material-sass 4.0.0.alpha6 → 4.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +36 -8
  4. data/Rakefile +16 -3
  5. data/app/assets/javascripts/material-sprockets.js +6 -1
  6. data/app/assets/javascripts/material.js +654 -417
  7. data/app/assets/javascripts/material.min.js +1 -0
  8. data/app/assets/javascripts/material/addons/picker.date.js +234 -0
  9. data/app/assets/javascripts/material/addons/picker.js +172 -0
  10. data/app/assets/javascripts/material/addons/textarea-autosize.js +20 -2
  11. data/app/assets/javascripts/material/addons/waves.js +127 -0
  12. data/app/assets/javascripts/material/components/floating-label.js +92 -0
  13. data/app/assets/javascripts/material/components/navdrawer.js +353 -0
  14. data/app/assets/javascripts/material/components/selection-control-focus.js +47 -0
  15. data/app/assets/javascripts/material/components/tab-switch.js +148 -0
  16. data/app/assets/javascripts/material/components/util.js +133 -0
  17. data/app/assets/javascripts/material/initializers/picker.js +171 -0
  18. data/app/assets/javascripts/material/initializers/textarea-autosize.js +10 -0
  19. data/app/assets/javascripts/material/initializers/waves.js +13 -0
  20. data/app/assets/stylesheets/material/_colours.scss +324 -0
  21. data/app/assets/stylesheets/material/_functions.scss +65 -0
  22. data/app/assets/stylesheets/material/_mixins.scss +23 -23
  23. data/app/assets/stylesheets/material/_print.scss +102 -0
  24. data/app/assets/stylesheets/material/_utilities.scss +21 -17
  25. data/app/assets/stylesheets/material/_variables.scss +13 -42
  26. data/app/assets/stylesheets/material/base/_base.scss +420 -5
  27. data/app/assets/stylesheets/material/base/_grid.scss +34 -33
  28. data/app/assets/stylesheets/material/base/_typography.scss +165 -174
  29. data/app/assets/stylesheets/material/bootstrap/_alert.scss +32 -39
  30. data/app/assets/stylesheets/material/bootstrap/_badge.scss +34 -0
  31. data/app/assets/stylesheets/material/bootstrap/_breadcrumb.scss +18 -18
  32. data/app/assets/stylesheets/material/bootstrap/_carousel.scss +127 -142
  33. data/app/assets/stylesheets/material/bootstrap/_close.scss +18 -19
  34. data/app/assets/stylesheets/material/bootstrap/_code.scss +10 -7
  35. data/app/assets/stylesheets/material/bootstrap/_custom-form.scss +50 -56
  36. data/app/assets/stylesheets/material/bootstrap/_form.scss +159 -129
  37. data/app/assets/stylesheets/material/bootstrap/_image.scss +19 -16
  38. data/app/assets/stylesheets/material/bootstrap/_jumbotron.scss +10 -7
  39. data/app/assets/stylesheets/material/bootstrap/_nav.scss +71 -69
  40. data/app/assets/stylesheets/material/bootstrap/_pagination.scss +34 -26
  41. data/app/assets/stylesheets/material/bootstrap/_popover.scss +26 -59
  42. data/app/assets/stylesheets/material/bootstrap/_responsive-embed.scss +4 -4
  43. data/app/assets/stylesheets/material/bootstrap/_transition.scss +10 -8
  44. data/app/assets/stylesheets/material/material.scss +75 -62
  45. data/app/assets/stylesheets/material/material/_button-flat.scss +26 -39
  46. data/app/assets/stylesheets/material/material/_button-float.scss +10 -14
  47. data/app/assets/stylesheets/material/material/_button-group.scss +268 -0
  48. data/app/assets/stylesheets/material/material/_button.scss +133 -189
  49. data/app/assets/stylesheets/material/material/_card.scss +300 -248
  50. data/app/assets/stylesheets/material/material/_chip.scss +65 -64
  51. data/app/assets/stylesheets/material/material/_data-table.scss +135 -45
  52. data/app/assets/stylesheets/material/material/_dialog.scss +141 -110
  53. data/app/assets/stylesheets/material/material/_expansion-panel.scss +86 -119
  54. data/app/assets/stylesheets/material/material/_menu.scss +308 -228
  55. data/app/assets/stylesheets/material/material/_navdrawer.scss +239 -234
  56. data/app/assets/stylesheets/material/material/_picker.scss +157 -155
  57. data/app/assets/stylesheets/material/material/_progress-circular.scss +80 -80
  58. data/app/assets/stylesheets/material/material/_progress.scss +180 -115
  59. data/app/assets/stylesheets/material/material/_selection-control.scss +132 -139
  60. data/app/assets/stylesheets/material/material/_stepper.scss +94 -93
  61. data/app/assets/stylesheets/material/material/_tab.scss +74 -93
  62. data/app/assets/stylesheets/material/material/_text-field-floating-label.scss +29 -20
  63. data/app/assets/stylesheets/material/material/_text-field-input-group.scss +94 -24
  64. data/app/assets/stylesheets/material/material/_text-field-textarea.scss +13 -26
  65. data/app/assets/stylesheets/material/material/_text-field.scss +127 -118
  66. data/app/assets/stylesheets/material/material/_toolbar.scss +308 -313
  67. data/app/assets/stylesheets/material/material/_tooltip.scss +23 -62
  68. data/app/assets/stylesheets/material/mixins/_background-variant.scss +6 -6
  69. data/app/assets/stylesheets/material/mixins/_border-radius.scss +17 -17
  70. data/app/assets/stylesheets/material/mixins/_breakpoint.scss +32 -2
  71. data/app/assets/stylesheets/material/mixins/_clearfix.scss +1 -1
  72. data/app/assets/stylesheets/material/mixins/_form.scss +62 -25
  73. data/app/assets/stylesheets/material/mixins/_grid-framework.scss +8 -16
  74. data/app/assets/stylesheets/material/mixins/_grid.scss +40 -64
  75. data/app/assets/stylesheets/material/mixins/_material-icons.scss +36 -0
  76. data/app/assets/stylesheets/material/mixins/_nav-divider.scss +1 -1
  77. data/app/assets/stylesheets/material/mixins/_reset-text.scss +2 -21
  78. data/app/assets/stylesheets/material/mixins/_screenreader.scss +14 -12
  79. data/app/assets/stylesheets/material/mixins/_text-alignment.scss +23 -0
  80. data/app/assets/stylesheets/material/mixins/_text-emphasis.scss +6 -6
  81. data/app/assets/stylesheets/material/mixins/_transition.scss +42 -10
  82. data/app/assets/stylesheets/material/utilities/_background.scss +18 -18
  83. data/app/assets/stylesheets/material/utilities/_border.scss +88 -41
  84. data/app/assets/stylesheets/material/utilities/_display.scss +63 -30
  85. data/app/assets/stylesheets/material/utilities/_flex.scss +139 -134
  86. data/app/assets/stylesheets/material/utilities/_material-icons.scss +3 -5
  87. data/app/assets/stylesheets/material/utilities/_position.scss +19 -22
  88. data/app/assets/stylesheets/material/utilities/_sizing.scss +11 -12
  89. data/app/assets/stylesheets/material/utilities/_spacing.scss +51 -56
  90. data/app/assets/stylesheets/material/utilities/_text.scss +80 -75
  91. data/app/assets/stylesheets/material/utilities/_visibility.scss +5 -46
  92. data/app/assets/stylesheets/material/utilities/_waves.scss +11 -18
  93. data/app/assets/stylesheets/material/variables/_elevation-shadow.scss +89 -82
  94. data/app/assets/stylesheets/material/variables/_grid.scss +29 -26
  95. data/app/assets/stylesheets/material/variables/_palette.scss +45 -0
  96. data/app/assets/stylesheets/material/variables/_spacer.scss +34 -88
  97. data/app/assets/stylesheets/material/variables/_transition.scss +29 -0
  98. data/app/assets/stylesheets/material/variables/_typography.scss +88 -74
  99. data/app/assets/stylesheets/material/variables/_variable-bootstrap.scss +196 -133
  100. data/app/assets/stylesheets/material/variables/_variable-material.scss +481 -429
  101. data/lib/material-sass/version.rb +1 -1
  102. data/material-sass.gemspec +3 -3
  103. metadata +26 -21
  104. data/app/assets/javascripts/material/addons-materialise/pickadate.js +0 -139
  105. data/app/assets/javascripts/material/addons-materialise/textarea-autosize.js +0 -11
  106. data/app/assets/javascripts/material/addons-materialise/wave.js +0 -15
  107. data/app/assets/javascripts/material/addons/pickadate.js +0 -7
  108. data/app/assets/javascripts/material/addons/wave.js +0 -5
  109. data/app/assets/javascripts/material/src/floating-label.js +0 -91
  110. data/app/assets/javascripts/material/src/navdrawer.js +0 -352
  111. data/app/assets/javascripts/material/src/tab-switch.js +0 -133
  112. data/app/assets/javascripts/material/src/util.js +0 -138
  113. data/app/assets/stylesheets/material/base/_normalize.scss +0 -253
  114. data/app/assets/stylesheets/material/base/_reboot.scss +0 -239
  115. data/app/assets/stylesheets/material/bootstrap/_button-group.scss +0 -134
  116. data/app/assets/stylesheets/material/mixins/_tab-focus.scss +0 -5
  117. data/app/assets/stylesheets/material/mixins/_transform.scss +0 -9
  118. data/app/assets/stylesheets/material/variables/_animation.scss +0 -22
  119. data/app/assets/stylesheets/material/variables/_colour.scss +0 -389
