materialize-sass 1.0.0.beta → 1.0.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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
@@ -64,6 +64,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
64
64
  _this.oldVal;
65
65
  _this.$inputField = _this.$el.closest('.input-field');
66
66
  _this.$active = $();
67
+ _this._mousedown = false;
67
68
  _this._setupDropdown();
68
69
 
69
70
  _this._setupEventHandlers();
@@ -93,16 +94,21 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
93
94
  this._handleInputBlurBound = this._handleInputBlur.bind(this);
94
95
  this._handleInputKeyupAndFocusBound = this._handleInputKeyupAndFocus.bind(this);
95
96
  this._handleInputKeydownBound = this._handleInputKeydown.bind(this);
97
+ this._handleInputClickBound = this._handleInputClick.bind(this);
96
98
  this._handleContainerMousedownAndTouchstartBound = this._handleContainerMousedownAndTouchstart.bind(this);
99
+ this._handleContainerMouseupAndTouchendBound = this._handleContainerMouseupAndTouchend.bind(this);
97
100
 
98
101
  this.el.addEventListener('blur', this._handleInputBlurBound);
99
102
  this.el.addEventListener('keyup', this._handleInputKeyupAndFocusBound);
100
103
  this.el.addEventListener('focus', this._handleInputKeyupAndFocusBound);
101
104
  this.el.addEventListener('keydown', this._handleInputKeydownBound);
105
+ this.el.addEventListener('click', this._handleInputClickBound);
102
106
  this.container.addEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
107
+ this.container.addEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
103
108
 
104
109
  if (typeof window.ontouchstart !== 'undefined') {
105
110
  this.container.addEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
111
+ this.container.addEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
106
112
  }
107
113
  }
108
114
 
@@ -117,10 +123,13 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
117
123
  this.el.removeEventListener('keyup', this._handleInputKeyupAndFocusBound);
118
124
  this.el.removeEventListener('focus', this._handleInputKeyupAndFocusBound);
119
125
  this.el.removeEventListener('keydown', this._handleInputKeydownBound);
126
+ this.el.removeEventListener('click', this._handleInputClickBound);
120
127
  this.container.removeEventListener('mousedown', this._handleContainerMousedownAndTouchstartBound);
128
+ this.container.removeEventListener('mouseup', this._handleContainerMouseupAndTouchendBound);
121
129
 
122
130
  if (typeof window.ontouchstart !== 'undefined') {
123
131
  this.container.removeEventListener('touchstart', this._handleContainerMousedownAndTouchstartBound);
132
+ this.container.removeEventListener('touchend', this._handleContainerMouseupAndTouchendBound);
124
133
  }
125
134
  }
126
135
 
