zurb-foundation 4.1.2 → 4.1.5

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 (70) hide show
  1. data/CONTRIBUTING.md +2 -2
  2. data/Gemfile.lock +1 -1
  3. data/README.md +11 -7
  4. data/docs/CHANGELOG.md +22 -3
  5. data/docs/_sidebar-components.html.erb +3 -1
  6. data/docs/_sidebar.html.erb +3 -1
  7. data/docs/components/breadcrumbs.html.erb +9 -1
  8. data/docs/components/forms.html.erb +12 -6
  9. data/docs/components/grid.html.erb +3 -3
  10. data/docs/components/kitchen-sink.html.erb +7 -1
  11. data/docs/components/labels.html.erb +3 -1
  12. data/docs/components/section.html.erb +99 -10
  13. data/docs/components/top-bar.html.erb +2 -2
  14. data/docs/components/type.html.erb +31 -2
  15. data/docs/css/docs.scss +0 -5
  16. data/docs/index.html.erb +2 -0
  17. data/docs/javascript.html.erb +8 -5
  18. data/docs/sass.html.erb +1005 -127
  19. data/js/foundation/foundation.clearing.js +8 -4
  20. data/js/foundation/foundation.dropdown.js +43 -23
  21. data/js/foundation/foundation.forms.js +5 -3
  22. data/js/foundation/foundation.joyride.js +2 -6
  23. data/js/foundation/foundation.js +70 -47
  24. data/js/foundation/foundation.orbit.js +10 -4
  25. data/js/foundation/foundation.reveal.js +8 -3
  26. data/js/foundation/foundation.section.js +188 -72
  27. data/js/foundation/foundation.tooltips.js +4 -3
  28. data/js/foundation/foundation.topbar.js +4 -1
  29. data/lib/foundation/generators/install_generator.rb +2 -2
  30. data/lib/foundation/version.rb +1 -1
  31. data/scss/foundation.scss +1 -1
  32. data/{templates/project/scss/_settings.scss → scss/foundation/_variables.scss} +347 -173
  33. data/scss/foundation/components/_alert-boxes.scss +1 -1
  34. data/scss/foundation/components/_block-grid.scss +6 -2
  35. data/scss/foundation/components/_breadcrumbs.scss +20 -13
  36. data/scss/foundation/components/_button-groups.scss +18 -6
  37. data/scss/foundation/components/_buttons.scss +18 -11
  38. data/scss/foundation/components/_clearing.scss +6 -0
  39. data/scss/foundation/components/_custom-forms.scss +29 -23
  40. data/scss/foundation/components/_dropdown-buttons.scss +1 -1
  41. data/scss/foundation/components/_dropdown.scss +7 -3
  42. data/scss/foundation/components/_flex-video.scss +1 -1
  43. data/scss/foundation/components/_forms.scss +49 -25
  44. data/scss/foundation/components/_global.scss +222 -3
  45. data/scss/foundation/components/_grid.scss +40 -24
  46. data/scss/foundation/components/_inline-lists.scss +1 -1
  47. data/scss/foundation/components/_joyride.scss +4 -6
  48. data/scss/foundation/components/_keystrokes.scss +1 -1
  49. data/scss/foundation/components/_labels.scss +5 -3
  50. data/scss/foundation/components/_magellan.scss +1 -1
  51. data/scss/foundation/components/_orbit.scss +13 -8
  52. data/scss/foundation/components/_pagination.scss +1 -1
  53. data/scss/foundation/components/_panels.scss +1 -1
  54. data/scss/foundation/components/_pricing-tables.scss +1 -1
  55. data/scss/foundation/components/_progress-bars.scss +1 -1
  56. data/scss/foundation/components/_reveal.scss +7 -7
  57. data/scss/foundation/components/_section.scss +75 -21
  58. data/scss/foundation/components/_side-nav.scss +1 -1
  59. data/scss/foundation/components/_split-buttons.scss +10 -3
  60. data/scss/foundation/components/_sub-nav.scss +1 -1
  61. data/scss/foundation/components/_switch.scss +1 -1
  62. data/scss/foundation/components/_thumbs.scss +3 -1
  63. data/scss/foundation/components/_top-bar.scss +8 -6
  64. data/scss/foundation/components/_visibility.scss +1 -1
  65. data/scss/normalize.scss +13 -7
  66. data/templates/project/manifest.rb +2 -11
  67. data/templates/project/scss/app.scss +0 -1
  68. metadata +5 -7
  69. data/scss/foundation/_foundation-global.scss +0 -198
  70. data/templates/project/scss/normalize.scss +0 -396
