foundation-rails 6.2.1.0 → 6.2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bower.json +1 -1
  4. data/lib/foundation/rails/version.rb +1 -1
  5. data/lib/generators/foundation/templates/_settings.scss +1 -1
  6. data/vendor/assets/js/foundation.abide.js.es6 +27 -11
  7. data/vendor/assets/js/foundation.accordion.js.es6 +1 -1
  8. data/vendor/assets/js/foundation.accordionMenu.js.es6 +10 -7
  9. data/vendor/assets/js/foundation.core.js.es6 +3 -3
  10. data/vendor/assets/js/foundation.drilldown.js.es6 +31 -23
  11. data/vendor/assets/js/foundation.dropdown.js.es6 +1 -1
  12. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +34 -26
  13. data/vendor/assets/js/foundation.equalizer.js.es6 +27 -6
  14. data/vendor/assets/js/foundation.interchange.js.es6 +22 -16
  15. data/vendor/assets/js/foundation.magellan.js.es6 +1 -1
  16. data/vendor/assets/js/foundation.offcanvas.js.es6 +6 -3
  17. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +10 -3
  18. data/vendor/assets/js/foundation.reveal.js.es6 +53 -35
  19. data/vendor/assets/js/foundation.slider.js.es6 +31 -11
  20. data/vendor/assets/js/foundation.sticky.js.es6 +30 -27
  21. data/vendor/assets/js/foundation.tabs.js.es6 +13 -5
  22. data/vendor/assets/js/foundation.tooltip.js.es6 +12 -6
  23. data/vendor/assets/js/foundation.util.box.js.es6 +1 -1
  24. data/vendor/assets/js/foundation.util.keyboard.js.es6 +3 -3
  25. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +15 -11
  26. data/vendor/assets/js/foundation.util.touch.js.es6 +1 -1
  27. data/vendor/assets/scss/components/_accordion.scss +27 -7
  28. data/vendor/assets/scss/components/_button-group.scss +15 -23
  29. data/vendor/assets/scss/components/_button.scss +5 -0
  30. data/vendor/assets/scss/components/_dropdown-menu.scss +16 -5
  31. data/vendor/assets/scss/components/_media-object.scss +8 -2
  32. data/vendor/assets/scss/components/_menu.scss +9 -7
  33. data/vendor/assets/scss/components/_reveal.scss +7 -0
  34. data/vendor/assets/scss/components/_title-bar.scss +1 -1
  35. data/vendor/assets/scss/forms/_input-group.scss +1 -0
  36. data/vendor/assets/scss/forms/_select.scss +2 -1
  37. data/vendor/assets/scss/foundation.scss +1 -1
  38. data/vendor/assets/scss/grid/_classes.scss +2 -1
  39. data/vendor/assets/scss/grid/_flex-grid.scss +1 -1
  40. data/vendor/assets/scss/grid/_position.scss +1 -1
  41. data/vendor/assets/scss/grid/_row.scss +1 -1
  42. data/vendor/assets/scss/settings/_settings.scss +1 -1
  43. data/vendor/assets/scss/util/_breakpoint.scss +4 -3
  44. data/vendor/assets/scss/util/_mixins.scss +1 -1
  45. metadata +2 -2
