foundation-rails 6.2.0.1 → 6.2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/bower.json +2 -2
  3. data/lib/foundation/rails/version.rb +1 -1
  4. data/lib/generators/foundation/templates/_settings.scss +2 -1
  5. data/lib/generators/foundation/templates/foundation_and_overrides.scss +1 -0
  6. data/vendor/assets/js/foundation.abide.js.es6 +89 -24
  7. data/vendor/assets/js/foundation.accordion.js.es6 +21 -23
  8. data/vendor/assets/js/foundation.accordionMenu.js.es6 +12 -11
  9. data/vendor/assets/js/foundation.core.js.es6 +1 -1
  10. data/vendor/assets/js/foundation.drilldown.js.es6 +35 -21
  11. data/vendor/assets/js/foundation.dropdown.js.es6 +8 -3
  12. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +1 -1
  13. data/vendor/assets/js/foundation.equalizer.js.es6 +1 -1
  14. data/vendor/assets/js/foundation.interchange.js.es6 +1 -1
  15. data/vendor/assets/js/foundation.orbit.js.es6 +2 -1
  16. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +19 -16
  17. data/vendor/assets/js/foundation.reveal.js.es6 +29 -15
  18. data/vendor/assets/js/foundation.slider.js.es6 +19 -3
  19. data/vendor/assets/js/foundation.toggler.js.es6 +2 -2
  20. data/vendor/assets/js/foundation.util.box.js.es6 +12 -0
  21. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +1 -1
  22. data/vendor/assets/scss/_global.scss +4 -3
  23. data/vendor/assets/scss/components/_breadcrumbs.scss +1 -0
  24. data/vendor/assets/scss/components/_button-group.scss +21 -14
  25. data/vendor/assets/scss/components/_button.scss +6 -4
  26. data/vendor/assets/scss/components/_callout.scss +1 -1
  27. data/vendor/assets/scss/components/_dropdown-menu.scss +2 -3
  28. data/vendor/assets/scss/components/_flex.scss +1 -1
  29. data/vendor/assets/scss/components/_media-object.scss +10 -5
  30. data/vendor/assets/scss/components/_menu.scss +1 -1
  31. data/vendor/assets/scss/components/_off-canvas.scss +1 -1
  32. data/vendor/assets/scss/components/_pagination.scss +1 -1
  33. data/vendor/assets/scss/components/_reveal.scss +2 -1
  34. data/vendor/assets/scss/components/_switch.scss +1 -1
  35. data/vendor/assets/scss/components/_table.scss +2 -2
  36. data/vendor/assets/scss/components/_top-bar.scss +18 -16
  37. data/vendor/assets/scss/components/_visibility.scss +4 -3
  38. data/vendor/assets/scss/forms/_checkbox.scss +4 -0
  39. data/vendor/assets/scss/forms/_input-group.scss +2 -2
  40. data/vendor/assets/scss/forms/_select.scss +1 -0
  41. data/vendor/assets/scss/forms/_text.scss +1 -1
  42. data/vendor/assets/scss/foundation.scss +1 -1
  43. data/vendor/assets/scss/grid/_flex-grid.scss +9 -7
  44. data/vendor/assets/scss/grid/_row.scss +2 -1
  45. data/vendor/assets/scss/settings/_settings.scss +2 -1
  46. data/vendor/assets/scss/typography/_alignment.scss +1 -1
  47. data/vendor/assets/scss/util/_breakpoint.scss +8 -6
  48. data/vendor/assets/scss/util/_mixins.scss +5 -3
  49. data/vendor/assets/scss/util/_value.scss +1 -1
  50. metadata +2 -2
