materialize-sass 1.0.0.beta → 1.0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +1 -0
  3. data/README.md +2 -2
  4. data/Rakefile +1 -1
  5. data/assets/javascripts/materialize/autocomplete.js +94 -37
  6. data/assets/javascripts/materialize/buttons.js +4 -6
  7. data/assets/javascripts/materialize/carousel.js +9 -9
  8. data/assets/javascripts/materialize/chips.js +2 -2
  9. data/assets/javascripts/materialize/collapsible.js +13 -10
  10. data/assets/javascripts/materialize/datepicker.js +27 -44
  11. data/assets/javascripts/materialize/dropdown.js +38 -15
  12. data/assets/javascripts/materialize/extras/nouislider.js +1 -1
  13. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  14. data/assets/javascripts/materialize/forms.js +7 -8
  15. data/assets/javascripts/materialize/global.js +28 -11
  16. data/assets/javascripts/materialize/materialbox.js +12 -7
  17. data/assets/javascripts/materialize/modal.js +8 -4
  18. data/assets/javascripts/materialize/parallax.js +1 -1
  19. data/assets/javascripts/materialize/pushpin.js +8 -3
  20. data/assets/javascripts/materialize/range.js +2 -19
  21. data/assets/javascripts/materialize/select.js +57 -33
  22. data/assets/javascripts/materialize/sidenav.js +5 -3
  23. data/assets/javascripts/materialize/slider.js +2 -1
  24. data/assets/javascripts/materialize/tabs.js +13 -8
  25. data/assets/javascripts/materialize/timepicker.js +22 -5
  26. data/assets/javascripts/materialize/toasts.js +4 -3
  27. data/assets/javascripts/materialize/tooltip.js +14 -8
  28. data/assets/javascripts/materialize.js +804 -685
  29. data/assets/stylesheets/materialize/components/_buttons.scss +2 -1
  30. data/assets/stylesheets/materialize/components/_collapsible.scss +8 -1
  31. data/assets/stylesheets/materialize/components/_datepicker.scss +5 -1
  32. data/assets/stylesheets/materialize/components/_dropdown.scss +10 -1
  33. data/assets/stylesheets/materialize/components/_global.scss +2 -0
  34. data/assets/stylesheets/materialize/components/_modal.scss +4 -0
  35. data/assets/stylesheets/materialize/components/_sidenav.scss +9 -17
  36. data/assets/stylesheets/materialize/components/_toast.scss +0 -1
  37. data/assets/stylesheets/materialize/components/_variables.scss +1 -0
  38. data/assets/stylesheets/materialize/components/forms/_input-fields.scss +2 -0
  39. data/assets/stylesheets/materialize/components/forms/_range.scss +3 -3
  40. data/assets/stylesheets/materialize/components/forms/_select.scss +19 -7
  41. data/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  42. data/lib/materialize-sass/engine.rb +4 -1
  43. data/lib/materialize-sass/version.rb +1 -1
  44. data/lib/materialize-sass.rb +3 -8
  45. data/materialize-sass.gemspec +4 -5
  46. metadata +18 -32
@@ -186,7 +186,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
186
186
  key: '_handleInterval',
187
187
  value: function _handleInterval() {
188
188
  var newActiveIndex = this.$slider.find('.active').index();
189
- if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0; // loop to start
189
+ if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0;
190
+ // loop to start
190
191
  else newActiveIndex += 1;
191
192
 
192
193
  this.set(newActiveIndex);
@@ -52,16 +52,19 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
52
52
  // Setup
53
53
  _this.$tabLinks = _this.$el.children('li.tab').children('a');
54
54
  _this.index = 0;
55
- _this._setTabsAndTabWidth();
56
55
  _this._setupActiveTabLink();
57
- _this._createIndicator();
58
56
 
57
+ // Setup tabs content
59
58
  if (_this.options.swipeable) {
60
59
  _this._setupSwipeableTabs();
61
60
  } else {
62
61
  _this._setupNormalTabs();
63
62
  }
64
63
 
64
+ // Setup tabs indicator after content to ensure accurate widths
65
+ _this._setTabsAndTabWidth();
66
+ _this._createIndicator();
67
+
65
68
  _this._setupEventHandlers();
66
69
  return _this;
67
70
  }
@@ -150,12 +153,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
150
153
  }
151
154
 
152
155
  // Act as regular link if target attribute is specified.
153
- if (!!tabLink.attr("target")) {
156
+ if (!!tabLink.attr('target')) {
154
157
  return;
155
158
  }
156
159
 
157
- this._setTabsAndTabWidth();
158
-
159
160
  // Make the old tab inactive.
160
161
  this.$activeTabLink.removeClass('active');
161
162
  var $oldContent = this.$content;
@@ -174,7 +175,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
174
175
  if (this.options.swipeable) {
175
176
  if (this._tabsCarousel) {
176
177
  this._tabsCarousel.set(this.index, function () {
177
- if (typeof _this2.options.onShow === "function") {
178
+ if (typeof _this2.options.onShow === 'function') {
178
179
  _this2.options.onShow.call(_this2, _this2.$content[0]);
179
180
  }
180
181
  });
@@ -194,6 +195,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
194
195
  }
195
196
  }
196
197
 
198
+ // Update widths after content is swapped (scrollbar bugfix)
199
+ this._setTabsAndTabWidth();
200
+
197
201
  // Update indicator
198
202
  this._animateIndicator(prevIndex);
199
203
 
@@ -290,7 +294,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
290
294
  _this4.$activeTabLink = _this4.$tabLinks.eq(_this4.index);
291
295
  _this4.$activeTabLink.addClass('active');
292
296
  _this4._animateIndicator(prevIndex);
293
- if (typeof _this4.options.onShow === "function") {
297
+ if (typeof _this4.options.onShow === 'function') {
294
298
  _this4.options.onShow.call(_this4, _this4.$content[0]);
295
299
  }
296
300
  }
@@ -386,6 +390,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
386
390
  }, {
387
391
  key: 'updateTabIndicator',
388
392
  value: function updateTabIndicator() {
393
+ this._setTabsAndTabWidth();
389
394
  this._animateIndicator(this.index);
390
395
  }
391
396
 
@@ -463,7 +468,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
463
468
  return Tabs;
464
469
  }(Component);
465
470
 
466
- window.M.Tabs = Tabs;
471
+ M.Tabs = Tabs;
467
472
 
468
473
  if (M.jQueryLoaded) {
469
474
  M.initializeJqueryWrapper(Tabs, 'tabs', 'M_Tabs');
@@ -31,7 +31,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
31
31
 
32
32
  autoClose: false, // auto close when minute is selected
33
33
  twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
34
- vibrate: true // vibrate the device when dragging clock hand
34
+ vibrate: true, // vibrate the device when dragging clock hand
35
+
36
+ // Callbacks
37
+ onOpenStart: null,
38
+ onOpenEnd: null,
39
+ onCloseStart: null,
40
+ onCloseEnd: null,
41
+ onSelect: null
35
42
  };
36
43
 
37
44
  /**
@@ -175,6 +182,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
175
182
  }, this.options.duration / 2);
176
183
  }
177
184
 
185
+ if (typeof this.options.onSelect === 'function') {
186
+ this.options.onSelect.call(this, this.hours, this.minutes);
187
+ }
188
+
178
189
  // Unbind mousemove event
179
190
  document.removeEventListener('mousemove', this._handleDocumentClickMoveBound);
180
191
  document.removeEventListener('touchmove', this._handleDocumentClickMoveBound);
@@ -200,7 +211,13 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
200
211
  var _this3 = this;
201
212
 
202
213
  this.modal = M.Modal.init(this.modalEl, {
214
+ onOpenStart: this.options.onOpenStart,
215
+ onOpenEnd: this.options.onOpenEnd,
216
+ onCloseStart: this.options.onCloseStart,
203
217
  onCloseEnd: function () {
218
+ if (typeof _this3.options.onCloseEnd === 'function') {
219
+ _this3.options.onCloseEnd.call(_this3);
220
+ }
204
221
  _this3.isOpen = false;
205
222
  }
206
223
  });
@@ -225,7 +242,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
225
242
  }, {
226
243
  key: '_pickerSetup',
227
244
  value: function _pickerSetup() {
228
-
229
245
  var $clearBtn = $('<button class="btn-flat timepicker-clear waves-effect" style="visibility: hidden;" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.clear + '</button>').appendTo(this.footer).on('click', this.clear.bind(this));
230
246
  if (this.options.showClearBtn) {
231
247
  $clearBtn.css({ visibility: '' });
@@ -357,12 +373,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
357
373
  // Get the time
358
374
  var value = ((this.el.value || this.options.defaultTime || '') + '').split(':');
359
375
  if (this.options.twelveHour && !(typeof value[1] === 'undefined')) {
360
- if (value[1].toUpperCase().indexOf("AM") > 0) {
376
+ if (value[1].toUpperCase().indexOf('AM') > 0) {
361
377
  this.amOrPm = 'AM';
362
378
  } else {
363
379
  this.amOrPm = 'PM';
364
380
  }
365
- value[1] = value[1].replace("AM", "").replace("PM", "");
381
+ value[1] = value[1].replace('AM', '').replace('PM', '');
366
382
  }
367
383
  if (value[0] === 'now') {
368
384
  var now = new Date(+new Date() + this.options.fromNow);
@@ -381,7 +397,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
381
397
  }, {
382
398
  key: 'showView',
383
399
  value: function showView(view, delay) {
384
- if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
400
+ if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') {
385
401
  // raiseCallback(this.options.beforeHourSelect);
386
402
  }
387
403
  var isHours = view === 'hours',
@@ -519,6 +535,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
519
535
  this.isOpen = true;
520
536
  this._updateTimeFromInput();
521
537
  this.showView('hours');
538
+
522
539
  this.modal.open();
523
540
  }
524
541
  }, {
@@ -46,6 +46,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
46
46
  var toastElement = this._createToast();
47
47
  toastElement.M_Toast = this;
48
48
  this.el = toastElement;
49
+ this.$el = $(toastElement);
49
50
  this._animateIn();
50
51
  this._setTimer();
51
52
  }
@@ -96,7 +97,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
96
97
  targets: this.el,
97
98
  top: 0,
98
99
  opacity: 1,
99
- duration: 300,
100
+ duration: this.options.inDuration,
100
101
  easing: 'easeOutCubic'
101
102
  });
102
103
  }
@@ -156,7 +157,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
156
157
  _this2.options.completeCallback();
157
158
  }
158
159
  // Remove toast from DOM
159
- _this2.el.parentNode.removeChild(_this2.el);
160
+ _this2.$el.remove();
160
161
  Toast._toasts.splice(Toast._toasts.indexOf(_this2), 1);
161
162
  if (Toast._toasts.length === 0) {
162
163
  Toast._removeContainer();
@@ -210,7 +211,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
210
211
  document.removeEventListener('mousemove', Toast._onDragMove);
211
212
  document.removeEventListener('mouseup', Toast._onDragEnd);
212
213
 
213
- Toast._container.parentNode.removeChild(Toast._container);
214
+ $(Toast._container).remove();
214
215
  Toast._container = null;
215
216
  }
216
217
 
@@ -104,16 +104,16 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
104
104
  }
105
105
  }, {
106
106
  key: 'open',
107
- value: function open() {
107
+ value: function open(isManual) {
108
108
  if (this.isOpen) {
109
109
  return;
110
110
  }
111
-
111
+ isManual = isManual === undefined ? true : undefined; // Default value true
112
112
  this.isOpen = true;
113
113
  // Update tooltip content with HTML attribute options
114
114
  this.options = $.extend({}, this.options, this._getAttributeOptions());
115
115
  this._updateTooltipContent();
116
- this._setEnterDelayTimeout();
116
+ this._setEnterDelayTimeout(isManual);
117
117
  }
118
118
  }, {
119
119
  key: 'close',
@@ -122,6 +122,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
122
122
  return;
123
123
  }
124
124
 
125
+ this.isHovered = false;
126
+ this.isFocused = false;
125
127
  this.isOpen = false;
126
128
  this._setExitDelayTimeout();
127
129
  }
@@ -152,13 +154,13 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
152
154
 
153
155
  }, {
154
156
  key: '_setEnterDelayTimeout',
155
- value: function _setEnterDelayTimeout() {
157
+ value: function _setEnterDelayTimeout(isManual) {
156
158
  var _this3 = this;
157
159
 
158
160
  clearTimeout(this._enterDelayTimeout);
159
161
 
160
162
  this._enterDelayTimeout = setTimeout(function () {
161
- if (!_this3.isHovered && !_this3.isFocused) {
163
+ if (!_this3.isHovered && !_this3.isFocused && !isManual) {
162
164
  return;
163
165
  }
164
166
 
@@ -275,19 +277,23 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
275
277
  key: '_handleMouseEnter',
276
278
  value: function _handleMouseEnter() {
277
279
  this.isHovered = true;
278
- this.open();
280
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
281
+ this.open(false);
279
282
  }
280
283
  }, {
281
284
  key: '_handleMouseLeave',
282
285
  value: function _handleMouseLeave() {
283
286
  this.isHovered = false;
287
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
284
288
  this.close();
285
289
  }
286
290
  }, {
287
291
  key: '_handleFocus',
288
292
  value: function _handleFocus() {
289
- this.isFocused = true;
290
- this.open();
293
+ if (M.tabPressed) {
294
+ this.isFocused = true;
295
+ this.open(false);
296
+ }
291
297
  }
292
298
  }, {
293
299
  key: '_handleBlur',
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v1.0.0-beta (http://materializecss.com)
2
+ * Materialize v1.0.0 (http://materializecss.com)
3
3
  * Copyright 2014-2017 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
5
  */
@@ -1071,8 +1071,8 @@ var Component = function () {
1071
1071
  })(window);
1072
1072
 
1073
1073
  // AMD
