zurb-foundation 4.1.6 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/CONTRIBUTING.md +5 -4
  2. data/Gemfile.lock +1 -1
  3. data/README.md +7 -0
  4. data/docs/CHANGELOG.md +27 -0
  5. data/docs/Gemfile +2 -0
  6. data/docs/Gemfile.lock +10 -0
  7. data/docs/_sidebar-components.html.erb +1 -0
  8. data/docs/_sidebar.html.erb +1 -0
  9. data/docs/components/alert-boxes.html.erb +8 -3
  10. data/docs/components/block-grid.html.erb +3 -3
  11. data/docs/components/breadcrumbs.html.erb +2 -2
  12. data/docs/components/button-groups.html.erb +2 -2
  13. data/docs/components/buttons.html.erb +3 -3
  14. data/docs/components/clearing.html.erb +7 -6
  15. data/docs/components/custom-forms.html.erb +1 -0
  16. data/docs/components/dropdown-buttons.html.erb +3 -3
  17. data/docs/components/dropdown.html.erb +20 -4
  18. data/docs/components/flex-video.html.erb +3 -3
  19. data/docs/components/forms.html.erb +5 -5
  20. data/docs/components/global.html.erb +235 -3
  21. data/docs/components/grid.html.erb +2 -2
  22. data/docs/components/inline-lists.html.erb +3 -3
  23. data/docs/components/interchange.html.erb +127 -0
  24. data/docs/components/keystrokes.html.erb +3 -3
  25. data/docs/components/kitchen-sink.html.erb +2 -2
  26. data/docs/components/labels.html.erb +3 -3
  27. data/docs/components/orbit.html.erb +120 -8
  28. data/docs/components/pagination.html.erb +5 -5
  29. data/docs/components/panels.html.erb +3 -3
  30. data/docs/components/pricing-tables.html.erb +3 -3
  31. data/docs/components/progress-bars.html.erb +3 -3
  32. data/docs/components/reveal.html.erb +126 -7
  33. data/docs/components/section.html.erb +43 -1
  34. data/docs/components/side-nav.html.erb +3 -3
  35. data/docs/components/split-buttons.html.erb +3 -3
  36. data/docs/components/sub-nav.html.erb +4 -4
  37. data/docs/components/switch.html.erb +3 -3
  38. data/docs/components/tables.html.erb +1 -1
  39. data/docs/components/thumbnails.html.erb +2 -2
  40. data/docs/components/tooltips.html.erb +34 -1
  41. data/docs/components/top-bar.html.erb +109 -30
  42. data/docs/components/type.html.erb +2 -1
  43. data/docs/components/visibility.html.erb +8 -8
  44. data/docs/css/normalize.scss +2 -2
  45. data/docs/css/qunit.css +1 -1
  46. data/docs/img/demos/demo1.jpg +0 -0
  47. data/docs/img/demos/demo2.jpg +0 -0
  48. data/docs/img/demos/demo3.jpg +0 -0
  49. data/docs/img/demos/demo4.jpg +0 -0
  50. data/docs/img/demos/demo5.jpg +0 -0
  51. data/docs/img/demos/interchange/default.jpg +0 -0
  52. data/docs/img/demos/interchange/large.jpg +0 -0
  53. data/docs/img/demos/interchange/med.jpg +0 -0
  54. data/docs/img/demos/interchange/small.jpg +0 -0
  55. data/docs/img/demos/interchange/smallest.jpg +0 -0
  56. data/docs/index.html.erb +14 -5
  57. data/docs/javascript.html.erb +2 -4
  58. data/docs/layout.html.erb +1 -1
  59. data/docs/rails.html.erb +4 -1
  60. data/docs/sass.html.erb +1274 -1023
  61. data/js/foundation/foundation.alerts.js +3 -1
  62. data/js/foundation/foundation.clearing.js +1 -1
  63. data/js/foundation/foundation.dropdown.js +25 -6
  64. data/js/foundation/foundation.forms.js +14 -12
  65. data/js/foundation/foundation.interchange.js +265 -0
  66. data/js/foundation/foundation.joyride.js +16 -3
  67. data/js/foundation/foundation.js +53 -7
  68. data/js/foundation/foundation.magellan.js +5 -3
  69. data/js/foundation/foundation.orbit.js +19 -2
  70. data/js/foundation/foundation.reveal.js +64 -11
  71. data/js/foundation/foundation.section.js +26 -17
  72. data/js/foundation/foundation.tooltips.js +16 -8
  73. data/js/foundation/foundation.topbar.js +98 -46
  74. data/js/foundation/index.js +1 -0
  75. data/lib/foundation/generators/install_generator.rb +2 -2
  76. data/lib/foundation/version.rb +1 -1
  77. data/scss/foundation/_variables.scss +134 -71
  78. data/scss/foundation/components/_alert-boxes.scss +20 -20
  79. data/scss/foundation/components/_block-grid.scss +7 -4
  80. data/scss/foundation/components/_breadcrumbs.scss +3 -3
  81. data/scss/foundation/components/_buttons.scss +5 -3
  82. data/scss/foundation/components/_clearing.scss +12 -6
  83. data/scss/foundation/components/_custom-forms.scss +17 -10
  84. data/scss/foundation/components/_dropdown.scss +6 -6
  85. data/scss/foundation/components/_forms.scss +5 -3
  86. data/scss/foundation/components/_global.scss +63 -30
  87. data/scss/foundation/components/_grid.scss +10 -9
  88. data/scss/foundation/components/_joyride.scss +22 -20
  89. data/scss/foundation/components/_keystrokes.scss +1 -1
  90. data/scss/foundation/components/_orbit.scss +108 -30
  91. data/scss/foundation/components/_reveal.scss +12 -8
  92. data/scss/foundation/components/_section.scss +38 -3
  93. data/scss/foundation/components/_switch.scss +18 -12
  94. data/scss/foundation/components/_thumbs.scss +10 -3
  95. data/scss/foundation/components/_tooltips.scss +11 -11
  96. data/scss/foundation/components/_top-bar.scss +102 -64
  97. data/scss/foundation/components/_type.scss +54 -47
  98. data/templates/project/manifest.rb +1 -0
  99. metadata +11 -4
