materialize-sass 0.98.0 → 0.98.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -2
  3. data/app/assets/javascripts/materialize-sprockets.js +2 -1
  4. data/app/assets/javascripts/materialize.js +4 -4
  5. data/app/assets/javascripts/materialize/carousel.js +4 -2
  6. data/app/assets/javascripts/materialize/chips.js +22 -25
  7. data/app/assets/javascripts/materialize/collapsible.js +22 -8
  8. data/app/assets/javascripts/materialize/dropdown.js +1 -1
  9. data/app/assets/javascripts/materialize/extras/nouislider.js +1 -1
  10. data/app/assets/javascripts/materialize/forms.js +58 -64
  11. data/app/assets/javascripts/materialize/global.js +14 -1
  12. data/app/assets/javascripts/materialize/init.js +8 -6
  13. data/app/assets/javascripts/materialize/materialbox.js +22 -20
  14. data/app/assets/javascripts/materialize/sideNav.js +1 -1
  15. data/app/assets/javascripts/materialize/tabs.js +2 -2
  16. data/app/assets/javascripts/materialize/tapTarget.js +181 -0
  17. data/app/assets/stylesheets/materialize.scss +2 -0
  18. data/app/assets/stylesheets/materialize/components/_buttons.scss +5 -2
  19. data/app/assets/stylesheets/materialize/components/_chips.scss +5 -0
  20. data/app/assets/stylesheets/materialize/components/_dropdown.scss +3 -0
  21. data/app/assets/stylesheets/materialize/components/_grid.scss +40 -9
  22. data/app/assets/stylesheets/materialize/components/_pulse.scss +31 -0
  23. data/app/assets/stylesheets/materialize/components/_sideNav.scss +12 -11
  24. data/app/assets/stylesheets/materialize/components/_tapTarget.scss +105 -0
  25. data/app/assets/stylesheets/materialize/components/_variables.scss +3 -1
  26. data/app/assets/stylesheets/materialize/components/forms/_input-fields.scss +1 -1
  27. data/app/assets/stylesheets/materialize/extras/nouislider.css +1 -1
  28. data/lib/materialize-sass/version.rb +1 -1
  29. metadata +5 -2
@@ -51,7 +51,20 @@
51
51
  }(window));
52
52
 
53
53
 
54
- // Unique ID
54
+ /**
55
+ * Generate approximated selector string for a jQuery object
56
+ * @param {jQuery} obj jQuery object to be parsed
57
+ * @returns {string}
58
+ */
59
+ Materialize.objectSelectorString = function(obj) {
60
+ var tagStr = obj.prop('tagName') || '';
61
+ var idStr = obj.attr('id') || '';
62
+ var classStr = obj.attr('class') || '';
63
+ return (tagStr + idStr + classStr).replace(/\s/g,'');
64
+ };
65
+
66
+
67
+ // Unique Random ID
55
68
  Materialize.guid = (function() {
56
69
  function s4() {
57
70
  return Math.floor((1 + Math.random()) * 0x10000)
@@ -179,7 +179,7 @@
179
179
  $('.datepicker').pickadate({selectYears: 20});
180
180
  $('select').not('.disabled').material_select();
181
181
  $('input.autocomplete').autocomplete({
182
- data: {"Apple": null, "Microsoft": null, "Google": 'http://placehold.it/250x250'}
182
+ data: {"Apple": null, "Microsoft": null, "Google": 'http://placehold.it/250x250'},
183
183
  });
184
184
 
185
185
  // Chips
@@ -199,11 +199,13 @@
199
199
  secondaryPlaceholder: '+Tag',
200
200
  });
201
201
  $('.chips-autocomplete').material_chip({
202
- autocompleteData: {
203
- 'Apple': null,
204
- 'Microsoft': null,
205
- 'Google': null
206
- }
202
+ autocompleteOptions: {
203
+ data: {
204
+ 'Apple': null,
205
+ 'Microsoft': null,
206
+ 'Google': null
207
+ }
208
+ },
207
209
  });
208
210
 
209
211
 
@@ -235,7 +235,28 @@
235
235
  },
