foundation-rails 6.1.2.0 → 6.2.0.0

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 (102) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +7 -6
  3. data/README.md +1 -1
  4. data/Rakefile +5 -1
  5. data/bower.json +3 -3
  6. data/foundation-rails.gemspec +1 -0
  7. data/lib/foundation-rails.rb +1 -0
  8. data/lib/foundation/rails/version.rb +1 -1
  9. data/lib/generators/foundation/templates/foundation_and_overrides.scss +2 -2
  10. data/vendor/assets/js/foundation.abide.js.es6 +462 -0
  11. data/vendor/assets/js/{foundation.accordion.js → foundation.accordion.js.es6} +55 -47
  12. data/vendor/assets/js/{foundation.accordionMenu.js → foundation.accordionMenu.js.es6} +46 -35
  13. data/vendor/assets/js/{foundation.core.js → foundation.core.js.es6} +10 -8
  14. data/vendor/assets/js/{foundation.drilldown.js → foundation.drilldown.js.es6} +75 -49
  15. data/vendor/assets/js/{foundation.dropdown.js → foundation.dropdown.js.es6} +100 -88
  16. data/vendor/assets/js/{foundation.dropdownMenu.js → foundation.dropdownMenu.js.es6} +134 -128
  17. data/vendor/assets/js/{foundation.equalizer.js → foundation.equalizer.js.es6} +72 -61
  18. data/vendor/assets/js/{foundation.interchange.js → foundation.interchange.js.es6} +44 -45
  19. data/vendor/assets/js/{foundation.js → foundation.js.es6} +0 -0
  20. data/vendor/assets/js/{foundation.magellan.js → foundation.magellan.js.es6} +80 -83
  21. data/vendor/assets/js/foundation.offcanvas.js.es6 +395 -0
  22. data/vendor/assets/js/foundation.orbit.js.es6 +445 -0
  23. data/vendor/assets/js/{foundation.responsiveMenu.js → foundation.responsiveMenu.js.es6} +37 -31
  24. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +112 -0
  25. data/vendor/assets/js/foundation.reveal.js.es6 +544 -0
  26. data/vendor/assets/js/{foundation.slider.js → foundation.slider.js.es6} +235 -184
  27. data/vendor/assets/js/{foundation.sticky.js → foundation.sticky.js.es6} +177 -166
  28. data/vendor/assets/js/{foundation.tabs.js → foundation.tabs.js.es6} +138 -118
  29. data/vendor/assets/js/{foundation.toggler.js → foundation.toggler.js.es6} +34 -37
  30. data/vendor/assets/js/{foundation.tooltip.js → foundation.tooltip.js.es6} +162 -153
  31. data/vendor/assets/js/foundation.util.box.js.es6 +183 -0
  32. data/vendor/assets/js/{foundation.util.keyboard.js → foundation.util.keyboard.js.es6} +54 -54
  33. data/vendor/assets/js/{foundation.util.mediaQuery.js → foundation.util.mediaQuery.js.es6} +46 -46
  34. data/vendor/assets/js/{foundation.util.motion.js → foundation.util.motion.js.es6} +58 -48
  35. data/vendor/assets/js/foundation.util.nest.js.es6 +76 -0
  36. data/vendor/assets/js/foundation.util.timerAndImageLoader.js.es6 +86 -0
  37. data/vendor/assets/js/{foundation.util.touch.js → foundation.util.touch.js.es6} +2 -2
  38. data/vendor/assets/js/foundation.util.triggers.js.es6 +239 -0
  39. data/vendor/assets/scss/_global.scss +28 -27
  40. data/vendor/assets/scss/components/_badge.scss +1 -1
  41. data/vendor/assets/scss/components/_button-group.scss +77 -26
  42. data/vendor/assets/scss/components/_button.scss +8 -8
  43. data/vendor/assets/scss/components/_callout.scss +2 -2
  44. data/vendor/assets/scss/components/_drilldown.scss +4 -0
  45. data/vendor/assets/scss/components/_dropdown-menu.scss +104 -54
  46. data/vendor/assets/scss/components/_flex.scss +28 -0
  47. data/vendor/assets/scss/components/_label.scss +1 -1
  48. data/vendor/assets/scss/components/_media-object.scss +37 -7
  49. data/vendor/assets/scss/components/_menu-icon.scss +9 -0
  50. data/vendor/assets/scss/components/_menu.scss +127 -29
  51. data/vendor/assets/scss/components/_off-canvas.scss +1 -0
  52. data/vendor/assets/scss/components/_pagination.scss +3 -3
  53. data/vendor/assets/scss/components/_progress-bar.scss +1 -25
  54. data/vendor/assets/scss/components/_reveal.scss +12 -6
  55. data/vendor/assets/scss/components/_slider.scss +3 -35
  56. data/vendor/assets/scss/components/_table.scss +8 -0
  57. data/vendor/assets/scss/components/_tabs.scss +5 -10
  58. data/vendor/assets/scss/components/_title-bar.scss +27 -10
  59. data/vendor/assets/scss/components/_tooltip.scss +0 -4
  60. data/vendor/assets/scss/components/_top-bar.scss +93 -21
  61. data/vendor/assets/scss/components/_visibility.scss +1 -1
  62. data/vendor/assets/scss/forms/_checkbox.scss +1 -1
  63. data/vendor/assets/scss/forms/_error.scss +7 -5
  64. data/vendor/assets/scss/forms/_forms.scss +3 -0
  65. data/vendor/assets/scss/forms/_help-text.scss +1 -1
  66. data/vendor/assets/scss/forms/_input-group.scss +44 -9
  67. data/vendor/assets/scss/forms/_meter.scss +109 -0
  68. data/vendor/assets/scss/forms/_progress.scss +85 -0
  69. data/vendor/assets/scss/forms/_range.scss +144 -0
  70. data/vendor/assets/scss/forms/_select.scss +1 -1
  71. data/vendor/assets/scss/forms/_text.scss +10 -1
  72. data/vendor/assets/scss/foundation.scss +16 -5
  73. data/vendor/assets/scss/grid/_classes.scss +5 -18
  74. data/vendor/assets/scss/grid/_column.scss +13 -11
  75. data/vendor/assets/scss/grid/_flex-grid.scss +54 -80
  76. data/vendor/assets/scss/grid/_grid.scss +22 -10
  77. data/vendor/assets/scss/grid/_layout.scss +18 -0
  78. data/vendor/assets/scss/grid/_row.scss +11 -15
  79. data/vendor/assets/scss/motion-ui/_classes.scss +10 -3
  80. data/vendor/assets/scss/motion-ui/effects/_fade.scss +4 -1
  81. data/vendor/assets/scss/motion-ui/effects/_zoom.scss +1 -1
  82. data/vendor/assets/scss/motion-ui/transitions/_slide.scss +1 -1
  83. data/vendor/assets/scss/motion-ui/util/_transition.scss +1 -1
  84. data/vendor/assets/scss/settings/_settings.scss +64 -47
  85. data/vendor/assets/scss/typography/_base.scss +4 -0
  86. data/vendor/assets/scss/typography/_print.scss +9 -5
  87. data/vendor/assets/scss/util/_breakpoint.scss +31 -25
  88. data/vendor/assets/scss/util/_color.scss +19 -0
  89. data/vendor/assets/scss/util/_flex.scss +68 -0
  90. data/vendor/assets/scss/util/_mixins.scss +13 -7
  91. data/vendor/assets/scss/util/_util.scss +1 -5
  92. data/vendor/assets/scss/util/_value.scss +9 -28
  93. metadata +51 -31
  94. data/vendor/assets/js/foundation.abide.js +0 -418
  95. data/vendor/assets/js/foundation.offcanvas.js +0 -376
  96. data/vendor/assets/js/foundation.orbit.js +0 -421
  97. data/vendor/assets/js/foundation.responsiveToggle.js +0 -106
  98. data/vendor/assets/js/foundation.reveal.js +0 -514
  99. data/vendor/assets/js/foundation.util.box.js +0 -169
  100. data/vendor/assets/js/foundation.util.nest.js +0 -63
  101. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +0 -82
  102. data/vendor/assets/js/foundation.util.triggers.js +0 -224
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d9bda7a24c18e275ca8c07d84d09f6f3b096b510
4
- data.tar.gz: b0299c7f66885abcc7cee0539f4b8630122d1875
3
+ metadata.gz: 0e800e7f84c9ace7a2767a6677a1993432ceea09
4
+ data.tar.gz: 0efe5e8e6af396f6be490843bb86d3a14d248353
5
5
  SHA512:
