fomantic-ui-sass 2.8.6 → 2.8.8

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +6 -0
  4. data/app/assets/fonts/semantic-ui/brand-icons.eot +0 -0
  5. data/app/assets/fonts/semantic-ui/brand-icons.svg +6 -41
  6. data/app/assets/fonts/semantic-ui/brand-icons.ttf +0 -0
  7. data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
  8. data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
  9. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  10. data/app/assets/fonts/semantic-ui/icons.svg +7 -245
  11. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  12. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  13. data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
  14. data/app/assets/fonts/semantic-ui/outline-icons.eot +0 -0
  15. data/app/assets/fonts/semantic-ui/outline-icons.svg +2 -2
  16. data/app/assets/fonts/semantic-ui/outline-icons.ttf +0 -0
  17. data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
  18. data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
  19. data/app/assets/javascripts/semantic-ui/calendar.js +153 -29
  20. data/app/assets/javascripts/semantic-ui/checkbox.js +1 -1
  21. data/app/assets/javascripts/semantic-ui/dimmer.js +11 -14
  22. data/app/assets/javascripts/semantic-ui/dropdown.js +240 -112
  23. data/app/assets/javascripts/semantic-ui/form.js +131 -67
  24. data/app/assets/javascripts/semantic-ui/modal.js +259 -16
  25. data/app/assets/javascripts/semantic-ui/nag.js +130 -64
  26. data/app/assets/javascripts/semantic-ui/popup.js +4 -4
  27. data/app/assets/javascripts/semantic-ui/progress.js +25 -31
  28. data/app/assets/javascripts/semantic-ui/search.js +15 -12
  29. data/app/assets/javascripts/semantic-ui/slider.js +57 -33
  30. data/app/assets/javascripts/semantic-ui/toast.js +26 -6
  31. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
  32. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +69 -74
  33. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +14 -7
  34. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +14 -11
  35. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +52 -5
  36. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +9 -5
  37. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +1 -0
  38. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +29 -2
  39. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +3 -4
  40. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +1 -1
  41. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1 -1
  42. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +14 -9
  43. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +244 -66
  44. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +34 -5
  45. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +34 -33
  46. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +1 -1
  47. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +13 -13
  48. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +41 -37
  49. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +1 -1
  50. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
  51. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
  52. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +40 -2
  53. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +10 -10
  54. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +13 -1
  55. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +2 -3
  56. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +2 -2
  57. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
  58. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +18 -11
  59. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +46 -4
  60. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +15 -15
  61. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +180 -28
  62. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +7 -7
  63. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +22 -11
  64. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +168 -16
  65. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +6 -2
  66. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +18 -10
  67. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +18 -33
  68. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +1 -1
  69. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
  70. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +3 -2
  71. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +11 -0
  72. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -2
  73. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
  74. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +103 -16
  75. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
  76. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +1 -1
  77. data/app/assets/stylesheets/semantic-ui/views/_card.scss +75 -3
  78. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
  79. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +6 -6
  80. data/app/assets/stylesheets/semantic-ui/views/_item.scss +1 -1
  81. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +5 -5
  82. data/lib/fomantic/ui/sass/version.rb +2 -2
  83. metadata +3 -3
@@ -91,6 +91,7 @@ $.fn.form = function(parameters) {
91
91
  else {
92
92
  if(instance !== undefined) {
93
93
  instance.invoke('destroy');
94
+ module.refresh();
94
95
  }
95
96
  module.verbose('Initializing form validation', $module, settings);
96
97
  module.bindEvents();
@@ -171,11 +172,9 @@ $.fn.form = function(parameters) {
171
172
  }
172
173
 
173
174
  $field.on('change click keyup keydown blur', function(e) {
174
- $(this).triggerHandler(e.type + ".dirty");
175
+ module.determine.isDirty();
175
176
  });
176
177
 
177
- $field.on('change.dirty click.dirty keyup.dirty keydown.dirty blur.dirty', module.determine.isDirty);
178
-
179
178
  $module.on('dirty' + eventNamespace, function(e) {
180
179
  settings.onDirty.call();
181
180
  });
@@ -219,6 +218,7 @@ $.fn.form = function(parameters) {
219
218
  $field.val('');
220
219
  }
221
220
  });
221
+ module.remove.states();
222
222
  },
223
223
 
224
224
  reset: function() {
@@ -259,8 +259,7 @@ $.fn.form = function(parameters) {
259
259
  $field.val(defaultValue);
260
260
  }
261
261
  });
