materialize-sass 1.0.0.beta → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/assets/javascripts/materialize.js +277 -195
  4. data/assets/javascripts/materialize/autocomplete.js +94 -37
  5. data/assets/javascripts/materialize/buttons.js +4 -6
  6. data/assets/javascripts/materialize/carousel.js +7 -7
  7. data/assets/javascripts/materialize/collapsible.js +0 -2
  8. data/assets/javascripts/materialize/datepicker.js +27 -44
  9. data/assets/javascripts/materialize/dropdown.js +29 -9
  10. data/assets/javascripts/materialize/extras/nouislider.js +1 -1
  11. data/assets/javascripts/materialize/extras/nouislider.min.js +1 -1
  12. data/assets/javascripts/materialize/forms.js +4 -4
  13. data/assets/javascripts/materialize/global.js +26 -11
  14. data/assets/javascripts/materialize/materialbox.js +6 -6
  15. data/assets/javascripts/materialize/modal.js +8 -4
  16. data/assets/javascripts/materialize/parallax.js +1 -1
  17. data/assets/javascripts/materialize/range.js +2 -19
  18. data/assets/javascripts/materialize/select.js +22 -23
  19. data/assets/javascripts/materialize/sidenav.js +3 -2
  20. data/assets/javascripts/materialize/slider.js +2 -1
  21. data/assets/javascripts/materialize/tabs.js +3 -3
  22. data/assets/javascripts/materialize/timepicker.js +22 -5
  23. data/assets/javascripts/materialize/toasts.js +4 -3
  24. data/assets/javascripts/materialize/tooltip.js +8 -3
  25. data/assets/stylesheets/materialize/components/_buttons.scss +2 -1
  26. data/assets/stylesheets/materialize/components/_collapsible.scss +7 -0
  27. data/assets/stylesheets/materialize/components/_datepicker.scss +4 -0
  28. data/assets/stylesheets/materialize/components/_dropdown.scss +10 -1
  29. data/assets/stylesheets/materialize/components/_sidenav.scss +1 -1
  30. data/assets/stylesheets/materialize/components/_toast.scss +0 -1
  31. data/assets/stylesheets/materialize/components/_variables.scss +1 -0
  32. data/assets/stylesheets/materialize/components/forms/_input-fields.scss +2 -0
  33. data/assets/stylesheets/materialize/components/forms/_range.scss +3 -3
  34. data/assets/stylesheets/materialize/components/forms/_select.scss +6 -4
  35. data/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  36. data/lib/materialize-sass/version.rb +1 -1
  37. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4755204505bc3a5591234d26b238680d84484c3f938769b3f91facb5a5d07271
4
- data.tar.gz: 9d78d633753c4a7dc26a2f263de490b25eae9219e00612bd27d9dd96c1230641
3
+ metadata.gz: d2f028d178b727d59bf1b30ffe7f4aaa9cf28c083b4d5a65e4271f2cd39bba78
4
+ data.tar.gz: 15a84af3a0bc12ca766d90141cc77e35c935a6caaf4b8f35b1076c3b0db7d2af
5
5
  SHA512:
6
- metadata.gz: 2bce13964ed4bc9135583c28101ca1f1b97982a7bb1453bdcb9e056cc8bc4d69c32f28da44060387af99cfef922e536635b913e3d900b183be2258233284ceee
7
- data.tar.gz: 455515535558551160a31c826d2fdec6c768b50ff59ee59cfc8e928d3eeb2ebeb17ac263d2f1eac739e61bea5f8e3ad73f9cace339b11344df1cbf1b9ee938a1
6
+ metadata.gz: 9bfad0988ccca8ca7701937f35fe38b391241662cd07b14cb6072762dd5f4b3ba37ee95d27228301dfe0f493017fc843a583c6313d3c4aaccabd81f93a1f8eee
7
+ data.tar.gz: 29b7c9502085cb82b4a1fe7d52348be6a3080de98374c1480fbdffa90161c21b1ee9f0145a4e5a63c899b4918cc1b8f3785b3fe646ce9cc75e9a9fd0471d80e4
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.beta
10
+ This master branch now v1.0.0.rc1
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.beta'
19
+ gem 'materialize-sass', '~> 1.0.0.rc1'
20
20
  ```
21
21
 
22
22
 
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Materialize v1.0.0-beta (http://materializecss.com)
2
+ * Materialize v1.0.0-rc.1 (http://materializecss.com)
3
3
  * Copyright 2014-2017 Materialize
4
4
  * MIT License (https://raw.githubusercontent.com/Dogfalo/materialize/master/LICENSE)
5
5
  */
@@ -1071,8 +1071,8 @@ var Component = function () {
1071
1071
  })(window);
1072
1072
 
1073
1073
  // AMD
1074
- if (typeof define === "function" && define.amd) {
1075
- define("M", [], function () {
1074
+ if (typeof define === 'function' && define.amd) {
1075
+ define('M', [], function () {
1076
1076
  return M;
1077
1077
  });
1078
1078
 
@@ -1096,18 +1096,31 @@ M.keys = {
1096
1096
  * TabPress Keydown handler
1097
1097
  */
1098
1098
  M.tabPressed = false;
1099
+ M.keyDown = false;
1099
1100
  var docHandleKeydown = function (e) {
1100
- if (e.which === M.keys.TAB) {
1101
+ M.keyDown = true;
1102
+ if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) {
1101
1103
  M.tabPressed = true;
1102
1104
  }
1103
1105
  };
1104
1106
  var docHandleKeyup = function (e) {
1105
- if (e.which === M.keys.TAB) {
1107
+ M.keyDown = false;
1108
+ if (e.which === M.keys.TAB || e.which === M.keys.ARROW_DOWN || e.which === M.keys.ARROW_UP) {
1106
1109
  M.tabPressed = false;
1107
1110
  }
1108
1111
  };
1109
- document.addEventListener('keydown', docHandleKeydown);
1110
- document.addEventListener('keyup', docHandleKeyup);
1112
+ var docHandleFocus = function (e) {
1113
+ if (M.keyDown) {
1114
+ document.body.classList.add('keyboard-focused');
1115
+ }
1116
+ };
1117
+ var docHandleBlur = function (e) {
1118
+ document.body.classList.remove('keyboard-focused');
1119
+ };
1120
+ document.addEventListener('keydown', docHandleKeydown, true);
1121
+ document.addEventListener('keyup', docHandleKeyup, true);
1122
+ document.addEventListener('focus', docHandleFocus, true);
1123
+ document.addEventListener('blur', docHandleBlur, true);
1111
1124
 
1112
1125
  /**
1113
1126
  * Initialize jQuery wrapper for plugin
@@ -1207,7 +1220,7 @@ M.guid = function () {
1207
1220
  * @returns {string}
1208
1221
  */
1209
1222
  M.escapeHash = function (hash) {
1210
- return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, "\\$1");
1223
+ return hash.replace(/(:|\.|\[|\]|,|=|\/)/g, '\\$1');
1211
1224
  };
1212
1225
 
1213
1226
  M.elementOrParentIsFixed = function (element) {
@@ -1215,7 +1228,7 @@ M.elementOrParentIsFixed = function (element) {
1215
1228
  var $checkElements = $element.add($element.parents());
1216
1229
  var isFixed = false;
1217
1230
  $checkElements.each(function () {
1218
- if ($(this).css("position") === "fixed") {
1231
+ if ($(this).css('position') === 'fixed') {
1219
1232
  isFixed = true;
1220
1233
  return false;
1221
1234
  }
@@ -1255,6 +1268,8 @@ M.checkWithinContainer = function (container, bounding, offset) {
1255
1268
  };
1256
1269
 
1257
1270
  var containerRect = container.getBoundingClientRect();
1271
+ // If body element is smaller than viewport, use viewport height instead.
1272
+ var containerBottom = container === document.body ? Math.max(containerRect.bottom, window.innerHeight) : containerRect.bottom;
1258
1273
 
1259
1274
  var scrollLeft = container.scrollLeft;
1260
1275
  var scrollTop = container.scrollTop;
@@ -1275,7 +1290,7 @@ M.checkWithinContainer = function (container, bounding, offset) {
1275
1290
  edges.top = true;
1276
1291
  }
1277
1292
 
1278
- if (scrolledY + bounding.height > containerRect.bottom - offset || scrolledY + bounding.height > window.innerHeight - offset) {
1293
+ if (scrolledY + bounding.height > containerBottom - offset || scrolledY + bounding.height > window.innerHeight - offset) {
1279
1294
  edges.bottom = true;
1280
1295
  }
1281
1296
 
@@ -1358,7 +1373,7 @@ M.getIdFromTrigger = function (trigger) {
1358
1373
  if (id) {
1359
1374
  id = id.slice(1);
1360
1375
  } else {
1361
- id = "";
1376
+ id = '';
1362
1377
  }
1363
1378
  }
1364
1379
  return id;
@@ -2115,7 +2130,6 @@ $jscomp.polyfill = function (e, r, p, m) {
2115
2130
 
2116
2131
  var $collapsibleLi = this.$el.children('li').eq(index);
2117
2132
  if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) {
2118
-
2119
2133
  // onOpenStart callback
2120
2134
  if (typeof this.options.onOpenStart === 'function') {
2121
2135
  this.options.onOpenStart.call(this, $collapsibleLi[0]);
@@ -2147,7 +2161,6 @@ $jscomp.polyfill = function (e, r, p, m) {
2147
2161
  value: function close(index) {
2148
2162
  var $collapsibleLi = this.$el.children('li').eq(index);
2149
2163
  if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) {
2150
-
2151
2164
  // onCloseStart callback
2152
2165
  if (typeof this.options.onCloseStart === 'function') {
2153
2166
  this.options.onCloseStart.call(this, $collapsibleLi[0]);
@@ -2206,7 +2219,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2206
2219
  onOpenStart: null,
2207
2220
  onOpenEnd: null,
2208
2221
  onCloseStart: null,
2209
- onCloseEnd: null
2222
+ onCloseEnd: null,
2223
+ onItemClick: null
2210
2224
  };
2211
2225
 
2212
2226
  /**
@@ -2279,6 +2293,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2279
2293
  _this8._resetFilterQueryBound = _this8._resetFilterQuery.bind(_this8);
2280
2294
  _this8._handleDocumentClickBound = _this8._handleDocumentClick.bind(_this8);
2281
2295
  _this8._handleDocumentTouchmoveBound = _this8._handleDocumentTouchmove.bind(_this8);
2296
+ _this8._handleDropdownClickBound = _this8._handleDropdownClick.bind(_this8);
2282
2297
  _this8._handleDropdownKeydownBound = _this8._handleDropdownKeydown.bind(_this8);
2283
2298
  _this8._handleTriggerKeydownBound = _this8._handleTriggerKeydown.bind(_this8);
2284
2299
  _this8._setupEventHandlers();
@@ -2309,6 +2324,9 @@ $jscomp.polyfill = function (e, r, p, m) {
2309
2324
  // Trigger keydown handler
2310
2325
  this.el.addEventListener('keydown', this._handleTriggerKeydownBound);
2311
2326
 
2327
+ // Item click handler
2328
+ this.dropdownEl.addEventListener('click', this._handleDropdownClickBound);
2329
+
2312
2330
  // Hover event handlers
2313
2331
  if (this.options.hover) {
2314
2332
  this._handleMouseEnterBound = this._handleMouseEnter.bind(this);
@@ -2331,13 +2349,13 @@ $jscomp.polyfill = function (e, r, p, m) {
2331
2349
  }, {
2332
2350
  key: "_removeEventHandlers",
2333
2351
  value: function _removeEventHandlers() {
2334
- // Trigger keydown handler
2335
2352
  this.el.removeEventListener('keydown', this._handleTriggerKeydownBound);
2353
+ this.dropdownEl.removeEventListener('click', this._handleDropdownClickBound);
2336
2354
 
2337
2355
  if (this.options.hover) {
2338
- this.el.removeEventHandlers('mouseenter', this._handleMouseEnterBound);
2339
- this.el.removeEventHandlers('mouseleave', this._handleMouseLeaveBound);
2340
- this.dropdownEl.removeEventHandlers('mouseleave', this._handleMouseLeaveBound);
2356
+ this.el.removeEventListener('mouseenter', this._handleMouseEnterBound);
2357
+ this.el.removeEventListener('mouseleave', this._handleMouseLeaveBound);
2358
+ this.dropdownEl.removeEventListener('mouseleave', this._handleMouseLeaveBound);
2341
2359
  } else {
2342
2360
  this.el.removeEventListener('click', this._handleClickBound);
2343
2361
  }
@@ -2430,6 +2448,21 @@ $jscomp.polyfill = function (e, r, p, m) {
2430
2448
  }
2431
2449
  }
2432
2450
 
2451
+ /**
2452
+ * Handle Dropdown Click
2453
+ * @param {Event} e
2454
+ */
2455
+
2456
+ }, {
2457
+ key: "_handleDropdownClick",
2458
+ value: function _handleDropdownClick(e) {
2459
+ // onItemClick callback
2460
+ if (typeof this.options.onItemClick === 'function') {
2461
+ var itemEl = $(e.target).closest('li')[0];
2462
+ this.options.onItemClick.call(this, itemEl);
2463
+ }
2464
+ }
2465
+
2433
2466
  /**
2434
2467
  * Handle Dropdown Keydown
2435
2468
  * @param {Event} e
@@ -2637,8 +2670,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2637
2670
  value: [0, 1],
2638
2671
  easing: 'easeOutQuad'
2639
2672
  },
2640
- scaleX: [.3, 1],
2641
- scaleY: [.3, 1],
2673
+ scaleX: [0.3, 1],
2674
+ scaleY: [0.3, 1],
2642
2675
  duration: this.options.inDuration,
2643
2676
  easing: 'easeOutQuint',
2644
2677
  complete: function (anim) {
@@ -2671,8 +2704,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2671
2704
  value: 0,
2672
2705
  easing: 'easeOutQuint'
2673
2706
  },
2674
- scaleX: .3,
2675
- scaleY: .3,
2707
+ scaleX: 0.3,
2708
+ scaleY: 0.3,
2676
2709
  duration: this.options.outDuration,
2677
2710
  easing: 'easeOutQuint',
2678
2711
  complete: function (anim) {
@@ -2880,6 +2913,7 @@ $jscomp.polyfill = function (e, r, p, m) {
2880
2913
  _this12._openingTrigger = undefined;
2881
2914
  _this12.$overlay = $('<div class="modal-overlay"></div>');
2882
2915
  _this12.el.tabIndex = 0;
2916
+ _this12._nthModalOpened = 0;
2883
2917
 
2884
2918
  Modal._count++;
2885
2919
  _this12._setupEventHandlers();
@@ -2999,7 +3033,8 @@ $jscomp.polyfill = function (e, r, p, m) {
2999
3033
  }, {
3000
3034
  key: "_handleFocus",
3001
3035
  value: function _handleFocus(e) {
3002
- if (!this.el.contains(e.target)) {
3036
+ // Only trap focus if this modal is the last model opened (prevents loops in nested modals).
3037
+ if (!this.el.contains(e.target) && this._nthModalOpened === Modal._modalsOpen) {
3003
3038
  this.el.focus();
3004
3039
  }
3005
3040
  }
@@ -3057,8 +3092,8 @@ $jscomp.polyfill = function (e, r, p, m) {
3057
3092
  $.extend(enterAnimOptions, {
3058
3093
  top: [this.options.startingTop, this.options.endingTop],
3059
3094
  opacity: 1,
3060
- scaleX: [.8, 1],
3061
- scaleY: [.8, 1]
3095
+ scaleX: [0.8, 1],
3096
+ scaleY: [0.8, 1]
3062
3097
  });
3063
3098
  anim(enterAnimOptions);
3064
3099
  }
@@ -3132,6 +3167,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3132
3167
 
3133
3168
  this.isOpen = true;
3134
3169
  Modal._modalsOpen++;
3170
+ this._nthModalOpened = Modal._modalsOpen;
3135
3171
 
3136
3172
  // Set Z-Index based on number of currently open modals
3137
3173
  this.$overlay[0].style.zIndex = 1000 + Modal._modalsOpen * 2;
@@ -3182,6 +3218,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3182
3218
 
3183
3219
  this.isOpen = false;
3184
3220
  Modal._modalsOpen--;
3221
+ this._nthModalOpened = 0;
3185
3222
 
3186
3223
  // Call onCloseStart callback
3187
3224
  if (typeof this.options.onCloseStart === 'function') {
@@ -3197,7 +3234,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3197
3234
 
3198
3235
  if (this.options.dismissible) {
3199
3236
  document.removeEventListener('keydown', this._handleKeydownBound);
3200
- document.removeEventListener('focus', this._handleFocusBound);
3237
+ document.removeEventListener('focus', this._handleFocusBound, true);
3201
3238
  }
3202
3239
 
3203
3240
  anim.remove(this.el);
@@ -3302,7 +3339,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3302
3339
  _this15.originalWidth = 0;
3303
3340
  _this15.originalHeight = 0;
3304
3341
  _this15.originInlineStyles = _this15.$el.attr('style');
3305
- _this15.caption = _this15.el.getAttribute('data-caption') || "";
3342
+ _this15.caption = _this15.el.getAttribute('data-caption') || '';
3306
3343
 
3307
3344
  // Wrap
3308
3345
  _this15.$el.before(_this15.placeholder);
@@ -3527,7 +3564,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3527
3564
  value: function _updateVars() {
3528
3565
  this.windowWidth = window.innerWidth;
3529
3566
  this.windowHeight = window.innerHeight;
3530
- this.caption = this.el.getAttribute('data-caption') || "";
3567
+ this.caption = this.el.getAttribute('data-caption') || '';
3531
3568
  }
3532
3569
 
3533
3570
  /**
@@ -3616,14 +3653,14 @@ $jscomp.polyfill = function (e, r, p, m) {
3616
3653
  });
3617
3654
 
3618
3655
  // Add and animate caption if it exists
3619
- if (this.caption !== "") {
3656
+ if (this.caption !== '') {
3620
3657
  if (this.$photocaption) {
3621
3658
  anim.remove(this.$photoCaption[0]);
3622
3659
  }
3623
3660
  this.$photoCaption = $('<div class="materialbox-caption"></div>');
3624
3661
  this.$photoCaption.text(this.caption);
3625
3662
  $('body').append(this.$photoCaption);
3626
- this.$photoCaption.css({ "display": "inline" });
3663
+ this.$photoCaption.css({ display: 'inline' });
3627
3664
 
3628
3665
  anim({
3629
3666
  targets: this.$photoCaption[0],
@@ -3682,7 +3719,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3682
3719
  anim.remove(this.el);
3683
3720
  anim.remove(this.$overlay[0]);
3684
3721
 
3685
- if (this.caption !== "") {
3722
+ if (this.caption !== '') {
3686
3723
  anim.remove(this.$photoCaption[0]);
3687
3724
  }
3688
3725
 
@@ -3705,7 +3742,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3705
3742
  this._animateImageOut();
3706
3743
 
3707
3744
  // Remove Caption + reset css settings on image
3708
- if (this.caption !== "") {
3745
+ if (this.caption !== '') {
3709
3746
  anim({
3710
3747
  targets: this.$photoCaption[0],
3711
3748
  opacity: 0,
@@ -3777,7 +3814,7 @@ $jscomp.polyfill = function (e, r, p, m) {
3777
3814
  _this20.$img = _this20.$el.find('img').first();
3778
3815
  _this20.$img.each(function () {
3779
3816
  var el = this;
3780
- if (el.complete) $(el).trigger("load");
3817
+ if (el.complete) $(el).trigger('load');
3781
3818
  });
3782
3819
 
3783
3820
  _this20._updateParallax();
@@ -4054,7 +4091,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4054
4091
  }
4055
4092
 
4056
4093
  // Act as regular link if target attribute is specified.
4057
- if (!!tabLink.attr("target")) {
4094
+ if (!!tabLink.attr('target')) {
4058
4095
  return;
4059
4096
  }
4060
4097
 
@@ -4078,7 +4115,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4078
4115
  if (this.options.swipeable) {
4079
4116
  if (this._tabsCarousel) {
4080
4117
  this._tabsCarousel.set(this.index, function () {
4081
- if (typeof _this22.options.onShow === "function") {
4118
+ if (typeof _this22.options.onShow === 'function') {
4082
4119
  _this22.options.onShow.call(_this22, _this22.$content[0]);
4083
4120
  }
4084
4121
  });
@@ -4194,7 +4231,7 @@ $jscomp.polyfill = function (e, r, p, m) {
4194
4231
  _this24.$activeTabLink = _this24.$tabLinks.eq(_this24.index);
4195
4232
  _this24.$activeTabLink.addClass('active');
4196
4233
  _this24._animateIndicator(prevIndex);
4197
- if (typeof _this24.options.onShow === "function") {
4234
+ if (typeof _this24.options.onShow === 'function') {
4198
4235
  _this24.options.onShow.call(_this24, _this24.$content[0]);
4199
4236
  }
4200
4237
  }
@@ -4473,7 +4510,6 @@ $jscomp.polyfill = function (e, r, p, m) {
4473
4510
  if (this.isOpen) {
4474
4511
  return;
4475
4512
  }
4476
-
4477
4513
  this.isOpen = true;
4478
4514
  // Update tooltip content with HTML attribute options
4479
4515
  this.options = $.extend({}, this.options, this._getAttributeOptions());
@@ -4487,6 +4523,8 @@ $jscomp.polyfill = function (e, r, p, m) {
4487
4523
  return;
4488
4524
  }
4489
4525
 
4526
+ this.isHovered = false;
4527
+ this.isFocused = false;
4490
4528
  this.isOpen = false;
4491
4529
  this._setExitDelayTimeout();
4492
4530
  }
@@ -4640,19 +4678,23 @@ $jscomp.polyfill = function (e, r, p, m) {
4640
4678
  key: "_handleMouseEnter",
4641
4679
  value: function _handleMouseEnter() {
4642
4680
  this.isHovered = true;
4681
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
4643
4682
  this.open();
4644
4683
  }
4645
4684
  }, {
4646
4685
  key: "_handleMouseLeave",
4647
4686
  value: function _handleMouseLeave() {
4648
4687
  this.isHovered = false;
4688
+ this.isFocused = false; // Allows close of tooltip when opened by focus.
4649
4689
  this.close();
4650
4690
  }
4651
4691
  }, {
4652
4692
  key: "_handleFocus",
4653
4693
  value: function _handleFocus() {
4654
- this.isFocused = true;
4655
- this.open();
4694
+ if (M.tabPressed) {
4695
+ this.isFocused = true;
4696
+ this.open();
4697
+ }
4656
4698
  }
4657
4699
  }, {
4658
4700
  key: "_handleBlur",
@@ -5085,6 +5127,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5085
5127
  var toastElement = this._createToast();
5086
5128
  toastElement.M_Toast = this;
5087
5129
  this.el = toastElement;
5130
+ this.$el = $(toastElement);
5088
5131
  this._animateIn();
5089
5132
  this._setTimer();
5090
5133
  }
@@ -5135,7 +5178,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5135
5178
  targets: this.el,
5136
5179
  top: 0,
5137
5180
  opacity: 1,
5138
- duration: 300,
5181
+ duration: this.options.inDuration,
5139
5182
  easing: 'easeOutCubic'
5140
5183
  });
5141
5184
  }
@@ -5195,7 +5238,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5195
5238
  _this29.options.completeCallback();
5196
5239
  }
5197
5240
  // Remove toast from DOM
5198
- _this29.el.parentNode.removeChild(_this29.el);
5241
+ _this29.$el.remove();
5199
5242
  Toast._toasts.splice(Toast._toasts.indexOf(_this29), 1);
5200
5243
  if (Toast._toasts.length === 0) {
5201
5244
  Toast._removeContainer();
@@ -5249,7 +5292,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5249
5292
  document.removeEventListener('mousemove', Toast._onDragMove);
5250
5293
  document.removeEventListener('mouseup', Toast._onDragEnd);
5251
5294
 
5252
- Toast._container.parentNode.removeChild(Toast._container);
5295
+ $(Toast._container).remove();
5253
5296
  Toast._container = null;
5254
5297
  }
5255
5298
 
@@ -5485,6 +5528,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5485
5528
  this._overlay.parentNode.removeChild(this._overlay);
5486
5529
  this.dragTarget.parentNode.removeChild(this.dragTarget);
5487
5530
  this.el.M_Sidenav = undefined;
5531
+ this.el.style.transform = '';
5488
5532
 
5489
5533
  var index = Sidenav._sidenavs.indexOf(this);
5490
5534
  if (index >= 0) {
@@ -5673,7 +5717,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5673
5717
  key: "_handleDragTargetRelease",
5674
5718
  value: function _handleDragTargetRelease() {
5675
5719
  if (this.isDragged) {
5676
- if (this.percentOpen > .5) {
5720
+ if (this.percentOpen > 0.2) {
5677
5721
  this.open();
5678
5722
  } else {
5679
5723
  this._animateOut();
@@ -5740,7 +5784,7 @@ $jscomp.polyfill = function (e, r, p, m) {
5740
5784
  key: "_handleCloseRelease",
5741
5785
  value: function _handleCloseRelease() {
5742
5786
  if (this.isOpen && this.isDragged) {
5743
- if (this.percentOpen > .5) {
5787
+ if (this.percentOpen > 0.8) {
5744
5788
  this._animateIn();
5745
5789
  } else {
5746
5790
  this.close();
@@ -6408,6 +6452,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6408
6452
  _this36.oldVal;
6409
6453
  _this36.$inputField = _this36.$el.closest('.input-field');
6410
6454
  _this36.$active = $();
6455
+ _this36._mousedown = false;
6411
6456
  _this36._setupDropdown();
6412
6457
 
6413
6458
  _this36._setupEventHandlers();
@@ -6437,16 +6482,21 @@ $jscomp.polyfill = function (e, r, p, m) {
6437
6482
  this._handleInputBlurBound = this._handleInputBlur.bind(this);
6438
6483
  this._handleInputKeyupAndFocusBound = this._handleInputKeyupAndFocus.bind(this);
6439
6484
  this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
6485
+ this._handleInputClickBound = this._handleInputClick.bind(this);
6440
6486
  this._handleContainerMousedownAndTouchstartBound = this._handleContainerMousedownAndTouchstart.bind(this);
6487
+ this._handleContainerMouseupAndTouchendBound = this._handleContainerMouseupAndTouchend.bind(this);
6441
6488
 
6442
6489
  this.el.addEventListener('blur', this._handleInputBlurBound);
6443
6490
  this.el.addEventListener('keyup', this._handleInputKeyupAndFocusBound);
6444
6491
  this.el.addEventListener('focus', this._handleInputKeyupAndFocusBound);
6445
6492
  this.el.addEventListener('keydown', this._handleInputKeydownBound);
6493
+ this.el.addEventListener('click', this._handleInputClickBound);
6446
6494
  this.container.addEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
6495
+ this.container.addEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
6447
6496
 
6448
6497
  if (typeof window.ontouchstart !== 'undefined') {
6449
6498
  this.container.addEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
6499
+ this.container.addEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
6450
6500
  }
6451
6501
  }
6452
6502
 
@@ -6461,10 +6511,13 @@ $jscomp.polyfill = function (e, r, p, m) {
6461
6511
  this.el.removeEventListener('keyup', this._handleInputKeyupAndFocusBound);
6462
6512
  this.el.removeEventListener('focus', this._handleInputKeyupAndFocusBound);
6463
6513
  this.el.removeEventListener('keydown', this._handleInputKeydownBound);
6514
+ this.el.removeEventListener('click', this._handleInputClickBound);
6464
6515
  this.container.removeEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
6516
+ this.container.removeEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
6465
6517
 
6466
6518
  if (typeof window.ontouchstart !== 'undefined') {
6467
6519
  this.container.removeEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
6520
+ this.container.removeEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
6468
6521
  }
6469
6522
  }
6470
6523
 
@@ -6475,6 +6528,8 @@ $jscomp.polyfill = function (e, r, p, m) {
6475
6528
  }, {
6476
6529
  key: "_setupDropdown",
6477
6530
  value: function _setupDropdown() {
6531
+ var _this37 = this;
6532
+
6478
6533
  this.container = document.createElement('ul');
6479
6534
  this.container.id = "autocomplete-options-" + M.guid();
6480
6535
  $(this.container).addClass('autocomplete-content dropdown-content');
@@ -6484,7 +6539,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6484
6539
  this.dropdown = M.Dropdown.init(this.el, {
6485
6540
  autoFocus: false,
6486
6541
  closeOnClick: false,
6487
- coverTrigger: false
6542
+ coverTrigger: false,
6543
+ onItemClick: function (itemEl) {
6544
+ _this37.selectOption($(itemEl));
6545
+ }
6488
6546
  });
6489
6547
 
6490
6548
  // Sketchy removal of dropdown click handler
@@ -6508,8 +6566,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6508
6566
  }, {
6509
6567
  key: "_handleInputBlur",
6510
6568
  value: function _handleInputBlur() {
6511
- this.dropdown.close();
6512
- this._resetAutocomplete();
6569
+ if (!this._mousedown) {
6570
+ this.close();
6571
+ this._resetAutocomplete();
6572
+ }
6513
6573
  }
6514
6574
 
6515
6575
  /**
@@ -6520,8 +6580,6 @@ $jscomp.polyfill = function (e, r, p, m) {
6520
6580
  }, {
6521
6581
  key: "_handleInputKeyupAndFocus",
6522
6582
  value: function _handleInputKeyupAndFocus(e) {
6523
- var _this37 = this;
6524
-
6525
6583
  if (e.type === 'keyup') {
6526
6584
  Autocomplete._keydown = false;
6527
6585
  }
@@ -6535,25 +6593,9 @@ $jscomp.polyfill = function (e, r, p, m) {
6535
6593
  }
6536
6594
 
6537
6595
  // Check if the input isn't empty
6538
- if (this.oldVal !== val) {
6539
- this._resetAutocomplete();
6540
-
6541
- if (val.length >= this.options.minLength) {
6542
- this.isOpen = true;
6543
- this._renderDropdown(this.options.data, val);
6544
- }
6545
-
6546
- // Open dropdown
6547
- if (!this.dropdown.isOpen) {
6548
- // Timeout to prevent dropdown temp doc click handler from firing
6549
- setTimeout(function () {
6550
- _this37.dropdown.open();
6551
- }, 100);
6552
-
6553
- // Recalculate dropdown when its already open
6554
- } else {
6555
- this.dropdown.recalculateDimensions();
6556
- }
6596
+ // Check if focus triggered by tab
6597
+ if (this.oldVal !== val && M.tabPressed) {
6598
+ this.open();
6557
6599
  }
6558
6600
 
6559
6601
  // Update oldVal
@@ -6576,7 +6618,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6576
6618
  numItems = $(this.container).children('li').length;
6577
6619
 
6578
6620
  // select element on Enter
6579
- if (keyCode === 13 && this.activeIndex >= 0) {
6621
+ if (keyCode === M.keys.ENTER && this.activeIndex >= 0) {
6580
6622
  liElement = $(this.container).children('li').eq(this.activeIndex);
6581
6623
  if (liElement.length) {
6582
6624
  this.selectOption(liElement);
@@ -6586,14 +6628,14 @@ $jscomp.polyfill = function (e, r, p, m) {
6586
6628
  }
6587
6629
 
6588
6630
  // Capture up and down key
6589
- if (keyCode === 38 || keyCode === 40) {
6631
+ if (keyCode === M.keys.ARROW_UP || keyCode === M.keys.ARROW_DOWN) {
6590
6632
  e.preventDefault();
6591
6633
 
6592
- if (keyCode === 38 && this.activeIndex > 0) {
6634
+ if (keyCode === M.keys.ARROW_UP && this.activeIndex > 0) {
6593
6635
  this.activeIndex--;
6594
6636
  }
6595
6637
 
6596
- if (keyCode === 40 && this.activeIndex < numItems - 1) {
6638
+ if (keyCode === M.keys.ARROW_DOWN && this.activeIndex < numItems - 1) {
6597
6639
  this.activeIndex++;
6598
6640
  }
6599
6641
 
@@ -6605,6 +6647,17 @@ $jscomp.polyfill = function (e, r, p, m) {
6605
6647
  }
6606
6648
  }
6607
6649
 
6650
+ /**
6651
+ * Handle Input Click
6652
+ * @param {Event} e
6653
+ */
6654
+
6655
+ }, {
6656
+ key: "_handleInputClick",
6657
+ value: function _handleInputClick(e) {
6658
+ this.open();
6659
+ }
6660
+
6608
6661
  /**
6609
6662
  * Handle Container Mousedown and Touchstart
6610
6663
  * @param {Event} e
@@ -6613,8 +6666,18 @@ $jscomp.polyfill = function (e, r, p, m) {
6613
6666
  }, {
6614
6667
  key: "_handleContainerMousedownAndTouchstart",
6615
6668
  value: function _handleContainerMousedownAndTouchstart(e) {
6616
- var $autocompleteOption = $(e.target).closest('li');
6617
- this.selectOption($autocompleteOption);
6669
+ this._mousedown = true;
6670
+ }
6671
+
6672
+ /**
6673
+ * Handle Container Mouseup and Touchend
6674
+ * @param {Event} e
6675
+ */
6676
+
6677
+ }, {
6678
+ key: "_handleContainerMouseupAndTouchend",
6679
+ value: function _handleContainerMouseupAndTouchend(e) {
6680
+ this._mousedown = false;
6618
6681
  }
6619
6682
 
6620
6683
  /**
@@ -6625,7 +6688,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6625
6688
  key: "_highlight",
6626
6689
  value: function _highlight(string, $el) {
6627
6690
  var img = $el.find('img');
6628
- var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
6691
+ var matchStart = $el.text().toLowerCase().indexOf('' + string.toLowerCase() + ''),
6629
6692
  matchEnd = matchStart + string.length - 1,
6630
6693
  beforeMatch = $el.text().slice(0, matchStart),
6631
6694
  matchText = $el.text().slice(matchStart, matchEnd + 1),
@@ -6658,6 +6721,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6658
6721
  this._resetCurrentElement();
6659
6722
  this.oldVal = null;
6660
6723
  this.isOpen = false;
6724
+ this._mousedown = false;
6661
6725
  }
6662
6726
 
6663
6727
  /**
@@ -6672,7 +6736,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6672
6736
  this.el.value = text;
6673
6737
  this.$el.trigger('change');
6674
6738
  this._resetAutocomplete();
6675
- this.dropdown.close();
6739
+ this.close();
6676
6740
 
6677
6741
  // Handle onAutocomplete callback.
6678
6742
  if (typeof this.options.onAutocomplete === 'function') {
@@ -6714,17 +6778,19 @@ $jscomp.polyfill = function (e, r, p, m) {
6714
6778
  }
6715
6779
 
6716
6780
  // Sort
6717
- var sortFunctionBound = function (a, b) {
6718
- return _this38.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6719
- };
6720
- matchingData.sort(sortFunctionBound);
6781
+ if (this.options.sortFunction) {
6782
+ var sortFunctionBound = function (a, b) {
6783
+ return _this38.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
6784
+ };
6785
+ matchingData.sort(sortFunctionBound);
6786
+ }
6721
6787
 
6722
6788
  // Render
6723
6789
  for (var i = 0; i < matchingData.length; i++) {
6724
6790
  var _entry = matchingData[i];
6725
6791
  var $autocompleteOption = $('<li></li>');
6726
6792
  if (!!_entry.data) {
6727
- $autocompleteOption.append('<img src="' + _entry.data + '" class="right circle"><span>' + _entry.key + '</span>');
6793
+ $autocompleteOption.append("<img src=\"" + _entry.data + "\" class=\"right circle\"><span>" + _entry.key + "</span>");
6728
6794
  } else {
6729
6795
  $autocompleteOption.append('<span>' + _entry.key + '</span>');
6730
6796
  }
@@ -6734,6 +6800,41 @@ $jscomp.polyfill = function (e, r, p, m) {
6734
6800
  }
6735
6801
  }
6736
6802
 
6803
+ /**
6804
+ * Open Autocomplete Dropdown
6805
+ */
6806
+
6807
+ }, {
6808
+ key: "open",
6809
+ value: function open() {
6810
+ var val = this.el.value.toLowerCase();
6811
+
6812
+ this._resetAutocomplete();
6813
+
6814
+ if (val.length >= this.options.minLength) {
6815
+ this.isOpen = true;
6816
+ this._renderDropdown(this.options.data, val);
6817
+ }
6818
+
6819
+ // Open dropdown
6820
+ if (!this.dropdown.isOpen) {
6821
+ this.dropdown.open();
6822
+ } else {
6823
+ // Recalculate dropdown when its already open
6824
+ this.dropdown.recalculateDimensions();
6825
+ }
6826
+ }
6827
+
6828
+ /**
6829
+ * Close Autocomplete Dropdown
6830
+ */
6831
+
6832
+ }, {
6833
+ key: "close",
6834
+ value: function close() {
6835
+ this.dropdown.close();
6836
+ }
6837
+
6737
6838
  /**
6738
6839
  * Update Data
6739
6840
  * @param {Object} data
@@ -6836,7 +6937,7 @@ $jscomp.polyfill = function (e, r, p, m) {
6836
6937
  }
6837
6938
 
6838
6939
  if (!$textarea.length) {
6839
- console.error("No textarea element found");
6940
+ console.error('No textarea element found');
6840
6941
  return;
6841
6942
  }
6842
6943
 
@@ -6977,10 +7078,10 @@ $jscomp.polyfill = function (e, r, p, m) {
6977
7078
  document.addEventListener('blur', function (e) {
6978
7079
  var $inputElement = $(e.target);
6979
7080
  if ($inputElement.is(input_selector)) {
6980
- var selector = ".prefix";
7081
+ var selector = '.prefix';
6981
7082
 
6982
7083
  if ($inputElement[0].value.length === 0 && $inputElement[0].validity.badInput !== true && $inputElement.attr('placeholder') === null) {
6983
- selector += ", label";
7084
+ selector += ', label';
6984
7085
  }
6985
7086
  $inputElement.siblings(selector).removeClass('active');
6986
7087
  M.validate_field($inputElement);
@@ -7029,7 +7130,7 @@ $jscomp.polyfill = function (e, r, p, m) {
7029
7130
  for (var i = 0; i < files.length; i++) {
7030
7131
  file_names.push(files[i].name);
7031
7132
  }
7032
- path_input[0].value = file_names.join(", ");
7133
+ path_input[0].value = file_names.join(', ');
7033
7134
  path_input.trigger('change');
7034
7135
  });
7035
7136
  }); // End of $(document).ready
@@ -7212,7 +7313,8 @@ $jscomp.polyfill = function (e, r, p, m) {
7212
7313
  key: "_handleInterval",
7213
7314
  value: function _handleInterval() {
7214
7315
  var newActiveIndex = this.$slider.find('.active').index();
7215
- if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0; // loop to start
7316
+ if (this.$slides.length === newActiveIndex + 1) newActiveIndex = 0;
7317
+ // loop to start
7216
7318
  else newActiveIndex += 1;
7217
7319
 
7218
7320
  this.set(newActiveIndex);
@@ -8247,17 +8349,15 @@ $jscomp.polyfill = function (e, r, p, m) {
8247
8349
  _this47.$floatingBtnsReverse = _this47.$el.find('ul .btn-floating').reverse();
8248
8350
  _this47.offsetY = 0;
8249
8351
  _this47.offsetX = 0;
8352
+
8353
+ _this47.$el.addClass("direction-" + _this47.options.direction);
8250
8354
  if (_this47.options.direction === 'top') {
8251
- _this47.$el.addClass('direction-top');
8252
8355
  _this47.offsetY = 40;
8253
8356
  } else if (_this47.options.direction === 'right') {
8254
- _this47.$el.addClass('direction-right');
8255
8357
  _this47.offsetX = -40;
8256
8358
  } else if (_this47.options.direction === 'bottom') {
8257
- _this47.$el.addClass('direction-bottom');
8258
8359
  _this47.offsetY = -40;
8259
8360
  } else {
8260
- _this47.$el.addClass('direction-left');
8261
8361
  _this47.offsetX = 40;
8262
8362
  }
8263
8363
  _this47._setupEventHandlers();
@@ -8393,7 +8493,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8393
8493
  anim({
8394
8494
  targets: el,
8395
8495
  opacity: 1,
8396
- scale: [.4, 1],
8496
+ scale: [0.4, 1],
8397
8497
  translateY: [_this48.offsetY, 0],
8398
8498
  translateX: [_this48.offsetX, 0],
8399
8499
  duration: 275,
@@ -8418,7 +8518,7 @@ $jscomp.polyfill = function (e, r, p, m) {
8418
8518
  anim({
8419
8519
  targets: el,
8420
8520
  opacity: 0,
8421
- scale: .4,
8521
+ scale: 0.4,
8422
8522
  translateY: _this49.offsetY,
8423
8523
  translateX: _this49.offsetX,
8424
8524
  duration: 175,
@@ -8604,6 +8704,8 @@ $jscomp.polyfill = function (e, r, p, m) {
8604
8704
  'use strict';
8605
8705
 
8606
8706
  var _defaults = {
8707
+ // Close when date is selected
8708
+ autoClose: false,
8607
8709
 
8608
8710
  // the default output format for the input field value
8609
8711
  format: 'mmm dd, yyyy',
@@ -8721,14 +8823,13 @@ $jscomp.polyfill = function (e, r, p, m) {
8721
8823
 
8722
8824
  if (!_this52.options.defaultDate) {
8723
8825
  _this52.options.defaultDate = new Date(Date.parse(_this52.el.value));
8724
- _this52.options.setDefaultDate = true;
8725
8826
  }
8726
8827
 
8727
8828
  var defDate = _this52.options.defaultDate;
8728
-
8729
8829
  if (Datepicker._isDate(defDate)) {
8730
8830
  if (_this52.options.setDefaultDate) {
8731
8831
  _this52.setDate(defDate, true);
8832
+ _this52.setInputValue();
8732
8833
  } else {
8733
8834
  _this52.gotoDate(defDate);
8734
8835
  }
@@ -8741,7 +8842,6 @@ $jscomp.polyfill = function (e, r, p, m) {
8741
8842
  * @type {Boolean}
8742
8843
  */
8743
8844
  _this52.isOpen = false;
8744
-
8745
8845
  return _this52;
8746
8846
  }
8747
8847
 
@@ -8762,11 +8862,11 @@ $jscomp.polyfill = function (e, r, p, m) {
8762
8862
  }, {
8763
8863
  key: "destroySelects",
8764
8864
  value: function destroySelects() {
8765
- var oldYearSelect = this.calendarEl.querySelector('.pika-select-year');
8865
+ var oldYearSelect = this.calendarEl.querySelector('.orig-select-year');
8766
8866
  if (oldYearSelect) {
8767
8867
  M.FormSelect.getInstance(oldYearSelect).destroy();
8768
8868
  }
8769
- var oldMonthSelect = this.calendarEl.querySelector('.pika-select-month');
8869
+ var oldMonthSelect = this.calendarEl.querySelector('.orig-select-month');
8770
8870
  if (oldMonthSelect) {
8771
8871
  M.FormSelect.getInstance(oldMonthSelect).destroy();
8772
8872
  }
@@ -8901,9 +9001,6 @@ $jscomp.polyfill = function (e, r, p, m) {
8901
9001
  month: date.getMonth(),
8902
9002
  year: date.getFullYear()
8903
9003
  }];
8904
- // if (this.options.mainCalendar === 'right') {
8905
- // this.calendars[0].month += 1 - this.options.numberOfMonths;
8906
- // }
8907
9004
  }
8908
9005
 
8909
9006
  this.adjustCalendars();
@@ -8912,12 +9009,6 @@ $jscomp.polyfill = function (e, r, p, m) {
8912
9009
  key: "adjustCalendars",
8913
9010
  value: function adjustCalendars() {
8914
9011
  this.calendars[0] = this.adjustCalendar(this.calendars[0]);
8915
- // for (let c = 1; c < this.options.numberOfMonths; c++) {
8916
- // this.calendars[c] = this.adjustCalendar({
8917
- // month: this.calendars[0].month + c,
8918
- // year: this.calendars[0].year
8919
- // });
8920
- // }
8921
9012
  this.draw();
8922
9013
  }
8923
9014
  }, {
@@ -9061,12 +9152,12 @@ $jscomp.polyfill = function (e, r, p, m) {
9061
9152
  if (opts.isEndRange) {
9062
9153
  arr.push('is-endrange');
9063
9154
  }
9064
- return '<td data-day="' + opts.day + '" class="' + arr.join(' ') + '" aria-selected="' + ariaSelected + '">' + '<button class="datepicker-day-button" type="button" ' + 'data-pika-year="' + opts.year + '" data-pika-month="' + opts.month + '" data-pika-day="' + opts.day + '">' + opts.day + '</button>' + '</td>';
9155
+ return "<td data-day=\"" + opts.day + "\" class=\"" + arr.join(' ') + "\" aria-selected=\"" + ariaSelected + "\">" + ("<button class=\"datepicker-day-button\" type=\"button\" data-year=\"" + opts.year + "\" data-month=\"" + opts.month + "\" data-day=\"" + opts.day + "\">" + opts.day + "</button>") + '</td>';
9065
9156
  }
9066
9157
  }, {
9067
9158
  key: "renderRow",
9068
9159
  value: function renderRow(days, isRTL, isRowSelected) {
9069
- return '<tr class="pika-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
9160
+ return '<tr class="datepicker-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
9070
9161
  }
9071
9162
  }, {
9072
9163
  key: "renderTable",
@@ -9079,7 +9170,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9079
9170
  var i = void 0,
9080
9171
  arr = [];
9081
9172
  for (i = 0; i < 7; i++) {
9082
- arr.push('<th scope="col"><abbr title="' + this.renderDayName(opts, i) + '">' + this.renderDayName(opts, i, true) + '</abbr></th>');
9173
+ arr.push("<th scope=\"col\"><abbr title=\"" + this.renderDayName(opts, i) + "\">" + this.renderDayName(opts, i, true) + "</abbr></th>");
9083
9174
  }
9084
9175
  return '<thead><tr>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</tr></thead>';
9085
9176
  }
@@ -9107,7 +9198,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9107
9198
  arr.push('<option value="' + (year === refYear ? i - c : 12 + i - c) + '"' + (i === month ? ' selected="selected"' : '') + (isMinYear && i < opts.minMonth || isMaxYear && i > opts.maxMonth ? 'disabled="disabled"' : '') + '>' + opts.i18n.months[i] + '</option>');
9108
9199
  }
9109
9200
 
9110
- monthHtml = '<select class="pika-select pika-select-month" tabindex="-1">' + arr.join('') + '</select>';
9201
+ monthHtml = '<select class="datepicker-select orig-select-month" tabindex="-1">' + arr.join('') + '</select>';
9111
9202
 
9112
9203
  if ($.isArray(opts.yearRange)) {
9113
9204
  i = opts.yearRange[0];
@@ -9119,14 +9210,14 @@ $jscomp.polyfill = function (e, r, p, m) {
9119
9210
 
9120
9211
  for (arr = []; i < j && i <= opts.maxYear; i++) {
9121
9212
  if (i >= opts.minYear) {
9122
- arr.push('<option value="' + i + '"' + (i === year ? ' selected="selected"' : '') + '>' + i + '</option>');
9213
+ arr.push("<option value=\"" + i + "\" " + (i === year ? 'selected="selected"' : '') + ">" + i + "</option>");
9123
9214
  }
9124
9215
  }
9125
9216
 
9126
- yearHtml = '<select class="pika-select pika-select-year" tabindex="-1">' + arr.join('') + '</select>';
9217
+ yearHtml = "<select class=\"datepicker-select orig-select-year\" tabindex=\"-1\">" + arr.join('') + "</select>";
9127
9218
 
9128
9219
  var leftArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z"/><path d="M0-.5h24v24H0z" fill="none"/></svg>';
9129
- html += '<button class="month-prev' + (prev ? '' : ' is-disabled') + '" type="button">' + leftArrow + '</button>';
9220
+ html += "<button class=\"month-prev" + (prev ? '' : ' is-disabled') + "\" type=\"button\">" + leftArrow + "</button>";
9130
9221
 
9131
9222
  html += '<div class="selects-container">';
9132
9223
  if (opts.showMonthAfterYear) {
@@ -9144,10 +9235,8 @@ $jscomp.polyfill = function (e, r, p, m) {
9144
9235
  next = false;
9145
9236
  }
9146
9237
 
9147
- // if (c === (this.options.numberOfMonths - 1) ) {
9148
9238
  var rightArrow = '<svg fill="#000000" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z"/><path d="M0-.25h24v24H0z" fill="none"/></svg>';
9149
- html += '<button class="month-next' + (next ? '' : ' is-disabled') + '" type="button">' + rightArrow + '</button>';
9150
- // }
9239
+ html += "<button class=\"month-next" + (next ? '' : ' is-disabled') + "\" type=\"button\">" + rightArrow + "</button>";
9151
9240
 
9152
9241
  return html += '</div>';
9153
9242
  }
@@ -9183,7 +9272,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9183
9272
  }
9184
9273
  }
9185
9274
 
9186
- randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
9275
+ randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
9187
9276
 
9188
9277
  for (var c = 0; c < 1; c++) {
9189
9278
  this._renderDateDisplay();
@@ -9195,10 +9284,16 @@ $jscomp.polyfill = function (e, r, p, m) {
9195
9284
  this.calendarEl.innerHTML = html;
9196
9285
 
9197
9286
  // Init Materialize Select
9198
- var yearSelect = this.calendarEl.querySelector('.pika-select-year');
9199
- var monthSelect = this.calendarEl.querySelector('.pika-select-month');
9200
- M.FormSelect.init(yearSelect, { classes: 'select-year', dropdownOptions: { container: document.body, constrainWidth: false } });
9201
- M.FormSelect.init(monthSelect, { classes: 'select-month', dropdownOptions: { container: document.body, constrainWidth: false } });
9287
+ var yearSelect = this.calendarEl.querySelector('.orig-select-year');
9288
+ var monthSelect = this.calendarEl.querySelector('.orig-select-month');
9289
+ M.FormSelect.init(yearSelect, {
9290
+ classes: 'select-year',
9291
+ dropdownOptions: { container: document.body, constrainWidth: false }
9292
+ });
9293
+ M.FormSelect.init(monthSelect, {
9294
+ classes: 'select-month',
9295
+ dropdownOptions: { container: document.body, constrainWidth: false }
9296
+ });
9202
9297
 
9203
9298
  // Add change handlers for select
9204
9299
  yearSelect.addEventListener('change', this._handleYearChange.bind(this));
@@ -9244,7 +9339,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9244
9339
  this.$modalEl = $(Datepicker._template);
9245
9340
  this.modalEl = this.$modalEl[0];
9246
9341
 
9247
- this.calendarEl = this.modalEl.querySelector('.pika-single');
9342
+ this.calendarEl = this.modalEl.querySelector('.datepicker-calendar');
9248
9343
 
9249
9344
  this.yearTextEl = this.modalEl.querySelector('.year-text');
9250
9345
  this.dateTextEl = this.modalEl.querySelector('.date-text');
@@ -9255,7 +9350,6 @@ $jscomp.polyfill = function (e, r, p, m) {
9255
9350
  this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel');
9256
9351
 
9257
9352
  this.formats = {
9258
-
9259
9353
  d: function () {
9260
9354
  return _this55.date.getDate();
9261
9355
  },
@@ -9326,24 +9420,16 @@ $jscomp.polyfill = function (e, r, p, m) {
9326
9420
  var $target = $(e.target);
9327
9421
  if (!$target.hasClass('is-disabled')) {
9328
9422
  if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) {
9329
- this.setDate(new Date(e.target.getAttribute('data-pika-year'), e.target.getAttribute('data-pika-month'), e.target.getAttribute('data-pika-day')));
9423
+ this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day')));
9424
+ if (this.options.autoClose) {
9425
+ this._finishSelection();
9426
+ }
9330
9427
  } else if ($target.closest('.month-prev').length) {
9331
9428
  this.prevMonth();
9332
9429
  } else if ($target.closest('.month-next').length) {
9333
9430
  this.nextMonth();
9334
9431
  }
9335
9432
  }
9336
- // if (!$target.hasClass('pika-select')) {
9337
- // // if this is touch event prevent mouse events emulation
9338
- // // if (e.preventDefault) {
9339
- // // e.preventDefault();
9340
- // // } else {
9341
- // // e.returnValue = false;
9342
- // // return false;
9343
- // // }
9344
- // } else {
9345
- // this._c = true;
9346
- // }
9347
9433
  }
9348
9434
  }, {
9349
9435
  key: "_handleClearClick",
@@ -9406,9 +9492,6 @@ $jscomp.polyfill = function (e, r, p, m) {
9406
9492
  if (Datepicker._isDate(date)) {
9407
9493
  this.setDate(date);
9408
9494
  }
9409
- // if (!self._v) {
9410
- // self.show();
9411
- // }
9412
9495
  }
9413
9496
  }, {
9414
9497
  key: "renderDayName",
@@ -9534,7 +9617,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9534
9617
  return Datepicker;
9535
9618
  }(Component);
9536
9619
 
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('');
9620
+ Datepicker._template = ['<div class= "modal datepicker-modal">', '<div class="modal-content datepicker-container">', '<div class="datepicker-date-display">', '<span class="year-text"></span>', '<span class="date-text"></span>', '</div>', '<div class="datepicker-calendar-container">', '<div class="datepicker-calendar"></div>', '<div class="datepicker-footer">', '<button class="btn-flat datepicker-clear waves-effect" style="visibility: hidden;" type="button"></button>', '<div class="confirmation-btns">', '<button class="btn-flat datepicker-cancel waves-effect" type="button"></button>', '<button class="btn-flat datepicker-done waves-effect" type="button"></button>', '</div>', '</div>', '</div>', '</div>', '</div>'].join('');
9538
9621
 
9539
9622
  M.Datepicker = Datepicker;
9540
9623
 
@@ -9565,7 +9648,14 @@ $jscomp.polyfill = function (e, r, p, m) {
9565
9648
 
9566
9649
  autoClose: false, // auto close when minute is selected
9567
9650
  twelveHour: true, // change to 12 hour AM/PM clock from 24 hour
9568
- vibrate: true // vibrate the device when dragging clock hand
9651
+ vibrate: true, // vibrate the device when dragging clock hand
9652
+
9653
+ // Callbacks
9654
+ onOpenStart: null,
9655
+ onOpenEnd: null,
9656
+ onCloseStart: null,
9657
+ onCloseEnd: null,
9658
+ onSelect: null
9569
9659
  };
9570
9660
 
9571
9661
  /**
@@ -9709,6 +9799,10 @@ $jscomp.polyfill = function (e, r, p, m) {
9709
9799
  }, this.options.duration / 2);
9710
9800
  }
9711
9801
 
9802
+ if (typeof this.options.onSelect === 'function') {
9803
+ this.options.onSelect.call(this, this.hours, this.minutes);
9804
+ }
9805
+
9712
9806
  // Unbind mousemove event
9713
9807
  document.removeEventListener('mousemove', this._handleDocumentClickMoveBound);
9714
9808
  document.removeEventListener('touchmove', this._handleDocumentClickMoveBound);
@@ -9734,7 +9828,13 @@ $jscomp.polyfill = function (e, r, p, m) {
9734
9828
  var _this58 = this;
9735
9829
 
9736
9830
  this.modal = M.Modal.init(this.modalEl, {
9831
+ onOpenStart: this.options.onOpenStart,
9832
+ onOpenEnd: this.options.onOpenEnd,
9833
+ onCloseStart: this.options.onCloseStart,
9737
9834
  onCloseEnd: function () {
9835
+ if (typeof _this58.options.onCloseEnd === 'function') {
9836
+ _this58.options.onCloseEnd.call(_this58);
9837
+ }
9738
9838
  _this58.isOpen = false;
9739
9839
  }
9740
9840
  });
@@ -9759,8 +9859,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9759
9859
  }, {
9760
9860
  key: "_pickerSetup",
9761
9861
  value: function _pickerSetup() {
9762
-
9763
- var $clearBtn = $('<button class="btn-flat timepicker-clear waves-effect" style="visibility: hidden;" type="button" tabindex="' + (this.options.twelveHour ? '3' : '1') + '">' + this.options.i18n.clear + '</button>').appendTo(this.footer).on('click', this.clear.bind(this));
9862
+ 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
9863
  if (this.options.showClearBtn) {
9765
9864
  $clearBtn.css({ visibility: '' });
9766
9865
  }
@@ -9891,12 +9990,12 @@ $jscomp.polyfill = function (e, r, p, m) {
9891
9990
  // Get the time
9892
9991
  var value = ((this.el.value || this.options.defaultTime || '') + '').split(':');
9893
9992
  if (this.options.twelveHour && !(typeof value[1] === 'undefined')) {
9894
- if (value[1].toUpperCase().indexOf("AM") > 0) {
9993
+ if (value[1].toUpperCase().indexOf('AM') > 0) {
9895
9994
  this.amOrPm = 'AM';
9896
9995
  } else {
9897
9996
  this.amOrPm = 'PM';
9898
9997
  }
9899
- value[1] = value[1].replace("AM", "").replace("PM", "");
9998
+ value[1] = value[1].replace('AM', '').replace('PM', '');
9900
9999
  }
9901
10000
  if (value[0] === 'now') {
9902
10001
  var now = new Date(+new Date() + this.options.fromNow);
@@ -9915,7 +10014,7 @@ $jscomp.polyfill = function (e, r, p, m) {
9915
10014
  }, {
9916
10015
  key: "showView",
9917
10016
  value: function showView(view, delay) {
9918
- if (view === 'minutes' && $(this.hoursView).css("visibility") === "visible") {
10017
+ if (view === 'minutes' && $(this.hoursView).css('visibility') === 'visible') {
9919
10018
  // raiseCallback(this.options.beforeHourSelect);
9920
10019
  }
9921
10020
  var isHours = view === 'hours',
@@ -10053,6 +10152,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10053
10152
  this.isOpen = true;
10054
10153
  this._updateTimeFromInput();
10055
10154
  this.showView('hours');
10155
+
10056
10156
  this.modal.open();
10057
10157
  }
10058
10158
  }, {
@@ -10896,7 +10996,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10896
10996
  this.$el.find('.carousel-item').removeClass('active');
10897
10997
  el.classList.add('active');
10898
10998
  }
10899
- var transformString = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
10999
+ var transformString = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween * i + "px) translateZ(" + this.options.dist * tween + "px)";
10900
11000
  this._updateItemStyle(el, centerTweenedOpacity, 0, transformString);
10901
11001
  }
10902
11002
 
@@ -10912,7 +11012,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10912
11012
  // Don't show wrapped items.
10913
11013
  if (!this.noWrap || this.center + i < this.count) {
10914
11014
  el = this.images[this._wrap(this.center + i)];
10915
- var _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
11015
+ var _transformString = alignment + " translateX(" + (this.options.shift + (this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)";
10916
11016
  this._updateItemStyle(el, tweenedOpacity, -i, _transformString);
10917
11017
  }
10918
11018
 
@@ -10927,7 +11027,7 @@ $jscomp.polyfill = function (e, r, p, m) {
10927
11027
  // Don't show wrapped items.
10928
11028
  if (!this.noWrap || this.center - i >= 0) {
10929
11029
  el = this.images[this._wrap(this.center - i)];
10930
- var _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
11030
+ var _transformString2 = alignment + " translateX(" + (-this.options.shift + (-this.dim * i - delta) / 2) + "px) translateZ(" + zTranslation + "px)";
10931
11031
  this._updateItemStyle(el, tweenedOpacity, -i, _transformString2);
10932
11032
  }
10933
11033
  }
@@ -10936,18 +11036,18 @@ $jscomp.polyfill = function (e, r, p, m) {
10936
11036
  // Don't show wrapped items.
10937
11037
  if (!this.noWrap || this.center >= 0 && this.center < this.count) {
10938
11038
  el = this.images[this._wrap(this.center)];
10939
- var _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
11039
+ var _transformString3 = alignment + " translateX(" + -delta / 2 + "px) translateX(" + dir * this.options.shift * tween + "px) translateZ(" + this.options.dist * tween + "px)";
10940
11040
  this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3);
10941
11041
  }
10942
11042
 
10943
11043
  // onCycleTo callback
10944
11044
  var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center));
10945
- if (lastCenter !== this.center && typeof this.options.onCycleTo === "function") {
11045
+ if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') {
10946
11046
  this.options.onCycleTo.call(this, $currItem[0], this.dragged);
10947
11047
  }
10948
11048
 
10949
11049
  // One time callback
10950
- if (typeof this.oneTimeCallback === "function") {
11050
+ if (typeof this.oneTimeCallback === 'function') {
10951
11051
  this.oneTimeCallback.call(this, $currItem[0], this.dragged);
10952
11052
  this.oneTimeCallback = null;
10953
11053
  }
@@ -11005,7 +11105,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11005
11105
  }
11006
11106
 
11007
11107
  // Set one time callback
11008
- if (typeof callback === "function") {
11108
+ if (typeof callback === 'function') {
11009
11109
  this.oneTimeCallback = callback;
11010
11110
  }
11011
11111
 
@@ -11607,17 +11707,13 @@ $jscomp.polyfill = function (e, r, p, m) {
11607
11707
  placeholderOption.find('input[type="checkbox"]').prop('checked', false);
11608
11708
  this._toggleEntryFromArray(placeholderOption[0].id);
11609
11709
  }
11610
-
11611
- var checkbox = $(option).find('input[type="checkbox"]');
11612
- checkbox.prop('checked', !checkbox.prop('checked'));
11613
11710
  selected = this._toggleEntryFromArray(key);
11614
11711
  } else {
11615
- $(this.dropdownOptions).find('li').removeClass('active');
11616
- $(option).toggleClass('active');
11617
- this.input.value = option.textContent;
11712
+ $(this.dropdownOptions).find('li').removeClass('selected');
11713
+ $(option).toggleClass('selected', selected);
11618
11714
  }
11619
11715
 
11620
- this._activateOption($(this.dropdownOptions), option);
11716
+ // Set selected on original select option
11621
11717
  $(this._valueDict[key].el).prop('selected', selected);
11622
11718
  this.$el.trigger('change');
11623
11719
  }
@@ -11648,7 +11744,7 @@ $jscomp.polyfill = function (e, r, p, m) {
11648
11744
  var _this70 = this;
11649
11745
 
11650
11746
  this.wrapper = document.createElement('div');
11651
- $(this.wrapper).addClass('select-wrapper' + ' ' + this.options.classes);
11747
+ $(this.wrapper).addClass('select-wrapper ' + this.options.classes);
11652
11748
  this.$el.before($(this.wrapper));
11653
11749
  this.wrapper.appendChild(this.el);
11654
11750
 
@@ -11787,9 +11883,8 @@ $jscomp.polyfill = function (e, r, p, m) {
11787
11883
 
11788
11884
  // add icons
11789
11885
  var iconUrl = option.getAttribute('data-icon');
11790
- var classes = option.getAttribute('class');
11791
11886
  if (!!iconUrl) {
11792
- var imgEl = $('<img alt="" src="' + iconUrl + '">');
11887
+ var imgEl = $("<img alt=\"\" src=\"" + iconUrl + "\">");
11793
11888
  liEl.prepend(imgEl);
11794
11889
  }
11795
11890
 
@@ -11808,49 +11903,54 @@ $jscomp.polyfill = function (e, r, p, m) {
11808
11903
  key: "_toggleEntryFromArray",
11809
11904
  value: function _toggleEntryFromArray(key) {
11810
11905
  var notAdded = !this._keysSelected.hasOwnProperty(key);
11906
+ var $optionLi = $(this._valueDict[key].optionEl);
11907
+
11811
11908
  if (notAdded) {
11812
11909
  this._keysSelected[key] = true;
11813
11910
  } else {
11814
11911
  delete this._keysSelected[key];
11815
11912
  }
11816
11913
 
11817
- $(this._valueDict[key].optionEl).toggleClass('active');
11914
+ $optionLi.toggleClass('selected', notAdded);
11915
+
11916
+ // Set checkbox checked value
11917
+ $optionLi.find('input[type="checkbox"]').prop('checked', notAdded);
11818
11918
 
11819
11919
  // use notAdded instead of true (to detect if the option is selected or not)
11820
- $(this._valueDict[key].el).prop('selected', notAdded);
11920
+ $optionLi.prop('selected', notAdded);
11821
11921
 
11822
11922
  return notAdded;
11823
11923
  }
11824
11924
 
11825
11925
  /**
11826
- * Set value to input
11926
+ * Set text value to input
11827
11927
  */
11828
11928
 
11829
11929
  }, {
11830
11930
  key: "_setValueToInput",
11831
11931
  value: function _setValueToInput() {
11832
- var value = '';
11932
+ var values = [];
11833
11933
  var options = this.$el.find('option');
11834
11934
 
11835
11935
  options.each(function (el) {
11836
11936
  if ($(el).prop('selected')) {
11837
11937
  var text = $(el).text();
11838
- value === '' ? value += text : value += ', ' + text;
11938
+ values.push(text);
11839
11939
  }
11840
11940
  });
11841
11941
 
11842
- if (value === '') {
11942
+ if (!values.length) {
11843
11943
  var firstDisabled = this.$el.find('option:disabled').eq(0);
11844
- if (firstDisabled.length) {
11845
- value = firstDisabled.text();
11944
+ if (firstDisabled.length && firstDisabled[0].value === '') {
11945
+ values.push(firstDisabled.text());
11846
11946
  }
11847
11947
  }
11848
11948
 
11849
- this.input.value = value;
11949
+ this.input.value = values.join(', ');
11850
11950
  }
11851
11951
 
11852
11952
  /**
11853
- * Set selected state of dropdown too match actual select element
11953
+ * Set selected state of dropdown to match actual select element
11854
11954
  */
11855
11955
 
11856
11956
  }, {
@@ -11860,12 +11960,12 @@ $jscomp.polyfill = function (e, r, p, m) {
11860
11960
 
11861
11961
  for (var key in this._valueDict) {
11862
11962
  var option = this._valueDict[key];
11863
- if ($(option.el).prop('selected')) {
11864
- $(option.optionEl).find('input[type="checkbox"]').prop("checked", true);
11963
+ var optionIsSelected = $(option.el).prop('selected');
11964
+ $(option.optionEl).find('input[type="checkbox"]').prop('checked', optionIsSelected);
11965
+ if (optionIsSelected) {
11865
11966
  this._activateOption($(this.dropdownOptions), $(option.optionEl));
11866
11967
  this._keysSelected[key] = true;
11867
11968
  } else {
11868
- $(option.optionEl).find('input[type="checkbox"]').prop("checked", false);
11869
11969
  $(option.optionEl).removeClass('selected');
11870
11970
  }
11871
11971
  }
@@ -11884,7 +11984,6 @@ $jscomp.polyfill = function (e, r, p, m) {
11884
11984
  if (!this.isMultiple) {
11885
11985
  collection.find('li.selected').removeClass('selected');
11886
11986
  }
11887
-
11888
11987
  var option = $(newOption);
11889
11988
  option.addClass('selected');
11890
11989
  }
@@ -11998,14 +12097,12 @@ $jscomp.polyfill = function (e, r, p, m) {
11998
12097
  key: "_setupEventHandlers",
11999
12098
  value: function _setupEventHandlers() {
12000
12099
  this._handleRangeChangeBound = this._handleRangeChange.bind(this);
12001
- this._handleRangeFocusBound = this._handleRangeFocus.bind(this);
12002
12100
  this._handleRangeMousedownTouchstartBound = this._handleRangeMousedownTouchstart.bind(this);
12003
12101
  this._handleRangeInputMousemoveTouchmoveBound = this._handleRangeInputMousemoveTouchmove.bind(this);
12004
12102
  this._handleRangeMouseupTouchendBound = this._handleRangeMouseupTouchend.bind(this);
12005
12103
  this._handleRangeBlurMouseoutTouchleaveBound = this._handleRangeBlurMouseoutTouchleave.bind(this);
12006
12104
 
12007
12105
  this.el.addEventListener('change', this._handleRangeChangeBound);
12008
- this.el.addEventListener('focus', this._handleRangeFocusBound);
12009
12106
 
12010
12107
  this.el.addEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
12011
12108
  this.el.addEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
@@ -12030,7 +12127,6 @@ $jscomp.polyfill = function (e, r, p, m) {
12030
12127
  key: "_removeEventHandlers",
12031
12128
  value: function _removeEventHandlers() {
12032
12129
  this.el.removeEventListener('change', this._handleRangeChangeBound);
12033
- this.el.removeEventListener('focus', this._handleRangeFocusBound);
12034
12130
 
12035
12131
  this.el.removeEventListener('mousedown', this._handleRangeMousedownTouchstartBound);
12036
12132
  this.el.removeEventListener('touchstart', this._handleRangeMousedownTouchstartBound);
@@ -12065,19 +12161,6 @@ $jscomp.polyfill = function (e, r, p, m) {
12065
12161
  $(this.thumb).addClass('active').css('left', offsetLeft + 'px');
12066
12162
  }
12067
12163
 
12068
- /**
12069
- * Handle Range Focus
12070
- * @param {Event} e
12071
- */
12072
-
12073
- }, {
12074
- key: "_handleRangeFocus",
12075
- value: function _handleRangeFocus() {
12076
- if (M.tabPressed) {
12077
- this.$el.addClass('focused');
12078
- }
12079
- }
12080
-
12081
12164
  /**
12082
12165
  * Handle Range Mousedown and Touchstart
12083
12166
  * @param {Event} e
@@ -12139,7 +12222,6 @@ $jscomp.polyfill = function (e, r, p, m) {
12139
12222
  key: "_handleRangeBlurMouseoutTouchleave",
12140
12223
  value: function _handleRangeBlurMouseoutTouchleave() {
12141
12224
  if (!this._mousedown) {
12142
- this.$el.removeClass('focused');
12143
12225
  var paddingLeft = parseInt(this.$el.css('padding-left'));
12144
12226
  var marginLeft = 7 + paddingLeft + 'px';
12145
12227
 
@@ -12214,8 +12296,8 @@ $jscomp.polyfill = function (e, r, p, m) {
12214
12296
  key: "_calcRangeOffset",
12215
12297
  value: function _calcRangeOffset() {
12216
12298
  var width = this.$el.width() - 15;
12217
- var max = parseFloat(this.$el.attr('max'));
12218
- var min = parseFloat(this.$el.attr('min'));
12299
+ var max = parseFloat(this.$el.attr('max')) || 100; // Range default max
12300
+ var min = parseFloat(this.$el.attr('min')) || 0; // Range default min
12219
12301
  var percent = (parseFloat(this.$el.val()) - min) / (max - min);
12220
12302
  return percent * width;
12221
12303
  }