6
- metadata.gz: 414837e97e06671a367cfa71e09ab6b3e091c5065f64bd94aec170888dd614e4b2b91d6268fbcd47b031d655cf496d2bae81c24f4d632b7bee72b461e84c9cfd
7
- data.tar.gz: e2e99e0aaa0defbedb06ab1d532a4bf73a75957e00088f17249ada71ca6fa865c259dce5ce5e74c214f60cfa74037075798e55f614372a17eda45d8340e8a3f2
6
+ metadata.gz: d38c86ffa3166653c19e198a94a2beec8471ca7747a4c1417c62fc17d0faa5d5a9104d0ab111d6ac054a2982cc7690841e81243bfe16c398e6b64f8a0244e1a9
7
+ data.tar.gz: c5fbe45e7d4268ee45e2b20cd00359893ca658050b7dcf152eff5755ae93da2649a96210e4e59d1aa7cb11627ea2b2246a23815aac0b07546a63923ec5b2ec3a
data/.travis.yml CHANGED
@@ -1,10 +1,11 @@
1
1
  language: ruby
2
- rvm: 2.2.1
3
- cache: bundler
2
+
4
3
  sudo: false
5
- before_install:
6
- - "echo '--colour' > ~/.rspec"
7
- install: bundle install
4
+
5
+ cache: bundler
6
+
7
+ rvm:
8
+ - 2.2
9
+
8
10
  notifications:
