materialize-sass 1.0.0.alpha4 → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d663fb262bda28a9d3a301ff8b967e730b79d54befd25c33ee449c914a5209c5
4
- data.tar.gz: 46a85c9259899296f1d0a55ee55cce924ebe3488b467b61e1ba677abbc481cde
3
+ metadata.gz: 4755204505bc3a5591234d26b238680d84484c3f938769b3f91facb5a5d07271
4
+ data.tar.gz: 9d78d633753c4a7dc26a2f263de490b25eae9219e00612bd27d9dd96c1230641
5
5
  SHA512:
6
- metadata.gz: 5f9201a2252c0d1be8a9c886f64219ea53594a9c26c03bc542bb979c4108c9775794c6a8a4280d052faea073ff7c1c9d5a9a9a5a352afa5f183213dc3386e7ed
7
- data.tar.gz: 661af14ace10a0779f7acdc0ed2c85e47e90d4713092aeaa837c80d9a9b9c5c37242940fab83234609b6a2277423c4c1f01f34031eee9c0ade6e2c745e32b643
6
+ metadata.gz: 2bce13964ed4bc9135583c28101ca1f1b97982a7bb1453bdcb9e056cc8bc4d69c32f28da44060387af99cfef922e536635b913e3d900b183be2258233284ceee
7
+ data.tar.gz: 455515535558551160a31c826d2fdec6c768b50ff59ee59cfc8e928d3eeb2ebeb17ac263d2f1eac739e61bea5f8e3ad73f9cace339b11344df1cbf1b9ee938a1
data/README.md CHANGED
@@ -7,7 +7,7 @@ example: http://materialize.labs.my/
7
7
  source: https://github.com/mkhairi/materialize-rails
8
8
 
9
9
  # Notices
10
- This master branch now v1.0.0.alpha4
10
+ This master branch now v1.0.0.beta
11
11
 
