foundation-rails 5.0.3.1 → 5.1.0.1

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +6 -2
  4. data/bower.json +7 -0
  5. data/lib/foundation/rails/version.rb +1 -1
  6. data/update-gem.sh +13 -0
  7. data/vendor/assets/javascripts/foundation.js +2 -1
  8. data/vendor/assets/javascripts/foundation/foundation.abide.js +67 -33
  9. data/vendor/assets/javascripts/foundation/foundation.accordion.js +19 -11
  10. data/vendor/assets/javascripts/foundation/foundation.alert.js +8 -5
  11. data/vendor/assets/javascripts/foundation/foundation.clearing.js +74 -52
  12. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +52 -46
  13. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +63 -0
  14. data/vendor/assets/javascripts/foundation/foundation.interchange.js +47 -26
  15. data/vendor/assets/javascripts/foundation/foundation.joyride.js +42 -36
  16. data/vendor/assets/javascripts/foundation/foundation.js +286 -118
  17. data/vendor/assets/javascripts/foundation/foundation.magellan.js +139 -98
  18. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +8 -6
  19. data/vendor/assets/javascripts/foundation/foundation.orbit.js +29 -21
  20. data/vendor/assets/javascripts/foundation/foundation.reveal.js +58 -50
  21. data/vendor/assets/javascripts/foundation/foundation.tab.js +22 -10
  22. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +38 -26
  23. data/vendor/assets/javascripts/foundation/foundation.topbar.js +79 -73
  24. data/vendor/assets/stylesheets/foundation/_functions.scss +37 -18
  25. data/vendor/assets/stylesheets/foundation/_settings.scss +115 -110
  26. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +14 -9
  27. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +2 -2
  28. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +1 -1
  29. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +13 -1
  30. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +1 -1
  31. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +1 -1
  32. data/vendor/assets/stylesheets/foundation/components/_forms.scss +23 -29
  33. data/vendor/assets/stylesheets/foundation/components/_global.scss +23 -54
  34. data/vendor/assets/stylesheets/foundation/components/_grid.scss +38 -31
  35. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +2 -2
  36. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +2 -2
  37. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +2 -2
  38. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +96 -96
  39. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +3 -0
  40. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +2 -2
  41. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +8 -3
  42. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +10 -5
  43. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +6 -3
  44. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +2 -0
  45. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +11 -1
  46. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +20 -7
  47. data/vendor/assets/stylesheets/foundation/components/_type.scss +82 -4
  48. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +2 -2
  49. metadata +5 -2
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.dropdown = {
5
5
  name : 'dropdown',
6
6
 
7
- version : '5.0.3',
7
+ version : '5.1.0',
8
8
 
9
9
  settings : {
10
10
  active_class: 'open',
@@ -20,74 +20,72 @@
20
20
  },
21
21
 
22
22
  events : function (scope) {
23
- var self = this;
23
+ var self = this,
24
+ S = self.S;
24
25
 
25
- $(this.scope)
26
+ S(this.scope)
26
27
  .off('.dropdown')
27
- .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
28
- var settings = $(this).data('dropdown-init') || self.settings;
28
+ .on('click.fndtn.dropdown', '[' + this.attr_name() + ']', function (e) {
29
+ var settings = S(this).data(self.attr_name(true) + '-init') || self.settings;
29
30
  e.preventDefault();
30
-
31
- self.closeall.call(self);
32
-
33
- if (!settings.is_hover || Modernizr.touch) self.toggle($(this));
31
+ if (!settings.is_hover || Modernizr.touch) self.toggle(S(this));
34
32
  })
35
- .on('mouseenter.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
36
- var $this = $(this);
33
+ .on('mouseenter.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
34
+ var $this = S(this);
37
35
  clearTimeout(self.timeout);
38
36
 
39
- if ($this.data('dropdown')) {
40
- var dropdown = $('#' + $this.data('dropdown')),
37
+ if ($this.data(self.data_attr())) {
38
+ var dropdown = S('#' + $this.data(self.data_attr())),
41
39
  target = $this;
42
40
  } else {
43
41
  var dropdown = $this;
44
- target = $("[data-dropdown='" + dropdown.attr('id') + "']");
42
+ target = S("[" + self.attr_name() + "='" + dropdown.attr('id') + "']");
45
43
  }
46
44
 
47
- var settings = target.data('dropdown-init') || self.settings;
45
+ var settings = target.data(self.attr_name(true) + '-init') || self.settings;
48
46
 
49
- if($(e.target).data('dropdown') && settings.is_hover) {
47
+ if(S(e.target).data(self.data_attr()) && settings.is_hover) {
50
48
  self.closeall.call(self);
51
49
  }
52
50
 
53
51
  if (settings.is_hover) self.open.apply(self, [dropdown, target]);
54
52
  })
55
- .on('mouseleave.fndtn.dropdown', '[data-dropdown], [data-dropdown-content]', function (e) {
56
- var $this = $(this);
53
+ .on('mouseleave.fndtn.dropdown', '[' + this.attr_name() + '], [' + this.attr_name() + '-content]', function (e) {
54
+ var $this = S(this);
57
55
  self.timeout = setTimeout(function () {
58
- if ($this.data('dropdown')) {
59
- var settings = $this.data('dropdown-init') || self.settings;
60
- if (settings.is_hover) self.close.call(self, $('#' + $this.data('dropdown')));
56
+ if ($this.data(self.data_attr())) {
57
+ var settings = $this.data(self.data_attr(true) + '-init') || self.settings;
58
+ if (settings.is_hover) self.close.call(self, S('#' + $this.data(self.data_attr())));
61
59
  } else {
62
- var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),
63
- settings = target.data('dropdown-init') || self.settings;
60
+ var target = S('[' + self.attr_name() + '="' + S(this).attr('id') + '"]'),
61
+ settings = target.data(self.attr_name(true) + '-init') || self.settings;
64
62
  if (settings.is_hover) self.close.call(self, $this);
65
63
  }
66
64
  }.bind(this), 150);
67
65
  })
68
66
  .on('click.fndtn.dropdown', function (e) {
69
- var parent = $(e.target).closest('[data-dropdown-content]');
67
+ var parent = S(e.target).closest('[' + self.attr_name() + '-content]');
70
68
 
71
- if ($(e.target).data('dropdown') || $(e.target).parent().data('dropdown')) {
69
+ if (S(e.target).data(self.data_attr()) || S(e.target).parent().data(self.data_attr())) {
72
70
  return;
73
71
  }
74
- if (!($(e.target).data('revealId')) &&
75
- (parent.length > 0 && ($(e.target).is('[data-dropdown-content]') ||
72
+ if (!(S(e.target).data('revealId')) &&
73
+ (parent.length > 0 && (S(e.target).is('[' + self.attr_name() + '-content]') ||
76
74
  $.contains(parent.first()[0], e.target)))) {
77
75
  e.stopPropagation();
78
76
  return;
79
77
  }
80
78
 
81
- self.close.call(self, $('[data-dropdown-content]'));
79
+ self.close.call(self, S('[' + self.attr_name() + '-content]'));
82
80
  })
83
- .on('opened.fndtn.dropdown', '[data-dropdown-content]', function () {
81
+ .on('opened.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
84
82
  self.settings.opened.call(this);
85
83
  })
86
- .on('closed.fndtn.dropdown', '[data-dropdown-content]', function () {
84
+ .on('closed.fndtn.dropdown', '[' + self.attr_name() + '-content]', function () {
87
85
  self.settings.closed.call(this);
88
86
  });
89
87
 
90
- $(window)
88
+ S(window)
91
89
  .off('.dropdown')
92
90
  .on('resize.fndtn.dropdown', self.throttle(function () {
93
91
  self.resize.call(self);
@@ -97,19 +95,19 @@
97
95
  close: function (dropdown) {
98
96
  var self = this;
99
97
  dropdown.each(function () {
100
- if ($(this).hasClass(self.settings.active_class)) {
101
- $(this)
98
+ if (self.S(this).hasClass(self.settings.active_class)) {
99
+ self.S(this)
102
100
  .css(Foundation.rtl ? 'right':'left', '-99999px')
103
101
  .removeClass(self.settings.active_class);
104
- $(this).trigger('closed');
102
+ self.S(this).trigger('closed');
105
103
  }
106
104
  });
107
105
  },
108
106
 
109
107
  closeall: function() {
110
108
  var self = this;
111
- $.each($('[data-dropdown-content]'), function() {
112
- self.close.call(self, $(this))
109
+ $.each(self.S('[' + this.attr_name() + '-content]'), function() {
110
+ self.close.call(self, self.S(this))
113
111
  });
114
112
  },
115
113
 
@@ -120,26 +118,34 @@
120
118
  dropdown.trigger('opened');
121
119
  },
122
120
 
121
+ data_attr: function () {
122
+ if (this.namespace.length > 0) {
123
+ return this.namespace + '-' + this.name;
124
+ }
125
+
126
+ return this.name;
127
+ },
128
+
123
129
  toggle : function (target) {
124
- var dropdown = $('#' + target.data('dropdown'));
130
+ var dropdown = this.S('#' + target.data(this.data_attr()));
125
131
  if (dropdown.length === 0) {
126
132
  // No dropdown found, not continuing
127
133
  return;
128
134
  }
129
135
 
130
- this.close.call(this, $('[data-dropdown-content]').not(dropdown));
136
+ this.close.call(this, this.S('[' + this.attr_name() + '-content]').not(dropdown));
131
137
 
132
138
  if (dropdown.hasClass(this.settings.active_class)) {
133
139
  this.close.call(this, dropdown);
134
140
  } else {
135
- this.close.call(this, $('[data-dropdown-content]'))
141
+ this.close.call(this, this.S('[' + this.attr_name() + '-content]'))
136
142
  this.open.call(this, dropdown, target);
137
143
  }
138
144
  },
139
145
 
140
146
  resize : function () {
141
- var dropdown = $('[data-dropdown-content].open'),
142
- target = $("[data-dropdown='" + dropdown.attr('id') + "']");
147
+ var dropdown = this.S('[' + this.attr_name() + '-content].open'),
148
+ target = this.S("[" + this.attr_name() + "='" + dropdown.attr('id') + "']");
143
149
 
144
150
  if (dropdown.length && target.length) {
145
151
  this.css(dropdown, target);
@@ -162,7 +168,7 @@
162
168
  });
163
169
  dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
164
170
  } else {
165
- if (!Foundation.rtl && $(window).width() > dropdown.outerWidth() + target.offset().left) {
171
+ if (!Foundation.rtl && this.S(window).width() > dropdown.outerWidth() + target.offset().left) {
166
172
  var left = position.left;
167
173
  if (dropdown.hasClass('right')) {
168
174
  dropdown.removeClass('right');
@@ -190,10 +196,10 @@
190
196
  },
191
197
 
192
198
  off: function () {
193
- $(this.scope).off('.fndtn.dropdown');
194
- $('html, body').off('.fndtn.dropdown');
195
- $(window).off('.fndtn.dropdown');
196
- $('[data-dropdown-content]').off('.fndtn.dropdown');
199
+ this.S(this.scope).off('.fndtn.dropdown');
200
+ this.S('html, body').off('.fndtn.dropdown');
201
+ this.S(window).off('.fndtn.dropdown');
202
+ this.S('[data-dropdown-content]').off('.fndtn.dropdown');
197
203
  this.settings.init = false;
198
204
  },
199
205
 
@@ -0,0 +1,63 @@
1
+ ;(function ($, window, document, undefined) {
2
+ 'use strict';
3
+
4
+ Foundation.libs.equalizer = {
5
+ name : 'equalizer',
6
+
7
+ version : '5.1.0',
8
+
9
+ settings : {
10
+ use_tallest: true,
11
+ before_height_change: $.noop,
12
+ after_height_change: $.noop
13
+ },
14
+
15
+ init : function (scope, method, options) {
16
+ this.bindings(method, options);
17
+ },
18
+
19
+ events : function () {
20
+ this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
21
+ this.reflow();
22
+ }.bind(this));
23
+ },
24
+
25
+ equalize: function(equalizer) {
26
+ var isStacked = false,
27
+ vals = equalizer.find('[' + this.attr_name() + '-watch]'),
28
+ firstTopOffset = vals.first().offset().top,
29
+ settings = equalizer.data(this.attr_name(true)+'-init');
30
+
31
+ if (vals.length === 0) return;
32
+ settings.before_height_change();
33
+ equalizer.trigger('before-height-change');
34
+ vals.height('inherit');
35
+ vals.each(function(){
36
+ var el = $(this);
37
+ if (el.offset().top !== firstTopOffset) {
38
+ isStacked = true;
39
+ }
40
+ });
41
+ if (isStacked) return;
42
+
43
+ var heights = vals.map(function(){ return $(this).outerHeight() });
44
+ if (settings.use_tallest) {
45
+ var max = Math.max.apply(null, heights);
46
+ vals.height(max);
47
+ } else {
48
+ var min = Math.min.apply(null, heights);
49
+ vals.height(min);
50
+ }
51
+ settings.after_height_change();
52
+ equalizer.trigger('after-height-change');
53
+ },
54
+
55
+ reflow : function () {
56
+ var self = this;
57
+
58
+ this.S('[' + this.attr_name() + ']', this.scope).each(function(){
59
+ self.equalize($(this));
60
+ });
61
+ }
62
+ };
63
+ }(jQuery, this, this.document));
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.interchange = {
5
5
  name : 'interchange',
6
6
 
7
- version : '5.0.3',
7
+ version : '5.1.0',
8
8
 
9
9
  cache : {},
10
10
 
@@ -53,13 +53,13 @@
53
53
 
54
54
  return trigger(el[0].src);
55
55
  }
56
- var last_path = el.data('interchange-last-path');
56
+ var last_path = el.data(this.data_attr + '-last-path');
57
57
 
58
58
  if (last_path == path) return;
59
59
 
60
60
  return $.get(path, function (response) {
61
61
  el.html(response);
62
- el.data('interchange-last-path', path);
62
+ el.data(this.data_attr + '-last-path', path);
63
63
  trigger();
64
64
  });
65
65
 
@@ -68,9 +68,9 @@
68
68
  },
69
69
 
70
70
  init : function (scope, method, options) {
71
- Foundation.inherit(this, 'throttle');
71
+ Foundation.inherit(this, 'throttle random_str');
72
72
 
73
- this.data_attr = 'data-' + this.settings.load_attr;
73
+ this.data_attr = this.set_data_attr();
74
74
  $.extend(true, this.settings, method, options);
75
75
 
76
76
  this.bindings(method, options);
@@ -84,7 +84,7 @@
84
84
  $(window)
85
85
  .off('.interchange')
86
86
  .on('resize.fndtn.interchange', self.throttle(function () {
87
- self.resize.call(self);
87
+ self.resize();
88
88
  }, 50));
89
89
 
90
90
  return this;
@@ -104,7 +104,7 @@
104
104
 
105
105
  if (passed) {
106
106
  this.settings.directives[passed
107
- .scenario[1]](passed.el, passed.scenario[0], function () {
107
+ .scenario[1]].call(this, passed.el, passed.scenario[0], function () {
108
108
  if (arguments[0] instanceof Array) {
109
109
  var args = arguments[0];
110
110
  } else {
@@ -123,17 +123,17 @@
123
123
  var count = scenarios.length;
124
124
 
125
125
  if (count > 0) {
126
- var el = this.S('[data-uuid="' + uuid + '"]');
126
+ var el = this.S('[' + this.add_namespace('data-uuid') + '="' + uuid + '"]');
127
127
 
128
- for (var i = count - 1; i >= 0; i--) {
129
- var mq, rule = scenarios[i][2];
128
+ while (count--) {
129
+ var mq, rule = scenarios[count][2];
130
130
  if (this.settings.named_queries.hasOwnProperty(rule)) {
131
131
  mq = matchMedia(this.settings.named_queries[rule]);
132
132
  } else {
133
133
  mq = matchMedia(rule);
134
134
  }
135
135
  if (mq.matches) {
136
- return {el: el, scenario: scenarios[i]};
136
+ return {el: el, scenario: scenarios[count]};
137
137
  }
138
138
  }
139
139
  }
@@ -152,6 +152,7 @@
152
152
  update_images : function () {
153
153
  var images = this.S('img[' + this.data_attr + ']'),
154
154
  count = images.length,
155
+ i = count,
155
156
  loaded_count = 0,
156
157
  data_attr = this.data_attr;
157
158
 
@@ -159,7 +160,7 @@
159
160
  this.cached_images = [];
160
161
  this.images_loaded = (count === 0);
161
162
 
162
- for (var i = count - 1; i >= 0; i--) {
163
+ while (i--) {
163
164
  loaded_count++;
164
165
  if (images[i]) {
165
166
  var str = images[i].getAttribute(data_attr) || '';
@@ -169,7 +170,7 @@
169
170
  }
170
171
  }
171
172
 
172
- if(loaded_count === count) {
173
+ if (loaded_count === count) {
173
174
  this.images_loaded = true;
174
175
  this.enhance('images');
175
176
  }
@@ -181,6 +182,7 @@
181
182
  update_nodes : function () {
182
183
  var nodes = this.S('[' + this.data_attr + ']').not('img'),
183
184
  count = nodes.length,
185
+ i = count,
184
186
  loaded_count = 0,
185
187
  data_attr = this.data_attr;
186
188
 
@@ -190,7 +192,7 @@
190
192
  this.nodes_loaded = (count === 0);
191
193
 
192
194
 
193
- for (var i = count - 1; i >= 0; i--) {
195
+ while (i--) {
194
196
  loaded_count++;
195
197
  var str = nodes[i].getAttribute(data_attr) || '';
196
198
 
@@ -208,9 +210,9 @@
208
210
  },
209
211
 
210
212
  enhance : function (type) {
211
- var count = this['cached_' + type].length;
213
+ var i = this['cached_' + type].length;
212
214
 
213
- for (var i = count - 1; i >= 0; i--) {
215
+ while (i--) {
214
216
  this.object($(this['cached_' + type][i]));
215
217
  }
216
218
 
@@ -233,10 +235,11 @@
233
235
 
234
236
  object : function(el) {
235
237
  var raw_arr = this.parse_data_attr(el),
236
- scenarios = [], count = raw_arr.length;
238
+ scenarios = [],
239
+ i = raw_arr.length;
237
240
 
238
- if (count > 0) {
239
- for (var i = count - 1; i >= 0; i--) {
241
+ if (i > 0) {
242
+ while (i--) {
240
243
  var split = raw_arr[i].split(/\((.*?)(\))$/);
241
244
 
242
245
  if (split.length > 1) {
@@ -253,10 +256,11 @@
253
256
  },
254
257
 
255
258
  uuid : function (separator) {
256
- var delim = separator || "-";
259
+ var delim = separator || "-",
260
+ self = this;
257
261
 
258
262
  function S4() {
259
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
263
+ return self.random_str(6);
260
264
  }
261
265
 
262
266
  return (S4() + S4() + delim + S4() + delim + S4()
@@ -265,11 +269,11 @@
265
269
 
266
270
  store : function (el, scenarios) {
267
271
  var uuid = this.uuid(),
268
- current_uuid = el.data('uuid');
272
+ current_uuid = el.data(this.add_namespace('uuid', true));
269
273
 
270
274
  if (this.cache[current_uuid]) return this.cache[current_uuid];
271
275
 
272
- el.attr('data-uuid', uuid);
276
+ el.attr(this.add_namespace('data-uuid'), uuid);
273
277
 
274
278
  return this.cache[uuid] = scenarios;
275
279
  },
@@ -282,11 +286,28 @@
282
286
  return str;
283
287
  },
284
288
 
289
+ set_data_attr: function (init) {
290
+ if (init) {
291
+ if (this.namespace.length > 0) {
292
+ return this.namespace + '-' + this.settings.load_attr;
293
+ }
294
+
295
+ return this.settings.load_attr;
296
+ }
297
+
298
+ if (this.namespace.length > 0) {
299
+ return 'data-' + this.namespace + '-' + this.settings.load_attr;
300
+ }
301
+
302
+ return 'data-' + this.settings.load_attr;
303
+ },
304
+
285
305
  parse_data_attr : function (el) {
286
- var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
287
- count = raw.length, output = [];
306
+ var raw = el.attr(this.attr_name()).split(/\[(.*?)\]/),
307
+ i = raw.length,
308
+ output = [];
288
309
 
289
- for (var i = count - 1; i >= 0; i--) {
310
+ while (i--) {
290
311
  if (raw[i].replace(/[\W\d]+/, '').length > 4) {
291
312
  output.push(raw[i]);
292
313
  }