@@ -66,31 +66,27 @@ class Sticky {
66
66
  * @private
67
67
  */
68
68
  _parsePoints() {
69
- var top = this.options.topAnchor,
70
- btm = this.options.btmAnchor,
69
+ var top = this.options.topAnchor == "" ? 1 : this.options.topAnchor,
70
+ btm = this.options.btmAnchor== "" ? document.documentElement.scrollHeight : this.options.btmAnchor,
71
71
  pts = [top, btm],
72
72
  breaks = {};
73
- if (top && btm) {
74
-
75
- for (var i = 0, len = pts.length; i < len && pts[i]; i++) {
76
- var pt;
77
- if (typeof pts[i] === 'number') {
78
- pt = pts[i];
79
- } else {
80
- var place = pts[i].split(':'),
81
- anchor = $(`#${place[0]}`);
82
-
83
- pt = anchor.offset().top;
84
- if (place[1] && place[1].toLowerCase() === 'bottom') {
85
- pt += anchor[0].getBoundingClientRect().height;
86
- }
73
+ for (var i = 0, len = pts.length; i < len && pts[i]; i++) {
74
+ var pt;
75
+ if (typeof pts[i] === 'number') {
76
+ pt = pts[i];
77
+ } else {
78
+ var place = pts[i].split(':'),
79
+ anchor = $(`#${place[0]}`);
80
+
81
+ pt = anchor.offset().top;
82
+ if (place[1] && place[1].toLowerCase() === 'bottom') {
83
+ pt += anchor[0].getBoundingClientRect().height;
87
84
  }
88
- breaks[i] = pt;
89
85
  }
90
- } else {
91
- breaks = {0: 1, 1: document.documentElement.scrollHeight};
86
+ breaks[i] = pt;
92
87
  }
93
88
 
89
+
94
90
  this.points = breaks;
95
91
  return;
96
92
  }
@@ -195,7 +191,8 @@ class Sticky {
195
191
  * @private
196
192
  */
197
193
  _setSticky() {
198
- var stickTo = this.options.stickTo,
194
+ var _this = this,
195
+ stickTo = this.options.stickTo,
199
196
  mrgn = stickTo === 'top' ? 'marginTop' : 'marginBottom',
200
197
  notStuckTo = stickTo === 'top' ? 'bottom' : 'top',
201
198
  css = {};
@@ -214,6 +211,9 @@ class Sticky {
214
211
  * @event Sticky#stuckto
215
212
  */
216
213
  .trigger(`sticky.zf.stuckto:${stickTo}`);
214
+ this.$element.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
215
+ _this._setSizes();
216
+ });
217
217
  }
218
218
 
219
219
  /**
@@ -235,12 +235,11 @@ class Sticky {
235
235
 
236
236
  css[mrgn] = 0;
237
237
 
238
- if ((isTop && !stickToTop) || (stickToTop && !isTop)) {
239
- css[stickTo] = anchorPt;
240
- css[notStuckTo] = 0;
238
+ css['bottom'] = 'auto';
239
+ if(isTop) {
240
+ css['top'] = 0;
241
241
  } else {
242
- css[stickTo] = 0;
243
- css[notStuckTo] = anchorPt;
242
+ css['top'] = anchorPt;
244
243
  }
245
244
 
246
245
  css['left'] = '';
@@ -281,6 +280,9 @@ class Sticky {
281
280
  });
282
281
 
283
282
  var newContainerHeight = this.$element[0].getBoundingClientRect().height || this.containerHeight;
283
+ if (this.$element.css("display") == "none") {
284
+ newContainerHeight = 0;
285
+ }
284
286
  this.containerHeight = newContainerHeight;
285
287
  this.$container.css({
286
288
  height: newContainerHeight
@@ -348,8 +350,9 @@ class Sticky {
348
350
  'max-width': ''
349
351
  })
350
352
  .off('resizeme.zf.trigger');
351
-
352
- this.$anchor.off('change.zf.sticky');
353
+ if (this.$anchor && this.$anchor.length) {
354
+ this.$anchor.off('change.zf.sticky');
355
+ }
353
356
  $(window).off(this.scrollListener);
354
357
 
355
358
  if (this.wasWrapped) {
@@ -93,9 +93,12 @@ class Tabs {
93
93
  _events() {
94
94
  this._addKeyHandler();
95
95
  this._addClickHandler();
96
-
96
+ this._setHeightMqHandler = null;
97
+
97
98
  if (this.options.matchHeight) {
98
- $(window).on('changed.zf.mediaquery', this._setHeight.bind(this));
99
+ this._setHeightMqHandler = this._setHeight.bind(this);
100
+
101
+ $(window).on('changed.zf.mediaquery', this._setHeightMqHandler);
99
102
  }
100
103
  }
101
104
 
@@ -129,8 +132,7 @@ class Tabs {
129
132
 
130
133
  this.$tabTitles.off('keydown.zf.tabs').on('keydown.zf.tabs', function(e){
131
134
  if (e.which === 9) return;
132
- e.stopPropagation();
133
- e.preventDefault();
135
+
134
136
 
135
137
  var $element = $(this),
136
138
  $elements = $element.parent('ul').children('li'),
@@ -163,6 +165,10 @@ class Tabs {
163
165
  next: function() {
164
166
  $nextElement.find('[role="tab"]').focus();
165
167
  _this._handleTabChange($nextElement);
168
+ },
169
+ handled: function() {
170
+ e.stopPropagation();
171
+ e.preventDefault();
166
172
  }
167
173
  });
168
174
  });
@@ -271,7 +277,9 @@ class Tabs {
271
277
  .hide();
272
278
 
273
279
  if (this.options.matchHeight) {
274
- $(window).off('changed.zf.mediaquery');
280
+ if (this._setHeightMqHandler != null) {
281
+ $(window).off('changed.zf.mediaquery', this._setHeightMqHandler);
282
+ }
275
283
  }
276
284
 
277
285
  Foundation.unregisterPlugin(this);
@@ -35,7 +35,7 @@ class Tooltip {
35
35
  _init() {
36
36
  var elemId = this.$element.attr('aria-describedby') || Foundation.GetYoDigits(6, 'tooltip');
37
37
 
38
- this.options.positionClass = this._getPositionClass(this.$element);
38
+ this.options.positionClass = this.options.positionClass || this._getPositionClass(this.$element);
39
39
  this.options.tipText = this.options.tipText || this.$element.attr('title');
40
40
  this.template = this.options.template ? $(this.options.template) : this._buildTemplate(elemId);
41
41
 
@@ -249,7 +249,7 @@ class Tooltip {
249
249
  })
250
250
  .on('mouseleave.zf.tooltip', function(e) {
251
251
  clearTimeout(_this.timeout);
252
- if (!isFocus || (!_this.isClick && _this.options.clickOpen)) {
252
+ if (!isFocus || (_this.isClick && !_this.options.clickOpen)) {
253
253
  _this.hide();
254
254
  }
255
255
  });
@@ -259,7 +259,7 @@ class Tooltip {
259
259
  this.$element.on('mousedown.zf.tooltip', function(e) {
260
260
  e.stopImmediatePropagation();
261
261
  if (_this.isClick) {
262
- _this.hide();
262
+ //_this.hide();
263
263
  // _this.isClick = false;
264
264
  } else {
265
265
  _this.isClick = true;
@@ -268,6 +268,11 @@ class Tooltip {
268
268
  }
269
269
  }
270
270
  });
271
+ } else {
272
+ this.$element.on('mousedown.zf.tooltip', function(e) {
273
+ e.stopImmediatePropagation();
274
+ _this.isClick = true;
275
+ });
271
276
  }
272
277
 
273
278
  if (!this.options.disableForTouch) {
@@ -286,11 +291,12 @@ class Tooltip {
286
291
  this.$element
287
292
  .on('focus.zf.tooltip', function(e) {
288
293
  isFocus = true;
289
- // console.log(_this.isClick);
290
294
  if (_this.isClick) {
295
+ // If we're not showing open on clicks, we need to pretend a click-launched focus isn't
296
+ // a real focus, otherwise on hover and come back we get bad behavior
297
+ if(!_this.options.clickOpen) { isFocus = false; }
291
298
  return false;
292
299
  } else {
293
- // $(window)
294
300
  _this.show();
295
301
  }
296
302
  })
@@ -435,4 +441,4 @@ Tooltip.defaults = {
435
441
  // Window exports
436
442
  Foundation.plugin(Tooltip, 'Tooltip');
437
443
 
438
- }(jQuery);
444
+ }(jQuery);
@@ -28,7 +28,7 @@ function ImNotTouchingYou(element, parent, lrOnly, tbOnly) {
28
28
  bottom = (eleDims.offset.top + eleDims.height <= parDims.height + parDims.offset.top);
29
29
  top = (eleDims.offset.top >= parDims.offset.top);
30
30
  left = (eleDims.offset.left >= parDims.offset.left);
31
- right = (eleDims.offset.left + eleDims.width <= parDims.width);
31
+ right = (eleDims.offset.left + eleDims.width <= parDims.width + parDims.offset.left);
32
32
  }
33
33
  else {
34
34
  bottom = (eleDims.offset.top + eleDims.height <= eleDims.windowDims.height + eleDims.windowDims.offset.top);
@@ -66,13 +66,13 @@ var Keyboard = {
66
66
 
67
67
  fn = functions[command];
68
68
  if (fn && typeof fn === 'function') { // execute function if exists
69
- fn.apply();
69
+ var returnValue = fn.apply();
70
70
  if (functions.handled || typeof functions.handled === 'function') { // execute function when event was handled
71
- functions.handled.apply();
71
+ functions.handled(returnValue);
72
72
  }
73
73
  } else {
74
74
  if (functions.unhandled || typeof functions.unhandled === 'function') { // execute function when event was not handled
75
- functions.unhandled.apply();
75
+ functions.unhandled();
76
76
  }
77
77
  }
78
78
  },
@@ -33,10 +33,12 @@ var MediaQuery = {
33
33
  namedQueries = parseStyleToObject(extractedStyles);
34
34
 
35
35
  for (var key in namedQueries) {
36
- self.queries.push({
37
- name: key,
38
- value: `only screen and (min-width: ${namedQueries[key]})`
39
- });
36
+ if(namedQueries.hasOwnProperty(key)) {
37
+ self.queries.push({
38
+ name: key,
39
+ value: `only screen and (min-width: ${namedQueries[key]})`
40
+ });
41
+ }
40
42
  }
41
43
 
42
44
  this.current = this._getCurrentSize();
@@ -68,8 +70,10 @@ var MediaQuery = {
68
70
  */
69
71
  get(size) {
70
72
  for (var i in this.queries) {
71
- var query = this.queries[i];
72
- if (size === query.name) return query.value;
73
+ if(this.queries.hasOwnProperty(i)) {
74
+ var query = this.queries[i];
75
+ if (size === query.name) return query.value;
76
+ }
73
77
  }
74
78
 
75
79
  return null;
@@ -106,14 +110,14 @@ var MediaQuery = {
106
110
  */
107
111
  _watcher() {
108
112
  $(window).on('resize.zf.mediaquery', () => {
109
- var newSize = this._getCurrentSize();
110
-
111
- if (newSize !== this.current) {
112
- // Broadcast the media query change on the window
113
- $(window).trigger('changed.zf.mediaquery', [newSize, this.current]);
113
+ var newSize = this._getCurrentSize(), currentSize = this.current;
114
114
 
115
+ if (newSize !== currentSize) {
115
116
  // Change the current media query
116
117
  this.current = newSize;
118
+
119
+ // Broadcast the media query change on the window
120
+ $(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
117
121
  }
118
122
  });
119
123
  }
@@ -101,7 +101,7 @@
101
101
  ;
102
102
 
103
103
  if('MouseEvent' in window && typeof window.MouseEvent === 'function') {
104
- simulatedEvent = window.MouseEvent(type, {
104
+ simulatedEvent = new window.MouseEvent(type, {
105
105
  'bubbles': true,
106
106
  'cancelable': true,
107
107
  'screenX': first.screenX,
@@ -36,7 +36,7 @@ $accordion-content-border: 1px solid $light-gray !default;
36
36
 
37
37
  /// Default text color of tab content.
38
38
  /// @type Color
39
- $accordion-content-color: foreground($accordion-background, $primary-color) !default;
39
+ $accordion-content-color: foreground($accordion-content-background, $body-font-color) !default;
40
40
 
41
41
  /// Default padding for tab content.
42
42
  /// @type Number | List
@@ -46,12 +46,20 @@ $accordion-content-padding: 1rem !default;
46
46
  @mixin accordion-container {
47
47
  list-style-type: none;
48
48
  background: $accordion-background;
49
- border: $accordion-content-border;
50
- border-bottom: 0;
51
- border-radius: $global-radius;
52
49
  margin-#{$global-left}: 0;
53
50
  }
54
51
 
52
+ /// Adds styles for the accordion item. Apply this to the list item within an accordion ul.
53
+ @mixin accordion-item {
54
+ &:first-child > :first-child {
55
+ border-radius: $global-radius $global-radius 0 0;
56
+ }
57
+
58
+ &:last-child > :last-child {
59
+ border-radius: 0 0 $global-radius $global-radius;
60
+ }
61
+ }
62
+
55
63
  /// Adds styles for the title of an accordion item. Apply this to the link within an accordion item.
56
64
  @mixin accordion-title {
57
65
  display: block;
@@ -60,7 +68,13 @@ $accordion-content-padding: 1rem !default;
60
68
  font-size: rem-calc(12);
61
69
  color: $accordion-item-color;
62
70
  position: relative;
63
- border-bottom: $accordion-content-border;
71
+ border: $accordion-content-border;
72
+ border-bottom: 0;
73
+
74
+ :last-child:not(.is-active) > & {
75
+ border-radius: 0 0 $global-radius $global-radius;
76
+ border-bottom: $accordion-content-border;
77
+ }
64
78
 
65
79
  &:hover,
66
80
  &:focus {
@@ -86,8 +100,14 @@ $accordion-content-padding: 1rem !default;
86
100
  @mixin accordion-content {
87
101
  padding: $accordion-content-padding;
88
102
  display: none;
89
- border-bottom: $accordion-content-border;
103
+ border: $accordion-content-border;
104
+ border-bottom: 0;
90
105
  background-color: $accordion-content-background;
106
+ color: $accordion-content-color;
107
+
108
+ :last-child > &:last-child {
109
+ border-bottom: $accordion-content-border;
110
+ }
91
111
  }
92
112
 
93
113
  @mixin foundation-accordion {
@@ -96,7 +116,7 @@ $accordion-content-padding: 1rem !default;
96
116
  }
97
117
 
98
118
  .accordion-item {
99
- // This class doesn't need styles!
119
+ @include accordion-item;
100
120
  }
101
121
 
102
122
  .accordion-title {
@@ -41,14 +41,16 @@ $buttongroup-expand-max: 6 !default;
41
41
 
42
42
  #{$child-selector} {
43
43
  margin: 0;
44
+ margin-#{$global-right}: $buttongroup-spacing;
45
+ margin-bottom: $buttongroup-spacing;
44
46
  font-size: map-get($button-sizes, default);
45
47
 
46
48
  @if $global-flexbox {
47
49
  flex: 0 0 auto;
48
50
  }
49
51
 
50
- &:not(:last-child) {
51
- margin-right: $buttongroup-spacing;
52
+ &:last-child {
53
+ margin-#{$global-right}: 0;
52
54
  }
53
55
  }
54
56
  }
@@ -60,7 +62,7 @@ $buttongroup-expand-max: 6 !default;
60
62
  $count: null
61
63
  ) {
62
64
  @if not $global-flexbox {
63
- margin-right: -$buttongroup-spacing;
65
+ margin-#{$global-right}: -$buttongroup-spacing;
64
66
 
65
67
  &::before,
66
68
  &::after {
@@ -78,12 +80,12 @@ $buttongroup-expand-max: 6 !default;
78
80
  &:first-child:nth-last-child(#{$i}) {
79
81
  &, &:first-child:nth-last-child(#{$i}) ~ #{$selector} {
80
82
  display: inline-block;
81
- @if #{$buttongroup-spacing} == '0' {
82
- width: #{percentage(1 / $i)};
83
- } @else {
84
- width: calc(#{percentage(1 / $i)} - #{$buttongroup-spacing});
83
+ width: calc(#{percentage(1 / $i)} - #{$buttongroup-spacing});
84
+ margin-#{$global-right}: $buttongroup-spacing;
85
+
86
+ &:last-child {
87
+ margin-#{$global-right}: $buttongroup-spacing * -$buttongroup-expand-max;
85
88
  }
86
- margin-right: $buttongroup-spacing;
87
89
  }
88
90
  }
89
91
  }
@@ -103,20 +105,13 @@ $buttongroup-expand-max: 6 !default;
103
105
  #{$selector} {
104
106
  @if $global-flexbox {
105
107
  flex: 0 0 100%;
106
- margin-#{$global-right}: 0;
107
108
  }
108
109
  @else {
109
110
  width: 100%;
110
- border-#{$global-right}: $buttongroup-spacing solid transparent;
111
111
  }
112
-
113
- &:not(:last-child) {
114
- @if $global-flexbox {
115
- margin-bottom: $buttongroup-spacing;
116
- }
117
- @else {
118
- border-bottom: $buttongroup-spacing solid $body-background;
119
- }
112
+
113
+ &:last-child {
114
+ margin-bottom: 0;
120
115
  }
121
116
  }
122
117
  }
@@ -134,10 +129,7 @@ $buttongroup-expand-max: 6 !default;
134
129
  @else {
135
130
  width: auto;
136
131
  }
137
-
138
- &:not(:last-child) {
139
- margin-#{$global-right}: $buttongroup-spacing;
140
- }
132
+ margin-bottom: 0;
141
133
  }
142
134
  }
143
135
 
@@ -195,7 +187,7 @@ $buttongroup-expand-max: 6 !default;
195
187
 
196
188
  #{$buttongroup-child-selector} {
197
189
  display: block;
198
- margin-right: 0;
190
+ margin-#{$global-right}: 0;
199
191
  }
200
192
  }
201
193
  }