1074
- if (typeof define === "function" && define.amd) {
1075
- define("M", [], function () {
1074
+ if (typeof define === 'function' && define.amd) {
1075
+ define('M', [], function () {
1076
1076
  return M;
1077
1077
  });
1078
1078
 
@@ -1084,6 +1084,8 @@ if (typeof define === "function" && define.amd) {
1084
1084
  exports.default = M;
1085
1085
  }
1086
1086
 
1087
+ M.version = '1.0.0';
1088
+
1087
1089
  M.keys = {
1088
1090
  TAB: 9,
1089
1091
  ENTER: 13,
@@ -1096,18 +1098,31 @@ M.keys = {
1096
1098
  * TabPress Keydown handler
1097
1099
  */
1098
1100
  M.tabPressed = false;
1101
+ M.keyDown = false;
1099
1102
  var docHandleKeydown = function (e) {
1100
- if (e.which === M.keys.TAB) {
1103
+ M.keyDown = true;
1104
+ if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) {
1101
1105
  M.tabPressed = true;
1102
1106
  }
1103
1107
  };
1104
1108
  var docHandleKeyup = function (e) {
1105
- if (e.which === M.keys.TAB) {
1109
+ M.keyDown = false;
1110
+ if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) {
1106
1111
  M.tabPressed = false;
1107
1112
  }
1108
1113
  };
1109
- document.addEventListener('keydown', docHandleKeydown);
1110
- document.addEventListener('keyup', docHandleKeyup);
1114
+ var docHandleFocus = function (e) {
1115
+ if (M.keyDown) {
1116
+ document.body.classList.add('keyboard-focused');
1117
+ }
1118
+ };
1119
+ var docHandleBlur = function (e) {
1120
+ document.body.classList.remove('keyboard-focused');
1121
+ };
1122
+ document.addEventListener('keydown', docHandleKeydown, true);
1123
+ document.addEventListener('keyup', docHandleKeyup, true);
1124
+ document.addEventListener('focus', docHandleFocus, true);
1125
+ document.addEventListener('blur', docHandleBlur, true);
1111
1126
 
1112
1127
  /**
1113
1128
  * Initialize jQuery wrapper for plugin
@@ -1207,7 +1222,7 @@ M.guid = function () {
1207
1222
  * @returns {string}
1208
1223
  */
1209
1224
  M.escapeHash = function (hash) {
1210
- return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, "\\$1");
1225
+ return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1');
1211
1226
  };
1212
1227
 
1213
1228
  M.elementOrParentIsFixed = function (element) {
@@ -1215,7 +1230,7 @@ M.elementOrParentIsFixed = function (element) {
1215
1230
  var $checkElements = $element.add($element.parents());
1216
1231
  var isFixed = false;
1217
1232
  $checkElements.each(function () {
1218
- if ($(this).css("position") === "fixed") {
1233
+ if ($(this).css('position') === 'fixed') {
1219
1234
  isFixed = true;
1220
1235
  return false;
1221
1236
  }
@@ -1255,6 +1270,8 @@ M.checkWithinContainer = function (container, bounding, offset) {
1255
1270
  };
1256
1271
 
1257
1272
  var containerRect = container.getBoundingClientRect();
1273
+ // If body element is smaller than viewport, use viewport height instead.
1274
+ var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom;
1258
1275
 
1259
1276
  var scrollLeft = container.scrollLeft;
1260
1277
  var scrollTop = container.scrollTop;
@@ -1275,7 +1292,7 @@ M.checkWithinContainer = function (container, bounding, offset) {
1275
1292
  edges.top = true;
1276
1293
  }
1277
1294
 
1278
- if (scrolledY + bounding.height > containerRect.bottom - offset || scrolledY + bounding.height > window.innerHeight - offset) {
1295
+ if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) {
1279
1296
  edges.bottom = true;
1280
1297
  }
1281
1298
 
@@ -1358,7 +1375,7 @@ M.getIdFromTrigger = function (trigger) {
1358
1375
  if (id) {
1359
1376
  id = id.slice(1);
1360
1377
  } else {
1361
- id = "";
1378
+ id = '';
1362
1379
  }
1363
1380
  }
1364
1381
  return id;
@@ -1967,7 +1984,12 @@ $jscomp.polyfill = function (e, r, p, m) {
1967
1984
  }, {
1968
1985
  key: "_removeEventHandlers",
1969
1986
  value: function _removeEventHandlers() {
1987
+ var _this5 = this;
1988
+
1970
1989
  this.el.removeEventListener('click', this._handleCollapsibleClickBound);
1990
+ this.$headers.each(function (header) {
1991
+ header.removeEventListener('keydown', _this5._handleCollapsibleKeydownBound);
1992
+ });
1971
1993
  }
1972
1994
 
1973
1995
  /**
@@ -2017,7 +2039,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2017
2039
  }, {
2018
2040
  key: "_animateIn",
2019
2041
  value: function _animateIn(index) {
2020
- var _this5 = this;
2042
+ var _this6 = this;
2021
2043
 
2022
2044
  var $collapsibleLi = this.$el.children('li').eq(index);
2023
2045
  if ($collapsibleLi.length) {
@@ -2056,8 +2078,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2056
2078
  });
2057
2079
 
2058
2080
  // onOpenEnd callback
2059
- if (typeof _this5.options.onOpenEnd === 'function') {
2060
- _this5.options.onOpenEnd.call(_this5, $collapsibleLi[0]);
2081
+ if (typeof _this6.options.onOpenEnd === 'function') {
2082
+ _this6.options.onOpenEnd.call(_this6, $collapsibleLi[0]);
2061
2083
  }
2062
2084
  }
2063
2085
  });
@@ -2072,7 +2094,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2072
2094
  }, {
2073
2095
  key: "_animateOut",
2074
2096
  value: function _animateOut(index) {
2075
- var _this6 = this;
2097
+ var _this7 = this;
2076
2098
 
2077
2099
  var $collapsibleLi = this.$el.children('li').eq(index);
2078
2100
  if ($collapsibleLi.length) {
@@ -2095,8 +2117,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2095
2117
  });
2096
2118
 
2097
2119
  // onCloseEnd callback
2098
- if (typeof _this6.options.onCloseEnd === 'function') {
2099
- _this6.options.onCloseEnd.call(_this6, $collapsibleLi[0]);
2120
+ if (typeof _this7.options.onCloseEnd === 'function') {
2121
+ _this7.options.onCloseEnd.call(_this7, $collapsibleLi[0]);
2100
2122
  }
2101
2123
  }
2102
2124
  });
@@ -2111,11 +2133,10 @@ $jscomp.polyfill = function (e, r, p, m) {
2111
2133
  }, {
2112
2134
  key: "open",
2113
2135
  value: function open(index) {
2114
- var _this7 = this;
2136
+ var _this8 = this;
2115
2137
 
2116
2138
  var $collapsibleLi = this.$el.children('li').eq(index);
2117
2139
  if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) {
2118
-
2119
2140
  // onOpenStart callback
2120
2141
  if (typeof this.options.onOpenStart === 'function') {
2121
2142
  this.options.onOpenStart.call(this, $collapsibleLi[0]);
@@ -2127,7 +2148,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2127
2148
  var $activeLis = this.$el.children('li.active');
2128
2149
  $activeLis.each(function (el) {
2129
2150
  var index = $collapsibleLis.index($(el));
2130
- _this7.close(index);
2151
+ _this8.close(index);
2131
2152
  });
2132
2153
  }
2133
2154
 
@@ -2147,7 +2168,6 @@ $jscomp.polyfill = function (e, r, p, m) {
2147
2168
  value: function close(index) {
2148
2169
  var $collapsibleLi = this.$el.children('li').eq(index);
2149
2170
  if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) {
2150
-
2151
2171
  // onCloseStart callback
2152
2172
  if (typeof this.options.onCloseStart === 'function') {
2153
2173
  this.options.onCloseStart.call(this, $collapsibleLi[0]);
@@ -2206,7 +2226,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2206
2226
  onOpenStart: null,
2207
2227
  onOpenEnd: null,
2208
2228
  onCloseStart: null,
2209
- onCloseEnd: null
2229
+ onCloseEnd: null,
2230
+ onItemClick: null
2210
2231
  };
2211
2232
 
2212
2233
  /**
@@ -2219,14 +2240,14 @@ $jscomp.polyfill = function (e, r, p, m) {
2219
2240
  function Dropdown(el, options) {
2220
2241
  _classCallCheck(this, Dropdown);
2221
2242
 
2222
- var _this8 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options));
2243
+ var _this9 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options));
2223
2244
 
2224
- _this8.el.M_Dropdown = _this8;
2225
- Dropdown._dropdowns.push(_this8);
2245
+ _this9.el.M_Dropdown = _this9;
2246
+ Dropdown._dropdowns.push(_this9);
2226
2247
 
2227
- _this8.id = M.getIdFromTrigger(el);
2228
- _this8.dropdownEl = document.getElementById(_this8.id);
2229
- _this8.$dropdownEl = $(_this8.dropdownEl);
2248
+ _this9.id = M.getIdFromTrigger(el);
2249
+ _this9.dropdownEl = document.getElementById(_this9.id);
2250
+ _this9.$dropdownEl = $(_this9.dropdownEl);
2230
2251
 
2231
2252
  /**
2232
2253
  * Options for the dropdown
@@ -2245,44 +2266,45 @@ $jscomp.polyfill = function (e, r, p, m) {
2245
2266
  * @prop {Function} onCloseStart - Function called when dropdown starts closing
2246
2267
  * @prop {Function} onCloseEnd - Function called when dropdown finishes closing
2247
2268
  */
2248
- _this8.options = $.extend({}, Dropdown.defaults, options);
2269
+ _this9.options = $.extend({}, Dropdown.defaults, options);
2249
2270
 
2250
2271
  /**
2251
2272
  * Describes open/close state of dropdown
2252
2273
  * @type {Boolean}
2253
2274
  */
2254
- _this8.isOpen = false;
2275
+ _this9.isOpen = false;
2255
2276
 
2256
2277
  /**
2257
2278
  * Describes if dropdown content is scrollable
2258
2279
  * @type {Boolean}
2259
2280
  */
2260
- _this8.isScrollable = false;
2281
+ _this9.isScrollable = false;
2261
2282
 
2262
2283
  /**
2263
2284
  * Describes if touch moving on dropdown content
2264
2285
  * @type {Boolean}
2265
2286
  */
2266
- _this8.isTouchMoving = false;
2287
+ _this9.isTouchMoving = false;
2267
2288
 
2268
- _this8.focusedIndex = -1;
2269
- _this8.filterQuery = [];
2289
+ _this9.focusedIndex = -1;
2290
+ _this9.filterQuery = [];
2270
2291
 
2271
2292
  // Move dropdown-content after dropdown-trigger
2272
- if (!!_this8.options.container) {
2273
- $(_this8.options.container).append(_this8.dropdownEl);
2293
+ if (!!_this9.options.container) {
2294
+ $(_this9.options.container).append(_this9.dropdownEl);
2274
2295
  } else {
2275
- _this8.$el.after(_this8.dropdownEl);
2276
- }
2277
-
2278
- _this8._makeDropdownFocusable();
2279
- _this8._resetFilterQueryBound = _this8._resetFilterQuery.bind(_this8);
2280
- _this8._handleDocumentClickBound = _this8._handleDocumentClick.bind(_this8);
2281
- _this8._handleDocumentTouchmoveBound = _this8._handleDocumentTouchmove.bind(_this8);
2282
- _this8._handleDropdownKeydownBound = _this8._handleDropdownKeydown.bind(_this8);
2283
- _this8._handleTriggerKeydownBound = _this8._handleTriggerKeydown.bind(_this8);
2284
- _this8._setupEventHandlers();
2285
- return _this8;
2296
+ _this9.$el.after(_this9.dropdownEl);
2297
+ }
2298
+
2299
+ _this9._makeDropdownFocusable();
2300
+ _this9._resetFilterQueryBound = _this9._resetFilterQuery.bind(_this9);
2301
+ _this9._handleDocumentClickBound = _this9._handleDocumentClick.bind(_this9);
2302
+ _this9._handleDocumentTouchmoveBound = _this9._handleDocumentTouchmove.bind(_this9);
2303
+ _this9._handleDropdownClickBound = _this9._handleDropdownClick.bind(_this9);
2304
+ _this9._handleDropdownKeydownBound = _this9._handleDropdownKeydown.bind(_this9);
2305
+ _this9._handleTriggerKeydownBound = _this9._handleTriggerKeydown.bind(_this9);
2306
+ _this9._setupEventHandlers();
2307
+ return _this9;
2286
2308
  }
2287
2309
 
2288
2310
  _createClass(Dropdown, [{
@@ -2309,6 +2331,9 @@ $jscomp.polyfill = function (e, r, p, m) {
2309
2331
  // Trigger keydown handler
2310
2332
  this.el.addEventListener('keydown', this._handleTriggerKeydownBound);
2311
2333
 
2334
+ // Item click handler
2335
+ this.dropdownEl.addEventListener('click', this._handleDropdownClickBound);
2336
+
2312
2337
  // Hover event handlers
2313
2338
  if (this.options.hover) {
2314
2339
  this._handleMouseEnterBound = this._handleMouseEnter.bind(this);
@@ -2331,13 +2356,13 @@ $jscomp.polyfill = function (e, r, p, m) {
2331
2356
  }, {
2332
2357
  key: "_removeEventHandlers",
2333
2358
  value: function _removeEventHandlers() {
2334
- // Trigger keydown handler
2335
2359
  this.el.removeEventListener('keydown', this._handleTriggerKeydownBound);
2360
+ this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound);
2336
2361
 
2337
2362
  if (this.options.hover) {
2338
- this.el.removeEventHandlers('mouseenter', this._handleMouseEnterBound);
2339
- this.el.removeEventHandlers('mouseleave', this._handleMouseLeaveBound);
2340
- this.dropdownEl.removeEventHandlers('mouseleave', this._handleMouseLeaveBound);
2363
+ this.el.removeEventListener('mouseenter', this._handleMouseEnterBound);
2364
+ this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound);
2365
+ this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound);
2341
2366
  } else {
2342
2367
  this.el.removeEventListener('click', this._handleClickBound);
2343
2368
  }
@@ -2391,17 +2416,17 @@ $jscomp.polyfill = function (e, r, p, m) {
2391
2416
  }, {
2392
2417
  key: "_handleDocumentClick",
2393
2418
  value: function _handleDocumentClick(e) {
2394
- var _this9 = this;
2419
+ var _this10 = this;
2395
2420
 
2396
2421
  var $target = $(e.target);
2397
2422
  if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) {
2398
2423
  // isTouchMoving to check if scrolling on mobile.
2399
2424
  setTimeout(function () {
2400
- _this9.close();
2425
+ _this10.close();
2401
2426
  }, 0);
2402
2427
  } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) {
2403
2428
  setTimeout(function () {
2404
- _this9.close();
2429
+ _this10.close();
2405
2430
  }, 0);
2406
2431
  }
2407
2432
  this.isTouchMoving = false;
@@ -2430,6 +2455,21 @@ $jscomp.polyfill = function (e, r, p, m) {
2430
2455
  }
2431
2456
  }
2432
2457
 
2458
+ /**
2459
+ * Handle Dropdown Click
2460
+ * @param {Event} e
2461
+ */
2462
+
2463
+ }, {
2464
+ key: "_handleDropdownClick",
2465
+ value: function _handleDropdownClick(e) {
2466
+ // onItemClick callback
2467
+ if (typeof this.options.onItemClick === 'function') {
2468
+ var itemEl = $(e.target).closest('li')[0];
2469
+ this.options.onItemClick.call(this, itemEl);
2470
+ }
2471
+ }
2472
+
2433
2473
  /**
2434
2474
  * Handle Dropdown Keydown
2435
2475
  * @param {Event} e
@@ -2469,7 +2509,11 @@ $jscomp.polyfill = function (e, r, p, m) {
2469
2509
  var $activatableElement = $(focusedElement).find('a, button').first();
2470
2510
 
2471
2511
  // Click a or button tag if exists, otherwise click li tag
2472
- !!$activatableElement.length ? $activatableElement[0].click() : focusedElement.click();
2512
+ if (!!$activatableElement.length) {
2513
+ $activatableElement[0].click();
2514
+ } else if (!!focusedElement) {
2515
+ focusedElement.click();
2516
+ }
2473
2517
 
2474
2518
  // Close dropdown on ESC
2475
2519
  } else if (e.which === M.keys.ESC && this.isOpen) {
@@ -2560,7 +2604,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2560
2604
  };
2561
2605
 
2562
2606
  // Countainer here will be closest ancestor with overflow: hidden
2563
- var closestOverflowParent = this.dropdownEl.offsetParent;
2607
+ var closestOverflowParent = !!this.dropdownEl.offsetParent ? this.dropdownEl.offsetParent : this.dropdownEl.parentNode;
2608
+
2564
2609
  var alignments = M.checkPossibleAlignments(this.el, closestOverflowParent, dropdownBounds, this.options.coverTrigger ? 0 : triggerBRect.height);
2565
2610
 
2566
2611
  var verticalAlignment = 'top';
@@ -2628,7 +2673,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2628
2673
  }, {
2629
2674
  key: "_animateIn",
2630
2675
  value: function _animateIn() {
2631
- var _this10 = this;
2676
+ var _this11 = this;
2632
2677
 
2633
2678
  anim.remove(this.dropdownEl);
2634
2679
  anim({
@@ -2637,19 +2682,18 @@ $jscomp.polyfill = function (e, r, p, m) {
2637
2682
  value: [0, 1],
2638
2683
  easing: 'easeOutQuad'
2639
2684
  },
2640
- scaleX: [.3, 1],
2641
- scaleY: [.3, 1],
2685
+ scaleX: [0.3, 1],
2686
+ scaleY: [0.3, 1],
2642
2687
  duration: this.options.inDuration,
2643
2688
  easing: 'easeOutQuint',
2644
2689
  complete: function (anim) {
2645
- if (_this10.options.autoFocus) {
2646
- _this10.dropdownEl.focus();
2690
+ if (_this11.options.autoFocus) {
2691
+ _this11.dropdownEl.focus();
2647
2692
  }
2648
2693
 
2649
2694
  // onOpenEnd callback
2650
- if (typeof _this10.options.onOpenEnd === 'function') {
2651
- var elem = anim.animatables[0].target;
2652
- _this10.options.onOpenEnd.call(elem, _this10.el);
2695
+ if (typeof _this11.options.onOpenEnd === 'function') {
2696
+ _this11.options.onOpenEnd.call(_this11, _this11.el);
2653
2697
  }
2654
2698
  }
2655
2699
  });
@@ -2662,7 +2706,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2662
2706
  }, {
2663
2707
  key: "_animateOut",
2664
2708
  value: function _animateOut() {
2665
- var _this11 = this;
2709
+ var _this12 = this;
2666
2710
 
2667
2711
  anim.remove(this.dropdownEl);
2668
2712
  anim({
@@ -2671,17 +2715,16 @@ $jscomp.polyfill = function (e, r, p, m) {
2671
2715
  value: 0,
2672
2716
  easing: 'easeOutQuint'
2673
2717
  },
2674
- scaleX: .3,
2675
- scaleY: .3,
2718
+ scaleX: 0.3,
2719
+ scaleY: 0.3,
2676
2720
  duration: this.options.outDuration,
2677
2721
  easing: 'easeOutQuint',
2678
2722
  complete: function (anim) {
2679
- _this11._resetDropdownStyles();
2723
+ _this12._resetDropdownStyles();
2680
2724
 
2681
2725
  // onCloseEnd callback
2682
- if (typeof _this11.options.onCloseEnd === 'function') {
2683
- var elem = anim.animatables[0].target;
2684
- _this11.options.onCloseEnd.call(_this11, _this11.el);
2726
+ if (typeof _this12.options.onCloseEnd === 'function') {
2727
+ _this12.options.onCloseEnd.call(_this12, _this12.el);
2685
2728
  }
2686
2729
  }
2687
2730
  });
@@ -2810,7 +2853,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2810
2853
 
2811
2854
  Dropdown._dropdowns = [];
2812
2855
 
2813
- window.M.Dropdown = Dropdown;
2856
+ M.Dropdown = Dropdown;
2814
2857
 
2815
2858
  if (M.jQueryLoaded) {
2816
2859
  M.initializeJqueryWrapper(Dropdown, 'dropdown', 'M_Dropdown');
@@ -2850,9 +2893,9 @@ $jscomp.polyfill = function (e, r, p, m) {
2850
2893
  function Modal(el, options) {
2851
2894
  _classCallCheck(this, Modal);
2852
2895
 
2853
- var _this12 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
2896
+ var _this13 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
2854
2897
 
2855
- _this12.el.M_Modal = _this12;
2898
+ _this13.el.M_Modal = _this13;
2856
2899
 
2857
2900
  /**
2858
2901
  * Options for the modal
@@ -2868,22 +2911,23 @@ $jscomp.polyfill = function (e, r, p, m) {
2868
2911
  * @prop {String} [startingTop='4%'] - startingTop
2869
2912
  * @prop {String} [endingTop='10%'] - endingTop
2870
2913
  */
2871
- _this12.options = $.extend({}, Modal.defaults, options);
2914
+ _this13.options = $.extend({}, Modal.defaults, options);
2872
2915
 
2873
2916
  /**
2874
2917
  * Describes open/close state of modal
2875
2918
  * @type {Boolean}
2876
2919
  */
2877
- _this12.isOpen = false;
2920
+ _this13.isOpen = false;
2878
2921
 
2879
- _this12.id = _this12.$el.attr('id');
2880
- _this12._openingTrigger = undefined;
2881
- _this12.$overlay = $('<div class="modal-overlay"></div>');
2882
- _this12.el.tabIndex = 0;
2922
+ _this13.id = _this13.$el.attr('id');
2923
+ _this13._openingTrigger = undefined;
2924
+ _this13.$overlay = $('<div class="modal-overlay"></div>');
2925
+ _this13.el.tabIndex = 0;
2926
+ _this13._nthModalOpened = 0;
2883
2927
 
2884
2928
  Modal._count++;
2885
- _this12._setupEventHandlers();
2886
- return _this12;
2929
+ _this13._setupEventHandlers();
2930
+ return _this13;
2887
2931
  }
2888
2932
 
2889
2933
  _createClass(Modal, [{
@@ -2999,7 +3043,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2999
3043
  }, {
3000
3044
  key: "_handleFocus",
3001
3045
  value: function _handleFocus(e) {
3002
- if (!this.el.contains(e.target)) {
3046
+ // Only trap focus if this modal is the last model opened (prevents loops in nested modals).
3047
+ if (!this.el.contains(e.target) && this._nthModalOpened === Modal._modalsOpen) {
3003
3048
  this.el.focus();
3004
3049
  }
3005
3050
  }
@@ -3011,7 +3056,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3011
3056
  }, {
3012
3057
  key: "_animateIn",
3013
3058
  value: function _animateIn() {
3014
- var _this13 = this;
3059
+ var _this14 = this;
3015
3060
 
3016
3061
  // Set initial styles
3017
3062
  $.extend(this.el.style, {
@@ -3038,8 +3083,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3038
3083
  easing: 'easeOutCubic',
3039
3084
  // Handle modal onOpenEnd callback
3040
3085
  complete: function () {
3041
- if (typeof _this13.options.onOpenEnd === 'function') {
3042
- _this13.options.onOpenEnd.call(_this13, _this13.el, _this13._openingTrigger);
3086
+ if (typeof _this14.options.onOpenEnd === 'function') {
3087
+ _this14.options.onOpenEnd.call(_this14, _this14.el, _this14._openingTrigger);
3043
3088
  }
3044
3089
  }
3045
3090
  };
@@ -3057,8 +3102,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3057
3102
  $.extend(enterAnimOptions, {
3058
3103
  top: [this.options.startingTop, this.options.endingTop],
3059
3104
  opacity: 1,
3060
- scaleX: [.8, 1],
3061
- scaleY: [.8, 1]
3105
+ scaleX: [0.8, 1],
3106
+ scaleY: [0.8, 1]
3062
3107
  });
3063
3108
  anim(enterAnimOptions);
3064
3109
  }
@@ -3071,7 +3116,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3071
3116
  }, {
3072
3117
  key: "_animateOut",
3073
3118
  value: function _animateOut() {
3074
- var _this14 = this;
3119
+ var _this15 = this;
3075
3120
 
3076
3121
  // Animate overlay
3077
3122
  anim({
@@ -3088,12 +3133,12 @@ $jscomp.polyfill = function (e, r, p, m) {
3088
3133
  easing: 'easeOutCubic',
3089
3134
  // Handle modal ready callback
3090
3135
  complete: function () {
3091
- _this14.el.style.display = 'none';
3092
- _this14.$overlay.remove();
3136
+ _this15.el.style.display = 'none';
3137
+ _this15.$overlay.remove();
3093
3138
 
3094
3139
  // Call onCloseEnd callback
3095
- if (typeof _this14.options.onCloseEnd === 'function') {
3096
- _this14.options.onCloseEnd.call(_this14, _this14.el);
3140
+ if (typeof _this15.options.onCloseEnd === 'function') {
3141
+ _this15.options.onCloseEnd.call(_this15, _this15.el);
3097
3142
  }
3098
3143
  }
3099
3144
  };
@@ -3132,6 +3177,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3132
3177
 
3133
3178
  this.isOpen = true;
3134
3179
  Modal._modalsOpen++;
3180
+ this._nthModalOpened = Modal._modalsOpen;
3135
3181
 
3136
3182
  // Set Z-Index based on number of currently open modals
3137
3183
  this.$overlay[0].style.zIndex = 1000 + Modal._modalsOpen * 2;
@@ -3182,6 +3228,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3182
3228
 
3183
3229
  this.isOpen = false;
3184
3230
  Modal._modalsOpen--;
3231
+ this._nthModalOpened = 0;
3185
3232
 
3186
3233
  // Call onCloseStart callback
3187
3234
  if (typeof this.options.onCloseStart === 'function') {
@@ -3197,7 +3244,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3197
3244
 
3198
3245
  if (this.options.dismissible) {
3199
3246
  document.removeEventListener('keydown', this._handleKeydownBound);
3200
- document.removeEventListener('focus', this._handleFocusBound);
3247
+ document.removeEventListener('focus', this._handleFocusBound, true);
3201
3248
  }
3202
3249
 
3203
3250
  anim.remove(this.el);
@@ -3280,9 +3327,9 @@ $jscomp.polyfill = function (e, r, p, m) {
3280
3327
  function Materialbox(el, options) {
3281
3328
  _classCallCheck(this, Materialbox);
3282
3329
 
3283
- var _this15 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
3330
+ var _this16 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
3284
3331
 
3285
- _this15.el.M_Materialbox = _this15;
3332
+ _this16.el.M_Materialbox = _this16;
3286
3333
 
3287
3334
  /**
3288
3335
  * Options for the modal
@@ -3294,22 +3341,22 @@ $jscomp.polyfill = function (e, r, p, m) {
3294
3341
  * @prop {Function} onCloseStart - Callback function called before materialbox is closed
3295
3342
  * @prop {Function} onCloseEnd - Callback function called after materialbox is closed
3296
3343
  */
3297
- _this15.options = $.extend({}, Materialbox.defaults, options);
3344
+ _this16.options = $.extend({}, Materialbox.defaults, options);
3298
3345
 
3299
- _this15.overlayActive = false;
3300
- _this15.doneAnimating = true;
3301
- _this15.placeholder = $('<div></div>').addClass('material-placeholder');
3302
- _this15.originalWidth = 0;
3303
- _this15.originalHeight = 0;
3304
- _this15.originInlineStyles = _this15.$el.attr('style');
3305
- _this15.caption = _this15.el.getAttribute('data-caption') || "";
3346
+ _this16.overlayActive = false;
3347
+ _this16.doneAnimating = true;
3348
+ _this16.placeholder = $('<div></div>').addClass('material-placeholder');
3349
+ _this16.originalWidth = 0;
3350
+ _this16.originalHeight = 0;
3351
+ _this16.originInlineStyles = _this16.$el.attr('style');
3352
+ _this16.caption = _this16.el.getAttribute('data-caption') || '';
3306
3353
 
3307
3354
  // Wrap
3308
- _this15.$el.before(_this15.placeholder);
3309
- _this15.placeholder.append(_this15.$el);
3355
+ _this16.$el.before(_this16.placeholder);
3356
+ _this16.placeholder.append(_this16.$el);
3310
3357
 
3311
- _this15._setupEventHandlers();
3312
- return _this15;
3358
+ _this16._setupEventHandlers();
3359
+ return _this16;
3313
3360
  }
3314
3361
 
3315
3362
  _createClass(Materialbox, [{
@@ -3322,6 +3369,11 @@ $jscomp.polyfill = function (e, r, p, m) {
3322
3369
  value: function destroy() {
3323
3370
  this._removeEventHandlers();
3324
3371
  this.el.M_Materialbox = undefined;
3372
+
3373
+ // Unwrap image
3374
+ $(this.placeholder).after(this.el).remove();
3375
+
3376
+ this.$el.removeAttr('style');
3325
3377
  }
3326
3378
 
3327
3379
  /**
@@ -3429,7 +3481,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3429
3481
  }, {
3430
3482
  key: "_animateImageIn",
3431
3483
  value: function _animateImageIn() {
3432
- var _this16 = this;
3484
+ var _this17 = this;
3433
3485
 
3434
3486
  var animOptions = {
3435
3487
  targets: this.el,
@@ -3440,11 +3492,11 @@ $jscomp.polyfill = function (e, r, p, m) {
3440
3492
  duration: this.options.inDuration,
3441
3493
  easing: 'easeOutQuad',
3442
3494
  complete: function () {
3443
- _this16.doneAnimating = true;
3495
+ _this17.doneAnimating = true;
3444
3496
 
3445
3497
  // onOpenEnd callback
3446
- if (typeof _this16.options.onOpenEnd === 'function') {
3447
- _this16.options.onOpenEnd.call(_this16, _this16.el);
3498
+ if (typeof _this17.options.onOpenEnd === 'function') {
3499
+ _this17.options.onOpenEnd.call(_this17, _this17.el);
3448
3500
  }
3449
3501
  }
3450
3502
  };
@@ -3469,7 +3521,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3469
3521
  }, {
3470
3522
  key: "_animateImageOut",
3471
3523
  value: function _animateImageOut() {
3472
- var _this17 = this;
3524
+ var _this18 = this;
3473
3525
 
3474
3526
  var animOptions = {
3475
3527
  targets: this.el,
@@ -3480,7 +3532,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3480
3532
  duration: this.options.outDuration,
3481
3533
  easing: 'easeOutQuad',
3482
3534
  complete: function () {
3483
- _this17.placeholder.css({
3535
+ _this18.placeholder.css({
3484
3536
  height: '',
3485
3537
  width: '',
3486
3538
  position: '',
@@ -3489,28 +3541,28 @@ $jscomp.polyfill = function (e, r, p, m) {
3489
3541
  });
3490
3542
 
3491
3543
  // Revert to width or height attribute
3492
- if (_this17.attrWidth) {
3493
- _this17.$el.attr('width', _this17.attrWidth);
3544
+ if (_this18.attrWidth) {
3545
+ _this18.$el.attr('width', _this18.attrWidth);
3494
3546
  }
3495
- if (_this17.attrHeight) {
3496
- _this17.$el.attr('height', _this17.attrHeight);
3547
+ if (_this18.attrHeight) {
3548
+ _this18.$el.attr('height', _this18.attrHeight);
3497
3549
  }
3498
3550
 
3499
- _this17.$el.removeAttr('style');
3500
- _this17.$el.attr('style', _this17.originInlineStyles);
3551
+ _this18.$el.removeAttr('style');
3552
+ _this18.originInlineStyles && _this18.$el.attr('style', _this18.originInlineStyles);
3501
3553
 
3502
3554
  // Remove class
3503
- _this17.$el.removeClass('active');
3504
- _this17.doneAnimating = true;
3555
+ _this18.$el.removeClass('active');
3556
+ _this18.doneAnimating = true;
3505
3557
 
3506
3558
  // Remove overflow overrides on ancestors
3507
- if (_this17.ancestorsChanged.length) {
3508
- _this17.ancestorsChanged.css('overflow', '');
3559
+ if (_this18.ancestorsChanged.length) {
3560
+ _this18.ancestorsChanged.css('overflow', '');
3509
3561
  }
3510
3562
 
3511
3563
  // onCloseEnd callback
3512
- if (typeof _this17.options.onCloseEnd === 'function') {
3513
- _this17.options.onCloseEnd.call(_this17, _this17.el);
3564
+ if (typeof _this18.options.onCloseEnd === 'function') {
3565
+ _this18.options.onCloseEnd.call(_this18, _this18.el);
3514
3566
  }
3515
3567
  }
3516
3568
  };
@@ -3527,7 +3579,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3527
3579
  value: function _updateVars() {
3528
3580
  this.windowWidth = window.innerWidth;
3529
3581
  this.windowHeight = window.innerHeight;
3530
- this.caption = this.el.getAttribute('data-caption') || "";
3582
+ this.caption = this.el.getAttribute('data-caption') || '';
3531
3583
  }
3532
3584
 
3533
3585
  /**
@@ -3537,7 +3589,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3537
3589
  }, {
3538
3590
  key: "open",
3539
3591
  value: function open() {
3540
- var _this18 = this;
3592
+ var _this19 = this;
3541
3593
 
3542
3594
  this._updateVars();
3543
3595
  this.originalWidth = this.el.getBoundingClientRect().width;
@@ -3587,8 +3639,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3587
3639
  this.$overlay = $('<div id="materialbox-overlay"></div>').css({
3588
3640
  opacity: 0
3589
3641
  }).one('click', function () {
3590
- if (_this18.doneAnimating) {
3591
- _this18.close();
3642
+ if (_this19.doneAnimating) {
3643
+ _this19.close();
3592
3644
  }
3593
3645
  });
3594
3646
 
@@ -3616,14 +3668,14 @@ $jscomp.polyfill = function (e, r, p, m) {
3616
3668
  });
3617
3669
 
3618
3670
  // Add and animate caption if it exists
3619
- if (this.caption !== "") {
3671
+ if (this.caption !== '') {
3620
3672
  if (this.$photocaption) {
3621
3673
  anim.remove(this.$photoCaption[0]);
3622
3674
  }
3623
3675
  this.$photoCaption = $('<div class="materialbox-caption"></div>');
3624
3676
  this.$photoCaption.text(this.caption);
3625
3677
  $('body').append(this.$photoCaption);
3626
- this.$photoCaption.css({ "display": "inline" });
3678
+ this.$photoCaption.css({ display: 'inline' });
3627
3679
 
3628
3680
  anim({
3629
3681
  targets: this.$photoCaption[0],
@@ -3669,7 +3721,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3669
3721
  }, {
3670
3722
  key: "close",
3671
3723
  value: function close() {
3672
- var _this19 = this;
3724
+ var _this20 = this;
3673
3725
 
3674
3726
  this._updateVars();
3675
3727
  this.doneAnimating = false;
@@ -3682,7 +3734,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3682
3734
  anim.remove(this.el);
3683
3735
  anim.remove(this.$overlay[0]);
3684
3736
 
3685
- if (this.caption !== "") {
3737
+ if (this.caption !== '') {
3686
3738
  anim.remove(this.$photoCaption[0]);
3687
3739
  }
3688
3740
 
@@ -3697,22 +3749,22 @@ $jscomp.polyfill = function (e, r, p, m) {
3697
3749
  duration: this.options.outDuration,
3698
3750
  easing: 'easeOutQuad',
3699
3751
  complete: function () {
3700
- _this19.overlayActive = false;
3701
- _this19.$overlay.remove();
3752
+ _this20.overlayActive = false;
3753
+ _this20.$overlay.remove();
3702
3754
  }
3703
3755
  });
3704
3756
 
3705
3757
  this._animateImageOut();
3706
3758
 
3707
3759
  // Remove Caption + reset css settings on image
3708
- if (this.caption !== "") {
3760
+ if (this.caption !== '') {
3709
3761
  anim({
3710
3762
  targets: this.$photoCaption[0],
3711
3763
  opacity: 0,
3712
3764
  duration: this.options.outDuration,
3713
3765
  easing: 'easeOutQuad',
3714
3766
  complete: function () {
3715
- _this19.$photoCaption.remove();
3767
+ _this20.$photoCaption.remove();
3716
3768
  }
3717
3769
  });
3718
3770
  }
@@ -3762,30 +3814,30 @@ $jscomp.polyfill = function (e, r, p, m) {
3762
3814
  function Parallax(el, options) {
3763
3815
  _classCallCheck(this, Parallax);
3764
3816
 
3765
- var _this20 = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
3817
+ var _this21 = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
3766
3818
 
3767
- _this20.el.M_Parallax = _this20;
3819
+ _this21.el.M_Parallax = _this21;
3768
3820
 
3769
3821
  /**
3770
3822
  * Options for the Parallax
3771
3823
  * @member Parallax#options
3772
3824
  * @prop {Number} responsiveThreshold
3773
3825
  */
3774
- _this20.options = $.extend({}, Parallax.defaults, options);
3775
- _this20._enabled = window.innerWidth > _this20.options.responsiveThreshold;
3826
+ _this21.options = $.extend({}, Parallax.defaults, options);
3827
+ _this21._enabled = window.innerWidth > _this21.options.responsiveThreshold;
3776
3828
 
3777
- _this20.$img = _this20.$el.find('img').first();
3778
- _this20.$img.each(function () {
3829
+ _this21.$img = _this21.$el.find('img').first();
3830
+ _this21.$img.each(function () {
3779
3831
  var el = this;
3780
- if (el.complete) $(el).trigger("load");
3832
+ if (el.complete) $(el).trigger('load');
3781
3833
  });
3782
3834
 
3783
- _this20._updateParallax();
3784
- _this20._setupEventHandlers();
3785
- _this20._setupStyles();
3835
+ _this21._updateParallax();
3836
+ _this21._setupEventHandlers();
3837
+ _this21._setupStyles();
3786
3838
 
3787
- Parallax._parallaxes.push(_this20);
3788
- return _this20;
3839
+ Parallax._parallaxes.push(_this21);
3840
+ return _this21;
3789
3841
  }
3790
3842
 
3791
3843
  _createClass(Parallax, [{
@@ -3939,9 +3991,9 @@ $jscomp.polyfill = function (e, r, p, m) {
3939
3991
  function Tabs(el, options) {
3940
3992
  _classCallCheck(this, Tabs);
3941
3993
 
3942
- var _this21 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
3994
+ var _this22 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
3943
3995
 
3944
- _this21.el.M_Tabs = _this21;
3996
+ _this22.el.M_Tabs = _this22;
3945
3997
 
3946
3998
  /**
3947
3999
  * Options for the Tabs
@@ -3951,23 +4003,26 @@ $jscomp.polyfill = function (e, r, p, m) {
3951
4003
  * @prop {Boolean} swipeable
3952
4004
  * @prop {Number} responsiveThreshold
3953
4005
  */
3954
- _this21.options = $.extend({}, Tabs.defaults, options);
4006
+ _this22.options = $.extend({}, Tabs.defaults, options);
3955
4007
 
3956
4008
  // Setup
3957
- _this21.$tabLinks = _this21.$el.children('li.tab').children('a');
3958
- _this21.index = 0;
3959
- _this21._setTabsAndTabWidth();
3960
- _this21._setupActiveTabLink();
3961
- _this21._createIndicator();
3962
-
3963
- if (_this21.options.swipeable) {
3964
- _this21._setupSwipeableTabs();
4009
+ _this22.$tabLinks = _this22.$el.children('li.tab').children('a');
4010
+ _this22.index = 0;
4011
+ _this22._setupActiveTabLink();
4012
+
4013
+ // Setup tabs content
4014
+ if (_this22.options.swipeable) {
4015
+ _this22._setupSwipeableTabs();
3965
4016
  } else {
3966
- _this21._setupNormalTabs();
4017
+ _this22._setupNormalTabs();
3967
4018
  }
3968
4019
 
3969
- _this21._setupEventHandlers();
3970
- return _this21;
4020
+ // Setup tabs indicator after content to ensure accurate widths
4021
+ _this22._setTabsAndTabWidth();
4022
+ _this22._createIndicator();
4023
+
4024
+ _this22._setupEventHandlers();
4025
+ return _this22;
3971
4026
  }
3972
4027
 
3973
4028
  _createClass(Tabs, [{
@@ -4038,7 +4093,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4038
4093
  }, {
4039
4094
  key: "_handleTabClick",
4040
4095
  value: function _handleTabClick(e) {
4041
- var _this22 = this;
4096
+ var _this23 = this;
4042
4097
 
4043
4098
  var tab = $(e.target).closest('li.tab');
4044
4099
  var tabLink = $(e.target).closest('a');
@@ -4054,12 +4109,10 @@ $jscomp.polyfill = function (e, r, p, m) {
4054
4109
  }
4055
4110
 
4056
4111
  // Act as regular link if target attribute is specified.
4057
- if (!!tabLink.attr("target")) {
4112
+ if (!!tabLink.attr('target')) {
4058
4113
  return;
4059
4114
  }
4060
4115
 
4061
- this._setTabsAndTabWidth();
4062
-
4063
4116
  // Make the old tab inactive.
4064
4117
  this.$activeTabLink.removeClass('active');
4065
4118
  var $oldContent = this.$content;
@@ -4078,8 +4131,8 @@ $jscomp.polyfill = function (e, r, p, m) {
4078
4131
  if (this.options.swipeable) {
4079
4132
  if (this._tabsCarousel) {
4080
4133
  this._tabsCarousel.set(this.index, function () {
4081
- if (typeof _this22.options.onShow === "function") {
4082
- _this22.options.onShow.call(_this22, _this22.$content[0]);
4134
+ if (typeof _this23.options.onShow === 'function') {
4135
+ _this23.options.onShow.call(_this23, _this23.$content[0]);
4083
4136
  }
4084
4137
  });
4085
4138
  }
@@ -4098,6 +4151,9 @@ $jscomp.polyfill = function (e, r, p, m) {
4098
4151
  }
4099
4152
  }
4100
4153
 
4154
+ // Update widths after content is swapped (scrollbar bugfix)
4155
+ this._setTabsAndTabWidth();
4156
+
4101
4157
  // Update indicator
4102
4158
  this._animateIndicator(prevIndex);
4103
4159
 
@@ -4112,7 +4168,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4112
4168
  }, {
4113
4169
  key: "_createIndicator",
4114
4170
  value: function _createIndicator() {
4115
- var _this23 = this;
4171
+ var _this24 = this;
4116
4172
 
4117
4173
  var indicator = document.createElement('li');
4118
4174
  indicator.classList.add('indicator');
@@ -4121,8 +4177,8 @@ $jscomp.polyfill = function (e, r, p, m) {
4121
4177
  this._indicator = indicator;
4122
4178
 
4123
4179
  setTimeout(function () {
4124
- _this23._indicator.style.left = _this23._calcLeftPos(_this23.$activeTabLink) + 'px';
4125
- _this23._indicator.style.right = _this23._calcRightPos(_this23.$activeTabLink) + 'px';
4180
+ _this24._indicator.style.left = _this24._calcLeftPos(_this24.$activeTabLink) + 'px';
4181
+ _this24._indicator.style.right = _this24._calcRightPos(_this24.$activeTabLink) + 'px';
4126
4182
  }, 0);
4127
4183
  }
4128
4184
 
@@ -4162,7 +4218,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4162
4218
  }, {
4163
4219
  key: "_setupSwipeableTabs",
4164
4220
  value: function _setupSwipeableTabs() {
4165
- var _this24 = this;
4221
+ var _this25 = this;
4166
4222
 
4167
4223
  // Change swipeable according to responsive threshold
4168
4224
  if (window.innerWidth > this.options.responsiveThreshold) {
@@ -4188,14 +4244,14 @@ $jscomp.polyfill = function (e, r, p, m) {
4188
4244
  fullWidth: true,
4189
4245
  noWrap: true,
4190
4246
  onCycleTo: function (item) {
4191
- var prevIndex = _this24.index;
4192
- _this24.index = $(item).index();
4193
- _this24.$activeTabLink.removeClass('active');
4194
- _this24.$activeTabLink = _this24.$tabLinks.eq(_this24.index);
4195
- _this24.$activeTabLink.addClass('active');
4196
- _this24._animateIndicator(prevIndex);
4197
- if (typeof _this24.options.onShow === "function") {
4198
- _this24.options.onShow.call(_this24, _this24.$content[0]);
4247
+ var prevIndex = _this25.index;
4248
+ _this25.index = $(item).index();
4249
+ _this25.$activeTabLink.removeClass('active');
4250
+ _this25.$activeTabLink = _this25.$tabLinks.eq(_this25.index);
4251
+ _this25.$activeTabLink.addClass('active');
4252
+ _this25._animateIndicator(prevIndex);
4253
+ if (typeof _this25.options.onShow === 'function') {
4254
+ _this25.options.onShow.call(_this25, _this25.$content[0]);
4199
4255
  }
4200
4256
  }
4201
4257
  });
@@ -4290,6 +4346,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4290
4346
  }, {
4291
4347
  key: "updateTabIndicator",
4292
4348
  value: function updateTabIndicator() {
4349
+ this._setTabsAndTabWidth();
4293
4350
  this._animateIndicator(this.index);
4294
4351
  }
4295
4352
 
@@ -4367,7 +4424,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4367
4424
  return Tabs;
4368
4425
  }(Component);
4369
4426
 
4370
- window.M.Tabs = Tabs;
4427
+ M.Tabs = Tabs;
4371
4428
 
4372
4429
  if (M.jQueryLoaded) {
4373
4430
  M.initializeJqueryWrapper(Tabs, 'tabs', 'M_Tabs');
@@ -4404,17 +4461,17 @@ $jscomp.polyfill = function (e, r, p, m) {
4404
4461
  function Tooltip(el, options) {
4405
4462
  _classCallCheck(this, Tooltip);
4406
4463
 
4407
- var _this25 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
4464
+ var _this26 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
4408
4465
 
4409
- _this25.el.M_Tooltip = _this25;
4410
- _this25.options = $.extend({}, Tooltip.defaults, options);
4466
+ _this26.el.M_Tooltip = _this26;
4467
+ _this26.options = $.extend({}, Tooltip.defaults, options);
4411
4468
 
4412
- _this25.isOpen = false;
4413
- _this25.isHovered = false;
4414
- _this25.isFocused = false;
4415
- _this25._appendTooltipEl();
4416
- _this25._setupEventHandlers();
4417
- return _this25;
4469
+ _this26.isOpen = false;
4470
+ _this26.isHovered = false;
4471
+ _this26.isFocused = false;
4472
+ _this26._appendTooltipEl();
4473
+ _this26._setupEventHandlers();
4474
+ return _this26;
4418
4475
  }
4419
4476
 
4420
4477
  _createClass(Tooltip, [{
@@ -4469,16 +4526,16 @@ $jscomp.polyfill = function (e, r, p, m) {
4469
4526
  }
4470
4527
  }, {
4471
4528
  key: "open",
4472
- value: function open() {
4529
+ value: function open(isManual) {
4473
4530
  if (this.isOpen) {
4474
4531
  return;
4475
4532
  }
4476
-
4533
+ isManual = isManual === undefined ? true : undefined; // Default value true
4477
4534
  this.isOpen = true;
4478
4535
  // Update tooltip content with HTML attribute options
4479
4536
  this.options = $.extend({}, this.options, this._getAttributeOptions());
4480
4537
  this._updateTooltipContent();
4481
- this._setEnterDelayTimeout();
4538
+ this._setEnterDelayTimeout(isManual);
4482
4539
  }
4483
4540
  }, {
4484
4541
  key: "close",
@@ -4487,6 +4544,8 @@ $jscomp.polyfill = function (e, r, p, m) {
4487
4544
  return;
4488
4545
  }
4489
4546
 
4547
+ this.isHovered = false;
4548
+ this.isFocused = false;
4490
4549
  this.isOpen = false;
4491
4550
  this._setExitDelayTimeout();
4492
4551
  }
@@ -4498,16 +4557,16 @@ $jscomp.polyfill = function (e, r, p, m) {
4498
4557
  }, {
4499
4558
  key: "_setExitDelayTimeout",
4500
4559
  value: function _setExitDelayTimeout() {
4501
- var _this26 = this;
4560
+ var _this27 = this;
4502
4561
 
4503
4562
  clearTimeout(this._exitDelayTimeout);
4504
4563
 
4505
4564
  this._exitDelayTimeout = setTimeout(function () {
4506
- if (_this26.isHovered || _this26.isFocused) {
4565
+ if (_this27.isHovered || _this27.isFocused) {
4507
4566
  return;
4508
4567
  }
4509
4568
 
4510
- _this26._animateOut();
4569
+ _this27._animateOut();
4511
4570
  }, this.options.exitDelay);
4512
4571
  }
4513
4572
 
@@ -4517,17 +4576,17 @@ $jscomp.polyfill = function (e, r, p, m) {
4517
4576
 
4518
4577
  }, {
4519
4578
  key: "_setEnterDelayTimeout",
4520
- value: function _setEnterDelayTimeout() {
4521
- var _this27 = this;
4579
+ value: function _setEnterDelayTimeout(isManual) {
4580
+ var _this28 = this;
4522
4581
 
4523
4582
  clearTimeout(this._enterDelayTimeout);
4524
4583
 
4525
4584
  this._enterDelayTimeout = setTimeout(function () {
4526
- if (!_this27.isHovered && !_this27.isFocused) {
4585
+ if (!_this28.isHovered && !_this28.isFocused && !isManual) {
4527
4586
  return;
4528
4587
  }
4529
4588
 
4530
- _this27._animateIn();
4589
+ _this28._animateIn();
4531
4590
  }, this.options.enterDelay);
4532
4591
  }
4533
4592
  }, {
@@ -4640,19 +4699,23 @@ $jscomp.polyfill = function (e, r, p, m) {
4640
4699
  key: "_handleMouseEnter",
4641
4700
  value: function _handleMouseEnter() {
4642
4701
  this.isHovered = true;
4643
- this.open();
4702
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
4703
+ this.open(false);
4644
4704
  }
4645
4705
  }, {
4646
4706
  key: "_handleMouseLeave",
4647
4707
  value: function _handleMouseLeave() {
4648
4708
  this.isHovered = false;
4709
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
4649
4710
  this.close();
4650
4711
  }
4651
4712
  }, {
4652
4713
  key: "_handleFocus",
4653
4714
  value: function _handleFocus() {
4654
- this.isFocused = true;
4655
- this.open();
4715
+ if (M.tabPressed) {
4716
+ this.isFocused = true;
4717
+ this.open(false);
4718
+ }
4656
4719
  }
4657
4720
  }, {
4658
4721
  key: "_handleBlur",
@@ -5085,6 +5148,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5085
5148
  var toastElement = this._createToast();
5086
5149
  toastElement.M_Toast = this;
5087
5150
  this.el = toastElement;
5151
+ this.$el = $(toastElement);
5088
5152
  this._animateIn();
5089
5153
  this._setTimer();
5090
5154
  }
@@ -5135,7 +5199,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5135
5199
  targets: this.el,
5136
5200
  top: 0,
5137
5201
  opacity: 1,
5138
- duration: 300,
5202
+ duration: this.options.inDuration,
5139
5203
  easing: 'easeOutCubic'
5140
5204
  });
5141
5205
  }
@@ -5148,18 +5212,18 @@ $jscomp.polyfill = function (e, r, p, m) {
5148
5212
  }, {
5149
5213
  key: "_setTimer",
5150
5214
  value: function _setTimer() {
5151
- var _this28 = this;
5215
+ var _this29 = this;
5152
5216
 
5153
5217
  if (this.timeRemaining !== Infinity) {
5154
5218
  this.counterInterval = setInterval(function () {
5155
5219
  // If toast is not being dragged, decrease its time remaining
5156
- if (!_this28.panning) {
5157
- _this28.timeRemaining -= 20;
5220
+ if (!_this29.panning) {
5221
+ _this29.timeRemaining -= 20;
5158
5222
  }
5159
5223
 
5160
5224
  // Animate toast out
5161
- if (_this28.timeRemaining <= 0) {
5162
- _this28.dismiss();
5225
+ if (_this29.timeRemaining <= 0) {
5226
+ _this29.dismiss();
5163
5227
  }
5164
5228
  }, 20);
5165
5229
  }
@@ -5172,7 +5236,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5172
5236
  }, {
5173
5237
  key: "dismiss",
5174
5238
  value: function dismiss() {
5175
- var _this29 = this;
5239
+ var _this30 = this;
5176
5240
 
5177
5241
  window.clearInterval(this.counterInterval);
5178
5242
  var activationDistance = this.el.offsetWidth * this.options.activationPercent;
@@ -5191,12 +5255,12 @@ $jscomp.polyfill = function (e, r, p, m) {
5191
5255
  easing: 'easeOutExpo',
5192
5256
  complete: function () {
5193
5257
  // Call the optional callback
5194
- if (typeof _this29.options.completeCallback === 'function') {
5195
- _this29.options.completeCallback();
5258
+ if (typeof _this30.options.completeCallback === 'function') {
5259
+ _this30.options.completeCallback();
5196
5260
  }
5197
5261
  // Remove toast from DOM
5198
- _this29.el.parentNode.removeChild(_this29.el);
5199
- Toast._toasts.splice(Toast._toasts.indexOf(_this29), 1);
5262
+ _this30.$el.remove();
5263
+ Toast._toasts.splice(Toast._toasts.indexOf(_this30), 1);
5200
5264
  if (Toast._toasts.length === 0) {
5201
5265
  Toast._removeContainer();
5202
5266
  }
@@ -5249,7 +5313,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5249
5313
  document.removeEventListener('mousemove', Toast._onDragMove);
5250
5314
  document.removeEventListener('mouseup', Toast._onDragEnd);
5251
5315
 
5252
- Toast._container.parentNode.removeChild(Toast._container);
5316
+ $(Toast._container).remove();
5253
5317
  Toast._container = null;
5254
5318
  }
5255
5319
 
@@ -5422,10 +5486,10 @@ $jscomp.polyfill = function (e, r, p, m) {
5422
5486
  function Sidenav(el, options) {
5423
5487
  _classCallCheck(this, Sidenav);
5424
5488
 
5425
- var _this30 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
5489
+ var _this31 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
5426
5490
 
5427
- _this30.el.M_Sidenav = _this30;
5428
- _this30.id = _this30.$el.attr('id');
5491
+ _this31.el.M_Sidenav = _this31;
5492
+ _this31.id = _this31.$el.attr('id');
5429
5493
 
5430
5494
  /**
5431
5495
  * Options for the Sidenav
@@ -5439,38 +5503,38 @@ $jscomp.polyfill = function (e, r, p, m) {
5439
5503
  * @prop {Function} onCloseStart - Function called when sidenav starts exiting
5440
5504
  * @prop {Function} onCloseEnd - Function called when sidenav finishes exiting
5441
5505
  */
5442
- _this30.options = $.extend({}, Sidenav.defaults, options);
5506
+ _this31.options = $.extend({}, Sidenav.defaults, options);
5443
5507
 
5444
5508
  /**
5445
5509
  * Describes open/close state of Sidenav
5446
5510
  * @type {Boolean}
5447
5511
  */
5448
- _this30.isOpen = false;
5512
+ _this31.isOpen = false;
5449
5513
 
5450
5514
  /**
5451
5515
  * Describes if Sidenav is fixed
5452
5516
  * @type {Boolean}
5453
5517
  */
5454
- _this30.isFixed = _this30.el.classList.contains('sidenav-fixed');
5518
+ _this31.isFixed = _this31.el.classList.contains('sidenav-fixed');
5455
5519
 
5456
5520
  /**
5457
5521
  * Describes if Sidenav is being draggeed
5458
5522
  * @type {Boolean}
5459
5523
  */
5460
- _this30.isDragged = false;
5524
+ _this31.isDragged = false;
5461
5525
 
5462
5526
  // Window size variables for window resize checks
5463
- _this30.lastWindowWidth = window.innerWidth;
5464
- _this30.lastWindowHeight = window.innerHeight;
5527
+ _this31.lastWindowWidth = window.innerWidth;
5528
+ _this31.lastWindowHeight = window.innerHeight;
5465
5529
 
5466
- _this30._createOverlay();
5467
- _this30._createDragTarget();
5468
- _this30._setupEventHandlers();
5469
- _this30._setupClasses();
5470
- _this30._setupFixed();
5530
+ _this31._createOverlay();
5531
+ _this31._createDragTarget();
5532
+ _this31._setupEventHandlers();
5533
+ _this31._setupClasses();
5534
+ _this31._setupFixed();
5471
5535
 
5472
- Sidenav._sidenavs.push(_this30);
5473
- return _this30;
5536
+ Sidenav._sidenavs.push(_this31);
5537
+ return _this31;
5474
5538
  }
5475
5539
 
5476
5540
  _createClass(Sidenav, [{
@@ -5482,9 +5546,11 @@ $jscomp.polyfill = function (e, r, p, m) {
5482
5546
  */
5483
5547
  value: function destroy() {
5484
5548
  this._removeEventHandlers();
5549
+ this._enableBodyScrolling();
5485
5550
  this._overlay.parentNode.removeChild(this._overlay);
5486
5551
  this.dragTarget.parentNode.removeChild(this.dragTarget);
5487
5552
  this.el.M_Sidenav = undefined;
5553
+ this.el.style.transform = '';
5488
5554
 
5489
5555
  var index = Sidenav._sidenavs.indexOf(this);
5490
5556
  if (index >= 0) {
@@ -5673,7 +5739,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5673
5739
  key: "_handleDragTargetRelease",
5674
5740
  value: function _handleDragTargetRelease() {
5675
5741
  if (this.isDragged) {
5676
- if (this.percentOpen > .5) {
5742
+ if (this.percentOpen > 0.2) {
5677
5743
  this.open();
5678
5744
  } else {
5679
5745
  this._animateOut();
@@ -5740,7 +5806,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5740
5806
  key: "_handleCloseRelease",
5741
5807
  value: function _handleCloseRelease() {
5742
5808
  if (this.isOpen && this.isDragged) {
5743
- if (this.percentOpen > .5) {
5809
+ if (this.percentOpen > 0.8) {
5744
5810
  this._animateIn();
5745
5811
  } else {
5746
5812
  this.close();
@@ -5905,7 +5971,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5905
5971
  }, {
5906
5972
  key: "_animateSidenavIn",
5907
5973
  value: function _animateSidenavIn() {
5908
- var _this31 = this;
5974
+ var _this32 = this;
5909
5975
 
5910
5976
  var slideOutPercent = this.options.edge === 'left' ? -1 : 1;
5911
5977
  if (this.isDragged) {
@@ -5920,8 +5986,8 @@ $jscomp.polyfill = function (e, r, p, m) {
5920
5986
  easing: 'easeOutQuad',
5921
5987
  complete: function () {
5922
5988
  // Run onOpenEnd callback
5923
- if (typeof _this31.options.onOpenEnd === 'function') {
5924
- _this31.options.onOpenEnd.call(_this31, _this31.el);
5989
+ if (typeof _this32.options.onOpenEnd === 'function') {
5990
+ _this32.options.onOpenEnd.call(_this32, _this32.el);
5925
5991
  }
5926
5992
  }
5927
5993
  });
@@ -5955,7 +6021,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5955
6021
  }, {
5956
6022
  key: "_animateSidenavOut",
5957
6023
  value: function _animateSidenavOut() {
5958
- var _this32 = this;
6024
+ var _this33 = this;
5959
6025
 
5960
6026
  var endPercent = this.options.edge === 'left' ? -1 : 1;
5961
6027
  var slideOutPercent = 0;
@@ -5971,8 +6037,8 @@ $jscomp.polyfill = function (e, r, p, m) {
5971
6037
  easing: 'easeOutQuad',
5972
6038
  complete: function () {
5973
6039
  // Run onOpenEnd callback
5974
- if (typeof _this32.options.onCloseEnd === 'function') {
5975
- _this32.options.onCloseEnd.call(_this32, _this32.el);
6040
+ if (typeof _this33.options.onCloseEnd === 'function') {
6041
+ _this33.options.onCloseEnd.call(_this33, _this33.el);
5976
6042
  }
5977
6043
  }
5978
6044
  });
@@ -5980,7 +6046,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5980
6046
  }, {
5981
6047
  key: "_animateOverlayOut",
5982
6048
  value: function _animateOverlayOut() {
5983
- var _this33 = this;
6049
+ var _this34 = this;
5984
6050
 
5985
6051
  anim.remove(this._overlay);
5986
6052
  anim({
@@ -5989,7 +6055,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5989
6055
  duration: this.options.outDuration,
5990
6056
  easing: 'easeOutQuad',
5991
6057
  complete: function () {
5992
- $(_this33._overlay).css('display', 'none');
6058
+ $(_this34._overlay).css('display', 'none');
5993
6059
  }
5994
6060
  });
5995
6061
  }
@@ -6028,7 +6094,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6028
6094
 
6029
6095
  Sidenav._sidenavs = [];
6030
6096
 
6031
- window.M.Sidenav = Sidenav;
6097
+ M.Sidenav = Sidenav;
6032
6098
 
6033
6099
  if (M.jQueryLoaded) {
6034
6100
  M.initializeJqueryWrapper(Sidenav, 'sidenav', 'M_Sidenav');
@@ -6063,9 +6129,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6063
6129
  function ScrollSpy(el, options) {
6064
6130
  _classCallCheck(this, ScrollSpy);
6065
6131
 
6066
- var _this34 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
6132
+ var _this35 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
6067
6133
 
6068
- _this34.el.M_ScrollSpy = _this34;
6134
+ _this35.el.M_ScrollSpy = _this35;
6069
6135
 
6070
6136
  /**
6071
6137
  * Options for the modal
@@ -6075,17 +6141,17 @@ $jscomp.polyfill = function (e, r, p, m) {
6075
6141
  * @prop {String} [activeClass='active'] - Class applied to active elements
6076
6142
  * @prop {Function} [getActiveElement] - Used to find active element
6077
6143
  */
6078
- _this34.options = $.extend({}, ScrollSpy.defaults, options);
6144
+ _this35.options = $.extend({}, ScrollSpy.defaults, options);
6079
6145
 
6080
6146
  // setup
6081
- ScrollSpy._elements.push(_this34);
6147
+ ScrollSpy._elements.push(_this35);
6082
6148
  ScrollSpy._count++;
6083
6149
  ScrollSpy._increment++;
6084
- _this34.tickId = -1;
6085
- _this34.id = ScrollSpy._increment;
6086
- _this34._setupEventHandlers();
6087
- _this34._handleWindowScroll();
6088
- return _this34;
6150
+ _this35.tickId = -1;
6151
+ _this35.id = ScrollSpy._increment;
6152
+ _this35._setupEventHandlers();
6153
+ _this35._handleWindowScroll();
6154
+ return _this35;
6089
6155
  }
6090
6156
 
6091
6157
  _createClass(ScrollSpy, [{
@@ -6238,7 +6304,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6238
6304
  }, {
6239
6305
  key: "_exit",
6240
6306
  value: function _exit() {
6241
- var _this35 = this;
6307
+ var _this36 = this;
6242
6308
 
6243
6309
  ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (value) {
6244
6310
  return value.height() != 0;
@@ -6248,7 +6314,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6248
6314
  $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).removeClass(this.options.activeClass);
6249
6315
 
6250
6316
  ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (el) {
6251
- return el.attr('id') != _this35.$el.attr('id');
6317
+ return el.attr('id') != _this36.$el.attr('id');
6252
6318
  });
6253
6319
  if (ScrollSpy._visibleElements[0]) {
6254
6320
  // Check if empty
@@ -6383,9 +6449,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6383
6449
  function Autocomplete(el, options) {
6384
6450
  _classCallCheck(this, Autocomplete);
6385
6451
 
6386
- var _this36 = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, Autocomplete, el, options));
6452
+ var _this37 = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, Autocomplete, el, options));
6387
6453
 
6388
- _this36.el.M_Autocomplete = _this36;
6454
+ _this37.el.M_Autocomplete = _this37;
6389
6455
 
6390
6456
  /**
6391
6457
  * Options for the autocomplete
@@ -6399,19 +6465,20 @@ $jscomp.polyfill = function (e, r, p, m) {
6399
6465
  * @prop {Boolean} noWrap
6400
6466
  * @prop {Function} onCycleTo
6401
6467
  */
6402
- _this36.options = $.extend({}, Autocomplete.defaults, options);
6468
+ _this37.options = $.extend({}, Autocomplete.defaults, options);
6403
6469
 
6404
6470
  // Setup
6405
- _this36.isOpen = false;
6406
- _this36.count = 0;
6407
- _this36.activeIndex = -1;
6408
- _this36.oldVal;
6409
- _this36.$inputField = _this36.$el.closest('.input-field');
6410
- _this36.$active = $();
6411
- _this36._setupDropdown();
6412
-
6413
- _this36._setupEventHandlers();
6414
- return _this36;
6471
+ _this37.isOpen = false;
6472
+ _this37.count = 0;
6473
+ _this37.activeIndex = -1;
6474
+ _this37.oldVal;
6475
+ _this37.$inputField = _this37.$el.closest('.input-field');
6476
+ _this37.$active = $();
6477
+ _this37._mousedown = false;
6478
+ _this37._setupDropdown();
6479
+
6480
+ _this37._setupEventHandlers();
6481
+ return _this37;
6415
6482
  }
6416
6483
 
6417
6484
  _createClass(Autocomplete, [{
@@ -6437,16 +6504,21 @@ $jscomp.polyfill = function (e, r, p, m) {
6437
6504
  this._handleInputBlurBound = this._handleInputBlur.bind(this);
6438
6505
  this._handleInputKeyupAndFocusBound = this._handleInputKeyupAndFocus.bind(this);
6439
6506
  this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
6507
+ this._handleInputClickBound = this._handleInputClick.bind(this);
6440
6508
  this._handleContainerMousedownAndTouchstartBound = this._handleContainerMousedownAndTouchstart.bind(this);
6509
+ this._handleContainerMouseupAndTouchendBound = this._handleContainerMouseupAndTouchend.bind(this);
6441
6510
 
6442
6511
  this.el.addEventListener('blur', this._handleInputBlurBound);
6443
6512
  this.el.addEventListener('keyup', this._handleInputKeyupAndFocusBound);
6444
6513
  this.el.addEventListener('focus', this._handleInputKeyupAndFocusBound);
6445
6514
  this.el.addEventListener('keydown', this._handleInputKeydownBound);
6515
+ this.el.addEventListener('click', this._handleInputClickBound);
6446
6516
  this.container.addEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
6517
+ this.container.addEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
6447
6518
 
6448
6519
  if (typeof window.ontouchstart !== 'undefined') {
6449
6520
  this.container.addEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
6521
+ this.container.addEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
6450
6522
  }
6451
6523
  }
6452
6524
 
@@ -6461,10 +6533,13 @@ $jscomp.polyfill = function (e, r, p, m) {
6461
6533
  this.el.removeEventListener('keyup', this._handleInputKeyupAndFocusBound);
6462
6534
  this.el.removeEventListener('focus', this._handleInputKeyupAndFocusBound);
6463
6535
  this.el.removeEventListener('keydown', this._handleInputKeydownBound);
6536
+ this.el.removeEventListener('click', this._handleInputClickBound);
6464
6537
  this.container.removeEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
6538
+ this.container.removeEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
6465
6539
 
6466
6540
  if (typeof window.ontouchstart !== 'undefined') {
6467
6541
  this.container.removeEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
6542
+ this.container.removeEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
6468
6543
  }
6469
6544
  }
6470
6545
 
@@ -6475,6 +6550,8 @@ $jscomp.polyfill = function (e, r, p, m) {
6475
6550
  }, {
6476
6551
  key: "_setupDropdown",
6477
6552
  value: function _setupDropdown() {
6553
+ var _this38 = this;
6554
+
6478
6555
  this.container = document.createElement('ul');
6479
6556
  this.container.id = "autocomplete-options-" + M.guid();
6480
6557
  $(this.container).addClass('autocomplete-content dropdown-content');
@@ -6484,7 +6561,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6484
6561
  this.dropdown = M.Dropdown.init(this.el, {
6485
6562
  autoFocus: false,
6486
6563
  closeOnClick: false,
6487
- coverTrigger: false
6564
+ coverTrigger: false,
6565
+ onItemClick: function (itemEl) {
6566
+ _this38.selectOption($(itemEl));
6567
+ }
6488
6568
  });
6489
6569
 
6490
6570
  // Sketchy removal of dropdown click handler
@@ -6508,8 +6588,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6508
6588
  }, {
6509
6589
  key: "_handleInputBlur",
6510
6590
  value: function _handleInputBlur() {
6511
- this.dropdown.close();
6512
- this._resetAutocomplete();
6591
+ if (!this._mousedown) {
6592
+ this.close();
6593
+ this._resetAutocomplete();
6594
+ }
6513
6595
  }
6514
6596
 
6515
6597
  /**
@@ -6520,8 +6602,6 @@ $jscomp.polyfill = function (e, r, p, m) {
6520
6602
  }, {
6521
6603
  key: "_handleInputKeyupAndFocus",
6522
6604
  value: function _handleInputKeyupAndFocus(e) {
6523
- var _this37 = this;
6524
-
6525
6605
  if (e.type === 'keyup') {
6526
6606
  Autocomplete._keydown = false;
6527
6607
  }
@@ -6535,25 +6615,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6535
6615
  }
6536
6616
 
6537
6617
  // Check if the input isn't empty
6538
- if (this.oldVal !== val) {
6539
- this._resetAutocomplete();
6540
-
6541
- if (val.length >= this.options.minLength) {
6542
- this.isOpen = true;
6543
- this._renderDropdown(this.options.data, val);
6544
- }
6545
-
6546
- // Open dropdown
6547
- if (!this.dropdown.isOpen) {
6548
- // Timeout to prevent dropdown temp doc click handler from firing
6549
- setTimeout(function () {
6550
- _this37.dropdown.open();
6551
- }, 100);
6552
-
6553
- // Recalculate dropdown when its already open
6554
- } else {
6555
- this.dropdown.recalculateDimensions();
6556
- }
6618
+ // Check if focus triggered by tab
6619
+ if (this.oldVal !== val && (M.tabPressed || e.type !== 'focus')) {
6620
+ this.open();
6557
6621
  }
6558
6622
 
6559
6623
  // Update oldVal
@@ -6576,7 +6640,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6576
6640
  numItems = $(this.container).children('li').length;
6577
6641
 
6578
6642
  // select element on Enter
6579
- if (keyCode === 13 && this.activeIndex >= 0) {
6643
+ if (keyCode === M.keys.ENTER && this.activeIndex >= 0) {
6580
6644
  liElement = $(this.container).children('li').eq(this.activeIndex);
6581
6645
  if (liElement.length) {
6582
6646
  this.selectOption(liElement);
@@ -6586,14 +6650,14 @@ $jscomp.polyfill = function (e, r, p, m) {
6586
6650
  }
6587
6651
 
6588
6652
  // Capture up and down key
6589
- if (keyCode === 38 || keyCode === 40) {
6653
+ if (keyCode === M.keys.ARROW_UP || keyCode === M.keys.ARROW_DOWN) {
6590
6654
  e.preventDefault();
6591
6655
 
6592
- if (keyCode === 38 && this.activeIndex > 0) {
6656
+ if (keyCode === M.keys.ARROW_UP && this.activeIndex > 0) {
6593
6657
  this.activeIndex--;
6594
6658
  }
6595
6659
 
6596
- if (keyCode === 40 && this.activeIndex < numItems - 1) {
6660
+ if (keyCode === M.keys.ARROW_DOWN && this.activeIndex < numItems - 1) {
6597
6661
  this.activeIndex++;
6598
6662
  }
6599
6663
 
@@ -6605,6 +6669,17 @@ $jscomp.polyfill = function (e, r, p, m) {
6605
6669
  }
6606
6670
  }
6607
6671
 
6672
+ /**
6673
+ * Handle Input Click
6674
+ * @param {Event} e
6675
+ */
6676
+
6677
+ }, {
6678
+ key: "_handleInputClick",
6679
+ value: function _handleInputClick(e) {
6680
+ this.open();
6681
+ }
6682
+
6608
6683
  /**
6609
6684
  * Handle Container Mousedown and Touchstart
6610
6685
  * @param {Event} e
@@ -6613,8 +6688,18 @@ $jscomp.polyfill = function (e, r, p, m) {
6613
6688
  }, {
6614
6689
  key: "_handleContainerMousedownAndTouchstart",
6615
6690
  value: function _handleContainerMousedownAndTouchstart(e) {
6616
- var $autocompleteOption = $(e.target).closest('li');
6617
- this.selectOption($autocompleteOption);
6691
+ this._mousedown = true;
6692
+ }
6693
+
6694
+ /**
6695
+ * Handle Container Mouseup and Touchend
6696
+ * @param {Event} e
6697
+ */
6698
+
6699
+ }, {
6700
+ key: "_handleContainerMouseupAndTouchend",
6701
+ value: function _handleContainerMouseupAndTouchend(e) {
6702
+ this._mousedown = false;
6618
6703
  }
6619
6704
 
6620
6705
  /**
@@ -6625,7 +6710,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6625
6710
  key: "_highlight",
6626
6711
  value: function _highlight(string, $el) {
6627
6712
  var img = $el.find('img');
6628
- var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
6713
+ var matchStart = $el.text().toLowerCase().indexOf('' + string.toLowerCase() + ''),
6629
6714
  matchEnd = matchStart + string.length - 1,
6630
6715
  beforeMatch = $el.text().slice(0, matchStart),
6631
6716
  matchText = $el.text().slice(matchStart, matchEnd + 1),
@@ -6658,6 +6743,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6658
6743
  this._resetCurrentElement();
6659
6744
  this.oldVal = null;
6660
6745
  this.isOpen = false;
6746
+ this._mousedown = false;
6661
6747
  }
6662
6748
 
6663
6749
  /**
@@ -6672,7 +6758,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6672
6758
  this.el.value = text;
6673
6759
  this.$el.trigger('change');
6674
6760
  this._resetAutocomplete();
6675
- this.dropdown.close();
6761
+ this.close();
6676
6762
 
6677
6763
  // Handle onAutocomplete callback.
6678
6764
  if (typeof this.options.onAutocomplete === 'function') {
@@ -6689,7 +6775,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6689
6775
  }, {
6690
6776
  key: "_renderDropdown",
6691
6777
  value: function _renderDropdown(data, val) {
6692
- var _this38 = this;
6778
+ var _this39 = this;
6693
6779
 
6694
6780
  this._resetAutocomplete();
6695
6781
 
@@ -6714,17 +6800,19 @@ $jscomp.polyfill = function (e, r, p, m) {
6714
6800
  }
6715
6801
 
6716
6802
  // Sort
6717
- var sortFunctionBound = function (a, b) {
6718
- return _this38.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6719
- };
6720
- matchingData.sort(sortFunctionBound);
6803
+ if (this.options.sortFunction) {
6804
+ var sortFunctionBound = function (a, b) {
6805
+ return _this39.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6806
+ };
6807
+ matchingData.sort(sortFunctionBound);
6808
+ }
6721
6809
 
6722
6810
  // Render
6723
6811
  for (var i = 0; i < matchingData.length; i++) {
6724
6812
  var _entry = matchingData[i];
6725
6813
  var $autocompleteOption = $('<li></li>');
6726
6814
  if (!!_entry.data) {
6727
- $autocompleteOption.append('<img src="' + _entry.data + '" class="right circle"><span>' + _entry.key + '</span>');
6815
+ $autocompleteOption.append("<img src=\"" + _entry.data + "\" class=\"right circle\"><span>" + _entry.key + "</span>");
6728
6816
  } else {
6729
6817
  $autocompleteOption.append('<span>' + _entry.key + '</span>');
6730
6818
  }
@@ -6734,6 +6822,41 @@ $jscomp.polyfill = function (e, r, p, m) {
6734
6822
  }
6735
6823
  }
6736
6824
 
6825
+ /**
6826
+ * Open Autocomplete Dropdown
6827
+ */
6828
+
6829
+ }, {
6830
+ key: "open",
6831
+ value: function open() {
6832
+ var val = this.el.value.toLowerCase();
6833
+
6834
+ this._resetAutocomplete();
6835
+
6836
+ if (val.length >= this.options.minLength) {
6837
+ this.isOpen = true;
6838
+ this._renderDropdown(this.options.data, val);
6839
+ }
6840
+
6841
+ // Open dropdown
6842
+ if (!this.dropdown.isOpen) {
6843
+ this.dropdown.open();
6844
+ } else {
6845
+ // Recalculate dropdown when its already open
6846
+ this.dropdown.recalculateDimensions();
6847
+ }
6848
+ }
6849
+
6850
+ /**
6851
+ * Close Autocomplete Dropdown
6852
+ */
6853
+
6854
+ }, {
6855
+ key: "close",
6856
+ value: function close() {
6857
+ this.dropdown.close();
6858
+ }
6859
+
6737
6860
  /**
6738
6861
  * Update Data
6739
6862
  * @param {Object} data
@@ -6836,7 +6959,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6836
6959
  }
6837
6960
 
6838
6961
  if (!$textarea.length) {
6839
- console.error("No textarea element found");
6962
+ console.error('No textarea element found');
6840
6963
  return;
6841
6964
  }
6842
6965
 
@@ -6952,8 +7075,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6952
7075
  formReset.find('select').each(function () {
6953
7076
  // check if initialized
6954
7077
  if (this.M_FormSelect) {
6955
- var reset_text = $(this).find('option[selected]').text();
6956
- $(this).siblings('input.select-dropdown')[0].value = reset_text;
7078
+ $(this).trigger('change');
6957
7079
  }
6958
7080
  });
6959
7081
  }, 0);
@@ -6977,10 +7099,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6977
7099
  document.addEventListener('blur', function (e) {
6978
7100
  var $inputElement = $(e.target);
6979
7101
  if ($inputElement.is(input_selector)) {
6980
- var selector = ".prefix";
7102
+ var selector = '.prefix';
6981
7103
 
6982
7104
  if ($inputElement[0].value.length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === null) {
6983
- selector += ", label";
7105
+ selector += ', label';
6984
7106
  }
6985
7107
  $inputElement.siblings(selector).removeClass('active');
6986
7108
  M.validate_field($inputElement);
@@ -7029,7 +7151,7 @@ $jscomp.polyfill = function (e, r, p, m) {
7029
7151
  for (var i = 0; i < files.length; i++) {
7030
7152
  file_names.push(files[i].name);
7031
7153
  }
7032
- path_input[0].value = file_names.join(", ");
7154
+ path_input[0].value = file_names.join(', ');
7033
7155
  path_input.trigger('change');
7034
7156
  });
7035
7157
  }); // End of $(document).ready
@@ -7061,9 +7183,9 @@ $jscomp.polyfill = function (e, r, p, m) {
7061
7183
  function Slider(el, options) {
7062
7184
  _classCallCheck(this, Slider);
7063
7185
 
7064
- var _this39 = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options));
7186
+ var _this40 = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options));
7065
7187
 
7066
- _this39.el.M_Slider = _this39;
7188
+ _this40.el.M_Slider = _this40;
7067
7189
 
7068
7190
  /**
7069
7191
  * Options for the modal
@@ -7073,27 +7195,27 @@ $jscomp.polyfill = function (e, r, p, m) {
7073
7195
  * @prop {Number} [duration=500] - Length in ms of slide transition
7074
7196
  * @prop {Number} [interval=6000] - Length in ms of slide interval
7075
7197
  */
7076
- _this39.options = $.extend({}, Slider.defaults, options);
7198
+ _this40.options = $.extend({}, Slider.defaults, options);
7077
7199
 
7078
7200
  // setup
7079
- _this39.$slider = _this39.$el.find('.slides');
7080
- _this39.$slides = _this39.$slider.children('li');
7081
- _this39.activeIndex = _this39.$slides.filter(function (item) {
7201
+ _this40.$slider = _this40.$el.find('.slides');
7202
+ _this40.$slides = _this40.$slider.children('li');
7203
+ _this40.activeIndex = _this40.$slides.filter(function (item) {
7082
7204
  return $(item).hasClass('active');
7083
7205
  }).first().index();
7084
- if (_this39.activeIndex != -1) {
7085
- _this39.$active = _this39.$slides.eq(_this39.activeIndex);
7206
+ if (_this40.activeIndex != -1) {
7207
+ _this40.$active = _this40.$slides.eq(_this40.activeIndex);
7086
7208
  }
7087
7209
 
7088
- _this39._setSliderHeight();
7210
+ _this40._setSliderHeight();
7089
7211
 
7090
7212
  // Set initial positions of captions
7091
- _this39.$slides.find('.caption').each(function (el) {
7092
- _this39._animateCaptionIn(el, 0);
7213
+ _this40.$slides.find('.caption').each(function (el) {
7214
+ _this40._animateCaptionIn(el, 0);
7093
7215
  });
7094
7216
 
7095
7217
  // Move img src into background-image
7096
- _this39.$slides.find('img').each(function (el) {
7218
+ _this40.$slides.find('img').each(function (el) {
7097
7219
  var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
7098
7220
  if ($(el).attr('src') !== placeholderBase64) {
7099
7221
  $(el).css('background-image', 'url("' + $(el).attr('src') + '")');
@@ -7101,46 +7223,46 @@ $jscomp.polyfill = function (e, r, p, m) {
7101
7223
  }
7102
7224
  });
7103
7225
 
7104
- _this39._setupIndicators();
7226
+ _this40._setupIndicators();
7105
7227
 
7106
7228
  // Show active slide
7107
- if (_this39.$active) {
7108
- _this39.$active.css('display', 'block');
7229
+ if (_this40.$active) {
7230
+ _this40.$active.css('display', 'block');
7109
7231
  } else {
7110
- _this39.$slides.first().addClass('active');
7232
+ _this40.$slides.first().addClass('active');
7111
7233
  anim({
7112
- targets: _this39.$slides.first()[0],
7234
+ targets: _this40.$slides.first()[0],
7113
7235
  opacity: 1,
7114
- duration: _this39.options.duration,
7236
+ duration: _this40.options.duration,
7115
7237
  easing: 'easeOutQuad'
7116
7238
  });
7117
7239
 
7118
- _this39.activeIndex = 0;
7119
- _this39.$active = _this39.$slides.eq(_this39.activeIndex);
7240
+ _this40.activeIndex = 0;
7241
+ _this40.$active = _this40.$slides.eq(_this40.activeIndex);
7120
7242
 
7121
7243
  // Update indicators
7122
- if (_this39.options.indicators) {
7123
- _this39.$indicators.eq(_this39.activeIndex).addClass('active');
7244
+ if (_this40.options.indicators) {
7245
+ _this40.$indicators.eq(_this40.activeIndex).addClass('active');
7124
7246
  }
7125
7247
  }
7126
7248
 
7127
7249
  // Adjust height to current slide
7128
- _this39.$active.find('img').each(function (el) {
7250
+ _this40.$active.find('img').each(function (el) {
7129
7251
  anim({
7130
- targets: _this39.$active.find('.caption')[0],
7252
+ targets: _this40.$active.find('.caption')[0],
7131
7253
  opacity: 1,
7132
7254
  translateX: 0,
7133
7255
  translateY: 0,
7134
- duration: _this39.options.duration,
7256
+ duration: _this40.options.duration,
7135
7257
  easing: 'easeOutQuad'
7136
7258
  });
7137
7259
  });
7138
7260
 
7139
- _this39._setupEventHandlers();
7261
+ _this40._setupEventHandlers();
7140
7262
 
7141
7263
  // auto scroll
7142
- _this39.start();
7143
- return _this39;
7264
+ _this40.start();
7265
+ return _this40;
7144
7266
  }
7145
7267
 
7146
7268
  _createClass(Slider, [{
@@ -7164,14 +7286,14 @@ $jscomp.polyfill = function (e, r, p, m) {
7164
7286
  }, {
7165
7287
  key: "_setupEventHandlers",
7166
7288
  value: function _setupEventHandlers() {
7167
- var _this40 = this;
7289
+ var _this41 = this;
7168
7290
 
7169
7291
  this._handleIntervalBound = this._handleInterval.bind(this);
7170
7292
  this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
7171
7293
 
7172
7294
  if (this.options.indicators) {
7173
7295
  this.$indicators.each(function (el) {
7174
- el.addEventListener('click', _this40._handleIndicatorClickBound);
7296
+ el.addEventListener('click', _this41._handleIndicatorClickBound);
7175
7297
  });
7176
7298
  }
7177
7299
  }
@@ -7183,11 +7305,11 @@ $jscomp.polyfill = function (e, r, p, m) {
7183
7305
  }, {
7184
7306
  key: "_removeEventHandlers",
7185
7307
  value: function _removeEventHandlers() {
7186
- var _this41 = this;
7308
+ var _this42 = this;
7187
7309
 
7188
7310
  if (this.options.indicators) {
7189
7311
  this.$indicators.each(function (el) {
7190
- el.removeEventListener('click', _this41._handleIndicatorClickBound);
7312
+ el.removeEventListener('click', _this42._handleIndicatorClickBound);
7191
7313
  });
7192
7314
  }
7193
7315
  }
@@ -7212,7 +7334,8 @@ $jscomp.polyfill = function (e, r, p, m) {
7212
7334
  key: "_handleInterval",
7213
7335
  value: function _handleInterval() {
7214
7336
  var newActiveIndex = this.$slider.find('.active').index();
7215
- if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0; // loop to start
7337
+ if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0;
7338
+ // loop to start
7216
7339
  else newActiveIndex += 1;
7217
7340
 
7218
7341
  this.set(newActiveIndex);
@@ -7271,13 +7394,13 @@ $jscomp.polyfill = function (e, r, p, m) {
7271
7394
  }, {
7272
7395
  key: "_setupIndicators",
7273
7396
  value: function _setupIndicators() {
7274
- var _this42 = this;
7397
+ var _this43 = this;
7275
7398
 
7276
7399
  if (this.options.indicators) {
7277
7400
  this.$indicators = $('<ul class="indicators"></ul>');
7278
7401
  this.$slides.each(function (el, index) {
7279
7402
  var $indicator = $('<li class="indicator-item"></li>');
7280
- _this42.$indicators.append($indicator[0]);
7403
+ _this43.$indicators.append($indicator[0]);
7281
7404
  });
7282
7405
  this.$el.append(this.$indicators[0]);
7283
7406
  this.$indicators = this.$indicators.children('li.indicator-item');
@@ -7302,7 +7425,7 @@ $jscomp.polyfill = function (e, r, p, m) {
7302
7425
  }, {
7303
7426
  key: "set",
7304
7427
  value: function set(index) {
7305
- var _this43 = this;
7428
+ var _this44 = this;
7306
7429
 
7307
7430
  // Wrap around indices.
7308
7431
  if (index >= this.$slides.length) index = 0;else if (index < 0) index = this.$slides.length - 1;
@@ -7319,7 +7442,7 @@ $jscomp.polyfill = function (e, r, p, m) {
7319
7442
  duration: this.options.duration,
7320
7443
  easing: 'easeOutQuad',
7321
7444
  complete: function () {
7322
- _this43.$slides.not('.active').each(function (el) {
7445
+ _this44.$slides.not('.active').each(function (el) {
7323
7446
  anim({
7324
7447
  targets: el,
7325
7448
  opacity: 0,
@@ -7518,9 +7641,9 @@ $jscomp.polyfill = function (e, r, p, m) {
7518
7641
  function Chips(el, options) {
7519
7642
  _classCallCheck(this, Chips);
7520
7643
 
7521
- var _this44 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
7644
+ var _this45 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
7522
7645
 
7523
- _this44.el.M_Chips = _this44;
7646
+ _this45.el.M_Chips = _this45;
7524
7647
 
7525
7648
  /**
7526
7649
  * Options for the modal
@@ -7530,34 +7653,34 @@ $jscomp.polyfill = function (e, r, p, m) {
7530
7653
  * @prop {String} secondaryPlaceholder
7531
7654
  * @prop {Object} autocompleteOptions
7532
7655
  */
7533
- _this44.options = $.extend({}, Chips.defaults, options);
7656
+ _this45.options = $.extend({}, Chips.defaults, options);
7534
7657
 
7535
- _this44.$el.addClass('chips input-field');
7536
- _this44.chipsData = [];
7537
- _this44.$chips = $();
7538
- _this44._setupInput();
7539
- _this44.hasAutocomplete = Object.keys(_this44.options.autocompleteOptions).length > 0;
7658
+ _this45.$el.addClass('chips input-field');
7659
+ _this45.chipsData = [];
7660
+ _this45.$chips = $();
7661
+ _this45._setupInput();
7662
+ _this45.hasAutocomplete = Object.keys(_this45.options.autocompleteOptions).length > 0;
7540
7663
 
7541
7664
  // Set input id
7542
- if (!_this44.$input.attr('id')) {
7543
- _this44.$input.attr('id', M.guid());
7665
+ if (!_this45.$input.attr('id')) {
7666
+ _this45.$input.attr('id', M.guid());
7544
7667
  }
7545
7668
 
7546
7669
  // Render initial chips
7547
- if (_this44.options.data.length) {
7548
- _this44.chipsData = _this44.options.data;
7549
- _this44._renderChips(_this44.chipsData);
7670
+ if (_this45.options.data.length) {
7671
+ _this45.chipsData = _this45.options.data;
7672
+ _this45._renderChips(_this45.chipsData);
7550
7673
  }
7551
7674
 
7552
7675
  // Setup autocomplete if needed
7553
- if (_this44.hasAutocomplete) {
7554
- _this44._setupAutocomplete();
7676
+ if (_this45.hasAutocomplete) {
7677
+ _this45._setupAutocomplete();
7555
7678
  }
7556
7679
 
7557
- _this44._setPlaceholder();
7558
- _this44._setupLabel();
7559
- _this44._setupEventHandlers();
7560
- return _this44;
7680
+ _this45._setPlaceholder();
7681
+ _this45._setupLabel();
7682
+ _this45._setupEventHandlers();
7683
+ return _this45;
7561
7684
  }
7562
7685
 
7563
7686
  _createClass(Chips, [{
@@ -7760,14 +7883,14 @@ $jscomp.polyfill = function (e, r, p, m) {
7760
7883
  }, {
7761
7884
  key: "_setupAutocomplete",
7762
7885
  value: function _setupAutocomplete() {
7763
- var _this45 = this;
7886
+ var _this46 = this;
7764
7887
 
7765
7888
  this.options.autocompleteOptions.onAutocomplete = function (val) {
7766
- _this45.addChip({
7889
+ _this46.addChip({
7767
7890
  tag: val
7768
7891
  });
7769
- _this45.$input[0].value = '';
7770
- _this45.$input[0].focus();
7892
+ _this46.$input[0].value = '';
7893
+ _this46.$input[0].focus();
7771
7894
  };
7772
7895
 
7773
7896
  this.autocomplete = M.Autocomplete.init(this.$input[0], this.options.autocompleteOptions);
@@ -8062,21 +8185,21 @@ $jscomp.polyfill = function (e, r, p, m) {
8062
8185
  function Pushpin(el, options) {
8063
8186
  _classCallCheck(this, Pushpin);
8064
8187
 
8065
- var _this46 = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
8188
+ var _this47 = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
8066
8189
 
8067
- _this46.el.M_Pushpin = _this46;
8190
+ _this47.el.M_Pushpin = _this47;
8068
8191
 
8069
8192
  /**
8070
8193
  * Options for the modal
8071
8194
  * @member Pushpin#options
8072
8195
  */
8073
- _this46.options = $.extend({}, Pushpin.defaults, options);
8196
+ _this47.options = $.extend({}, Pushpin.defaults, options);
8074
8197
 
8075
- _this46.originalOffset = _this46.el.offsetTop;
8076
- Pushpin._pushpins.push(_this46);
8077
- _this46._setupEventHandlers();
8078
- _this46._updatePosition();
8079
- return _this46;
8198
+ _this47.originalOffset = _this47.el.offsetTop;
8199
+ Pushpin._pushpins.push(_this47);
8200
+ _this47._setupEventHandlers();
8201
+ _this47._updatePosition();
8202
+ return _this47;
8080
8203
  }
8081
8204
 
8082
8205
  _createClass(Pushpin, [{
@@ -8112,7 +8235,6 @@ $jscomp.polyfill = function (e, r, p, m) {
8112
8235
 
8113
8236
  if (this.options.top <= scrolled && this.options.bottom >= scrolled && !this.el.classList.contains('pinned')) {
8114
8237
  this._removePinClasses();
8115
-
8116
8238
  this.el.style.top = this.options.offset + "px";
8117
8239
  this.el.classList.add('pinned');
8118
8240
 
@@ -8149,7 +8271,10 @@ $jscomp.polyfill = function (e, r, p, m) {
8149
8271
  }, {
8150
8272
  key: "_removePinClasses",
8151
8273
  value: function _removePinClasses() {
8152
- this.el.classList.remove('pin-top', 'pinned', 'pin-bottom');
8274
+ // IE 11 bug (can't remove multiple classes in one line)
8275
+ this.el.classList.remove('pin-top');
8276
+ this.el.classList.remove('pinned');
8277
+ this.el.classList.remove('pin-bottom');
8153
8278
  }
8154
8279
  }], [{
8155
8280
  key: "init",
@@ -8227,9 +8352,9 @@ $jscomp.polyfill = function (e, r, p, m) {
8227
8352
  function FloatingActionButton(el, options) {
8228
8353
  _classCallCheck(this, FloatingActionButton);
8229
8354
 
8230
- var _this47 = _possibleConstructorReturn(this, (FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton)).call(this, FloatingActionButton, el, options));
8355
+ var _this48 = _possibleConstructorReturn(this, (FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton)).call(this, FloatingActionButton, el, options));
8231
8356
 
8232
- _this47.el.M_FloatingActionButton = _this47;
8357
+ _this48.el.M_FloatingActionButton = _this48;
8233
8358
 
8234
8359
  /**
8235
8360
  * Options for the fab
@@ -8238,30 +8363,28 @@ $jscomp.polyfill = function (e, r, p, m) {
8238
8363
  * @prop {Boolean} [hoverEnabled=true] - Enable hover vs click
8239
8364
  * @prop {Boolean} [toolbarEnabled=false] - Enable toolbar transition
8240
8365
  */
8241
- _this47.options = $.extend({}, FloatingActionButton.defaults, options);
8242
-
8243
- _this47.isOpen = false;
8244
- _this47.$anchor = _this47.$el.children('a').first();
8245
- _this47.$menu = _this47.$el.children('ul').first();
8246
- _this47.$floatingBtns = _this47.$el.find('ul .btn-floating');
8247
- _this47.$floatingBtnsReverse = _this47.$el.find('ul .btn-floating').reverse();
8248
- _this47.offsetY = 0;
8249
- _this47.offsetX = 0;
8250
- if (_this47.options.direction === 'top') {
8251
- _this47.$el.addClass('direction-top');
8252
- _this47.offsetY = 40;
8253
- } else if (_this47.options.direction === 'right') {
8254
- _this47.$el.addClass('direction-right');
8255
- _this47.offsetX = -40;
8256
- } else if (_this47.options.direction === 'bottom') {
8257
- _this47.$el.addClass('direction-bottom');
8258
- _this47.offsetY = -40;
8366
+ _this48.options = $.extend({}, FloatingActionButton.defaults, options);
8367
+
8368
+ _this48.isOpen = false;
8369
+ _this48.$anchor = _this48.$el.children('a').first();
8370
+ _this48.$menu = _this48.$el.children('ul').first();
8371
+ _this48.$floatingBtns = _this48.$el.find('ul .btn-floating');
8372
+ _this48.$floatingBtnsReverse = _this48.$el.find('ul .btn-floating').reverse();
8373
+ _this48.offsetY = 0;
8374
+ _this48.offsetX = 0;
8375
+
8376
+ _this48.$el.addClass("direction-" + _this48.options.direction);
8377
+ if (_this48.options.direction === 'top') {
8378
+ _this48.offsetY = 40;
8379
+ } else if (_this48.options.direction === 'right') {
8380
+ _this48.offsetX = -40;
8381
+ } else if (_this48.options.direction === 'bottom') {
8382
+ _this48.offsetY = -40;
8259
8383
  } else {
8260
- _this47.$el.addClass('direction-left');
8261
- _this47.offsetX = 40;
8384
+ _this48.offsetX = 40;
8262
8385
  }
8263
- _this47._setupEventHandlers();
8264
- return _this47;
8386
+ _this48._setupEventHandlers();
8387
+ return _this48;
8265
8388
  }
8266
8389
 
8267
8390
  _createClass(FloatingActionButton, [{
@@ -8384,7 +8507,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8384
8507
  }, {
8385
8508
  key: "_animateInFAB",
8386
8509
  value: function _animateInFAB() {
8387
- var _this48 = this;
8510
+ var _this49 = this;
8388
8511
 
8389
8512
  this.$el.addClass('active');
8390
8513
 
@@ -8393,9 +8516,9 @@ $jscomp.polyfill = function (e, r, p, m) {
8393
8516
  anim({
8394
8517
  targets: el,
8395
8518
  opacity: 1,
8396
- scale: [.4, 1],
8397
- translateY: [_this48.offsetY, 0],
8398
- translateX: [_this48.offsetX, 0],
8519
+ scale: [0.4, 1],
8520
+ translateY: [_this49.offsetY, 0],
8521
+ translateX: [_this49.offsetX, 0],
8399
8522
  duration: 275,
8400
8523
  delay: time,
8401
8524
  easing: 'easeInOutQuad'
@@ -8411,20 +8534,20 @@ $jscomp.polyfill = function (e, r, p, m) {
8411
8534
  }, {
8412
8535
  key: "_animateOutFAB",
8413
8536
  value: function _animateOutFAB() {
8414
- var _this49 = this;
8537
+ var _this50 = this;
8415
8538
 
8416
8539
  this.$floatingBtnsReverse.each(function (el) {
8417
8540
  anim.remove(el);
8418
8541
  anim({
8419
8542
  targets: el,
8420
8543
  opacity: 0,
8421
- scale: .4,
8422
- translateY: _this49.offsetY,
8423
- translateX: _this49.offsetX,
8544
+ scale: 0.4,
8545
+ translateY: _this50.offsetY,
8546
+ translateX: _this50.offsetX,
8424
8547
  duration: 175,
8425
8548
  easing: 'easeOutQuad',
8426
8549
  complete: function () {
8427
- _this49.$el.removeClass('active');
8550
+ _this50.$el.removeClass('active');
8428
8551
  }
8429
8552
  });
8430
8553
  });
@@ -8437,7 +8560,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8437
8560
  }, {
8438
8561
  key: "_animateInToolbar",
8439
8562
  value: function _animateInToolbar() {
8440
- var _this50 = this;
8563
+ var _this51 = this;
8441
8564
 
8442
8565
  var scaleFactor = void 0;
8443
8566
  var windowWidth = window.innerWidth;
@@ -8473,18 +8596,18 @@ $jscomp.polyfill = function (e, r, p, m) {
8473
8596
  });
8474
8597
 
8475
8598
  setTimeout(function () {
8476
- _this50.$el.css({
8599
+ _this51.$el.css({
8477
8600
  transform: '',
8478
8601
  transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
8479
8602
  });
8480
- _this50.$anchor.css({
8603
+ _this51.$anchor.css({
8481
8604
  overflow: 'visible',
8482
8605
  transform: '',
8483
8606
  transition: 'transform .2s'
8484
8607
  });
8485
8608
 
8486
8609
  setTimeout(function () {
8487
- _this50.$el.css({
8610
+ _this51.$el.css({
8488
8611
  overflow: 'hidden',
8489
8612
  'background-color': fabColor
8490
8613
  });
@@ -8492,14 +8615,14 @@ $jscomp.polyfill = function (e, r, p, m) {
8492
8615
  transform: 'scale(' + scaleFactor + ')',
8493
8616
  transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
8494
8617
  });
8495
- _this50.$menu.children('li').children('a').css({
8618
+ _this51.$menu.children('li').children('a').css({
8496
8619
  opacity: 1
8497
8620
  });
8498
8621
 
8499
8622
  // Scroll to close.
8500
- _this50._handleDocumentClickBound = _this50._handleDocumentClick.bind(_this50);
8501
- window.addEventListener('scroll', _this50._handleCloseBound, true);
8502
- document.body.addEventListener('click', _this50._handleDocumentClickBound, true);
8623
+ _this51._handleDocumentClickBound = _this51._handleDocumentClick.bind(_this51);
8624
+ window.addEventListener('scroll', _this51._handleCloseBound, true);
8625
+ document.body.addEventListener('click', _this51._handleDocumentClickBound, true);
8503
8626
  }, 100);
8504
8627
  }, 0);
8505
8628
  }
@@ -8511,7 +8634,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8511
8634
  }, {
8512
8635
  key: "_animateOutToolbar",
8513
8636
  value: function _animateOutToolbar() {
8514
- var _this51 = this;
8637
+ var _this52 = this;
8515
8638
 
8516
8639
  var windowWidth = window.innerWidth;
8517
8640
  var windowHeight = window.innerHeight;
@@ -8542,26 +8665,26 @@ $jscomp.polyfill = function (e, r, p, m) {
8542
8665
  backdrop.remove();
8543
8666
 
8544
8667
  // Set initial state.
8545
- _this51.$el.css({
8668
+ _this52.$el.css({
8546
8669
  'text-align': '',
8547
8670
  width: '',
8548
8671
  bottom: '',
8549
8672
  left: '',
8550
8673
  overflow: '',
8551
8674
  'background-color': '',
8552
- transform: 'translate3d(' + -_this51.offsetX + 'px,0,0)'
8675
+ transform: 'translate3d(' + -_this52.offsetX + 'px,0,0)'
8553
8676
  });
8554
- _this51.$anchor.css({
8677
+ _this52.$anchor.css({
8555
8678
  overflow: '',
8556
- transform: 'translate3d(0,' + _this51.offsetY + 'px,0)'
8679
+ transform: 'translate3d(0,' + _this52.offsetY + 'px,0)'
8557
8680
  });
8558
8681
 
8559
8682
  setTimeout(function () {
8560
- _this51.$el.css({
8683
+ _this52.$el.css({
8561
8684
  transform: 'translate3d(0,0,0)',
8562
8685
  transition: 'transform .2s'
8563
8686
  });
8564
- _this51.$anchor.css({
8687
+ _this52.$anchor.css({
8565
8688
  transform: 'translate3d(0,0,0)',
8566
8689
  transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
8567
8690
  });
@@ -8604,6 +8727,8 @@ $jscomp.polyfill = function (e, r, p, m) {
8604
8727
  'use strict';
8605
8728
 
8606
8729
  var _defaults = {
8730
+ // Close when date is selected
8731
+ autoClose: false,
8607
8732
 
8608
8733
  // the default output format for the input field value
8609
8734
  format: 'mmm dd, yyyy',
@@ -8696,53 +8821,51 @@ $jscomp.polyfill = function (e, r, p, m) {
8696
8821
  function Datepicker(el, options) {
8697
8822
  _classCallCheck(this, Datepicker);
8698
8823
 
8699
- var _this52 = _possibleConstructorReturn(this, (Datepicker.__proto__ || Object.getPrototypeOf(Datepicker)).call(this, Datepicker, el, options));
8824
+ var _this53 = _possibleConstructorReturn(this, (Datepicker.__proto__ || Object.getPrototypeOf(Datepicker)).call(this, Datepicker, el, options));
8700
8825
 
8701
- _this52.el.M_Datepicker = _this52;
8826
+ _this53.el.M_Datepicker = _this53;
8702
8827
 
8703
- _this52.options = $.extend({}, Datepicker.defaults, options);
8828
+ _this53.options = $.extend({}, Datepicker.defaults, options);
8704
8829
 
8705
8830
  // make sure i18n defaults are not lost when only few i18n option properties are passed
8706
8831
  if (!!options && options.hasOwnProperty('i18n') && typeof options.i18n === 'object') {
8707
- _this52.options.i18n = $.extend({}, Datepicker.defaults.i18n, options.i18n);
8832
+ _this53.options.i18n = $.extend({}, Datepicker.defaults.i18n, options.i18n);
8708
8833
  }
8709
8834
 
8710
8835
  // Remove time component from minDate and maxDate options
8711
- if (_this52.options.minDate) _this52.options.minDate.setHours(0, 0, 0, 0);
8712
- if (_this52.options.maxDate) _this52.options.maxDate.setHours(0, 0, 0, 0);
8836
+ if (_this53.options.minDate) _this53.options.minDate.setHours(0, 0, 0, 0);
8837
+ if (_this53.options.maxDate) _this53.options.maxDate.setHours(0, 0, 0, 0);
8713
8838
 
8714
- _this52.id = M.guid();
8839
+ _this53.id = M.guid();
8715
8840
 
8716
- _this52._setupVariables();
8717
- _this52._insertHTMLIntoDOM();
8718
- _this52._setupModal();
8841
+ _this53._setupVariables();
8842
+ _this53._insertHTMLIntoDOM();
8843
+ _this53._setupModal();
8719
8844
 
8720
- _this52._setupEventHandlers();
8845
+ _this53._setupEventHandlers();
8721
8846
 
8722
- if (!_this52.options.defaultDate) {
8723
- _this52.options.defaultDate = new Date(Date.parse(_this52.el.value));
8724
- _this52.options.setDefaultDate = true;
8847
+ if (!_this53.options.defaultDate) {
8848
+ _this53.options.defaultDate = new Date(Date.parse(_this53.el.value));
8725
8849
  }
8726
8850
 
8727
- var defDate = _this52.options.defaultDate;
8728
-
8851
+ var defDate = _this53.options.defaultDate;
8729
8852
  if (Datepicker._isDate(defDate)) {
8730
- if (_this52.options.setDefaultDate) {
8731
- _this52.setDate(defDate, true);
8853
+ if (_this53.options.setDefaultDate) {
8854
+ _this53.setDate(defDate, true);
8855
+ _this53.setInputValue();
8732
8856
  } else {
8733
- _this52.gotoDate(defDate);
8857
+ _this53.gotoDate(defDate);
8734
8858
  }
8735
8859
  } else {
8736
- _this52.gotoDate(new Date());
8860
+ _this53.gotoDate(new Date());
8737
8861
  }
8738
8862
 
8739
8863
  /**
8740
8864
  * Describes open/close state of datepicker
8741
8865
  * @type {Boolean}
8742
8866
  */
8743
- _this52.isOpen = false;
8744
-
8745
- return _this52;
8867
+ _this53.isOpen = false;
8868
+ return _this53;
8746
8869
  }
8747
8870
 
8748
8871
  _createClass(Datepicker, [{
@@ -8762,11 +8885,11 @@ $jscomp.polyfill = function (e, r, p, m) {
8762
8885
  }, {
8763
8886
  key: "destroySelects",
8764
8887
  value: function destroySelects() {
8765
- var oldYearSelect = this.calendarEl.querySelector('.pika-select-year');
8888
+ var oldYearSelect = this.calendarEl.querySelector('.orig-select-year');
8766
8889
  if (oldYearSelect) {
8767
8890
  M.FormSelect.getInstance(oldYearSelect).destroy();
8768
8891
  }
8769
- var oldMonthSelect = this.calendarEl.querySelector('.pika-select-month');
8892
+ var oldMonthSelect = this.calendarEl.querySelector('.orig-select-month');
8770
8893
  if (oldMonthSelect) {
8771
8894
  M.FormSelect.getInstance(oldMonthSelect).destroy();
8772
8895
  }
@@ -8791,19 +8914,19 @@ $jscomp.polyfill = function (e, r, p, m) {
8791
8914
  }, {
8792
8915
  key: "_setupModal",
8793
8916
  value: function _setupModal() {
8794
- var _this53 = this;
8917
+ var _this54 = this;
8795
8918
 
8796
8919
  this.modalEl.id = 'modal-' + this.id;
8797
8920
  this.modal = M.Modal.init(this.modalEl, {
8798
8921
  onCloseEnd: function () {
8799
- _this53.isOpen = false;
8922
+ _this54.isOpen = false;
8800
8923
  }
8801
8924
  });
8802
8925
  }
8803
8926
  }, {
8804
8927
  key: "toString",
8805
8928
  value: function toString(format) {
8806
- var _this54 = this;
8929
+ var _this55 = this;
8807
8930
 
8808
8931
  format = format || this.options.format;
8809
8932
  if (!Datepicker._isDate(this.date)) {
@@ -8812,8 +8935,8 @@ $jscomp.polyfill = function (e, r, p, m) {
8812
8935
 
8813
8936
  var formatArray = format.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
8814
8937
  var formattedDate = formatArray.map(function (label) {
8815
- if (_this54.formats[label]) {
8816
- return _this54.formats[label]();
8938
+ if (_this55.formats[label]) {
8939
+ return _this55.formats[label]();
8817
8940
  }
8818
8941
 
8819
8942
  return label;
@@ -8901,9 +9024,6 @@ $jscomp.polyfill = function (e, r, p, m) {
8901
9024
  month: date.getMonth(),
8902
9025
  year: date.getFullYear()
8903
9026
  }];
8904
- // if (this.options.mainCalendar === 'right') {
8905
- // this.calendars[0].month += 1 - this.options.numberOfMonths;
8906
- // }
8907
9027
  }
8908
9028
 
8909
9029
  this.adjustCalendars();
@@ -8912,12 +9032,6 @@ $jscomp.polyfill = function (e, r, p, m) {
8912
9032
  key: "adjustCalendars",
8913
9033
  value: function adjustCalendars() {
8914
9034
  this.calendars[0] = this.adjustCalendar(this.calendars[0]);
8915
- // for (let c = 1; c < this.options.numberOfMonths; c++) {
8916
- // this.calendars[c] = this.adjustCalendar({
8917
- // month: this.calendars[0].month + c,
8918
- // year: this.calendars[0].year
8919
- // });
8920
- // }
8921
9035
  this.draw();
8922
9036
  }
8923
9037
  }, {
@@ -9061,12 +9175,12 @@ $jscomp.polyfill = function (e, r, p, m) {
9061
9175
  if (opts.isEndRange) {
9062
9176
  arr.push('is-endrange');
9063
9177
  }
9064
- return '<td data-day="' + opts.day + '" class="' + arr.join(' ') + '" aria-selected="' + ariaSelected + '">' + '<button class="datepicker-day-button" type="button" ' + 'data-pika-year="' + opts.year + '" data-pika-month="' + opts.month + '" data-pika-day="' + opts.day + '">' + opts.day + '</button>' + '</td>';
9178
+ return "<td data-day=\"" + opts.day + "\" class=\"" + arr.join(' ') + "\" aria-selected=\"" + ariaSelected + "\">" + ("<button class=\"datepicker-day-button\" type=\"button\" data-year=\"" + opts.year + "\" data-month=\"" + opts.month + "\" data-day=\"" + opts.day + "\">" + opts.day + "</button>") + '</td>';
9065
9179
  }
9066
9180
  }, {
9067
9181
  key: "renderRow",
9068
9182
  value: function renderRow(days, isRTL, isRowSelected) {
9069
- return '<tr class="pika-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
9183
+ return '<tr class="datepicker-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
9070
9184
  }
9071
9185
  }, {
9072
9186
  key: "renderTable",
@@ -9079,7 +9193,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9079
9193
  var i = void 0,
9080
9194
  arr = [];
9081
9195
  for (i = 0; i < 7; i++) {
9082
- arr.push('<th scope="col"><abbr title="' + this.renderDayName(opts, i) + '">' + this.renderDayName(opts, i, true) + '</abbr></th>');
9196
+ arr.push("<th scope=\"col\"><abbr title=\"" + this.renderDayName(opts, i) + "\">" + this.renderDayName(opts, i, true) + "</abbr></th>");
9083
9197
  }
9084
9198
  return '<thead><tr>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</tr></thead>';
9085
9199
  }
@@ -9107,7 +9221,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9107
9221
  arr.push('<option value="' + (year === refYear ? i - c : 12 + i - c) + '"' + (i === month ? ' selected="selected"' : '') + (isMinYear && i < opts.minMonth || isMaxYear && i > opts.maxMonth ? 'disabled="disabled"' : '') + '>' + opts.i18n.months[i] + '</option>');
9108
9222
  }
9109
9223
 
9110
- monthHtml = '<select class="pika-select pika-select-month" tabindex="-1">' + arr.join('') + '</select>';
9224
+ monthHtml = '<select class="datepicker-select orig-select-month" tabindex="-1">' + arr.join('') + '</select>';
9111
9225
 
9112
9226
  if ($.isArray(opts.yearRange)) {
9113
9227
  i = opts.yearRange[0];
@@ -9119,14 +9233,14 @@ $jscomp.polyfill = function (e, r, p, m) {
9119
9233
 
9120
9234
  for (arr = []; i < j && i <= opts.maxYear; i++) {
9121
9235
  if (i >= opts.minYear) {
9122
- arr.push('<option value="' + i + '"' + (i === year ? ' selected="selected"' : '') + '>' + i + '</option>');
9236
+ arr.push("<option value=\"" + i + "\" " + (i === year ? 'selected="selected"' : '') + ">" + i + "</option>");
9123
9237
  }
9124
9238
  }
9125
9239
 
9126
- yearHtml = '<select class="pika-select pika-select-year" tabindex="-1">' + arr.join('') + '</select>';
9240
+ yearHtml = "<select class=\"datepicker-select orig-select-year\" tabindex=\"-1\">" + arr.join('') + "</select>";
9127
9241
 
9128
9242
  var leftArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg>';
9129
- html += '<button class="month-prev' + (prev ? '' : ' is-disabled') + '" type="button">' + leftArrow + '</button>';
9243
+ html += "<button class=\"month-prev" + (prev ? '' : ' is-disabled') + "\" type=\"button\">" + leftArrow + "</button>";
9130
9244
 
9131
9245
  html += '<div class="selects-container">';
9132
9246
  if (opts.showMonthAfterYear) {
@@ -9144,10 +9258,8 @@ $jscomp.polyfill = function (e, r, p, m) {
9144
9258
  next = false;
9145
9259
  }
9146
9260
 
9147
- // if (c === (this.options.numberOfMonths - 1) ) {
9148
9261
  var rightArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg>';
9149
- html += '<button class="month-next' + (next ? '' : ' is-disabled') + '" type="button">' + rightArrow + '</button>';
9150
- // }
9262
+ html += "<button class=\"month-next" + (next ? '' : ' is-disabled') + "\" type=\"button\">" + rightArrow + "</button>";
9151
9263
 
9152
9264
  return html += '</div>';
9153
9265
  }
@@ -9183,7 +9295,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9183
9295
  }
9184
9296
  }
9185
9297
 
9186
- randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
9298
+ randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
9187
9299
 
9188
9300
  for (var c = 0; c < 1; c++) {
9189
9301
  this._renderDateDisplay();
@@ -9195,10 +9307,16 @@ $jscomp.polyfill = function (e, r, p, m) {
9195
9307
  this.calendarEl.innerHTML = html;
9196
9308
 
9197
9309
  // Init Materialize Select
9198
- var yearSelect = this.calendarEl.querySelector('.pika-select-year');
9199
- var monthSelect = this.calendarEl.querySelector('.pika-select-month');
9200
- M.FormSelect.init(yearSelect, { classes: 'select-year', dropdownOptions: { container: document.body, constrainWidth: false } });
9201
- M.FormSelect.init(monthSelect, { classes: 'select-month', dropdownOptions: { container: document.body, constrainWidth: false } });
9310
+ var yearSelect = this.calendarEl.querySelector('.orig-select-year');
9311
+ var monthSelect = this.calendarEl.querySelector('.orig-select-month');
9312
+ M.FormSelect.init(yearSelect, {
9313
+ classes: 'select-year',
9314
+ dropdownOptions: { container: document.body, constrainWidth: false }
9315
+ });
9316
+ M.FormSelect.init(monthSelect, {
9317
+ classes: 'select-month',
9318
+ dropdownOptions: { container: document.body, constrainWidth: false }
9319
+ });
9202
9320
 
9203
9321
  // Add change handlers for select
9204
9322
  yearSelect.addEventListener('change', this._handleYearChange.bind(this));
@@ -9239,12 +9357,12 @@ $jscomp.polyfill = function (e, r, p, m) {
9239
9357
  }, {
9240
9358
  key: "_setupVariables",
9241
9359
  value: function _setupVariables() {
9242
- var _this55 = this;
9360
+ var _this56 = this;
9243
9361
 
9244
9362
  this.$modalEl = $(Datepicker._template);
9245
9363
  this.modalEl = this.$modalEl[0];
9246
9364
 
9247
- this.calendarEl = this.modalEl.querySelector('.pika-single');
9365
+ this.calendarEl = this.modalEl.querySelector('.datepicker-calendar');
9248
9366
 
9249
9367
  this.yearTextEl = this.modalEl.querySelector('.year-text');
9250
9368
  this.dateTextEl = this.modalEl.querySelector('.date-text');
@@ -9255,38 +9373,37 @@ $jscomp.polyfill = function (e, r, p, m) {
9255
9373
  this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel');
9256
9374
 
9257
9375
  this.formats = {
9258
-
9259
9376
  d: function () {
9260
- return _this55.date.getDate();
9377
+ return _this56.date.getDate();
9261
9378
  },
9262
9379
  dd: function () {
9263
- var d = _this55.date.getDate();
9380
+ var d = _this56.date.getDate();
9264
9381
  return (d < 10 ? '0' : '') + d;
9265
9382
  },
9266
9383
  ddd: function () {
9267
- return _this55.options.i18n.weekdaysShort[_this55.date.getDay()];
9384
+ return _this56.options.i18n.weekdaysShort[_this56.date.getDay()];
9268
9385
  },
9269
9386
  dddd: function () {
9270
- return _this55.options.i18n.weekdays[_this55.date.getDay()];
9387
+ return _this56.options.i18n.weekdays[_this56.date.getDay()];
9271
9388
  },
9272
9389
  m: function () {
9273
- return _this55.date.getMonth() + 1;
9390
+ return _this56.date.getMonth() + 1;
9274
9391
  },
9275
9392
  mm: function () {
9276
- var m = _this55.date.getMonth() + 1;
9393
+ var m = _this56.date.getMonth() + 1;
9277
9394
  return (m < 10 ? '0' : '') + m;
9278
9395
  },
9279
9396
  mmm: function () {
9280
- return _this55.options.i18n.monthsShort[_this55.date.getMonth()];
9397
+ return _this56.options.i18n.monthsShort[_this56.date.getMonth()];
9281
9398
  },
9282
9399
  mmmm: function () {
9283
- return _this55.options.i18n.months[_this55.date.getMonth()];
9400
+ return _this56.options.i18n.months[_this56.date.getMonth()];
9284
9401
  },
9285
9402
  yy: function () {
9286
- return ('' + _this55.date.getFullYear()).slice(2);
9403
+ return ('' + _this56.date.getFullYear()).slice(2);
9287
9404
  },
9288
9405
  yyyy: function () {
9289
- return _this55.date.getFullYear();
9406
+ return _this56.date.getFullYear();
9290
9407
  }
9291
9408
  };
9292
9409
  }
@@ -9326,24 +9443,16 @@ $jscomp.polyfill = function (e, r, p, m) {
9326
9443
  var $target = $(e.target);
9327
9444
  if (!$target.hasClass('is-disabled')) {
9328
9445
  if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) {
9329
- this.setDate(new Date(e.target.getAttribute('data-pika-year'), e.target.getAttribute('data-pika-month'), e.target.getAttribute('data-pika-day')));
9446
+ this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day')));
9447
+ if (this.options.autoClose) {
9448
+ this._finishSelection();
9449
+ }
9330
9450
  } else if ($target.closest('.month-prev').length) {
9331
9451
  this.prevMonth();
9332
9452
  } else if ($target.closest('.month-next').length) {
9333
9453
  this.nextMonth();
9334
9454
  }
9335
9455
  }
9336
- // if (!$target.hasClass('pika-select')) {
9337
- // // if this is touch event prevent mouse events emulation
9338
- // // if (e.preventDefault) {
9339
- // // e.preventDefault();
9340
- // // } else {
9341
- // // e.returnValue = false;
9342
- // // return false;
9343
- // // }
9344
- // } else {
9345
- // this._c = true;
9346
- // }
9347
9456
  }
9348
9457
  }, {
9349
9458
  key: "_handleClearClick",
@@ -9406,9 +9515,6 @@ $jscomp.polyfill = function (e, r, p, m) {
9406
9515
  if (Datepicker._isDate(date)) {
9407
9516
  this.setDate(date);
9408
9517
  }
9409
- // if (!self._v) {
9410
- // self.show();
9411
- // }
9412
9518
  }
9413
9519
  }, {
9414
9520
  key: "renderDayName",
@@ -9534,7 +9640,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9534
9640
  return Datepicker;
9535
9641
  }(Component);
9536
9642
 
9537
- Datepicker._template = ['<div class= "modal datepicker-modal">', '<div class="modal-content datepicker-container">', '<div class="datepicker-date-display">', '<span class="year-text"></span>', '<span class="date-text"></span>', '</div>', '<div class="datepicker-calendar-container">', '<div class="pika-single"></div>', '<div class="datepicker-footer">', '<button class="btn-flat datepicker-clear waves-effect" style="visibility: hidden;" type="button"></button>', '<div class="confirmation-btns">', '<button class="btn-flat datepicker-cancel waves-effect" type="button"></button>', '<button class="btn-flat datepicker-done waves-effect" type="button"></button>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
9643
+ Datepicker._template = ['<div class= "modal datepicker-modal">', '<div class="modal-content datepicker-container">', '<div class="datepicker-date-display">', '<span class="year-text"></span>', '<span class="date-text"></span>', '</div>', '<div class="datepicker-calendar-container">', '<div class="datepicker-calendar"></div>', '<div class="datepicker-footer">', '<button class="btn-flat datepicker-clear waves-effect" style="visibility: hidden;" type="button"></button>', '<div class="confirmation-btns">', '<button class="btn-flat datepicker-cancel waves-effect" type="button"></button>', '<button class="btn-flat datepicker-done waves-effect" type="button"></button>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
9538
9644
 
9539
9645
  M.Datepicker = Datepicker;
9540
9646
 
@@ -9565,7 +9671,14 @@ $jscomp.polyfill = function (e, r, p, m) {
9565
9671
 
9566
9672
  autoClose: false, // auto close when minute is selected
9567
9673
  twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
9568
- vibrate: true // vibrate the device when dragging clock hand
9674
+ vibrate: true, // vibrate the device when dragging clock hand
9675
+
9676
+ // Callbacks
9677
+ onOpenStart: null,
9678
+ onOpenEnd: null,
9679
+ onCloseStart: null,
9680
+ onCloseEnd: null,
9681
+ onSelect: null
9569
9682
  };
9570
9683
 
9571
9684
  /**
@@ -9579,21 +9692,21 @@ $jscomp.polyfill = function (e, r, p, m) {
9579
9692
  function Timepicker(el, options) {
9580
9693
  _classCallCheck(this, Timepicker);
9581
9694
 
9582
- var _this56 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options));
9695
+ var _this57 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options));
9583
9696
 
9584
- _this56.el.M_Timepicker = _this56;
9697
+ _this57.el.M_Timepicker = _this57;
9585
9698
 
9586
- _this56.options = $.extend({}, Timepicker.defaults, options);
9699
+ _this57.options = $.extend({}, Timepicker.defaults, options);
9587
9700
 
9588
- _this56.id = M.guid();
9589
- _this56._insertHTMLIntoDOM();
9590
- _this56._setupModal();
9591
- _this56._setupVariables();
9592
- _this56._setupEventHandlers();
9701
+ _this57.id = M.guid();
9702
+ _this57._insertHTMLIntoDOM();
9703
+ _this57._setupModal();
9704
+ _this57._setupVariables();
9705
+ _this57._setupEventHandlers();
9593
9706
 
9594
- _this56._clockSetup();
9595
- _this56._pickerSetup();
9596
- return _this56;
9707
+ _this57._clockSetup();
9708
+ _this57._pickerSetup();
9709
+ return _this57;
9597
9710
  }
9598
9711
 
9599
9712
  _createClass(Timepicker, [{
@@ -9688,7 +9801,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9688
9801
  }, {
9689
9802
  key: "_handleDocumentClickEnd",
9690
9803
  value: function _handleDocumentClickEnd(e) {
9691
- var _this57 = this;
9804
+ var _this58 = this;
9692
9805
 
9693
9806
  e.preventDefault();
9694
9807
  document.removeEventListener('mouseup', this._handleDocumentClickEndBound);
@@ -9705,10 +9818,14 @@ $jscomp.polyfill = function (e, r, p, m) {
9705
9818
  } else if (this.options.autoClose) {
9706
9819
  $(this.minutesView).addClass('timepicker-dial-out');
9707
9820
  setTimeout(function () {
9708
- _this57.done();
9821
+ _this58.done();
9709
9822
  }, this.options.duration / 2);
9710
9823
  }
9711
9824
 
9825
+ if (typeof this.options.onSelect === 'function') {
9826
+ this.options.onSelect.call(this, this.hours, this.minutes);
9827
+ }
9828
+
9712
9829
  // Unbind mousemove event
9713
9830
  document.removeEventListener('mousemove', this._handleDocumentClickMoveBound);
9714
9831
  document.removeEventListener('touchmove', this._handleDocumentClickMoveBound);
@@ -9731,11 +9848,17 @@ $jscomp.polyfill = function (e, r, p, m) {
9731
9848
  }, {
9732
9849
  key: "_setupModal",
9733
9850
  value: function _setupModal() {
9734
- var _this58 = this;
9851
+ var _this59 = this;
9735
9852
 
9736
9853
  this.modal = M.Modal.init(this.modalEl, {
9854
+ onOpenStart: this.options.onOpenStart,
9855
+ onOpenEnd: this.options.onOpenEnd,
9856
+ onCloseStart: this.options.onCloseStart,
9737
9857
  onCloseEnd: function () {
9738
- _this58.isOpen = false;
9858
+ if (typeof _this59.options.onCloseEnd === 'function') {
9859
+ _this59.options.onCloseEnd.call(_this59);
9860
+ }
9861
+ _this59.isOpen = false;
9739
9862
  }
9740
9863
  });
9741
9864
  }
@@ -9759,8 +9882,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9759
9882
  }, {
9760
9883
  key: "_pickerSetup",
9761
9884
  value: function _pickerSetup() {
9762
-
9763
- var $clearBtn = $('<button class="btn-flat timepicker-clear waves-effect" style="visibility: hidden;" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.clear + '</button>').appendTo(this.footer).on('click', this.clear.bind(this));
9885
+ var $clearBtn = $("<button class=\"btn-flat timepicker-clear waves-effect\" style=\"visibility: hidden;\" type=\"button\" tabindex=\"" + (this.options.twelveHour ? '3' : '1') + "\">" + this.options.i18n.clear + "</button>").appendTo(this.footer).on('click', this.clear.bind(this));
9764
9886
  if (this.options.showClearBtn) {
9765
9887
  $clearBtn.css({ visibility: '' });
9766
9888
  }
@@ -9891,12 +10013,12 @@ $jscomp.polyfill = function (e, r, p, m) {
9891
10013
  // Get the time
9892
10014
  var value = ((this.el.value || this.options.defaultTime || '') + '').split(':');
9893
10015
  if (this.options.twelveHour && !(typeof value[1] === 'undefined')) {
9894
- if (value[1].toUpperCase().indexOf("AM") > 0) {
10016
+ if (value[1].toUpperCase().indexOf('AM') > 0) {
9895
10017
  this.amOrPm = 'AM';
9896
10018
  } else {
9897
10019
  this.amOrPm = 'PM';
9898
10020
  }
9899
- value[1] = value[1].replace("AM", "").replace("PM", "");
10021
+ value[1] = value[1].replace('AM', '').replace('PM', '');
9900
10022
  }
9901
10023
  if (value[0] === 'now') {
9902
10024
  var now = new Date(+new Date() + this.options.fromNow);
@@ -9915,7 +10037,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9915
10037
  }, {
9916
10038
  key: "showView",
9917
10039
  value: function showView(view, delay) {
9918
- if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
10040
+ if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') {
9919
10041
  // raiseCallback(this.options.beforeHourSelect);
9920
10042
  }
9921
10043
  var isHours = view === 'hours',
@@ -9965,7 +10087,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9965
10087
  }, {
9966
10088
  key: "setHand",
9967
10089
  value: function setHand(x, y, roundBy5) {
9968
- var _this59 = this;
10090
+ var _this60 = this;
9969
10091
 
9970
10092
  var radian = Math.atan2(x, -y),
9971
10093
  isHours = this.currentView === 'hours',
@@ -10020,7 +10142,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10020
10142
  if (!this.vibrateTimer) {
10021
10143
  navigator[this.vibrate](10);
10022
10144
  this.vibrateTimer = setTimeout(function () {
10023
- _this59.vibrateTimer = null;
10145
+ _this60.vibrateTimer = null;
10024
10146
  }, 100);
10025
10147
  }
10026
10148
  }
@@ -10053,6 +10175,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10053
10175
  this.isOpen = true;
10054
10176
  this._updateTimeFromInput();
10055
10177
  this.showView('hours');
10178
+
10056
10179
  this.modal.open();
10057
10180
  }
10058
10181
  }, {
@@ -10184,20 +10307,20 @@ $jscomp.polyfill = function (e, r, p, m) {
10184
10307
  function CharacterCounter(el, options) {
10185
10308
  _classCallCheck(this, CharacterCounter);
10186
10309
 
10187
- var _this60 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options));
10310
+ var _this61 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options));
10188
10311
 
10189
- _this60.el.M_CharacterCounter = _this60;
10312
+ _this61.el.M_CharacterCounter = _this61;
10190
10313
 
10191
10314
  /**
10192
10315
  * Options for the character counter
10193
10316
  */
10194
- _this60.options = $.extend({}, CharacterCounter.defaults, options);
10317
+ _this61.options = $.extend({}, CharacterCounter.defaults, options);
10195
10318
 
10196
- _this60.isInvalid = false;
10197
- _this60.isValidLength = false;
10198
- _this60._setupCounter();
10199
- _this60._setupEventHandlers();
10200
- return _this60;
10319
+ _this61.isInvalid = false;
10320
+ _this61.isValidLength = false;
10321
+ _this61._setupCounter();
10322
+ _this61._setupEventHandlers();
10323
+ return _this61;
10201
10324
  }
10202
10325
 
10203
10326
  _createClass(CharacterCounter, [{
@@ -10364,9 +10487,9 @@ $jscomp.polyfill = function (e, r, p, m) {
10364
10487
  function Carousel(el, options) {
10365
10488
  _classCallCheck(this, Carousel);
10366
10489
 
10367
- var _this61 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options));
10490
+ var _this62 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options));
10368
10491
 
10369
- _this61.el.M_Carousel = _this61;
10492
+ _this62.el.M_Carousel = _this62;
10370
10493
 
10371
10494
  /**
10372
10495
  * Options for the carousel
@@ -10381,38 +10504,38 @@ $jscomp.polyfill = function (e, r, p, m) {
10381
10504
  * @prop {Boolean} noWrap
10382
10505
  * @prop {Function} onCycleTo
10383
10506
  */
10384
- _this61.options = $.extend({}, Carousel.defaults, options);
10507
+ _this62.options = $.extend({}, Carousel.defaults, options);
10385
10508
 
10386
10509
  // Setup
10387
- _this61.hasMultipleSlides = _this61.$el.find('.carousel-item').length > 1;
10388
- _this61.showIndicators = _this61.options.indicators && _this61.hasMultipleSlides;
10389
- _this61.noWrap = _this61.options.noWrap || !_this61.hasMultipleSlides;
10390
- _this61.pressed = false;
10391
- _this61.dragged = false;
10392
- _this61.offset = _this61.target = 0;
10393
- _this61.images = [];
10394
- _this61.itemWidth = _this61.$el.find('.carousel-item').first().innerWidth();
10395
- _this61.itemHeight = _this61.$el.find('.carousel-item').first().innerHeight();
10396
- _this61.dim = _this61.itemWidth * 2 + _this61.options.padding || 1; // Make sure dim is non zero for divisions.
10397
- _this61._autoScrollBound = _this61._autoScroll.bind(_this61);
10398
- _this61._trackBound = _this61._track.bind(_this61);
10510
+ _this62.hasMultipleSlides = _this62.$el.find('.carousel-item').length > 1;
10511
+ _this62.showIndicators = _this62.options.indicators && _this62.hasMultipleSlides;
10512
+ _this62.noWrap = _this62.options.noWrap || !_this62.hasMultipleSlides;
10513
+ _this62.pressed = false;
10514
+ _this62.dragged = false;
10515
+ _this62.offset = _this62.target = 0;
10516
+ _this62.images = [];
10517
+ _this62.itemWidth = _this62.$el.find('.carousel-item').first().innerWidth();
10518
+ _this62.itemHeight = _this62.$el.find('.carousel-item').first().innerHeight();
10519
+ _this62.dim = _this62.itemWidth * 2 + _this62.options.padding || 1; // Make sure dim is non zero for divisions.
10520
+ _this62._autoScrollBound = _this62._autoScroll.bind(_this62);
10521
+ _this62._trackBound = _this62._track.bind(_this62);
10399
10522
 
10400
10523
  // Full Width carousel setup
10401
- if (_this61.options.fullWidth) {
10402
- _this61.options.dist = 0;
10403
- _this61._setCarouselHeight();
10524
+ if (_this62.options.fullWidth) {
10525
+ _this62.options.dist = 0;
10526
+ _this62._setCarouselHeight();
10404
10527
 
10405
10528
  // Offset fixed items when indicators.
10406
- if (_this61.showIndicators) {
10407
- _this61.$el.find('.carousel-fixed-item').addClass('with-indicators');
10529
+ if (_this62.showIndicators) {
10530
+ _this62.$el.find('.carousel-fixed-item').addClass('with-indicators');
10408
10531
  }
10409
10532
  }
10410
10533
 
10411
10534
  // Iterate through slides
10412
- _this61.$indicators = $('<ul class="indicators"></ul>');
10413
- _this61.$el.find('.carousel-item').each(function (el, i) {
10414
- _this61.images.push(el);
10415
- if (_this61.showIndicators) {
10535
+ _this62.$indicators = $('<ul class="indicators"></ul>');
10536
+ _this62.$el.find('.carousel-item').each(function (el, i) {
10537
+ _this62.images.push(el);
10538
+ if (_this62.showIndicators) {
10416
10539
  var $indicator = $('<li class="indicator-item"></li>');
10417
10540
 
10418
10541
  // Add active to first by default.
@@ -10420,31 +10543,31 @@ $jscomp.polyfill = function (e, r, p, m) {
10420
10543
  $indicator[0].classList.add('active');
10421
10544
  }
10422
10545
 
10423
- _this61.$indicators.append($indicator);
10546
+ _this62.$indicators.append($indicator);
10424
10547
  }
10425
10548
  });
10426
- if (_this61.showIndicators) {
10427
- _this61.$el.append(_this61.$indicators);
10549
+ if (_this62.showIndicators) {
10550
+ _this62.$el.append(_this62.$indicators);
10428
10551
  }
10429
- _this61.count = _this61.images.length;
10552
+ _this62.count = _this62.images.length;
10430
10553
 
10431
10554
  // Cap numVisible at count
10432
- _this61.options.numVisible = Math.min(_this61.count, _this61.options.numVisible);
10555
+ _this62.options.numVisible = Math.min(_this62.count, _this62.options.numVisible);
10433
10556
 
10434
10557
  // Setup cross browser string
10435
- _this61.xform = 'transform';
10558
+ _this62.xform = 'transform';
10436
10559
  ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
10437
10560
  var e = prefix + 'Transform';
10438
10561
  if (typeof document.body.style[e] !== 'undefined') {
10439
- _this61.xform = e;
10562
+ _this62.xform = e;
10440
10563
  return false;
10441
10564
  }
10442
10565
  return true;
10443
10566
  });
10444
10567
 
10445
- _this61._setupEventHandlers();
10446
- _this61._scroll(_this61.offset);
10447
- return _this61;
10568
+ _this62._setupEventHandlers();
10569
+ _this62._scroll(_this62.offset);
10570
+ return _this62;
10448
10571
  }
10449
10572
 
10450
10573
  _createClass(Carousel, [{
@@ -10466,7 +10589,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10466
10589
  }, {
10467
10590
  key: "_setupEventHandlers",
10468
10591
  value: function _setupEventHandlers() {
10469
- var _this62 = this;
10592
+ var _this63 = this;
10470
10593
 
10471
10594
  this._handleCarouselTapBound = this._handleCarouselTap.bind(this);
10472
10595
  this._handleCarouselDragBound = this._handleCarouselDrag.bind(this);
@@ -10488,7 +10611,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10488
10611
  if (this.showIndicators && this.$indicators) {
10489
10612
  this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
10490
10613
  this.$indicators.find('.indicator-item').each(function (el, i) {
10491
- el.addEventListener('click', _this62._handleIndicatorClickBound);
10614
+ el.addEventListener('click', _this63._handleIndicatorClickBound);
10492
10615
  });
10493
10616
  }
10494
10617
 
@@ -10506,7 +10629,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10506
10629
  }, {
10507
10630
  key: "_removeEventHandlers",
10508
10631
  value: function _removeEventHandlers() {
10509
- var _this63 = this;
10632
+ var _this64 = this;
10510
10633
 
10511
10634
  if (typeof window.ontouchstart !== 'undefined') {
10512
10635
  this.el.removeEventListener('touchstart', this._handleCarouselTapBound);
@@ -10521,7 +10644,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10521
10644
 
10522
10645
  if (this.showIndicators && this.$indicators) {
10523
10646
  this.$indicators.find('.indicator-item').each(function (el, i) {
10524
- el.removeEventListener('click', _this63._handleIndicatorClickBound);
10647
+ el.removeEventListener('click', _this64._handleIndicatorClickBound);
10525
10648
  });
10526
10649
  }
10527
10650
 
@@ -10707,7 +10830,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10707
10830
  }, {
10708
10831
  key: "_setCarouselHeight",
10709
10832
  value: function _setCarouselHeight(imageOnly) {
10710
- var _this64 = this;
10833
+ var _this65 = this;
10711
10834
 
10712
10835
  var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first();
10713
10836
  var firstImage = firstSlide.find('img').first();
@@ -10727,7 +10850,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10727
10850
  } else {
10728
10851
  // Get height when image is loaded normally
10729
10852
  firstImage.one('load', function (el, i) {
10730
- _this64.$el.css('height', el.offsetHeight + 'px');
10853
+ _this65.$el.css('height', el.offsetHeight + 'px');
10731
10854
  });
10732
10855
  }
10733
10856
  } else if (!imageOnly) {
@@ -10833,7 +10956,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10833
10956
  }, {
10834
10957
  key: "_scroll",
10835
10958
  value: function _scroll(x) {
10836
- var _this65 = this;
10959
+ var _this66 = this;
10837
10960
 
10838
10961
  // Track scrolling state
10839
10962
  if (!this.$el.hasClass('scrolling')) {
@@ -10843,7 +10966,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10843
10966
  window.clearTimeout(this.scrollingTimeout);
10844
10967
  }
10845
10968
  this.scrollingTimeout = window.setTimeout(function () {
10846
- _this65.$el.removeClass('scrolling');
10969
+ _this66.$el.removeClass('scrolling');
10847
10970
  }, this.options.duration);
10848
10971
 
10849
10972
  // Start actual scroll
@@ -10896,7 +11019,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10896
11019
  this.$el.find('.carousel-item').removeClass('active');
10897
11020
  el.classList.add('active');
10898
11021
  }
10899
- var transformString = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
11022
+ var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)";
10900
11023
  this._updateItemStyle(el, centerTweenedOpacity, 0, transformString);
10901
11024
  }
10902
11025
 
@@ -10912,7 +11035,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10912
11035
  // Don't show wrapped items.
10913
11036
  if (!this.noWrap || this.center + i < this.count) {
10914
11037
  el = this.images[this._wrap(this.center + i)];
10915
- var _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
11038
+ var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)";
10916
11039
  this._updateItemStyle(el, tweenedOpacity, -i, _transformString);
10917
11040
  }
10918
11041
 
@@ -10927,7 +11050,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10927
11050
  // Don't show wrapped items.
10928
11051
  if (!this.noWrap || this.center - i >= 0) {
10929
11052
  el = this.images[this._wrap(this.center - i)];
10930
- var _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
11053
+ var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)";
10931
11054
  this._updateItemStyle(el, tweenedOpacity, -i, _transformString2);
10932
11055
  }
10933
11056
  }
@@ -10936,18 +11059,18 @@ $jscomp.polyfill = function (e, r, p, m) {
10936
11059
  // Don't show wrapped items.
10937
11060
  if (!this.noWrap || this.center >= 0 && this.center < this.count) {
10938
11061
  el = this.images[this._wrap(this.center)];
10939
- var _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
11062
+ var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)";
10940
11063
  this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3);
10941
11064
  }
10942
11065
 
10943
11066
  // onCycleTo callback
10944
11067
  var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center));
10945
- if (lastCenter !== this.center && typeof this.options.onCycleTo === "function") {
11068
+ if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') {
10946
11069
  this.options.onCycleTo.call(this, $currItem[0], this.dragged);
10947
11070
  }
10948
11071
 
10949
11072
  // One time callback
10950
- if (typeof this.oneTimeCallback === "function") {
11073
+ if (typeof this.oneTimeCallback === 'function') {
10951
11074
  this.oneTimeCallback.call(this, $currItem[0], this.dragged);
10952
11075
  this.oneTimeCallback = null;
10953
11076
  }
@@ -11005,7 +11128,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11005
11128
  }
11006
11129
 
11007
11130
  // Set one time callback
11008
- if (typeof callback === "function") {
11131
+ if (typeof callback === 'function') {
11009
11132
  this.oneTimeCallback = callback;
11010
11133
  }
11011
11134
 
@@ -11030,7 +11153,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11030
11153
  }
11031
11154
 
11032
11155
  var index = this.center + n;
11033
- if (index > this.count || index < 0) {
11156
+ if (index >= this.count || index < 0) {
11034
11157
  if (this.noWrap) {
11035
11158
  return;
11036
11159
  }
@@ -11053,7 +11176,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11053
11176
  }
11054
11177
 
11055
11178
  var index = this.center - n;
11056
- if (index > this.count || index < 0) {
11179
+ if (index >= this.count || index < 0) {
11057
11180
  if (this.noWrap) {
11058
11181
  return;
11059
11182
  }
@@ -11144,9 +11267,9 @@ $jscomp.polyfill = function (e, r, p, m) {
11144
11267
  function TapTarget(el, options) {
11145
11268
  _classCallCheck(this, TapTarget);
11146
11269
 
11147
- var _this66 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options));
11270
+ var _this67 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options));
11148
11271
 
11149
- _this66.el.M_TapTarget = _this66;
11272
+ _this67.el.M_TapTarget = _this67;
11150
11273
 
11151
11274
  /**
11152
11275
  * Options for the select
@@ -11154,17 +11277,17 @@ $jscomp.polyfill = function (e, r, p, m) {
11154
11277
  * @prop {Function} onOpen - Callback function called when feature discovery is opened
11155
11278
  * @prop {Function} onClose - Callback function called when feature discovery is closed
11156
11279
  */
11157
- _this66.options = $.extend({}, TapTarget.defaults, options);
11280
+ _this67.options = $.extend({}, TapTarget.defaults, options);
11158
11281
 
11159
- _this66.isOpen = false;
11282
+ _this67.isOpen = false;
11160
11283
 
11161
11284
  // setup
11162
- _this66.$origin = $('#' + _this66.$el.attr('data-target'));
11163
- _this66._setup();
11285
+ _this67.$origin = $('#' + _this67.$el.attr('data-target'));
11286
+ _this67._setup();
11164
11287
 
11165
- _this66._calculatePositioning();
11166
- _this66._setupEventHandlers();
11167
- return _this66;
11288
+ _this67._calculatePositioning();
11289
+ _this67._setupEventHandlers();
11290
+ return _this67;
11168
11291
  }
11169
11292
 
11170
11293
  _createClass(TapTarget, [{
@@ -11499,30 +11622,30 @@ $jscomp.polyfill = function (e, r, p, m) {
11499
11622
  _classCallCheck(this, FormSelect);
11500
11623
 
11501
11624
  // Don't init if browser default version
11502
- var _this67 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options));
11625
+ var _this68 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options));
11503
11626
 
11504
- if (_this67.$el.hasClass('browser-default')) {
11505
- return _possibleConstructorReturn(_this67);
11627
+ if (_this68.$el.hasClass('browser-default')) {
11628
+ return _possibleConstructorReturn(_this68);
11506
11629
  }
11507
11630
 
11508
- _this67.el.M_FormSelect = _this67;
11631
+ _this68.el.M_FormSelect = _this68;
11509
11632
 
11510
11633
  /**
11511
11634
  * Options for the select
11512
11635
  * @member FormSelect#options
11513
11636
  */
11514
- _this67.options = $.extend({}, FormSelect.defaults, options);
11637
+ _this68.options = $.extend({}, FormSelect.defaults, options);
11515
11638
 
11516
- _this67.isMultiple = _this67.$el.prop('multiple');
11639
+ _this68.isMultiple = _this68.$el.prop('multiple');
11517
11640
 
11518
11641
  // Setup
11519
- _this67.el.tabIndex = -1;
11520
- _this67._keysSelected = {};
11521
- _this67._valueDict = {}; // Maps key to original and generated option element.
11522
- _this67._setupDropdown();
11642
+ _this68.el.tabIndex = -1;
11643
+ _this68._keysSelected = {};
11644
+ _this68._valueDict = {}; // Maps key to original and generated option element.
11645
+ _this68._setupDropdown();
11523
11646
 
11524
- _this67._setupEventHandlers();
11525
- return _this67;
11647
+ _this68._setupEventHandlers();
11648
+ return _this68;
11526
11649
  }
11527
11650
 
11528
11651
  _createClass(FormSelect, [{
@@ -11545,14 +11668,14 @@ $jscomp.polyfill = function (e, r, p, m) {
11545
11668
  }, {
11546
11669
  key: "_setupEventHandlers",
11547
11670
  value: function _setupEventHandlers() {
11548
- var _this68 = this;
11671
+ var _this69 = this;
11549
11672
 
11550
11673
  this._handleSelectChangeBound = this._handleSelectChange.bind(this);
11551
11674
  this._handleOptionClickBound = this._handleOptionClick.bind(this);
11552
11675
  this._handleInputClickBound = this._handleInputClick.bind(this);
11553
11676
 
11554
11677
  $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) {
11555
- el.addEventListener('click', _this68._handleOptionClickBound);
11678
+ el.addEventListener('click', _this69._handleOptionClickBound);
11556
11679
  });
11557
11680
  this.el.addEventListener('change', this._handleSelectChangeBound);
11558
11681
  this.input.addEventListener('click', this._handleInputClickBound);
@@ -11565,10 +11688,10 @@ $jscomp.polyfill = function (e, r, p, m) {
11565
11688
  }, {
11566
11689
  key: "_removeEventHandlers",
11567
11690
  value: function _removeEventHandlers() {
11568
- var _this69 = this;
11691
+ var _this70 = this;
11569
11692
 
11570
11693
  $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) {
11571
- el.removeEventListener('click', _this69._handleOptionClickBound);
11694
+ el.removeEventListener('click', _this70._handleOptionClickBound);
11572
11695
  });
11573
11696
  this.el.removeEventListener('change', this._handleSelectChangeBound);
11574
11697
  this.input.removeEventListener('click', this._handleInputClickBound);
@@ -11607,19 +11730,19 @@ $jscomp.polyfill = function (e, r, p, m) {
11607
11730
  placeholderOption.find('input[type="checkbox"]').prop('checked', false);
11608
11731
  this._toggleEntryFromArray(placeholderOption[0].id);
11609
11732
  }
11610
-
11611
- var checkbox = $(option).find('input[type="checkbox"]');
11612
- checkbox.prop('checked', !checkbox.prop('checked'));
11613
11733
  selected = this._toggleEntryFromArray(key);
11614
11734
  } else {
11615
- $(this.dropdownOptions).find('li').removeClass('active');
11616
- $(option).toggleClass('active');
11617
- this.input.value = option.textContent;
11735
+ $(this.dropdownOptions).find('li').removeClass('selected');
11736
+ $(option).toggleClass('selected', selected);
11618
11737
  }
11619
11738
 
11620
- this._activateOption($(this.dropdownOptions), option);
11621
- $(this._valueDict[key].el).prop('selected', selected);
11622
- this.$el.trigger('change');
11739
+ // Set selected on original select option
11740
+ // Only trigger if selected state changed
11741
+ var prevSelected = $(this._valueDict[key].el).prop('selected');
11742
+ if (prevSelected !== selected) {
11743
+ $(this._valueDict[key].el).prop('selected', selected);
11744
+ this.$el.trigger('change');
11745
+ }
11623
11746
  }
11624
11747
 
11625
11748
  e.stopPropagation();
@@ -11645,10 +11768,10 @@ $jscomp.polyfill = function (e, r, p, m) {
11645
11768
  }, {
11646
11769
  key: "_setupDropdown",
11647
11770
  value: function _setupDropdown() {
11648
- var _this70 = this;
11771
+ var _this71 = this;
11649
11772
 
11650
11773
  this.wrapper = document.createElement('div');
11651
- $(this.wrapper).addClass('select-wrapper' + ' ' + this.options.classes);
11774
+ $(this.wrapper).addClass('select-wrapper ' + this.options.classes);
11652
11775
  this.$el.before($(this.wrapper));
11653
11776
  this.wrapper.appendChild(this.el);
11654
11777
 
@@ -11668,21 +11791,21 @@ $jscomp.polyfill = function (e, r, p, m) {
11668
11791
  if ($(el).is('option')) {
11669
11792
  // Direct descendant option.
11670
11793
  var optionEl = void 0;
11671
- if (_this70.isMultiple) {
11672
- optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'multiple');
11794
+ if (_this71.isMultiple) {
11795
+ optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'multiple');
11673
11796
  } else {
11674
- optionEl = _this70._appendOptionWithIcon(_this70.$el, el);
11797
+ optionEl = _this71._appendOptionWithIcon(_this71.$el, el);
11675
11798
  }
11676
11799
 
11677
- _this70._addOptionToValueDict(el, optionEl);
11800
+ _this71._addOptionToValueDict(el, optionEl);
11678
11801
  } else if ($(el).is('optgroup')) {
11679
11802
  // Optgroup.
11680
11803
  var selectOptions = $(el).children('option');
11681
- $(_this70.dropdownOptions).append($('<li class="optgroup"><span>' + el.getAttribute('label') + '</span></li>')[0]);
11804
+ $(_this71.dropdownOptions).append($('<li class="optgroup"><span>' + el.getAttribute('label') + '</span></li>')[0]);
11682
11805
 
11683
11806
  selectOptions.each(function (el) {
11684
- var optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'optgroup-option');
11685
- _this70._addOptionToValueDict(el, optionEl);
11807
+ var optionEl = _this71._appendOptionWithIcon(_this71.$el, el, 'optgroup-option');
11808
+ _this71._addOptionToValueDict(el, optionEl);
11686
11809
  });
11687
11810
  }
11688
11811
  });
@@ -11713,11 +11836,21 @@ $jscomp.polyfill = function (e, r, p, m) {
11713
11836
 
11714
11837
  // Add callback for centering selected option when dropdown content is scrollable
11715
11838
  dropdownOptions.onOpenEnd = function (el) {
11716
- var selectedOption = $(_this70.dropdownOptions).find('.selected').first();
11717
- if (_this70.dropdown.isScrollable && selectedOption.length) {
11718
- var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this70.dropdownOptions.getBoundingClientRect().top; // scroll to selected option
11719
- scrollOffset -= _this70.dropdownOptions.clientHeight / 2; // center in dropdown
11720
- _this70.dropdownOptions.scrollTop = scrollOffset;
11839
+ var selectedOption = $(_this71.dropdownOptions).find('.selected').first();
11840
+
11841
+ if (selectedOption.length) {
11842
+ // Focus selected option in dropdown
11843
+ M.keyDown = true;
11844
+ _this71.dropdown.focusedIndex = selectedOption.index();
11845
+ _this71.dropdown._focusFocusedItem();
11846
+ M.keyDown = false;
11847
+
11848
+ // Handle scrolling to selected option
11849
+ if (_this71.dropdown.isScrollable) {
11850
+ var scrollOffset = selectedOption[0].getBoundingClientRect().top - _this71.dropdownOptions.getBoundingClientRect().top; // scroll to selected option
11851
+ scrollOffset -= _this71.dropdownOptions.clientHeight / 2; // center in dropdown
11852
+ _this71.dropdownOptions.scrollTop = scrollOffset;
11853
+ }
11721
11854
  }
11722
11855
  };
11723
11856
 
@@ -11787,9 +11920,8 @@ $jscomp.polyfill = function (e, r, p, m) {
11787
11920
 
11788
11921
  // add icons
11789
11922
  var iconUrl = option.getAttribute('data-icon');
11790
- var classes = option.getAttribute('class');
11791
11923
  if (!!iconUrl) {
11792
- var imgEl = $('<img alt="" src="' + iconUrl + '">');
11924
+ var imgEl = $("<img alt=\"\" src=\"" + iconUrl + "\">");
11793
11925
  liEl.prepend(imgEl);
11794
11926
  }
11795
11927
 
@@ -11808,49 +11940,54 @@ $jscomp.polyfill = function (e, r, p, m) {
11808
11940
  key: "_toggleEntryFromArray",
11809
11941
  value: function _toggleEntryFromArray(key) {
11810
11942
  var notAdded = !this._keysSelected.hasOwnProperty(key);
11943
+ var $optionLi = $(this._valueDict[key].optionEl);
11944
+
11811
11945
  if (notAdded) {
11812
11946
  this._keysSelected[key] = true;
11813
11947
  } else {
11814
11948
  delete this._keysSelected[key];
11815
11949
  }
11816
11950
 
11817
- $(this._valueDict[key].optionEl).toggleClass('active');
11951
+ $optionLi.toggleClass('selected', notAdded);
11952
+
11953
+ // Set checkbox checked value
11954
+ $optionLi.find('input[type="checkbox"]').prop('checked', notAdded);
11818
11955
 
11819
11956
  // use notAdded instead of true (to detect if the option is selected or not)
11820
- $(this._valueDict[key].el).prop('selected', notAdded);
11957
+ $optionLi.prop('selected', notAdded);
11821
11958
 
11822
11959
  return notAdded;
11823
11960
  }
11824
11961
 
11825
11962
  /**
11826
- * Set value to input
11963
+ * Set text value to input
11827
11964
  */
11828
11965
 
11829
11966
  }, {
11830
11967
  key: "_setValueToInput",
11831
11968
  value: function _setValueToInput() {
11832
- var value = '';
11969
+ var values = [];
11833
11970
  var options = this.$el.find('option');
11834
11971
 
11835
11972
  options.each(function (el) {
11836
11973
  if ($(el).prop('selected')) {
11837
11974
  var text = $(el).text();
11838
- value === '' ? value += text : value += ', ' + text;
11975
+ values.push(text);
11839
11976
  }
11840
11977
  });
11841
11978
 
11842
- if (value === '') {
11979
+ if (!values.length) {
11843
11980
  var firstDisabled = this.$el.find('option:disabled').eq(0);
11844
- if (firstDisabled.length) {
11845
- value = firstDisabled.text();
11981
+ if (firstDisabled.length && firstDisabled[0].value === '') {
11982
+ values.push(firstDisabled.text());
11846
11983
  }
11847
11984
  }
11848
11985
 
11849
- this.input.value = value;
11986
+ this.input.value = values.join(', ');
11850
11987
  }
11851
11988
 
11852
11989
  /**
11853
- * Set selected state of dropdown too match actual select element
11990
+ * Set selected state of dropdown to match actual select element
11854
11991
  */
11855
11992
 
11856
11993
  }, {
@@ -11860,12 +11997,12 @@ $jscomp.polyfill = function (e, r, p, m) {
11860
11997
 
11861
11998
  for (var key in this._valueDict) {
11862
11999
  var option = this._valueDict[key];
11863
- if ($(option.el).prop('selected')) {
11864
- $(option.optionEl).find('input[type="checkbox"]').prop("checked", true);
12000
+ var optionIsSelected = $(option.el).prop('selected');
12001
+ $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected);
12002
+ if (optionIsSelected) {
11865
12003
  this._activateOption($(this.dropdownOptions), $(option.optionEl));
11866
12004
  this._keysSelected[key] = true;
11867
12005
  } else {
11868
- $(option.optionEl).find('input[type="checkbox"]').prop("checked", false);
11869
12006
  $(option.optionEl).removeClass('selected');
11870
12007
  }
11871
12008
  }
@@ -11884,7 +12021,6 @@ $jscomp.polyfill = function (e, r, p, m) {
11884
12021
  if (!this.isMultiple) {
11885
12022
  collection.find('li.selected').removeClass('selected');
11886
12023
  }
11887
-
11888
12024
  var option = $(newOption);
11889
12025
  option.addClass('selected');
11890
12026
  }
@@ -11958,23 +12094,23 @@ $jscomp.polyfill = function (e, r, p, m) {
11958
12094
  function Range(el, options) {
11959
12095
  _classCallCheck(this, Range);
11960
12096
 
11961
- var _this71 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
12097
+ var _this72 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
11962
12098
 
11963
- _this71.el.M_Range = _this71;
12099
+ _this72.el.M_Range = _this72;
11964
12100
 
11965
12101
  /**
11966
12102
  * Options for the range
11967
12103
  * @member Range#options
11968
12104
  */
11969
- _this71.options = $.extend({}, Range.defaults, options);
12105
+ _this72.options = $.extend({}, Range.defaults, options);
11970
12106
 
11971
- _this71._mousedown = false;
12107
+ _this72._mousedown = false;
11972
12108
 
11973
12109
  // Setup
11974
- _this71._setupThumb();
12110
+ _this72._setupThumb();
11975
12111
 
11976
- _this71._setupEventHandlers();
11977
- return _this71;
12112
+ _this72._setupEventHandlers();
12113
+ return _this72;
11978
12114
  }
11979
12115
 
11980
12116
  _createClass(Range, [{
@@ -11998,14 +12134,12 @@ $jscomp.polyfill = function (e, r, p, m) {
11998
12134
  key: "_setupEventHandlers",
11999
12135
  value: function _setupEventHandlers() {
12000
12136
  this._handleRangeChangeBound = this._handleRangeChange.bind(this);
12001
- this._handleRangeFocusBound = this._handleRangeFocus.bind(this);
12002
12137
  this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
12003
12138
  this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this);
12004
12139
  this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
12005
12140
  this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this);
12006
12141
 
12007
12142
  this.el.addEventListener('change', this._handleRangeChangeBound);
12008
- this.el.addEventListener('focus', this._handleRangeFocusBound);
12009
12143
 
12010
12144
  this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
12011
12145
  this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
@@ -12030,7 +12164,6 @@ $jscomp.polyfill = function (e, r, p, m) {
12030
12164
  key: "_removeEventHandlers",
12031
12165
  value: function _removeEventHandlers() {
12032
12166
  this.el.removeEventListener('change', this._handleRangeChangeBound);
12033
- this.el.removeEventListener('focus', this._handleRangeFocusBound);
12034
12167
 
12035
12168
  this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
12036
12169
  this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
@@ -12065,19 +12198,6 @@ $jscomp.polyfill = function (e, r, p, m) {
12065
12198
  $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
12066
12199
  }
12067
12200
 
12068
- /**
12069
- * Handle Range Focus
12070
- * @param {Event} e
12071
- */
12072
-
12073
- }, {
12074
- key: "_handleRangeFocus",
12075
- value: function _handleRangeFocus() {
12076
- if (M.tabPressed) {
12077
- this.$el.addClass('focused');
12078
- }
12079
- }
12080
-
12081
12201
  /**
12082
12202
  * Handle Range Mousedown and Touchstart
12083
12203
  * @param {Event} e
@@ -12139,7 +12259,6 @@ $jscomp.polyfill = function (e, r, p, m) {
12139
12259
  key: "_handleRangeBlurMouseoutTouchleave",
12140
12260
  value: function _handleRangeBlurMouseoutTouchleave() {
12141
12261
  if (!this._mousedown) {
12142
- this.$el.removeClass('focused');
12143
12262
  var paddingLeft = parseInt(this.$el.css('padding-left'));
12144
12263
  var marginLeft = 7 + paddingLeft + 'px';
12145
12264
 
@@ -12214,8 +12333,8 @@ $jscomp.polyfill = function (e, r, p, m) {
12214
12333
  key: "_calcRangeOffset",
12215
12334
  value: function _calcRangeOffset() {
12216
12335
  var width = this.$el.width() - 15;
12217
- var max = parseFloat(this.$el.attr('max'));
12218
- var min = parseFloat(this.$el.attr('min'));
12336
+ var max = parseFloat(this.$el.attr('max')) || 100; // Range default max
12337
+ var min = parseFloat(this.$el.attr('min')) || 0; // Range default min
12219
12338
  var percent = (parseFloat(this.$el.val()) - min) / (max - min);
12220
12339
  return percent * width;
12221
12340
  }