@@ -45,6 +45,8 @@
45
45
 
46
46
  off : function () {
47
47
  $(this.scope).off('.fndtn.alerts');
48
- }
48
+ },
49
+
50
+ reflow : function () {}
49
51
  };
50
52
  }(Foundation.zj, this, this.document));
@@ -388,7 +388,7 @@
388
388
 
389
389
  if (caption) {
390
390
  container
391
- .text(caption)
391
+ .html(caption)
392
392
  .show();
393
393
  } else {
394
394
  container
@@ -6,17 +6,18 @@
6
6
  Foundation.libs.dropdown = {
7
7
  name : 'dropdown',
8
8
 
9
- version : '4.1.3',
9
+ version : '4.2.0',
10
10
 
11
11
  settings : {
12
12
  activeClass: 'open',
13
+ is_hover: false,
13
14
  opened: function(){},
14
15
  closed: function(){}
15
16
  },
16
17
 
17
18
  init : function (scope, method, options) {
18
19
  this.scope = scope || this.scope;
19
- Foundation.inherit(this, 'throttle scrollLeft');
20
+ Foundation.inherit(this, 'throttle scrollLeft data_options');
20
21
 
21
22
  if (typeof method === 'object') {
22
23
  $.extend(true, this.settings, method);
@@ -39,8 +40,19 @@
39
40
 
40
41
  $(this.scope)
41
42
  .on('click.fndtn.dropdown', '[data-dropdown]', function (e) {
42
- e.preventDefault();
43
- self.toggle($(this));
43
+ var settings = $.extend({}, self.settings, self.data_options($(this)));
44
+ e.preventDefault();
45
+
46
+ if (!settings.is_hover) self.toggle($(this));
47
+ })
48
+ .on('mouseenter', '[data-dropdown]', function (e) {
49
+ var settings = $.extend({}, self.settings, self.data_options($(this)));
50
+ if (settings.is_hover) self.toggle($(this));
51
+ })
52
+ .on('mouseleave', '[data-dropdown-content]', function (e) {
53
+ var target = $('[data-dropdown="' + $(this).attr('id') + '"]'),
54
+ settings = $.extend({}, self.settings, self.data_options(target));
55
+ if (settings.is_hover) self.close.call(self, $(this));
44
56
  })
45
57
  .on('opened.fndtn.dropdown', '[data-dropdown-content]', this.settings.opened)
46
58
  .on('closed.fndtn.dropdown', '[data-dropdown-content]', this.settings.closed);
@@ -93,6 +105,7 @@
93
105
  if (dropdown.hasClass(this.settings.activeClass)) {
94
106
  this.close.call(this, dropdown);
95
107
  } else {
108
+ this.close.call(this, $('[data-dropdown-content]'))
96
109
  this.open.call(this, dropdown, target);
97
110
  }
98
111
  },
@@ -107,8 +120,9 @@
107
120
  },
108
121
 
109
122
  css : function (dropdown, target) {
123
+ var offset_parent = dropdown.offsetParent();
110
124
  // temporary workaround until 4.2
111
- if (/body/i.test(dropdown.offsetParent()[0].nodeName)) {
125
+ if (offset_parent.length > 0 && /body/i.test(dropdown.offsetParent()[0].nodeName)) {
112
126
  var position = target.offset();
113
127
  position.top -= dropdown.offsetParent().offset().top;
114
128
  position.left -= dropdown.offsetParent().offset().left;
@@ -127,6 +141,9 @@
127
141
  } else {
128
142
  if (!Foundation.rtl && $(window).width() > this.outerWidth(dropdown) + target.offset().left) {
129
143
  var left = position.left;
144
+ if (dropdown.hasClass('right')) {
145
+ dropdown.removeClass('right');
146
+ }
130
147
  } else {
131
148
  if (!dropdown.hasClass('right')) {
132
149
  dropdown.addClass('right');
@@ -154,6 +171,8 @@
154
171
  $(window).off('.fndtn.dropdown');
155
172
  $('[data-dropdown-content]').off('.fndtn.dropdown');
156
173
  this.settings.init = false;
157
- }
174
+ },
175
+
176
+ reflow : function () {}
158
177
  };
159
178
  }(Foundation.zj, this, this.document));
@@ -4,7 +4,7 @@
4
4
  Foundation.libs.forms = {
5
5
  name: 'forms',
6
6
 
7
- version: '4.1.6',
7
+ version: '4.2.0',
8
8
 
9
9
  cache: {},
10
10
 
@@ -87,6 +87,9 @@
87
87
  }
88
88
  }
89
89
  })
