foundation-rails 6.4.1.0 → 6.4.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Rakefile +5 -6
  4. data/lib/foundation/rails/version.rb +1 -1
  5. data/vendor/assets/js/foundation.abide.js +781 -0
  6. data/vendor/assets/js/foundation.accordion.js +511 -0
  7. data/vendor/assets/js/foundation.accordionMenu.js +527 -0
  8. data/vendor/assets/js/foundation.core.js +860 -0
  9. data/vendor/assets/js/foundation.drilldown.js +759 -0
  10. data/vendor/assets/js/foundation.dropdown.js +1131 -0
  11. data/vendor/assets/js/foundation.dropdownMenu.js +678 -0
  12. data/vendor/assets/js/foundation.equalizer.js +542 -0
  13. data/vendor/assets/js/foundation.interchange.js +399 -0
  14. data/vendor/assets/js/{foundation.js.es6 → foundation.js} +11 -12
  15. data/vendor/assets/js/foundation.magellan.js +449 -0
  16. data/vendor/assets/js/foundation.offcanvas.js +1052 -0
  17. data/vendor/assets/js/foundation.orbit.js +767 -0
  18. data/vendor/assets/js/foundation.responsiveAccordionTabs.js +440 -0
  19. data/vendor/assets/js/foundation.responsiveMenu.js +362 -0
  20. data/vendor/assets/js/foundation.responsiveToggle.js +336 -0
  21. data/vendor/assets/js/foundation.reveal.js +1066 -0
  22. data/vendor/assets/js/foundation.slider.js +1236 -0
  23. data/vendor/assets/js/foundation.smoothScroll.js +303 -0
  24. data/vendor/assets/js/foundation.sticky.js +1001 -0
  25. data/vendor/assets/js/foundation.tabs.js +678 -0
  26. data/vendor/assets/js/foundation.toggler.js +602 -0
  27. data/vendor/assets/js/foundation.tooltip.js +1195 -0
  28. data/vendor/assets/js/{foundation.util.box.js.es6 → foundation.util.box.js} +154 -41
  29. data/vendor/assets/js/foundation.util.imageLoader.js +163 -0
  30. data/vendor/assets/js/foundation.util.keyboard.js +298 -0
  31. data/vendor/assets/js/foundation.util.mediaQuery.js +353 -0
  32. data/vendor/assets/js/foundation.util.motion.js +231 -0
  33. data/vendor/assets/js/foundation.util.nest.js +181 -0
  34. data/vendor/assets/js/foundation.util.timer.js +170 -0
  35. data/vendor/assets/js/foundation.util.timerAndImageLoader.js +90 -0
  36. data/vendor/assets/js/foundation.util.touch.js +275 -0
  37. data/vendor/assets/js/foundation.util.triggers.js +399 -0
  38. data/vendor/assets/js/foundation.zf.responsiveAccordionTabs.js +262 -0
  39. metadata +37 -71
  40. data/vendor/assets/js/entries/foundation-plugins.js +0 -25
  41. data/vendor/assets/js/entries/foundation.js +0 -101
  42. data/vendor/assets/js/entries/plugins/foundation.abide.js +0 -4
  43. data/vendor/assets/js/entries/plugins/foundation.accordion.js +0 -4
  44. data/vendor/assets/js/entries/plugins/foundation.accordionMenu.js +0 -5
  45. data/vendor/assets/js/entries/plugins/foundation.core.js +0 -21
  46. data/vendor/assets/js/entries/plugins/foundation.drilldown.js +0 -4
  47. data/vendor/assets/js/entries/plugins/foundation.dropdown.js +0 -5
  48. data/vendor/assets/js/entries/plugins/foundation.dropdownMenu.js +0 -4
  49. data/vendor/assets/js/entries/plugins/foundation.equalizer.js +0 -4
  50. data/vendor/assets/js/entries/plugins/foundation.interchange.js +0 -4
  51. data/vendor/assets/js/entries/plugins/foundation.magellan.js +0 -4
  52. data/vendor/assets/js/entries/plugins/foundation.offcanvas.js +0 -4
  53. data/vendor/assets/js/entries/plugins/foundation.orbit.js +0 -5
  54. data/vendor/assets/js/entries/plugins/foundation.responsiveAccordionTabs.js +0 -5
  55. data/vendor/assets/js/entries/plugins/foundation.responsiveMenu.js +0 -5
  56. data/vendor/assets/js/entries/plugins/foundation.responsiveToggle.js +0 -5
  57. data/vendor/assets/js/entries/plugins/foundation.reveal.js +0 -4
  58. data/vendor/assets/js/entries/plugins/foundation.slider.js +0 -5
  59. data/vendor/assets/js/entries/plugins/foundation.smoothScroll.js +0 -5
  60. data/vendor/assets/js/entries/plugins/foundation.sticky.js +0 -5
  61. data/vendor/assets/js/entries/plugins/foundation.tabs.js +0 -5
  62. data/vendor/assets/js/entries/plugins/foundation.toggler.js +0 -5
  63. data/vendor/assets/js/entries/plugins/foundation.tooltip.js +0 -4
  64. data/vendor/assets/js/entries/plugins/foundation.util.box.js +0 -4
  65. data/vendor/assets/js/entries/plugins/foundation.util.imageLoader.js +0 -5
  66. data/vendor/assets/js/entries/plugins/foundation.util.keyboard.js +0 -4
  67. data/vendor/assets/js/entries/plugins/foundation.util.mediaQuery.js +0 -4
  68. data/vendor/assets/js/entries/plugins/foundation.util.motion.js +0 -5
  69. data/vendor/assets/js/entries/plugins/foundation.util.nest.js +0 -5
  70. data/vendor/assets/js/entries/plugins/foundation.util.timer.js +0 -5
  71. data/vendor/assets/js/entries/plugins/foundation.util.touch.js +0 -7
  72. data/vendor/assets/js/entries/plugins/foundation.util.triggers.js +0 -5
  73. data/vendor/assets/js/foundation.abide.js.es6 +0 -587
  74. data/vendor/assets/js/foundation.accordion.js.es6 +0 -329
  75. data/vendor/assets/js/foundation.accordionMenu.js.es6 +0 -328
  76. data/vendor/assets/js/foundation.core.js.es6 +0 -337
  77. data/vendor/assets/js/foundation.drilldown.js.es6 +0 -536
  78. data/vendor/assets/js/foundation.dropdown.js.es6 +0 -394
  79. data/vendor/assets/js/foundation.dropdownMenu.js.es6 +0 -458
  80. data/vendor/assets/js/foundation.equalizer.js.es6 +0 -318
  81. data/vendor/assets/js/foundation.interchange.js.es6 +0 -210
  82. data/vendor/assets/js/foundation.magellan.js.es6 +0 -257
  83. data/vendor/assets/js/foundation.offcanvas.js.es6 +0 -546
  84. data/vendor/assets/js/foundation.orbit.js.es6 +0 -531
  85. data/vendor/assets/js/foundation.plugin.js.es6 +0 -54
  86. data/vendor/assets/js/foundation.positionable.js.es6 +0 -206
  87. data/vendor/assets/js/foundation.responsiveAccordionTabs.js.es6 +0 -243
  88. data/vendor/assets/js/foundation.responsiveMenu.js.es6 +0 -155
  89. data/vendor/assets/js/foundation.responsiveToggle.js.es6 +0 -156
  90. data/vendor/assets/js/foundation.reveal.js.es6 +0 -585
  91. data/vendor/assets/js/foundation.slider.js.es6 +0 -712
  92. data/vendor/assets/js/foundation.smoothScroll.js.es6 +0 -135
  93. data/vendor/assets/js/foundation.sticky.js.es6 +0 -507
  94. data/vendor/assets/js/foundation.tabs.js.es6 +0 -498
  95. data/vendor/assets/js/foundation.toggler.js.es6 +0 -150
  96. data/vendor/assets/js/foundation.tooltip.js.es6 +0 -462
  97. data/vendor/assets/js/foundation.util.core.js.es6 +0 -52
  98. data/vendor/assets/js/foundation.util.imageLoader.js.es6 +0 -45
  99. data/vendor/assets/js/foundation.util.keyboard.js.es6 +0 -162
  100. data/vendor/assets/js/foundation.util.mediaQuery.js.es6 +0 -234
  101. data/vendor/assets/js/foundation.util.motion.js.es6 +0 -104
  102. data/vendor/assets/js/foundation.util.nest.js.es6 +0 -67
  103. data/vendor/assets/js/foundation.util.timer.js.es6 +0 -48
  104. data/vendor/assets/js/foundation.util.touch.js.es6 +0 -149
  105. data/vendor/assets/js/foundation.util.triggers.js.es6 +0 -268
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 143b53581ca20cc761e43bb0aaf349f09ee8bb0a
4
- data.tar.gz: 3ffa0e1461d130e7ae73a6947d856a5ecca86059
3
+ metadata.gz: f38e8190ad81cddc9c9536417ae51d06e3b42f29
4
+ data.tar.gz: e14ace5fca793ecda3ed180f5372a36288ef7c32
5
5
  SHA512:
6
- metadata.gz: d9e7d79f6bb625371a6adc090e184d8e58a558a7ec8dbae39b8e20804ff343705bda29575ba41a7fe05e0b2909a51c11b31c35bb3fb09cfc36055677bd0f9218
7
- data.tar.gz: 79bcc536efe118bc771a0720f36694809820bd4f9c15f8ddfe66d9b75ed0e436e8c182855d7a8e7f6f2dc1264baa8c9860829867d32a8c5c5cb1c383b889cc70
6
+ metadata.gz: db13a7141da47c7b7fd5ce32f95086ae7d56dbfc40b138ab948b80283355185e272195454c0134e08196f59b936bd292d5d7e49fb6f08c0a809774e99bd6dd2c
7
+ data.tar.gz: fc63247c5a7c776e7071f42d11715c53f35237c682b7c0d521a30568482ee16848c294204913983f87ab5622ed2a0ffd038364a5739fe9d7c0419d7c7cb2dcab
data/.gitignore CHANGED
@@ -15,4 +15,5 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
- /bower_components/*
18
+ /bower_components/*
19
+ *.swp
data/Rakefile CHANGED
@@ -11,7 +11,8 @@ namespace :assets do
11
11
  desc 'Update Foundation for Sites assets'
12
12
  task update: :clean do
13
13
  sh 'bower install'
14
- sh 'cp -R bower_components/foundation-sites/js/* vendor/assets/js/'
14
+ sh 'cp -R bower_components/foundation-sites/dist/js/plugins/* vendor/assets/js/'
15
+ sh 'rm -f vendor/assets/js/*.min.*'
15
16
  sh 'cp -R bower_components/foundation-sites/scss/* vendor/assets/scss/'
16
17
  sh 'cp -R bower_components/foundation-sites/scss/settings/_settings.scss lib/generators/foundation/templates'
17
18
  sh 'cp -R bower_components/motion-ui/src/* vendor/assets/scss/motion-ui'
@@ -20,14 +21,12 @@ namespace :assets do
20
21
 
21
22
  js_files = Dir['vendor/assets/js/*.js'].sort
22
23
  # Move foundation.core.js to beginning of js_files
23
- js_files.insert(0, js_files.delete(js_files.find { |file| file[/foundation.core.js/] }))
24
+ util_file_regex = /foundation\.util*/
25
+ js_files = js_files.find_all { |file| file =~ util_file_regex } + js_files.reject { |file| file =~ util_file_regex }
26
+ js_files.insert(0, js_files.delete(js_files.find { |file| file =~ /foundation\.core\.js/ }))
24
27
  manifest = js_files.map { |file| "//= require #{File.basename(file)}" }.join("\n")