9
11
  email: false
10
-
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/foundation-rails.svg)](https://badge.fury.io/rb/foundation-rails)
4
4
 
5
- Foundation::Rails is a gem that makes it super easy to use Foundation in your upcoming Rails project. You can start using Foundation::Rails in your projects by following the instructions below.
5
+ **Foundation::Rails** is a gem that makes it super easy to use Foundation in your upcoming Rails project.
6
6
 
7
7
  ## Installation
8
8
 
data/Rakefile CHANGED
@@ -21,7 +21,11 @@ namespace :assets do
21
21
  manifest = js_files.map { |file| "//= require #{File.basename(file)}" }.join("\n")
22
22
  File.write('vendor/assets/js/foundation.js', manifest)
23
23
 
24
- puts 'Now update version.rb'
24
+ Dir['vendor/assets/js/*.js'].each do |file|
25
+ sh "mv #{file} #{file}.es6"
26
+ end
27
+
28
+ puts "\n*********************\n** ASSETS UPDATED! **\n*********************\n"
25
29
  end
26
30
 
27
31
  desc 'Remove old Foundation for Sites assets'
data/bower.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "foundation-rails",
3
- "version": "6.1.2.0",
3
+ "version": "6.2.0.0",
4
4
  "dependencies": {
5
- "foundation-sites": "6.1.2",
6
- "motion-ui": "1.1.1"
5
+ "foundation-sites": "6.2.0",
6
+ "motion-ui": "1.2.0"
7
7
  }
8
8
  }
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "sass", [">= 3.3.0", "< 3.5"]
22
22
  spec.add_dependency "railties", [">= 3.1.0"]
23
+ spec.add_dependency "sprockets-es6", [">= 0.9.0"]
23
24
 
24
25
  spec.add_development_dependency "bundler", "~> 1.3"
25
26
  spec.add_development_dependency "capybara"
@@ -1 +1,2 @@
1
1
  require 'foundation/rails'
2
+ require 'sprockets/es6'
@@ -1,5 +1,5 @@
1
1
  module Foundation
2
2
  module Rails
3
- VERSION = "6.1.2.0"
3
+ VERSION = "6.2.0.0"
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@
3
3
  @import 'settings';