@@ -131,6 +140,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
131
140
  }, {
132
141
  key: '_setupDropdown',
133
142
  value: function _setupDropdown() {
143
+ var _this2 = this;
144
+
134
145
  this.container = document.createElement('ul');
135
146
  this.container.id = 'autocomplete-options-' + M.guid();
136
147
  $(this.container).addClass('autocomplete-content dropdown-content');
@@ -140,7 +151,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
140
151
  this.dropdown = M.Dropdown.init(this.el, {
141
152
  autoFocus: false,
142
153
  closeOnClick: false,
143
- coverTrigger: false
154
+ coverTrigger: false,
155
+ onItemClick: function (itemEl) {
156
+ _this2.selectOption($(itemEl));
157
+ }
144
158
  });
145
159
 
146
160
  // Sketchy removal of dropdown click handler
@@ -164,8 +178,10 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
164
178
  }, {
165
179
  key: '_handleInputBlur',
166
180
  value: function _handleInputBlur() {
167
- this.dropdown.close();
168
- this._resetAutocomplete();
181
+ if (!this._mousedown) {
182
+ this.close();
183
+ this._resetAutocomplete();
184
+ }
169
185
  }
170
186
 
171
187
  /**
@@ -176,8 +192,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
176
192
  }, {
177
193
  key: '_handleInputKeyupAndFocus',
178
194
  value: function _handleInputKeyupAndFocus(e) {
179
- var _this2 = this;
180
-
181
195
  if (e.type === 'keyup') {
182
196
  Autocomplete._keydown = false;
183
197
  }
@@ -191,25 +205,9 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
191
205
  }
192
206
 
193
207
  // Check if the input isn't empty
194
- if (this.oldVal !== val) {
195
- this._resetAutocomplete();
196
-
197
- if (val.length >= this.options.minLength) {
198
- this.isOpen = true;
199
- this._renderDropdown(this.options.data, val);
200
- }
201
-
202
- // Open dropdown
203
- if (!this.dropdown.isOpen) {
204
- // Timeout to prevent dropdown temp doc click handler from firing
205
- setTimeout(function () {
206
- _this2.dropdown.open();
207
- }, 100);
208
-
209
- // Recalculate dropdown when its already open
210
- } else {
211
- this.dropdown.recalculateDimensions();
212
- }
208
+ // Check if focus triggered by tab
209
+ if (this.oldVal !== val && (M.tabPressed || e.type !== 'focus')) {
210
+ this.open();
213
211
  }
214
212
 
215
213
  // Update oldVal
@@ -232,7 +230,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
232
230
  numItems = $(this.container).children('li').length;
233
231
 
234
232
  // select element on Enter
235
- if (keyCode === 13 && this.activeIndex >= 0) {
233
+ if (keyCode === M.keys.ENTER && this.activeIndex >= 0) {
236
234
  liElement = $(this.container).children('li').eq(this.activeIndex);
237
235
  if (liElement.length) {
238
236
  this.selectOption(liElement);
@@ -242,14 +240,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
242
240
  }
243
241
 
244
242
  // Capture up and down key
245
- if (keyCode === 38 || keyCode === 40) {
243
+ if (keyCode === M.keys.ARROW_UP || keyCode === M.keys.ARROW_DOWN) {
246
244
  e.preventDefault();
247
245
 
248
- if (keyCode === 38 && this.activeIndex > 0) {
246
+ if (keyCode === M.keys.ARROW_UP && this.activeIndex > 0) {
249
247
  this.activeIndex--;
250
248
  }
251
249
 
252
- if (keyCode === 40 && this.activeIndex < numItems - 1) {
250
+ if (keyCode === M.keys.ARROW_DOWN && this.activeIndex < numItems - 1) {
253
251
  this.activeIndex++;
254
252
  }
255
253
 
@@ -261,6 +259,17 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
261
259
  }
262
260
  }
263
261
 
262
+ /**
263
+ * Handle Input Click
264
+ * @param {Event} e
265
+ */
266
+
267
+ }, {
268
+ key: '_handleInputClick',
269
+ value: function _handleInputClick(e) {
270
+ this.open();
271
+ }
272
+
264
273
  /**
265
274
  * Handle Container Mousedown and Touchstart
266
275
  * @param {Event} e
@@ -269,8 +278,18 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
269
278
  }, {
270
279
  key: '_handleContainerMousedownAndTouchstart',
271
280
  value: function _handleContainerMousedownAndTouchstart(e) {
272
- var $autocompleteOption = $(e.target).closest('li');
273
- this.selectOption($autocompleteOption);
281
+ this._mousedown = true;
282
+ }
283
+
284
+ /**
285
+ * Handle Container Mouseup and Touchend
286
+ * @param {Event} e
287
+ */
288
+
289
+ }, {
290
+ key: '_handleContainerMouseupAndTouchend',
291
+ value: function _handleContainerMouseupAndTouchend(e) {
292
+ this._mousedown = false;
274
293
  }
275
294
 
276
295
  /**
@@ -281,12 +300,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
281
300
  key: '_highlight',
282
301
  value: function _highlight(string, $el) {
283
302
  var img = $el.find('img');
284
- var matchStart = $el.text().toLowerCase().indexOf("" + string.toLowerCase() + ""),
303
+ var matchStart = $el.text().toLowerCase().indexOf('' + string.toLowerCase() + ''),
285
304
  matchEnd = matchStart + string.length - 1,
286
305
  beforeMatch = $el.text().slice(0, matchStart),
287
306
  matchText = $el.text().slice(matchStart, matchEnd + 1),
288
307
  afterMatch = $el.text().slice(matchEnd + 1);
289
- $el.html("<span>" + beforeMatch + "<span class='highlight'>" + matchText + "</span>" + afterMatch + "</span>");
308
+ $el.html('<span>' + beforeMatch + '<span class=\'highlight\'>' + matchText + '</span>' + afterMatch + '</span>');
290
309
  if (img.length) {
291
310
  $el.prepend(img);
292
311
  }
@@ -314,6 +333,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
314
333
  this._resetCurrentElement();
315
334
  this.oldVal = null;
316
335
  this.isOpen = false;
336
+ this._mousedown = false;
317
337
  }
318
338
 
319
339
  /**
@@ -328,7 +348,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
328
348
  this.el.value = text;
329
349
  this.$el.trigger('change');
330
350
  this._resetAutocomplete();
331
- this.dropdown.close();
351
+ this.close();
332
352
 
333
353
  // Handle onAutocomplete callback.
334
354
  if (typeof this.options.onAutocomplete === 'function') {
@@ -370,10 +390,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
370
390
  }
371
391
 
372
392
  // Sort
373
- var sortFunctionBound = function (a, b) {
374
- return _this3.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
375
- };
376
- matchingData.sort(sortFunctionBound);
393
+ if (this.options.sortFunction) {
394
+ var sortFunctionBound = function (a, b) {
395
+ return _this3.options.sortFunction(a.key.toLowerCase(), b.key.toLowerCase(), val.toLowerCase());
396
+ };
397
+ matchingData.sort(sortFunctionBound);
398
+ }
377
399
 
378
400
  // Render
379
401
  for (var i = 0; i < matchingData.length; i++) {
@@ -390,6 +412,41 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
390
412
  }
391
413
  }
392
414
 
415
+ /**
416
+ * Open Autocomplete Dropdown
417
+ */
418
+
419
+ }, {
420
+ key: 'open',
421
+ value: function open() {
422
+ var val = this.el.value.toLowerCase();
423
+
424
+ this._resetAutocomplete();
425
+
426
+ if (val.length >= this.options.minLength) {
427
+ this.isOpen = true;
428
+ this._renderDropdown(this.options.data, val);
429
+ }
430
+
431
+ // Open dropdown
432
+ if (!this.dropdown.isOpen) {
433
+ this.dropdown.open();
434
+ } else {
435
+ // Recalculate dropdown when its already open
436
+ this.dropdown.recalculateDimensions();
437
+ }
438
+ }
439
+
440
+ /**
441
+ * Close Autocomplete Dropdown
442
+ */
443
+
444
+ }, {
445
+ key: 'close',
446
+ value: function close() {
447
+ this.dropdown.close();
448
+ }
449
+
393
450
  /**
394
451
  * Update Data
395
452
  * @param {Object} data
@@ -56,17 +56,15 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
56
56
  _this.$floatingBtnsReverse = _this.$el.find('ul .btn-floating').reverse();
57
57
  _this.offsetY = 0;
58
58
  _this.offsetX = 0;
59
+
60
+ _this.$el.addClass('direction-' + _this.options.direction);
59
61
  if (_this.options.direction === 'top') {
60
- _this.$el.addClass('direction-top');
61
62
  _this.offsetY = 40;
62
63
  } else if (_this.options.direction === 'right') {
63
- _this.$el.addClass('direction-right');
64
64
  _this.offsetX = -40;
65
65
  } else if (_this.options.direction === 'bottom') {
66
- _this.$el.addClass('direction-bottom');
67
66
  _this.offsetY = -40;
68
67
  } else {
69
- _this.$el.addClass('direction-left');
70
68
  _this.offsetX = 40;
71
69
  }
72
70
  _this._setupEventHandlers();
@@ -202,7 +200,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
202
200
  anim({
203
201
  targets: el,
204
202
  opacity: 1,
205
- scale: [.4, 1],
203
+ scale: [0.4, 1],
206
204
  translateY: [_this2.offsetY, 0],
207
205
  translateX: [_this2.offsetX, 0],
208
206
  duration: 275,
@@ -227,7 +225,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
227
225
  anim({
228
226
  targets: el,
229
227
  opacity: 0,
230
- scale: .4,
228
+ scale: 0.4,
231
229
  translateY: _this3.offsetY,
232
230
  translateX: _this3.offsetX,
233
231
  duration: 175,
@@ -572,7 +572,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
572
572
  this.$el.find('.carousel-item').removeClass('active');
573
573
  el.classList.add('active');
574
574
  }
575
- var transformString = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween * i + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
575
+ var transformString = alignment + ' translateX(' + -delta / 2 + 'px) translateX(' + dir * this.options.shift * tween * i + 'px) translateZ(' + this.options.dist * tween + 'px)';
576
576
  this._updateItemStyle(el, centerTweenedOpacity, 0, transformString);
577
577
  }
578
578
 
@@ -588,7 +588,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
588
588
  // Don't show wrapped items.
589
589
  if (!this.noWrap || this.center + i < this.count) {
590
590
  el = this.images[this._wrap(this.center + i)];
591
- var _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
591
+ var _transformString = alignment + ' translateX(' + (this.options.shift + (this.dim * i - delta) / 2) + 'px) translateZ(' + zTranslation + 'px)';
592
592
  this._updateItemStyle(el, tweenedOpacity, -i, _transformString);
593
593
  }
594
594
 
@@ -603,7 +603,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
603
603
  // Don't show wrapped items.
604
604
  if (!this.noWrap || this.center - i >= 0) {
605
605
  el = this.images[this._wrap(this.center - i)];
606
- var _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px)' + ' translateZ(' + zTranslation + 'px)';
606
+ var _transformString2 = alignment + ' translateX(' + (-this.options.shift + (-this.dim * i - delta) / 2) + 'px) translateZ(' + zTranslation + 'px)';
607
607
  this._updateItemStyle(el, tweenedOpacity, -i, _transformString2);
608
608
  }
609
609
  }
@@ -612,18 +612,18 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
612
612
  // Don't show wrapped items.
613
613
  if (!this.noWrap || this.center >= 0 && this.center < this.count) {
614
614
  el = this.images[this._wrap(this.center)];
615
- var _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px)' + ' translateX(' + dir * this.options.shift * tween + 'px)' + ' translateZ(' + this.options.dist * tween + 'px)';
615
+ var _transformString3 = alignment + ' translateX(' + -delta / 2 + 'px) translateX(' + dir * this.options.shift * tween + 'px) translateZ(' + this.options.dist * tween + 'px)';
616
616
  this._updateItemStyle(el, centerTweenedOpacity, 0, _transformString3);
617
617
  }
618
618
 
619
619
  // onCycleTo callback
620
620
  var $currItem = this.$el.find('.carousel-item').eq(this._wrap(this.center));
621
- if (lastCenter !== this.center && typeof this.options.onCycleTo === "function") {
621
+ if (lastCenter !== this.center && typeof this.options.onCycleTo === 'function') {
622
622
  this.options.onCycleTo.call(this, $currItem[0], this.dragged);
623
623
  }
624
624
 
625
625
  // One time callback
626
- if (typeof this.oneTimeCallback === "function") {
626
+ if (typeof this.oneTimeCallback === 'function') {
627
627
  this.oneTimeCallback.call(this, $currItem[0], this.dragged);
628
628
  this.oneTimeCallback = null;
629
629
  }
@@ -681,7 +681,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
681
681
  }
682
682
 
683
683
  // Set one time callback
684
- if (typeof callback === "function") {
684
+ if (typeof callback === 'function') {
685
685
  this.oneTimeCallback = callback;
686
686
  }
687
687
 
@@ -257,7 +257,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
257
257
 
258
258
  var $collapsibleLi = this.$el.children('li').eq(index);
259
259
  if ($collapsibleLi.length && !$collapsibleLi[0].classList.contains('active')) {
260
-
261
260
  // onOpenStart callback
262
261
  if (typeof this.options.onOpenStart === 'function') {
263
262
  this.options.onOpenStart.call(this, $collapsibleLi[0]);
@@ -289,7 +288,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
289
288
  value: function close(index) {
290
289
  var $collapsibleLi = this.$el.children('li').eq(index);
291
290
  if ($collapsibleLi.length && $collapsibleLi[0].classList.contains('active')) {
292
-
293
291
  // onCloseStart callback
294
292
  if (typeof this.options.onCloseStart === 'function') {
295
293
  this.options.onCloseStart.call(this, $collapsibleLi[0]);
@@ -12,6 +12,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
12
12
  'use strict';
13
13
 
14
14
  var _defaults = {
15
+ // Close when date is selected
16
+ autoClose: false,
15
17
 
16
18
  // the default output format for the input field value
17
19
  format: 'mmm dd, yyyy',
@@ -129,14 +131,13 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
129
131
 
130
132
  if (!_this.options.defaultDate) {
131
133
  _this.options.defaultDate = new Date(Date.parse(_this.el.value));
132
- _this.options.setDefaultDate = true;
133
134
  }
134
135
 
135
136
  var defDate = _this.options.defaultDate;
136
-
137
137
  if (Datepicker._isDate(defDate)) {
138
138
  if (_this.options.setDefaultDate) {
139
139
  _this.setDate(defDate, true);
140
+ _this.setInputValue();
140
141
  } else {
141
142
  _this.gotoDate(defDate);
142
143
  }
@@ -149,7 +150,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
149
150
  * @type {Boolean}
150
151
  */
151
152
  _this.isOpen = false;
152
-
153
153
  return _this;
154
154
  }
155
155
 
@@ -170,11 +170,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
170
170
  }, {
171
171
  key: 'destroySelects',
172
172
  value: function destroySelects() {
173
- var oldYearSelect = this.calendarEl.querySelector('.pika-select-year');
173
+ var oldYearSelect = this.calendarEl.querySelector('.orig-select-year');
174
174
  if (oldYearSelect) {
175
175
  M.FormSelect.getInstance(oldYearSelect).destroy();
176
176
  }
177
- var oldMonthSelect = this.calendarEl.querySelector('.pika-select-month');
177
+ var oldMonthSelect = this.calendarEl.querySelector('.orig-select-month');
178
178
  if (oldMonthSelect) {
179
179
  M.FormSelect.getInstance(oldMonthSelect).destroy();
180
180
  }
@@ -309,9 +309,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
309
309
  month: date.getMonth(),
310
310
  year: date.getFullYear()
311
311
  }];