25
28
  File.write('vendor/assets/js/foundation.js', manifest)
26
29
 
27
- Dir['vendor/assets/js/*.js'].each do |file|
28
- sh "mv #{file} #{file}.es6"
29
- end
30
-
31
30
  puts "\n*********************\n** ASSETS UPDATED! **\n*********************\n"
32
31
  end
33
32
 
@@ -1,5 +1,5 @@
1
1
  module Foundation
2
2
  module Rails
3
- VERSION = "6.4.1.0"
3
+ VERSION = "6.4.1.2"
4
4
  end
5
5
  end
@@ -0,0 +1,781 @@
1
+ /******/ (function(modules) { // webpackBootstrap
2
+ /******/ // The module cache
3
+ /******/ var installedModules = {};
4
+ /******/
5
+ /******/ // The require function
6
+ /******/ function __webpack_require__(moduleId) {
7
+ /******/
8
+ /******/ // Check if module is in cache
9
+ /******/ if(installedModules[moduleId]) {
10
+ /******/ return installedModules[moduleId].exports;
11
+ /******/ }
12
+ /******/ // Create a new module (and put it into the cache)
13
+ /******/ var module = installedModules[moduleId] = {
14
+ /******/ i: moduleId,
15
+ /******/ l: false,
16
+ /******/ exports: {}
17
+ /******/ };
18
+ /******/
19
+ /******/ // Execute the module function
20
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21
+ /******/
22
+ /******/ // Flag the module as loaded
23
+ /******/ module.l = true;
24
+ /******/
25
+ /******/ // Return the exports of the module
26
+ /******/ return module.exports;
27
+ /******/ }
28
+ /******/
29
+ /******/
30
+ /******/ // expose the modules object (__webpack_modules__)
31
+ /******/ __webpack_require__.m = modules;
32
+ /******/
33
+ /******/ // expose the module cache
34
+ /******/ __webpack_require__.c = installedModules;
35
+ /******/
36
+ /******/ // identity function for calling harmony imports with the correct context
37
+ /******/ __webpack_require__.i = function(value) { return value; };
38
+ /******/
39
+ /******/ // define getter function for harmony exports
40
+ /******/ __webpack_require__.d = function(exports, name, getter) {
41
+ /******/ if(!__webpack_require__.o(exports, name)) {
42
+ /******/ Object.defineProperty(exports, name, {
43
+ /******/ configurable: false,
44
+ /******/ enumerable: true,
45
+ /******/ get: getter
46
+ /******/ });
47
+ /******/ }
48
+ /******/ };
49
+ /******/
50
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
51
+ /******/ __webpack_require__.n = function(module) {
52
+ /******/ var getter = module && module.__esModule ?
53
+ /******/ function getDefault() { return module['default']; } :
54
+ /******/ function getModuleExports() { return module; };
55
+ /******/ __webpack_require__.d(getter, 'a', getter);
56
+ /******/ return getter;
57
+ /******/ };
58
+ /******/
59
+ /******/ // Object.prototype.hasOwnProperty.call
60
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
61
+ /******/
62
+ /******/ // __webpack_public_path__
63
+ /******/ __webpack_require__.p = "";
64
+ /******/
65
+ /******/ // Load entry module and return exports
66
+ /******/ return __webpack_require__(__webpack_require__.s = 79);
67
+ /******/ })
68
+ /************************************************************************/
69
+ /******/ ({
70
+
71
+ /***/ 0:
72
+ /***/ (function(module, exports) {
73
+
74
+ module.exports = jQuery;
75
+
76
+ /***/ }),
77
+
78
+ /***/ 1:
79
+ /***/ (function(module, exports) {
80
+
81
+ module.exports = {Foundation: window.Foundation};
82
+
83
+ /***/ }),
84
+
85
+ /***/ 13:
86
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
87
+
88
+ "use strict";
89
+ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
90
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_core__ = __webpack_require__(1);
91
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation_core___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__foundation_core__);
92
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_abide__ = __webpack_require__(43);
93
+
94
+
95
+
96
+ __WEBPACK_IMPORTED_MODULE_0__foundation_core__["Foundation"].plugin(__WEBPACK_IMPORTED_MODULE_1__foundation_abide__["a" /* Abide */], 'Abide');
97
+
98
+ /***/ }),
99
+
100
+ /***/ 2:
101
+ /***/ (function(module, exports) {
102
+
103
+ module.exports = {Plugin: window.Foundation.Plugin};
104
+
105
+ /***/ }),
106
+
107
+ /***/ 43:
108
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
109
+
110
+ "use strict";
111
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Abide; });
112
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery__ = __webpack_require__(0);
113
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_jquery__);
114
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_plugin__ = __webpack_require__(2);
115
+ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation_plugin___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__foundation_plugin__);
116
+
117
+
118
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
119
+
120
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
121
+
122
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
123
+
124
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
125
+
126
+
127
+
128
+
129
+ /**
130
+ * Abide module.
131
+ * @module foundation.abide
132
+ */
133
+
134
+ var Abide = function (_Plugin) {
135
+ _inherits(Abide, _Plugin);
136
+
137
+ function Abide() {
138
+ _classCallCheck(this, Abide);
139
+
140
+ return _possibleConstructorReturn(this, (Abide.__proto__ || Object.getPrototypeOf(Abide)).apply(this, arguments));
141
+ }
142
+
143
+ _createClass(Abide, [{
144
+ key: '_setup',
145
+
146
+ /**
147
+ * Creates a new instance of Abide.
148
+ * @class
149
+ * @name Abide
150
+ * @fires Abide#init
151
+ * @param {Object} element - jQuery object to add the trigger to.
152
+ * @param {Object} options - Overrides to the default plugin settings.
153
+ */
154
+ value: function _setup(element) {
155
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
156
+
157
+ this.$element = element;
158
+ this.options = __WEBPACK_IMPORTED_MODULE_0_jquery___default.a.extend({}, Abide.defaults, this.$element.data(), options);
159
+
160
+ this.className = 'Abide'; // ie9 back compat
161
+ this._init();
162
+ }
163
+
164
+ /**
165
+ * Initializes the Abide plugin and calls functions to get Abide functioning on load.
166
+ * @private
167
+ */
168
+
169
+ }, {
170
+ key: '_init',
171
+ value: function _init() {
172
+ this.$inputs = this.$element.find('input, textarea, select');
173
+
174
+ this._events();
175
+ }
176
+
177
+ /**
178
+ * Initializes events for Abide.
179
+ * @private
180
+ */
181
+
182
+ }, {
183
+ key: '_events',
184
+ value: function _events() {
185
+ var _this3 = this;
186
+
187
+ this.$element.off('.abide').on('reset.zf.abide', function () {
188
+ _this3.resetForm();
189
+ }).on('submit.zf.abide', function () {
190
+ return _this3.validateForm();
191
+ });
192
+
193
+ if (this.options.validateOn === 'fieldChange') {
194
+ this.$inputs.off('change.zf.abide').on('change.zf.abide', function (e) {
195
+ _this3.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target));
196
+ });
197
+ }
198
+
199
+ if (this.options.liveValidate) {
200
+ this.$inputs.off('input.zf.abide').on('input.zf.abide', function (e) {
201
+ _this3.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target));
202
+ });
203
+ }
204
+
205
+ if (this.options.validateOnBlur) {
206
+ this.$inputs.off('blur.zf.abide').on('blur.zf.abide', function (e) {
207
+ _this3.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e.target));
208
+ });
209
+ }
210
+ }
211
+
212
+ /**
213
+ * Calls necessary functions to update Abide upon DOM change
214
+ * @private
215
+ */
216
+
217
+ }, {
218
+ key: '_reflow',
219
+ value: function _reflow() {
220
+ this._init();
221
+ }
222
+
223
+ /**
224
+ * Checks whether or not a form element has the required attribute and if it's checked or not
225
+ * @param {Object} element - jQuery object to check for required attribute
226
+ * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
227
+ */
228
+
229
+ }, {
230
+ key: 'requiredCheck',
231
+ value: function requiredCheck($el) {
232
+ if (!$el.attr('required')) return true;
233
+
234
+ var isGood = true;
235
+
236
+ switch ($el[0].type) {
237
+ case 'checkbox':
238
+ isGood = $el[0].checked;
239
+ break;
240
+
241
+ case 'select':
242
+ case 'select-one':
243
+ case 'select-multiple':
244
+ var opt = $el.find('option:selected');
245
+ if (!opt.length || !opt.val()) isGood = false;
246
+ break;
247
+
248
+ default:
249
+ if (!$el.val() || !$el.val().length) isGood = false;
250
+ }
251
+
252
+ return isGood;
253
+ }
254
+
255
+ /**
256
+ * Get:
257
+ * - Based on $el, the first element(s) corresponding to `formErrorSelector` in this order:
258
+ * 1. The element's direct sibling('s).
259
+ * 2. The element's parent's children.
260
+ * - Element(s) with the attribute `[data-form-error-for]` set with the element's id.
261
+ *
262
+ * This allows for multiple form errors per input, though if none are found, no form errors will be shown.
263
+ *
264
+ * @param {Object} $el - jQuery object to use as reference to find the form error selector.
265
+ * @returns {Object} jQuery object with the selector.
266
+ */
267
+
268
+ }, {
269
+ key: 'findFormError',
270
+ value: function findFormError($el) {
271
+ var id = $el[0].id;
272
+ var $error = $el.siblings(this.options.formErrorSelector);
273
+
274
+ if (!$error.length) {
275
+ $error = $el.parent().find(this.options.formErrorSelector);
276
+ }
277
+
278
+ $error = $error.add(this.$element.find('[data-form-error-for="' + id + '"]'));
279
+
280
+ return $error;
281
+ }
282
+
283
+ /**
284
+ * Get the first element in this order:
285
+ * 2. The <label> with the attribute `[for="someInputId"]`
286
+ * 3. The `.closest()` <label>
287
+ *
288
+ * @param {Object} $el - jQuery object to check for required attribute
289
+ * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
290
+ */
291
+
292
+ }, {
293
+ key: 'findLabel',
294
+ value: function findLabel($el) {
295
+ var id = $el[0].id;
296
+ var $label = this.$element.find('label[for="' + id + '"]');
297
+
298
+ if (!$label.length) {
299
+ return $el.closest('label');
300
+ }
301
+
302
+ return $label;
303
+ }
304
+
305
+ /**
306
+ * Get the set of labels associated with a set of radio els in this order
307
+ * 2. The <label> with the attribute `[for="someInputId"]`
308
+ * 3. The `.closest()` <label>
309
+ *
310
+ * @param {Object} $el - jQuery object to check for required attribute
311
+ * @returns {Boolean} Boolean value depends on whether or not attribute is checked or empty
312
+ */
313
+
314
+ }, {
315
+ key: 'findRadioLabels',
316
+ value: function findRadioLabels($els) {
317
+ var _this4 = this;
318
+
319
+ var labels = $els.map(function (i, el) {
320
+ var id = el.id;
321
+ var $label = _this4.$element.find('label[for="' + id + '"]');
322
+
323
+ if (!$label.length) {
324
+ $label = __WEBPACK_IMPORTED_MODULE_0_jquery___default()(el).closest('label');
325
+ }
326
+ return $label[0];
327
+ });
328
+
329
+ return __WEBPACK_IMPORTED_MODULE_0_jquery___default()(labels);
330
+ }
331
+
332
+ /**
333
+ * Adds the CSS error class as specified by the Abide settings to the label, input, and the form
334
+ * @param {Object} $el - jQuery object to add the class to
335
+ */
336
+
337
+ }, {
338
+ key: 'addErrorClasses',
339
+ value: function addErrorClasses($el) {
340
+ var $label = this.findLabel($el);
341
+ var $formError = this.findFormError($el);
342
+
343
+ if ($label.length) {
344
+ $label.addClass(this.options.labelErrorClass);
345
+ }
346
+
347
+ if ($formError.length) {
348
+ $formError.addClass(this.options.formErrorClass);
349
+ }
350
+
351
+ $el.addClass(this.options.inputErrorClass).attr('data-invalid', '');
352
+ }
353
+
354
+ /**
355
+ * Remove CSS error classes etc from an entire radio button group
356
+ * @param {String} groupName - A string that specifies the name of a radio button group
357
+ *
358
+ */
359
+
360
+ }, {
361
+ key: 'removeRadioErrorClasses',
362
+ value: function removeRadioErrorClasses(groupName) {
363
+ var $els = this.$element.find(':radio[name="' + groupName + '"]');
364
+ var $labels = this.findRadioLabels($els);
365
+ var $formErrors = this.findFormError($els);
366
+
367
+ if ($labels.length) {
368
+ $labels.removeClass(this.options.labelErrorClass);
369
+ }
370
+
371
+ if ($formErrors.length) {
372
+ $formErrors.removeClass(this.options.formErrorClass);
373
+ }
374
+
375
+ $els.removeClass(this.options.inputErrorClass).removeAttr('data-invalid');
376
+ }
377
+
378
+ /**
379
+ * Removes CSS error class as specified by the Abide settings from the label, input, and the form
380
+ * @param {Object} $el - jQuery object to remove the class from
381
+ */
382
+
383
+ }, {
384
+ key: 'removeErrorClasses',
385
+ value: function removeErrorClasses($el) {
386
+ // radios need to clear all of the els
387
+ if ($el[0].type == 'radio') {
388
+ return this.removeRadioErrorClasses($el.attr('name'));
389
+ }
390
+
391
+ var $label = this.findLabel($el);
392
+ var $formError = this.findFormError($el);
393
+
394
+ if ($label.length) {
395
+ $label.removeClass(this.options.labelErrorClass);
396
+ }
397
+
398
+ if ($formError.length) {
399
+ $formError.removeClass(this.options.formErrorClass);
400
+ }
401
+
402
+ $el.removeClass(this.options.inputErrorClass).removeAttr('data-invalid');
403
+ }
404
+
405
+ /**
406
+ * Goes through a form to find inputs and proceeds to validate them in ways specific to their type.
407
+ * Ignores inputs with data-abide-ignore, type="hidden" or disabled attributes set
408
+ * @fires Abide#invalid
409
+ * @fires Abide#valid
410
+ * @param {Object} element - jQuery object to validate, should be an HTML input
411
+ * @returns {Boolean} goodToGo - If the input is valid or not.
412
+ */
413
+
414
+ }, {
415
+ key: 'validateInput',
416
+ value: function validateInput($el) {
417
+ var clearRequire = this.requiredCheck($el),
418
+ validated = false,
419
+ customValidator = true,
420
+ validator = $el.attr('data-validator'),
421
+ equalTo = true;
422
+
423
+ // don't validate ignored inputs or hidden inputs or disabled inputs
424
+ if ($el.is('[data-abide-ignore]') || $el.is('[type="hidden"]') || $el.is('[disabled]')) {
425
+ return true;
426
+ }
427
+
428
+ switch ($el[0].type) {
429
+ case 'radio':
430
+ validated = this.validateRadio($el.attr('name'));
431
+ break;
432
+
433
+ case 'checkbox':
434
+ validated = clearRequire;
435
+ break;
436
+
437
+ case 'select':
438
+ case 'select-one':
439
+ case 'select-multiple':
440
+ validated = clearRequire;
441
+ break;
442
+
443
+ default:
444
+ validated = this.validateText($el);
445
+ }
446
+
447
+ if (validator) {
448
+ customValidator = this.matchValidation($el, validator, $el.attr('required'));
449
+ }
450
+
451
+ if ($el.attr('data-equalto')) {
452
+ equalTo = this.options.validators.equalTo($el);
453
+ }
454
+
455
+ var goodToGo = [clearRequire, validated, customValidator, equalTo].indexOf(false) === -1;
456
+ var message = (goodToGo ? 'valid' : 'invalid') + '.zf.abide';
457
+
458
+ if (goodToGo) {
459
+ // Re-validate inputs that depend on this one with equalto
460
+ var dependentElements = this.$element.find('[data-equalto="' + $el.attr('id') + '"]');
461
+ if (dependentElements.length) {
462
+ var _this = this;
463
+ dependentElements.each(function () {
464
+ if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this).val()) {
465
+ _this.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this));
466
+ }
467
+ });
468
+ }
469
+ }
470
+
471
+ this[goodToGo ? 'removeErrorClasses' : 'addErrorClasses']($el);
472
+
473
+ /**
474
+ * Fires when the input is done checking for validation. Event trigger is either `valid.zf.abide` or `invalid.zf.abide`
475
+ * Trigger includes the DOM element of the input.
476
+ * @event Abide#valid
477
+ * @event Abide#invalid
478
+ */
479
+ $el.trigger(message, [$el]);
480
+
481
+ return goodToGo;
482
+ }
483
+
484
+ /**
485
+ * Goes through a form and if there are any invalid inputs, it will display the form error element
486
+ * @returns {Boolean} noError - true if no errors were detected...
487
+ * @fires Abide#formvalid
488
+ * @fires Abide#forminvalid
489
+ */
490
+
491
+ }, {
492
+ key: 'validateForm',
493
+ value: function validateForm() {
494
+ var acc = [];
495
+ var _this = this;
496
+
497
+ this.$inputs.each(function () {
498
+ acc.push(_this.validateInput(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this)));
499
+ });
500
+
501
+ var noError = acc.indexOf(false) === -1;
502
+
503
+ this.$element.find('[data-abide-error]').css('display', noError ? 'none' : 'block');
504
+
505
+ /**
506
+ * Fires when the form is finished validating. Event trigger is either `formvalid.zf.abide` or `forminvalid.zf.abide`.
507
+ * Trigger includes the element of the form.
508
+ * @event Abide#formvalid
509
+ * @event Abide#forminvalid
510
+ */
511
+ this.$element.trigger((noError ? 'formvalid' : 'forminvalid') + '.zf.abide', [this.$element]);
512
+
513
+ return noError;
514
+ }
515
+
516
+ /**
517
+ * 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.
518
+ * @param {Object} $el - jQuery object to validate, should be a text input HTML element
519
+ * @param {String} pattern - string value of one of the RegEx patterns in Abide.options.patterns
520
+ * @returns {Boolean} Boolean value depends on whether or not the input value matches the pattern specified
521
+ */
522
+
523
+ }, {
524
+ key: 'validateText',
525
+ value: function validateText($el, pattern) {
526
+ // A pattern can be passed to this function, or it will be infered from the input's "pattern" attribute, or it's "type" attribute
527
+ pattern = pattern || $el.attr('pattern') || $el.attr('type');
528
+ var inputText = $el.val();
529
+ var valid = false;
530
+
531
+ if (inputText.length) {
532
+ // If the pattern attribute on the element is in Abide's list of patterns, then test that regexp
533
+ if (this.options.patterns.hasOwnProperty(pattern)) {
534
+ valid = this.options.patterns[pattern].test(inputText);
535
+ }
536
+ // If the pattern name isn't also the type attribute of the field, then test it as a regexp
537
+ else if (pattern !== $el.attr('type')) {
538
+ valid = new RegExp(pattern).test(inputText);
539
+ } else {
540
+ valid = true;
541
+ }
542
+ }
543
+ // An empty field is valid if it's not required
544
+ else if (!$el.prop('required')) {
545
+ valid = true;
546
+ }
547
+
548
+ return valid;
549
+ }
550
+
551
+ /**
552
+ * Determines whether or a not a radio input is valid based on whether or not it is required and selected. Although the function targets a single `<input>`, it validates by checking the `required` and `checked` properties of all radio buttons in its group.
553
+ * @param {String} groupName - A string that specifies the name of a radio button group
554
+ * @returns {Boolean} Boolean value depends on whether or not at least one radio input has been selected (if it's required)
555
+ */
556
+
557
+ }, {
558
+ key: 'validateRadio',
559
+ value: function validateRadio(groupName) {
560
+ // If at least one radio in the group has the `required` attribute, the group is considered required
561
+ // Per W3C spec, all radio buttons in a group should have `required`, but we're being nice
562
+ var $group = this.$element.find(':radio[name="' + groupName + '"]');
563
+ var valid = false,
564
+ required = false;
565
+
566
+ // For the group to be required, at least one radio needs to be required
567
+ $group.each(function (i, e) {
568
+ if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e).attr('required')) {
569
+ required = true;
570
+ }
571
+ });
572
+ if (!required) valid = true;
573
+
574
+ if (!valid) {
575
+ // For the group to be valid, at least one radio needs to be checked
576
+ $group.each(function (i, e) {
577
+ if (__WEBPACK_IMPORTED_MODULE_0_jquery___default()(e).prop('checked')) {
578
+ valid = true;
579
+ }
580
+ });
581
+ };
582
+
583
+ return valid;
584
+ }
585
+
586
+ /**
587
+ * 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.
588
+ * @param {Object} $el - jQuery input element.
589
+ * @param {String} validators - a string of function names matching functions in the Abide.options.validators object.
590
+ * @param {Boolean} required - self explanatory?
591
+ * @returns {Boolean} - true if validations passed.
592
+ */
593
+
594
+ }, {
595
+ key: 'matchValidation',
596
+ value: function matchValidation($el, validators, required) {
597
+ var _this5 = this;
598
+
599
+ required = required ? true : false;
600
+
601
+ var clear = validators.split(' ').map(function (v) {
602
+ return _this5.options.validators[v]($el, required, $el.parent());
603
+ });
604
+ return clear.indexOf(false) === -1;
605
+ }
606
+
607
+ /**
608
+ * Resets form inputs and styles
609
+ * @fires Abide#formreset
610
+ */
611
+
612
+ }, {
613
+ key: 'resetForm',
614
+ value: function resetForm() {
615
+ var $form = this.$element,
616
+ opts = this.options;
617
+
618
+ __WEBPACK_IMPORTED_MODULE_0_jquery___default()('.' + opts.labelErrorClass, $form).not('small').removeClass(opts.labelErrorClass);
619
+ __WEBPACK_IMPORTED_MODULE_0_jquery___default()('.' + opts.inputErrorClass, $form).not('small').removeClass(opts.inputErrorClass);
620
+ __WEBPACK_IMPORTED_MODULE_0_jquery___default()(opts.formErrorSelector + '.' + opts.formErrorClass).removeClass(opts.formErrorClass);
621
+ $form.find('[data-abide-error]').css('display', 'none');
622
+ __WEBPACK_IMPORTED_MODULE_0_jquery___default()(':input', $form).not(':button, :submit, :reset, :hidden, :radio, :checkbox, [data-abide-ignore]').val('').removeAttr('data-invalid');
623
+ __WEBPACK_IMPORTED_MODULE_0_jquery___default()(':input:radio', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid');
624
+ __WEBPACK_IMPORTED_MODULE_0_jquery___default()(':input:checkbox', $form).not('[data-abide-ignore]').prop('checked', false).removeAttr('data-invalid');
625
+ /**
626
+ * Fires when the form has been reset.
627
+ * @event Abide#formreset
628
+ */
629
+ $form.trigger('formreset.zf.abide', [$form]);
630
+ }
631
+
632
+ /**
633
+ * Destroys an instance of Abide.
634
+ * Removes error styles and classes from elements, without resetting their values.
635
+ */
636
+
637
+ }, {
638
+ key: '_destroy',
639
+ value: function _destroy() {
640
+ var _this = this;
641
+ this.$element.off('.abide').find('[data-abide-error]').css('display', 'none');
642
+
643
+ this.$inputs.off('.abide').each(function () {
644
+ _this.removeErrorClasses(__WEBPACK_IMPORTED_MODULE_0_jquery___default()(this));
645
+ });
646
+ }
647
+ }]);
648
+
649
+ return Abide;
650
+ }(__WEBPACK_IMPORTED_MODULE_1__foundation_plugin__["Plugin"]);
651
+
652
+ /**
653
+ * Default settings for plugin
654
+ */
655
+
656
+
657
+ Abide.defaults = {
658
+ /**
659
+ * The default event to validate inputs. Checkboxes and radios validate immediately.
660
+ * Remove or change this value for manual validation.
661
+ * @option
662
+ * @type {?string}
663
+ * @default 'fieldChange'
664
+ */
665
+ validateOn: 'fieldChange',
666
+
667
+ /**
668
+ * Class to be applied to input labels on failed validation.
669
+ * @option
670
+ * @type {string}
671
+ * @default 'is-invalid-label'
672
+ */
673
+ labelErrorClass: 'is-invalid-label',
674
+
675
+ /**
676
+ * Class to be applied to inputs on failed validation.
677
+ * @option
678
+ * @type {string}
679
+ * @default 'is-invalid-input'
680
+ */
681
+ inputErrorClass: 'is-invalid-input',
682
+
683
+ /**
684
+ * Class selector to use to target Form Errors for show/hide.
685
+ * @option
686
+ * @type {string}
687
+ * @default '.form-error'
688
+ */
689
+ formErrorSelector: '.form-error',
690
+
691
+ /**
692
+ * Class added to Form Errors on failed validation.
693
+ * @option
694
+ * @type {string}
695
+ * @default 'is-visible'
696
+ */
697
+ formErrorClass: 'is-visible',
698
+
699
+ /**
700
+ * Set to true to validate text inputs on any value change.
701
+ * @option
702
+ * @type {boolean}
703
+ * @default false
704
+ */
705
+ liveValidate: false,
706
+
707
+ /**
708
+ * Set to true to validate inputs on blur.
709
+ * @option
710
+ * @type {boolean}
711
+ * @default false
712
+ */
713
+ validateOnBlur: false,
714
+
715
+ patterns: {
716
+ alpha: /^[a-zA-Z]+$/,
717
+ alpha_numeric: /^[a-zA-Z0-9]+$/,
718
+ integer: /^[-+]?\d+$/,
719
+ number: /^[-+]?\d*(?:[\.\,]\d+)?$/,
720
+
721
+ // amex, visa, diners
722
+ card: /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(?:222[1-9]|2[3-6][0-9]{2}|27[0-1][0-9]|2720)[0-9]{12}|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})$/,
723
+ cvv: /^([0-9]){3,4}$/,
724
+
725
+ // http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#valid-e-mail-address
726
+ 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])?)+$/,
727
+
728
+ 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})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,
729
+ // abc.de
730
+ domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,8}$/,
731
+
732
+ 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))$/,
733
+ // YYYY-MM-DD
734
+ 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))$/,
735
+ // HH:MM:SS
736
+ time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,
737
+ dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,
738
+ // MM/DD/YYYY
739
+ month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,
740
+ // DD/MM/YYYY
741
+ day_month_year: /^(0[1-9]|[12][0-9]|3[01])[- \/.](0[1-9]|1[012])[- \/.]\d{4}$/,
742
+
743
+ // #FFF or #FFFFFF
744
+ color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/,
745
+
746
+ // Domain || URL
747
+ website: {
748
+ test: function (text) {
749
+ return Abide.defaults.patterns['domain'].test(text) || Abide.defaults.patterns['url'].test(text);
750
+ }
751
+ }
752
+ },
753
+
754
+ /**
755
+ * Optional validation functions to be used. `equalTo` being the only default included function.
756
+ * Functions should return only a boolean if the input is valid or not. Functions are given the following arguments:
757
+ * el : The jQuery element to validate.
758
+ * required : Boolean value of the required attribute be present or not.
759
+ * parent : The direct parent of the input.
760
+ * @option
761
+ */
762
+ validators: {
763
+ equalTo: function (el, required, parent) {
764
+ return __WEBPACK_IMPORTED_MODULE_0_jquery___default()('#' + el.attr('data-equalto')).val() === el.val();
765
+ }
766
+ }
767
+ };
768
+
769
+
770
+
771
+ /***/ }),
772
+
773
+ /***/ 79:
774
+ /***/ (function(module, exports, __webpack_require__) {
775
+
776
+ module.exports = __webpack_require__(13);
777
+
778
+
779
+ /***/ })
780
+
781
+ /******/ });