foundation-rails 5.5.3.2 → 6.1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +2 -8
  4. data/Rakefile +23 -0
  5. data/app/views/foundation/rails/styleguide/show.html.erb +2 -5
  6. data/bower.json +2 -2
  7. data/lib/foundation/rails/version.rb +1 -1
  8. data/lib/generators/foundation/install_generator.rb +6 -3
  9. data/lib/generators/foundation/templates/_settings.scss +546 -0
  10. data/lib/generators/foundation/templates/application.html.erb +0 -1
  11. data/lib/generators/foundation/templates/application.html.haml +0 -2
  12. data/lib/generators/foundation/templates/application.html.slim +0 -2
  13. data/lib/generators/foundation/templates/foundation_and_overrides.scss +51 -0
  14. data/vendor/assets/js/foundation.abide.js +418 -0
  15. data/vendor/assets/js/foundation.accordion.js +229 -0
  16. data/vendor/assets/js/foundation.accordionMenu.js +262 -0
  17. data/vendor/assets/js/foundation.core.js +378 -0
  18. data/vendor/assets/js/foundation.drilldown.js +321 -0
  19. data/vendor/assets/js/foundation.dropdown.js +390 -0
  20. data/vendor/assets/js/foundation.dropdownMenu.js +391 -0
  21. data/vendor/assets/js/foundation.equalizer.js +274 -0
  22. data/vendor/assets/js/foundation.interchange.js +184 -0
  23. data/vendor/assets/js/foundation.js +28 -0
  24. data/vendor/assets/js/foundation.magellan.js +212 -0
  25. data/vendor/assets/js/foundation.offcanvas.js +371 -0
  26. data/vendor/assets/js/foundation.orbit.js +419 -0
  27. data/vendor/assets/js/foundation.responsiveMenu.js +145 -0
  28. data/vendor/assets/js/foundation.responsiveToggle.js +106 -0
  29. data/vendor/assets/js/foundation.reveal.js +478 -0
  30. data/vendor/assets/js/foundation.slider.js +484 -0
  31. data/vendor/assets/js/foundation.sticky.js +436 -0
  32. data/vendor/assets/js/foundation.tabs.js +306 -0
  33. data/vendor/assets/js/foundation.toggler.js +147 -0
  34. data/vendor/assets/js/foundation.tooltip.js +429 -0
  35. data/vendor/assets/js/foundation.util.box.js +169 -0
  36. data/vendor/assets/js/foundation.util.keyboard.js +115 -0
  37. data/vendor/assets/js/foundation.util.mediaQuery.js +210 -0
  38. data/vendor/assets/js/foundation.util.motion.js +89 -0
  39. data/vendor/assets/js/foundation.util.nest.js +64 -0
  40. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +78 -0
  41. data/vendor/assets/js/foundation.util.touch.js +339 -0
  42. data/vendor/assets/js/foundation.util.triggers.js +222 -0
  43. data/vendor/assets/scss/_global.scss +626 -0
  44. data/vendor/assets/scss/components/_accordion-menu.scss +32 -0
  45. data/vendor/assets/scss/components/_accordion.scss +113 -0
  46. data/vendor/assets/scss/components/_badge.scss +55 -0
  47. data/vendor/assets/scss/components/_breadcrumbs.scss +94 -0
  48. data/vendor/assets/scss/components/_button-group.scss +130 -0
  49. data/vendor/assets/scss/components/_button.scss +265 -0
  50. data/vendor/assets/scss/components/_callout.scss +105 -0
  51. data/vendor/assets/scss/components/_close-button.scss +61 -0
  52. data/vendor/assets/scss/components/_drilldown.scss +75 -0
  53. data/vendor/assets/scss/components/_dropdown-menu.scss +148 -0
  54. data/vendor/assets/scss/components/_dropdown.scss +64 -0
  55. data/vendor/assets/scss/components/_flex-video.scss +63 -0
  56. data/vendor/assets/scss/components/_float.scss +27 -0
  57. data/vendor/assets/scss/components/_label.scss +56 -0
  58. data/vendor/assets/scss/components/_media-object.scss +74 -0
  59. data/vendor/assets/scss/components/_menu.scss +209 -0
  60. data/vendor/assets/scss/components/_off-canvas.scss +180 -0
  61. data/vendor/assets/scss/components/_orbit.scss +193 -0
  62. data/vendor/assets/scss/components/_pagination.scss +158 -0
  63. data/vendor/assets/scss/components/_progress-bar.scss +83 -0
  64. data/vendor/assets/scss/components/_reveal.scss +156 -0
  65. data/vendor/assets/scss/components/_slider.scss +158 -0
  66. data/vendor/assets/scss/components/_sticky.scss +38 -0
  67. data/vendor/assets/scss/components/_switch.scss +232 -0
  68. data/vendor/assets/scss/components/_table.scss +213 -0
  69. data/vendor/assets/scss/components/_tabs.scss +170 -0
  70. data/vendor/assets/scss/components/_thumbnail.scss +54 -0
  71. data/vendor/assets/scss/components/_title-bar.scss +68 -0
  72. data/vendor/assets/scss/components/_tooltip.scss +100 -0
  73. data/vendor/assets/scss/components/_top-bar.scss +89 -0
  74. data/vendor/assets/scss/components/_visibility.scss +131 -0
  75. data/vendor/assets/scss/forms/_checkbox.scss +36 -0
  76. data/vendor/assets/scss/forms/_error.scss +82 -0
  77. data/vendor/assets/scss/forms/_fieldset.scss +53 -0
  78. data/vendor/assets/scss/forms/_forms.scss +32 -0
  79. data/vendor/assets/scss/forms/_help-text.scss +30 -0
  80. data/vendor/assets/scss/forms/_input-group.scss +91 -0
  81. data/vendor/assets/scss/forms/_label.scss +48 -0
  82. data/vendor/assets/scss/forms/_select.scss +63 -0
  83. data/vendor/assets/scss/forms/_text.scss +154 -0
  84. data/vendor/assets/scss/foundation.scss +91 -0
  85. data/vendor/assets/scss/grid/_classes.scss +153 -0
  86. data/vendor/assets/scss/grid/_column.scss +124 -0
  87. data/vendor/assets/scss/grid/_flex-grid.scss +281 -0
  88. data/vendor/assets/scss/grid/_grid.scss +48 -0
  89. data/vendor/assets/scss/grid/_gutter.scss +34 -0
  90. data/vendor/assets/scss/grid/_layout.scss +33 -0
  91. data/vendor/assets/scss/grid/_position.scss +72 -0
  92. data/vendor/assets/scss/grid/_row.scss +97 -0
  93. data/vendor/assets/scss/grid/_size.scss +24 -0
  94. data/vendor/assets/scss/settings/_settings.scss +547 -0
  95. data/vendor/assets/scss/typography/_alignment.scss +22 -0
  96. data/vendor/assets/scss/typography/_base.scss +439 -0
  97. data/vendor/assets/scss/typography/_helpers.scss +77 -0
  98. data/vendor/assets/scss/typography/_print.scss +73 -0
  99. data/vendor/assets/scss/typography/_typography.scss +28 -0
  100. data/vendor/assets/scss/util/_breakpoint.scss +266 -0
  101. data/vendor/assets/scss/util/_color.scss +41 -0
  102. data/vendor/assets/scss/util/_mixins.scss +223 -0
  103. data/vendor/assets/scss/util/_selector.scss +40 -0
  104. data/vendor/assets/scss/util/_unit.scss +90 -0
  105. data/vendor/assets/scss/util/_util.scss +15 -0
  106. data/vendor/assets/scss/util/_value.scss +126 -0
  107. metadata +97 -64
  108. data/update-gem.sh +0 -20
  109. data/vendor/assets/javascripts/foundation.js +0 -17
  110. data/vendor/assets/javascripts/foundation/foundation.abide.js +0 -426
  111. data/vendor/assets/javascripts/foundation/foundation.accordion.js +0 -125
  112. data/vendor/assets/javascripts/foundation/foundation.alert.js +0 -43
  113. data/vendor/assets/javascripts/foundation/foundation.clearing.js +0 -586
  114. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +0 -468
  115. data/vendor/assets/javascripts/foundation/foundation.equalizer.js +0 -104
  116. data/vendor/assets/javascripts/foundation/foundation.interchange.js +0 -360
  117. data/vendor/assets/javascripts/foundation/foundation.joyride.js +0 -935
  118. data/vendor/assets/javascripts/foundation/foundation.js +0 -732
  119. data/vendor/assets/javascripts/foundation/foundation.magellan.js +0 -214
  120. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +0 -225
  121. data/vendor/assets/javascripts/foundation/foundation.orbit.js +0 -476
  122. data/vendor/assets/javascripts/foundation/foundation.reveal.js +0 -522
  123. data/vendor/assets/javascripts/foundation/foundation.slider.js +0 -296
  124. data/vendor/assets/javascripts/foundation/foundation.tab.js +0 -247
  125. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +0 -348
  126. data/vendor/assets/javascripts/foundation/foundation.topbar.js +0 -458
  127. data/vendor/assets/javascripts/vendor/modernizr.js +0 -1406
  128. data/vendor/assets/stylesheets/foundation.scss +0 -42
  129. data/vendor/assets/stylesheets/foundation/_functions.scss +0 -156
  130. data/vendor/assets/stylesheets/foundation/_settings.scss +0 -1489
  131. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +0 -161
  132. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +0 -128
  133. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +0 -133
  134. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +0 -132
  135. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +0 -208
  136. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +0 -261
  137. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +0 -260
  138. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +0 -130
  139. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +0 -269
  140. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +0 -51
  141. data/vendor/assets/stylesheets/foundation/components/_forms.scss +0 -607
  142. data/vendor/assets/stylesheets/foundation/components/_global.scss +0 -566
  143. data/vendor/assets/stylesheets/foundation/components/_grid.scss +0 -292
  144. data/vendor/assets/stylesheets/foundation/components/_icon-bar.scss +0 -460
  145. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +0 -58
  146. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +0 -220
  147. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +0 -60
  148. data/vendor/assets/stylesheets/foundation/components/_labels.scss +0 -106
  149. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +0 -34
  150. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +0 -606
  151. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +0 -388
  152. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +0 -163
  153. data/vendor/assets/stylesheets/foundation/components/_panels.scss +0 -107
  154. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +0 -150
  155. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +0 -85
  156. data/vendor/assets/stylesheets/foundation/components/_range-slider.scss +0 -177
  157. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +0 -212
  158. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +0 -120
  159. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +0 -203
  160. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +0 -125
  161. data/vendor/assets/stylesheets/foundation/components/_switches.scss +0 -241
  162. data/vendor/assets/stylesheets/foundation/components/_tables.scss +0 -135
  163. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +0 -142
  164. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +0 -66
  165. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +0 -142
  166. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +0 -745
  167. data/vendor/assets/stylesheets/foundation/components/_type.scss +0 -525
  168. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +0 -425
  169. data/vendor/assets/stylesheets/normalize.scss +0 -424