312
- // if (this.options.mainCalendar === 'right') {
313
- // this.calendars[0].month += 1 - this.options.numberOfMonths;
314
- // }
315
312
  }
316
313
 
317
314
  this.adjustCalendars();
@@ -320,12 +317,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
320
317
  key: 'adjustCalendars',
321
318
  value: function adjustCalendars() {
322
319
  this.calendars[0] = this.adjustCalendar(this.calendars[0]);
323
- // for (let c = 1; c < this.options.numberOfMonths; c++) {
324
- // this.calendars[c] = this.adjustCalendar({
325
- // month: this.calendars[0].month + c,
326
- // year: this.calendars[0].year
327
- // });
328
- // }
329
320
  this.draw();
330
321
  }
331
322
  }, {
@@ -469,12 +460,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
469
460
  if (opts.isEndRange) {
470
461
  arr.push('is-endrange');
471
462
  }
472
- 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>';
463
+ 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>';
473
464
  }
474
465
  }, {
475
466
  key: 'renderRow',
476
467
  value: function renderRow(days, isRTL, isRowSelected) {
477
- return '<tr class="pika-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
468
+ return '<tr class="datepicker-row' + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>';
478
469
  }
479
470
  }, {
480
471
  key: 'renderTable',
@@ -515,7 +506,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
515
506
  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>');
516
507
  }