236
236
  {
237
237
  duration: outDuration,
238
- queue: false, easing: 'easeOutQuad'
238
+ queue: false, easing: 'easeOutQuad',
239
+ complete: function() {
240
+ placeholder.css({
241
+ height: '',
242
+ width: '',
243
+ position: '',
244
+ top: '',
245
+ left: ''
246
+ });
247
+
248
+ origin.removeAttr('style');
249
+ origin.attr('style', originInlineStyles);
250
+
251
+ // Remove class
252
+ origin.removeClass('active');
253
+ doneAnimating = true;
254
+
255
+ // Remove overflow overrides on ancestors
256
+ if (ancestorsChanged) {
257
+ ancestorsChanged.css('overflow', '');
258
+ }
259
+ }
239
260
  }
240
261
  );
241
262
 
@@ -244,26 +265,7 @@
244
265
  duration: outDuration, // Delay prevents animation overlapping
245
266
  queue: false, easing: 'easeOutQuad',
246
267
  complete: function(){
247
- placeholder.css({
248
- height: '',
249
- width: '',
250
- position: '',
251
- top: '',
252
- left: ''
253
- });
254
-
255
- origin.removeAttr('style');
256
- origin.attr('style', originInlineStyles);
257
-
258
- // Remove class
259
- origin.removeClass('active');
260
- doneAnimating = true;
261
268
  $(this).remove();
262
-
263
- // Remove overflow overrides on ancestors
264
- if (ancestorsChanged) {
265
- ancestorsChanged.css('overflow', '');
266
- }
267
269
  }
268
270
  });
269
271
 
@@ -221,7 +221,7 @@
221
221
  }).bind('panend', function(e) {
222
222
 
223
223
  if (e.gesture.pointerType == "touch") {
224
- var $overlay = $('<div id="sidenav-overlay"></div>');
224
+ var $overlay = $('#sidenav-overlay');
225
225
  var velocityX = e.gesture.velocityX;
226
226
  var x = e.gesture.center.x;
227
227
  var leftPos = x - options.menuWidth;
@@ -100,7 +100,7 @@
100
100
  $indicator.css({"left": calcLeftPos($active) });
101
101
  }, 0);
102
102
  }