12
12
  Documentation for previous releases (v0.100.*) are available [this branch.](https://github.com/mkhairi/materialize-sass/tree/v0.100)
13
13
 
@@ -16,7 +16,7 @@ Documentation for previous releases (v0.100.*) are available [this branch.](http
16
16
  In your Gemfile you need to add the `materialize-sass` gem:
17
17
 
18
18
  ```ruby
19
- gem 'materialize-sass', '~> 1.0.0.alpha4'
19
+ gem 'materialize-sass', '~> 1.0.0.beta'
20
20
  ```
21
21
 
22
22
 
@@ -53,7 +53,7 @@ $ rm app/assets/stylesheets/application.css
53
53
  Since materialize color scheme are declared in color.scss you should import the color.scss first. then you can override color variable just like this:
54
54
 
55
55
  ```scss
56
- @import "materialize/components/color";
56
+ @import "materialize/components/color-variables";
57
57
  $primary-color: color("blue", "lighten-2") !default;
58
58
  $secondary-color: color("yellow", "base") !default;
59
59
  @import 'materialize';
data/Rakefile CHANGED
@@ -32,8 +32,7 @@ namespace :javascripts do
32
32
  task :turbolinks_init do
33
33
  files = Dir.glob('assets/javascripts/materialize/**/*.js').reject { |file| file.end_with?(".min.js") and File.file?(file) }
34
34
  files.each do |file|
35
- selected_files = %w(buttons.js cards.js character_counter.js chips.js collapsible.js
36
- dropdown.js forms.js materialbox.js scrollspy.js tabs.js tooltip.js transitions.js)
35
+ selected_files = %w(forms.js chips.js)
37
36
  file_name = File.basename file
38
37
  #only selected file
39
38
  if selected_files.include?(file_name)
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v1.0.0-alpha.4 (http://materializecss.com)
2
+ * Materialize v1.0.0-beta (http://materializecss.com)
3
3
  * Copyright 2014-2017 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
5
  */
@@ -1144,6 +1144,41 @@ M.initializeJqueryWrapper = function (plugin, pluginName, classRef) {
1144
1144
  };
1145
1145
  };
1146
1146
 
1147
+ /**
1148
+ * Automatically initialize components
1149
+ * @param {Element} context DOM Element to search within for components
1150
+ */
1151
+ M.AutoInit = function (context) {
1152
+ // Use document.body if no context is given
1153
+ var root = !!context ? context : document.body;
1154
+
1155
+ var registry = {
1156
+ Autocomplete: root.querySelectorAll('.autocomplete:not(.no-autoinit)'),
1157
+ Carousel: root.querySelectorAll('.carousel:not(.no-autoinit)'),
1158
+ Chips: root.querySelectorAll('.chips:not(.no-autoinit)'),
1159
+ Collapsible: root.querySelectorAll('.collapsible:not(.no-autoinit)'),
1160
+ Datepicker: root.querySelectorAll('.datepicker:not(.no-autoinit)'),
1161
+ Dropdown: root.querySelectorAll('.dropdown-trigger:not(.no-autoinit)'),
1162
+ Materialbox: root.querySelectorAll('.materialboxed:not(.no-autoinit)'),
1163
+ Modal: root.querySelectorAll('.modal:not(.no-autoinit)'),
1164
+ Parallax: root.querySelectorAll('.parallax:not(.no-autoinit)'),
1165
+ Pushpin: root.querySelectorAll('.pushpin:not(.no-autoinit)'),
1166
+ ScrollSpy: root.querySelectorAll('.scrollspy:not(.no-autoinit)'),
1167
+ FormSelect: root.querySelectorAll('select:not(.no-autoinit)'),
1168
+ Sidenav: root.querySelectorAll('.sidenav:not(.no-autoinit)'),
1169
+ Tabs: root.querySelectorAll('.tabs:not(.no-autoinit)'),
1170
+ TapTarget: root.querySelectorAll('.tap-target:not(.no-autoinit)'),
1171
+ Timepicker: root.querySelectorAll('.timepicker:not(.no-autoinit)'),
1172
+ Tooltip: root.querySelectorAll('.tooltipped:not(.no-autoinit)'),
1173
+ FloatingActionButton: root.querySelectorAll('.fixed-action-btn:not(.no-autoinit)')
1174
+ };
1175
+
1176
+ for (var pluginName in registry) {
1177
+ var plugin = M[pluginName];
1178
+ plugin.init(registry[pluginName]);
1179
+ }
1180
+ };
1181
+
1147
1182
  /**
1148
1183
  * Generate approximated selector string for a jQuery object
1149
1184
  * @param {jQuery} obj jQuery object to be parsed
@@ -1878,6 +1913,10 @@ $jscomp.polyfill = function (e, r, p, m) {
1878
1913
  */
1879
1914
  _this3.options = $.extend({}, Collapsible.defaults, options);
1880
1915
 
1916
+ // Setup tab indices
1917
+ _this3.$headers = _this3.$el.children('li').children('.collapsible-header');
1918
+ _this3.$headers.attr('tabindex', 0);
1919
+
1881
1920
  _this3._setupEventHandlers();
1882
1921
 
1883
1922
  // Open first active
@@ -1911,8 +1950,14 @@ $jscomp.polyfill = function (e, r, p, m) {
1911
1950
  }, {
1912
1951
  key: "_setupEventHandlers",
1913
1952
  value: function _setupEventHandlers() {
1953
+ var _this4 = this;
1954
+
1914
1955
  this._handleCollapsibleClickBound = this._handleCollapsibleClick.bind(this);
1956
+ this._handleCollapsibleKeydownBound = this._handleCollapsibleKeydown.bind(this);
1915
1957
  this.el.addEventListener('click', this._handleCollapsibleClickBound);
1958
+ this.$headers.each(function (header) {
1959
+ header.addEventListener('keydown', _this4._handleCollapsibleKeydownBound);
1960
+ });
1916
1961
  }
1917
1962
 
1918
1963
  /**
@@ -1951,6 +1996,19 @@ $jscomp.polyfill = function (e, r, p, m) {
1951
1996
  }
1952
1997
  }
1953
1998
 
1999
+ /**
2000
+ * Handle Collapsible Keydown
2001
+ * @param {Event} e
2002
+ */
2003
+
2004
+ }, {
2005
+ key: "_handleCollapsibleKeydown",
2006
+ value: function _handleCollapsibleKeydown(e) {
2007
+ if (e.keyCode === 13) {
2008
+ this._handleCollapsibleClickBound(e);
2009
+ }
2010
+ }
2011
+
1954
2012
  /**
1955
2013
  * Animate in collapsible slide
1956
2014
  * @param {Number} index - 0th index of slide
@@ -1959,7 +2017,7 @@ $jscomp.polyfill = function (e, r, p, m) {
1959
2017
  }, {
1960
2018
  key: "_animateIn",
1961
2019
  value: function _animateIn(index) {
1962
- var _this4 = this;
2020
+ var _this5 = this;
1963
2021
 
1964
2022
  var $collapsibleLi = this.$el.children('li').eq(index);
1965
2023
  if ($collapsibleLi.length) {
@@ -1998,8 +2056,8 @@ $jscomp.polyfill = function (e, r, p, m) {
1998
2056
  });
1999
2057
 
2000
2058
  // onOpenEnd callback
2001
- if (typeof _this4.options.onOpenEnd === 'function') {
2002
- _this4.options.onOpenEnd.call(_this4, $collapsibleLi[0]);
2059
+ if (typeof _this5.options.onOpenEnd === 'function') {
2060
+ _this5.options.onOpenEnd.call(_this5, $collapsibleLi[0]);
2003
2061
  }
2004
2062
  }
2005
2063
  });
@@ -2014,7 +2072,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2014
2072
  }, {
2015
2073
  key: "_animateOut",
2016
2074
  value: function _animateOut(index) {
2017
- var _this5 = this;
2075
+ var _this6 = this;
2018
2076
 
2019
2077
  var $collapsibleLi = this.$el.children('li').eq(index);
2020
2078
  if ($collapsibleLi.length) {
@@ -2037,8 +2095,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2037
2095
  });
2038
2096
 
2039
2097
  // onCloseEnd callback
2040
- if (typeof _this5.options.onCloseEnd === 'function') {
2041
- _this5.options.onCloseEnd.call(_this5, $collapsibleLi[0]);
2098
+ if (typeof _this6.options.onCloseEnd === 'function') {
2099
+ _this6.options.onCloseEnd.call(_this6, $collapsibleLi[0]);
2042
2100
  }
2043
2101
  }
2044
2102
  });
@@ -2053,7 +2111,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2053
2111
  }, {
2054
2112
  key: "open",
2055
2113
  value: function open(index) {
2056
- var _this6 = this;
2114
+ var _this7 = this;
2057
2115
 
2058
2116
  var $collapsibleLi = this.$el.children('li').eq(index);
2059
2117
  if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) {
@@ -2069,7 +2127,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2069
2127
  var $activeLis = this.$el.children('li.active');
2070
2128
  $activeLis.each(function (el) {
2071
2129
  var index = $collapsibleLis.index($(el));
2072
- _this6.close(index);
2130
+ _this7.close(index);
2073
2131
  });
2074
2132
  }
2075
2133
 
@@ -2137,6 +2195,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2137
2195
 
2138
2196
  var _defaults = {
2139
2197
  alignment: 'left',
2198
+ autoFocus: true,
2140
2199
  constrainWidth: true,
2141
2200
  container: null,
2142
2201
  coverTrigger: true,
@@ -2160,19 +2219,20 @@ $jscomp.polyfill = function (e, r, p, m) {
2160
2219
  function Dropdown(el, options) {
2161
2220
  _classCallCheck(this, Dropdown);
2162
2221
 
2163
- var _this7 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options));
2222
+ var _this8 = _possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, Dropdown, el, options));
2164
2223
 
2165
- _this7.el.M_Dropdown = _this7;
2166
- Dropdown._dropdowns.push(_this7);
2224
+ _this8.el.M_Dropdown = _this8;
2225
+ Dropdown._dropdowns.push(_this8);
2167
2226
 
2168
- _this7.id = M.getIdFromTrigger(el);
2169
- _this7.dropdownEl = document.getElementById(_this7.id);
2170
- _this7.$dropdownEl = $(_this7.dropdownEl);
2227
+ _this8.id = M.getIdFromTrigger(el);
2228
+ _this8.dropdownEl = document.getElementById(_this8.id);
2229
+ _this8.$dropdownEl = $(_this8.dropdownEl);
2171
2230
 
2172
2231
  /**
2173
2232
  * Options for the dropdown
2174
2233
  * @member Dropdown#options
2175
2234
  * @prop {String} [alignment='left'] - Edge which the dropdown is aligned to
2235
+ * @prop {Boolean} [autoFocus=true] - Automatically focus dropdown el for keyboard
2176
2236
  * @prop {Boolean} [constrainWidth=true] - Constrain width to width of the button
2177
2237
  * @prop {Element} container - Container element to attach dropdown to (optional)
2178
2238
  * @prop {Boolean} [coverTrigger=true] - Place dropdown over trigger
@@ -2185,31 +2245,44 @@ $jscomp.polyfill = function (e, r, p, m) {
2185
2245
  * @prop {Function} onCloseStart - Function called when dropdown starts closing
2186
2246
  * @prop {Function} onCloseEnd - Function called when dropdown finishes closing
2187
2247
  */
2188
- _this7.options = $.extend({}, Dropdown.defaults, options);
2248
+ _this8.options = $.extend({}, Dropdown.defaults, options);
2189
2249
 
2190
2250
  /**
2191
2251
  * Describes open/close state of dropdown
2192
2252
  * @type {Boolean}
2193
2253
  */
2194
- _this7.isOpen = false;
2254
+ _this8.isOpen = false;
2195
2255
 
2196
- _this7.focusedIndex = -1;
2197
- _this7.filterQuery = [];
2256
+ /**
2257
+ * Describes if dropdown content is scrollable
2258
+ * @type {Boolean}
2259
+ */
2260
+ _this8.isScrollable = false;
2261
+
2262
+ /**
2263
+ * Describes if touch moving on dropdown content
2264
+ * @type {Boolean}
2265
+ */
2266
+ _this8.isTouchMoving = false;
2267
+
2268
+ _this8.focusedIndex = -1;
2269
+ _this8.filterQuery = [];
2198
2270
 
2199
2271
  // Move dropdown-content after dropdown-trigger
2200
- if (!!_this7.options.container) {
2201
- $(_this7.options.container).append(_this7.dropdownEl);
2272
+ if (!!_this8.options.container) {
2273
+ $(_this8.options.container).append(_this8.dropdownEl);
2202
2274
  } else {
2203
- _this7.$el.after(_this7.dropdownEl);
2275
+ _this8.$el.after(_this8.dropdownEl);
2204
2276
  }
2205
2277
 
2206
- _this7._makeDropdownFocusable();
2207
- _this7._resetFilterQueryBound = _this7._resetFilterQuery.bind(_this7);
2208
- _this7._handleDocumentClickBound = _this7._handleDocumentClick.bind(_this7);
2209
- _this7._handleDropdownKeydownBound = _this7._handleDropdownKeydown.bind(_this7);
2210
- _this7._handleTriggerKeydownBound = _this7._handleTriggerKeydown.bind(_this7);
2211
- _this7._setupEventHandlers();
2212
- return _this7;
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;
2213
2286
  }
2214
2287
 
2215
2288
  _createClass(Dropdown, [{
@@ -2275,6 +2348,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2275
2348
  // Use capture phase event handler to prevent click
2276
2349
  document.body.addEventListener('click', this._handleDocumentClickBound, true);
2277
2350
  document.body.addEventListener('touchend', this._handleDocumentClickBound);
2351
+ document.body.addEventListener('touchmove', this._handleDocumentTouchmoveBound);
2278
2352
  this.dropdownEl.addEventListener('keydown', this._handleDropdownKeydownBound);
2279
2353
  }
2280
2354
  }, {
@@ -2283,6 +2357,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2283
2357
  // Use capture phase event handler to prevent click
2284
2358
  document.body.removeEventListener('click', this._handleDocumentClickBound, true);
2285
2359
  document.body.removeEventListener('touchend', this._handleDocumentClickBound);
2360
+ document.body.removeEventListener('touchmove', this._handleDocumentTouchmoveBound);
2286
2361
  this.dropdownEl.removeEventListener('keydown', this._handleDropdownKeydownBound);
2287
2362
  }
2288
2363
  }, {
@@ -2316,18 +2391,20 @@ $jscomp.polyfill = function (e, r, p, m) {
2316
2391
  }, {
2317
2392
  key: "_handleDocumentClick",
2318
2393
  value: function _handleDocumentClick(e) {
2319
- var _this8 = this;
2394
+ var _this9 = this;
2320
2395
 
2321
2396
  var $target = $(e.target);
2322
- if (this.options.closeOnClick && $target.closest('.dropdown-content').length) {
2397
+ if (this.options.closeOnClick && $target.closest('.dropdown-content').length && !this.isTouchMoving) {
2398
+ // isTouchMoving to check if scrolling on mobile.
2323
2399
  setTimeout(function () {
2324
- _this8.close();
2400
+ _this9.close();
2325
2401
  }, 0);
2326
2402
  } else if ($target.closest('.dropdown-trigger').length || !$target.closest('.dropdown-content').length) {
2327
2403
  setTimeout(function () {
2328
- _this8.close();
2404
+ _this9.close();
2329
2405
  }, 0);
2330
2406
  }
2407
+ this.isTouchMoving = false;
2331
2408
  }
2332
2409
  }, {
2333
2410
  key: "_handleTriggerKeydown",
@@ -2339,6 +2416,20 @@ $jscomp.polyfill = function (e, r, p, m) {
2339
2416
  }
2340
2417
  }
2341
2418
 
2419
+ /**
2420
+ * Handle Document Touchmove
2421
+ * @param {Event} e
2422
+ */
2423
+
2424
+ }, {
2425
+ key: "_handleDocumentTouchmove",
2426
+ value: function _handleDocumentTouchmove(e) {
2427
+ var $target = $(e.target);
2428
+ if ($target.closest('.dropdown-content').length) {
2429
+ this.isTouchMoving = true;
2430
+ }
2431
+ }
2432
+
2342
2433
  /**
2343
2434
  * Handle Dropdown Keydown
2344
2435
  * @param {Event} e
@@ -2355,8 +2446,21 @@ $jscomp.polyfill = function (e, r, p, m) {
2355
2446
  } else if ((e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) && this.isOpen) {
2356
2447
  e.preventDefault();
2357
2448
  var direction = e.which === M.keys.ARROW_DOWN ? 1 : -1;
2358
- this.focusedIndex = Math.max(Math.min(this.focusedIndex + direction, this.dropdownEl.children.length - 1), 0);
2359
- this._focusFocusedItem();
2449
+ var newFocusedIndex = this.focusedIndex;
2450
+ var foundNewIndex = false;
2451
+ do {
2452
+ newFocusedIndex = newFocusedIndex + direction;
2453
+
2454
+ if (!!this.dropdownEl.children[newFocusedIndex] && this.dropdownEl.children[newFocusedIndex].tabIndex !== -1) {
2455
+ foundNewIndex = true;
2456
+ break;
2457
+ }
2458
+ } while (newFocusedIndex < this.dropdownEl.children.length && newFocusedIndex >= 0);
2459
+
2460
+ if (foundNewIndex) {
2461
+ this.focusedIndex = newFocusedIndex;
2462
+ this._focusFocusedItem();
2463
+ }
2360
2464
 
2361
2465
  // ENTER selects choice on focused item
2362
2466
  } else if (e.which === M.keys.ENTER && this.isOpen) {
@@ -2419,16 +2523,20 @@ $jscomp.polyfill = function (e, r, p, m) {
2419
2523
  }, {
2420
2524
  key: "_makeDropdownFocusable",
2421
2525
  value: function _makeDropdownFocusable() {
2422
- if (this.dropdownEl.tabIndex === -1) {
2423
- this.dropdownEl.tabIndex = 0;
2424
- }
2526
+ // Needed for arrow key navigation
2527
+ this.dropdownEl.tabIndex = 0;
2425
2528
 
2426
- $(this.dropdownEl).children().attr('tabindex', 0);
2529
+ // Only set tabindex if it hasn't been set by user
2530
+ $(this.dropdownEl).children().each(function (el) {
2531
+ if (!el.getAttribute('tabindex')) {
2532
+ el.setAttribute('tabindex', 0);
2533
+ }
2534
+ });
2427
2535
  }
2428
2536
  }, {
2429
2537
  key: "_focusFocusedItem",
2430
2538
  value: function _focusFocusedItem() {
2431
- if (this.focusedIndex >= 0 && this.focusedIndex < this.dropdownEl.children.length) {
2539
+ if (this.focusedIndex >= 0 && this.focusedIndex < this.dropdownEl.children.length && this.options.autoFocus) {
2432
2540
  this.dropdownEl.children[this.focusedIndex].focus();
2433
2541
  }
2434
2542
  }
@@ -2458,10 +2566,16 @@ $jscomp.polyfill = function (e, r, p, m) {
2458
2566
  var verticalAlignment = 'top';
2459
2567
  var horizontalAlignment = this.options.alignment;
2460
2568
  idealYPos += this.options.coverTrigger ? 0 : triggerBRect.height;
2569
+
2570
+ // Reset isScrollable
2571
+ this.isScrollable = false;
2572
+
2461
2573
  if (!alignments.top) {
2462
2574
  if (alignments.bottom) {
2463
2575
  verticalAlignment = 'bottom';
2464
2576
  } else {
2577
+ this.isScrollable = true;
2578
+
2465
2579
  // Determine which side has most space and cutoff at correct height
2466
2580
  if (alignments.spaceOnTop > alignments.spaceOnBottom) {
2467
2581
  verticalAlignment = 'bottom';
@@ -2513,15 +2627,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2513
2627
 
2514
2628
  }, {
2515
2629
  key: "_animateIn",
2516
- value: function _animateIn(positionInfo) {
2517
- var _this9 = this;
2518
-
2519
- // Place dropdown
2520
- this.dropdownEl.style.left = positionInfo.x + 'px';
2521
- this.dropdownEl.style.top = positionInfo.y + 'px';
2522
- this.dropdownEl.style.height = positionInfo.height + 'px';
2523
- this.dropdownEl.style.width = positionInfo.width + 'px';
2524
- this.dropdownEl.style.transformOrigin = (positionInfo.horizontalAlignment === 'left' ? '0' : '100%') + " " + (positionInfo.verticalAlignment === 'top' ? '0' : '100%');
2630
+ value: function _animateIn() {
2631
+ var _this10 = this;
2525
2632
 
2526
2633
  anim.remove(this.dropdownEl);
2527
2634
  anim({
@@ -2535,12 +2642,14 @@ $jscomp.polyfill = function (e, r, p, m) {
2535
2642
  duration: this.options.inDuration,
2536
2643
  easing: 'easeOutQuint',
2537
2644
  complete: function (anim) {
2538
- _this9.dropdownEl.focus();
2645
+ if (_this10.options.autoFocus) {
2646
+ _this10.dropdownEl.focus();
2647
+ }
2539
2648
 
2540
2649
  // onOpenEnd callback
2541
- if (typeof _this9.options.onOpenEnd === 'function') {
2650
+ if (typeof _this10.options.onOpenEnd === 'function') {
2542
2651
  var elem = anim.animatables[0].target;
2543
- _this9.options.onOpenEnd.call(elem, _this9.el);
2652
+ _this10.options.onOpenEnd.call(elem, _this10.el);
2544
2653
  }
2545
2654
  }
2546
2655
  });
@@ -2553,7 +2662,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2553
2662
  }, {
2554
2663
  key: "_animateOut",
2555
2664
  value: function _animateOut() {
2556
- var _this10 = this;
2665
+ var _this11 = this;
2557
2666
 
2558
2667
  anim.remove(this.dropdownEl);
2559
2668
  anim({
@@ -2567,17 +2676,36 @@ $jscomp.polyfill = function (e, r, p, m) {
2567
2676
  duration: this.options.outDuration,
2568
2677
  easing: 'easeOutQuint',
2569
2678
  complete: function (anim) {
2570
- _this10._resetDropdownStyles();
2679
+ _this11._resetDropdownStyles();
2571
2680
 
2572
2681
  // onCloseEnd callback
2573
- if (typeof _this10.options.onCloseEnd === 'function') {
2682
+ if (typeof _this11.options.onCloseEnd === 'function') {
2574
2683
  var elem = anim.animatables[0].target;
2575
- _this10.options.onCloseEnd.call(_this10, _this10.el);
2684
+ _this11.options.onCloseEnd.call(_this11, _this11.el);
2576
2685
  }
2577
2686
  }
2578
2687
  });
2579
2688
  }
2580
2689
 
2690
+ /**
2691
+ * Place dropdown
2692
+ */
2693
+
2694
+ }, {
2695
+ key: "_placeDropdown",
2696
+ value: function _placeDropdown() {
2697
+ // Set width before calculating positionInfo
2698
+ var idealWidth = this.options.constrainWidth ? this.el.getBoundingClientRect().width : this.dropdownEl.getBoundingClientRect().width;
2699
+ this.dropdownEl.style.width = idealWidth + 'px';
2700
+
2701
+ var positionInfo = this._getDropdownPosition();
2702
+ this.dropdownEl.style.left = positionInfo.x + 'px';
2703
+ this.dropdownEl.style.top = positionInfo.y + 'px';
2704
+ this.dropdownEl.style.height = positionInfo.height + 'px';
2705
+ this.dropdownEl.style.width = positionInfo.width + 'px';
2706
+ this.dropdownEl.style.transformOrigin = (positionInfo.horizontalAlignment === 'left' ? '0' : '100%') + " " + (positionInfo.verticalAlignment === 'top' ? '0' : '100%');
2707
+ }
2708
+
2581
2709
  /**
2582
2710
  * Open Dropdown
2583
2711
  */
@@ -2599,12 +2727,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2599
2727
  this._resetDropdownStyles();
2600
2728
  this.dropdownEl.style.display = 'block';
2601
2729
 
2602
- // Set width before calculating positionInfo
2603
- var idealWidth = this.options.constrainWidth ? this.el.getBoundingClientRect().width : this.dropdownEl.getBoundingClientRect().width;
2604
- this.dropdownEl.style.width = idealWidth + 'px';
2605
-
2606
- var positionInfo = this._getDropdownPosition();
2607
- this._animateIn(positionInfo);
2730
+ this._placeDropdown();
2731
+ this._animateIn();
2608
2732
  this._setupTemporaryEventHandlers();
2609
2733
  }
2610
2734
 
@@ -2628,7 +2752,29 @@ $jscomp.polyfill = function (e, r, p, m) {
2628
2752
 
2629
2753
  this._animateOut();
2630
2754
  this._removeTemporaryEventHandlers();
2631
- this.el.focus();
2755
+
2756
+ if (this.options.autoFocus) {
2757
+ this.el.focus();
2758
+ }
2759
+ }
2760
+
2761
+ /**
2762
+ * Recalculate dimensions
2763
+ */
2764
+
2765
+ }, {
2766
+ key: "recalculateDimensions",
2767
+ value: function recalculateDimensions() {
2768
+ if (this.isOpen) {
2769
+ this.$dropdownEl.css({
2770
+ width: '',
2771
+ height: '',
2772
+ left: '',
2773
+ top: '',
2774
+ 'transform-origin': ''
2775
+ });
2776
+ this._placeDropdown();
2777
+ }
2632
2778
  }
2633
2779
  }], [{
2634
2780
  key: "init",
@@ -2681,6 +2827,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2681
2827
  onOpenEnd: null,
2682
2828
  onCloseStart: null,
2683
2829
  onCloseEnd: null,
2830
+ preventScrolling: true,
2684
2831
  dismissible: true,
2685
2832
  startingTop: '4%',
2686
2833
  endingTop: '10%'
@@ -2703,9 +2850,9 @@ $jscomp.polyfill = function (e, r, p, m) {
2703
2850
  function Modal(el, options) {
2704
2851
  _classCallCheck(this, Modal);
2705
2852
 
2706
- var _this11 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
2853
+ var _this12 = _possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, Modal, el, options));
2707
2854
 
2708
- _this11.el.M_Modal = _this11;
2855
+ _this12.el.M_Modal = _this12;
2709
2856
 
2710
2857
  /**
2711
2858
  * Options for the modal
@@ -2721,21 +2868,22 @@ $jscomp.polyfill = function (e, r, p, m) {
2721
2868
  * @prop {String} [startingTop='4%'] - startingTop
2722
2869
  * @prop {String} [endingTop='10%'] - endingTop
2723
2870
  */
2724
- _this11.options = $.extend({}, Modal.defaults, options);
2871
+ _this12.options = $.extend({}, Modal.defaults, options);
2725
2872
 
2726
2873
  /**
2727
2874
  * Describes open/close state of modal
2728
2875
  * @type {Boolean}
2729
2876
  */
2730
- _this11.isOpen = false;
2877
+ _this12.isOpen = false;
2731
2878
 
2732
- _this11.id = _this11.$el.attr('id');
2733
- _this11._openingTrigger = undefined;
2734
- _this11.$overlay = $('<div class="modal-overlay"></div>');
2879
+ _this12.id = _this12.$el.attr('id');
2880
+ _this12._openingTrigger = undefined;
2881
+ _this12.$overlay = $('<div class="modal-overlay"></div>');
2882
+ _this12.el.tabIndex = 0;
2735
2883
 
2736
2884
  Modal._count++;
2737
- _this11._setupEventHandlers();
2738
- return _this11;
2885
+ _this12._setupEventHandlers();
2886
+ return _this12;
2739
2887
  }
2740
2888
 
2741
2889
  _createClass(Modal, [{
@@ -2843,6 +2991,19 @@ $jscomp.polyfill = function (e, r, p, m) {
2843
2991
  }
2844
2992
  }
2845
2993
 
2994
+ /**
2995
+ * Handle Focus
2996
+ * @param {Event} e
2997
+ */
2998
+
2999
+ }, {
3000
+ key: "_handleFocus",
3001
+ value: function _handleFocus(e) {
3002
+ if (!this.el.contains(e.target)) {
3003
+ this.el.focus();
3004
+ }
3005
+ }
3006
+
2846
3007
  /**
2847
3008
  * Animate in modal
2848
3009
  */
@@ -2850,7 +3011,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2850
3011
  }, {
2851
3012
  key: "_animateIn",
2852
3013
  value: function _animateIn() {
2853
- var _this12 = this;
3014
+ var _this13 = this;
2854
3015
 
2855
3016
  // Set initial styles
2856
3017
  $.extend(this.el.style, {
@@ -2877,8 +3038,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2877
3038
  easing: 'easeOutCubic',
2878
3039
  // Handle modal onOpenEnd callback
2879
3040
  complete: function () {
2880
- if (typeof _this12.options.onOpenEnd === 'function') {
2881
- _this12.options.onOpenEnd.call(_this12, _this12.el, _this12._openingTrigger);
3041
+ if (typeof _this13.options.onOpenEnd === 'function') {
3042
+ _this13.options.onOpenEnd.call(_this13, _this13.el, _this13._openingTrigger);
2882
3043
  }
2883
3044
  }
2884
3045
  };
@@ -2910,7 +3071,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2910
3071
  }, {
2911
3072
  key: "_animateOut",
2912
3073
  value: function _animateOut() {
2913
- var _this13 = this;
3074
+ var _this14 = this;
2914
3075
 
2915
3076
  // Animate overlay
2916
3077
  anim({
@@ -2927,12 +3088,12 @@ $jscomp.polyfill = function (e, r, p, m) {
2927
3088
  easing: 'easeOutCubic',
2928
3089
  // Handle modal ready callback
2929
3090
  complete: function () {
2930
- _this13.el.style.display = 'none';
2931
- _this13.$overlay.remove();
3091
+ _this14.el.style.display = 'none';
3092
+ _this14.$overlay.remove();
2932
3093
 
2933
3094
  // Call onCloseEnd callback
2934
- if (typeof _this13.options.onCloseEnd === 'function') {
2935
- _this13.options.onCloseEnd.call(_this13, _this13.el);
3095
+ if (typeof _this14.options.onCloseEnd === 'function') {
3096
+ _this14.options.onCloseEnd.call(_this14, _this14.el);
2936
3097
  }
2937
3098
  }
2938
3099
  };
@@ -2984,18 +3145,27 @@ $jscomp.polyfill = function (e, r, p, m) {
2984
3145
  this.options.onOpenStart.call(this, this.el, this._openingTrigger);
2985
3146
  }
2986
3147
 
2987
- document.body.style.overflow = 'hidden';
3148
+ if (this.options.preventScrolling) {
3149
+ document.body.style.overflow = 'hidden';
3150
+ }
3151
+
2988
3152
  this.el.classList.add('open');
2989
3153
  this.el.insertAdjacentElement('afterend', this.$overlay[0]);
2990
3154
 
2991
3155
  if (this.options.dismissible) {
2992
3156
  this._handleKeydownBound = this._handleKeydown.bind(this);
3157
+ this._handleFocusBound = this._handleFocus.bind(this);
2993
3158
  document.addEventListener('keydown', this._handleKeydownBound);
3159
+ document.addEventListener('focus', this._handleFocusBound, true);
2994
3160
  }
2995
3161
 
2996
3162
  anim.remove(this.el);
2997
3163
  anim.remove(this.$overlay[0]);
2998
3164
  this._animateIn();
3165
+
3166
+ // Focus modal
3167
+ this.el.focus();
3168
+
2999
3169
  return this;
3000
3170
  }
3001
3171
 
@@ -3027,6 +3197,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3027
3197
 
3028
3198
  if (this.options.dismissible) {
3029
3199
  document.removeEventListener('keydown', this._handleKeydownBound);
3200
+ document.removeEventListener('focus', this._handleFocusBound);
3030
3201
  }
3031
3202
 
3032
3203
  anim.remove(this.el);
@@ -3109,9 +3280,9 @@ $jscomp.polyfill = function (e, r, p, m) {
3109
3280
  function Materialbox(el, options) {
3110
3281
  _classCallCheck(this, Materialbox);
3111
3282
 
3112
- var _this14 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
3283
+ var _this15 = _possibleConstructorReturn(this, (Materialbox.__proto__ || Object.getPrototypeOf(Materialbox)).call(this, Materialbox, el, options));
3113
3284
 
3114
- _this14.el.M_Materialbox = _this14;
3285
+ _this15.el.M_Materialbox = _this15;
3115
3286
 
3116
3287
  /**
3117
3288
  * Options for the modal
@@ -3123,22 +3294,22 @@ $jscomp.polyfill = function (e, r, p, m) {
3123
3294
  * @prop {Function} onCloseStart - Callback function called before materialbox is closed
3124
3295
  * @prop {Function} onCloseEnd - Callback function called after materialbox is closed
3125
3296
  */
3126
- _this14.options = $.extend({}, Materialbox.defaults, options);
3297
+ _this15.options = $.extend({}, Materialbox.defaults, options);
3127
3298
 
3128
- _this14.overlayActive = false;
3129
- _this14.doneAnimating = true;
3130
- _this14.placeholder = $('<div></div>').addClass('material-placeholder');
3131
- _this14.originalWidth = 0;
3132
- _this14.originalHeight = 0;
3133
- _this14.originInlineStyles = _this14.$el.attr('style');
3134
- _this14.caption = _this14.el.getAttribute('data-caption') || "";
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') || "";
3135
3306
 
3136
3307
  // Wrap
3137
- _this14.$el.before(_this14.placeholder);
3138
- _this14.placeholder.append(_this14.$el);
3308
+ _this15.$el.before(_this15.placeholder);
3309
+ _this15.placeholder.append(_this15.$el);
3139
3310
 
3140
- _this14._setupEventHandlers();
3141
- return _this14;
3311
+ _this15._setupEventHandlers();
3312
+ return _this15;
3142
3313
  }
3143
3314
 
3144
3315
  _createClass(Materialbox, [{
@@ -3258,7 +3429,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3258
3429
  }, {
3259
3430
  key: "_animateImageIn",
3260
3431
  value: function _animateImageIn() {
3261
- var _this15 = this;
3432
+ var _this16 = this;
3262
3433
 
3263
3434
  var animOptions = {
3264
3435
  targets: this.el,
@@ -3269,11 +3440,11 @@ $jscomp.polyfill = function (e, r, p, m) {
3269
3440
  duration: this.options.inDuration,
3270
3441
  easing: 'easeOutQuad',
3271
3442
  complete: function () {
3272
- _this15.doneAnimating = true;
3443
+ _this16.doneAnimating = true;
3273
3444
 
3274
3445
  // onOpenEnd callback
3275
- if (typeof _this15.options.onOpenEnd === 'function') {
3276
- _this15.options.onOpenEnd.call(_this15, _this15.el);
3446
+ if (typeof _this16.options.onOpenEnd === 'function') {
3447
+ _this16.options.onOpenEnd.call(_this16, _this16.el);
3277
3448
  }
3278
3449
  }
3279
3450
  };
@@ -3298,7 +3469,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3298
3469
  }, {
3299
3470
  key: "_animateImageOut",
3300
3471
  value: function _animateImageOut() {
3301
- var _this16 = this;
3472
+ var _this17 = this;
3302
3473
 
3303
3474
  var animOptions = {
3304
3475
  targets: this.el,
@@ -3309,7 +3480,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3309
3480
  duration: this.options.outDuration,
3310
3481
  easing: 'easeOutQuad',
3311
3482
  complete: function () {
3312
- _this16.placeholder.css({
3483
+ _this17.placeholder.css({
3313
3484
  height: '',
3314
3485
  width: '',
3315
3486
  position: '',
@@ -3318,28 +3489,28 @@ $jscomp.polyfill = function (e, r, p, m) {
3318
3489
  });
3319
3490
 
3320
3491
  // Revert to width or height attribute
3321
- if (_this16.attrWidth) {
3322
- _this16.$el.attr('width', _this16.attrWidth);
3492
+ if (_this17.attrWidth) {
3493
+ _this17.$el.attr('width', _this17.attrWidth);
3323
3494
  }
3324
- if (_this16.attrHeight) {
3325
- _this16.$el.attr('height', _this16.attrHeight);
3495
+ if (_this17.attrHeight) {
3496
+ _this17.$el.attr('height', _this17.attrHeight);
3326
3497
  }
3327
3498
 
3328
- _this16.$el.removeAttr('style');
3329
- _this16.$el.attr('style', _this16.originInlineStyles);
3499
+ _this17.$el.removeAttr('style');
3500
+ _this17.$el.attr('style', _this17.originInlineStyles);
3330
3501
 
3331
3502
  // Remove class
3332
- _this16.$el.removeClass('active');
3333
- _this16.doneAnimating = true;
3503
+ _this17.$el.removeClass('active');
3504
+ _this17.doneAnimating = true;
3334
3505
 
3335
3506
  // Remove overflow overrides on ancestors
3336
- if (_this16.ancestorsChanged.length) {
3337
- _this16.ancestorsChanged.css('overflow', '');
3507
+ if (_this17.ancestorsChanged.length) {
3508
+ _this17.ancestorsChanged.css('overflow', '');
3338
3509
  }
3339
3510
 
3340
3511
  // onCloseEnd callback
3341
- if (typeof _this16.options.onCloseEnd === 'function') {
3342
- _this16.options.onCloseEnd.call(_this16, _this16.el);
3512
+ if (typeof _this17.options.onCloseEnd === 'function') {
3513
+ _this17.options.onCloseEnd.call(_this17, _this17.el);
3343
3514
  }
3344
3515
  }
3345
3516
  };
@@ -3366,7 +3537,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3366
3537
  }, {
3367
3538
  key: "open",
3368
3539
  value: function open() {
3369
- var _this17 = this;
3540
+ var _this18 = this;
3370
3541
 
3371
3542
  this._updateVars();
3372
3543
  this.originalWidth = this.el.getBoundingClientRect().width;
@@ -3416,8 +3587,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3416
3587
  this.$overlay = $('<div id="materialbox-overlay"></div>').css({
3417
3588
  opacity: 0
3418
3589
  }).one('click', function () {
3419
- if (_this17.doneAnimating) {
3420
- _this17.close();
3590
+ if (_this18.doneAnimating) {
3591
+ _this18.close();
3421
3592
  }
3422
3593
  });
3423
3594
 
@@ -3498,7 +3669,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3498
3669
  }, {
3499
3670
  key: "close",
3500
3671
  value: function close() {
3501
- var _this18 = this;
3672
+ var _this19 = this;
3502
3673
 
3503
3674
  this._updateVars();
3504
3675
  this.doneAnimating = false;
@@ -3526,8 +3697,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3526
3697
  duration: this.options.outDuration,
3527
3698
  easing: 'easeOutQuad',
3528
3699
  complete: function () {
3529
- _this18.overlayActive = false;
3530
- _this18.$overlay.remove();
3700
+ _this19.overlayActive = false;
3701
+ _this19.$overlay.remove();
3531
3702
  }
3532
3703
  });
3533
3704
 
@@ -3541,7 +3712,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3541
3712
  duration: this.options.outDuration,
3542
3713
  easing: 'easeOutQuad',
3543
3714
  complete: function () {
3544
- _this18.$photoCaption.remove();
3715
+ _this19.$photoCaption.remove();
3545
3716
  }
3546
3717
  });
3547
3718
  }
@@ -3591,30 +3762,30 @@ $jscomp.polyfill = function (e, r, p, m) {
3591
3762
  function Parallax(el, options) {
3592
3763
  _classCallCheck(this, Parallax);
3593
3764
 
3594
- var _this19 = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
3765
+ var _this20 = _possibleConstructorReturn(this, (Parallax.__proto__ || Object.getPrototypeOf(Parallax)).call(this, Parallax, el, options));
3595
3766
 
3596
- _this19.el.M_Parallax = _this19;
3767
+ _this20.el.M_Parallax = _this20;
3597
3768
 
3598
3769
  /**
3599
3770
  * Options for the Parallax
3600
3771
  * @member Parallax#options
3601
3772
  * @prop {Number} responsiveThreshold
3602
3773
  */
3603
- _this19.options = $.extend({}, Parallax.defaults, options);
3604
- _this19._enabled = window.innerWidth > _this19.options.responsiveThreshold;
3774
+ _this20.options = $.extend({}, Parallax.defaults, options);
3775
+ _this20._enabled = window.innerWidth > _this20.options.responsiveThreshold;
3605
3776
 
3606
- _this19.$img = _this19.$el.find('img').first();
3607
- _this19.$img.each(function () {
3777
+ _this20.$img = _this20.$el.find('img').first();
3778
+ _this20.$img.each(function () {
3608
3779
  var el = this;
3609
3780
  if (el.complete) $(el).trigger("load");
3610
3781
  });
3611
3782
 
3612
- _this19._updateParallax();
3613
- _this19._setupEventHandlers();
3614
- _this19._setupStyles();
3783
+ _this20._updateParallax();
3784
+ _this20._setupEventHandlers();
3785
+ _this20._setupStyles();
3615
3786
 
3616
- Parallax._parallaxes.push(_this19);
3617
- return _this19;
3787
+ Parallax._parallaxes.push(_this20);
3788
+ return _this20;
3618
3789
  }
3619
3790
 
3620
3791
  _createClass(Parallax, [{
@@ -3768,9 +3939,9 @@ $jscomp.polyfill = function (e, r, p, m) {
3768
3939
  function Tabs(el, options) {
3769
3940
  _classCallCheck(this, Tabs);
3770
3941
 
3771
- var _this20 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
3942
+ var _this21 = _possibleConstructorReturn(this, (Tabs.__proto__ || Object.getPrototypeOf(Tabs)).call(this, Tabs, el, options));
3772
3943
 
3773
- _this20.el.M_Tabs = _this20;
3944
+ _this21.el.M_Tabs = _this21;
3774
3945
 
3775
3946
  /**
3776
3947
  * Options for the Tabs
@@ -3780,23 +3951,23 @@ $jscomp.polyfill = function (e, r, p, m) {
3780
3951
  * @prop {Boolean} swipeable
3781
3952
  * @prop {Number} responsiveThreshold
3782
3953
  */
3783
- _this20.options = $.extend({}, Tabs.defaults, options);
3954
+ _this21.options = $.extend({}, Tabs.defaults, options);
3784
3955
 
3785
3956
  // Setup
3786
- _this20.$tabLinks = _this20.$el.children('li.tab').children('a');
3787
- _this20.index = 0;
3788
- _this20._setTabsAndTabWidth();
3789
- _this20._setupActiveTabLink();
3790
- _this20._createIndicator();
3791
-
3792
- if (_this20.options.swipeable) {
3793
- _this20._setupSwipeableTabs();
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();
3794
3965
  } else {
3795
- _this20._setupNormalTabs();
3966
+ _this21._setupNormalTabs();
3796
3967
  }
3797
3968
 
3798
- _this20._setupEventHandlers();
3799
- return _this20;
3969
+ _this21._setupEventHandlers();
3970
+ return _this21;
3800
3971
  }
3801
3972
 
3802
3973
  _createClass(Tabs, [{
@@ -3867,7 +4038,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3867
4038
  }, {
3868
4039
  key: "_handleTabClick",
3869
4040
  value: function _handleTabClick(e) {
3870
- var _this21 = this;
4041
+ var _this22 = this;
3871
4042
 
3872
4043
  var tab = $(e.target).closest('li.tab');
3873
4044
  var tabLink = $(e.target).closest('a');
@@ -3907,8 +4078,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3907
4078
  if (this.options.swipeable) {
3908
4079
  if (this._tabsCarousel) {
3909
4080
  this._tabsCarousel.set(this.index, function () {
3910
- if (typeof _this21.options.onShow === "function") {
3911
- _this21.options.onShow.call(_this21, _this21.$content[0]);
4081
+ if (typeof _this22.options.onShow === "function") {
4082
+ _this22.options.onShow.call(_this22, _this22.$content[0]);
3912
4083
  }
3913
4084
  });
3914
4085
  }
@@ -3941,7 +4112,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3941
4112
  }, {
3942
4113
  key: "_createIndicator",
3943
4114
  value: function _createIndicator() {
3944
- var _this22 = this;
4115
+ var _this23 = this;
3945
4116
 
3946
4117
  var indicator = document.createElement('li');
3947
4118
  indicator.classList.add('indicator');
@@ -3950,8 +4121,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3950
4121
  this._indicator = indicator;
3951
4122
 
3952
4123
  setTimeout(function () {
3953
- _this22._indicator.style.left = _this22._calcLeftPos(_this22.$activeTabLink) + 'px';
3954
- _this22._indicator.style.right = _this22._calcRightPos(_this22.$activeTabLink) + 'px';
4124
+ _this23._indicator.style.left = _this23._calcLeftPos(_this23.$activeTabLink) + 'px';
4125
+ _this23._indicator.style.right = _this23._calcRightPos(_this23.$activeTabLink) + 'px';
3955
4126
  }, 0);
3956
4127
  }
3957
4128
 
@@ -3991,7 +4162,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3991
4162
  }, {
3992
4163
  key: "_setupSwipeableTabs",
3993
4164
  value: function _setupSwipeableTabs() {
3994
- var _this23 = this;
4165
+ var _this24 = this;
3995
4166
 
3996
4167
  // Change swipeable according to responsive threshold
3997
4168
  if (window.innerWidth > this.options.responsiveThreshold) {
@@ -4010,21 +4181,27 @@ $jscomp.polyfill = function (e, r, p, m) {
4010
4181
  $tabsWrapper.append($tabsContent);
4011
4182
  $tabsContent[0].style.display = '';
4012
4183
 
4184
+ // Keep active tab index to set initial carousel slide
4185
+ var activeTabIndex = this.$activeTabLink.closest('.tab').index();
4186
+
4013
4187
  this._tabsCarousel = M.Carousel.init($tabsWrapper[0], {
4014
4188
  fullWidth: true,
4015
4189
  noWrap: true,
4016
4190
  onCycleTo: function (item) {
4017
- var prevIndex = _this23.index;
4018
- _this23.index = $(item).index();
4019
- _this23.$activeTabLink.removeClass('active');
4020
- _this23.$activeTabLink = _this23.$tabLinks.eq(_this23.index);
4021
- _this23.$activeTabLink.addClass('active');
4022
- _this23._animateIndicator(prevIndex);
4023
- if (typeof _this23.options.onShow === "function") {
4024
- _this23.options.onShow.call(_this23, _this23.$content[0]);
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]);
4025
4199
  }
4026
4200
  }
4027
4201
  });
4202
+
4203
+ // Set initial carousel slide to active tab
4204
+ this._tabsCarousel.set(activeTabIndex);
4028
4205
  }
4029
4206
 
4030
4207
  /**
@@ -4227,16 +4404,17 @@ $jscomp.polyfill = function (e, r, p, m) {
4227
4404
  function Tooltip(el, options) {
4228
4405
  _classCallCheck(this, Tooltip);
4229
4406
 
4230
- var _this24 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
4407
+ var _this25 = _possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, Tooltip, el, options));
4231
4408
 
4232
- _this24.el.M_Tooltip = _this24;
4233
- _this24.options = $.extend({}, Tooltip.defaults, options);
4409
+ _this25.el.M_Tooltip = _this25;
4410
+ _this25.options = $.extend({}, Tooltip.defaults, options);
4234
4411
 
4235
- _this24.isOpen = false;
4236
- _this24.isHovered = false;
4237
- _this24._appendTooltipEl();
4238
- _this24._setupEventHandlers();
4239
- return _this24;
4412
+ _this25.isOpen = false;
4413
+ _this25.isHovered = false;
4414
+ _this25.isFocused = false;
4415
+ _this25._appendTooltipEl();
4416
+ _this25._setupEventHandlers();
4417
+ return _this25;
4240
4418
  }
4241
4419
 
4242
4420
  _createClass(Tooltip, [{
@@ -4249,7 +4427,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4249
4427
  value: function destroy() {
4250
4428
  $(this.tooltipEl).remove();
4251
4429
  this._removeEventHandlers();
4252
- this.$el[0].M_Tooltip = undefined;
4430
+ this.el.M_Tooltip = undefined;
4253
4431
  }
4254
4432
  }, {
4255
4433
  key: "_appendTooltipEl",
@@ -4272,16 +4450,22 @@ $jscomp.polyfill = function (e, r, p, m) {
4272
4450
  }, {
4273
4451
  key: "_setupEventHandlers",
4274
4452
  value: function _setupEventHandlers() {
4275
- this.handleMouseEnterBound = this._handleMouseEnter.bind(this);
4276
- this.handleMouseLeaveBound = this._handleMouseLeave.bind(this);
4277
- this.$el[0].addEventListener('mouseenter', this.handleMouseEnterBound);
4278
- this.$el[0].addEventListener('mouseleave', this.handleMouseLeaveBound);
4453
+ this._handleMouseEnterBound = this._handleMouseEnter.bind(this);
4454
+ this._handleMouseLeaveBound = this._handleMouseLeave.bind(this);
4455
+ this._handleFocusBound = this._handleFocus.bind(this);
4456
+ this._handleBlurBound = this._handleBlur.bind(this);
4457
+ this.el.addEventListener('mouseenter', this._handleMouseEnterBound);
4458
+ this.el.addEventListener('mouseleave', this._handleMouseLeaveBound);
4459
+ this.el.addEventListener('focus', this._handleFocusBound, true);
4460
+ this.el.addEventListener('blur', this._handleBlurBound, true);
4279
4461
  }
4280
4462
  }, {
4281
4463
  key: "_removeEventHandlers",
4282
4464
  value: function _removeEventHandlers() {
4283
- this.$el[0].removeEventListener('mouseenter', this.handleMouseEnterBound);
4284
- this.$el[0].removeEventListener('mouseleave', this.handleMouseLeaveBound);
4465
+ this.el.removeEventListener('mouseenter', this._handleMouseEnterBound);
4466
+ this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound);
4467
+ this.el.removeEventListener('focus', this._handleFocusBound, true);
4468
+ this.el.removeEventListener('blur', this._handleBlurBound, true);
4285
4469
  }
4286
4470
  }, {
4287
4471
  key: "open",
@@ -4314,16 +4498,16 @@ $jscomp.polyfill = function (e, r, p, m) {
4314
4498
  }, {
4315
4499
  key: "_setExitDelayTimeout",
4316
4500
  value: function _setExitDelayTimeout() {
4317
- var _this25 = this;
4501
+ var _this26 = this;
4318
4502
 
4319
4503
  clearTimeout(this._exitDelayTimeout);
4320
4504
 
4321
4505
  this._exitDelayTimeout = setTimeout(function () {
4322
- if (_this25.isHovered) {
4506
+ if (_this26.isHovered || _this26.isFocused) {
4323
4507
  return;
4324
4508
  }
4325
4509
 
4326
- _this25._animateOut();
4510
+ _this26._animateOut();
4327
4511
  }, this.options.exitDelay);
4328
4512
  }
4329
4513
 
@@ -4334,22 +4518,22 @@ $jscomp.polyfill = function (e, r, p, m) {
4334
4518
  }, {
4335
4519
  key: "_setEnterDelayTimeout",
4336
4520
  value: function _setEnterDelayTimeout() {
4337
- var _this26 = this;
4521
+ var _this27 = this;
4338
4522
 
4339
4523
  clearTimeout(this._enterDelayTimeout);
4340
4524
 
4341
4525
  this._enterDelayTimeout = setTimeout(function () {
4342
- if (!_this26.isHovered) {
4526
+ if (!_this27.isHovered && !_this27.isFocused) {
4343
4527
  return;
4344
4528
  }
4345
4529
 
4346
- _this26._animateIn();
4530
+ _this27._animateIn();
4347
4531
  }, this.options.enterDelay);
4348
4532
  }
4349
4533
  }, {
4350
4534
  key: "_positionTooltip",
4351
4535
  value: function _positionTooltip() {
4352
- var origin = this.$el[0],
4536
+ var origin = this.el,
4353
4537
  tooltip = this.tooltipEl,
4354
4538
  originHeight = origin.offsetHeight,
4355
4539
  originWidth = origin.offsetWidth,
@@ -4464,12 +4648,24 @@ $jscomp.polyfill = function (e, r, p, m) {
4464
4648
  this.isHovered = false;
4465
4649
  this.close();
4466
4650
  }
4651
+ }, {
4652
+ key: "_handleFocus",
4653
+ value: function _handleFocus() {
4654
+ this.isFocused = true;
4655
+ this.open();
4656
+ }
4657
+ }, {
4658
+ key: "_handleBlur",
4659
+ value: function _handleBlur() {
4660
+ this.isFocused = false;
4661
+ this.close();
4662
+ }
4467
4663
  }, {
4468
4664
  key: "_getAttributeOptions",
4469
4665
  value: function _getAttributeOptions() {
4470
4666
  var attributeOptions = {};
4471
- var tooltipTextOption = this.$el[0].getAttribute('data-tooltip');
4472
- var positionOption = this.$el[0].getAttribute('data-position');
4667
+ var tooltipTextOption = this.el.getAttribute('data-tooltip');
4668
+ var positionOption = this.el.getAttribute('data-position');
4473
4669
 
4474
4670
  if (tooltipTextOption) {
4475
4671
  attributeOptions.html = tooltipTextOption;
@@ -4952,18 +5148,18 @@ $jscomp.polyfill = function (e, r, p, m) {
4952
5148
  }, {
4953
5149
  key: "_setTimer",
4954
5150
  value: function _setTimer() {
4955
- var _this27 = this;
5151
+ var _this28 = this;
4956
5152
 
4957
5153
  if (this.timeRemaining !== Infinity) {
4958
5154
  this.counterInterval = setInterval(function () {
4959
5155
  // If toast is not being dragged, decrease its time remaining
4960
- if (!_this27.panning) {
4961
- _this27.timeRemaining -= 20;
5156
+ if (!_this28.panning) {
5157
+ _this28.timeRemaining -= 20;
4962
5158
  }
4963
5159
 
4964
5160
  // Animate toast out
4965
- if (_this27.timeRemaining <= 0) {
4966
- _this27.dismiss();
5161
+ if (_this28.timeRemaining <= 0) {
5162
+ _this28.dismiss();
4967
5163
  }
4968
5164
  }, 20);
4969
5165
  }
@@ -4976,7 +5172,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4976
5172
  }, {
4977
5173
  key: "dismiss",
4978
5174
  value: function dismiss() {
4979
- var _this28 = this;
5175
+ var _this29 = this;
4980
5176
 
4981
5177
  window.clearInterval(this.counterInterval);
4982
5178
  var activationDistance = this.el.offsetWidth * this.options.activationPercent;
@@ -4995,12 +5191,12 @@ $jscomp.polyfill = function (e, r, p, m) {
4995
5191
  easing: 'easeOutExpo',
4996
5192
  complete: function () {
4997
5193
  // Call the optional callback
4998
- if (typeof _this28.options.completeCallback === 'function') {
4999
- _this28.options.completeCallback();
5194
+ if (typeof _this29.options.completeCallback === 'function') {
5195
+ _this29.options.completeCallback();
5000
5196
  }
5001
5197
  // Remove toast from DOM
5002
- _this28.el.parentNode.removeChild(_this28.el);
5003
- Toast._toasts.splice(Toast._toasts.indexOf(_this28), 1);
5198
+ _this29.el.parentNode.removeChild(_this29.el);
5199
+ Toast._toasts.splice(Toast._toasts.indexOf(_this29), 1);
5004
5200
  if (Toast._toasts.length === 0) {
5005
5201
  Toast._removeContainer();
5006
5202
  }
@@ -5206,7 +5402,8 @@ $jscomp.polyfill = function (e, r, p, m) {
5206
5402
  onOpenStart: null,
5207
5403
  onOpenEnd: null,
5208
5404
  onCloseStart: null,
5209
- onCloseEnd: null
5405
+ onCloseEnd: null,
5406
+ preventScrolling: true
5210
5407
  };
5211
5408
 
5212
5409
  /**
@@ -5225,10 +5422,10 @@ $jscomp.polyfill = function (e, r, p, m) {
5225
5422
  function Sidenav(el, options) {
5226
5423
  _classCallCheck(this, Sidenav);
5227
5424
 
5228
- var _this29 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
5425
+ var _this30 = _possibleConstructorReturn(this, (Sidenav.__proto__ || Object.getPrototypeOf(Sidenav)).call(this, Sidenav, el, options));
5229
5426
 
5230
- _this29.el.M_Sidenav = _this29;
5231
- _this29.id = _this29.$el.attr('id');
5427
+ _this30.el.M_Sidenav = _this30;
5428
+ _this30.id = _this30.$el.attr('id');
5232
5429
 
5233
5430
  /**
5234
5431
  * Options for the Sidenav
@@ -5242,34 +5439,38 @@ $jscomp.polyfill = function (e, r, p, m) {
5242
5439
  * @prop {Function} onCloseStart - Function called when sidenav starts exiting
5243
5440
  * @prop {Function} onCloseEnd - Function called when sidenav finishes exiting
5244
5441
  */
5245
- _this29.options = $.extend({}, Sidenav.defaults, options);
5442
+ _this30.options = $.extend({}, Sidenav.defaults, options);
5246
5443
 
5247
5444
  /**
5248
5445
  * Describes open/close state of Sidenav
5249
5446
  * @type {Boolean}
5250
5447
  */
5251
- _this29.isOpen = false;
5448
+ _this30.isOpen = false;
5252
5449
 
5253
5450
  /**
5254
5451
  * Describes if Sidenav is fixed
5255
5452
  * @type {Boolean}
5256
5453
  */
5257
- _this29.isFixed = _this29.el.classList.contains('sidenav-fixed');
5454
+ _this30.isFixed = _this30.el.classList.contains('sidenav-fixed');
5258
5455
 
5259
5456
  /**
5260
5457
  * Describes if Sidenav is being draggeed
5261
5458
  * @type {Boolean}
5262
5459
  */
5263
- _this29.isDragged = false;
5460
+ _this30.isDragged = false;
5461
+
5462
+ // Window size variables for window resize checks
5463
+ _this30.lastWindowWidth = window.innerWidth;
5464
+ _this30.lastWindowHeight = window.innerHeight;
5264
5465
 
5265
- _this29._createOverlay();
5266
- _this29._createDragTarget();
5267
- _this29._setupEventHandlers();
5268
- _this29._setupClasses();
5269
- _this29._setupFixed();
5466
+ _this30._createOverlay();
5467
+ _this30._createDragTarget();
5468
+ _this30._setupEventHandlers();
5469
+ _this30._setupClasses();
5470
+ _this30._setupFixed();
5270
5471
 
5271
- Sidenav._sidenavs.push(_this29);
5272
- return _this29;
5472
+ Sidenav._sidenavs.push(_this30);
5473
+ return _this30;
5273
5474
  }
5274
5475
 
5275
5476
  _createClass(Sidenav, [{
@@ -5386,6 +5587,8 @@ $jscomp.polyfill = function (e, r, p, m) {
5386
5587
  this._time = Date.now();
5387
5588
  this._width = this.el.getBoundingClientRect().width;
5388
5589
  this._overlay.style.display = 'block';
5590
+ this._initialScrollTop = this.isOpen ? this.el.scrollTop : M.getDocumentScrollTop();
5591
+ this._verticallyScrolling = false;
5389
5592
  anim.remove(this.el);
5390
5593
  anim.remove(this._overlay);
5391
5594
  }
@@ -5399,10 +5602,14 @@ $jscomp.polyfill = function (e, r, p, m) {
5399
5602
  key: "_dragMoveUpdate",
5400
5603
  value: function _dragMoveUpdate(e) {
5401
5604
  var clientX = e.targetTouches[0].clientX;
5605
+ var currentScrollTop = this.isOpen ? this.el.scrollTop : M.getDocumentScrollTop();
5402
5606
  this.deltaX = Math.abs(this._xPos - clientX);
5403
5607
  this._xPos = clientX;
5404
5608
  this.velocityX = this.deltaX / (Date.now() - this._time);
5405
5609
  this._time = Date.now();
5610
+ if (this._initialScrollTop !== currentScrollTop) {
5611
+ this._verticallyScrolling = true;
5612
+ }
5406
5613
  }
5407
5614
 
5408
5615
  /**
@@ -5414,7 +5621,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5414
5621
  key: "_handleDragTargetDrag",
5415
5622
  value: function _handleDragTargetDrag(e) {
5416
5623
  // Check if draggable
5417
- if (!this.options.draggable || this._isCurrentlyFixed()) {
5624
+ if (!this.options.draggable || this._isCurrentlyFixed() || this._verticallyScrolling) {
5418
5625
  return;
5419
5626
  }
5420
5627
 
@@ -5473,6 +5680,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5473
5680
  }
5474
5681
 
5475
5682
  this.isDragged = false;
5683
+ this._verticallyScrolling = false;
5476
5684
  }
5477
5685
  }
5478
5686
 
@@ -5486,7 +5694,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5486
5694
  value: function _handleCloseDrag(e) {
5487
5695
  if (this.isOpen) {
5488
5696
  // Check if draggable
5489
- if (!this.options.draggable || this._isCurrentlyFixed()) {
5697
+ if (!this.options.draggable || this._isCurrentlyFixed() || this._verticallyScrolling) {
5490
5698
  return;
5491
5699
  }
5492
5700
 
@@ -5539,6 +5747,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5539
5747
  }
5540
5748
 
5541
5749
  this.isDragged = false;
5750
+ this._verticallyScrolling = false;
5542
5751
  }
5543
5752
  }
5544
5753
 
@@ -5550,7 +5759,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5550
5759
  key: "_handleCloseTriggerClick",
5551
5760
  value: function _handleCloseTriggerClick(e) {
5552
5761
  var $closeTrigger = $(e.target).closest('.sidenav-close');
5553
- if ($closeTrigger.length) {
5762
+ if ($closeTrigger.length && !this._isCurrentlyFixed()) {
5554
5763
  this.close();
5555
5764
  }
5556
5765
  }
@@ -5562,11 +5771,17 @@ $jscomp.polyfill = function (e, r, p, m) {
5562
5771
  }, {
5563
5772
  key: "_handleWindowResize",
5564
5773
  value: function _handleWindowResize() {
5565
- if (window.innerWidth > 992) {
5566
- this.open();
5567
- } else {
5568
- this.close();
5774
+ // Only handle horizontal resizes
5775
+ if (this.lastWindowWidth !== window.innerWidth) {
5776
+ if (window.innerWidth > 992) {
5777
+ this.open();
5778
+ } else {
5779
+ this.close();
5780
+ }
5569
5781
  }
5782
+
5783
+ this.lastWindowWidth = window.innerWidth;
5784
+ this.lastWindowHeight = window.innerHeight;
5570
5785
  }
5571
5786
  }, {
5572
5787
  key: "_setupClasses",
@@ -5642,7 +5857,9 @@ $jscomp.polyfill = function (e, r, p, m) {
5642
5857
 
5643
5858
  // Handle non-fixed Sidenav
5644
5859
  } else {
5645
- this._preventBodyScrolling();
5860
+ if (this.options.preventScrolling) {
5861
+ this._preventBodyScrolling();
5862
+ }
5646
5863
 
5647
5864
  if (!this.isDragged || this.percentOpen != 1) {
5648
5865
  this._animateIn();
@@ -5688,7 +5905,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5688
5905
  }, {
5689
5906
  key: "_animateSidenavIn",
5690
5907
  value: function _animateSidenavIn() {
5691
- var _this30 = this;
5908
+ var _this31 = this;
5692
5909
 
5693
5910
  var slideOutPercent = this.options.edge === 'left' ? -1 : 1;
5694
5911
  if (this.isDragged) {
@@ -5703,8 +5920,8 @@ $jscomp.polyfill = function (e, r, p, m) {
5703
5920
  easing: 'easeOutQuad',
5704
5921
  complete: function () {
5705
5922
  // Run onOpenEnd callback
5706
- if (typeof _this30.options.onOpenEnd === 'function') {
5707
- _this30.options.onOpenEnd.call(_this30, _this30.el);
5923
+ if (typeof _this31.options.onOpenEnd === 'function') {
5924
+ _this31.options.onOpenEnd.call(_this31, _this31.el);
5708
5925
  }
5709
5926
  }
5710
5927
  });
@@ -5738,7 +5955,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5738
5955
  }, {
5739
5956
  key: "_animateSidenavOut",
5740
5957
  value: function _animateSidenavOut() {
5741
- var _this31 = this;
5958
+ var _this32 = this;
5742
5959
 
5743
5960
  var endPercent = this.options.edge === 'left' ? -1 : 1;
5744
5961
  var slideOutPercent = 0;
@@ -5754,8 +5971,8 @@ $jscomp.polyfill = function (e, r, p, m) {
5754
5971
  easing: 'easeOutQuad',
5755
5972
  complete: function () {
5756
5973
  // Run onOpenEnd callback
5757
- if (typeof _this31.options.onCloseEnd === 'function') {
5758
- _this31.options.onCloseEnd.call(_this31, _this31.el);
5974
+ if (typeof _this32.options.onCloseEnd === 'function') {
5975
+ _this32.options.onCloseEnd.call(_this32, _this32.el);
5759
5976
  }
5760
5977
  }
5761
5978
  });
@@ -5763,7 +5980,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5763
5980
  }, {
5764
5981
  key: "_animateOverlayOut",
5765
5982
  value: function _animateOverlayOut() {
5766
- var _this32 = this;
5983
+ var _this33 = this;
5767
5984
 
5768
5985
  anim.remove(this._overlay);
5769
5986
  anim({
@@ -5772,7 +5989,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5772
5989
  duration: this.options.outDuration,
5773
5990
  easing: 'easeOutQuad',
5774
5991
  complete: function () {
5775
- $(_this32._overlay).css('display', 'none');
5992
+ $(_this33._overlay).css('display', 'none');
5776
5993
  }
5777
5994
  });
5778
5995
  }
@@ -5846,9 +6063,9 @@ $jscomp.polyfill = function (e, r, p, m) {
5846
6063
  function ScrollSpy(el, options) {
5847
6064
  _classCallCheck(this, ScrollSpy);
5848
6065
 
5849
- var _this33 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
6066
+ var _this34 = _possibleConstructorReturn(this, (ScrollSpy.__proto__ || Object.getPrototypeOf(ScrollSpy)).call(this, ScrollSpy, el, options));
5850
6067
 
5851
- _this33.el.M_ScrollSpy = _this33;
6068
+ _this34.el.M_ScrollSpy = _this34;
5852
6069
 
5853
6070
  /**
5854
6071
  * Options for the modal
@@ -5858,17 +6075,17 @@ $jscomp.polyfill = function (e, r, p, m) {
5858
6075
  * @prop {String} [activeClass='active'] - Class applied to active elements
5859
6076
  * @prop {Function} [getActiveElement] - Used to find active element
5860
6077
  */
5861
- _this33.options = $.extend({}, ScrollSpy.defaults, options);
6078
+ _this34.options = $.extend({}, ScrollSpy.defaults, options);
5862
6079
 
5863
6080
  // setup
5864
- ScrollSpy._elements.push(_this33);
6081
+ ScrollSpy._elements.push(_this34);
5865
6082
  ScrollSpy._count++;
5866
6083
  ScrollSpy._increment++;
5867
- _this33.tickId = -1;
5868
- _this33.id = ScrollSpy._increment;
5869
- _this33._setupEventHandlers();
5870
- _this33._handleWindowScroll();
5871
- return _this33;
6084
+ _this34.tickId = -1;
6085
+ _this34.id = ScrollSpy._increment;
6086
+ _this34._setupEventHandlers();
6087
+ _this34._handleWindowScroll();
6088
+ return _this34;
5872
6089
  }
5873
6090
 
5874
6091
  _createClass(ScrollSpy, [{
@@ -6021,7 +6238,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6021
6238
  }, {
6022
6239
  key: "_exit",
6023
6240
  value: function _exit() {
6024
- var _this34 = this;
6241
+ var _this35 = this;
6025
6242
 
6026
6243
  ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (value) {
6027
6244
  return value.height() != 0;
@@ -6031,7 +6248,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6031
6248
  $(this.options.getActiveElement(ScrollSpy._visibleElements[0].attr('id'))).removeClass(this.options.activeClass);
6032
6249
 
6033
6250
  ScrollSpy._visibleElements = ScrollSpy._visibleElements.filter(function (el) {
6034
- return el.attr('id') != _this34.$el.attr('id');
6251
+ return el.attr('id') != _this35.$el.attr('id');
6035
6252
  });
6036
6253
  if (ScrollSpy._visibleElements[0]) {
6037
6254
  // Check if empty
@@ -6166,9 +6383,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6166
6383
  function Autocomplete(el, options) {
6167
6384
  _classCallCheck(this, Autocomplete);
6168
6385
 
6169
- var _this35 = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, Autocomplete, el, options));
6386
+ var _this36 = _possibleConstructorReturn(this, (Autocomplete.__proto__ || Object.getPrototypeOf(Autocomplete)).call(this, Autocomplete, el, options));
6170
6387
 
6171
- _this35.el.M_Autocomplete = _this35;
6388
+ _this36.el.M_Autocomplete = _this36;
6172
6389
 
6173
6390
  /**
6174
6391
  * Options for the autocomplete
@@ -6182,19 +6399,19 @@ $jscomp.polyfill = function (e, r, p, m) {
6182
6399
  * @prop {Boolean} noWrap
6183
6400
  * @prop {Function} onCycleTo
6184
6401
  */
6185
- _this35.options = $.extend({}, Autocomplete.defaults, options);
6402
+ _this36.options = $.extend({}, Autocomplete.defaults, options);
6186
6403
 
6187
6404
  // Setup
6188
- _this35.isOpen = false;
6189
- _this35.count = 0;
6190
- _this35.activeIndex = -1;
6191
- _this35.oldVal;
6192
- _this35.$inputField = _this35.$el.closest('.input-field');
6193
- _this35.$active = $();
6194
- _this35._setupDropdown();
6195
-
6196
- _this35._setupEventHandlers();
6197
- return _this35;
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;
6198
6415
  }
6199
6416
 
6200
6417
  _createClass(Autocomplete, [{
@@ -6259,8 +6476,19 @@ $jscomp.polyfill = function (e, r, p, m) {
6259
6476
  key: "_setupDropdown",
6260
6477
  value: function _setupDropdown() {
6261
6478
  this.container = document.createElement('ul');
6479
+ this.container.id = "autocomplete-options-" + M.guid();
6262
6480
  $(this.container).addClass('autocomplete-content dropdown-content');
6263
6481
  this.$inputField.append(this.container);
6482
+ this.el.setAttribute('data-target', this.container.id);
6483
+
6484
+ this.dropdown = M.Dropdown.init(this.el, {
6485
+ autoFocus: false,
6486
+ closeOnClick: false,
6487
+ coverTrigger: false
6488
+ });
6489
+
6490
+ // Sketchy removal of dropdown click handler
6491
+ this.el.removeEventListener('click', this.dropdown._handleClickBound);
6264
6492
  }
6265
6493
 
6266
6494
  /**
@@ -6280,7 +6508,8 @@ $jscomp.polyfill = function (e, r, p, m) {
6280
6508
  }, {
6281
6509
  key: "_handleInputBlur",
6282
6510
  value: function _handleInputBlur() {
6283
- this._removeAutocomplete();
6511
+ this.dropdown.close();
6512
+ this._resetAutocomplete();
6284
6513
  }
6285
6514
 
6286
6515
  /**
@@ -6291,6 +6520,8 @@ $jscomp.polyfill = function (e, r, p, m) {
6291
6520
  }, {
6292
6521
  key: "_handleInputKeyupAndFocus",
6293
6522
  value: function _handleInputKeyupAndFocus(e) {
6523
+ var _this37 = this;
6524
+
6294
6525
  if (e.type === 'keyup') {
6295
6526
  Autocomplete._keydown = false;
6296
6527
  }
@@ -6305,12 +6536,24 @@ $jscomp.polyfill = function (e, r, p, m) {
6305
6536
 
6306
6537
  // Check if the input isn't empty
6307
6538
  if (this.oldVal !== val) {
6308
- this._removeAutocomplete();
6539
+ this._resetAutocomplete();
6309
6540
 
6310
6541
  if (val.length >= this.options.minLength) {
6311
6542
  this.isOpen = true;
6312
6543
  this._renderDropdown(this.options.data, val);
6313
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
+ }
6314
6557
  }
6315
6558
 
6316
6559
  // Update oldVal
@@ -6405,18 +6648,15 @@ $jscomp.polyfill = function (e, r, p, m) {
6405
6648
  }
6406
6649
 
6407
6650
  /**
6408
- * Remove autocomplete elements
6651
+ * Reset autocomplete elements
6409
6652
  */
6410
6653
 
6411
6654
  }, {
6412
- key: "_removeAutocomplete",
6413
- value: function _removeAutocomplete() {
6655
+ key: "_resetAutocomplete",
6656
+ value: function _resetAutocomplete() {
6414
6657
  $(this.container).empty();
6415
6658
  this._resetCurrentElement();
6416
6659
  this.oldVal = null;
6417
- $(this.container).css({
6418
- display: ''
6419
- });
6420
6660
  this.isOpen = false;
6421
6661
  }
6422
6662
 
@@ -6431,7 +6671,8 @@ $jscomp.polyfill = function (e, r, p, m) {
6431
6671
  var text = el.text().trim();
6432
6672
  this.el.value = text;
6433
6673
  this.$el.trigger('change');
6434
- this._removeAutocomplete();
6674
+ this._resetAutocomplete();
6675
+ this.dropdown.close();
6435
6676
 
6436
6677
  // Handle onAutocomplete callback.
6437
6678
  if (typeof this.options.onAutocomplete === 'function') {
@@ -6448,9 +6689,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6448
6689
  }, {
6449
6690
  key: "_renderDropdown",
6450
6691
  value: function _renderDropdown(data, val) {
6451
- var _this36 = this;
6692
+ var _this38 = this;
6452
6693
 
6453
- this._removeAutocomplete();
6694
+ this._resetAutocomplete();
6454
6695
 
6455
6696
  var matchingData = [];
6456
6697
 
@@ -6474,14 +6715,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6474
6715
 
6475
6716
  // Sort
6476
6717
  var sortFunctionBound = function (a, b) {
6477
- return _this36.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6718
+ return _this38.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6478
6719
  };
6479
6720
  matchingData.sort(sortFunctionBound);
6480
6721
 
6481
- $(this.container).css({
6482
- display: 'block'
6483
- });
6484
-
6485
6722
  // Render
6486
6723
  for (var i = 0; i < matchingData.length; i++) {
6487
6724
  var _entry = matchingData[i];
@@ -6555,7 +6792,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6555
6792
  ;(function ($) {
6556
6793
  // Function to update labels of text fields
6557
6794
  M.updateTextFields = function () {
6558
- var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
6795
+ var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea';
6559
6796
  $(input_selector).each(function (element, index) {
6560
6797
  var $this = $(this);
6561
6798
  if (element.value.length > 0 || $(element).is(':focus') || element.autofocus || $this.attr('placeholder') !== null) {
@@ -6684,7 +6921,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6684
6921
 
6685
6922
  $(document).ready(function () {
6686
6923
  // Text based inputs
6687
- var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], textarea';
6924
+ var input_selector = 'input[type=text], input[type=password], input[type=email], input[type=url], input[type=tel], input[type=number], input[type=search], input[type=date], input[type=time], textarea';
6688
6925
 
6689
6926
  // Add active if form auto complete
6690
6927
  $(document).on('change', input_selector, function () {
@@ -6824,9 +7061,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6824
7061
  function Slider(el, options) {
6825
7062
  _classCallCheck(this, Slider);
6826
7063
 
6827
- var _this37 = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options));
7064
+ var _this39 = _possibleConstructorReturn(this, (Slider.__proto__ || Object.getPrototypeOf(Slider)).call(this, Slider, el, options));
6828
7065
 
6829
- _this37.el.M_Slider = _this37;
7066
+ _this39.el.M_Slider = _this39;
6830
7067
 
6831
7068
  /**
6832
7069
  * Options for the modal
@@ -6836,25 +7073,27 @@ $jscomp.polyfill = function (e, r, p, m) {
6836
7073
  * @prop {Number} [duration=500] - Length in ms of slide transition
6837
7074
  * @prop {Number} [interval=6000] - Length in ms of slide interval
6838
7075
  */
6839
- _this37.options = $.extend({}, Slider.defaults, options);
7076
+ _this39.options = $.extend({}, Slider.defaults, options);
6840
7077
 
6841
7078
  // setup
6842
- _this37.$slider = _this37.$el.find('.slides');
6843
- _this37.$slides = _this37.$slider.children('li');
6844
- _this37.activeIndex = _this37.$slider.find('.active').index();
6845
- if (_this37.activeIndex != -1) {
6846
- _this37.$active = _this37.$slides.eq(_this37.activeIndex);
7079
+ _this39.$slider = _this39.$el.find('.slides');
7080
+ _this39.$slides = _this39.$slider.children('li');
7081
+ _this39.activeIndex = _this39.$slides.filter(function (item) {
7082
+ return $(item).hasClass('active');
7083
+ }).first().index();
7084
+ if (_this39.activeIndex != -1) {
7085
+ _this39.$active = _this39.$slides.eq(_this39.activeIndex);
6847
7086
  }
6848
7087
 
6849
- _this37._setSliderHeight();
7088
+ _this39._setSliderHeight();
6850
7089
 
6851
7090
  // Set initial positions of captions
6852
- _this37.$slides.find('.caption').each(function (el) {
6853
- _this37._animateCaptionIn(el, 0);
7091
+ _this39.$slides.find('.caption').each(function (el) {
7092
+ _this39._animateCaptionIn(el, 0);
6854
7093
  });
6855
7094
 
6856
7095
  // Move img src into background-image
6857
- _this37.$slides.find('img').each(function (el) {
7096
+ _this39.$slides.find('img').each(function (el) {
6858
7097
  var placeholderBase64 = 'data:image/gif;base64,R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
6859
7098
  if ($(el).attr('src') !== placeholderBase64) {
6860
7099
  $(el).css('background-image', 'url("' + $(el).attr('src') + '")');
@@ -6862,46 +7101,46 @@ $jscomp.polyfill = function (e, r, p, m) {
6862
7101
  }
6863
7102
  });
6864
7103
 
6865
- _this37._setupIndicators();
7104
+ _this39._setupIndicators();
6866
7105
 
6867
7106
  // Show active slide
6868
- if (_this37.$active) {
6869
- _this37.$active.css('display', 'block');
7107
+ if (_this39.$active) {
7108
+ _this39.$active.css('display', 'block');
6870
7109
  } else {
6871
- _this37.$slides.first().addClass('active');
7110
+ _this39.$slides.first().addClass('active');
6872
7111
  anim({
6873
- targets: _this37.$slides.first()[0],
7112
+ targets: _this39.$slides.first()[0],
6874
7113
  opacity: 1,
6875
- duration: _this37.options.duration,
7114
+ duration: _this39.options.duration,
6876
7115
  easing: 'easeOutQuad'
6877
7116
  });
6878
7117
 
6879
- _this37.activeIndex = 0;
6880
- _this37.$active = _this37.$slides.eq(_this37.activeIndex);
7118
+ _this39.activeIndex = 0;
7119
+ _this39.$active = _this39.$slides.eq(_this39.activeIndex);
6881
7120
 
6882
7121
  // Update indicators
6883
- if (_this37.options.indicators) {
6884
- _this37.$indicators.eq(_this37.activeIndex).addClass('active');
7122
+ if (_this39.options.indicators) {
7123
+ _this39.$indicators.eq(_this39.activeIndex).addClass('active');
6885
7124
  }
6886
7125
  }
6887
7126
 
6888
7127
  // Adjust height to current slide
6889
- _this37.$active.find('img').each(function (el) {
7128
+ _this39.$active.find('img').each(function (el) {
6890
7129
  anim({
6891
- targets: _this37.$active.find('.caption')[0],
7130
+ targets: _this39.$active.find('.caption')[0],
6892
7131
  opacity: 1,
6893
7132
  translateX: 0,
6894
7133
  translateY: 0,
6895
- duration: _this37.options.duration,
7134
+ duration: _this39.options.duration,
6896
7135
  easing: 'easeOutQuad'
6897
7136
  });
6898
7137
  });
6899
7138
 
6900
- _this37._setupEventHandlers();
7139
+ _this39._setupEventHandlers();
6901
7140
 
6902
7141
  // auto scroll
6903
- _this37.start();
6904
- return _this37;
7142
+ _this39.start();
7143
+ return _this39;
6905
7144
  }
6906
7145
 
6907
7146
  _createClass(Slider, [{
@@ -6925,14 +7164,14 @@ $jscomp.polyfill = function (e, r, p, m) {
6925
7164
  }, {
6926
7165
  key: "_setupEventHandlers",
6927
7166
  value: function _setupEventHandlers() {
6928
- var _this38 = this;
7167
+ var _this40 = this;
6929
7168
 
6930
7169
  this._handleIntervalBound = this._handleInterval.bind(this);
6931
7170
  this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
6932
7171
 
6933
7172
  if (this.options.indicators) {
6934
7173
  this.$indicators.each(function (el) {
6935
- el.addEventListener('click', _this38._handleIndicatorClickBound);
7174
+ el.addEventListener('click', _this40._handleIndicatorClickBound);
6936
7175
  });
6937
7176
  }
6938
7177
  }
@@ -6944,11 +7183,11 @@ $jscomp.polyfill = function (e, r, p, m) {
6944
7183
  }, {
6945
7184
  key: "_removeEventHandlers",
6946
7185
  value: function _removeEventHandlers() {
6947
- var _this39 = this;
7186
+ var _this41 = this;
6948
7187
 
6949
7188
  if (this.options.indicators) {
6950
7189
  this.$indicators.each(function (el) {
6951
- el.removeEventListener('click', _this39._handleIndicatorClickBound);
7190
+ el.removeEventListener('click', _this41._handleIndicatorClickBound);
6952
7191
  });
6953
7192
  }
6954
7193
  }
@@ -7032,13 +7271,13 @@ $jscomp.polyfill = function (e, r, p, m) {
7032
7271
  }, {
7033
7272
  key: "_setupIndicators",
7034
7273
  value: function _setupIndicators() {
7035
- var _this40 = this;
7274
+ var _this42 = this;
7036
7275
 
7037
7276
  if (this.options.indicators) {
7038
7277
  this.$indicators = $('<ul class="indicators"></ul>');
7039
7278
  this.$slides.each(function (el, index) {
7040
7279
  var $indicator = $('<li class="indicator-item"></li>');
7041
- _this40.$indicators.append($indicator[0]);
7280
+ _this42.$indicators.append($indicator[0]);
7042
7281
  });
7043
7282
  this.$el.append(this.$indicators[0]);
7044
7283
  this.$indicators = this.$indicators.children('li.indicator-item');
@@ -7063,7 +7302,7 @@ $jscomp.polyfill = function (e, r, p, m) {
7063
7302
  }, {
7064
7303
  key: "set",
7065
7304
  value: function set(index) {
7066
- var _this41 = this;
7305
+ var _this43 = this;
7067
7306
 
7068
7307
  // Wrap around indices.
7069
7308
  if (index >= this.$slides.length) index = 0;else if (index < 0) index = this.$slides.length - 1;
@@ -7080,7 +7319,7 @@ $jscomp.polyfill = function (e, r, p, m) {
7080
7319
  duration: this.options.duration,
7081
7320
  easing: 'easeOutQuad',
7082
7321
  complete: function () {
7083
- _this41.$slides.not('.active').each(function (el) {
7322
+ _this43.$slides.not('.active').each(function (el) {
7084
7323
  anim({
7085
7324
  targets: el,
7086
7325
  opacity: 0,
@@ -7279,9 +7518,9 @@ $jscomp.polyfill = function (e, r, p, m) {
7279
7518
  function Chips(el, options) {
7280
7519
  _classCallCheck(this, Chips);
7281
7520
 
7282
- var _this42 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
7521
+ var _this44 = _possibleConstructorReturn(this, (Chips.__proto__ || Object.getPrototypeOf(Chips)).call(this, Chips, el, options));
7283
7522
 
7284
- _this42.el.M_Chips = _this42;
7523
+ _this44.el.M_Chips = _this44;
7285
7524
 
7286
7525
  /**
7287
7526
  * Options for the modal
@@ -7291,34 +7530,34 @@ $jscomp.polyfill = function (e, r, p, m) {
7291
7530
  * @prop {String} secondaryPlaceholder
7292
7531
  * @prop {Object} autocompleteOptions
7293
7532
  */
7294
- _this42.options = $.extend({}, Chips.defaults, options);
7533
+ _this44.options = $.extend({}, Chips.defaults, options);
7295
7534
 
7296
- _this42.$el.addClass('chips input-field');
7297
- _this42.chipsData = [];
7298
- _this42.$chips = $();
7299
- _this42._setupInput();
7300
- _this42.hasAutocomplete = Object.keys(_this42.options.autocompleteOptions).length > 0;
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;
7301
7540
 
7302
7541
  // Set input id
7303
- if (!_this42.$input.attr('id')) {
7304
- _this42.$input.attr('id', M.guid());
7542
+ if (!_this44.$input.attr('id')) {
7543
+ _this44.$input.attr('id', M.guid());
7305
7544
  }
7306
7545
 
7307
7546
  // Render initial chips
7308
- if (_this42.options.data.length) {
7309
- _this42.chipsData = _this42.options.data;
7310
- _this42._renderChips(_this42.chipsData);
7547
+ if (_this44.options.data.length) {
7548
+ _this44.chipsData = _this44.options.data;
7549
+ _this44._renderChips(_this44.chipsData);
7311
7550
  }
7312
7551
 
7313
7552
  // Setup autocomplete if needed
7314
- if (_this42.hasAutocomplete) {
7315
- _this42._setupAutocomplete();
7553
+ if (_this44.hasAutocomplete) {
7554
+ _this44._setupAutocomplete();
7316
7555
  }
7317
7556
 
7318
- _this42._setPlaceholder();
7319
- _this42._setupLabel();
7320
- _this42._setupEventHandlers();
7321
- return _this42;
7557
+ _this44._setPlaceholder();
7558
+ _this44._setupLabel();
7559
+ _this44._setupEventHandlers();
7560
+ return _this44;
7322
7561
  }
7323
7562
 
7324
7563
  _createClass(Chips, [{
@@ -7521,14 +7760,14 @@ $jscomp.polyfill = function (e, r, p, m) {
7521
7760
  }, {
7522
7761
  key: "_setupAutocomplete",
7523
7762
  value: function _setupAutocomplete() {
7524
- var _this43 = this;
7763
+ var _this45 = this;
7525
7764
 
7526
7765
  this.options.autocompleteOptions.onAutocomplete = function (val) {
7527
- _this43.addChip({
7766
+ _this45.addChip({
7528
7767
  tag: val
7529
7768
  });
7530
- _this43.$input[0].value = '';
7531
- _this43.$input[0].focus();
7769
+ _this45.$input[0].value = '';
7770
+ _this45.$input[0].focus();
7532
7771
  };
7533
7772
 
7534
7773
  this.autocomplete = M.Autocomplete.init(this.$input[0], this.options.autocompleteOptions);
@@ -7702,7 +7941,9 @@ $jscomp.polyfill = function (e, r, p, m) {
7702
7941
  var index = currChips._selectedChip.index();
7703
7942
  currChips.deleteChip(index);
7704
7943
  currChips._selectedChip = null;
7705
- selectIndex = index - 1;
7944
+
7945
+ // Make sure selectIndex doesn't go negative
7946
+ selectIndex = Math.max(index - 1, 0);
7706
7947
  }
7707
7948
 
7708
7949
  if (currChips.chipsData.length) {
@@ -7821,21 +8062,21 @@ $jscomp.polyfill = function (e, r, p, m) {
7821
8062
  function Pushpin(el, options) {
7822
8063
  _classCallCheck(this, Pushpin);
7823
8064
 
7824
- var _this44 = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
8065
+ var _this46 = _possibleConstructorReturn(this, (Pushpin.__proto__ || Object.getPrototypeOf(Pushpin)).call(this, Pushpin, el, options));
7825
8066
 
7826
- _this44.el.M_Pushpin = _this44;
8067
+ _this46.el.M_Pushpin = _this46;
7827
8068
 
7828
8069
  /**
7829
8070
  * Options for the modal
7830
8071
  * @member Pushpin#options
7831
8072
  */
7832
- _this44.options = $.extend({}, Pushpin.defaults, options);
8073
+ _this46.options = $.extend({}, Pushpin.defaults, options);
7833
8074
 
7834
- _this44.originalOffset = _this44.el.offsetTop;
7835
- Pushpin._pushpins.push(_this44);
7836
- _this44._setupEventHandlers();
7837
- _this44._updatePosition();
7838
- return _this44;
8075
+ _this46.originalOffset = _this46.el.offsetTop;
8076
+ Pushpin._pushpins.push(_this46);
8077
+ _this46._setupEventHandlers();
8078
+ _this46._updatePosition();
8079
+ return _this46;
7839
8080
  }
7840
8081
 
7841
8082
  _createClass(Pushpin, [{
@@ -7986,9 +8227,9 @@ $jscomp.polyfill = function (e, r, p, m) {
7986
8227
  function FloatingActionButton(el, options) {
7987
8228
  _classCallCheck(this, FloatingActionButton);
7988
8229
 
7989
- var _this45 = _possibleConstructorReturn(this, (FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton)).call(this, FloatingActionButton, el, options));
8230
+ var _this47 = _possibleConstructorReturn(this, (FloatingActionButton.__proto__ || Object.getPrototypeOf(FloatingActionButton)).call(this, FloatingActionButton, el, options));
7990
8231
 
7991
- _this45.el.M_FloatingActionButton = _this45;
8232
+ _this47.el.M_FloatingActionButton = _this47;
7992
8233
 
7993
8234
  /**
7994
8235
  * Options for the fab
@@ -7997,30 +8238,30 @@ $jscomp.polyfill = function (e, r, p, m) {
7997
8238
  * @prop {Boolean} [hoverEnabled=true] - Enable hover vs click
7998
8239
  * @prop {Boolean} [toolbarEnabled=false] - Enable toolbar transition
7999
8240
  */
8000
- _this45.options = $.extend({}, FloatingActionButton.defaults, options);
8001
-
8002
- _this45.isOpen = false;
8003
- _this45.$anchor = _this45.$el.children('a').first();
8004
- _this45.$menu = _this45.$el.children('ul').first();
8005
- _this45.$floatingBtns = _this45.$el.find('ul .btn-floating');
8006
- _this45.$floatingBtnsReverse = _this45.$el.find('ul .btn-floating').reverse();
8007
- _this45.offsetY = 0;
8008
- _this45.offsetX = 0;
8009
- if (_this45.options.direction === 'top') {
8010
- _this45.$el.addClass('direction-top');
8011
- _this45.offsetY = 40;
8012
- } else if (_this45.options.direction === 'right') {
8013
- _this45.$el.addClass('direction-right');
8014
- _this45.offsetX = -40;
8015
- } else if (_this45.options.direction === 'bottom') {
8016
- _this45.$el.addClass('direction-bottom');
8017
- _this45.offsetY = -40;
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;
8018
8259
  } else {
8019
- _this45.$el.addClass('direction-left');
8020
- _this45.offsetX = 40;
8260
+ _this47.$el.addClass('direction-left');
8261
+ _this47.offsetX = 40;
8021
8262
  }
8022
- _this45._setupEventHandlers();
8023
- return _this45;
8263
+ _this47._setupEventHandlers();
8264
+ return _this47;
8024
8265
  }
8025
8266
 
8026
8267
  _createClass(FloatingActionButton, [{
@@ -8143,7 +8384,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8143
8384
  }, {
8144
8385
  key: "_animateInFAB",
8145
8386
  value: function _animateInFAB() {
8146
- var _this46 = this;
8387
+ var _this48 = this;
8147
8388
 
8148
8389
  this.$el.addClass('active');
8149
8390
 
@@ -8153,8 +8394,8 @@ $jscomp.polyfill = function (e, r, p, m) {
8153
8394
  targets: el,
8154
8395
  opacity: 1,
8155
8396
  scale: [.4, 1],
8156
- translateY: [_this46.offsetY, 0],
8157
- translateX: [_this46.offsetX, 0],
8397
+ translateY: [_this48.offsetY, 0],
8398
+ translateX: [_this48.offsetX, 0],
8158
8399
  duration: 275,
8159
8400
  delay: time,
8160
8401
  easing: 'easeInOutQuad'
@@ -8170,7 +8411,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8170
8411
  }, {
8171
8412
  key: "_animateOutFAB",
8172
8413
  value: function _animateOutFAB() {
8173
- var _this47 = this;
8414
+ var _this49 = this;
8174
8415
 
8175
8416
  this.$floatingBtnsReverse.each(function (el) {
8176
8417
  anim.remove(el);
@@ -8178,12 +8419,12 @@ $jscomp.polyfill = function (e, r, p, m) {
8178
8419
  targets: el,
8179
8420
  opacity: 0,
8180
8421
  scale: .4,
8181
- translateY: _this47.offsetY,
8182
- translateX: _this47.offsetX,
8422
+ translateY: _this49.offsetY,
8423
+ translateX: _this49.offsetX,
8183
8424
  duration: 175,
8184
8425
  easing: 'easeOutQuad',
8185
8426
  complete: function () {
8186
- _this47.$el.removeClass('active');
8427
+ _this49.$el.removeClass('active');
8187
8428
  }
8188
8429
  });
8189
8430
  });
@@ -8196,7 +8437,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8196
8437
  }, {
8197
8438
  key: "_animateInToolbar",
8198
8439
  value: function _animateInToolbar() {
8199
- var _this48 = this;
8440
+ var _this50 = this;
8200
8441
 
8201
8442
  var scaleFactor = void 0;
8202
8443
  var windowWidth = window.innerWidth;
@@ -8232,18 +8473,18 @@ $jscomp.polyfill = function (e, r, p, m) {
8232
8473
  });
8233
8474
 
8234
8475
  setTimeout(function () {
8235
- _this48.$el.css({
8476
+ _this50.$el.css({
8236
8477
  transform: '',
8237
8478
  transition: 'transform .2s cubic-bezier(0.550, 0.085, 0.680, 0.530), background-color 0s linear .2s'
8238
8479
  });
8239
- _this48.$anchor.css({
8480
+ _this50.$anchor.css({
8240
8481
  overflow: 'visible',
8241
8482
  transform: '',
8242
8483
  transition: 'transform .2s'
8243
8484
  });
8244
8485
 
8245
8486
  setTimeout(function () {
8246
- _this48.$el.css({
8487
+ _this50.$el.css({
8247
8488
  overflow: 'hidden',
8248
8489
  'background-color': fabColor
8249
8490
  });
@@ -8251,14 +8492,14 @@ $jscomp.polyfill = function (e, r, p, m) {
8251
8492
  transform: 'scale(' + scaleFactor + ')',
8252
8493
  transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
8253
8494
  });
8254
- _this48.$menu.children('li').children('a').css({
8495
+ _this50.$menu.children('li').children('a').css({
8255
8496
  opacity: 1
8256
8497
  });
8257
8498
 
8258
8499
  // Scroll to close.
8259
- _this48._handleDocumentClickBound = _this48._handleDocumentClick.bind(_this48);
8260
- window.addEventListener('scroll', _this48._handleCloseBound, true);
8261
- document.body.addEventListener('click', _this48._handleDocumentClickBound, true);
8500
+ _this50._handleDocumentClickBound = _this50._handleDocumentClick.bind(_this50);
8501
+ window.addEventListener('scroll', _this50._handleCloseBound, true);
8502
+ document.body.addEventListener('click', _this50._handleDocumentClickBound, true);
8262
8503
  }, 100);
8263
8504
  }, 0);
8264
8505
  }
@@ -8270,7 +8511,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8270
8511
  }, {
8271
8512
  key: "_animateOutToolbar",
8272
8513
  value: function _animateOutToolbar() {
8273
- var _this49 = this;
8514
+ var _this51 = this;
8274
8515
 
8275
8516
  var windowWidth = window.innerWidth;
8276
8517
  var windowHeight = window.innerHeight;
@@ -8301,26 +8542,26 @@ $jscomp.polyfill = function (e, r, p, m) {
8301
8542
  backdrop.remove();
8302
8543
 
8303
8544
  // Set initial state.
8304
- _this49.$el.css({
8545
+ _this51.$el.css({
8305
8546
  'text-align': '',
8306
8547
  width: '',
8307
8548
  bottom: '',
8308
8549
  left: '',
8309
8550
  overflow: '',
8310
8551
  'background-color': '',
8311
- transform: 'translate3d(' + -_this49.offsetX + 'px,0,0)'
8552
+ transform: 'translate3d(' + -_this51.offsetX + 'px,0,0)'
8312
8553
  });
8313
- _this49.$anchor.css({
8554
+ _this51.$anchor.css({
8314
8555
  overflow: '',
8315
- transform: 'translate3d(0,' + _this49.offsetY + 'px,0)'
8556
+ transform: 'translate3d(0,' + _this51.offsetY + 'px,0)'
8316
8557
  });
8317
8558
 
8318
8559
  setTimeout(function () {
8319
- _this49.$el.css({
8560
+ _this51.$el.css({
8320
8561
  transform: 'translate3d(0,0,0)',
8321
8562
  transition: 'transform .2s'
8322
8563
  });
8323
- _this49.$anchor.css({
8564
+ _this51.$anchor.css({
8324
8565
  transform: 'translate3d(0,0,0)',
8325
8566
  transition: 'transform .2s cubic-bezier(0.550, 0.055, 0.675, 0.190)'
8326
8567
  });
@@ -8411,10 +8652,13 @@ $jscomp.polyfill = function (e, r, p, m) {
8411
8652
  // Specify a DOM element to render the calendar in
8412
8653
  container: null,
8413
8654
 
8655
+ // Show clear button
8656
+ showClearBtn: false,
8657
+
8414
8658
  // internationalization
8415
8659
  i18n: {
8660
+ cancel: 'Cancel',
8416
8661
  clear: 'Clear',
8417
- today: 'Today',
8418
8662
  done: 'Ok',
8419
8663
  previousMonth: '‹',
8420
8664
  nextMonth: '›',
@@ -8452,53 +8696,53 @@ $jscomp.polyfill = function (e, r, p, m) {
8452
8696
  function Datepicker(el, options) {
8453
8697
  _classCallCheck(this, Datepicker);
8454
8698
 
8455
- var _this50 = _possibleConstructorReturn(this, (Datepicker.__proto__ || Object.getPrototypeOf(Datepicker)).call(this, Datepicker, el, options));
8699
+ var _this52 = _possibleConstructorReturn(this, (Datepicker.__proto__ || Object.getPrototypeOf(Datepicker)).call(this, Datepicker, el, options));
8456
8700
 
8457
- _this50.el.M_Datepicker = _this50;
8701
+ _this52.el.M_Datepicker = _this52;
8458
8702
 
8459
- _this50.options = $.extend({}, Datepicker.defaults, options);
8703
+ _this52.options = $.extend({}, Datepicker.defaults, options);
8460
8704
 
8461
8705
  // make sure i18n defaults are not lost when only few i18n option properties are passed
8462
8706
  if (!!options && options.hasOwnProperty('i18n') && typeof options.i18n === 'object') {
8463
- _this50.options.i18n = $.extend({}, Datepicker.defaults.i18n, options.i18n);
8707
+ _this52.options.i18n = $.extend({}, Datepicker.defaults.i18n, options.i18n);
8464
8708
  }
8465
8709
 
8466
8710
  // Remove time component from minDate and maxDate options
8467
- if (_this50.options.minDate) _this50.options.minDate.setHours(0, 0, 0, 0);
8468
- if (_this50.options.maxDate) _this50.options.maxDate.setHours(0, 0, 0, 0);
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);
8469
8713
 
8470
- _this50.id = M.guid();
8714
+ _this52.id = M.guid();
8471
8715
 
8472
- _this50._setupVariables();
8473
- _this50._insertHTMLIntoDOM();
8474
- _this50._setupModal();
8716
+ _this52._setupVariables();
8717
+ _this52._insertHTMLIntoDOM();
8718
+ _this52._setupModal();
8475
8719
 
8476
- _this50._setupEventHandlers();
8720
+ _this52._setupEventHandlers();
8477
8721
 
8478
- if (!_this50.options.defaultDate) {
8479
- _this50.options.defaultDate = new Date(Date.parse(_this50.el.value));
8480
- _this50.options.setDefaultDate = true;
8722
+ if (!_this52.options.defaultDate) {
8723
+ _this52.options.defaultDate = new Date(Date.parse(_this52.el.value));
8724
+ _this52.options.setDefaultDate = true;
8481
8725
  }
8482
8726
 
8483
- var defDate = _this50.options.defaultDate;
8727
+ var defDate = _this52.options.defaultDate;
8484
8728
 
8485
8729
  if (Datepicker._isDate(defDate)) {
8486
- if (_this50.options.setDefaultDate) {
8487
- _this50.setDate(defDate, true);
8730
+ if (_this52.options.setDefaultDate) {
8731
+ _this52.setDate(defDate, true);
8488
8732
  } else {
8489
- _this50.gotoDate(defDate);
8733
+ _this52.gotoDate(defDate);
8490
8734
  }
8491
8735
  } else {
8492
- _this50.gotoDate(new Date());
8736
+ _this52.gotoDate(new Date());
8493
8737
  }
8494
8738
 
8495
8739
  /**
8496
8740
  * Describes open/close state of datepicker
8497
8741
  * @type {Boolean}
8498
8742
  */
8499
- _this50.isOpen = false;
8743
+ _this52.isOpen = false;
8500
8744
 
8501
- return _this50;
8745
+ return _this52;
8502
8746
  }
8503
8747
 
8504
8748
  _createClass(Datepicker, [{
@@ -8512,18 +8756,34 @@ $jscomp.polyfill = function (e, r, p, m) {
8512
8756
  this._removeEventHandlers();
8513
8757
  this.modal.destroy();
8514
8758
  $(this.modalEl).remove();
8759
+ this.destroySelects();
8515
8760
  this.el.M_Datepicker = undefined;
8516
8761
  }
8762
+ }, {
8763
+ key: "destroySelects",
8764
+ value: function destroySelects() {
8765
+ var oldYearSelect = this.calendarEl.querySelector('.pika-select-year');
8766
+ if (oldYearSelect) {
8767
+ M.FormSelect.getInstance(oldYearSelect).destroy();
8768
+ }
8769
+ var oldMonthSelect = this.calendarEl.querySelector('.pika-select-month');
8770
+ if (oldMonthSelect) {
8771
+ M.FormSelect.getInstance(oldMonthSelect).destroy();
8772
+ }
8773
+ }
8517
8774
  }, {
8518
8775
  key: "_insertHTMLIntoDOM",
8519
8776
  value: function _insertHTMLIntoDOM() {
8520
- this.clearBtn.innerHTML = this.options.i18n.clear;
8521
- this.todayBtn.innerHTML = this.options.i18n.today;
8777
+ if (this.options.showClearBtn) {
8778
+ $(this.clearBtn).css({ visibility: '' });
8779
+ this.clearBtn.innerHTML = this.options.i18n.clear;
8780
+ }
8781
+
8522
8782
  this.doneBtn.innerHTML = this.options.i18n.done;
8783
+ this.cancelBtn.innerHTML = this.options.i18n.cancel;
8523
8784
 
8524
- var containerEl = document.querySelector(this.options.container);
8525
- if (this.options.container && !!containerEl) {
8526
- this.$modalEl.appendTo(containerEl);
8785
+ if (this.options.container) {
8786
+ this.$modalEl.appendTo(this.options.container);
8527
8787
  } else {
8528
8788
  this.$modalEl.insertBefore(this.el);
8529
8789
  }
@@ -8531,19 +8791,19 @@ $jscomp.polyfill = function (e, r, p, m) {
8531
8791
  }, {
8532
8792
  key: "_setupModal",
8533
8793
  value: function _setupModal() {
8534
- var _this51 = this;
8794
+ var _this53 = this;
8535
8795
 
8536
8796
  this.modalEl.id = 'modal-' + this.id;
8537
8797
  this.modal = M.Modal.init(this.modalEl, {
8538
8798
  onCloseEnd: function () {
8539
- _this51.isOpen = false;
8799
+ _this53.isOpen = false;
8540
8800
  }
8541
8801
  });
8542
8802
  }
8543
8803
  }, {
8544
8804
  key: "toString",
8545
8805
  value: function toString(format) {
8546
- var _this52 = this;
8806
+ var _this54 = this;
8547
8807
 
8548
8808
  format = format || this.options.format;
8549
8809
  if (!Datepicker._isDate(this.date)) {
@@ -8552,8 +8812,8 @@ $jscomp.polyfill = function (e, r, p, m) {
8552
8812
 
8553
8813
  var formatArray = format.split(/(d{1,4}|m{1,4}|y{4}|yy|!.)/g);
8554
8814
  var formattedDate = formatArray.map(function (label) {
8555
- if (_this52.formats[label]) {
8556
- return _this52.formats[label]();
8815
+ if (_this54.formats[label]) {
8816
+ return _this54.formats[label]();
8557
8817
  }
8558
8818
 
8559
8819
  return label;
@@ -8930,15 +9190,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8930
9190
  html += this.renderTitle(this, c, this.calendars[c].year, this.calendars[c].month, this.calendars[0].year, randId) + this.render(this.calendars[c].year, this.calendars[c].month, randId);
8931
9191
  }
8932
9192
 
8933
- // Destroy Materialize Select
8934
- var oldYearSelect = this.calendarEl.querySelector('.pika-select-year');
8935
- if (oldYearSelect) {
8936
- M.FormSelect.getInstance(oldYearSelect).destroy();
8937
- }
8938
- var oldMonthSelect = this.calendarEl.querySelector('.pika-select-month');
8939
- if (oldMonthSelect) {
8940
- M.FormSelect.getInstance(oldMonthSelect).destroy();
8941
- }
9193
+ this.destroySelects();
8942
9194
 
8943
9195
  this.calendarEl.innerHTML = html;
8944
9196
 
@@ -8969,22 +9221,25 @@ $jscomp.polyfill = function (e, r, p, m) {
8969
9221
  this._handleInputChangeBound = this._handleInputChange.bind(this);
8970
9222
  this._handleCalendarClickBound = this._handleCalendarClick.bind(this);
8971
9223
  this._finishSelectionBound = this._finishSelection.bind(this);
8972
- this._handleTodayClickBound = this._handleTodayClick.bind(this);
8973
- this._handleClearClickBound = this._handleClearClick.bind(this);
8974
9224
  this._handleMonthChange = this._handleMonthChange.bind(this);
9225
+ this._closeBound = this.close.bind(this);
8975
9226
 
8976
9227
  this.el.addEventListener('click', this._handleInputClickBound);
8977
9228
  this.el.addEventListener('keydown', this._handleInputKeydownBound);
8978
9229
  this.el.addEventListener('change', this._handleInputChangeBound);
8979
9230
  this.calendarEl.addEventListener('click', this._handleCalendarClickBound);
8980
9231
  this.doneBtn.addEventListener('click', this._finishSelectionBound);
8981
- this.todayBtn.addEventListener('click', this._handleTodayClickBound);
8982
- this.clearBtn.addEventListener('click', this._handleClearClickBound);
9232
+ this.cancelBtn.addEventListener('click', this._closeBound);
9233
+
9234
+ if (this.options.showClearBtn) {
9235
+ this._handleClearClickBound = this._handleClearClick.bind(this);
9236
+ this.clearBtn.addEventListener('click', this._handleClearClickBound);
9237
+ }
8983
9238
  }
8984
9239
  }, {
8985
9240
  key: "_setupVariables",
8986
9241
  value: function _setupVariables() {
8987
- var _this53 = this;
9242
+ var _this55 = this;
8988
9243
 
8989
9244
  this.$modalEl = $(Datepicker._template);
8990
9245
  this.modalEl = this.$modalEl[0];
@@ -8993,43 +9248,45 @@ $jscomp.polyfill = function (e, r, p, m) {
8993
9248
 
8994
9249
  this.yearTextEl = this.modalEl.querySelector('.year-text');
8995
9250
  this.dateTextEl = this.modalEl.querySelector('.date-text');
8996
- this.clearBtn = this.modalEl.querySelector('.datepicker-clear');
8997
- this.todayBtn = this.modalEl.querySelector('.datepicker-today');
9251
+ if (this.options.showClearBtn) {
9252
+ this.clearBtn = this.modalEl.querySelector('.datepicker-clear');
9253
+ }
8998
9254
  this.doneBtn = this.modalEl.querySelector('.datepicker-done');
9255
+ this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel');
8999
9256
 
9000
9257
  this.formats = {
9001
9258
 
9002
9259
  d: function () {
9003
- return _this53.date.getDate();
9260
+ return _this55.date.getDate();
9004
9261
  },
9005
9262
  dd: function () {
9006
- var d = _this53.date.getDate();
9263
+ var d = _this55.date.getDate();
9007
9264
  return (d < 10 ? '0' : '') + d;
9008
9265
  },
9009
9266
  ddd: function () {
9010
- return _this53.options.i18n.weekdaysShort[_this53.date.getDay()];
9267
+ return _this55.options.i18n.weekdaysShort[_this55.date.getDay()];
9011
9268
  },
9012
9269
  dddd: function () {
9013
- return _this53.options.i18n.weekdays[_this53.date.getDay()];
9270
+ return _this55.options.i18n.weekdays[_this55.date.getDay()];
9014
9271
  },
9015
9272
  m: function () {
9016
- return _this53.date.getMonth() + 1;
9273
+ return _this55.date.getMonth() + 1;
9017
9274
  },
9018
9275
  mm: function () {
9019
- var m = _this53.date.getMonth() + 1;
9276
+ var m = _this55.date.getMonth() + 1;
9020
9277
  return (m < 10 ? '0' : '') + m;
9021
9278
  },
9022
9279
  mmm: function () {
9023
- return _this53.options.i18n.monthsShort[_this53.date.getMonth()];
9280
+ return _this55.options.i18n.monthsShort[_this55.date.getMonth()];
9024
9281
  },
9025
9282
  mmmm: function () {
9026
- return _this53.options.i18n.months[_this53.date.getMonth()];
9283
+ return _this55.options.i18n.months[_this55.date.getMonth()];
9027
9284
  },
9028
9285
  yy: function () {
9029
- return ('' + _this53.date.getFullYear()).slice(2);
9286
+ return ('' + _this55.date.getFullYear()).slice(2);
9030
9287
  },
9031
9288
  yyyy: function () {
9032
- return _this53.date.getFullYear();
9289
+ return _this55.date.getFullYear();
9033
9290
  }
9034
9291
  };
9035
9292
  }
@@ -9088,13 +9345,6 @@ $jscomp.polyfill = function (e, r, p, m) {
9088
9345
  // this._c = true;
9089
9346
  // }
9090
9347
  }
9091
- }, {
9092
- key: "_handleTodayClick",
9093
- value: function _handleTodayClick() {
9094
- this.date = new Date();
9095
- this.setInputValue();
9096
- this.close();
9097
- }
9098
9348
  }, {
9099
9349
  key: "_handleClearClick",
9100
9350
  value: function _handleClearClick() {
@@ -9284,7 +9534,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9284
9534
  return Datepicker;
9285
9535
  }(Component);
9286
9536
 
9287
- 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" type="button"></button>', '<div class="confirmation-btns">', '<button class="btn-flat datepicker-today waves-effect" type="button"></button>', '<button class="btn-flat datepicker-done waves-effect" type="button"></button>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
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('');
9288
9538
 
9289
9539
  M.Datepicker = Datepicker;
9290
9540
 
@@ -9303,13 +9553,14 @@ $jscomp.polyfill = function (e, r, p, m) {
9303
9553
  duration: 350,
9304
9554
  container: null,
9305
9555
  defaultTime: 'now', // default time, 'now' or '13:14' e.g.
9306
- fromnow: 0, // Millisecond offset from the defaultTime
9556
+ fromNow: 0, // Millisecond offset from the defaultTime
9557
+ showClearBtn: false,
9307
9558
 
9308
9559
  // internationalization
9309
9560
  i18n: {
9310
- done: 'Ok',
9561
+ cancel: 'Cancel',
9311
9562
  clear: 'Clear',
9312
- cancel: 'Cancel'
9563
+ done: 'Ok'
9313
9564
  },
9314
9565
 
9315
9566
  autoClose: false, // auto close when minute is selected
@@ -9328,21 +9579,21 @@ $jscomp.polyfill = function (e, r, p, m) {
9328
9579
  function Timepicker(el, options) {
9329
9580
  _classCallCheck(this, Timepicker);
9330
9581
 
9331
- var _this54 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options));
9582
+ var _this56 = _possibleConstructorReturn(this, (Timepicker.__proto__ || Object.getPrototypeOf(Timepicker)).call(this, Timepicker, el, options));
9332
9583
 
9333
- _this54.el.M_Timepicker = _this54;
9584
+ _this56.el.M_Timepicker = _this56;
9334
9585
 
9335
- _this54.options = $.extend({}, Timepicker.defaults, options);
9586
+ _this56.options = $.extend({}, Timepicker.defaults, options);
9336
9587
 
9337
- _this54.id = M.guid();
9338
- _this54._insertHTMLIntoDOM();
9339
- _this54._setupModal();
9340
- _this54._setupVariables();
9341
- _this54._setupEventHandlers();
9588
+ _this56.id = M.guid();
9589
+ _this56._insertHTMLIntoDOM();
9590
+ _this56._setupModal();
9591
+ _this56._setupVariables();
9592
+ _this56._setupEventHandlers();
9342
9593
 
9343
- _this54._clockSetup();
9344
- _this54._pickerSetup();
9345
- return _this54;
9594
+ _this56._clockSetup();
9595
+ _this56._pickerSetup();
9596
+ return _this56;
9346
9597
  }
9347
9598
 
9348
9599
  _createClass(Timepicker, [{
@@ -9437,7 +9688,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9437
9688
  }, {
9438
9689
  key: "_handleDocumentClickEnd",
9439
9690
  value: function _handleDocumentClickEnd(e) {
9440
- var _this55 = this;
9691
+ var _this57 = this;
9441
9692
 
9442
9693
  e.preventDefault();
9443
9694
  document.removeEventListener('mouseup', this._handleDocumentClickEndBound);
@@ -9454,7 +9705,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9454
9705
  } else if (this.options.autoClose) {
9455
9706
  $(this.minutesView).addClass('timepicker-dial-out');
9456
9707
  setTimeout(function () {
9457
- _this55.done();
9708
+ _this57.done();
9458
9709
  }, this.options.duration / 2);
9459
9710
  }
9460
9711
 
@@ -9480,11 +9731,11 @@ $jscomp.polyfill = function (e, r, p, m) {
9480
9731
  }, {
9481
9732
  key: "_setupModal",
9482
9733
  value: function _setupModal() {
9483
- var _this56 = this;
9734
+ var _this58 = this;
9484
9735
 
9485
9736
  this.modal = M.Modal.init(this.modalEl, {
9486
9737
  onCloseEnd: function () {
9487
- _this56.isOpen = false;
9738
+ _this58.isOpen = false;
9488
9739
  }
9489
9740
  });
9490
9741
  }
@@ -9508,7 +9759,11 @@ $jscomp.polyfill = function (e, r, p, m) {
9508
9759
  }, {
9509
9760
  key: "_pickerSetup",
9510
9761
  value: function _pickerSetup() {
9511
- $('<button class="btn-flat timepicker-clear waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.clear + '</button>').appendTo(this.footer).on('click', this.clear.bind(this));
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));
9764
+ if (this.options.showClearBtn) {
9765
+ $clearBtn.css({ visibility: '' });
9766
+ }
9512
9767
 
9513
9768
  var confirmationBtnsContainer = $('<div class="confirmation-btns"></div>');
9514
9769
  $('<button class="btn-flat timepicker-close waves-effect" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.cancel + '</button>').appendTo(confirmationBtnsContainer).on('click', this.close.bind(this));
@@ -9644,7 +9899,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9644
9899
  value[1] = value[1].replace("AM", "").replace("PM", "");
9645
9900
  }
9646
9901
  if (value[0] === 'now') {
9647
- var now = new Date(+new Date() + this.options.fromnow);
9902
+ var now = new Date(+new Date() + this.options.fromNow);
9648
9903
  value = [now.getHours(), now.getMinutes()];
9649
9904
  if (this.options.twelveHour) {
9650
9905
  this.amOrPm = value[0] >= 12 && value[0] < 24 ? 'PM' : 'AM';
@@ -9710,7 +9965,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9710
9965
  }, {
9711
9966
  key: "setHand",
9712
9967
  value: function setHand(x, y, roundBy5) {
9713
- var _this57 = this;
9968
+ var _this59 = this;
9714
9969
 
9715
9970
  var radian = Math.atan2(x, -y),
9716
9971
  isHours = this.currentView === 'hours',
@@ -9765,7 +10020,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9765
10020
  if (!this.vibrateTimer) {
9766
10021
  navigator[this.vibrate](10);
9767
10022
  this.vibrateTimer = setTimeout(function () {
9768
- _this57.vibrateTimer = null;
10023
+ _this59.vibrateTimer = null;
9769
10024
  }, 100);
9770
10025
  }
9771
10026
  }
@@ -9929,20 +10184,20 @@ $jscomp.polyfill = function (e, r, p, m) {
9929
10184
  function CharacterCounter(el, options) {
9930
10185
  _classCallCheck(this, CharacterCounter);
9931
10186
 
9932
- var _this58 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options));
10187
+ var _this60 = _possibleConstructorReturn(this, (CharacterCounter.__proto__ || Object.getPrototypeOf(CharacterCounter)).call(this, CharacterCounter, el, options));
9933
10188
 
9934
- _this58.el.M_CharacterCounter = _this58;
10189
+ _this60.el.M_CharacterCounter = _this60;
9935
10190
 
9936
10191
  /**
9937
10192
  * Options for the character counter
9938
10193
  */
9939
- _this58.options = $.extend({}, CharacterCounter.defaults, options);
10194
+ _this60.options = $.extend({}, CharacterCounter.defaults, options);
9940
10195
 
9941
- _this58.isInvalid = false;
9942
- _this58.isValidLength = false;
9943
- _this58._setupCounter();
9944
- _this58._setupEventHandlers();
9945
- return _this58;
10196
+ _this60.isInvalid = false;
10197
+ _this60.isValidLength = false;
10198
+ _this60._setupCounter();
10199
+ _this60._setupEventHandlers();
10200
+ return _this60;
9946
10201
  }
9947
10202
 
9948
10203
  _createClass(CharacterCounter, [{
@@ -10085,6 +10340,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10085
10340
  dist: -100, // zoom scale TODO: make this more intuitive as an option
10086
10341
  shift: 0, // spacing for center image
10087
10342
  padding: 0, // Padding between non center items
10343
+ numVisible: 5, // Number of visible items in carousel
10088
10344
  fullWidth: false, // Change to full width styles
10089
10345
  indicators: false, // Toggle indicators
10090
10346
  noWrap: false, // Don't wrap around and cycle through items.
@@ -10108,54 +10364,55 @@ $jscomp.polyfill = function (e, r, p, m) {
10108
10364
  function Carousel(el, options) {
10109
10365
  _classCallCheck(this, Carousel);
10110
10366
 
10111
- var _this59 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options));
10367
+ var _this61 = _possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, Carousel, el, options));
10112
10368
 
10113
- _this59.el.M_Carousel = _this59;
10369
+ _this61.el.M_Carousel = _this61;
10114
10370
 
10115
10371
  /**
10116
10372
  * Options for the carousel
10117
10373
  * @member Carousel#options
10118
10374
  * @prop {Number} duration
10119
10375
  * @prop {Number} dist
10120
- * @prop {number} shift
10121
- * @prop {number} padding
10376
+ * @prop {Number} shift
10377
+ * @prop {Number} padding
10378
+ * @prop {Number} numVisible
10122
10379
  * @prop {Boolean} fullWidth
10123
10380
  * @prop {Boolean} indicators
10124
10381
  * @prop {Boolean} noWrap
10125
10382
  * @prop {Function} onCycleTo
10126
10383
  */
10127
- _this59.options = $.extend({}, Carousel.defaults, options);
10384
+ _this61.options = $.extend({}, Carousel.defaults, options);
10128
10385
 
10129
10386
  // Setup
10130
- _this59.hasMultipleSlides = _this59.$el.find('.carousel-item').length > 1;
10131
- _this59.showIndicators = _this59.options.indicators && _this59.hasMultipleSlides;
10132
- _this59.noWrap = _this59.options.noWrap || !_this59.hasMultipleSlides;
10133
- _this59.pressed = false;
10134
- _this59.dragged = false;
10135
- _this59.offset = _this59.target = 0;
10136
- _this59.images = [];
10137
- _this59.itemWidth = _this59.$el.find('.carousel-item').first().innerWidth();
10138
- _this59.itemHeight = _this59.$el.find('.carousel-item').first().innerHeight();
10139
- _this59.dim = _this59.itemWidth * 2 + _this59.options.padding || 1; // Make sure dim is non zero for divisions.
10140
- _this59._autoScrollBound = _this59._autoScroll.bind(_this59);
10141
- _this59._trackBound = _this59._track.bind(_this59);
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);
10142
10399
 
10143
10400
  // Full Width carousel setup
10144
- if (_this59.options.fullWidth) {
10145
- _this59.options.dist = 0;
10146
- _this59._setCarouselHeight();
10401
+ if (_this61.options.fullWidth) {
10402
+ _this61.options.dist = 0;
10403
+ _this61._setCarouselHeight();
10147
10404
 
10148
10405
  // Offset fixed items when indicators.
10149
- if (_this59.showIndicators) {
10150
- _this59.$el.find('.carousel-fixed-item').addClass('with-indicators');
10406
+ if (_this61.showIndicators) {
10407
+ _this61.$el.find('.carousel-fixed-item').addClass('with-indicators');
10151
10408
  }
10152
10409
  }
10153
10410
 
10154
10411
  // Iterate through slides
10155
- _this59.$indicators = $('<ul class="indicators"></ul>');
10156
- _this59.$el.find('.carousel-item').each(function (el, i) {
10157
- _this59.images.push(el);
10158
- if (_this59.showIndicators) {
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) {
10159
10416
  var $indicator = $('<li class="indicator-item"></li>');
10160
10417
 
10161
10418
  // Add active to first by default.
@@ -10163,28 +10420,31 @@ $jscomp.polyfill = function (e, r, p, m) {
10163
10420
  $indicator[0].classList.add('active');
10164
10421
  }
10165
10422
 
10166
- _this59.$indicators.append($indicator);
10423
+ _this61.$indicators.append($indicator);
10167
10424
  }
10168
10425
  });
10169
- if (_this59.showIndicators) {
10170
- _this59.$el.append(_this59.$indicators);
10426
+ if (_this61.showIndicators) {
10427
+ _this61.$el.append(_this61.$indicators);
10171
10428
  }
10172
- _this59.count = _this59.images.length;
10429
+ _this61.count = _this61.images.length;
10430
+
10431
+ // Cap numVisible at count
10432
+ _this61.options.numVisible = Math.min(_this61.count, _this61.options.numVisible);
10173
10433
 
10174
10434
  // Setup cross browser string
10175
- _this59.xform = 'transform';
10435
+ _this61.xform = 'transform';
10176
10436
  ['webkit', 'Moz', 'O', 'ms'].every(function (prefix) {
10177
10437
  var e = prefix + 'Transform';
10178
10438
  if (typeof document.body.style[e] !== 'undefined') {
10179
- _this59.xform = e;
10439
+ _this61.xform = e;
10180
10440
  return false;
10181
10441
  }
10182
10442
  return true;
10183
10443
  });
10184
10444
 
10185
- _this59._setupEventHandlers();
10186
- _this59._scroll(_this59.offset);
10187
- return _this59;
10445
+ _this61._setupEventHandlers();
10446
+ _this61._scroll(_this61.offset);
10447
+ return _this61;
10188
10448
  }
10189
10449
 
10190
10450
  _createClass(Carousel, [{
@@ -10206,7 +10466,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10206
10466
  }, {
10207
10467
  key: "_setupEventHandlers",
10208
10468
  value: function _setupEventHandlers() {
10209
- var _this60 = this;
10469
+ var _this62 = this;
10210
10470
 
10211
10471
  this._handleCarouselTapBound = this._handleCarouselTap.bind(this);
10212
10472
  this._handleCarouselDragBound = this._handleCarouselDrag.bind(this);
@@ -10228,7 +10488,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10228
10488
  if (this.showIndicators && this.$indicators) {
10229
10489
  this._handleIndicatorClickBound = this._handleIndicatorClick.bind(this);
10230
10490
  this.$indicators.find('.indicator-item').each(function (el, i) {
10231
- el.addEventListener('click', _this60._handleIndicatorClickBound);
10491
+ el.addEventListener('click', _this62._handleIndicatorClickBound);
10232
10492
  });
10233
10493
  }
10234
10494
 
@@ -10246,7 +10506,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10246
10506
  }, {
10247
10507
  key: "_removeEventHandlers",
10248
10508
  value: function _removeEventHandlers() {
10249
- var _this61 = this;
10509
+ var _this63 = this;
10250
10510
 
10251
10511
  if (typeof window.ontouchstart !== 'undefined') {
10252
10512
  this.el.removeEventListener('touchstart', this._handleCarouselTapBound);
@@ -10261,7 +10521,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10261
10521
 
10262
10522
  if (this.showIndicators && this.$indicators) {
10263
10523
  this.$indicators.find('.indicator-item').each(function (el, i) {
10264
- el.removeEventListener('click', _this61._handleIndicatorClickBound);
10524
+ el.removeEventListener('click', _this63._handleIndicatorClickBound);
10265
10525
  });
10266
10526
  }
10267
10527
 
@@ -10447,7 +10707,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10447
10707
  }, {
10448
10708
  key: "_setCarouselHeight",
10449
10709
  value: function _setCarouselHeight(imageOnly) {
10450
- var _this62 = this;
10710
+ var _this64 = this;
10451
10711
 
10452
10712
  var firstSlide = this.$el.find('.carousel-item.active').length ? this.$el.find('.carousel-item.active').first() : this.$el.find('.carousel-item').first();
10453
10713
  var firstImage = firstSlide.find('img').first();
@@ -10467,7 +10727,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10467
10727
  } else {
10468
10728
  // Get height when image is loaded normally
10469
10729
  firstImage.one('load', function (el, i) {
10470
- _this62.$el.css('height', el.offsetHeight + 'px');
10730
+ _this64.$el.css('height', el.offsetHeight + 'px');
10471
10731
  });
10472
10732
  }
10473
10733
  } else if (!imageOnly) {
@@ -10573,7 +10833,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10573
10833
  }, {
10574
10834
  key: "_scroll",
10575
10835
  value: function _scroll(x) {
10576
- var _this63 = this;
10836
+ var _this65 = this;
10577
10837
 
10578
10838
  // Track scrolling state
10579
10839
  if (!this.$el.hasClass('scrolling')) {
@@ -10583,7 +10843,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10583
10843
  window.clearTimeout(this.scrollingTimeout);
10584
10844
  }
10585
10845
  this.scrollingTimeout = window.setTimeout(function () {
10586
- _this63.$el.removeClass('scrolling');
10846
+ _this65.$el.removeClass('scrolling');
10587
10847
  }, this.options.duration);
10588
10848
 
10589
10849
  // Start actual scroll
@@ -10595,8 +10855,10 @@ $jscomp.polyfill = function (e, r, p, m) {
10595
10855
  el = void 0,
10596
10856
  alignment = void 0,
10597
10857
  zTranslation = void 0,
10598
- tweenedOpacity = void 0;
10858
+ tweenedOpacity = void 0,
10859
+ centerTweenedOpacity = void 0;
10599
10860
  var lastCenter = this.center;
10861
+ var numVisibleOffset = 1 / this.options.numVisible;
10600
10862
 
10601
10863
  this.offset = typeof x === 'number' ? x : this.offset;
10602
10864
  this.center = Math.floor((this.offset + this.dim / 2) / this.dim);
@@ -10605,11 +10867,13 @@ $jscomp.polyfill = function (e, r, p, m) {
10605
10867
  tween = -dir * delta * 2 / this.dim;
10606
10868
  half = this.count >> 1;
10607
10869
 
10608
- if (!this.options.fullWidth) {
10870
+ if (this.options.fullWidth) {
10871
+ alignment = 'translateX(0)';
10872
+ centerTweenedOpacity = 1;
10873
+ } else {
10609
10874
  alignment = 'translateX(' + (this.el.clientWidth - this.itemWidth) / 2 + 'px) ';
10610
10875
  alignment += 'translateY(' + (this.el.clientHeight - this.itemHeight) / 2 + 'px)';
10611
- } else {
10612
- alignment = 'translateX(0)';
10876
+ centerTweenedOpacity = 1 - numVisibleOffset * tween;
10613
10877
  }
10614
10878
 
10615
10879
  // Set indicator active
@@ -10632,15 +10896,8 @@ $jscomp.polyfill = function (e, r, p, m) {
10632
10896
  this.$el.find('.carousel-item').removeClass('active');
10633
10897
  el.classList.add('active');
10634
10898
  }
10635
- el.style[this.xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
10636
- el.style.zIndex = 0;
10637
- if (this.options.fullWidth) {
10638
- tweenedOpacity = 1;
10639
- } else {
10640
- tweenedOpacity = 1 - 0.2 * tween;
10641
- }
10642
- el.style.opacity = tweenedOpacity;
10643
- el.style.visibility = 'visible';
10899
+ var transformString = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
10900
+ this._updateItemStyle(el, centerTweenedOpacity, 0, transformString);
10644
10901
  }
10645
10902
 
10646
10903
  for (i = 1; i <= half; ++i) {
@@ -10650,15 +10907,13 @@ $jscomp.polyfill = function (e, r, p, m) {
10650
10907
  tweenedOpacity = i === half && delta < 0 ? 1 - tween : 1;
10651
10908
  } else {
10652
10909
  zTranslation = this.options.dist * (i * 2 + tween * dir);
10653
- tweenedOpacity = 1 - 0.2 * (i * 2 + tween * dir);
10910
+ tweenedOpacity = 1 - numVisibleOffset * (i * 2 + tween * dir);
10654
10911
  }
10655
10912
  // Don't show wrapped items.
10656
10913
  if (!this.noWrap || this.center + i < this.count) {
10657
10914
  el = this.images[this._wrap(this.center + i)];
10658
- el.style[this.xform] = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
10659
- el.style.zIndex = -i;
10660
- el.style.opacity = tweenedOpacity;
10661
- el.style.visibility = 'visible';
10915
+ var _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
10916
+ this._updateItemStyle(el, tweenedOpacity, -i, _transformString);
10662
10917
  }
10663
10918
 
10664
10919
  // left side
@@ -10667,15 +10922,13 @@ $jscomp.polyfill = function (e, r, p, m) {
10667
10922
  tweenedOpacity = i === half && delta > 0 ? 1 - tween : 1;
10668
10923
  } else {
10669
10924
  zTranslation = this.options.dist * (i * 2 - tween * dir);
10670
- tweenedOpacity = 1 - 0.2 * (i * 2 - tween * dir);
10925
+ tweenedOpacity = 1 - numVisibleOffset * (i * 2 - tween * dir);
10671
10926
  }
10672
10927
  // Don't show wrapped items.
10673
10928
  if (!this.noWrap || this.center - i >= 0) {
10674
10929
  el = this.images[this._wrap(this.center - i)];
10675
- el.style[this.xform] = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
10676
- el.style.zIndex = -i;
10677
- el.style.opacity = tweenedOpacity;
10678
- el.style.visibility = 'visible';
10930
+ var _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
10931
+ this._updateItemStyle(el, tweenedOpacity, -i, _transformString2);
10679
10932
  }
10680
10933
  }
10681
10934
 
@@ -10683,15 +10936,8 @@ $jscomp.polyfill = function (e, r, p, m) {
10683
10936
  // Don't show wrapped items.
10684
10937
  if (!this.noWrap || this.center >= 0 && this.center < this.count) {
10685
10938
  el = this.images[this._wrap(this.center)];
10686
- el.style[this.xform] = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
10687
- el.style.zIndex = 0;
10688
- if (this.options.fullWidth) {
10689
- tweenedOpacity = 1;
10690
- } else {
10691
- tweenedOpacity = 1 - 0.2 * tween;
10692
- }
10693
- el.style.opacity = tweenedOpacity;
10694
- el.style.visibility = 'visible';
10939
+ var _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
10940
+ this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3);
10695
10941
  }
10696
10942
 
10697
10943
  // onCycleTo callback
@@ -10707,6 +10953,23 @@ $jscomp.polyfill = function (e, r, p, m) {
10707
10953
  }
10708
10954
  }
10709
10955
 
10956
+ /**
10957
+ * Cycle to target
10958
+ * @param {Element} el
10959
+ * @param {Number} opacity
10960
+ * @param {Number} zIndex
10961
+ * @param {String} transform
10962
+ */
10963
+
10964
+ }, {
10965
+ key: "_updateItemStyle",
10966
+ value: function _updateItemStyle(el, opacity, zIndex, transform) {
10967
+ el.style[this.xform] = transform;
10968
+ el.style.zIndex = zIndex;
10969
+ el.style.opacity = opacity;
10970
+ el.style.visibility = 'visible';
10971
+ }
10972
+
10710
10973
  /**
10711
10974
  * Cycle to target
10712
10975
  * @param {Number} n
@@ -10869,42 +11132,42 @@ $jscomp.polyfill = function (e, r, p, m) {
10869
11132
  *
10870
11133
  */
10871
11134
 
10872
- var FeatureDiscovery = function (_Component19) {
10873
- _inherits(FeatureDiscovery, _Component19);
11135
+ var TapTarget = function (_Component19) {
11136
+ _inherits(TapTarget, _Component19);
10874
11137
 
10875
11138
  /**
10876
- * Construct FeatureDiscovery instance
11139
+ * Construct TapTarget instance
10877
11140
  * @constructor
10878
11141
  * @param {Element} el
10879
11142
  * @param {Object} options
10880
11143
  */
10881
- function FeatureDiscovery(el, options) {
10882
- _classCallCheck(this, FeatureDiscovery);
11144
+ function TapTarget(el, options) {
11145
+ _classCallCheck(this, TapTarget);
10883
11146
 
10884
- var _this64 = _possibleConstructorReturn(this, (FeatureDiscovery.__proto__ || Object.getPrototypeOf(FeatureDiscovery)).call(this, FeatureDiscovery, el, options));
11147
+ var _this66 = _possibleConstructorReturn(this, (TapTarget.__proto__ || Object.getPrototypeOf(TapTarget)).call(this, TapTarget, el, options));
10885
11148
 
10886
- _this64.el.M_FeatureDiscovery = _this64;
11149
+ _this66.el.M_TapTarget = _this66;
10887
11150
 
10888
11151
  /**
10889
11152
  * Options for the select
10890
- * @member FeatureDiscovery#options
11153
+ * @member TapTarget#options
10891
11154
  * @prop {Function} onOpen - Callback function called when feature discovery is opened
10892
11155
  * @prop {Function} onClose - Callback function called when feature discovery is closed
10893
11156
  */
10894
- _this64.options = $.extend({}, FeatureDiscovery.defaults, options);
11157
+ _this66.options = $.extend({}, TapTarget.defaults, options);
10895
11158
 
10896
- _this64.isOpen = false;
11159
+ _this66.isOpen = false;
10897
11160
 
10898
11161
  // setup
10899
- _this64.$origin = $('#' + _this64.$el.attr('data-target'));
10900
- _this64._setup();
11162
+ _this66.$origin = $('#' + _this66.$el.attr('data-target'));
11163
+ _this66._setup();
10901
11164
 
10902
- _this64._calculatePositioning();
10903
- _this64._setupEventHandlers();
10904
- return _this64;
11165
+ _this66._calculatePositioning();
11166
+ _this66._setupEventHandlers();
11167
+ return _this66;
10905
11168
  }
10906
11169
 
10907
- _createClass(FeatureDiscovery, [{
11170
+ _createClass(TapTarget, [{
10908
11171
  key: "destroy",
10909
11172
 
10910
11173
 
@@ -10913,7 +11176,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10913
11176
  */
10914
11177
  value: function destroy() {
10915
11178
  this._removeEventHandlers();
10916
- this.el.FeatureDiscovery = undefined;
11179
+ this.el.TapTarget = undefined;
10917
11180
  }
10918
11181
 
10919
11182
  /**
@@ -10998,7 +11261,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10998
11261
  }
10999
11262
 
11000
11263
  /**
11001
- * Setup feature discovery
11264
+ * Setup Tap Target
11002
11265
  */
11003
11266
 
11004
11267
  }, {
@@ -11134,7 +11397,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11134
11397
  }
11135
11398
 
11136
11399
  /**
11137
- * Open Feature Discovery
11400
+ * Open TapTarget
11138
11401
  */
11139
11402
 
11140
11403
  }, {
@@ -11157,7 +11420,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11157
11420
  }
11158
11421
 
11159
11422
  /**
11160
- * Close Feature Discovery
11423
+ * Close Tap Target
11161
11424
  */
11162
11425
 
11163
11426
  }, {
@@ -11181,7 +11444,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11181
11444
  }], [{
11182
11445
  key: "init",
11183
11446
  value: function init(els, options) {
11184
- return _get(FeatureDiscovery.__proto__ || Object.getPrototypeOf(FeatureDiscovery), "init", this).call(this, this, els, options);
11447
+ return _get(TapTarget.__proto__ || Object.getPrototypeOf(TapTarget), "init", this).call(this, this, els, options);
11185
11448
  }
11186
11449
 
11187
11450
  /**
@@ -11192,7 +11455,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11192
11455
  key: "getInstance",
11193
11456
  value: function getInstance(el) {
11194
11457
  var domElem = !!el.jquery ? el[0] : el;
11195
- return domElem.M_FeatureDiscovery;
11458
+ return domElem.M_TapTarget;
11196
11459
  }
11197
11460
  }, {
11198
11461
  key: "defaults",
@@ -11201,13 +11464,13 @@ $jscomp.polyfill = function (e, r, p, m) {
11201
11464
  }
11202
11465
  }]);
11203
11466
 
11204
- return FeatureDiscovery;
11467
+ return TapTarget;
11205
11468
  }(Component);
11206
11469
 
11207
- M.FeatureDiscovery = FeatureDiscovery;
11470
+ M.TapTarget = TapTarget;
11208
11471
 
11209
11472
  if (M.jQueryLoaded) {
11210
- M.initializeJqueryWrapper(FeatureDiscovery, 'featureDiscovery', 'M_FeatureDiscovery');
11473
+ M.initializeJqueryWrapper(TapTarget, 'tapTarget', 'M_TapTarget');
11211
11474
  }
11212
11475
  })(cash);
11213
11476
  ;(function ($) {
@@ -11236,30 +11499,30 @@ $jscomp.polyfill = function (e, r, p, m) {
11236
11499
  _classCallCheck(this, FormSelect);
11237
11500
 
11238
11501
  // Don't init if browser default version
11239
- var _this65 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options));
11502
+ var _this67 = _possibleConstructorReturn(this, (FormSelect.__proto__ || Object.getPrototypeOf(FormSelect)).call(this, FormSelect, el, options));
11240
11503
 
11241
- if (_this65.$el.hasClass('browser-default')) {
11242
- return _possibleConstructorReturn(_this65);
11504
+ if (_this67.$el.hasClass('browser-default')) {
11505
+ return _possibleConstructorReturn(_this67);
11243
11506
  }
11244
11507
 
11245
- _this65.el.M_FormSelect = _this65;
11508
+ _this67.el.M_FormSelect = _this67;
11246
11509
 
11247
11510
  /**
11248
11511
  * Options for the select
11249
11512
  * @member FormSelect#options
11250
11513
  */
11251
- _this65.options = $.extend({}, FormSelect.defaults, options);
11514
+ _this67.options = $.extend({}, FormSelect.defaults, options);
11252
11515
 
11253
- _this65.isMultiple = _this65.$el.prop('multiple');
11516
+ _this67.isMultiple = _this67.$el.prop('multiple');
11254
11517
 
11255
11518
  // Setup
11256
- _this65.el.tabIndex = -1;
11257
- _this65._keysSelected = {};
11258
- _this65._valueDict = {}; // Maps key to original and generated option element.
11259
- _this65._setupDropdown();
11519
+ _this67.el.tabIndex = -1;
11520
+ _this67._keysSelected = {};
11521
+ _this67._valueDict = {}; // Maps key to original and generated option element.
11522
+ _this67._setupDropdown();
11260
11523
 
11261
- _this65._setupEventHandlers();
11262
- return _this65;
11524
+ _this67._setupEventHandlers();
11525
+ return _this67;
11263
11526
  }
11264
11527
 
11265
11528
  _createClass(FormSelect, [{
@@ -11282,14 +11545,14 @@ $jscomp.polyfill = function (e, r, p, m) {
11282
11545
  }, {
11283
11546
  key: "_setupEventHandlers",
11284
11547
  value: function _setupEventHandlers() {
11285
- var _this66 = this;
11548
+ var _this68 = this;
11286
11549
 
11287
11550
  this._handleSelectChangeBound = this._handleSelectChange.bind(this);
11288
11551
  this._handleOptionClickBound = this._handleOptionClick.bind(this);
11289
11552
  this._handleInputClickBound = this._handleInputClick.bind(this);
11290
11553
 
11291
11554
  $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) {
11292
- el.addEventListener('click', _this66._handleOptionClickBound);
11555
+ el.addEventListener('click', _this68._handleOptionClickBound);
11293
11556
  });
11294
11557
  this.el.addEventListener('change', this._handleSelectChangeBound);
11295
11558
  this.input.addEventListener('click', this._handleInputClickBound);
@@ -11302,10 +11565,10 @@ $jscomp.polyfill = function (e, r, p, m) {
11302
11565
  }, {
11303
11566
  key: "_removeEventHandlers",
11304
11567
  value: function _removeEventHandlers() {
11305
- var _this67 = this;
11568
+ var _this69 = this;
11306
11569
 
11307
11570
  $(this.dropdownOptions).find('li:not(.optgroup)').each(function (el) {
11308
- el.removeEventListener('click', _this67._handleOptionClickBound);
11571
+ el.removeEventListener('click', _this69._handleOptionClickBound);
11309
11572
  });
11310
11573
  this.el.removeEventListener('change', this._handleSelectChangeBound);
11311
11574
  this.input.removeEventListener('click', this._handleInputClickBound);
@@ -11382,7 +11645,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11382
11645
  }, {
11383
11646
  key: "_setupDropdown",
11384
11647
  value: function _setupDropdown() {
11385
- var _this68 = this;
11648
+ var _this70 = this;
11386
11649
 
11387
11650
  this.wrapper = document.createElement('div');
11388
11651
  $(this.wrapper).addClass('select-wrapper' + ' ' + this.options.classes);
@@ -11405,21 +11668,21 @@ $jscomp.polyfill = function (e, r, p, m) {
11405
11668
  if ($(el).is('option')) {
11406
11669
  // Direct descendant option.
11407
11670
  var optionEl = void 0;
11408
- if (_this68.isMultiple) {
11409
- optionEl = _this68._appendOptionWithIcon(_this68.$el, el, 'multiple');
11671
+ if (_this70.isMultiple) {
11672
+ optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'multiple');
11410
11673
  } else {
11411
- optionEl = _this68._appendOptionWithIcon(_this68.$el, el);
11674
+ optionEl = _this70._appendOptionWithIcon(_this70.$el, el);
11412
11675
  }
11413
11676
 
11414
- _this68._addOptionToValueDict(el, optionEl);
11677
+ _this70._addOptionToValueDict(el, optionEl);
11415
11678
  } else if ($(el).is('optgroup')) {
11416
11679
  // Optgroup.
11417
11680
  var selectOptions = $(el).children('option');
11418
- $(_this68.dropdownOptions).append($('<li class="optgroup"><span>' + el.getAttribute('label') + '</span></li>')[0]);
11681
+ $(_this70.dropdownOptions).append($('<li class="optgroup"><span>' + el.getAttribute('label') + '</span></li>')[0]);
11419
11682
 
11420
11683
  selectOptions.each(function (el) {
11421
- var optionEl = _this68._appendOptionWithIcon(_this68.$el, el, 'optgroup-option');
11422
- _this68._addOptionToValueDict(el, optionEl);
11684
+ var optionEl = _this70._appendOptionWithIcon(_this70.$el, el, 'optgroup-option');
11685
+ _this70._addOptionToValueDict(el, optionEl);
11423
11686
  });
11424
11687
  }
11425
11688
  });
@@ -11448,6 +11711,16 @@ $jscomp.polyfill = function (e, r, p, m) {
11448
11711
  if (!this.el.disabled) {
11449
11712
  var dropdownOptions = $.extend({}, this.options.dropdownOptions);
11450
11713
 
11714
+ // Add callback for centering selected option when dropdown content is scrollable
11715
+ 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;
11721
+ }
11722
+ };
11723
+
11451
11724
  if (this.isMultiple) {
11452
11725
  dropdownOptions.closeOnClick = false;
11453
11726
  }
@@ -11685,23 +11958,23 @@ $jscomp.polyfill = function (e, r, p, m) {
11685
11958
  function Range(el, options) {
11686
11959
  _classCallCheck(this, Range);
11687
11960
 
11688
- var _this69 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
11961
+ var _this71 = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this, Range, el, options));
11689
11962
 
11690
- _this69.el.M_Range = _this69;
11963
+ _this71.el.M_Range = _this71;
11691
11964
 
11692
11965
  /**
11693
11966
  * Options for the range
11694
11967
  * @member Range#options
11695
11968
  */
11696
- _this69.options = $.extend({}, Range.defaults, options);
11969
+ _this71.options = $.extend({}, Range.defaults, options);
11697
11970
 
11698
- _this69._mousedown = false;
11971
+ _this71._mousedown = false;
11699
11972
 
11700
11973
  // Setup
11701
- _this69._setupThumb();
11974
+ _this71._setupThumb();
11702
11975
 
11703
- _this69._setupEventHandlers();
11704
- return _this69;
11976
+ _this71._setupEventHandlers();
11977
+ return _this71;
11705
11978
  }
11706
11979
 
11707
11980
  _createClass(Range, [{