uikit-sass-rails 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/README.md +15 -12
  4. data/lib/uikit/sass/rails/engine.rb +1 -1
  5. data/lib/uikit/sass/rails/version.rb +1 -1
  6. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  7. data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
  8. data/vendor/assets/fonts/fontawesome-webfont.svg +525 -464
  9. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  10. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  11. data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
  12. data/vendor/assets/javascripts/uikit.js +30 -3
  13. data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
  14. data/vendor/assets/javascripts/uikit/components/autocomplete.js +48 -27
  15. data/vendor/assets/javascripts/uikit/components/datepicker.js +2887 -97
  16. data/vendor/assets/javascripts/uikit/components/form-password.js +24 -19
  17. data/vendor/assets/javascripts/uikit/components/form-select.js +24 -18
  18. data/vendor/assets/javascripts/uikit/components/grid.js +524 -0
  19. data/vendor/assets/javascripts/uikit/components/htmleditor.js +46 -39
  20. data/vendor/assets/javascripts/uikit/components/lightbox.js +543 -0
  21. data/vendor/assets/javascripts/uikit/components/nestable.js +125 -98
  22. data/vendor/assets/javascripts/uikit/components/notify.js +34 -22
  23. data/vendor/assets/javascripts/uikit/components/pagination.js +24 -21
  24. data/vendor/assets/javascripts/uikit/components/parallax.js +400 -0
  25. data/vendor/assets/javascripts/uikit/components/search.js +19 -16
  26. data/vendor/assets/javascripts/uikit/components/slider.js +482 -0
  27. data/vendor/assets/javascripts/uikit/components/slideset.js +498 -0
  28. data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +377 -0
  29. data/vendor/assets/javascripts/uikit/components/slideshow.js +540 -0
  30. data/vendor/assets/javascripts/uikit/components/sortable.js +392 -263
  31. data/vendor/assets/javascripts/uikit/components/sticky.js +127 -68
  32. data/vendor/assets/javascripts/uikit/components/timepicker.js +65 -42
  33. data/vendor/assets/javascripts/uikit/components/tooltip.js +220 -0
  34. data/vendor/assets/javascripts/uikit/components/upload.js +11 -10
  35. data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
  36. data/vendor/assets/javascripts/uikit/core/button.js +154 -0
  37. data/vendor/assets/javascripts/uikit/core/core.js +717 -0
  38. data/vendor/assets/javascripts/uikit/{components → core}/cover.js +41 -35
  39. data/vendor/assets/javascripts/uikit/core/dropdown.js +296 -0
  40. data/vendor/assets/javascripts/uikit/core/grid.js +172 -0
  41. data/vendor/assets/javascripts/uikit/core/modal.js +323 -0
  42. data/vendor/assets/javascripts/uikit/core/nav.js +117 -0
  43. data/vendor/assets/javascripts/uikit/core/offcanvas.js +178 -0
  44. data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
  45. data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
  46. data/vendor/assets/javascripts/uikit/core/switcher.js +298 -0
  47. data/vendor/assets/javascripts/uikit/core/tab.js +159 -0
  48. data/vendor/assets/javascripts/uikit/core/toggle.js +117 -0
  49. data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
  50. data/vendor/assets/javascripts/uikit/core/utility.js +157 -0
  51. data/vendor/assets/javascripts/uikit/uikit.js +1538 -871
  52. data/vendor/assets/stylesheets/extra/font-awesome.scss +4 -7
  53. data/vendor/assets/stylesheets/uikit.scss +22 -1
  54. data/vendor/assets/stylesheets/uikit/almost-flat.scss +22 -2
  55. data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.scss +45 -0
  56. data/vendor/assets/stylesheets/uikit/components/accordion.gradient.scss +45 -0
  57. data/vendor/assets/stylesheets/uikit/components/accordion.scss +43 -0
  58. data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.scss +62 -0
  59. data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.scss +62 -0
  60. data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +60 -0
  61. data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.scss +148 -0
  62. data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.scss +158 -0
  63. data/vendor/assets/stylesheets/uikit/components/datepicker.scss +142 -0
  64. data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.scss +152 -0
  65. data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.scss +152 -0
  66. data/vendor/assets/stylesheets/uikit/components/dotnav.scss +148 -0
  67. data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.scss +92 -0
  68. data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.scss +92 -0
  69. data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +92 -0
  70. data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.scss +36 -0
  71. data/vendor/assets/stylesheets/uikit/components/form-file.gradient.scss +36 -0
  72. data/vendor/assets/stylesheets/uikit/components/form-file.scss +36 -0
  73. data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.scss +37 -0
  74. data/vendor/assets/stylesheets/uikit/components/form-password.gradient.scss +37 -0
  75. data/vendor/assets/stylesheets/uikit/components/form-password.scss +37 -0
  76. data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.scss +37 -0
  77. data/vendor/assets/stylesheets/uikit/components/form-select.gradient.scss +37 -0
  78. data/vendor/assets/stylesheets/uikit/components/form-select.scss +37 -0
  79. data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.scss +282 -0
  80. data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.scss +290 -0
  81. data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +208 -0
  82. data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.scss +137 -0
  83. data/vendor/assets/stylesheets/uikit/components/nestable.gradient.scss +141 -0
  84. data/vendor/assets/stylesheets/uikit/components/nestable.scss +134 -0
  85. data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.scss +112 -0
  86. data/vendor/assets/stylesheets/uikit/components/notify.gradient.scss +112 -0
  87. data/vendor/assets/stylesheets/uikit/components/notify.scss +106 -0
  88. data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.scss +36 -0
  89. data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.scss +36 -0
  90. data/vendor/assets/stylesheets/uikit/components/placeholder.scss +36 -0
  91. data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.scss +130 -0
  92. data/vendor/assets/stylesheets/uikit/components/progress.gradient.scss +138 -0
  93. data/vendor/assets/stylesheets/uikit/components/progress.scss +118 -0
  94. data/vendor/assets/stylesheets/uikit/components/search.almost-flat.scss +216 -0
  95. data/vendor/assets/stylesheets/uikit/components/search.gradient.scss +216 -0
  96. data/vendor/assets/stylesheets/uikit/components/search.scss +214 -0
  97. data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.scss +110 -0
  98. data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.scss +110 -0
  99. data/vendor/assets/stylesheets/uikit/components/slidenav.scss +110 -0
  100. data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.scss +105 -0
  101. data/vendor/assets/stylesheets/uikit/components/slider.gradient.scss +105 -0
  102. data/vendor/assets/stylesheets/uikit/components/slider.scss +105 -0
  103. data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.scss +166 -0
  104. data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.scss +166 -0
  105. data/vendor/assets/stylesheets/uikit/components/slideshow.scss +166 -0
  106. data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.scss +90 -0
  107. data/vendor/assets/stylesheets/uikit/components/sortable.gradient.scss +90 -0
  108. data/vendor/assets/stylesheets/uikit/components/sortable.scss +90 -0
  109. data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.scss +39 -0
  110. data/vendor/assets/stylesheets/uikit/components/sticky.gradient.scss +39 -0
  111. data/vendor/assets/stylesheets/uikit/components/sticky.scss +39 -0
  112. data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.scss +129 -0
  113. data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.scss +129 -0
  114. data/vendor/assets/stylesheets/uikit/components/tooltip.scss +127 -0
  115. data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.scss +11 -0
  116. data/vendor/assets/stylesheets/uikit/components/upload.gradient.scss +11 -0
  117. data/vendor/assets/stylesheets/uikit/components/upload.scss +11 -0
  118. data/vendor/assets/stylesheets/uikit/gradient.scss +22 -2
  119. data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +1768 -498
  120. data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +1776 -512
  121. data/vendor/assets/stylesheets/uikit/uikit.scss +1722 -462
  122. metadata +92 -7
  123. data/vendor/assets/stylesheets/uikit/components/uikit.components.almost-flat.scss +0 -1586
  124. data/vendor/assets/stylesheets/uikit/components/uikit.components.gradient.scss +0 -1608
  125. data/vendor/assets/stylesheets/uikit/components/uikit.components.scss +0 -1489
