foundation-rails 5.2.3.0 → 5.3.0.0

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/bower.json +2 -2
  3. data/lib/foundation/rails/version.rb +1 -1
  4. data/test/dummy/.ruby-version +1 -0
  5. data/vendor/assets/_settings.scss +1298 -0
  6. data/vendor/assets/javascripts/foundation/foundation.abide.js +4 -4
  7. data/vendor/assets/javascripts/foundation/foundation.accordion.js +7 -1
  8. data/vendor/assets/javascripts/foundation/foundation.alert.js +3 -3
  9. data/vendor/assets/javascripts/foundation/foundation.clearing.js +17 -9
  10. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +7 -5
  11. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +2 -2
  12. data/vendor/assets/javascripts/foundation/foundation.interchange.js +24 -11
  13. data/vendor/assets/javascripts/foundation/foundation.joyride.js +14 -11
  14. data/vendor/assets/javascripts/foundation/foundation.js +6 -4
  15. data/vendor/assets/javascripts/foundation/foundation.magellan.js +5 -3
  16. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +2 -2
  17. data/vendor/assets/javascripts/foundation/foundation.orbit.js +123 -261
  18. data/vendor/assets/javascripts/foundation/foundation.reveal.js +15 -15
  19. data/vendor/assets/javascripts/foundation/foundation.slider.js +51 -24
  20. data/vendor/assets/javascripts/foundation/foundation.topbar.js +13 -12
  21. data/vendor/assets/javascripts/vendor/modernizr.js +3 -3
  22. data/vendor/assets/stylesheets/foundation.scss +2 -1
  23. data/vendor/assets/stylesheets/foundation/_settings.scss +19 -10
  24. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +115 -1
  25. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +2 -2
  26. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +9 -1
  27. data/vendor/assets/stylesheets/foundation/components/_forms.scss +8 -6
  28. data/vendor/assets/stylesheets/foundation/components/_global.scss +12 -7
  29. data/vendor/assets/stylesheets/foundation/components/_grid.scss +17 -4
  30. data/vendor/assets/stylesheets/foundation/components/_icon-bar.scss +229 -0
  31. data/vendor/assets/stylesheets/foundation/components/_iconbar.scss +67 -0
  32. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +18 -16
  33. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +84 -139
  34. data/vendor/assets/stylesheets/foundation/components/_panels.scss +6 -3
  35. data/vendor/assets/stylesheets/foundation/components/_range-slider.scss +20 -5
  36. data/vendor/assets/stylesheets/foundation/components/_reveal-new.scss +0 -0
  37. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +1 -1
  38. data/vendor/assets/stylesheets/foundation/components/_switches.scss +215 -0
  39. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +1 -1
  40. data/vendor/assets/stylesheets/foundation/components/_toolbar.scss +67 -0
  41. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +2 -1
  42. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +26 -11
  43. data/vendor/assets/stylesheets/foundation/components/_type.scss +2 -0
  44. metadata +10 -3
  45. data/vendor/assets/stylesheets/foundation/components/_switch.scss +0 -294
@@ -15,7 +15,7 @@
15
15
  alpha: /^[a-zA-Z]+$/,
16
16
  alpha_numeric : /^[a-zA-Z0-9]+$/,
17
17
  integer: /^[-+]?\d+$/,
18
- number: /^[-+]?\d*(?:\.\d+)?$/,
18
+ number: /^[-+]?\d*(?:[\.\,]\d+)?$/,
19
19
 
20
20
  // amex, visa, diners
21
21
  card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
@@ -101,19 +101,19 @@
101
101
  settings = form.data(this.attr_name(true) + '-init') || {},
102
102
  submit_event = /submit/.test(e.type);
103
103
 
104
- form.trigger('validated');
104
+ form.trigger('validated').trigger('validated.fndtn.abide');
105
105
  // Has to count up to make sure the focus gets applied to the top error
106
106
  for (var i=0; i < validation_count; i++) {
107
107
  if (!validations[i] && (submit_event || is_ajax)) {
108
108
  if (settings.focus_on_invalid) els[i].focus();
109
- form.trigger('invalid');
109
+ form.trigger('invalid').trigger('invalid.fndtn.abide');
110
110
  this.S(els[i]).closest('[data-' + this.attr_name(true) + ']').attr(this.invalid_attr, '');
111
111
  return false;
112
112
  }
113
113
  }
114
114
 