90
+ .on('mousedown.fndtn.forms', 'form.custom div.custom.dropdown', function () {
91
+ return false;
92
+ })
90
93
  .on('click.fndtn.forms', 'form.custom div.custom.dropdown a.current, form.custom div.custom.dropdown a.selector', function (e) {
91
94
  var $this = $(this),
92
95
  $dropdown = $this.closest('div.custom.dropdown'),
@@ -156,7 +159,7 @@
156
159
  if (e.which === 13) {
157
160
  dropdown.find('li.selected').trigger('click');
158
161
  }
159
-
162
+
160
163
  if (e.which === 27) {
161
164
  dropdown.removeClass('open');
162
165
  }
@@ -196,14 +199,14 @@
196
199
  this.settings.init = true;
197
200
  },
198
201
 
199
- go_to: function (dropdown, char) {
202
+ go_to: function (dropdown, character) {
200
203
  var lis = dropdown.find('li'),
201
204
  count = lis.length;
202
205
 
203
206
  if (count > 0) {
204
207
  for (var i = 0; i < count; i++) {
205
208
  var first_letter = lis.eq(i).text().charAt(0).toLowerCase();
206
- if (first_letter === String.fromCharCode(char).toLowerCase()) return lis.eq(i);
209
+ if (first_letter === String.fromCharCode(character).toLowerCase()) return lis.eq(i);
207
210
  }
208
211
  }
209
212
  },
@@ -228,10 +231,6 @@
228
231
  type = $this.attr('type'),
229
232
  $span = $this.next('span.custom.' + type);
230
233
 
231
- if (!$this.parent().hasClass('switch')) {
232
- $this.addClass('hidden-field');
233
- }
234
-
235
234
  if ($span.length === 0) {
236
235
  $span = $('<span class="custom ' + type + '"></span>').insertAfter($this);
237
236
  }
@@ -269,7 +268,8 @@
269
268
  $customList = $customSelect.find("ul");
270
269
 
271
270
  liHtml = $options.map(function () {
272
- return "<li>" + $(this).html() + "</li>";
271
+ var copyClasses = $(this).attr('class') ? $(this).attr('class') : '';
272
+ return "<li class='" + copyClasses + "'>" + $(this).html() + "</li>";
273
273
  }).get().join('');
274
274
 
275
275
  $customList.append(liHtml);
@@ -445,7 +445,7 @@
445
445
  var _self = this;
446
446
 
447
447
  // Set all hidden parent elements, including this element.
448
- _self.hidden = $child.parents().andSelf().filter(":hidden");
448
+ _self.hidden = $child.parents().addBack().filter(":hidden");
449
449
 
450
450
  // Loop through all hidden elements.
451
451
  _self.hidden.each(function () {
@@ -499,7 +499,9 @@
499
499
 
500
500
  off: function () {
501
501
  $(this.scope).off('.fndtn.forms');
502
- }
502
+ },
503
+
504
+ reflow : function () {}
503
505
  };
504
506
 
505
507
  var getFirstPrevSibling = function($el, selector) {
@@ -510,4 +512,4 @@
510
512
  }
511
513
  return $();
512
514
  };
513
- }(Foundation.zj, this, this.document));
515
+ }(Foundation.zj, this, this.document));
@@ -0,0 +1,265 @@
1
+ /*jslint unparam: true, browser: true, indent: 2 */
2
+
3
+ ;(function ($, window, document, undefined) {
4
+ 'use strict';
5
+
6
+ Foundation.libs.interchange = {
7
+ name : 'interchange',
8
+
9
+ version : '4.2.0',
10
+
11
+ cache : {},
12
+
13
+ settings : {
14
+ load_attr : 'interchange',
15
+
16
+ named_queries : {
17
+ 'default' : 'only screen and (min-width: 1px)',
18
+ small : 'only screen and (min-width: 768px)',
19
+ medium : 'only screen and (min-width: 1280px)',
20
+ large : 'only screen and (min-width: 1440px)',
21
+ landscape : 'only screen and (orientation: landscape)',
22
+ portrait : 'only screen and (orientation: portrait)'
23
+ },
24
+
25
+ directives : {
26
+ replace : function (el, path) {
27
+ if (/IMG/.test(el[0].nodeName)) {
28
+ var path_parts = path.split('/'),
29
+ path_file = path_parts[path_parts.length - 1],
30
+ orig_path = el[0].src;
31
+
32
+ if (new RegExp(path_file, 'i').test(el[0].src)) return;
33
+
34
+ el[0].src = path;
35
+
36
+ return el.trigger('replace', [el[0].src, orig_path]);
37
+ }
38
+ }
39
+ }
40
+ },
41
+
42
+ init : function (scope, method, options) {
43
+ Foundation.inherit(this, 'throttle');
44
+
45
+ if (typeof method === 'object') {
46
+ $.extend(true, this.settings, method);
47
+ }
48
+
49
+ this.events();
50
+ this.images();
51
+
52
+ if (typeof method != 'string') {
53
+ return this.settings.init;
54
+ } else {
55
+ return this[method].call(this, options);
56
+ }
57
+ },
58
+
59
+ events : function () {
60
+ var self = this;
61
+
62
+ $(window).on('resize.fndtn.interchange', self.throttle(function () {
63
+ self.resize.call(self);
64
+ }, 50));
65
+ },
66
+
67
+ resize : function () {
68
+ var cache = this.cache;
69
+
70
+ for (var uuid in cache) {
71
+ if (cache.hasOwnProperty(uuid)) {
72
+ var passed = this.results(uuid, cache[uuid]);
73
+
74
+ if (passed) {
75
+ this.settings.directives[passed
76
+ .scenario[1]](passed.el, passed.scenario[0]);
77
+ }
78
+ }
79
+ }
80
+
81
+ },
82
+
83
+ results : function (uuid, scenarios) {
84
+ var count = scenarios.length,
85
+ results_arr = [];
86
+
87
+ if (count > 0) {
88
+ var el = $('[data-uuid="' + uuid + '"]');
89
+
90
+ for (var i = count - 1; i >= 0; i--) {
91
+ var rule = scenarios[i][2];
92
+ if (this.settings.named_queries.hasOwnProperty(rule)) {
93
+ var mq = matchMedia(this.settings.named_queries[rule]);
94
+ } else {
95
+ var mq = matchMedia(scenarios[i][2]);
96
+ }
97
+ if (mq.matches) {
98
+ return {el: el, scenario: scenarios[i]};
99
+ }
100
+ }
101
+ }
102
+
103
+ return false;
104
+ },
105
+
106
+ images : function (force_update) {
107
+ if (typeof this.cached_images === 'undefined' || force_update) {
108
+ return this.update_images();
109
+ }
110
+
111
+ return this.cached_images;
112
+ },
113
+
114
+ update_images : function () {
115
+ var images = document.getElementsByTagName('img'),
116
+ count = images.length,
117
+ data_attr = 'data-' + this.settings.load_attr;
118
+
119
+ this.cached_images = [];
120
+
121
+ for (var i = count - 1; i >= 0; i--) {
122
+ this.loaded($(images[i]), (i === 0), function (image, last) {
123
+ if (image) {
124
+ var str = image.getAttribute(data_attr) || '';
125
+
126
+ if (str.length > 0) {
127
+ this.cached_images.push(image);
128
+ }
129
+ }
130
+
131
+ if (last) this.enhance();
132
+
133
+ }.bind(this));
134
+ }
135
+
136
+ return 'deferred';
137
+ },
138
+
139
+ // based on jquery.imageready.js
140
+ // @weblinc, @jsantell, (c) 2012
141
+
142
+ loaded : function (image, last, callback) {
143
+ function loaded () {
144
+ callback(image[0], last);
145
+ }
146
+
147
+ function bindLoad () {
148
+ this.one('load', loaded);
149
+
150
+ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
151
+ var src = this.attr( 'src' ),
152
+ param = src.match( /\?/ ) ? '&' : '?';
153
+
154
+ param += 'random=' + (new Date()).getTime();
155
+ this.attr('src', src + param);
156
+ }
157
+ }
158
+
159
+ if (!image.attr('src')) {
160
+ loaded();
161
+ return;
162
+ }
163
+
164
+ if (image[0].complete || image[0].readyState === 4) {
165
+ loaded();
166
+ } else {
167
+ bindLoad.call(image);
168
+ }
169
+ },
170
+
171
+ enhance : function () {
172
+ var count = this.images().length;
173
+
174
+ for (var i = count - 1; i >= 0; i--) {
175
+ this._object($(this.images()[i]));
176
+ }
177
+
178
+ return $(window).trigger('resize');
179
+ },
180
+
181
+ parse_params : function (path, directive, mq) {
182
+ return [this.trim(path), this.convert_directive(directive), this.trim(mq)];
183
+ },
184
+
185
+ convert_directive : function (directive) {
186
+ var trimmed = this.trim(directive);
187
+
188
+ if (trimmed.length > 0) {
189
+ return trimmed;
190
+ }
191
+
192
+ return 'replace';
193
+ },
194
+
195
+ _object : function(el) {
196
+ var raw_arr = this.parse_data_attr(el),
197
+ scenarios = [], count = raw_arr.length;
198
+
199
+ if (count > 0) {
200
+ for (var i = count - 1; i >= 0; i--) {
201
+ var split = raw_arr[i].split(/\((.*?)(\))$/);
202
+
203
+ if (split.length > 1) {
204
+ var cached_split = split[0].split(','),
205
+ params = this.parse_params(cached_split[0],
206
+ cached_split[1], split[1]);
207
+
208
+ scenarios.push(params);
209
+ }
210
+ }
211
+ }
212
+
213
+ return this.store(el, scenarios);
214
+ },
215
+
216
+ uuid : function (separator) {
217
+ var delim = separator || "-";
218
+
219
+ function S4() {
220
+ return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
221
+ }
222
+
223
+ return (S4() + S4() + delim + S4() + delim + S4()
224
+ + delim + S4() + delim + S4() + S4() + S4());
225
+ },
226
+
227
+ store : function (el, scenarios) {
228
+ var uuid = this.uuid(),
229
+ current_uuid = el.data('uuid');
230
+
231
+ if (current_uuid) return this.cache[current_uuid];
232
+
233
+ el.attr('data-uuid', uuid);
234
+
235
+ return this.cache[uuid] = scenarios;
236
+ },
237
+
238
+ trim : function(str) {
239
+ if (typeof str === 'string') {
240
+ return $.trim(str);
241
+ }
242
+
243
+ return str;
244
+ },
245
+
246
+ parse_data_attr : function (el) {
247
+ var raw = el.data(this.settings.load_attr).split(/\[(.*?)\]/),
248
+ count = raw.length, output = [];
249
+
250
+ for (var i = count - 1; i >= 0; i--) {
251
+ if (raw[i].replace(/[\W\d]+/, '').length > 4) {
252
+ output.push(raw[i]);
253
+ }
254
+ }
255
+
256
+ return output;
257
+ },
258
+
259
+ reflow : function () {
260
+ this.images(true);
261
+ }
262
+
263
+ };
264
+
265
+ }(Foundation.zj, this, this.document));