@@ -0,0 +1,169 @@
1
+ !function(Foundation, window){
2
+ /**
3
+ * Compares the dimensions of an element to a container and determines collision events with container.
4
+ * @function
5
+ * @param {jQuery} element - jQuery object to test for collisions.
6
+ * @param {jQuery} parent - jQuery object to use as bounding container.
7
+ * @param {Boolean} lrOnly - set to true to check left and right values only.
8
+ * @param {Boolean} tbOnly - set to true to check top and bottom values only.
9
+ * @default if no parent object passed, detects collisions with `window`.
10
+ * @returns {Boolean} - true if collision free, false if a collision in any direction.
11
+ */
12
+ var ImNotTouchingYou = function(element, parent, lrOnly, tbOnly){
13
+ var eleDims = GetDimensions(element),
14
+ top, bottom, left, right;
15
+
16
+ if(parent){
17
+ var parDims = GetDimensions(parent);
18
+
19
+ bottom = (eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top);
20
+ top = (eleDims.offset.top >= parDims.offset.top);
21
+ left = (eleDims.offset.left >= parDims.offset.left);
22
+ right = (eleDims.offset.left + eleDims.width <= parDims.width);
23
+ }else{
24
+ bottom = (eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top);
25
+ top = (eleDims.offset.top >= eleDims.windowDims.offset.top);
26
+ left = (eleDims.offset.left >= eleDims.windowDims.offset.left);
27
+ right = (eleDims.offset.left + eleDims.width <= eleDims.windowDims.width);
28
+ }
29
+ var allDirs = [bottom, top, left, right];
30
+
31
+ if(lrOnly){ return left === right === true; }
32
+ if(tbOnly){ return top === bottom === true; }
33
+
34
+ return allDirs.indexOf(false) === -1;
35
+ };
36
+
37
+ /**
38
+ * Uses native methods to return an object of dimension values.
39
+ * @function
40
+ * @param {jQuery || HTML} element - jQuery object or DOM element for which to get the dimensions. Can be any element other that document or window.
41
+ * @returns {Object} - nested object of integer pixel values
42
+ * TODO - if element is window, return only those values.
43
+ */
44
+ var GetDimensions = function(elem, test){
45
+ elem = elem.length ? elem[0] : elem;
46
+
47
+ if(elem === window || elem === document){ throw new Error("I'm sorry, Dave. I'm afraid I can't do that."); }
48
+
49
+ var rect = elem.getBoundingClientRect(),
50
+ parRect = elem.parentNode.getBoundingClientRect(),
51
+ winRect = document.body.getBoundingClientRect(),
52
+ winY = window.pageYOffset,
53
+ winX = window.pageXOffset;
54
+
55
+ return {
56
+ width: rect.width,
57
+ height: rect.height,
58
+ offset: {
59
+ top: rect.top + winY,
60
+ left: rect.left + winX
61
+ },
62
+ parentDims: {
63
+ width: parRect.width,
64
+ height: parRect.height,
65
+ offset: {
66
+ top: parRect.top + winY,
67
+ left: parRect.left + winX
68
+ }
69
+ },
70
+ windowDims: {
71
+ width: winRect.width,
72
+ height: winRect.height,
73
+ offset: {
74
+ top: winY,
75
+ left: winX
76
+ }
77
+ }
78
+ };
79
+ };
80
+ /**
81
+ * Returns an object of top and left integer pixel values for dynamically rendered elements,
82
+ * such as: Tooltip, Reveal, and Dropdown
83
+ * @function
84
+ * @param {jQuery} element - jQuery object for the element being positioned.
85
+ * @param {jQuery} anchor - jQuery object for the element's anchor point.
86
+ * @param {String} position - a string relating to the desired position of the element, relative to it's anchor
87
+ * @param {Number} vOffset - integer pixel value of desired vertical separation between anchor and element.
88
+ * @param {Number} hOffset - integer pixel value of desired horizontal separation between anchor and element.
89
+ * @param {Boolean} isOverflow - if a collision event is detected, sets to true to default the element to full width - any desired offset.
90
+ * TODO alter/rewrite to work with `em` values as well/instead of pixels
91
+ */
92
+ var GetOffsets = function(element, anchor, position, vOffset, hOffset, isOverflow){
93
+ var $eleDims = GetDimensions(element),
94
+ // var $eleDims = GetDimensions(element),
95
+ $anchorDims = anchor ? GetDimensions(anchor) : null;
96
+ // $anchorDims = anchor ? GetDimensions(anchor) : null;
97
+ switch(position){
98
+ case 'top':
99
+ return {
100
+ left: $anchorDims.offset.left,
101
+ top: $anchorDims.offset.top - ($eleDims.height + vOffset)
102
+ };
103
+ break;
104
+ case 'left':
105
+ return {
106
+ left: $anchorDims.offset.left - ($eleDims.width + hOffset),
107
+ top: $anchorDims.offset.top
108
+ };
109
+ break;
110
+ case 'right':
111
+ return {
112
+ left: $anchorDims.offset.left + $anchorDims.width + hOffset,
113
+ top: $anchorDims.offset.top
114
+ };
115
+ break;
116
+ case 'center top':
117
+ return {
118
+ left: ($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2),
119
+ top: $anchorDims.offset.top - ($eleDims.height + vOffset)
120
+ };
121
+ break;
122
+ case 'center bottom':
123
+ return {
124
+ left: isOverflow ? hOffset : (($anchorDims.offset.left + ($anchorDims.width / 2)) - ($eleDims.width / 2)),
125
+ top: $anchorDims.offset.top + $anchorDims.height + vOffset
126
+ };
127
+ break;
128
+ case 'center left':
129
+ return {
130
+ left: $anchorDims.offset.left - ($eleDims.width + hOffset),
131
+ top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
132
+ };
133
+ break;
134
+ case 'center right':
135
+ return {
136
+ left: $anchorDims.offset.left + $anchorDims.width + hOffset + 1,
137
+ top: ($anchorDims.offset.top + ($anchorDims.height / 2)) - ($eleDims.height / 2)
138
+ };
139
+ break;
140
+ case 'center':
141
+ return {
142
+ left: ($eleDims.windowDims.offset.left + ($eleDims.windowDims.width / 2)) - ($eleDims.width / 2),
143
+ top: ($eleDims.windowDims.offset.top + ($eleDims.windowDims.height / 2)) - ($eleDims.height / 2)
144
+ };
145
+ break;
146
+ case 'reveal':
147
+ return {
148
+ left: ($eleDims.windowDims.width - $eleDims.width) / 2,
149
+ top: $eleDims.windowDims.offset.top + vOffset
150
+ };
151
+ case 'reveal full':
152
+ return {
153
+ left: $eleDims.windowDims.offset.left,
154
+ top: $eleDims.windowDims.offset.top
155
+ };
156
+ break;
157
+ default:
158
+ return {
159
+ left: $anchorDims.offset.left,
160
+ top: $anchorDims.offset.top + $anchorDims.height + vOffset
161
+ };
162
+ }
163
+ };
164
+ Foundation.Box = {
165
+ ImNotTouchingYou: ImNotTouchingYou,
166
+ GetDimensions: GetDimensions,
167
+ GetOffsets: GetOffsets
168
+ };
169
+ }(window.Foundation, window);
@@ -0,0 +1,115 @@
1
+ /*******************************************
2
+ * *
3
+ * This util was created by Marius Olbertz *
4
+ * Please thank Marius on GitHub /owlbertz *
5
+ * or the web http://www.mariusolbertz.de/ *
6
+ * *
7
+ ******************************************/
8
+ !function($, Foundation){
9
+ 'use strict';
10
+ Foundation.Keyboard = {};
11
+
12
+ var keyCodes = {
13
+ 9: 'TAB',
14
+ 13: 'ENTER',
15
+ 27: 'ESCAPE',
16
+ 32: 'SPACE',
17
+ 37: 'ARROW_LEFT',
18
+ 38: 'ARROW_UP',
19
+ 39: 'ARROW_RIGHT',
20
+ 40: 'ARROW_DOWN'
21
+ };
22
+
23
+ /*
24
+ * Constants for easier comparing.
25
+ * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE
26
+ */
27
+ var keys = (function(kcs) {
28
+ var k = {};
29
+ for (var kc in kcs) k[kcs[kc]] = kcs[kc];
30
+ return k;
31
+ })(keyCodes);
32
+
33
+ Foundation.Keyboard.keys = keys;
34
+
35
+ /**
36
+ * Parses the (keyboard) event and returns a String that represents its key
37
+ * Can be used like Foundation.parseKey(event) === Foundation.keys.SPACE
38
+ * @param {Event} event - the event generated by the event handler
39
+ * @return String key - String that represents the key pressed
40
+ */
41
+ var parseKey = function(event) {
42
+ var key = keyCodes[event.which || event.keyCode] || String.fromCharCode(event.which).toUpperCase();
43
+ if (event.shiftKey) key = 'SHIFT_' + key;
44
+ if (event.ctrlKey) key = 'CTRL_' + key;
45
+ if (event.altKey) key = 'ALT_' + key;
46
+ return key;
47
+ };
48
+ Foundation.Keyboard.parseKey = parseKey;
49
+
50
+
51
+ // plain commands per component go here, ltr and rtl are merged based on orientation
52
+ var commands = {};
53
+
54
+ /**
55
+ * Handles the given (keyboard) event
56
+ * @param {Event} event - the event generated by the event handler
57
+ * @param {String} component - Foundation component's name, e.g. Slider or Reveal
58
+ * @param {Objects} functions - collection of functions that are to be executed
59
+ */
60
+ var handleKey = function(event, component, functions) {
61
+ var commandList = commands[component],
62
+ keyCode = parseKey(event),
63
+ cmds,
64
+ command,
65
+ fn;
66
+ if (!commandList) return console.warn('Component not defined!');
67
+
68
+ if (typeof commandList.ltr === 'undefined') { // this component does not differentiate between ltr and rtl
69
+ cmds = commandList; // use plain list
70
+ } else { // merge ltr and rtl: if document is rtl, rtl overwrites ltr and vice versa
71
+ if (Foundation.rtl()) cmds = $.extend({}, commandList.ltr, commandList.rtl);
72
+
73
+ else cmds = $.extend({}, commandList.rtl, commandList.ltr);
74
+ }
75
+ command = cmds[keyCode];
76
+
77
+
78
+ fn = functions[command];
79
+ if (fn && typeof fn === 'function') { // execute function if exists
80
+ fn.apply();
81
+ if (functions.handled || typeof functions.handled === 'function') { // execute function when event was handled
82
+ functions.handled.apply();
83
+ }
84
+ } else {
85
+ if (functions.unhandled || typeof functions.unhandled === 'function') { // execute function when event was not handled
86
+ functions.unhandled.apply();
87
+ }
88
+ }
89
+ };
90
+ Foundation.Keyboard.handleKey = handleKey;
91
+
92
+ /**
93
+ * Finds all focusable elements within the given `$element`
94
+ * @param {jQuery} $element - jQuery object to search within
95
+ * @return {jQuery} $focusable - all focusable elements within `$element`
96
+ */
97
+ var findFocusable = function($element) {
98
+ return $element.find('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]').filter(function() {
99
+ if (!$(this).is(':visible') || $(this).attr('tabindex') < 0) { return false; } //only have visible elements and those that have a tabindex greater or equal 0
100
+ return true;
101
+ });
102
+ };
103
+ Foundation.Keyboard.findFocusable = findFocusable;
104
+
105
+ /**
106
+ * Returns the component name name
107
+ * @param {Object} component - Foundation component, e.g. Slider or Reveal
108
+ * @return String componentName
109
+ */
110
+
111
+ var register = function(componentName, cmds) {
112
+ commands[componentName] = cmds;
113
+ };
114
+ Foundation.Keyboard.register = register;
115
+ }(jQuery, window.Foundation);
@@ -0,0 +1,210 @@
1
+ !function($, Foundation) {
2
+
3
+ // Default set of media queries
4
+ var defaultQueries = {
5
+ 'default' : 'only screen',
6
+ landscape : 'only screen and (orientation: landscape)',
7
+ portrait : 'only screen and (orientation: portrait)',
8
+ retina : 'only screen and (-webkit-min-device-pixel-ratio: 2),' +
9
+ 'only screen and (min--moz-device-pixel-ratio: 2),' +
10
+ 'only screen and (-o-min-device-pixel-ratio: 2/1),' +
11
+ 'only screen and (min-device-pixel-ratio: 2),' +
12
+ 'only screen and (min-resolution: 192dpi),' +
13
+ 'only screen and (min-resolution: 2dppx)'
14
+ };
15
+
16
+ var MediaQuery = {
17
+ queries: [],
18
+ current: '',
19
+
20
+ /**
21
+ * Checks if the screen is at least as wide as a breakpoint.
22
+ * @function
23
+ * @param {String} size - Name of the breakpoint to check.
24
+ * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller.
25
+ */
26
+ atLeast: function(size) {
27
+ var query = this.get(size);
28
+
29
+ if (query) {
30
+ return window.matchMedia(query).matches;
31
+ }
32
+
33
+ return false;
34
+ },
35
+
36
+ /**
37
+ * Gets the media query of a breakpoint.
38
+ * @function
39
+ * @param {String} size - Name of the breakpoint to get.
40
+ * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist.
41
+ */
42
+ get: function(size) {
43
+ for (var i in this.queries) {
44
+ var query = this.queries[i];
45
+ if (size === query.name) return query.value;
46
+ }
47
+
48
+ return null;
49
+ },
50
+
51
+ /**
52
+ * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
53
+ * @function
54
+ * @private
55
+ */
56
+ _init: function() {
57
+ var self = this;
58
+ var extractedStyles = $('.foundation-mq').css('font-family');
59
+ var namedQueries;
60
+
61
+ namedQueries = parseStyleToObject(extractedStyles);
62
+
63
+ for (var key in namedQueries) {
64
+ self.queries.push({
65
+ name: key,
66
+ value: 'only screen and (min-width: ' + namedQueries[key] + ')'
67
+ });
68
+ }
69
+
70
+ this.current = this._getCurrentSize();
71
+
72
+ this._watcher();
73
+
74
+ // Extend default queries
75
+ // namedQueries = $.extend(defaultQueries, namedQueries);
76
+ },
77
+
78
+ /**
79
+ * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one).
80
+ * @function
81
+ * @private
82
+ * @returns {String} Name of the current breakpoint.
83
+ */
84
+ _getCurrentSize: function() {
85
+ var matched;
86
+
87
+ for (var i in this.queries) {
88
+ var query = this.queries[i];
89
+
90
+ if (window.matchMedia(query.value).matches) {
91
+ matched = query;
92
+ }
93
+ }
94
+
95
+ if(typeof matched === 'object') {
96
+ return matched.name;
97
+ } else {
98
+ return matched;
99
+ }
100
+ },
101
+
102
+ /**
103
+ * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes.
104
+ * @function
105
+ * @private
106
+ */
107
+ _watcher: function() {
108
+ var _this = this;
109
+
110
+ $(window).on('resize.zf.mediaquery', function() {
111
+ var newSize = _this._getCurrentSize();
112
+
113
+ if (newSize !== _this.current) {
114
+ // Broadcast the media query change on the window
115
+ $(window).trigger('changed.zf.mediaquery', [newSize, _this.current]);
116
+
117
+ // Change the current media query
118
+ _this.current = newSize;
119
+ }
120
+ });
121
+ }
122
+ };
123
+
124
+ Foundation.MediaQuery = MediaQuery;
125
+
126
+ // matchMedia() polyfill - Test a CSS media type/query in JS.
127
+ // Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license
128
+ window.matchMedia || (window.matchMedia = function() {
129
+ 'use strict';
130
+
131
+ // For browsers that support matchMedium api such as IE 9 and webkit
132
+ var styleMedia = (window.styleMedia || window.media);
133
+
134
+ // For those that don't support matchMedium
135
+ if (!styleMedia) {
136
+ var style = document.createElement('style'),
137
+ script = document.getElementsByTagName('script')[0],
138
+ info = null;
139
+
140
+ style.type = 'text/css';
141
+ style.id = 'matchmediajs-test';
142
+
143
+ script.parentNode.insertBefore(style, script);
144
+
145
+ // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
146
+ info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
147
+
148
+ styleMedia = {
149
+ matchMedium: function(media) {
150
+ var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
151
+
152
+ // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
153
+ if (style.styleSheet) {
154
+ style.styleSheet.cssText = text;
155
+ } else {
156
+ style.textContent = text;
157
+ }
158
+
159
+ // Test if media query is true or false
160
+ return info.width === '1px';
161
+ }
162
+ };
163
+ }
164
+
165
+ return function(media) {
166
+ return {
167
+ matches: styleMedia.matchMedium(media || 'all'),
168
+ media: media || 'all'
169
+ };
170
+ };
171
+ }());
172
+
173
+ // Thank you: https://github.com/sindresorhus/query-string
174
+ function parseStyleToObject(str) {
175
+ var styleObject = {};
176
+
177
+ if (typeof str !== 'string') {
178
+ return styleObject;
179
+ }
180
+
181
+ str = str.trim().slice(1, -1); // browsers re-quote string style values
182
+
183
+ if (!str) {
184
+ return styleObject;
185
+ }
186
+
187
+ styleObject = str.split('&').reduce(function(ret, param) {
188
+ var parts = param.replace(/\+/g, ' ').split('=');
189
+ var key = parts[0];
190
+ var val = parts[1];
191
+ key = decodeURIComponent(key);
192
+
193
+ // missing `=` should be `null`:
194
+ // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
195
+ val = val === undefined ? null : decodeURIComponent(val);
196
+
197
+ if (!ret.hasOwnProperty(key)) {
198
+ ret[key] = val;
199
+ } else if (Array.isArray(ret[key])) {
200
+ ret[key].push(val);
201
+ } else {
202
+ ret[key] = [ret[key], val];
203
+ }
204
+ return ret;
205
+ }, {});
206
+
207
+ return styleObject;
208
+ }
209
+
210
+ }(jQuery, Foundation);