@@ -6,11 +6,17 @@
6
6
  Foundation.libs.section = {
7
7
  name: 'section',
8
8
 
9
- version : '4.1.2',
9
+ version : '4.1.3',
10
10
 
11
11
  settings : {
12
12
  deep_linking: false,
13
13
  one_up: true,
14
+ section_selector : '[data-section]',
15
+ region_selector : 'section, .section, [data-section-region]',
16
+ title_selector : '.title, [data-section-title]',
17
+ active_region_selector : 'section.active, .section.active, .active[data-section-region]',
18
+ content_selector : '.content, [data-section-content]',
19
+ nav_selector : '[data-section="vertical-nav"], [data-section="horizontal-nav"]',
14
20
  callback: function (){}
15
21
  },
16
22
 
@@ -18,6 +24,10 @@
18
24
  var self = this;
19
25
  Foundation.inherit(this, 'throttle data_options position_right offset_right');
20
26
 
27
+ if (typeof method === 'object') {
28
+ $.extend(true, self.settings, method);
29
+ }
30
+
21
31
  if (typeof method != 'string') {
22
32
  this.set_active_from_hash();
23
33
  this.events();
@@ -34,9 +44,10 @@
34
44
  $(this.scope)
35
45
  .on('click.fndtn.section', '[data-section] .title, [data-section] [data-section-title]', function (e) {
36
46
  var $this = $(this),
37
- section = $this.closest('[data-section]');
47
+ section = $this.closest(self.settings.section_selector);
38
48
 
39
49
  self.toggle_active.call(this, e, self);
50
+ self.reflow();
40
51
  });
41
52
 
42
53
  $(window)
@@ -52,9 +63,9 @@
52
63
 
53
64
  $(document)
54
65
  .on('click.fndtn.section', function (e) {
55
- if ($(e.target).closest('.title, [data-section-title]').length < 1) {
56
- $('[data-section="vertical-nav"], [data-section="horizontal-nav"]')
57
- .find('section, .section, [data-section-region]')
66
+ if ($(e.target).closest(self.settings.title_selector).length < 1) {
67
+ $(self.settings.nav_selector)
68
+ .children(self.settings.region_selector)
58
69
  .removeClass('active')
59
70
  .attr('style', '');
60
71
  }
@@ -64,11 +75,13 @@
64
75
 
65
76
  toggle_active : function (e, self) {
66
77
  var $this = $(this),
67
- section = $this.closest('section, .section, [data-section-region]'),
68
- content = section.find('.content, [data-section-content]'),
69
- parent = section.closest('[data-section]'),
70
78
  self = Foundation.libs.section,
71
- settings = $.extend({}, self.settings, self.data_options(parent));
79
+ region = $this.closest(self.settings.region_selector),
80
+ content = $this.siblings(self.settings.content_selector),
81
+ parent = region.parent(),
82
+ settings = $.extend({}, self.settings, self.data_options(parent)),
83
+ prev_active_section = parent
84
+ .children(self.settings.active_region_selector);
72
85
 
73
86
  self.settings.toggled = true;
74
87
 
@@ -76,39 +89,60 @@
76
89
  e.preventDefault();
77
90
  }
78
91
 
79
- if (section.hasClass('active')) {
92
+ if (region.hasClass('active')) {
93
+ // this is causing the style flash.
80
94
  if (self.small(parent)
81
- || self.is_vertical(parent)
82
- || self.is_horizontal(parent)
95
+ || self.is_vertical_nav(parent)
96
+ || self.is_horizontal_nav(parent)
83
97
  || self.is_accordion(parent)) {
84
- section
85
- .removeClass('active')
86
- .attr('style', '');
98
+ if (prev_active_section[0] !== region[0]
99
+ || (prev_active_section[0] === region[0] && !settings.one_up)) {
100
+ region
101
+ .removeClass('active')
102
+ .attr('style', '');
103
+ }
87
104
  }
88
105
  } else {
89
- var prev_active_section = null,
90
- title_height = self.outerHeight(section.find('.title, [data-section-title]'));
106
+ var prev_active_section = parent
107
+ .children(self.settings.active_region_selector),
108
+ title_height = self.outerHeight(region
109
+ .children(self.settings.title_selector));
91
110
 
92
111
  if (self.small(parent) || settings.one_up) {
93
- prev_active_section = $this.closest('[data-section]').find('section.active, .section.active, .active[data-section-region]');
94
112
 
95
113
  if (self.small(parent)) {
96
114
  prev_active_section.attr('style', '');
97
115
  } else {
98
- prev_active_section.attr('style', 'visibility: hidden; padding-top: '+title_height+'px;');
116
+ prev_active_section.attr('style',
117
+ 'visibility: hidden; padding-top: '+title_height+'px;');
99
118
  }
100
119
  }
101
120
 
102
121
  if (self.small(parent)) {
103
- section.attr('style', '');
122
+ region.attr('style', '');
104
123
  } else {
105
- section.css('padding-top', title_height);
124
+ region.css('padding-top', title_height);
125
+ }
126
+
127
+ region.addClass('active');
128
+
129
+ if (prev_active_section.length > 0) {
130
+ prev_active_section
131
+ .removeClass('active')
132
+ .attr('style', '');
106
133
  }
107
134
 
108
- section.addClass('active');
135
+ // Toggle the content display attribute. This is done to
136
+ // ensure accurate outerWidth measurements that account for
137
+ // the scrollbar.
138
+ if (self.is_vertical_tabs(parent)) {
139
+ content.css('display', 'block');
109
140
 
110
- if (prev_active_section !== null) {
111
- prev_active_section.removeClass('active').attr('style', '');
141
+ if (prev_active_section !== null) {
142
+ prev_active_section
143
+ .children(self.settings.content_selector)
144
+ .css('display', 'none');
145
+ }
112
146
  }
113
147
  }
114
148
 
@@ -120,12 +154,13 @@
120
154
  },
121
155
 
122
156
  resize : function () {
123
- var sections = $('[data-section]'),
124
- self = Foundation.libs.section;
157
+ var self = Foundation.libs.section,
158
+ sections = $(self.settings.section_selector);
125
159
 
126
160
  sections.each(function() {
127
161
  var $this = $(this),
128
- active_section = $this.find('section.active, .section.active, .active[data-section-region]'),
162
+ active_section = $this
163
+ .children(self.settings.active_region_selector),
129
164
  settings = $.extend({}, self.settings, self.data_options($this));
130
165
 
131
166
  if (active_section.length > 1) {
@@ -134,32 +169,35 @@
134
169
  .removeClass('active')
135
170
  .attr('style', '');
136
171
  } else if (active_section.length < 1
137
- && !self.is_vertical($this)
138
- && !self.is_horizontal($this)
172
+ && !self.is_vertical_nav($this)
173
+ && !self.is_horizontal_nav($this)
139
174
  && !self.is_accordion($this)) {
140
175
 
141
- var first = $this.find('section, .section, [data-section-region]').first();
176
+ var first = $this.children(self.settings.region_selector).first();
142
177
 
143
- if (settings.one_up) {
178
+ if (settings.one_up || !self.small($this)) {
144
179
  first.addClass('active');
145
180
  }
146
181
 
147
182
  if (self.small($this)) {
148
183
  first.attr('style', '');
149
184
  } else {
150
- first.css('padding-top', self.outerHeight(first.find('.title, [data-section-title]')));
185
+ first.css('padding-top', self.outerHeight(first
186
+ .children(self.settings.title_selector)));
151
187
  }
152
188
  }
153
189
 
154
190
  if (self.small($this)) {
155
191
  active_section.attr('style', '');
156
192
  } else {
157
- active_section.css('padding-top', self.outerHeight(active_section.find('.title, [data-section-title]')));
193
+ active_section.css('padding-top', self.outerHeight(active_section
194
+ .children(self.settings.title_selector)));
158
195
  }
159
196
 
160
197
  self.position_titles($this);
161
198
 
162
- if (self.is_horizontal($this) && !self.small($this)) {
199
+ if ( (self.is_horizontal_nav($this) && !self.small($this))
200
+ || self.is_vertical_tabs($this)) {
163
201
  self.position_content($this);
164
202
  } else {
165
203
  self.position_content($this, false);
@@ -167,11 +205,11 @@
167
205
  });
168
206
  },
169
207
 
170
- is_vertical : function (el) {
208
+ is_vertical_nav : function (el) {
171
209
  return /vertical-nav/i.test(el.data('section'));
172
210
  },
173
211
 
174
- is_horizontal : function (el) {
212
+ is_horizontal_nav : function (el) {
175
213
  return /horizontal-nav/i.test(el.data('section'));
176
214
  },
177
215
 
@@ -179,8 +217,12 @@
179
217
  return /accordion/i.test(el.data('section'));
180
218
  },
181
219
 
182
- is_tabs : function (el) {
183
- return /tabs/i.test(el.data('section'));
220
+ is_horizontal_tabs : function (el) {
221
+ return /^tabs$/i.test(el.data('section'));
222
+ },
223
+
224
+ is_vertical_tabs : function (el) {
225
+ return /vertical-tabs/i.test(el.data('section'));
184
226
  },
185
227
 
186
228
  set_active_from_hash : function () {
@@ -193,21 +235,29 @@
193
235
  settings = $.extend({}, self.settings, self.data_options(section));
194
236
 
195
237
  if (hash.length > 0 && settings.deep_linking) {
196
- section
197
- .find('section, .section, [data-section-region]')
238
+ var regions = section
239
+ .children(self.settings.region_selector)
198
240
  .attr('style', '')
199
241
  .removeClass('active');
200
- section
201
- .find('.content[data-slug="' + hash + '"], [data-section-content][data-slug="' + hash + '"]')
202
- .closest('section, .section, [data-section-region]')
242
+ regions
243
+ .map(function () {
244
+ return $(this).children('.content[data-slug="' + hash + '"], [data-section-content][data-slug="' + hash + '"]');
245
+ })
246
+ .parent()
203
247
  .addClass('active');
204
248
  }
205
249
  });
206
250
  },
207
251
 
208
252
  position_titles : function (section, off) {
209
- var titles = section.find('.title, [data-section-title]'),
253
+ var self = this,
254
+ titles = section
255
+ .children(this.settings.region_selector)
256
+ .map(function () {
257
+ return $(this).children(self.settings.title_selector);
258
+ }),
210
259
  previous_width = 0,
260
+ previous_height = 0,
211
261
  self = this;
212
262
 
213
263
  if (typeof off === 'boolean') {
@@ -215,59 +265,125 @@
215
265
 
216
266
  } else {
217
267
  titles.each(function () {
218
- if (!self.rtl) {
219
- $(this).css('left', previous_width);
268
+ if (self.is_vertical_tabs(section)) {
269
+ $(this).css('top', previous_height);
270
+ previous_height += self.outerHeight($(this));
220
271
  } else {
221
- $(this).css('right', previous_width);
272
+ if (!self.rtl) {
273
+ $(this).css('left', previous_width);
274
+ } else {
275
+ $(this).css('right', previous_width);
276
+ }
277
+ previous_width += self.outerWidth($(this));
222
278
  }
223
- previous_width += self.outerWidth($(this));
224
279
  });
225
280
  }
226
281
  },
227
282
 
228
283
  position_content : function (section, off) {
229
- var titles = section.find('.title, [data-section-title]'),
230
- content = section.find('.content, [data-section-content]'),
231
- self = this;
284
+ var self = this,
285
+ regions = section.children(self.settings.region_selector),
286
+ titles = regions
287
+ .map(function () {
288
+ return $(this).children(self.settings.title_selector);
289
+ }),
290
+ content = regions
291
+ .map(function () {
292
+ return $(this).children(self.settings.content_selector);
293
+ });
232
294
 
233
295
  if (typeof off === 'boolean') {
234
296
  content.attr('style', '');
235
297
  section.attr('style', '');
236
298
  } else {
237
- section.find('section, .section, [data-section-region]').each(function () {
238
- var title = $(this).find('.title, [data-section-title]'),
239
- content = $(this).find('.content, [data-section-content]');
240
- if (!self.rtl) {
241
- content.css({left: title.position().left - 1, top: self.outerHeight(title) - 2});
299
+ if (self.is_vertical_tabs(section)
300
+ && !self.small(section)) {
301
+ var content_min_height = 0,
302
+ content_min_width = Number.MAX_VALUE,
303
+ title_width = null;
304
+
305
+ regions.each(function () {
306
+ var region = $(this),
307
+ title = region.children(self.settings.title_selector),
308
+ content = region.children(self.settings.content_selector),
309
+ content_width = 0;
310
+
311
+ title_width = self.outerWidth(title);
312
+ content_width = self.outerWidth(section) - title_width;
313
+ if (content_width < content_min_width) {
314
+ content_min_width = content_width;
315
+ }
316
+
317
+ // Increment the minimum height of the content region
318
+ // to align with the height of the titles.
319
+ content_min_height += self.outerHeight(title);
320
+
321
+ // Set all of the inactive tabs to 'display: none'
322
+ // The CSS sets all of the tabs as 'display: block'
323
+ // in order to account for scrollbars when measuring the width
324
+ // of the content regions.
325
+ if (!$(this).hasClass('active')) {
326
+ content.css('display', 'none');
327
+ }
328
+ });
329
+
330
+ regions.each(function () {
331
+ var content = $(this).children(self.settings.content_selector);
332
+ content.css('minHeight', content_min_height);
333
+
334
+ // Remove 2 pixels to account for the right-shift in the CSS
335
+ content.css('maxWidth', content_min_width - 2);
336
+ });
337
+
338
+ // Adjust the outer section container width to match
339
+ // the width of the title and content
340
+ section.css('maxWidth', title_width + content_min_width);
341
+ } else {
342
+ regions.each(function () {
343
+ var region = $(this),
344
+ title = region.children(self.settings.title_selector),
345
+ content = region.children(self.settings.content_selector);
346
+ if (!self.rtl) {
347
+ content
348
+ .css({left: title.position().left - 1,
349
+ top: self.outerHeight(title) - 2});
350
+ } else {
351
+ content
352
+ .css({right: self.position_right(title) + 1,
353
+ top: self.outerHeight(title) - 2});
354
+ }
355
+ });
356
+
357
+ // temporary work around for Zepto outerheight calculation issues.
358
+ if (typeof Zepto === 'function') {
359
+ section.height(this.outerHeight(titles.first()));
242
360
  } else {
243
- content.css({right: self.position_right(title) + 1, top: self.outerHeight(title) - 2});
361
+ section.height(this.outerHeight(titles.first()) - 2);
244
362
  }
245
- });
246
-
247
- // temporary work around for Zepto outerheight calculation issues.
248
- if (typeof Zepto === 'function') {
249
- section.height(this.outerHeight(titles.first()));
250
- } else {
251
- section.height(this.outerHeight(titles.first()) - 2);
252
363
  }
253
364
  }
254
-
255
365
  },
256
366
 
257
367
  position_right : function (el) {
258
- var section = el.closest('[data-section]'),
259
- section_width = el.closest('[data-section]').width(),
260
- offset = section.find('.title, [data-section-title]').length;
368
+ var self = this,
369
+ section = el.closest(this.settings.section_selector),
370
+ regions = section.children(this.settings.region_selector),
371
+ section_width = el.closest(this.settings.section_selector).width(),
372
+ offset = regions
373
+ .map(function () {
374
+ return $(this).children(self.settings.title_selector);
375
+ }).length;
261
376
  return (section_width - el.position().left - el.width() * (el.index() + 1) - offset);
262
377
  },
263
378
 
264
- reflow : function () {
265
- $('[data-section]').trigger('resize');
379
+ reflow : function (scope) {
380
+ var scope = scope || document;
381
+ $(this.settings.section_selector, scope).trigger('resize');
266
382
  },
267
383
 
268
384
  small : function (el) {
269
385
  var settings = $.extend({}, this.settings, this.data_options(el));
270
- if (this.is_tabs(el)) {
386
+ if (this.is_horizontal_tabs(el)) {
271
387
  return false;
272
388
  }
273
389
  if (el && this.is_accordion(el)) {
@@ -288,4 +404,4 @@
288
404
  $(document).off('.fndtn.section')
289
405
  }
290
406
  };
291
- }(Foundation.zj, this, this.document));
407
+ }(Foundation.zj, this, this.document));
@@ -6,12 +6,13 @@
6
6
  Foundation.libs.tooltips = {
7
7
  name: 'tooltips',
8
8
 
9
- version : '4.1.0',
9
+ version : '4.1.3',
10
10
 
11
11
  settings : {
12
12
  selector : '.has-tip',
13
13
  additionalInheritableClasses : [],
14
14
  tooltipClass : '.tooltip',
15
+ appendTo: 'body',
15
16
  tipTemplate : function (selector, content) {
16
17
  return '<span data-selector="' + selector + '" class="'
17
18
  + Foundation.libs.tooltips.settings.tooltipClass.substring(1)
@@ -98,10 +99,10 @@
98
99
  },
99
100
 
100
101
  create : function ($target) {
101
- var $tip = $(this.settings.tipTemplate(this.selector($target), $('<div>').html($target.attr('title')).html())),
102
+ var $tip = $(this.settings.tipTemplate(this.selector($target), $('<div></div>').html($target.attr('title')).html())),
102
103
  classes = this.inheritable_classes($target);
103
104
 
104
- $tip.addClass(classes).appendTo('body');
105
+ $tip.addClass(classes).appendTo(this.settings.appendTo);
105
106
  if (Modernizr.touch) {
106
107
  $tip.append('<span class="tap-to-close">tap to close </span>');
107
108
  }