@@ -69,8 +69,11 @@ class Dropdown {
69
69
  * @returns {String} position - string value of a position class.
70
70
  */
71
71
  getPositionClass() {
72
- var position = this.$element[0].className.match(/\b(top|left|right)\b/g);
73
- position = position ? position[0] : '';
72
+ var verticalPosition = this.$element[0].className.match(/(top|left|right|bottom)/g);
73
+ verticalPosition = verticalPosition ? verticalPosition[0] : '';
74
+ var horizontalPosition = /float-(.+)\s/.exec(this.$anchor[0].className);
75
+ horizontalPosition = horizontalPosition ? horizontalPosition[1] : '';
76
+ var position = horizontalPosition ? horizontalPosition + ' ' + verticalPosition : verticalPosition;
74
77
  return position;
75
78
  }
76
79
 
@@ -130,6 +133,8 @@ class Dropdown {
130
133
  param = (direction === 'top') ? 'height' : 'width',
131
134
  offset = (param === 'height') ? this.options.vOffset : this.options.hOffset;
132
135
 
136
+
137
+
133
138
  if(($eleDims.width >= $eleDims.windowDims.width) || (!this.counter && !Foundation.Box.ImNotTouchingYou(this.$element))){
134
139
  this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, 'center bottom', this.options.vOffset, this.options.hOffset, true)).css({
135
140
  'width': $eleDims.windowDims.width - (this.options.hOffset * 2),
@@ -141,7 +146,7 @@ class Dropdown {
141
146
 
142
147
  this.$element.offset(Foundation.Box.GetOffsets(this.$element, this.$anchor, position, this.options.vOffset, this.options.hOffset));
143
148
 
144
- while(!Foundation.Box.ImNotTouchingYou(this.$element) && this.counter){
149
+ while(!Foundation.Box.ImNotTouchingYou(this.$element, false, true) && this.counter){
145
150
  this._reposition(position);
146
151
  this._setPosition();
147
152
  }
@@ -50,7 +50,7 @@ class DropdownMenu {
50
50
  this.$tabs = this.$element.children('[role="menuitem"]');
51
51
  this.$tabs.find('ul.is-dropdown-submenu').addClass(this.options.verticalClass);
52
52
 
53
- if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl()) {
53
+ if (this.$element.hasClass(this.options.rightClass) || this.options.alignment === 'right' || Foundation.rtl() || this.$element.parents('.top-bar-right').is('*')) {
54
54
  this.options.alignment = 'right';
55
55
  subs.addClass('opens-left');
56
56
  } else {
@@ -155,7 +155,7 @@ class Equalizer {
155
155
  * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
156
156
  */
157
157
  getHeightsByRow(cb) {
158
- var lastElTopOffset = this.$watched.first().offset().top,
158
+ var lastElTopOffset = (this.$watched.length ? this.$watched.first().offset().top : 0),
159
159
  groups = [],
160
160
  group = 0;
161
161
  //group by Row
@@ -139,7 +139,7 @@ class Interchange {
139
139
  .trigger(trigger);
140
140
  }
141
141
  // Replacing background images
142
- else if (path.match(/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i)) {
142
+ else if (path.match(/\.(gif|jpg|jpeg|png|svg|tiff)([?#].*)?/i)) {
143
143
  this.$element.css({ 'background-image': 'url('+path+')' })
144
144
  .trigger(trigger);
145
145
  }
@@ -200,7 +200,8 @@ class Orbit {
200
200
  var $controls = this.$element.find(`.${this.options.nextClass}, .${this.options.prevClass}`);
201
201
  $controls.attr('tabindex', 0)
202
202
  //also need to handle enter/return and spacebar key presses
203
- .on('click.zf.orbit touchend.zf.orbit', function(){
203
+ .on('click.zf.orbit touchend.zf.orbit', function(e){
204
+ e.preventDefault();
204
205
  _this.changeSlide($(this).hasClass(_this.options.nextClass));
205
206
  });
206
207
  }
@@ -38,25 +38,28 @@ class ResponsiveMenu {
38
38
  * @private
39
39
  */
40
40
  _init() {
41
- var rulesTree = {};
42
-
43
- // Parse rules from "classes" in data attribute
44
- var rules = this.rules.split(' ');
45
-
46
- // Iterate through every rule found
47
- for (var i = 0; i < rules.length; i++) {
48
- var rule = rules[i].split('-');
49
- var ruleSize = rule.length > 1 ? rule[0] : 'small';
50
- var rulePlugin = rule.length > 1 ? rule[1] : rule[0];
51
-
52
- if (MenuPlugins[rulePlugin] !== null) {
53
- rulesTree[ruleSize] = MenuPlugins[rulePlugin];
41
+ // The first time an Interchange plugin is initialized, this.rules is converted from a string of "classes" to an object of rules
42
+ if (typeof this.rules === 'string') {
43
+ let rulesTree = {};
44
+
45
+ // Parse rules from "classes" pulled from data attribute
46
+ let rules = this.rules.split(' ');
47
+
48
+ // Iterate through every rule found
49
+ for (let i = 0; i < rules.length; i++) {
50
+ let rule = rules[i].split('-');
51
+ let ruleSize = rule.length > 1 ? rule[0] : 'small';
52
+ let rulePlugin = rule.length > 1 ? rule[1] : rule[0];
53
+
54
+ if (MenuPlugins[rulePlugin] !== null) {
55
+ rulesTree[ruleSize] = MenuPlugins[rulePlugin];
56
+ }
54
57
  }
55
- }
56
58
 
57
- this.rules = rulesTree;
59
+ this.rules = rulesTree;
60
+ }
58
61
 
59
- if (!$.isEmptyObject(rulesTree)) {
62
+ if (!$.isEmptyObject(this.rules)) {
60
63
  this._checkMediaQueries();
61
64
  }
62
65
  }
@@ -109,17 +109,27 @@ class Reveal {
109
109
  var outerWidth = $(window).width();
110
110
  var height = this.$element.outerHeight();
111
111
  var outerHeight = $(window).height();
112
- var left = parseInt((outerWidth - width) / 2, 10);
113
- var top;
114
- if (height > outerHeight) {
115
- top = parseInt(Math.min(100, outerHeight / 10), 10);
112
+ var left, top;
113
+ if (this.options.hOffset === 'auto') {
114
+ left = parseInt((outerWidth - width) / 2, 10);
116
115
  } else {
117
- top = parseInt((outerHeight - height) / 4, 10);
116
+ left = parseInt(this.options.hOffset, 10);
117
+ }
118
+ if (this.options.vOffset === 'auto') {
119
+ if (height > outerHeight) {
120
+ top = parseInt(Math.min(100, outerHeight / 10), 10);
121
+ } else {
122
+ top = parseInt((outerHeight - height) / 4, 10);
123
+ }
124
+ } else {
125
+ top = parseInt(this.options.vOffset, 10);
118
126
  }
119
127
  this.$element.css({top: top + 'px'});
120
- // only worry about left if we don't have an overlay, otherwise we're perfectly in the middle
121
- if(!this.$overlay) {
128
+ // only worry about left if we don't have an overlay or we havea horizontal offset,
129
+ // otherwise we're perfectly in the middle
130
+ if(!this.$overlay || (this.options.hOffset !== 'auto')) {
122
131
  this.$element.css({left: left + 'px'});
132
+ this.$element.css({margin: '0px'});
123
133
  }
124
134
 
125
135
  }
@@ -224,7 +234,7 @@ class Reveal {
224
234
  if (this.options.overlay) {
225
235
  Foundation.Motion.animateIn(this.$overlay, 'fade-in');
226
236
  }
227
- Foundation.Motion.animateIn(this.$element, this.options.animationIn, function() {
237
+ Foundation.Motion.animateIn(this.$element, this.options.animationIn, () => {
228
238
  this.focusableElements = Foundation.Keyboard.findFocusable(this.$element);
229
239
  });
230
240
  }
@@ -292,9 +302,6 @@ class Reveal {
292
302
  }
293
303
  }
294
304
  });
295
- if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
296
- e.preventDefault();
297
- }
298
305
  });
299
306
  }
300
307
 
@@ -308,12 +315,18 @@ class Reveal {
308
315
  _this.focusableElements.eq(0).focus();
309
316
  e.preventDefault();
310
317
  }
318
+ if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
319
+ e.preventDefault();
320
+ }
311
321
  },
312
322
  tab_backward: function() {
313
323
  if (_this.$element.find(':focus').is(_this.focusableElements.eq(0)) || _this.$element.is(':focus')) { // left modal upwards, setting focus to last element
314
324
  _this.focusableElements.eq(-1).focus();
315
325
  e.preventDefault();
316
326
  }
327
+ if (_this.focusableElements.length === 0) { // no focusable elements inside the modal at all, prevent tabbing in general
328
+ e.preventDefault();
329
+ }
317
330
  },
318
331
  open: function() {
319
332
  if (_this.$element.find(':focus').is(_this.$element.find('[data-close]'))) {
@@ -437,6 +450,7 @@ class Reveal {
437
450
  */
438
451
  destroy() {
439
452
  if (this.options.overlay) {
453
+ this.$element.appendTo($('body')); // move $element outside of $overlay to prevent error unregisterPlugin()
440
454
  this.$overlay.hide().off().remove();
441
455
  }
442
456
  this.$element.hide().off();
@@ -493,15 +507,15 @@ Reveal.defaults = {
493
507
  /**
494
508
  * Distance, in pixels, the modal should push down from the top of the screen.
495
509
  * @option
496
- * @example 100
510
+ * @example auto
497
511
  */
498
- vOffset: 100,
512
+ vOffset: 'auto',
499
513
  /**
500
514
  * Distance, in pixels, the modal should push in from the side of the screen.
501
515
  * @option
502
- * @example 0
516
+ * @example auto
503
517
  */
504
- hOffset: 0,
518
+ hOffset: 'auto',
505
519
  /**
506
520
  * Allows the modal to be fullscreen, completely blocking out the rest of the view. JS checks for this as well.
507
521
  * @option
@@ -103,6 +103,7 @@ class Slider {
103
103
  * @param {Number} location - floating point between the start and end values of the slider bar.
104
104
  * @param {Function} cb - callback function to fire on completion.
105
105
  * @fires Slider#moved
106
+ * @fires Slider#changed
106
107
  */
107
108
  _setHandlePos($hndl, location, noInvert, cb) {
108
109
  //might need to alter that slightly for bars that will have odd number selections.
@@ -137,7 +138,7 @@ class Slider {
137
138
  handleDim = $hndl[0].getBoundingClientRect()[hOrW],
138
139
  elemDim = this.$element[0].getBoundingClientRect()[hOrW],
139
140
  //percentage of bar min/max value based on click or drag point
140
- pctOfBar = percent(location, this.options.end).toFixed(2),
141
+ pctOfBar = percent(location - this.options.start, this.options.end - this.options.start).toFixed(2),
141
142
  //number of actual pixels to shift the handle, based on the percentage obtained above
142
143
  pxToMove = (elemDim - handleDim) * pctOfBar,
143
144
  //percentage of bar to shift the handle
@@ -199,6 +200,15 @@ class Slider {
199
200
  _this.$fill.css(css);
200
201
  }
201
202
  });
203
+
204
+ /**
205
+ * Fires when the value has not been change for a given time.
206
+ * @event Slider#changed
207
+ */
208
+ clearTimeout(_this.timeout);
209
+ _this.timeout = setTimeout(function(){
210
+ _this.$element.trigger('changed.zf.slider', [$hndl]);
211
+ }, _this.options.changedDelay);
202
212
  }
203
213
 
204
214
  /**
@@ -265,7 +275,7 @@ class Slider {
265
275
  //if the cursor position is less than or greater than the elements bounding coordinates, set coordinates within those bounds
266
276
  barXY = barOffset > 0 ? -halfOfHandle : (barOffset - halfOfHandle) < -barDim ? barDim : Math.abs(barOffset),
267
277
  offsetPct = percent(barXY, barDim);
268
- value = (this.options.end - this.options.start) * offsetPct;
278
+ value = (this.options.end - this.options.start) * offsetPct + this.options.start;
269
279
 
270
280
  // turn everything around for RTL, yay math!
271
281
  if (Foundation.rtl() && !this.options.vertical) {value = this.options.end - value;}
@@ -520,7 +530,13 @@ Slider.defaults = {
520
530
  * @option
521
531
  * @example false
522
532
  */
523
- invertVertical: false
533
+ invertVertical: false,
534
+ /**
535
+ * Milliseconds before the `changed.zf-slider` event is triggered after value change.
536
+ * @option
537
+ * @example 500
538
+ */
539
+ changedDelay: 500
524
540
  };
525
541
 
526
542
  function percent(frac, num) {
@@ -103,14 +103,14 @@ class Toggler {
103
103
 
104
104
  if (this.$element.is(':hidden')) {
105
105
  Foundation.Motion.animateIn(this.$element, this.animationIn, function() {
106
- this.trigger('on.zf.toggler');
107
106
  _this._updateARIA(true);
107
+ this.trigger('on.zf.toggler');
108
108
  });
109
109
  }
110
110
  else {
111
111
  Foundation.Motion.animateOut(this.$element, this.animationOut, function() {
112
- this.trigger('off.zf.toggler');
113
112
  _this._updateARIA(false);
113
+ this.trigger('off.zf.toggler');
114
114
  });
115
115
  }
116
116
  }
@@ -172,6 +172,18 @@ function GetOffsets(element, anchor, position, vOffset, hOffset, isOverflow) {
172
172
  top: $eleDims.windowDims.offset.top
173
173
  }
174
174
  break;
175
+ case 'left bottom':
176
+ return {
177
+ left: $anchorDims.offset.left - ($eleDims.width + hOffset),
178
+ top: $anchorDims.offset.top + $anchorDims.height
179
+ };
180
+ break;
181
+ case 'right bottom':
182
+ return {
183
+ left: $anchorDims.offset.left + $anchorDims.width + hOffset - $eleDims.width,
184
+ top: $anchorDims.offset.top + $anchorDims.height
185
+ };
186
+ break;
175
187
  default:
176
188
  return {
177
189
  left: (Foundation.rtl() ? $anchorDims.offset.left - $eleDims.width + $anchorDims.width : $anchorDims.offset.left),
@@ -84,7 +84,7 @@ var MediaQuery = {
84
84
  _getCurrentSize() {
85
85
  var matched;
86
86
 
87
- for (var i in this.queries) {
87
+ for (var i = 0; i < this.queries.length; i++) {
88
88
  var query = this.queries[i];
89
89
 
90
90
  if (window.matchMedia(query.value).matches) {
@@ -128,8 +128,8 @@ $-zf-flex-classes-imported: false;
128
128
 
129
129
  // Set box-sizing globally to handle padding and border widths
130
130
  *,
131
- *:before,
132
- *:after {
131
+ *::before,
132
+ *::after {
133
133
  box-sizing: inherit;
134
134
  }
135
135
 
@@ -187,6 +187,7 @@ $-zf-flex-classes-imported: false;
187
187
 
188
188
  // Reset <button> styles created by most browsers
189
189
  button {
190
+ @include disable-mouse-outline;
190
191
  -webkit-appearance: none;
191
192
  -moz-appearance: none;
192
193
  background: transparent;
@@ -512,7 +513,7 @@ $-zf-flex-classes-imported: false;
512
513
 
513
514
  button[disabled],
514
515
  html input[disabled] {
515
- cursor: default;
516
+ cursor: not-allowed;
516
517
  }
517
518
 
518
519
  /**
@@ -89,6 +89,7 @@ $breadcrumbs-item-slash: true !default;
89
89
 
90
90
  .disabled {
91
91
  color: $breadcrumbs-item-color-disabled;
92
+ cursor: not-allowed;
92
93
  }
93
94
  }
94
95
  }
@@ -29,13 +29,15 @@ $buttongroup-expand-max: 6 !default;
29
29
  ) {
30
30
  @include clearfix;
31
31
  margin-bottom: $buttongroup-margin;
32
- font-size: 0;
33
32
 
34
33
  @if $global-flexbox {
35
34
  display: flex;
36
35
  flex-wrap: nowrap;
37
36
  align-items: stretch;
38
37
  }
38
+ @else {
39
+ font-size: 0;
40
+ }
39
41
 
40
42
  #{$child-selector} {
41
43
  margin: 0;
@@ -44,17 +46,9 @@ $buttongroup-expand-max: 6 !default;
44
46
  @if $global-flexbox {
45
47
  flex: 0 0 auto;
46
48
  }
47
- @else {
48
- float: #{$global-left};
49
- }
50
49
 
51
50
  &:not(:last-child) {
52
- @if $global-flexbox {
53
- margin-right: $buttongroup-spacing;
54
- }
55
- @else {
56
- border-#{$global-right}: $buttongroup-spacing solid $body-background;
57
- }
51
+ margin-right: $buttongroup-spacing;
58
52
  }
59
53
  }
60
54
  }
@@ -84,7 +78,11 @@ $buttongroup-expand-max: 6 !default;
84
78
  &:first-child:nth-last-child(#{$i}) {
85
79
  &, &:first-child:nth-last-child(#{$i}) ~ #{$selector} {
86
80
  display: inline-block;
87
- width: calc(#{percentage(1/$i)} - #{$buttongroup-spacing});
81
+ @if #{$buttongroup-spacing} == '0' {
82
+ width: #{percentage(1 / $i)};
83
+ } @else {
84
+ width: calc(#{percentage(1 / $i)} - #{$buttongroup-spacing});
85
+ }
88
86
  margin-right: $buttongroup-spacing;
89
87
  }
90
88
  }
@@ -105,13 +103,20 @@ $buttongroup-expand-max: 6 !default;
105
103
  #{$selector} {
106
104
  @if $global-flexbox {
107
105
  flex: 0 0 100%;
106
+ margin-#{$global-right}: 0;
108
107
  }
109
108
  @else {
110
109
  width: 100%;
110
+ border-#{$global-right}: $buttongroup-spacing solid transparent;
111
111
  }
112
-
112
+
113
113
  &:not(:last-child) {
114
- margin-#{$global-right}: 0;
114
+ @if $global-flexbox {
115
+ margin-bottom: $buttongroup-spacing;
116
+ }
117
+ @else {
118
+ border-bottom: $buttongroup-spacing solid $body-background;
119
+ }
115
120
  }
116
121
  }
117
122
  }
@@ -142,7 +147,9 @@ $buttongroup-expand-max: 6 !default;
142
147
 
143
148
  // Sizes
144
149
  @each $size, $value in map-remove($button-sizes, default) {
145
- &.#{$size} #{$buttongroup-child-selector} { font-size: $value; }
150
+ &.#{$size} #{$buttongroup-child-selector} {
151
+ font-size: $value;
152
+ }
146
153
  }
147
154
 
148
155
  // Even-width Group
@@ -99,7 +99,7 @@ $button-opacity-disabled: 0.25 !default;
99
99
  $color: $button-color
100
100
  ) {
101
101
  @if $color == auto {
102
- $color: foreground($background);
102
+ $color: foreground($background, $button-color-alt, $button-color);
103
103
  }
104
104
 
105
105
  @if $background-hover == auto {
@@ -139,7 +139,6 @@ $button-opacity-disabled: 0.25 !default;
139
139
  @mixin button-disabled {
140
140
  opacity: $button-opacity-disabled;
141
141
  cursor: not-allowed;
142
- pointer-events: none;
143
142
  }
144
143
 
145
144
  /// Adds a dropdown arrow to a button.
@@ -195,15 +194,18 @@ $button-opacity-disabled: 0.25 !default;
195
194
 
196
195
  // Sizes
197
196
  @each $size, $value in map-remove($button-sizes, default) {
198
- &.#{$size} { font-size: $value; }
197
+ &.#{$size} {
198
+ font-size: $value;
199
+ }
199
200
  }
201
+
200
202
  &.expanded { @include button-expand; }
201
203
 
202
204
  // Colors
203
205
  @each $name, $color in $foundation-palette {
204
206
  @if $button-fill != hollow {
205
207
  &.#{$name} {
206
- @include button-style($color, auto);
208
+ @include button-style($color, auto, auto);
207
209
  }
208
210
  }
209
211
  @else {