115
115
  if (submit_event || is_ajax) {
116
- form.trigger('valid');
116
+ form.trigger('valid').trigger('valid.fndtn.abide');
117
117
  }
118
118
 
119
119
  form.removeAttr(this.invalid_attr);
@@ -39,7 +39,11 @@
39
39
 
40
40
  if (settings.toggleable && target.is(active_content)) {
41
41
  target.parent('dd').toggleClass(settings.active_class, false);
42
- return target.toggleClass(settings.active_class, false);
42
+ target.toggleClass(settings.active_class, false);
43
+ settings.callback(target);
44
+ target.triggerHandler('toggled', [accordion]);
45
+ accordion.triggerHandler('toggled', [target]);
46
+ return;
43
47
  }
44
48
 
45
49
  if (!settings.multi_expand) {
@@ -49,6 +53,8 @@
49
53
 
50
54
  target.addClass(settings.active_class).parent().addClass(settings.active_class);
51
55
  settings.callback(target);
56
+ target.triggerHandler('toggled', [accordion]);
57
+ accordion.triggerHandler('toggled', [target]);
52
58
  });
53
59
  },
54
60
 
@@ -23,15 +23,15 @@
23
23
  settings = alertBox.data(self.attr_name(true) + '-init') || self.settings;
24
24
 
25
25
  e.preventDefault();
26
- if ('transitionend' in window || 'webkitTransitionEnd' in window || 'oTransitionEnd' in window) {
26
+ if (Modernizr.csstransitions) {
27
27
  alertBox.addClass("alert-close");
28
28
  alertBox.on('transitionend webkitTransitionEnd oTransitionEnd', function(e) {
29
- S(this).trigger('close').remove();
29
+ S(this).trigger('close').trigger('close.fndtn.alert').remove();
30
30
  settings.callback();
31
31
  });
32
32
  } else {
33
33
  alertBox.fadeOut(300, function () {
34
- S(this).trigger('close').remove();
34
+ S(this).trigger('close').trigger('close.fndtn.alert').remove();
35
35
  settings.callback();
36
36
  });
37
37
  }
@@ -16,7 +16,10 @@
16
16
 
17
17
  // comma delimited list of selectors that, on click, will close clearing,
18
18
  // add 'div.clearing-blackout, div.visible-img' to close on background click
19
- close_selectors : '.clearing-close',
19
+ close_selectors : '.clearing-close, div.clearing-blackout',
20
+
21
+ // Default to the entire li element.
22
+ open_selectors : '',
20
23
 
21
24
  touch_label : '',
22
25
 
@@ -51,7 +54,7 @@
51
54
 
52
55
  S(this.scope)
53
56
  .off('.clearing')
54
- .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li',
57
+ .on('click.fndtn.clearing', 'ul[' + this.attr_name() + '] li ' + this.settings.open_selectors,
55
58
  function (e, current, target) {
56
59
  var current = current || S(this),
57
60
  target = target || current,
@@ -127,7 +130,11 @@
127
130
 
128
131
  data.delta_x = e.touches[0].pageX - data.start_page_x;
129
132
 
130
- if ( typeof data.is_scrolling === 'undefined') {
133
+ if (Foundation.rtl) {
134
+ data.delta_x = -data.delta_x;
135
+ }
136
+
137
+ if (typeof data.is_scrolling === 'undefined') {
131
138
  data.is_scrolling = !!( data.is_scrolling || Math.abs(data.delta_x) < Math.abs(e.touches[0].pageY - data.start_page_y) );
132
139
  }
133
140
 
@@ -202,7 +209,7 @@
202
209
  cb.call(this, image);
203
210
  }
204
211
  }.bind(this));
205
- }.bind(this), 50);
212
+ }.bind(this), 100);
206
213
  }
207
214
 
208
215
  function cb (image) {
@@ -217,8 +224,8 @@
217
224
  .caption(self.S('.clearing-caption', visible_image), self.S('img', target))
218
225
  .center_and_label(image, label)
219
226
  .shift(current, target, function () {
220
- target.siblings().removeClass('visible');
221
- target.addClass('visible');
227
+ target.closest('li').siblings().removeClass('visible');
228
+ target.closest('li').addClass('visible');
222
229
  });
223
230
  visible_image.trigger('opened.fndtn.clearing')
224
231
  }
@@ -275,7 +282,7 @@
275
282
 
276
283
  if (e.which === NEXT_KEY) this.go(clearing, 'next');
277
284
  if (e.which === PREV_KEY) this.go(clearing, 'prev');