@@ -0,0 +1,92 @@
1
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
+
3
+ /*
4
+ * floating label:
5
+ * when a user engages with the text input field,
6
+ * the floating inline labels move to float above the field
7
+ */
8
+
9
+ var FloatingLabel = function ($) {
10
+
11
+ // constants >>>
12
+ var DATA_KEY = 'md.floatinglabel';
13
+ var EVENT_KEY = '.' + DATA_KEY;
14
+ var NAME = 'floatinglabel';
15
+ var NO_CONFLICT = $.fn[NAME];
16
+
17
+ var ClassName = {
18
+ IS_FOCUSED: 'is-focused',
19
+ HAS_VALUE: 'has-value'
20
+ };
21
+
22
+ var Event = {
23
+ CHANGE: 'change' + EVENT_KEY,
24
+ FOCUSIN: 'focusin' + EVENT_KEY,
25
+ FOCUSOUT: 'focusout' + EVENT_KEY
26
+ };
27
+
28
+ var Selector = {
29
+ DATA_PARENT: '.floating-label',
30
+ DATA_TOGGLE: '.floating-label .form-control'
31
+ };
32
+ // <<< constants
33
+
34
+ var FloatingLabel = function () {
35
+ function FloatingLabel(element) {
36
+ _classCallCheck(this, FloatingLabel);
37
+
38
+ this._element = element;
39
+ }
40
+
41
+ FloatingLabel.prototype.change = function change(relatedTarget) {
42
+ if ($(this._element).val() || $(this._element).is('select') && $('option:first-child', $(this._element)).html().replace(' ', '') !== '') {
43
+ $(relatedTarget).addClass(ClassName.HAS_VALUE);
44
+ } else {
45
+ $(relatedTarget).removeClass(ClassName.HAS_VALUE);
46
+ }
47
+ };
48
+
49
+ FloatingLabel.prototype.focusin = function focusin(relatedTarget) {
50
+ $(relatedTarget).addClass(ClassName.IS_FOCUSED);
51
+ };
52
+
53
+ FloatingLabel.prototype.focusout = function focusout(relatedTarget) {
54
+ $(relatedTarget).removeClass(ClassName.IS_FOCUSED);
55
+ };
56
+
57
+ FloatingLabel._jQueryInterface = function _jQueryInterface(event) {
58
+ return this.each(function () {
59
+ var _event = event ? event : 'change';
60
+ var data = $(this).data(DATA_KEY);
61
+
62
+ if (!data) {
63
+ data = new FloatingLabel(this);
64
+ $(this).data(DATA_KEY, data);
65
+ }
66
+
67
+ if (typeof _event === 'string') {
68
+ if (data[_event] === undefined) {
69
+ throw new Error('No method named "' + _event + '"');
70
+ }
71
+
72
+ data[_event]($(this).closest(Selector.DATA_PARENT));
73
+ }
74
+ });
75
+ };
76
+
77
+ return FloatingLabel;
78
+ }();
79
+
80
+ $(document).on(Event.CHANGE + ' ' + Event.FOCUSIN + ' ' + Event.FOCUSOUT, Selector.DATA_TOGGLE, function (event) {
81
+ FloatingLabel._jQueryInterface.call($(this), event.type);
82
+ });
83
+
84
+ $.fn[NAME] = FloatingLabel._jQueryInterface;
85
+ $.fn[NAME].Constructor = FloatingLabel;
86
+ $.fn[NAME].noConflict = function () {
87
+ $.fn[NAME] = NO_CONFLICT;
88
+ return FloatingLabel._jQueryInterface;
89
+ };
90
+
91
+ return FloatingLabel;
92
+ }(jQuery);
@@ -0,0 +1,353 @@
1
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
2
+
3
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
+
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
7
+ /*
8
+ * navigation drawer
9
+ * based on bootstrap's (v4.0.0-beta) modal.js
10
+ */
11
+
12
+ var NavDrawer = function ($) {
13
+
14
+ // constants >>>
15
+ var DATA_API_KEY = '.data-api';
16
+ var DATA_KEY = 'md.navdrawer';
17
+ var ESCAPE_KEYCODE = 27;
18
+ var EVENT_KEY = '.' + DATA_KEY;
19
+ var NAME = 'navdrawer';
20
+ var NO_CONFLICT = $.fn[NAME];
21
+ var TRANSITION_DURATION = 292.5;
22
+ var TRANSITION_DURATION_BACKDROP = 487.5;
23
+
24
+ var ClassName = {
25
+ BACKDROP: 'navdrawer-backdrop',
26
+ OPEN: 'navdrawer-open',
27
+ SHOW: 'show'
28
+ };
29
+
30
+ var Default = {
31
+ breakpoint: 1280,
32
+ keyboard: true,
33
+ show: true,
34
+ type: 'default'
35
+ };
36
+
37
+ var DefaultType = {
38
+ keyboard: 'boolean',
39
+ show: 'boolean',
40
+ type: 'string'
41
+ };
42
+
43
+ var Event = {
44
+ CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY,
45
+ CLICK_DISMISS: 'click.dismiss' + EVENT_KEY,
46
+ FOCUSIN: 'focusin' + EVENT_KEY,
47
+ HIDDEN: 'hidden' + EVENT_KEY,
48
+ HIDE: 'hide' + EVENT_KEY,
49
+ KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY,
50
+ MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY,
51
+ MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY,
52
+ SHOW: 'show' + EVENT_KEY,
53
+ SHOWN: 'shown' + EVENT_KEY
54
+ };
55
+
56
+ var Selector = {
57
+ CONTENT: '.navdrawer-content',
58
+ DATA_DISMISS: '[data-dismiss="navdrawer"]',
59
+ DATA_TOGGLE: '[data-toggle="navdrawer"]'
60
+ };
61
+ // <<< constants
62
+
63
+ var NavDrawer = function () {
64
+ function NavDrawer(element, config) {
65
+ _classCallCheck(this, NavDrawer);
66
+
67
+ this._backdrop = null;
68
+ this._config = this._getConfig(config);
69
+ this._content = $(element).find(Selector.CONTENT)[0];
70
+ this._element = element;
71
+ this._ignoreBackdropClick = false;
72
+ this._isShown = false;
73
+ }
74
+
75
+ NavDrawer.prototype.hide = function hide(event) {
76
+ if (event) {
77
+ event.preventDefault();
78
+ }
79
+
80
+ var hideClassName = ClassName.OPEN + '-' + this._config.type;
81
+ var hideEvent = $.Event(Event.HIDE);
82
+
83
+ $(this._element).trigger(hideEvent);
84
+
85
+ if (!this._isShown || hideEvent.isDefaultPrevented()) {
86
+ return;
87
+ }
88
+
89
+ this._isShown = false;
90
+ this._setEscapeEvent();
91
+ $(document).off(Event.FOCUSIN);
92
+ $(this._content).off(Event.MOUSEDOWN_DISMISS);
93
+
94
+ $(this._element).off(Event.CLICK_DISMISS).removeClass(ClassName.SHOW);
95
+
96
+ this._hideNavdrawer(hideClassName);
97
+ };
98
+
99
+ NavDrawer.prototype.show = function show(relatedTarget) {
100
+ var _this = this;
101
+
102
+ var showEvent = $.Event(Event.SHOW, {
103
+ relatedTarget: relatedTarget
104
+ });
105
+
106
+ $(this._element).trigger(showEvent);
107
+
108
+ if (this._isShown || showEvent.isDefaultPrevented()) {
109
+ return;
110
+ }
111
+
112
+ this._isShown = true;
113
+ $(document.body).addClass(ClassName.OPEN + '-' + this._config.type);
114
+ this._setEscapeEvent();
115
+ $(this._element).addClass(NAME + '-' + this._config.type);
116
+ $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, $.proxy(this.hide, this));
117
+
118
+ $(this._content).on(Event.MOUSEDOWN_DISMISS, function () {
119
+ $(_this._element).one(Event.MOUSEUP_DISMISS, function (event) {
120
+ if ($(event.target).is(_this._element)) {
121
+ _this._ignoreBackdropClick = true;
122
+ }
123
+ });
124
+ });
125
+
126
+ this._showBackdrop();
127
+ this._showElement(relatedTarget);
128
+ };
129
+
130
+ NavDrawer.prototype.toggle = function toggle(relatedTarget) {
131
+ return this._isShown ? this.hide() : this.show(relatedTarget);
132
+ };
133
+
134
+ NavDrawer.prototype._enforceFocus = function _enforceFocus() {
135
+ var _this2 = this;
136
+
137
+ $(document).off(Event.FOCUSIN).on(Event.FOCUSIN, function (event) {
138
+ if (_this2._config.type === 'default' || $(window).width() <= _this2._config.breakpoint) {
139
+ if (_this2._element !== event.target && !$(_this2._element).has(event.target).length) {
140
+ _this2._element.focus();
141
+ }
142
+ }
143
+ });
144
+ };
145
+
146
+ NavDrawer.prototype._getConfig = function _getConfig(config) {
147
+ config = $.extend({}, Default, config);
148
+ Util.typeCheckConfig(NAME, config, DefaultType);
149
+ return config;
150
+ };
151
+
152
+ NavDrawer.prototype._hideNavdrawer = function _hideNavdrawer(className) {
153
+ var _this3 = this;
154
+
155
+ this._showBackdrop(function () {
156
+ $(document.body).removeClass(className);
157
+
158
+ _this3._element.setAttribute('aria-hidden', 'true');
159
+ _this3._element.style.display = 'none';
160
+
161
+ $(_this3._element).trigger(Event.HIDDEN);
162
+ });
163
+ };
164
+
165
+ NavDrawer.prototype._removeBackdrop = function _removeBackdrop() {
166
+ if (this._backdrop) {
167
+ $(this._backdrop).remove();
168
+ this._backdrop = null;
169
+ }
170
+ };
171
+
172
+ NavDrawer.prototype._setEscapeEvent = function _setEscapeEvent() {
173
+ var _this4 = this;
174
+
175
+ if (this._isShown && this._config.keyboard) {
176
+ $(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
177
+ if (event.which === ESCAPE_KEYCODE) {
178
+ _this4.hide();
179
+ }
180
+ });
181
+ } else if (!this._isShown) {
182
+ $(this._element).off(Event.KEYDOWN_DISMISS);
183
+ }
184
+ };
185
+
186
+ NavDrawer.prototype._showBackdrop = function _showBackdrop(callback) {
187
+ var _this5 = this;
188
+
189
+ var supportsTransition = Util.supportsTransitionEnd();
190
+
191
+ if (this._isShown) {
192
+ this._backdrop = document.createElement('div');
193
+
194
+ $(this._backdrop).addClass(ClassName.BACKDROP).addClass(ClassName.BACKDROP + '-' + this._config.type).appendTo(document.body);
195
+
196
+ $(this._element).on(Event.CLICK_DISMISS, function (event) {
197
+ if (_this5._ignoreBackdropClick) {
198
+ _this5._ignoreBackdropClick = false;
199
+ return;
200
+ }
201
+
202
+ if (event.target !== event.currentTarget) {
203
+ return;
204
+ }
205
+
206
+ _this5.hide();
207
+ });
208
+
209
+ if (supportsTransition) {
210
+ Util.reflow(this._backdrop);
211
+ }
212
+
213
+ $(this._backdrop).addClass(ClassName.SHOW);
214
+
215
+ if (!callback) {
216
+ return;
217
+ }
218
+
219
+ if (!supportsTransition) {
220
+ callback();
221
+ return;
222
+ }
223
+
224
+ $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(TRANSITION_DURATION_BACKDROP);
225
+ } else if (this._backdrop && !this._isShown) {
226
+ $(this._backdrop).removeClass(ClassName.SHOW);
227
+
228
+ var callbackRemove = function callbackRemove() {
229
+ _this5._removeBackdrop();
230
+
231
+ if (callback) {
232
+ callback();
233
+ }
234
+ };
235
+
236
+ if (supportsTransition) {
237
+ $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(TRANSITION_DURATION_BACKDROP);
238
+ } else {
239
+ callbackRemove();
240
+ }
241
+ } else if (callback) {
242
+ callback();
243
+ }
244
+ };
245
+
246
+ NavDrawer.prototype._showElement = function _showElement(relatedTarget) {
247
+ var _this6 = this;
248
+
249
+ var supportsTransition = Util.supportsTransitionEnd();
250
+
251
+ if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
252
+ document.body.appendChild(this._element);
253
+ }
254
+
255
+ this._element.removeAttribute('aria-hidden');
256
+ this._element.style.display = 'block';
257
+
258
+ if (supportsTransition) {
259
+ Util.reflow(this._element);
260
+ }
261
+
262
+ $(this._element).addClass(ClassName.SHOW);
263
+ this._enforceFocus();
264
+
265
+ var shownEvent = $.Event(Event.SHOWN, {
266
+ relatedTarget: relatedTarget
267
+ });
268
+
269
+ var transitionComplete = function transitionComplete() {
270
+ _this6._element.focus();
271
+ $(_this6._element).trigger(shownEvent);
272
+ };
273
+
274
+ if (supportsTransition) {
275
+ $(this._content).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION);
276
+ } else {
277
+ transitionComplete();
278
+ }
279
+ };
280
+
281
+ NavDrawer._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
282
+ return this.each(function () {
283
+ var _config = $.extend({}, NavDrawer.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config);
284
+
285
+ var data = $(this).data(DATA_KEY);
286
+
287
+ if (!data) {
288
+ data = new NavDrawer(this, _config);
289
+ $(this).data(DATA_KEY, data);
290
+ }
291
+
292
+ if (typeof config === 'string') {
293
+ if (data[config] === undefined) {
294
+ throw new Error('No method named "' + config + '"');
295
+ }
296
+
297
+ data[config](relatedTarget);
298
+ } else if (_config.show) {
299
+ data.show(relatedTarget);
300
+ }
301
+ });
302
+ };
303
+
304
+ _createClass(NavDrawer, null, [{
305
+ key: 'Default',
306
+ get: function get() {
307
+ return Default;
308
+ }
309
+ }]);
310
+
311
+ return NavDrawer;
312
+ }();
313
+
314
+ $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
315
+ var _this7 = this;
316
+
317
+ var selector = Util.getSelectorFromElement(this);
318
+ var target = void 0;
319
+
320
+ if (selector) {
321
+ target = $(selector)[0];
322
+ }
323
+
324
+ var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data());
325
+
326
+ if (this.tagName === 'A') {
327
+ event.preventDefault();
328
+ }
329
+
330
+ var $target = $(target).one(Event.SHOW, function (showEvent) {
331
+ if (showEvent.isDefaultPrevented()) {
332
+ return;
333
+ }
334
+
335
+ $target.one(Event.HIDDEN, function () {
336
+ if ($(_this7).is(':visible')) {
337
+ _this7.focus();
338
+ }
339
+ });
340
+ });
341
+
342
+ NavDrawer._jQueryInterface.call($(target), config, this);
343
+ });
344
+
345
+ $.fn[NAME] = NavDrawer._jQueryInterface;
346
+ $.fn[NAME].Constructor = NavDrawer;
347
+ $.fn[NAME].noConflict = function () {
348
+ $.fn[NAME] = NO_CONFLICT;
349
+ return NavDrawer._jQueryInterface;
350
+ };
351
+
352
+ return NavDrawer;
353
+ }(jQuery);
@@ -0,0 +1,47 @@
1
+ /*
2
+ * selection control focus:
3
+ * chrome persists the focus style on checkboxes/radio buttons
4
+ * after clicking with the mouse
5
+ */
6
+
7
+ var ControlFocus = function ($) {
8
+
9
+ // constants >>>
10
+ var DATA_KEY = 'md.controlfocus';
11
+ var EVENT_KEY = '.' + DATA_KEY;
12
+
13
+ var ClassName = {
14
+ FOCUS: 'focus'
15
+ };
16
+
17
+ var LastInteraction = {
18
+ IS_MOUSEDOWN: false
19
+ };
20
+
21
+ var Event = {
22
+ BLUR: 'blur' + EVENT_KEY,
23
+ FOCUS: 'focus' + EVENT_KEY,
24
+ MOUSEDOWN: 'mousedown' + EVENT_KEY,
25
+ MOUSEUP: 'mouseup' + EVENT_KEY
26
+ };
27
+
28
+ var Selector = {
29
+ CONTROL: '.custom-control',
30
+ INPUT: '.custom-control-input'
31
+ };
32
+ // <<< constants
33
+
34
+ $(document).on('' + Event.BLUR, Selector.INPUT, function (event) {
35
+ $(event.target).removeClass(ClassName.FOCUS);
36
+ }).on('' + Event.FOCUS, Selector.INPUT, function (event) {
37
+ if (LastInteraction.IS_MOUSEDOWN === false) {
38
+ $(event.target).addClass(ClassName.FOCUS);
39
+ }
40
+ }).on('' + Event.MOUSEDOWN, Selector.CONTROL, function () {
41
+ LastInteraction.IS_MOUSEDOWN = true;
42
+ }).on('' + Event.MOUSEUP, Selector.CONTROL, function () {
43
+ setTimeout(function () {
44
+ LastInteraction.IS_MOUSEDOWN = false;
45
+ }, 1);
46
+ });
47
+ }(jQuery);