103
- $(window).resize(function () {
103
+ $(window).off('resize.tabs').on('resize.tabs', function () {
104
104
  $tabs_width = $this.width();
105
105
  $tab_width = Math.max($tabs_width, $this[0].scrollWidth) / $links.length;
106
106
  if (index < 0) {
@@ -143,7 +143,7 @@
143
143
 
144
144
 
145
145
  // Bind the click event handler
146
- $this.on('click', 'a', function(e) {
146
+ $this.off('click.tabs').on('click.tabs', 'a', function(e) {
147
147
  if ($(this).parent().hasClass('disabled')) {
148
148
  e.preventDefault();
149
149
  return;
@@ -0,0 +1,181 @@
1
+ (function ($) {
2
+
3
+ var methods = {
4
+ init: function (options) {
5
+ return this.each(function() {
6
+ var origin = $('#'+$(this).attr('data-activates'));
7
+ var screen = $('body');
8
+
9
+ // Creating tap target
10
+ var tapTargetEl = $(this);
11
+ var tapTargetWrapper = tapTargetEl.parent('.tap-target-wrapper');
12
+ var tapTargetWave = tapTargetWrapper.find('.tap-target-wave');
13
+ var tapTargetOriginEl = tapTargetWrapper.find('.tap-target-origin');
14
+ var tapTargetContentEl = tapTargetEl.find('.tap-target-content');
15
+
16
+ // Creating wrapper
17
+ if (!tapTargetWrapper.length) {
18
+ tapTargetWrapper = tapTargetEl.wrap($('<div class="tap-target-wrapper"></div>')).parent();
19
+ }
20
+
21
+ // Creating content
22
+ if (!tapTargetContentEl.length) {
23
+ tapTargetContentEl = $('<div class="tap-target-content"></div>');
24
+ tapTargetEl.append(tapTargetContentEl);
25
+ }
26
+
27
+ // Creating foreground wave
28
+ if (!tapTargetWave.length) {
29
+ tapTargetWave = $('<div class="tap-target-wave"></div>');
30
+
31
+ // Creating origin
32
+ if (!tapTargetOriginEl.length) {
33
+ tapTargetOriginEl = origin.clone(true, true);
34
+ tapTargetOriginEl.addClass('tap-target-origin');
35
+ tapTargetOriginEl.removeAttr('id');
36
+ tapTargetOriginEl.removeAttr('style');
37
+ tapTargetWave.append(tapTargetOriginEl);
38
+ }
39
+
40
+ tapTargetWrapper.append(tapTargetWave);
41
+ }
42
+
43
+ // Open
44
+ var openTapTarget = function() {
45
+ if (tapTargetWrapper.is('.open')) {
46
+ return;
47
+ }
48
+
49
+ // Adding open class
50
+ tapTargetWrapper.addClass('open');
51
+
52
+ setTimeout(function() {
53
+ tapTargetOriginEl.off('click.tapTarget').on('click.tapTarget', function(e) {
54
+ closeTapTarget();
55
+ tapTargetOriginEl.off('click.tapTarget');
56
+ });
57
+
58
+ $(document).off('click.tapTarget').on('click.tapTarget', function(e) {
59
+ closeTapTarget();
60
+ $(document).off('click.tapTarget');
61
+ });
62
+ }, 0);
63
+ };
64
+
65
+ // Close
66
+ var closeTapTarget = function(){
67
+ if (!tapTargetWrapper.is('.open')) {
68
+ return;
69
+ }
70
+
71
+ tapTargetWrapper.removeClass('open');
72
+ tapTargetOriginEl.off('click.tapTarget')
73
+ $(document).off('click.tapTarget');
74
+ };
75
+
76
+ // Pre calculate
77
+ var calculateTapTarget = function() {
78
+ // Element or parent is fixed position?
79
+ var isFixed = origin.css('position') === 'fixed';
80
+ if (!isFixed) {
81
+ var parents = origin.parents();
82
+ for(var i = 0; i < parents.length; i++) {
83
+ isFixed = $(parents[i]).css('position') == 'fixed';
84
+ if (isFixed) {
85
+ break;
86
+ }
87
+ }
88
+ }
89
+
90
+ // Calculating origin
91
+ var originWidth = origin.outerWidth();
92
+ var originHeight = origin.outerHeight();
93
+ var originTop = isFixed ? origin.offset().top - $(document).scrollTop() : origin.offset().top;
94
+ var originLeft = isFixed ? origin.offset().left - $(document).scrollLeft() : origin.offset().left;
95
+
96
+ // Calculating screen
97
+ var windowWidth = $(window).width();
98
+ var windowHeight = $(window).height();
99
+ var centerX = windowWidth / 2;
100
+ var centerY = windowHeight / 2;
101
+ var isLeft = originLeft <= centerX;
102
+ var isRight = originLeft > centerX;
103
+ var isTop = originTop <= centerY;
104
+ var isBottom = originTop > centerY;
105
+ var isCenterX = originLeft >= windowWidth*0.25 && originLeft <= windowWidth*0.75;
106
+ var isCenterY = originTop >= windowHeight*0.25 && originTop <= windowHeight*0.75;
107
+
108
+ // Calculating tap target
109
+ var tapTargetWidth = tapTargetEl.outerWidth();
110
+ var tapTargetHeight = tapTargetEl.outerHeight();
111
+ var tapTargetTop = originTop + originHeight/2 - tapTargetHeight/2;
112
+ var tapTargetLeft = originLeft + originWidth/2 - tapTargetWidth/2;
113
+ var tapTargetPosition = isFixed ? 'fixed' : 'absolute';
114
+
115
+ // Calculating content
116
+ var tapTargetTextWidth = isCenterX ? tapTargetWidth : tapTargetWidth/2 + originWidth;
117
+ var tapTargetTextHeight = tapTargetHeight/2;
118
+ var tapTargetTextTop = isTop ? tapTargetHeight/2 : 0;
119
+ var tapTargetTextBottom = 0;
120
+ var tapTargetTextLeft = isLeft && !isCenterX ? tapTargetWidth/2 - originWidth : 0;
121
+ var tapTargetTextRight = 0;
122
+ var tapTargetTextPadding = originWidth;
123
+ var tapTargetTextAlign = isBottom ? 'bottom' : 'top';
124
+
125
+ // Calculating wave
126
+ var tapTargetWaveWidth = originWidth > originHeight ? originWidth*2 : originWidth*2;
127
+ var tapTargetWaveHeight = tapTargetWaveWidth;
128
+ var tapTargetWaveTop = tapTargetHeight/2 - tapTargetWaveHeight/2;
129
+ var tapTargetWaveLeft = tapTargetWidth/2 - tapTargetWaveWidth/2;
130
+
131
+ // Setting tap target
132
+ var tapTargetWrapperCssObj = {};
133
+ tapTargetWrapperCssObj.top = isTop ? tapTargetTop : '';
134
+ tapTargetWrapperCssObj.right = isRight ? windowWidth - tapTargetLeft - tapTargetWidth : '';
135
+ tapTargetWrapperCssObj.bottom = isBottom ? windowHeight - tapTargetTop - tapTargetHeight : '';
136
+ tapTargetWrapperCssObj.left = isLeft ? tapTargetLeft : '';
137
+ tapTargetWrapperCssObj.position = tapTargetPosition;
138
+ tapTargetWrapper.css(tapTargetWrapperCssObj);
139
+
140
+ // Setting content
141
+ tapTargetContentEl.css({
142
+ width: tapTargetTextWidth,
143
+ height: tapTargetTextHeight,
144
+ top: tapTargetTextTop,
145
+ right: tapTargetTextRight,
146
+ bottom: tapTargetTextBottom,
147
+ left: tapTargetTextLeft,
148
+ padding: tapTargetTextPadding,
149
+ verticalAlign: tapTargetTextAlign
150
+ });
151
+
152
+ // Setting wave
153
+ tapTargetWave.css({
154
+ top: tapTargetWaveTop,
155
+ left: tapTargetWaveLeft,
156
+ width: tapTargetWaveWidth,
157
+ height: tapTargetWaveHeight
158
+ });
159
+ }
160
+
161
+ if (options == 'open') {
162
+ calculateTapTarget();
163
+ openTapTarget();
164
+ }
165
+
166
+ if (options == 'close')
167
+ closeTapTarget();
168
+ });
169
+ },
170
+ open: function() {},
171
+ close: function() {}
172
+ };
173
+
174
+ $.fn.tapTarget = function(methodOrOptions) {
175
+ if (methods[methodOrOptions] || typeof methodOrOptions === 'object')
176
+ return methods.init.apply( this, arguments );
177
+
178
+ $.error( 'Method ' + methodOrOptions + ' does not exist on jQuery.tap-target' );
179
+ };
180
+
181
+ }( jQuery ));
@@ -37,6 +37,8 @@
37
37
  @import "materialize/components/preloader";
38
38
  @import "materialize/components/slider";
39
39
  @import "materialize/components/carousel";
40
+ @import "materialize/components/tapTarget";
41
+ @import "materialize/components/pulse";
40
42
  @import "materialize/components/date_picker/default";
41
43
  @import "materialize/components/date_picker/default.date";
42
44
  @import "materialize/components/date_picker/default.time";
@@ -89,6 +89,10 @@
89
89
  }
90
90
 
91
91
  &.btn-large {
92
+ &.halfway-fab {
93
+ bottom: -$button-floating-large-size / 2;
94
+ }
95
+
92
96
  width: $button-floating-large-size;
93
97
  height: $button-floating-large-size;
94
98
  i {
@@ -104,8 +108,7 @@
104
108
 
105
109
  position: absolute;
106
110
  right: 24px;
107
- bottom: 0;
108
- transform: translateY(50%);
111
+ bottom: -$button-floating-size / 2;
109
112
  }
110
113
 
111
114
  display: inline-block;
@@ -69,6 +69,11 @@
69
69
  border: 0 !important;
70
70
  box-shadow: none !important;
71
71
  }
72
+
73
+ // Autocomplete
74
+ .autocomplete-content {
75
+ margin-top: 0;
76
+ }
72
77
  }
73
78
 
74
79
  // Form prefix
@@ -52,6 +52,9 @@
52
52
  & > a > i {
53
53
  height: inherit;
54
54
  line-height: inherit;
55
+ float: left;
56
+ margin: 0 24px 0 0;
57
+ width: 24px;
55
58
  }
56
59
  }
57
60
  }
@@ -59,9 +59,10 @@
59
59
 
60
60
  $i: 1;
61
61
  @while $i <= $num-cols {
62
- $perc: unquote((100 / ($num-cols / $i)) + "%");
63
- &.s#{$i} {
64
- width: $perc;
62
+ &.s#{$i},
63
+ &.m#{$i},
64
+ &.l#{$i},
65
+ &.xl#{$i} {
65
66
  margin-left: auto;
66
67
  left: auto;
67
68
  right: auto;
@@ -69,6 +70,15 @@
69
70
  $i: $i + 1;
70
71
  }
71
72
 
73
+ $i: 1;
74
+ @while $i <= $num-cols {
75
+ $perc: unquote((100 / ($num-cols / $i)) + "%");
76
+ &.s#{$i} {
77
+ width: $perc;
78
+ }
79
+ $i: $i + 1;
80
+ }
81
+
72
82
  $i: 1;
73
83
  @while $i <= $num-cols {
74
84
  $perc: unquote((100 / ($num-cols / $i)) + "%");
@@ -91,9 +101,6 @@
91
101
  $perc: unquote((100 / ($num-cols / $i)) + "%");
92
102
  &.m#{$i} {
93
103
  width: $perc;
94
- margin-left: auto;
95
- left: auto;
96
- right: auto;
97
104
  }
98
105
  $i: $i + 1
99
106
  }
@@ -121,9 +128,6 @@
121
128
  $perc: unquote((100 / ($num-cols / $i)) + "%");
122
129
  &.l#{$i} {
123
130
  width: $perc;
124
- margin-left: auto;
125
- left: auto;
126
- right: auto;
127
131
  }
128
132
  $i: $i + 1;
129
133
  }
@@ -143,5 +147,32 @@
143
147
  $i: $i + 1;
144
148
  }
145
149
  }
150
+
151
+ @media #{$extra-large-and-up} {
152
+
153
+ $i: 1;
154
+ @while $i <= $num-cols {
155
+ $perc: unquote((100 / ($num-cols / $i)) + "%");
156
+ &.xl#{$i} {
157
+ width: $perc;
158
+ }
159
+ $i: $i + 1;
160
+ }
161
+
162
+ $i: 1;
163
+ @while $i <= $num-cols {
164
+ $perc: unquote((100 / ($num-cols / $i)) + "%");
165
+ &.offset-xl#{$i} {
166
+ margin-left: $perc;
167
+ }
168
+ &.pull-xl#{$i} {
169
+ right: $perc;
170
+ }
171
+ &.push-xl#{$i} {
172
+ left: $perc;
173
+ }
174
+ $i: $i + 1;
175
+ }
176
+ }
146
177
  }
147
178
  }