278
- if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click');
285
+ if (e.which === ESC_KEY) this.S('a.clearing-close').trigger('click').trigger('click.fndtn.clearing');
279
286
  },
280
287
 
281
288
  nav : function (e, direction) {
@@ -315,6 +322,7 @@
315
322
  },
316
323
 
317
324
  update_paddles : function (target) {
325
+ target = target.closest('li');
318
326
  var visible_image = target
319
327
  .closest('.carousel')
320
328
  .siblings('.visible-img');
@@ -417,7 +425,7 @@
417
425
  .hide();
418
426
  }
419
427
  return this;
420
- },
428
+ },
421
429
 
422
430
  // directional methods
423
431
 
@@ -427,7 +435,7 @@
427
435
 
428
436
  if (target.length) {
429
437
  this.S('img', target)
430
- .trigger('click', [current, target])
438
+ .trigger('click', [current, target]).trigger('click.fndtn.clearing', [current, target])
431
439
  .trigger('change.fndtn.clearing');
432
440
  }
433
441
  },
@@ -111,7 +111,7 @@
111
111
  .removeClass(self.settings.active_class)
112
112
  .removeData('target');
113
113
 
114
- self.S(this).trigger('closed', [dropdown]);
114
+ self.S(this).trigger('closed').trigger('closed.fndtn.dropdown', [dropdown]);
115
115
  }
116
116
  });
117
117
  },
@@ -128,7 +128,7 @@
128
128
  .css(dropdown
129
129
  .addClass(this.settings.active_class), target);
130
130
  dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
131
- dropdown.data('target', target.get(0)).trigger('opened', [dropdown, target]);
131
+ dropdown.data('target', target.get(0)).trigger('opened').trigger('opened.fndtn.dropdown', [dropdown, target]);
132
132
  },
133
133
 
134
134
  data_attr: function () {
@@ -167,6 +167,8 @@
167
167
  },
168
168
 
169
169
  css : function (dropdown, target) {
170
+ var left_offset = Math.max((target.width() - dropdown.width()) / 2, 8);
171
+
170
172
  this.clear_idx();
171
173
 
172
174
  if (this.small()) {
@@ -179,7 +181,7 @@
179
181
  top: p.top
180
182
  });
181
183
 