517
508
 
518
- monthHtml = '<select class="pika-select pika-select-month" tabindex="-1">' + arr.join('') + '</select>';
509
+ monthHtml = '<select class="datepicker-select orig-select-month" tabindex="-1">' + arr.join('') + '</select>';
519
510
 
520
511
  if ($.isArray(opts.yearRange)) {
521
512
  i = opts.yearRange[0];
@@ -527,11 +518,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
527
518
 
528
519
  for (arr = []; i < j && i <= opts.maxYear; i++) {
529
520
  if (i >= opts.minYear) {
530
- arr.push('<option value="' + i + '"' + (i === year ? ' selected="selected"' : '') + '>' + i + '</option>');
521
+ arr.push('<option value="' + i + '" ' + (i === year ? 'selected="selected"' : '') + '>' + i + '</option>');
531
522
  }
532
523
  }
533
524
 
534
- yearHtml = '<select class="pika-select pika-select-year" tabindex="-1">' + arr.join('') + '</select>';
525
+ yearHtml = '<select class="datepicker-select orig-select-year" tabindex="-1">' + arr.join('') + '</select>';
535
526
 
536
527
  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>';
537
528
  html += '<button class="month-prev' + (prev ? '' : ' is-disabled') + '" type="button">' + leftArrow + '</button>';
@@ -552,10 +543,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
552
543
  next = false;
553
544
  }