@@ -1,19 +1,5 @@
1
- /*! UIkit 2.11.1 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
- (function(addon) {
3
-
4
- var component;
5
-
6
- if (jQuery && jQuery.UIkit) {
7
- component = addon(jQuery, jQuery.UIkit);
8
- }
9
-
10
- if (typeof define == "function" && define.amd) {
11
- define("uikit-cover", ["uikit"], function(){
12
- return component || addon(jQuery, jQuery.UIkit);
13
- });
14
- }
15
-
16
- })(function($, UI){
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ (function(UI){
17
3
 
18
4
  "use strict";
19
5
 
@@ -23,20 +9,35 @@
23
9
  automute : true
24
10
  },
25
11
 
12
+ boot: function() {
13
+
14
+ // auto init
15
+ UI.ready(function(context) {
16
+
17
+ UI.$("[data-uk-cover]", context).each(function(){
18
+
19
+ var ele = UI.$(this);
20
+
21
+ if(!ele.data("cover")) {
22
+ var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
23
+ }
24
+ });
25
+ });
26
+ },
27
+
26
28
  init: function() {
27
29
 
28
- this.parent = this.element.parent();
29
- this.dimension = {w: this.element.width(), h: this.element.height()};
30
- this.ratio = this.dimension.w / this.dimension.h;
30
+ this.parent = this.element.parent();
31
31
 
32
32
  UI.$win.on('load resize orientationchange', UI.Utils.debounce(function(){
33
33
  this.check();
34
34
  }.bind(this), 100));
35
35
 
36
- this.check();
37
-
38
- this.element.data("cover", this);
36
+ this.on("display.uk.check", function(e) {
37
+ if(this.element.is(":visible")) this.check();
38
+ }.bind(this));
39
39
 
40
+ this.check();
40
41
 
41
42
  if (this.element.is('iframe') && this.options.automute) {
42
43
 
@@ -52,6 +53,23 @@
52
53
 
53
54
  check: function() {
54
55
 
56
+ this.element.css({
57
+ 'width' : '',
58
+ 'height' : ''
59
+ });
60
+
61
+ this.dimension = {w: this.element.width(), h: this.element.height()};
62
+
63
+ if (this.element.attr('width') && !isNaN(this.element.attr('width'))) {
64
+ this.dimension.w = this.element.attr('width');
65
+ }
66
+
67
+ if (this.element.attr('height') && !isNaN(this.element.attr('height'))) {
68
+ this.dimension.h = this.element.attr('height');
69
+ }
70
+
71
+ this.ratio = this.dimension.w / this.dimension.h;
72
+
55
73
  var w = this.parent.width(), h = this.parent.height(), width, height;
56
74
 
57
75
  // if element height < parent height (gap underneath)
@@ -74,16 +92,4 @@
74
92
  }
75
93
  });
76
94
 
77
- // auto init
78
- UI.ready(function(context) {
79
-
80
- $("[data-uk-cover]", context).each(function(){
81
-
82
- var ele = $(this);
83
-
84
- if(!ele.data("cover")) {
85
- var plugin = UI.cover(ele, UI.Utils.options(ele.attr("data-uk-cover")));
86
- }
87
- });
88
- });
89
- });
95
+ })(UIkit);
@@ -0,0 +1,296 @@
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ (function(UI) {
3
+
4
+ "use strict";
5
+
6
+ var active = false, hoverIdle;
7
+
8
+ UI.component('dropdown', {
9
+
10
+ defaults: {
11
+ 'mode' : 'hover',
12
+ 'remaintime' : 800,
13
+ 'justify' : false,
14
+ 'boundary' : UI.$win,
15
+ 'delay' : 0,
16
+ 'hoverDelayIdle' : 250
17
+ },
18
+
19
+ remainIdle: false,
20
+
21
+ boot: function() {
22
+
23
+ var triggerevent = UI.support.touch ? "click" : "mouseenter";
24
+
25
+ // init code
26
+ UI.$html.on(triggerevent+".dropdown.uikit", "[data-uk-dropdown]", function(e) {
27
+
28
+ var ele = UI.$(this);
29
+
30
+ if (!ele.data("dropdown")) {
31
+
32
+ var dropdown = UI.dropdown(ele, UI.Utils.options(ele.attr("data-uk-dropdown")));
33
+
34
+ if (triggerevent=="click" || (triggerevent=="mouseenter" && dropdown.options.mode=="hover")) {
35
+ dropdown.element.trigger(triggerevent);
36
+ }
37
+
38
+ if (dropdown.element.find('.uk-dropdown').length) {
39
+ e.preventDefault();
40
+ }
41
+ }
42
+ });
43
+ },
44
+
45
+ init: function() {
46
+
47
+ var $this = this;
48
+
49
+ this.dropdown = this.find('.uk-dropdown');
50
+
51
+ this.centered = this.dropdown.hasClass('uk-dropdown-center');
52
+ this.justified = this.options.justify ? UI.$(this.options.justify) : false;
53
+
54
+ this.boundary = UI.$(this.options.boundary);
55
+ this.flipped = this.dropdown.hasClass('uk-dropdown-flip');
56
+
57
+ if (!this.boundary.length) {
58
+ this.boundary = UI.$win;
59
+ }
60
+
61
+ // Init ARIA
62
+ this.element.attr('aria-haspopup', 'true');
63
+ this.element.attr('aria-expanded', this.element.hasClass("uk-open"));
64
+
65
+ if (this.options.mode == "click" || UI.support.touch) {
66
+
67
+ this.on("click.uikit.dropdown", function(e) {
68
+
69
+ var $target = UI.$(e.target);
70
+
71
+ if (!$target.parents(".uk-dropdown").length) {
72
+
73
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']") || ($this.dropdown.length && !$this.dropdown.is(":visible")) ){
74
+ e.preventDefault();
75
+ }
76
+
77
+ $target.blur();
78
+ }
79
+
80
+ if (!$this.element.hasClass('uk-open')) {
81
+
82
+ $this.show();
83
+
84
+ } else {
85
+
86
+ if ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length) {
87
+ $this.hide();
88
+ }
89
+ }
90
+ });
91
+
92
+ } else {
93
+
94
+ this.on("mouseenter", function(e) {
95
+
96
+ if ($this.remainIdle) {
97
+ clearTimeout($this.remainIdle);
98
+ }
99
+
100
+ if (hoverIdle) {
101
+ clearTimeout(hoverIdle);
102
+ }
103
+
104
+ if (active && active == $this) {
105
+ return;
106
+ }
107
+
108
+ // pseudo manuAim
109
+ if (active && active != $this) {
110
+
111
+ hoverIdle = setTimeout(function() {
112
+ hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
113
+ }, $this.options.hoverDelayIdle);
114
+
115
+ } else {
116
+
117
+ hoverIdle = setTimeout($this.show.bind($this), $this.options.delay);
118
+ }
119
+
120
+ }).on("mouseleave", function() {
121
+
122
+ if (hoverIdle) {
123
+ clearTimeout(hoverIdle);
124
+ }
125
+
126
+ $this.remainIdle = setTimeout(function() {
127
+ if (active && active == $this) $this.hide();
128
+ }, $this.options.remaintime);
129
+
130
+ }).on("click", function(e){
131
+
132
+ var $target = UI.$(e.target);
133
+
134
+ if ($this.remainIdle) {
135
+ clearTimeout($this.remainIdle);
136
+ }
137
+
138
+ if ($target.is("a[href='#']") || $target.parent().is("a[href='#']")){
139
+ e.preventDefault();
140
+ }
141
+
142
+ $this.show();
143
+ });
144
+ }
145
+ },
146
+
147
+ show: function(){
148
+
149
+ UI.$html.off("click.outer.dropdown");
150
+
151
+ if (active && active != this) {
152
+ active.hide();
153
+ }
154
+
155
+ if (hoverIdle) {
156
+ clearTimeout(hoverIdle);
157
+ }
158
+
159
+ this.checkDimensions();
160
+ this.element.addClass('uk-open');
161
+
162
+ // Update ARIA
163
+ this.element.attr('aria-expanded', 'true');
164
+
165
+ this.trigger('show.uk.dropdown', [this]);
166
+
167
+ UI.Utils.checkDisplay(this.dropdown, true);
168
+ active = this;
169
+
170
+ this.registerOuterClick();
171
+ },
172
+
173
+ hide: function() {
174
+ this.element.removeClass('uk-open');
175
+
176
+ if (this.remainIdle) {
177
+ clearTimeout(this.remainIdle);
178
+ }
179
+
180
+ this.remainIdle = false;
181
+
182
+ // Update ARIA
183
+ this.element.attr('aria-expanded', 'false');
184
+
185
+ this.trigger('hide.uk.dropdown', [this]);
186
+
187
+ if (active == this) active = false;
188
+ },
189
+
190
+ registerOuterClick: function(){
191
+
192
+ var $this = this;
193
+
194
+ UI.$html.off("click.outer.dropdown");
195
+
196
+ setTimeout(function() {
197
+
198
+ UI.$html.on("click.outer.dropdown", function(e) {
199
+
200
+ if (hoverIdle) {
201
+ clearTimeout(hoverIdle);
202
+ }
203
+
204
+ var $target = UI.$(e.target);
205
+
206
+ if (active == $this && ($target.is("a:not(.js-uk-prevent)") || $target.is(".uk-dropdown-close") || !$this.dropdown.find(e.target).length)) {
207
+ $this.hide();
208
+ UI.$html.off("click.outer.dropdown");
209
+ }
210
+ });
211
+ }, 10);
212
+ },
213
+
214
+ checkDimensions: function() {
215
+
216
+ if (!this.dropdown.length) return;
217
+
218
+ if (this.justified && this.justified.length) {
219
+ this.dropdown.css("min-width", "");
220
+ }
221
+
222
+ var $this = this,
223
+ dropdown = this.dropdown.css("margin-" + UI.langdirection, ""),
224
+ offset = dropdown.show().offset(),
225
+ width = dropdown.outerWidth(),
226
+ boundarywidth = this.boundary.width(),
227
+ boundaryoffset = this.boundary.offset() ? this.boundary.offset().left:0;
228
+
229
+ // centered dropdown
230
+ if (this.centered) {
231
+ dropdown.css("margin-" + UI.langdirection, (parseFloat(width) / 2 - dropdown.parent().width() / 2) * -1);
232
+ offset = dropdown.offset();
233
+
234
+ // reset dropdown
235
+ if ((width + offset.left) > boundarywidth || offset.left < 0) {
236
+ dropdown.css("margin-" + UI.langdirection, "");
237
+ offset = dropdown.offset();
238
+ }
239
+ }
240
+
241
+ // justify dropdown
242
+ if (this.justified && this.justified.length) {
243
+
244
+ var jwidth = this.justified.outerWidth();
245
+
246
+ dropdown.css("min-width", jwidth);
247
+
248
+ if (UI.langdirection == 'right') {
249
+
250
+ var right1 = boundarywidth - (this.justified.offset().left + jwidth),
251
+ right2 = boundarywidth - (dropdown.offset().left + dropdown.outerWidth());
252
+
253
+ dropdown.css("margin-right", right1 - right2);
254
+
255
+ } else {
256
+ dropdown.css("margin-left", this.justified.offset().left - offset.left);
257
+ }
258
+
259
+ offset = dropdown.offset();
260
+
261
+ }
262
+
263
+ if ((width + (offset.left-boundaryoffset)) > boundarywidth) {
264
+ dropdown.addClass('uk-dropdown-flip');
265
+ offset = dropdown.offset();
266
+ }
267
+
268
+ if ((offset.left-boundaryoffset) < 0) {
269
+
270
+ dropdown.addClass("uk-dropdown-stack");
271
+
272
+ if (dropdown.hasClass('uk-dropdown-flip')) {
273
+
274
+ if (!this.flipped) {
275
+ dropdown.removeClass('uk-dropdown-flip');
276
+ offset = dropdown.offset();
277
+ dropdown.addClass('uk-dropdown-flip');
278
+ }
279
+
280
+ setTimeout(function(){
281
+
282
+ if ((dropdown.offset().left-boundaryoffset) < 0 || !$this.flipped && (dropdown.outerWidth() + (offset.left-boundaryoffset)) < boundarywidth) {
283
+ dropdown.removeClass('uk-dropdown-flip');
284
+ }
285
+ }, 0);
286
+ }
287
+
288
+ this.trigger('stack.uk.dropdown', [this]);
289
+ }
290
+
291
+ dropdown.css("display", "");
292
+ }
293
+
294
+ });
295
+
296
+ })(UIkit);
@@ -0,0 +1,172 @@
1
+ /*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
2
+ (function(UI) {
3
+
4
+ "use strict";
5
+
6
+ var grids = [];
7
+
8
+ UI.component('gridMatchHeight', {
9
+
10
+ defaults: {
11
+ "target" : false,
12
+ "row" : true
13
+ },
14
+
15
+ boot: function() {
16
+
17
+ // init code
18
+ UI.ready(function(context) {
19
+
20
+ UI.$("[data-uk-grid-match]", context).each(function() {
21
+ var grid = UI.$(this), obj;
22
+
23
+ if (!grid.data("gridMatchHeight")) {
24
+ obj = UI.gridMatchHeight(grid, UI.Utils.options(grid.attr("data-uk-grid-match")));
25
+ }
26
+ });
27
+ });
28
+ },
29
+
30
+ init: function() {
31
+
32
+ var $this = this;
33
+
34
+ this.columns = this.element.children();
35
+ this.elements = this.options.target ? this.find(this.options.target) : this.columns;
36
+
37
+ if (!this.columns.length) return;
38
+
39
+ UI.$win.on('load resize orientationchange', (function() {
40
+
41
+ var fn = function() {
42
+ $this.match();
43
+ };
44
+
45
+ UI.$(function() { fn(); });
46
+
47
+ return UI.Utils.debounce(fn, 50);
48
+ })());
49
+
50
+ UI.$html.on("changed.uk.dom", function(e) {
51
+ $this.columns = $this.element.children();
52
+ $this.elements = $this.options.target ? $this.find($this.options.target) : $this.columns;
53
+ $this.match();
54
+ });
55
+
56
+ this.on("display.uk.check", function(e) {
57
+ if(this.element.is(":visible")) this.match();
58
+ }.bind(this));
59
+
60
+ grids.push(this);
61
+ },
62
+
63
+ match: function() {
64
+
65
+ var firstvisible = this.columns.filter(":visible:first");
66
+
67
+ if (!firstvisible.length) return;
68
+
69
+ var stacked = Math.ceil(100 * parseFloat(firstvisible.css('width')) / parseFloat(firstvisible.parent().css('width'))) >= 100;
70
+
71
+ if (stacked) {
72
+ this.revert();
73
+ } else {
74
+ UI.Utils.matchHeights(this.elements, this.options);
75
+ }
76
+
77
+ return this;
78
+ },
79
+
80
+ revert: function() {
81
+ this.elements.css('min-height', '');
82
+ return this;
83
+ }
84
+ });
85
+
86
+ UI.component('gridMargin', {
87
+
88
+ defaults: {
89
+ "cls": "uk-grid-margin"
90
+ },
91
+
92
+ boot: function() {
93
+
94
+ // init code
95
+ UI.ready(function(context) {
96
+
97
+ UI.$("[data-uk-grid-margin]", context).each(function() {
98
+ var grid = UI.$(this), obj;
99
+
100
+ if (!grid.data("gridMargin")) {
101
+ obj = UI.gridMargin(grid, UI.Utils.options(grid.attr("data-uk-grid-margin")));
102
+ }
103
+ });
104
+ });
105
+ },
106
+
107
+ init: function() {
108
+
109
+ var stackMargin = UI.stackMargin(this.element, this.options);
110
+ }
111
+ });
112
+
113
+ // helper
114
+
115
+ UI.Utils.matchHeights = function(elements, options) {
116
+
117
+ elements = UI.$(elements).css('min-height', '');
118
+ options = UI.$.extend({ row : true }, options);
119
+
120
+ var matchHeights = function(group){
121
+
122
+ if(group.length < 2) return;
123
+
124
+ var max = 0;
125
+
126
+ group.each(function() {
127
+ max = Math.max(max, UI.$(this).outerHeight());
128
+ }).each(function() {
129
+
130
+ var element = UI.$(this),
131
+ height = max - (element.css('box-sizing') == 'border-box' ? 0 : (element.outerHeight() - element.height()));
132
+
133
+
134
+ element.css('min-height', height + 'px');
135
+ });
136
+ };
137
+
138
+ if(options.row) {
139
+
140
+ elements.first().width(); // force redraw
141
+
142
+ setTimeout(function(){
143
+
144
+ var lastoffset = false, group = [];
145
+
146
+ elements.each(function() {
147
+
148
+ var ele = UI.$(this), offset = ele.offset().top;
149
+
150
+ if(offset != lastoffset && group.length) {
151
+
152
+ matchHeights(UI.$(group));
153
+ group = [];
154
+ offset = ele.offset().top;
155
+ }
156
+
157
+ group.push(ele);
158
+ lastoffset = offset;
159
+ });
160
+
161
+ if(group.length) {
162
+ matchHeights(UI.$(group));
163
+ }
164
+
165
+ }, 0);
166
+
167
+ } else {
168
+ matchHeights(elements);
169
+ }
170
+ };
171
+
172
+ })(UIkit);