182
- dropdown.css(Foundation.rtl ? 'right':'left', '2.5%');
184
+ dropdown.css(Foundation.rtl ? 'right':'left', left_offset);
183
185
  } else {
184
186
  var settings = target.data(this.attr_name(true) + '-init') || this.settings;
185
187
 
@@ -213,7 +215,7 @@
213
215
  top: function (t, s) {
214
216
  var self = Foundation.libs.dropdown,
215
217
  p = self.dirs._base.call(this, t),
216
- pip_offset_base = (t.outerWidth() / 2) - 8;
218
+ pip_offset_base = 8;
217
219
 
218
220
  this.addClass('drop-top');
219
221
 
@@ -231,7 +233,7 @@
231
233
  bottom: function (t, s) {
232
234
  var self = Foundation.libs.dropdown,
233
235
  p = self.dirs._base.call(this, t),
234
- pip_offset_base = (t.outerWidth() / 2) - 8;
236
+ pip_offset_base = 8;
235
237
 
236
238
  if (t.outerWidth() < this.outerWidth() || self.small()) {
237
239
  self.adjust_pip(pip_offset_base, p);
@@ -33,7 +33,7 @@
33
33
  if (vals.length === 0) return;
34
34
  var firstTopOffset = vals.first().offset().top;
35
35
  settings.before_height_change();
36
- equalizer.trigger('before-height-change');
36
+ equalizer.trigger('before-height-change').trigger('before-height-change.fndth.equalizer');
37
37
  vals.height('inherit');
38
38
  vals.each(function(){
39
39
  var el = $(this);
@@ -56,7 +56,7 @@
56
56
  vals.css('height', min);
57
57
  }
58
58
  settings.after_height_change();
59
- equalizer.trigger('after-height-change');
59
+ equalizer.trigger('after-height-change').trigger('after-height-change.fndtn.equalizer');
60
60
  },
61
61
 
62
62
  reflow : function () {
@@ -53,7 +53,8 @@
53
53
 
54
54
  return trigger(el[0].src);
55
55
  }
56
- var last_path = el.data(this.data_attr + '-last-path');
56
+ var last_path = el.data(this.data_attr + '-last-path'),
57
+ self = this;
57
58
 
58
59
  if (last_path == path) return;
59
60
 
@@ -65,7 +66,7 @@
65
66
 
66
67
  return $.get(path, function (response) {
67
68
  el.html(response);
68
- el.data(this.data_attr + '-last-path', path);
69
+ el.data(self.data_attr + '-last-path', path);
69
70
  trigger();
70
71
  });
71
72
 
@@ -231,11 +232,7 @@
231
232
  this.object($(this['cached_' + type][i]));
232
233
  }
233
234
 
234
- return $(window).trigger('resize');
235
- },
236
-
237
- parse_params : function (path, directive, mq) {
238
- return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
235
+ return $(window).trigger('resize').trigger('resize.fndtn.interchange');
239
236
  },
240
237
 
241
238
  convert_directive : function (directive) {
@@ -249,6 +246,25 @@
249
246
  return 'replace';
250
247
  },
251
248
 
249
+ parse_scenario : function (scenario) {
250
+ // This logic had to be made more complex since some users were using commas in the url path
251
+ // So we cannot simply just split on a comma
252
+ var directive_match = scenario[0].match(/(.+),\s*(\w+)\s*$/),
253
+ media_query = scenario[1];
254
+
255
+ if (directive_match) {
256
+ var path = directive_match[1],
257
+ directive = directive_match[2];
258
+ }
259
+ else {
260
+ var cached_split = scenario[0].split(/,\s*$/),
261
+ path = cached_split[0],
262
+ directive = '';
263
+ }
264
+
265
+ return [this.trim(path), this.convert_directive(directive), this.trim(media_query)];
266
+ },
267
+
252
268
  object : function(el) {
253
269
  var raw_arr = this.parse_data_attr(el),
254
270
  scenarios = [],
@@ -259,10 +275,7 @@
259
275
  var split = raw_arr[i].split(/\((.*?)(\))$/);
260
276
 
261
277
  if (split.length > 1) {
262
- var cached_split = split[0].split(/\, /),
263
- params = this.parse_params(cached_split[0],
264
- cached_split[1], split[1]);
265
-
278
+ var params = this.parse_scenario(split);
266
279
  scenarios.push(params);
267
280
  }
268
281
  }
@@ -423,15 +423,18 @@
423
423
  }
424
424
 
425
425
  if (!/body/i.test(this.settings.$target.selector)) {
426
+ var topAdjustment = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0,
427
+ leftAdjustment = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0;
428
+
426
429
  if (this.bottom()) {
427
430
  if (this.rtl) {
428
431
  this.settings.$next_tip.css({
429
- top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
430
- left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
432
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
433
+ left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + leftAdjustment});
431
434
  } else {
432
435
  this.settings.$next_tip.css({
433
- top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight()),
434
- left: this.settings.$target.offset().left});
436
+ top: (this.settings.$target.offset().top + nub_height + this.settings.$target.outerHeight() + topAdjustment),
437
+ left: this.settings.$target.offset().left + leftAdjustment});
435
438
  }
436
439
 
437
440
  this.nub_position($nub, this.settings.tip_settings.nub_position, 'top');
@@ -439,12 +442,12 @@
439
442
  } else if (this.top()) {
440
443
  if (this.rtl) {
441
444
  this.settings.$next_tip.css({
442
- top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
445
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
443
446
  left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth()});
444
447
  } else {
445
448
  this.settings.$next_tip.css({
446
- top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height),
447
- left: this.settings.$target.offset().left});
449
+ top: (this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - nub_height + topAdjustment),
450
+ left: this.settings.$target.offset().left + leftAdjustment});
448
451
  }
449
452
 
450
453
  this.nub_position($nub, this.settings.tip_settings.nub_position, 'bottom');
@@ -452,16 +455,16 @@
452
455
  } else if (this.right()) {
453
456
 
454
457
  this.settings.$next_tip.css({
455
- top: this.settings.$target.offset().top,
456
- left: (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width)});
458
+ top: this.settings.$target.offset().top + topAdjustment,
459
+ left: (this.settings.$target.outerWidth() + this.settings.$target.offset().left + nub_width + leftAdjustment)});
457
460
 
458
461
  this.nub_position($nub, this.settings.tip_settings.nub_position, 'left');
459
462
 