262
-
263
- module.determine.isDirty();
262
+ module.remove.states();
264
263
  },
265
264
 
266
265
  determine: {
@@ -302,10 +301,6 @@ $.fn.form = function(parameters) {
302
301
  module.set.clean();
303
302
  }
304
303
 
305
- if (e && e.namespace === 'dirty') {
306
- e.stopImmediatePropagation();
307
- e.preventDefault();
308
- }
309
304
  }
310
305
  },
311
306
 
@@ -313,13 +308,6 @@ $.fn.form = function(parameters) {
313
308
  bracketedRule: function(rule) {
314
309
  return (rule.type && rule.type.match(settings.regExp.bracket));
315
310
  },
316
- shorthandFields: function(fields) {
317
- var
318
- fieldKeys = Object.keys(fields),
319
- firstRule = fields[fieldKeys[0]]
320
- ;
321
- return module.is.shorthandRules(firstRule);
322
- },
323
311
  // duck type rule test
324
312
  shorthandRules: function(rules) {
325
313
  return (typeof rules == 'string' || Array.isArray(rules));
@@ -338,18 +326,18 @@ $.fn.form = function(parameters) {
338
326
  blank: function($field) {
339
327
  return String($field.val()).trim() === '';
340
328
  },
341
- valid: function(field) {
329
+ valid: function(field, showErrors) {
342
330
  var
343
331
  allValid = true
344
332
  ;
345
333
  if(field) {
346
334
  module.verbose('Checking if field is valid', field);
347
- return module.validate.field(validation[field], field, false);
335
+ return module.validate.field(validation[field], field, !!showErrors);
348
336
  }
349
337
  else {
350
338
  module.verbose('Checking if form is valid');
351
339
  $.each(validation, function(fieldName, field) {
352
- if( !module.is.valid(fieldName) ) {
340
+ if( !module.is.valid(fieldName, showErrors) ) {
353
341
  allValid = false;
354
342
  }
355
343
  });
@@ -366,9 +354,15 @@ $.fn.form = function(parameters) {
366
354
  var initialValue = $el.data(metadata.defaultValue);
367
355
  // Explicitly check for null/undefined here as value may be `false`, so ($el.data(dataInitialValue) || '') would not work
368
356
  if (initialValue == null) { initialValue = ''; }
357
+ else if(Array.isArray(initialValue)) {
358
+ initialValue = initialValue.toString();
359
+ }
369
360
  var currentValue = $el.val();
370
361
  if (currentValue == null) { currentValue = ''; }
371
-
362
+ // multiple select values are returned as arrays which are never equal, so do string conversion first
363
+ else if(Array.isArray(currentValue)) {
364
+ currentValue = currentValue.toString();
365
+ }
372
366
  // Boolean values can be encoded as "true/false" or "True/False" depending on underlying frameworks so we need a case insensitive comparison
373
367
  var boolRegex = /^(true|false)$/i;
374
368
  var isBoolValue = boolRegex.test(initialValue) && boolRegex.test(currentValue);
@@ -416,7 +410,7 @@ $.fn.form = function(parameters) {
416
410
  ;
417
411
  if( key == keyCode.escape) {
418
412
  module.verbose('Escape key pressed blurring field');
419
- $field
413
+ $field[0]
420
414
  .blur()
421
415
  ;
422
416
  }
@@ -438,15 +432,11 @@ $.fn.form = function(parameters) {
438
432
  $fieldGroup = $field.closest($group),
439
433
  validationRules = module.get.validation($field)
440
434
  ;
441
- if( $fieldGroup.hasClass(className.error) ) {
435
+ if(validationRules && (settings.on == 'blur' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) {
442
436
  module.debug('Revalidating field', $field, validationRules);
443
- if(validationRules) {
444
- module.validate.field( validationRules );
445
- }
446
- }
447
- else if(settings.on == 'blur') {
448
- if(validationRules) {
449
- module.validate.field( validationRules );
437
+ module.validate.field( validationRules );
438
+ if(!settings.inline) {
439
+ module.validate.form(false,true);
450
440
  }
451
441
  }
452
442
  },
@@ -459,8 +449,11 @@ $.fn.form = function(parameters) {
459
449
  if(validationRules && (settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) )) {
460
450
  clearTimeout(module.timer);
461
451
  module.timer = setTimeout(function() {
462
- module.debug('Revalidating field', $field, module.get.validation($field));
452
+ module.debug('Revalidating field', $field, validationRules);
463
453
  module.validate.field( validationRules );
454
+ if(!settings.inline) {
455
+ module.validate.form(false,true);
456
+ }
464
457
  }, settings.delay);
465
458
  }
466
459
  }
@@ -518,15 +511,19 @@ $.fn.form = function(parameters) {
518
511
  fullFields = {}
519
512
  ;
520
513
  $.each(fields, function(name, rules) {
521
- if(typeof rules == 'string') {
522
- rules = [rules];
514
+ if (!Array.isArray(rules) && typeof rules === 'object') {
515
+ fullFields[name] = rules;
516
+ } else {
517
+ if (typeof rules == 'string') {
518
+ rules = [rules];
519
+ }
520
+ fullFields[name] = {
521
+ rules: []
522
+ };
523
+ $.each(rules, function (index, rule) {
524
+ fullFields[name].rules.push({type: rule});
525
+ });
523
526
  }
524
- fullFields[name] = {
525
- rules: []
526
- };
527
- $.each(rules, function(index, rule) {
528
- fullFields[name].rules.push({ type: rule });
529
- });
530
527
  });
531
528
  return fullFields;
532
529
  },
@@ -542,8 +539,23 @@ $.fn.form = function(parameters) {
542
539
  requiresValue = (prompt.search('{value}') !== -1),
543
540
  requiresName = (prompt.search('{name}') !== -1),
544
541
  $label,
545
- name
542
+ name,
543
+ parts,
544
+ suffixPrompt
546
545
  ;
546
+ if(ancillary && ancillary.indexOf('..') >= 0) {
547
+ parts = ancillary.split('..', 2);
548
+ if(!rule.prompt) {
549
+ suffixPrompt = (
550
+ parts[0] === '' ? settings.prompt.maxValue.replace(/\{ruleValue\}/g,'{max}') :
551
+ parts[1] === '' ? settings.prompt.minValue.replace(/\{ruleValue\}/g,'{min}') :
552
+ settings.prompt.range
553
+ );
554
+ prompt += suffixPrompt.replace(/\{name\}/g, ' ' + settings.text.and);
555
+ }
556
+ prompt = prompt.replace(/\{min\}/g, parts[0]);
557
+ prompt = prompt.replace(/\{max\}/g, parts[1]);
558
+ }
547
559
  if(requiresValue) {
548
560
  prompt = prompt.replace(/\{value\}/g, $field.val());
549
561
  }
@@ -579,7 +591,7 @@ $.fn.form = function(parameters) {
579
591
  }
580
592
  else {
581
593
  // 2.x
582
- if(parameters.fields && module.is.shorthandFields(parameters.fields)) {
594
+ if(parameters.fields) {
583
595
  parameters.fields = module.get.fieldsFromShorthand(parameters.fields);
584
596
  }
585
597
  settings = $.extend(true, {}, $.fn.form.settings, parameters);
@@ -607,7 +619,7 @@ $.fn.form = function(parameters) {
607
619
  instance = $module.data(moduleNamespace);
608
620
 
609
621
  // refresh selector cache
610
- module.refresh();
622
+ (instance || module).refresh();
611
623
  },
612
624
  field: function(identifier) {
613
625
  module.verbose('Finding field with identifier', identifier);
@@ -853,16 +865,7 @@ $.fn.form = function(parameters) {
853
865
  module.debug('Adding rules', newValidation.rules, validation);
854
866
  },
855
867
  fields: function(fields) {
856
- var
857
- newValidation
858
- ;
859
- if(fields && module.is.shorthandFields(fields)) {
860
- newValidation = module.get.fieldsFromShorthand(fields);
861
- }
862
- else {
863
- newValidation = fields;
864
- }
865
- validation = $.extend({}, validation, newValidation);
868
+ validation = $.extend({}, validation, module.get.fieldsFromShorthand(fields));
866
869
  },
867
870
  prompt: function(identifier, errors, internal) {
868
871
  var
@@ -918,6 +921,17 @@ $.fn.form = function(parameters) {
918
921
  },
919
922
 
920
923
  remove: {
924
+ errors: function() {
925
+ module.debug('Removing form error messages');
926
+ $message.empty();
927
+ },
928
+ states: function() {
929
+ $module.removeClass(className.error).removeClass(className.success);
930
+ if(!settings.inline) {
931
+ module.remove.errors();
932
+ }
933
+ module.determine.isDirty();
934
+ },
921
935
  rule: function(field, rule) {
922
936
  var
923
937
  rules = Array.isArray(rule)
@@ -1145,6 +1159,14 @@ $.fn.form = function(parameters) {
1145
1159
  }
1146
1160
  }
1147
1161
  });
1162
+ },
1163
+ optional: function(identifier, bool) {
1164
+ bool = (bool !== false);
1165
+ $.each(validation, function(fieldName, field) {
1166
+ if (identifier == fieldName || identifier == field.identifier) {
1167
+ field.optional = bool;
1168
+ }
1169
+ });
1148
1170
  }
1149
1171
  },
1150
1172
 
@@ -1163,12 +1185,16 @@ $.fn.form = function(parameters) {
1163
1185
  if( module.determine.isValid() ) {
1164
1186
  module.debug('Form has no validation errors, submitting');
1165
1187
  module.set.success();
1188
+ if(!settings.inline) {
1189
+ module.remove.errors();
1190
+ }
1166
1191
  if(ignoreCallbacks !== true) {
1167
1192
  return settings.onSuccess.call(element, event, values);
1168
1193
  }
1169
1194
  }
1170
1195
  else {
1171
1196
  module.debug('Form has errors');
1197
+ submitting = false;
1172
1198
  module.set.error();
1173
1199
  if(!settings.inline) {
1174
1200
  module.add.errors(formErrors);
@@ -1177,6 +1203,24 @@ $.fn.form = function(parameters) {
1177
1203
  if(event && $module.data('moduleApi') !== undefined) {
1178
1204
  event.stopImmediatePropagation();
1179
1205
  }
1206
+ if(settings.errorFocus) {
1207
+ var focusElement, hasTabIndex = true;
1208
+ if (typeof settings.errorFocus === 'string') {
1209
+ focusElement = $(settings.errorFocus);
1210
+ hasTabIndex = focusElement.is('[tabindex]');
1211
+ // to be able to focus/scroll into non input elements we need a tabindex
1212
+ if (!hasTabIndex) {
1213
+ focusElement.attr('tabindex',-1);
1214
+ }
1215
+ } else {
1216
+ focusElement = $group.filter('.' + className.error).first().find(selector.field);
1217
+ }
1218
+ focusElement.focus();
1219
+ // only remove tabindex if it was dynamically created above
1220
+ if (!hasTabIndex){
1221
+ focusElement.removeAttr('tabindex');
1222
+ }
1223
+ }
1180
1224
  if(ignoreCallbacks !== true) {
1181
1225
  return settings.onFailure.call(element, formErrors, values);
1182
1226
  }
@@ -1218,7 +1262,9 @@ $.fn.form = function(parameters) {
1218
1262
  module.debug('Field depends on another value that is not present or empty. Skipping', $dependsField);
1219
1263
  }
1220
1264
  else if(field.rules !== undefined) {
1221
- $field.closest($group).removeClass(className.error);
1265
+ if(showErrors) {
1266
+ $field.closest($group).removeClass(className.error);
1267
+ }
1222
1268
  $.each(field.rules, function(index, rule) {
1223
1269
  if( module.has.field(identifier)) {
1224
1270
  var invalidFields = module.validate.rule(field, rule,true) || [];
@@ -1264,7 +1310,7 @@ $.fn.form = function(parameters) {
1264
1310
  // cast to string avoiding encoding special values
1265
1311
  value = (value === undefined || value === '' || value === null)
1266
1312
  ? ''
1267
- : (settings.shouldTrim) ? String(value + '').trim() : String(value + '')
1313
+ : (settings.shouldTrim && rule.shouldTrim !== false) || rule.shouldTrim ? String(value + '').trim() : String(value + '')
1268
1314
  ;
1269
1315
  return ruleFunction.call(field, value, ancillary, $module);
1270
1316
  }
@@ -1480,6 +1526,7 @@ $.fn.form.settings = {
1480
1526
 
1481
1527
  autoCheckRequired : false,
1482
1528
  preventLeaving : false,
1529
+ errorFocus : false,
1483
1530
  dateHandling : 'date', // 'date', 'input', 'formatter'
1484
1531
 
1485
1532
  onValid : function() {},
@@ -1508,12 +1555,16 @@ $.fn.form.settings = {
1508
1555
  },
1509
1556
 
1510
1557
  text: {
1558
+ and : 'and',
1511
1559
  unspecifiedRule : 'Please enter a valid value',
1512
1560
  unspecifiedField : 'This field',
1513
1561
  leavingMessage : 'There are unsaved changes on this page which will be discarded if you continue.'
1514
1562
  },
1515
1563
 
1516
1564
  prompt: {
1565
+ range : '{name} must be in a range from {min} to {max}',
1566
+ maxValue : '{name} must have a maximum value of {ruleValue}',
1567
+ minValue : '{name} must have a minimum value of {ruleValue}',
1517
1568
  empty : '{name} must have a value',
1518
1569
  checked : '{name} must be checked',
1519
1570
  email : '{name} must be a valid e-mail',
@@ -1545,9 +1596,9 @@ $.fn.form.settings = {
1545
1596
  selector : {
1546
1597
  checkbox : 'input[type="checkbox"], input[type="radio"]',
1547
1598
  clear : '.clear',
1548
- field : 'input, textarea, select',
1599
+ field : 'input:not(.search):not([type="file"]), textarea, select',
1549
1600
  group : '.field',
1550
- input : 'input',
1601
+ input : 'input:not([type="file"])',
1551
1602
  message : '.error.message',
1552
1603
  prompt : '.prompt.label',
1553
1604
  radio : 'input[type="radio"]',
@@ -1676,11 +1727,24 @@ $.fn.form.settings = {
1676
1727
  }
1677
1728
  return value.match( new RegExp(regExp, flags) );
1678
1729
  },
1679
-
1730
+ minValue: function(value, range) {
1731
+ return $.fn.form.settings.rules.range(value, range+'..', 'number');
1732
+ },
1733
+ maxValue: function(value, range) {
1734
+ return $.fn.form.settings.rules.range(value, '..'+range, 'number');
1735
+ },
1680
1736
  // is valid integer or matches range
1681
1737
  integer: function(value, range) {
1738
+ return $.fn.form.settings.rules.range(value, range, 'integer');
1739
+ },
1740
+ range: function(value, range, regExp) {
1741
+ if(typeof regExp == "string") {
1742
+ regExp = $.fn.form.settings.regExp[regExp];
1743
+ }
1744
+ if(!(regExp instanceof RegExp)) {
1745
+ regExp = $.fn.form.settings.regExp.integer;
1746
+ }
1682
1747
  var
1683
- intRegExp = $.fn.form.settings.regExp.integer,
1684
1748
  min,
1685
1749
  max,
1686
1750
  parts
@@ -1689,34 +1753,34 @@ $.fn.form.settings = {
1689
1753
  // do nothing
1690
1754
  }
1691
1755
  else if(range.indexOf('..') == -1) {
1692
- if(intRegExp.test(range)) {
1756
+ if(regExp.test(range)) {
1693
1757
  min = max = range - 0;
1694
1758
  }
1695
1759
  }
1696
1760
  else {
1697
1761
  parts = range.split('..', 2);
1698
- if(intRegExp.test(parts[0])) {
1762
+ if(regExp.test(parts[0])) {
1699
1763
  min = parts[0] - 0;
1700
1764
  }
1701
- if(intRegExp.test(parts[1])) {
1765
+ if(regExp.test(parts[1])) {
1702
1766
  max = parts[1] - 0;
1703
1767
  }
1704
1768
  }
1705
1769
  return (
1706
- intRegExp.test(value) &&
1770
+ regExp.test(value) &&
1707
1771
  (min === undefined || value >= min) &&
1708
1772
  (max === undefined || value <= max)
1709
1773
  );
1710
1774
  },
1711
1775
 
1712
1776
  // is valid number (with decimal)
1713
- decimal: function(value) {
1714
- return $.fn.form.settings.regExp.decimal.test(value);
1777
+ decimal: function(value, range) {
1778
+ return $.fn.form.settings.rules.range(value, range, 'decimal');
1715
1779
  },
1716
1780
 
1717
1781
  // is valid number
1718
- number: function(value) {
1719
- return $.fn.form.settings.regExp.number.test(value);
1782
+ number: function(value, range) {
1783
+ return $.fn.form.settings.rules.range(value, range, 'number');
1720
1784
  },
1721
1785
 
1722
1786
  // is value (case insensitive)
@@ -1921,8 +1985,8 @@ $.fn.form.settings = {
1921
1985
  return;
1922
1986
  }
1923
1987
 
1924
- // allow dashes in card
1925
- cardNumber = cardNumber.replace(/[\-]/g, '');
1988
+ // allow dashes and spaces in card
1989
+ cardNumber = cardNumber.replace(/[\s\-]/g, '');
1926
1990
 
1927
1991
  // verify card types
1928
1992
  if(requiredTypes) {