4
4
  @import 'foundation';
5
5
 
6
- // If you'd like to include motion-ui, you need to install the motion-ui sass package.
6
+ // If you'd like to include motion-ui the foundation-rails gem comes prepackaged with it, uncomment the 3 @imports, if you are not using the gem you need to install the motion-ui sass package.
7
7
  //
8
8
  // @import 'motion-ui/motion-ui';
9
9
 
@@ -45,7 +45,7 @@
45
45
  @include foundation-tooltip;
46
46
  @include foundation-top-bar;
47
47
 
48
- // If you'd like to include motion-ui, you need to install the motion-ui sass package.
48
+ // If you'd like to include motion-ui the foundation-rails gem comes prepackaged with it, uncomment the 3 @imports, if you are not using the gem you need to install the motion-ui sass package.
49
49
  //
50
50
  // @include motion-ui-transitions;
51
51
  // @include motion-ui-animations;
@@ -0,0 +1,462 @@
1
+ 'use strict';
2
+
3
+ !function($) {
4
+
5
+ /**
6
+ * Abide module.
7
+ * @module foundation.abide
8
+ */
9
+
10
+ class Abide {
11
+ /**
12
+ * Creates a new instance of Abide.
13
+ * @class
14
+ * @fires Abide#init
15
+ * @param {Object} element - jQuery object to add the trigger to.
16
+ * @param {Object} options - Overrides to the default plugin settings.
17
+ */
18
+ constructor(element, options = {}) {
19
+ this.$element = element;
20
+ this.options = $.extend({}, Abide.defaults, this.$element.data(), options);
21
+
22
+ this._init();
23
+
24
+ Foundation.registerPlugin(this, 'Abide');
25
+ }
26
+
27
+ /**
28
+ * Initializes the Abide plugin and calls functions to get Abide functioning on load.
29
+ * @private
30
+ */
31
+ _init() {
32
+ this.$inputs = this.$element.find('input, textarea, select').not('[data-abide-ignore]');
33
+
34
+ this._events();
35
+ }
36
+
37
+ /**
38
+ * Initializes events for Abide.
39
+ * @private
40
+ */
41
+ _events() {
42
+ this.$element.off('.abide')
43
+ .on('reset.zf.abide', () => {
44
+ this.resetForm();
45
+ })
46
+ .on('submit.zf.abide', () => {
47
+ return this.validateForm();
48
+ });
49
+
50
+ if (this.options.validateOn === 'fieldChange') {
51
+ this.$inputs
52
+ .off('change.zf.abide')
53
+ .on('change.zf.abide', (e) => {
54
+ this.validateInput($(e.target));
55
+ });
56
+ }
57
+
58
+ if (this.options.liveValidate) {
59
+ this.$inputs
60
+ .off('input.zf.abide')
61
+ .on('input.zf.abide', (e) => {
62
+ this.validateInput($(e.target));
63
+ });
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Calls necessary functions to update Abide upon DOM change
69
+ * @private
70
+ */
71
+ _reflow() {
72
+ this._init();
73
+ }
74
+
75
+ /**
76
+ * Checks whether or not a form element has the required attribute and if it's checked or not
77
+ * @param {Object} element - jQuery object to check for required attribute
78
+ * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
79
+ */
80
+ requiredCheck($el) {
81
+ if (!$el.attr('required')) return true;
82
+
83
+ var isGood = true;
84
+
85
+ switch ($el[0].type) {
86
+ case 'checkbox':
87
+ case 'radio':
88
+ isGood = $el[0].checked;
89
+ break;
90
+
91
+ case 'select':
92
+ case 'select-one':
93
+ case 'select-multiple':
94
+ var opt = $el.find('option:selected');
95
+ if (!opt.length || !opt.val()) isGood = false;
96
+ break;
97
+
98
+ default:
99
+ if(!$el.val() || !$el.val().length) isGood = false;
100
+ }
101
+
102
+ return isGood;
103
+ }
104
+
105
+ /**
106
+ * Based on $el, get the first element with selector in this order:
107
+ * 1. The element's direct sibling('s).
108
+ * 3. The element's parent's children.
109
+ *
110
+ * This allows for multiple form errors per input, though if none are found, no form errors will be shown.
111
+ *
112
+ * @param {Object} $el - jQuery object to use as reference to find the form error selector.
113
+ * @returns {Object} jQuery object with the selector.
114
+ */
115
+ findFormError($el) {
116
+ var $error = $el.siblings(this.options.formErrorSelector);
117
+
118
+ if (!$error.length) {
119
+ $error = $el.parent().find(this.options.formErrorSelector);
120
+ }
121
+
122
+ return $error;
123
+ }
124
+
125
+ /**
126
+ * Get the first element in this order:
127
+ * 2. The <label> with the attribute `[for="someInputId"]`
128
+ * 3. The `.closest()` <label>
129
+ *
130
+ * @param {Object} $el - jQuery object to check for required attribute
131
+ * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
132
+ */
133
+ findLabel($el) {
134
+ var id = $el[0].id;
135
+ var $label = this.$element.find(`label[for="${id}"]`);
136
+
137
+ if (!$label.length) {
138
+ return $el.closest('label');
139
+ }
140
+
141
+ return $label;
142
+ }
143
+
144
+ /**
145
+ * Adds the CSS error class as specified by the Abide settings to the label, input, and the form
146
+ * @param {Object} $el - jQuery object to add the class to
147
+ */
148
+ addErrorClasses($el) {
149
+ var $label = this.findLabel($el);
150
+ var $formError = this.findFormError($el);
151
+
152
+ if ($label.length) {
153
+ $label.addClass(this.options.labelErrorClass);
154
+ }
155
+
156
+ if ($formError.length) {
157
+ $formError.addClass(this.options.formErrorClass);
158
+ }
159
+
160
+ $el.addClass(this.options.inputErrorClass).attr('data-invalid', '');
161
+ }
162
+
163
+ /**
164
+ * Removes CSS error class as specified by the Abide settings from the label, input, and the form
165
+ * @param {Object} $el - jQuery object to remove the class from
166
+ */
167
+ removeErrorClasses($el) {
168
+ var $label = this.findLabel($el);
169
+ var $formError = this.findFormError($el);
170
+
171
+ if ($label.length) {
172
+ $label.removeClass(this.options.labelErrorClass);
173
+ }
174
+
175
+ if ($formError.length) {
176
+ $formError.removeClass(this.options.formErrorClass);
177
+ }
178
+
179
+ $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid');
180
+ }
181
+
182
+ /**
183
+ * Goes through a form to find inputs and proceeds to validate them in ways specific to their type
184
+ * @fires Abide#invalid
185
+ * @fires Abide#valid
186
+ * @param {Object} element - jQuery object to validate, should be an HTML input
187
+ * @returns {Boolean} goodToGo - If the input is valid or not.
188
+ */
189
+ validateInput($el) {
190
+ var clearRequire = this.requiredCheck($el),
191
+ validated = false,
192
+ customValidator = true,
193
+ validator = $el.attr('data-validator'),
194
+ equalTo = true;
195
+
196
+ switch ($el[0].type) {
197
+ case 'radio':
198
+ validated = this.validateRadio($el.attr('name'));
199
+ break;
200
+
201
+ case 'checkbox':
202
+ validated = clearRequire;
203
+ break;
204
+
205
+ case 'select':
206
+ case 'select-one':
207
+ case 'select-multiple':
208
+ validated = clearRequire;
209
+ break;
210
+
211
+ default:
212
+ validated = this.validateText($el);
213
+ }
214
+
215
+ if (validator) {
216
+ customValidator = this.matchValidation($el, validator, $el.attr('required'));
217
+ }
218
+
219
+ if ($el.attr('data-equalto')) {
220
+ equalTo = this.options.validators.equalTo($el);
221
+ }
222
+
223
+ var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1;
224
+ var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide';
225
+
226
+ this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el);
227
+
228
+ /**
229
+ * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide`
230
+ * Trigger includes the DOM element of the input.
231
+ * @event Abide#valid
232
+ * @event Abide#invalid
233
+ */
234
+ $el.trigger(message, [$el]);
235
+
236
+ return goodToGo;
237
+ }
238
+
239
+ /**
240
+ * Goes through a form and if there are any invalid inputs, it will display the form error element
241
+ * @returns {Boolean} noError - true if no errors were detected...
242
+ * @fires Abide#formvalid
243
+ * @fires Abide#forminvalid
244
+ */
245
+ validateForm() {
246
+ var acc = [];
247
+ var _this = this;
248
+
249
+ this.$inputs.each(function() {
250
+ acc.push(_this.validateInput($(this)));
251
+ });
252
+
253
+ var noError = acc.indexOf(false) === -1;
254
+
255
+ this.$element.find('[data-abide-error]').css('display', (noError ? 'none' : 'block'));
256
+
257
+ /**
258
+ * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`.
259
+ * Trigger includes the element of the form.
260
+ * @event Abide#formvalid
261
+ * @event Abide#forminvalid
262
+ */
263
+ this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]);
264
+
265
+ return noError;
266
+ }
267
+
268
+ /**
269
+ * Determines whether or a not a text input is valid based on the pattern specified in the attribute. If no matching pattern is found, returns true.
270
+ * @param {Object} $el - jQuery object to validate, should be a text input HTML element
271
+ * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns
272
+ * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified
273
+ */
274
+ validateText($el, pattern) {
275
+ // pattern = pattern ? pattern : $el.attr('pattern') ? $el.attr('pattern') : $el.attr('type');
276
+ pattern = (pattern || $el.attr('pattern') || $el.attr('type'));
277
+ var inputText = $el.val();
278
+
279
+ // if text, check if the pattern exists, if so, test it, if no text or no pattern, return true.
280
+ return inputText.length ?
281
+ this.options.patterns.hasOwnProperty(pattern) ? this.options.patterns[pattern].test(inputText) :
282
+ pattern && pattern !== $el.attr('type') ?
283
+ new RegExp(pattern).test(inputText) :
284
+ true :
285
+ true;
286
+ }
287
+
288
+ /**
289
+ * Determines whether or a not a radio input is valid based on whether or not it is required and selected
290
+ * @param {String} groupName - A string that specifies the name of a radio button group
291
+ * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required)
292
+ */
293
+ validateRadio(groupName) {
294
+ var $group = this.$element.find(`:radio[name="${groupName}"]`),
295
+ counter = [],
296
+ _this = this;
297
+
298
+ $group.each(function(){
299
+ var rdio = $(this),
300
+ clear = _this.requiredCheck(rdio);
301
+ counter.push(clear);
302
+ if(clear) _this.removeErrorClasses(rdio);
303
+ });
304
+
305
+ return counter.indexOf(false) === -1;
306
+ }
307
+
308
+ /**
309
+ * Determines if a selected input passes a custom validation function. Multiple validations can be used, if passed to the element with `data-validator="foo bar baz"` in a space separated listed.
310
+ * @param {Object} $el - jQuery input element.
311
+ * @param {String} validators - a string of function names matching functions in the Abide.options.validators object.
312
+ * @param {Boolean} required - self explanatory?
313
+ * @returns {Boolean} - true if validations passed.
314
+ */
315
+ matchValidation($el, validators, required) {
316
+ required = required ? true : false;
317
+
318
+ var clear = validators.split(' ').map((v) => {
319
+ return this.options.validators[v]($el, required, $el.parent());
320
+ });
321
+ return clear.indexOf(false) === -1;
322
+ }
323
+
324
+ /**
325
+ * Resets form inputs and styles
326
+ * @fires Abide#formreset
327
+ */
328
+ resetForm() {
329
+ var $form = this.$element,
330
+ opts = this.options;
331
+
332
+ $(`.${opts.labelErrorClass}`, $form).not('small').removeClass(opts.labelErrorClass);
333
+ $(`.${opts.inputErrorClass}`, $form).not('small').removeClass(opts.inputErrorClass);
334
+ $(`${opts.formErrorSelector}.${opts.formErrorClass}`).removeClass(opts.formErrorClass);
335
+ $form.find('[data-abide-error]').css('display', 'none');
336
+ $(':input', $form).not(':button, :submit, :reset, :hidden, [data-abide-ignore]').val('').removeAttr('data-invalid');
337
+ /**
338
+ * Fires when the form has been reset.
339
+ * @event Abide#formreset
340
+ */
341
+ $form.trigger('formreset.zf.abide', [$form]);
342
+ }
343
+
344
+ /**
345
+ * Destroys an instance of Abide.
346
+ * Removes error styles and classes from elements, without resetting their values.
347
+ */
348
+ destroy() {
349
+ var _this = this;
350
+ this.$element
351
+ .off('.abide')
352
+ .find('[data-abide-error]')
353
+ .css('display', 'none');
354
+
355
+ this.$inputs
356
+ .off('.abide')
357
+ .each(function() {
358
+ _this.removeErrorClasses($(this));
359
+ });
360
+
361
+ Foundation.unregisterPlugin(this);
362
+ }
363
+ }
364
+
365
+ /**
366
+ * Default settings for plugin
367
+ */
368
+ Abide.defaults = {
369
+ /**
370
+ * The default event to validate inputs. Checkboxes and radios validate immediately.
371
+ * Remove or change this value for manual validation.
372
+ * @option
373
+ * @example 'fieldChange'
374
+ */
375
+ validateOn: 'fieldChange',
376
+
377
+ /**
378
+ * Class to be applied to input labels on failed validation.
379
+ * @option
380
+ * @example 'is-invalid-label'
381
+ */
382
+ labelErrorClass: 'is-invalid-label',
383
+
384
+ /**
385
+ * Class to be applied to inputs on failed validation.
386
+ * @option
387
+ * @example 'is-invalid-input'
388
+ */
389
+ inputErrorClass: 'is-invalid-input',
390
+
391
+ /**
392
+ * Class selector to use to target Form Errors for show/hide.
393
+ * @option
394
+ * @example '.form-error'
395
+ */
396
+ formErrorSelector: '.form-error',
397
+
398
+ /**
399
+ * Class added to Form Errors on failed validation.
400
+ * @option
401
+ * @example 'is-visible'
402
+ */
403
+ formErrorClass: 'is-visible',
404
+
405
+ /**
406
+ * Set to true to validate text inputs on any value change.
407
+ * @option
408
+ * @example false
409
+ */
410
+ liveValidate: false,
411
+
412
+ patterns: {
413
+ alpha : /^[a-zA-Z]+$/,
414
+ alpha_numeric : /^[a-zA-Z0-9]+$/,
415
+ integer : /^[-+]?\d+$/,
416
+ number : /^[-+]?\d*(?:[\.\,]\d+)?$/,
417
+
418
+ // amex, visa, diners
419
+ card : /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,
420
+ cvv : /^([0-9]){3,4}$/,
421
+
422
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
423
+ email : /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/,
424
+
425
+ url : /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
426
+ // abc.de
427
+ domain : /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,
428
+
429
+ datetime : /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,
430
+ // YYYY-MM-DD
431
+ date : /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,
432
+ // HH:MM:SS
433
+ time : /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
434
+ dateISO : /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
435
+ // MM/DD/YYYY
436
+ month_day_year : /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
437
+ // DD/MM/YYYY
438
+ day_month_year : /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
439
+
440
+ // #FFF or #FFFFFF
441
+ color : /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/
442
+ },
443
+
444
+ /**
445
+ * Optional validation functions to be used. `equalTo` being the only default included function.
446
+ * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments:
447
+ * el : The jQuery element to validate.
448
+ * required : Boolean value of the required attribute be present or not.
449
+ * parent : The direct parent of the input.
450
+ * @option
451
+ */
452
+ validators: {
453
+ equalTo: function (el, required, parent) {
454
+ return $(`#${el.attr('data-equalto')}`).val() === el.val();
455
+ }
456
+ }
457
+ }
458
+
459
+ // Window exports
460
+ Foundation.plugin(Abide, 'Abide');
461
+
462
+ }(jQuery);