460
463
  } else if (this.left()) {
461
464
 
462
465
  this.settings.$next_tip.css({
463
- top: this.settings.$target.offset().top,
464
- left: (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width)});
466
+ top: this.settings.$target.offset().top + topAdjustment,
467
+ left: (this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - nub_width + leftAdjustment)});
465
468
 
466
469
  this.nub_position($nub, this.settings.tip_settings.nub_position, 'right');
467
470
 
@@ -98,9 +98,6 @@
98
98
  var self = this,
99
99
  should_bind_events = !S(this).data(this.attr_name(true));
100
100
 
101
- if (typeof method === 'string') {
102
- return this[method].call(this, options);
103
- }
104
101
 
105
102
  if (S(this.scope).is('[' + this.attr_name() +']')) {
106
103
  S(this.scope).data(this.attr_name(true) + '-init', $.extend({}, this.settings, (options || method), this.data_options(S(this.scope))));
@@ -119,6 +116,11 @@
119
116
  }
120
117
  });
121
118
  }
119
+ // # Patch to fix #5043 to move this *after* the if/else clause in order for Backbone and similar frameworks to have improved control over event binding and data-options updating.
120
+ if (typeof method === 'string') {
121
+ return this[method].call(this, options);
122
+ }
123
+
122
124
  };
123
125
 
124
126
  var single_image_loaded = function (image, callback) {
@@ -530,7 +532,7 @@
530
532
  // Class (String): Class name for the generated <meta> tag
531
533
  register_media : function (media, media_class) {
532
534
  if(Foundation.media_queries[media] === undefined) {
533
- $('head').append('<meta class="' + media_class + '">');
535
+ $('head').append('<meta class="' + media_class + '"/>');
534
536
  Foundation.media_queries[media] = removeQuotes($('.' + media_class).css('font-family'));
535
537
  }
536
538
  },
@@ -41,7 +41,7 @@
41
41
  }
42
42
 
43
43
  // Account for expedition height if fixed position
44
- var scroll_top = target.offset().top;
44
+ var scroll_top = target.offset().top - settings.destination_threshold;
45
45
  scroll_top = scroll_top - expedition.outerHeight();
46
46
 
47
47
  $('html, body').stop().animate({
@@ -71,11 +71,12 @@
71
71
  var self = this;
72
72
  $('[' + this.attr_name() + '=fixed]', self.scope).each(function(idx, el) {
73
73
  var expedition = $(this),
74
+ settings = expedition.data('magellan-expedition-init'),
74
75
  styles = expedition.attr('styles'), // save styles
75
76
  top_offset;
76
77
 
77
78
  expedition.attr('style', '');
78
- top_offset = expedition.offset().top + self.settings.threshold;
79
+ top_offset = expedition.offset().top + settings.threshold;
79
80
 
80
81
  expedition.data(self.data_attr('magellan-top-offset'), top_offset);
81
82
  expedition.attr('style', styles);
@@ -88,6 +89,7 @@
88
89
 
89
90
  $('[' + this.attr_name() + '=fixed]', self.scope).each(function() {
90
91
  var expedition = $(this),
92
+ settings = expedition.data('magellan-expedition-init'),
91
93
  top_offset = expedition.data('magellan-top-offset');
92
94
 
93
95
  if (window_top_offset >= top_offset) {
@@ -100,7 +102,7 @@
100
102
  placeholder.attr(self.add_namespace('data-magellan-expedition-clone'),'');
101
103
  expedition.before(placeholder);
102
104
  }
103
- expedition.css({position:'fixed', top: self.settings.fixed_top});
105
+ expedition.css({position:'fixed', top: settings.fixed_top});
104
106
  } else {
105
107
  expedition.prev('[' + self.add_namespace('data-magellan-expedition-clone') + ']').remove();
106
108
  expedition.attr('style','').removeClass('fixed');
@@ -67,13 +67,13 @@
67
67
 
68
68
  show: function(class_name, $off_canvas) {
69
69
  $off_canvas = $off_canvas || this.get_wrapper();
70
- $off_canvas.trigger('open');
70
+ $off_canvas.trigger('open').trigger('open.fndtn.offcanvas');
71
71
  $off_canvas.addClass(class_name);
72
72
  },
73
73
 
74
74
  hide: function(class_name, $off_canvas) {
75
75
  $off_canvas = $off_canvas || this.get_wrapper();
76
- $off_canvas.trigger('close');
76
+ $off_canvas.trigger('close').trigger('close.fndtn.offcanvas');
77
77
  $off_canvas.removeClass(class_name);
78
78
  },
79
79