554
545
 
555
- // if (c === (this.options.numberOfMonths - 1) ) {
556
546
  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>';
557
547
  html += '<button class="month-next' + (next ? '' : ' is-disabled') + '" type="button">' + rightArrow + '</button>';
558
- // }
559
548
 
560
549
  return html += '</div>';
561
550
  }
@@ -591,7 +580,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
591
580
  }
592
581
  }
593
582
 
594
- randId = 'pika-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
583
+ randId = 'datepicker-title-' + Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 2);
595
584
 
596
585
  for (var c = 0; c < 1; c++) {
597
586
  this._renderDateDisplay();
@@ -603,10 +592,16 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
603
592
  this.calendarEl.innerHTML = html;
604
593
 
605
594
  // Init Materialize Select
606
- var yearSelect = this.calendarEl.querySelector('.pika-select-year');
607
- var monthSelect = this.calendarEl.querySelector('.pika-select-month');
608
- M.FormSelect.init(yearSelect, { classes: 'select-year', dropdownOptions: { container: document.body, constrainWidth: false } });
609
- M.FormSelect.init(monthSelect, { classes: 'select-month', dropdownOptions: { container: document.body, constrainWidth: false } });
595
+ var yearSelect = this.calendarEl.querySelector('.orig-select-year');
596
+ var monthSelect = this.calendarEl.querySelector('.orig-select-month');
597
+ M.FormSelect.init(yearSelect, {
598
+ classes: 'select-year',
599
+ dropdownOptions: { container: document.body, constrainWidth: false }
600
+ });
601
+ M.FormSelect.init(monthSelect, {
602
+ classes: 'select-month',
603
+ dropdownOptions: { container: document.body, constrainWidth: false }
604
+ });
610
605
 
611
606
  // Add change handlers for select
612
607
  yearSelect.addEventListener('change', this._handleYearChange.bind(this));
@@ -652,7 +647,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
652
647
  this.$modalEl = $(Datepicker._template);
653
648
  this.modalEl = this.$modalEl[0];
654
649
 
655
- this.calendarEl = this.modalEl.querySelector('.pika-single');
650
+ this.calendarEl = this.modalEl.querySelector('.datepicker-calendar');
656
651
 
657
652
  this.yearTextEl = this.modalEl.querySelector('.year-text');
658
653
  this.dateTextEl = this.modalEl.querySelector('.date-text');
@@ -663,7 +658,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
663
658
  this.cancelBtn = this.modalEl.querySelector('.datepicker-cancel');
664
659
 
665
660
  this.formats = {
666
-
667
661
  d: function () {
668
662
  return _this4.date.getDate();
669
663
  },
@@ -734,24 +728,16 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
734
728
  var $target = $(e.target);
735
729
  if (!$target.hasClass('is-disabled')) {
736
730
  if ($target.hasClass('datepicker-day-button') && !$target.hasClass('is-empty') && !$target.parent().hasClass('is-disabled')) {
737
- this.setDate(new Date(e.target.getAttribute('data-pika-year'), e.target.getAttribute('data-pika-month'), e.target.getAttribute('data-pika-day')));
731
+ this.setDate(new Date(e.target.getAttribute('data-year'), e.target.getAttribute('data-month'), e.target.getAttribute('data-day')));
732
+ if (this.options.autoClose) {
733
+ this._finishSelection();
734
+ }
738
735
  } else if ($target.closest('.month-prev').length) {
739
736
  this.prevMonth();
740
737
  } else if ($target.closest('.month-next').length) {
741
738
  this.nextMonth();
742
739
  }
743
740
  }
744
- // if (!$target.hasClass('pika-select')) {
745
- // // if this is touch event prevent mouse events emulation
746
- // // if (e.preventDefault) {
747
- // // e.preventDefault();
748
- // // } else {
749
- // // e.returnValue = false;
750
- // // return false;
751
- // // }
752
- // } else {
753
- // this._c = true;
754
- // }
755
741
  }
756
742
  }, {
757
743
  key: '_handleClearClick',
@@ -814,9 +800,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
814
800
  if (Datepicker._isDate(date)) {
815
801
  this.setDate(date);
816
802
  }
817
- // if (!self._v) {
818
- // self.show();
819
- // }
820
803
  }
821
804
  }, {
822
805
  key: 'renderDayName',
@@ -942,7 +925,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
942
925
  return Datepicker;
943
926
  }(Component);
944
927
 
945
- 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('');
928
+ 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('');
946
929
 
947
930
  M.Datepicker = Datepicker;
948
931