fomantic-ui 2.9.3-beta.2 → 2.9.3-beta.21

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 (246) hide show
  1. package/.github/workflows/ci.yml +1 -1
  2. package/dist/components/accordion.css +1 -1
  3. package/dist/components/accordion.js +1 -1
  4. package/dist/components/accordion.min.css +1 -1
  5. package/dist/components/accordion.min.js +1 -1
  6. package/dist/components/ad.css +1 -1
  7. package/dist/components/ad.min.css +1 -1
  8. package/dist/components/api.js +1 -1
  9. package/dist/components/api.min.js +1 -1
  10. package/dist/components/breadcrumb.css +1 -1
  11. package/dist/components/breadcrumb.min.css +1 -1
  12. package/dist/components/button.css +2 -2
  13. package/dist/components/button.min.css +2 -2
  14. package/dist/components/calendar.css +6 -6
  15. package/dist/components/calendar.js +1 -1
  16. package/dist/components/calendar.min.css +2 -2
  17. package/dist/components/calendar.min.js +1 -1
  18. package/dist/components/card.css +1 -1
  19. package/dist/components/card.min.css +1 -1
  20. package/dist/components/checkbox.css +1 -1
  21. package/dist/components/checkbox.js +1 -1
  22. package/dist/components/checkbox.min.css +1 -1
  23. package/dist/components/checkbox.min.js +1 -1
  24. package/dist/components/comment.css +1 -1
  25. package/dist/components/comment.min.css +1 -1
  26. package/dist/components/container.css +62 -1
  27. package/dist/components/container.min.css +2 -2
  28. package/dist/components/dimmer.css +3 -3
  29. package/dist/components/dimmer.js +1 -1
  30. package/dist/components/dimmer.min.css +2 -2
  31. package/dist/components/dimmer.min.js +1 -1
  32. package/dist/components/divider.css +1 -1
  33. package/dist/components/divider.min.css +1 -1
  34. package/dist/components/dropdown.css +42 -4
  35. package/dist/components/dropdown.js +22 -12
  36. package/dist/components/dropdown.min.css +2 -2
  37. package/dist/components/dropdown.min.js +2 -2
  38. package/dist/components/embed.css +1 -1
  39. package/dist/components/embed.js +1 -1
  40. package/dist/components/embed.min.css +1 -1
  41. package/dist/components/embed.min.js +1 -1
  42. package/dist/components/emoji.css +1 -1
  43. package/dist/components/emoji.min.css +1 -1
  44. package/dist/components/feed.css +1 -1
  45. package/dist/components/feed.min.css +1 -1
  46. package/dist/components/flag.css +3 -2
  47. package/dist/components/flag.min.css +2 -2
  48. package/dist/components/flyout.css +1 -1
  49. package/dist/components/flyout.js +26 -20
  50. package/dist/components/flyout.min.css +1 -1
  51. package/dist/components/flyout.min.js +2 -2
  52. package/dist/components/form.css +53 -20
  53. package/dist/components/form.js +78 -44
  54. package/dist/components/form.min.css +2 -2
  55. package/dist/components/form.min.js +2 -2
  56. package/dist/components/grid.css +107 -107
  57. package/dist/components/grid.min.css +2 -2
  58. package/dist/components/header.css +1 -1
  59. package/dist/components/header.min.css +1 -1
  60. package/dist/components/icon.css +1 -1
  61. package/dist/components/icon.min.css +1 -1
  62. package/dist/components/image.css +1 -1
  63. package/dist/components/image.min.css +1 -1
  64. package/dist/components/input.css +3 -27
  65. package/dist/components/input.min.css +2 -2
  66. package/dist/components/item.css +1 -1
  67. package/dist/components/item.min.css +1 -1
  68. package/dist/components/label.css +21 -2
  69. package/dist/components/label.min.css +2 -2
  70. package/dist/components/list.css +13 -13
  71. package/dist/components/list.min.css +2 -2
  72. package/dist/components/loader.css +282 -282
  73. package/dist/components/loader.min.css +2 -2
  74. package/dist/components/menu.css +9 -3
  75. package/dist/components/menu.min.css +2 -2
  76. package/dist/components/message.css +1 -1
  77. package/dist/components/message.min.css +1 -1
  78. package/dist/components/modal.css +10 -3
  79. package/dist/components/modal.js +31 -26
  80. package/dist/components/modal.min.css +2 -2
  81. package/dist/components/modal.min.js +2 -2
  82. package/dist/components/nag.css +1 -1
  83. package/dist/components/nag.js +1 -1
  84. package/dist/components/nag.min.css +1 -1
  85. package/dist/components/nag.min.js +1 -1
  86. package/dist/components/placeholder.css +1 -1
  87. package/dist/components/placeholder.min.css +1 -1
  88. package/dist/components/popup.css +41 -40
  89. package/dist/components/popup.js +8 -6
  90. package/dist/components/popup.min.css +2 -2
  91. package/dist/components/popup.min.js +2 -2
  92. package/dist/components/progress.css +1 -1
  93. package/dist/components/progress.js +1 -1
  94. package/dist/components/progress.min.css +1 -1
  95. package/dist/components/progress.min.js +1 -1
  96. package/dist/components/rail.css +1 -1
  97. package/dist/components/rail.min.css +1 -1
  98. package/dist/components/rating.css +1 -1
  99. package/dist/components/rating.js +1 -1
  100. package/dist/components/rating.min.css +1 -1
  101. package/dist/components/rating.min.js +1 -1
  102. package/dist/components/reset.css +1 -1
  103. package/dist/components/reset.min.css +1 -1
  104. package/dist/components/reveal.css +1 -1
  105. package/dist/components/reveal.min.css +1 -1
  106. package/dist/components/search.css +17 -1
  107. package/dist/components/search.js +3 -2
  108. package/dist/components/search.min.css +2 -2
  109. package/dist/components/search.min.js +2 -2
  110. package/dist/components/segment.css +159 -33
  111. package/dist/components/segment.min.css +2 -2
  112. package/dist/components/shape.css +1 -1
  113. package/dist/components/shape.js +1 -1
  114. package/dist/components/shape.min.css +1 -1
  115. package/dist/components/shape.min.js +1 -1
  116. package/dist/components/sidebar.css +1 -1
  117. package/dist/components/sidebar.js +1 -1
  118. package/dist/components/sidebar.min.css +1 -1
  119. package/dist/components/sidebar.min.js +1 -1
  120. package/dist/components/site.css +1 -1
  121. package/dist/components/site.js +1 -1
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +1 -1
  124. package/dist/components/slider.css +1 -1
  125. package/dist/components/slider.js +122 -26
  126. package/dist/components/slider.min.css +1 -1
  127. package/dist/components/slider.min.js +2 -2
  128. package/dist/components/state.js +1 -1
  129. package/dist/components/state.min.js +1 -1
  130. package/dist/components/statistic.css +1 -1
  131. package/dist/components/statistic.min.css +1 -1
  132. package/dist/components/step.css +1 -1
  133. package/dist/components/step.min.css +1 -1
  134. package/dist/components/sticky.css +1 -1
  135. package/dist/components/sticky.js +1 -1
  136. package/dist/components/sticky.min.css +1 -1
  137. package/dist/components/sticky.min.js +1 -1
  138. package/dist/components/tab.css +1 -1
  139. package/dist/components/tab.js +1 -1
  140. package/dist/components/tab.min.css +1 -1
  141. package/dist/components/tab.min.js +1 -1
  142. package/dist/components/table.css +65 -1
  143. package/dist/components/table.min.css +2 -2
  144. package/dist/components/text.css +1 -1
  145. package/dist/components/text.min.css +1 -1
  146. package/dist/components/toast.css +6 -1
  147. package/dist/components/toast.js +2 -2
  148. package/dist/components/toast.min.css +2 -2
  149. package/dist/components/toast.min.js +2 -2
  150. package/dist/components/transition.css +1 -1
  151. package/dist/components/transition.js +1 -1
  152. package/dist/components/transition.min.css +1 -1
  153. package/dist/components/transition.min.js +1 -1
  154. package/dist/components/visibility.js +1 -1
  155. package/dist/components/visibility.min.js +1 -1
  156. package/dist/semantic.css +1055 -593
  157. package/dist/semantic.js +310 -156
  158. package/dist/semantic.min.css +2 -2
  159. package/dist/semantic.min.js +2 -2
  160. package/package.json +1 -1
  161. package/src/definitions/behaviors/form.js +77 -43
  162. package/src/definitions/collections/breadcrumb.less +2 -1
  163. package/src/definitions/collections/form.less +27 -13
  164. package/src/definitions/collections/grid.less +108 -107
  165. package/src/definitions/collections/menu.less +29 -21
  166. package/src/definitions/collections/message.less +2 -1
  167. package/src/definitions/collections/table.less +68 -1
  168. package/src/definitions/elements/button.less +4 -2
  169. package/src/definitions/elements/container.less +65 -1
  170. package/src/definitions/elements/divider.less +2 -1
  171. package/src/definitions/elements/emoji.less +2 -1
  172. package/src/definitions/elements/flag.less +2 -1
  173. package/src/definitions/elements/header.less +2 -1
  174. package/src/definitions/elements/icon.less +2 -1
  175. package/src/definitions/elements/image.less +2 -1
  176. package/src/definitions/elements/input.less +4 -3
  177. package/src/definitions/elements/label.less +23 -2
  178. package/src/definitions/elements/list.less +14 -13
  179. package/src/definitions/elements/loader.less +73 -72
  180. package/src/definitions/elements/placeholder.less +2 -1
  181. package/src/definitions/elements/rail.less +2 -1
  182. package/src/definitions/elements/reveal.less +2 -1
  183. package/src/definitions/elements/segment.less +112 -14
  184. package/src/definitions/elements/step.less +2 -1
  185. package/src/definitions/elements/text.less +2 -1
  186. package/src/definitions/globals/reset.less +2 -1
  187. package/src/definitions/globals/site.less +2 -1
  188. package/src/definitions/modules/accordion.less +2 -1
  189. package/src/definitions/modules/calendar.less +3 -2
  190. package/src/definitions/modules/checkbox.less +2 -1
  191. package/src/definitions/modules/dimmer.less +4 -3
  192. package/src/definitions/modules/dropdown.js +21 -11
  193. package/src/definitions/modules/dropdown.less +55 -4
  194. package/src/definitions/modules/embed.less +2 -1
  195. package/src/definitions/modules/flyout.js +25 -19
  196. package/src/definitions/modules/flyout.less +2 -1
  197. package/src/definitions/modules/modal.js +30 -25
  198. package/src/definitions/modules/modal.less +13 -3
  199. package/src/definitions/modules/nag.less +3 -1
  200. package/src/definitions/modules/popup.js +7 -5
  201. package/src/definitions/modules/popup.less +42 -39
  202. package/src/definitions/modules/progress.less +2 -1
  203. package/src/definitions/modules/rating.less +2 -1
  204. package/src/definitions/modules/search.js +2 -1
  205. package/src/definitions/modules/search.less +20 -1
  206. package/src/definitions/modules/shape.less +2 -1
  207. package/src/definitions/modules/sidebar.less +2 -1
  208. package/src/definitions/modules/slider.js +121 -25
  209. package/src/definitions/modules/slider.less +2 -1
  210. package/src/definitions/modules/sticky.less +2 -1
  211. package/src/definitions/modules/tab.less +2 -1
  212. package/src/definitions/modules/toast.js +1 -1
  213. package/src/definitions/modules/toast.less +9 -1
  214. package/src/definitions/modules/transition.less +2 -1
  215. package/src/definitions/views/ad.less +2 -1
  216. package/src/definitions/views/card.less +2 -1
  217. package/src/definitions/views/comment.less +2 -1
  218. package/src/definitions/views/feed.less +2 -1
  219. package/src/definitions/views/item.less +2 -1
  220. package/src/definitions/views/statistic.less +2 -1
  221. package/src/overrides.less +7 -0
  222. package/src/theme.less +7 -6
  223. package/src/themes/amazon/elements/button.variables +5 -1
  224. package/src/themes/bootstrap3/elements/button.variables +5 -1
  225. package/src/themes/chubby/elements/header.variables +6 -1
  226. package/src/themes/default/collections/message.variables +3 -9
  227. package/src/themes/default/collections/table.variables +3 -0
  228. package/src/themes/default/elements/button.variables +1 -3
  229. package/src/themes/default/elements/container.variables +3 -0
  230. package/src/themes/default/elements/flag.variables +1 -1
  231. package/src/themes/default/elements/label.variables +5 -0
  232. package/src/themes/default/elements/segment.variables +8 -0
  233. package/src/themes/default/globals/site.variables +20 -1
  234. package/src/themes/default/globals/variation.variables +7 -1
  235. package/src/themes/default/modules/dropdown.variables +6 -0
  236. package/src/themes/default/modules/modal.variables +4 -0
  237. package/src/themes/default/modules/popup.variables +3 -1
  238. package/src/themes/default/modules/search.variables +3 -0
  239. package/src/themes/default/modules/toast.variables +1 -0
  240. package/src/themes/default/views/card.variables +4 -12
  241. package/src/themes/github/elements/button.variables +5 -1
  242. package/src/themes/twitter/elements/button.variables +5 -1
  243. package/tasks/admin/distributions/create.js +8 -3
  244. package/tasks/config/project/install.js +3 -0
  245. package/tasks/config/tasks.js +1 -8
  246. package/tasks/install.js +15 -5
package/dist/semantic.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * # Fomantic UI - 2.9.3-beta.2+824a375
2
+ * # Fomantic UI - 2.9.3-beta.21+491b07a
3
3
  * https://github.com/fomantic/Fomantic-UI
4
4
  * https://fomantic-ui.com/
5
5
  *
@@ -9,7 +9,7 @@
9
9
  *
10
10
  */
11
11
  /*!
12
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Site
12
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Site
13
13
  * https://github.com/fomantic/Fomantic-UI/
14
14
  *
15
15
  *
@@ -463,7 +463,7 @@
463
463
  })(jQuery, window, document);
464
464
 
465
465
  /*!
466
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Form Validation
466
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Form Validation
467
467
  * https://github.com/fomantic/Fomantic-UI/
468
468
  *
469
469
  *
@@ -486,6 +486,7 @@
486
486
  $.fn.form = function (parameters) {
487
487
  var
488
488
  $allModules = $(this),
489
+ $window = $(window),
489
490
 
490
491
  time = Date.now(),
491
492
  performance = [],
@@ -524,6 +525,8 @@
524
525
  namespace,
525
526
  moduleNamespace,
526
527
  eventNamespace,
528
+ attachEventsSelector,
529
+ attachEventsAction,
527
530
 
528
531
  submitting = false,
529
532
  dirty = false,
@@ -538,6 +541,7 @@
538
541
  initialize: function () {
539
542
  // settings grabbed at run time
540
543
  module.get.settings();
544
+ $module.addClass(className.initial);
541
545
  if (methodInvoked) {
542
546
  if (instance === undefined) {
543
547
  module.instantiate();
@@ -591,10 +595,13 @@
591
595
  module.bindEvents();
592
596
  },
593
597
 
594
- submit: function () {
598
+ submit: function (event) {
595
599
  module.verbose('Submitting form', $module);
596
600
  submitting = true;
597
601
  $module.trigger('submit');
602
+ if (event) {
603
+ event.preventDefault();
604
+ }
598
605
  },
599
606
 
600
607
  attachEvents: function (selector, action) {
@@ -606,6 +613,9 @@
606
613
  module[action]();
607
614
  event.preventDefault();
608
615
  });
616
+
617
+ attachEventsSelector = selector;
618
+ attachEventsAction = action;
609
619
  },
610
620
 
611
621
  bindEvents: function () {
@@ -617,6 +627,7 @@
617
627
  .on('click' + eventNamespace, selector.reset, module.reset)
618
628
  .on('click' + eventNamespace, selector.clear, module.clear)
619
629
  ;
630
+ $field.on('invalid' + eventNamespace, module.event.field.invalid);
620
631
  if (settings.keyboardShortcuts) {
621
632
  $module.on('keydown' + eventNamespace, selector.field, module.event.field.keydown);
622
633
  }
@@ -631,7 +642,7 @@
631
642
 
632
643
  // Dirty events
633
644
  if (settings.preventLeaving) {
634
- $(window).on('beforeunload' + eventNamespace, module.event.beforeUnload);
645
+ $window.on('beforeunload' + eventNamespace, module.event.beforeUnload);
635
646
  }
636
647
 
637
648
  $field.on('change' + eventNamespace
@@ -649,6 +660,9 @@
649
660
  $module.on('clean' + eventNamespace, function (e) {
650
661
  settings.onClean.call();
651
662
  });
663
+ if (attachEventsSelector) {
664
+ module.attachEvents(attachEventsSelector, attachEventsAction);
665
+ }
652
666
  },
653
667
 
654
668
  clear: function () {
@@ -697,6 +711,7 @@
697
711
  isCheckbox = $field.is(selector.checkbox),
698
712
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
699
713
  isCalendar = $calendar.length > 0 && module.can.useElement('calendar'),
714
+ isFile = $field.is(selector.file),
700
715
  isErrored = $fieldGroup.hasClass(className.error)
701
716
  ;
702
717
  if (defaultValue === undefined) {
@@ -717,7 +732,7 @@
717
732
  $calendar.calendar('set date', defaultValue);
718
733
  } else {
719
734
  module.verbose('Resetting field value', $field, defaultValue);
720
- $field.val(defaultValue);
735
+ $field.val(isFile ? '' : defaultValue);
721
736
  }
722
737
  });
723
738
  module.remove.states();
@@ -728,8 +743,12 @@
728
743
  var
729
744
  allValid = true
730
745
  ;
731
- $.each(validation, function (fieldName, field) {
732
- if (!module.validate.field(field, fieldName, true)) {
746
+ $field.each(function (index, el) {
747
+ var $el = $(el),
748
+ validation = module.get.validation($el) || {},
749
+ identifier = module.get.identifier(validation, $el)
750
+ ;
751
+ if (!module.validate.field(validation, identifier, true)) {
733
752
  allValid = false;
734
753
  }
735
754
  });
@@ -853,6 +872,13 @@
853
872
  $module.off(eventNamespace);
854
873
  $field.off(eventNamespace);
855
874
  $submit.off(eventNamespace);
875
+ if (settings.preventLeaving) {
876
+ $window.off(eventNamespace);
877
+ }
878
+ if (attachEventsSelector) {
879
+ $(attachEventsSelector).off(eventNamespace);
880
+ attachEventsSelector = undefined;
881
+ }
856
882
  },
857
883
 
858
884
  event: {
@@ -878,9 +904,8 @@
878
904
  if (!event.ctrlKey && key === keyCode.enter && isInput && !isInDropdown && !isCheckbox) {
879
905
  if (!keyHeldDown) {
880
906
  $field.one('keyup' + eventNamespace, module.event.field.keyup);
881
- module.submit();
907
+ module.submit(event);
882
908
  module.debug('Enter pressed on input submitting form');
883
- event.preventDefault();
884
909
  }
885
910
  keyHeldDown = true;
886
911
  }
@@ -888,15 +913,18 @@
888
913
  keyup: function () {
889
914
  keyHeldDown = false;
890
915
  },
916
+ invalid: function (event) {
917
+ event.preventDefault();
918
+ },
891
919
  blur: function (event) {
892
920
  var
893
921
  $field = $(this),
894
- $fieldGroup = $field.closest($group),
895
- validationRules = module.get.validation($field)
922
+ validationRules = module.get.validation($field) || {},
923
+ identifier = module.get.identifier(validationRules, $field)
896
924
  ;
897
- if (validationRules && (settings.on === 'blur' || ($fieldGroup.hasClass(className.error) && settings.revalidate))) {
925
+ if (settings.on === 'blur' || (!$module.hasClass(className.initial) && settings.revalidate)) {
898
926
  module.debug('Revalidating field', $field, validationRules);
899
- module.validate.field(validationRules);
927
+ module.validate.field(validationRules, identifier);
900
928
  if (!settings.inline) {
901
929
  module.validate.form(false, true);
902
930
  }
@@ -905,14 +933,14 @@
905
933
  change: function (event) {
906
934
  var
907
935
  $field = $(this),
908
- $fieldGroup = $field.closest($group),
909
- validationRules = module.get.validation($field)
936
+ validationRules = module.get.validation($field) || {},
937
+ identifier = module.get.identifier(validationRules, $field)
910
938
  ;
911
- if (validationRules && (settings.on === 'change' || ($fieldGroup.hasClass(className.error) && settings.revalidate))) {
939
+ if (settings.on === 'change' || (!$module.hasClass(className.initial) && settings.revalidate)) {
912
940
  clearTimeout(module.timer);
913
941
  module.timer = setTimeout(function () {
914
942
  module.debug('Revalidating field', $field, validationRules);
915
- module.validate.field(validationRules);
943
+ module.validate.field(validationRules, identifier);
916
944
  if (!settings.inline) {
917
945
  module.validate.form(false, true);
918
946
  }
@@ -954,18 +982,7 @@
954
982
  return rule.type;
955
983
  },
956
984
  changeEvent: function (type, $input) {
957
- if (type === 'checkbox' || type === 'radio' || type === 'hidden' || $input.is('select')) {
958
- return 'change';
959
- }
960
-
961
- return module.get.inputEvent();
962
- },
963
- inputEvent: function () {
964
- return document.createElement('input').oninput !== undefined
965
- ? 'input'
966
- : (document.createElement('input').onpropertychange !== undefined
967
- ? 'propertychange'
968
- : 'keyup');
985
+ return ['file', 'checkbox', 'radio', 'hidden'].indexOf(type) >= 0 || $input.is('select') ? 'change' : 'input';
969
986
  },
970
987
  fieldsFromShorthand: function (fields) {
971
988
  var
@@ -989,6 +1006,9 @@
989
1006
 
990
1007
  return fullFields;
991
1008
  },
1009
+ identifier: function (validation, $el) {
1010
+ return validation.identifier || $el.attr('id') || $el.attr('name') || $el.data(metadata.validate);
1011
+ },
992
1012
  prompt: function (rule, field) {
993
1013
  var
994
1014
  ruleName = module.get.ruleName(rule),
@@ -1101,7 +1121,7 @@
1101
1121
  var $field = typeof identifier === 'string'
1102
1122
  ? module.get.field(identifier)
1103
1123
  : identifier,
1104
- $label = $field.closest(selector.group).find('label').eq(0)
1124
+ $label = $field.closest(selector.group).find('label:not(:empty)').eq(0)
1105
1125
  ;
1106
1126
 
1107
1127
  return $label.length === 1
@@ -1432,7 +1452,7 @@
1432
1452
  $message.empty();
1433
1453
  },
1434
1454
  states: function () {
1435
- $module.removeClass(className.error).removeClass(className.success);
1455
+ $module.removeClass(className.error).removeClass(className.success).addClass(className.initial);
1436
1456
  if (!settings.inline) {
1437
1457
  module.remove.errors();
1438
1458
  }
@@ -1570,6 +1590,7 @@
1570
1590
  $field = module.get.field(key),
1571
1591
  $element = $field.parent(),
1572
1592
  $calendar = $field.closest(selector.uiCalendar),
1593
+ isFile = $field.is(selector.file),
1573
1594
  isMultiple = Array.isArray(value),
1574
1595
  isCheckbox = $element.is(selector.uiCheckbox) && module.can.useElement('checkbox'),
1575
1596
  isDropdown = $element.is(selector.uiDropdown) && module.can.useElement('dropdown'),
@@ -1612,7 +1633,7 @@
1612
1633
  $calendar.calendar('set date', value);
1613
1634
  } else {
1614
1635
  module.verbose('Setting field value', value, $field);
1615
- $field.val(value);
1636
+ $field.val(isFile ? '' : value);
1616
1637
  }
1617
1638
  }
1618
1639
  });
@@ -1668,7 +1689,7 @@
1668
1689
  return rule.type === 'empty';
1669
1690
  }) !== 0
1670
1691
  : false,
1671
- identifier = validation.identifier || $el.attr('id') || $el.attr('name') || $el.data(metadata.validate)
1692
+ identifier = module.get.identifier(validation, $el)
1672
1693
  ;
1673
1694
  if (isRequired && !isDisabled && !hasEmptyRule && identifier !== undefined) {
1674
1695
  if (isCheckbox) {
@@ -1700,7 +1721,7 @@
1700
1721
  if (keyHeldDown) {
1701
1722
  return false;
1702
1723
  }
1703
-
1724
+ $module.removeClass(className.initial);
1704
1725
  // reset errors
1705
1726
  formErrors = [];
1706
1727
  if (module.determine.isValid()) {
@@ -1772,13 +1793,25 @@
1772
1793
  ? module.get.field(field.depends)
1773
1794
  : false,
1774
1795
  fieldValid = true,
1775
- fieldErrors = []
1796
+ fieldErrors = [],
1797
+ isDisabled = $field.filter(':not(:disabled)').length === 0,
1798
+ validationMessage = $field[0].validationMessage,
1799
+ errorLimit
1776
1800
  ;
1777
1801
  if (!field.identifier) {
1778
1802
  module.debug('Using field name as identifier', identifier);
1779
1803
  field.identifier = identifier;
1780
1804
  }
1781
- var isDisabled = $field.filter(':not(:disabled)').length === 0;
1805
+ if (validationMessage) {
1806
+ module.debug('Field is natively invalid', identifier);
1807
+ fieldErrors.push(validationMessage);
1808
+ fieldValid = false;
1809
+ if (showErrors) {
1810
+ $field.closest($group).addClass(className.error);
1811
+ }
1812
+ } else if (showErrors) {
1813
+ $field.closest($group).removeClass(className.error);
1814
+ }
1782
1815
  if (isDisabled) {
1783
1816
  module.debug('Field is disabled. Skipping', identifier);
1784
1817
  } else if (field.optional && module.is.blank($field)) {
@@ -1786,11 +1819,9 @@
1786
1819
  } else if (field.depends && module.is.empty($dependsField)) {
1787
1820
  module.debug('Field depends on another value that is not present or empty. Skipping', $dependsField);
1788
1821
  } else if (field.rules !== undefined) {
1789
- if (showErrors) {
1790
- $field.closest($group).removeClass(className.error);
1791
- }
1822
+ errorLimit = field.errorLimit || settings.errorLimit;
1792
1823
  $.each(field.rules, function (index, rule) {
1793
- if (module.has.field(identifier)) {
1824
+ if (module.has.field(identifier) && (!errorLimit || fieldErrors.length < errorLimit)) {
1794
1825
  var invalidFields = module.validate.rule(field, rule, true) || [];
1795
1826
  if (invalidFields.length > 0) {
1796
1827
  module.debug('Field is invalid', identifier, rule.type);
@@ -1805,7 +1836,7 @@
1805
1836
  }
1806
1837
  if (fieldValid) {
1807
1838
  if (showErrors) {
1808
- module.remove.prompt(identifier, fieldErrors);
1839
+ module.remove.prompt(identifier);
1809
1840
  settings.onValid.call($field);
1810
1841
  }
1811
1842
  } else {
@@ -2042,6 +2073,7 @@
2042
2073
  preventLeaving: false,
2043
2074
  errorFocus: true,
2044
2075
  dateHandling: 'date', // 'date', 'input', 'formatter'
2076
+ errorLimit: 0,
2045
2077
 
2046
2078
  onValid: function () {},
2047
2079
  onInvalid: function () {},
@@ -2095,8 +2127,8 @@
2095
2127
  isExactly: '{name} must be exactly "{ruleValue}"',
2096
2128
  not: '{name} cannot be set to "{ruleValue}"',
2097
2129
  notExactly: '{name} cannot be set to exactly "{ruleValue}"',
2098
- contain: '{name} must contain "{ruleValue}"',
2099
- containExactly: '{name} must contain exactly "{ruleValue}"',
2130
+ contains: '{name} must contain "{ruleValue}"',
2131
+ containsExactly: '{name} must contain exactly "{ruleValue}"',
2100
2132
  doesntContain: '{name} cannot contain "{ruleValue}"',
2101
2133
  doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"',
2102
2134
  minLength: '{name} must be at least {ruleValue} characters',
@@ -2115,9 +2147,10 @@
2115
2147
  selector: {
2116
2148
  checkbox: 'input[type="checkbox"], input[type="radio"]',
2117
2149
  clear: '.clear',
2118
- field: 'input:not(.search):not([type="file"]):not([type="reset"]):not([type="button"]):not([type="submit"]), textarea, select',
2150
+ field: 'input:not(.search):not([type="reset"]):not([type="button"]):not([type="submit"]), textarea, select',
2151
+ file: 'input[type="file"]',
2119
2152
  group: '.field',
2120
- input: 'input:not([type="file"])',
2153
+ input: 'input',
2121
2154
  message: '.error.message',
2122
2155
  prompt: '.prompt.label',
2123
2156
  radio: 'input[type="radio"]',
@@ -2129,6 +2162,7 @@
2129
2162
  },
2130
2163
 
2131
2164
  className: {
2165
+ initial: 'initial',
2132
2166
  error: 'error',
2133
2167
  label: 'ui basic red pointing prompt label',
2134
2168
  pressed: 'down',
@@ -2569,7 +2603,7 @@
2569
2603
  })(jQuery, window, document);
2570
2604
 
2571
2605
  /*!
2572
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Accordion
2606
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Accordion
2573
2607
  * https://github.com/fomantic/Fomantic-UI/
2574
2608
  *
2575
2609
  *
@@ -3163,7 +3197,7 @@
3163
3197
  })(jQuery, window, document);
3164
3198
 
3165
3199
  /*!
3166
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Calendar
3200
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Calendar
3167
3201
  * https://github.com/fomantic/Fomantic-UI/
3168
3202
  *
3169
3203
  *
@@ -5174,7 +5208,7 @@
5174
5208
  })(jQuery, window, document);
5175
5209
 
5176
5210
  /*!
5177
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Checkbox
5211
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Checkbox
5178
5212
  * https://github.com/fomantic/Fomantic-UI/
5179
5213
  *
5180
5214
  *
@@ -6055,7 +6089,7 @@
6055
6089
  })(jQuery, window, document);
6056
6090
 
6057
6091
  /*!
6058
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Dimmer
6092
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Dimmer
6059
6093
  * https://github.com/fomantic/Fomantic-UI/
6060
6094
  *
6061
6095
  *
@@ -6786,7 +6820,7 @@
6786
6820
  })(jQuery, window, document);
6787
6821
 
6788
6822
  /*!
6789
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Dropdown
6823
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Dropdown
6790
6824
  * https://github.com/fomantic/Fomantic-UI/
6791
6825
  *
6792
6826
  *
@@ -6889,7 +6923,8 @@
6889
6923
  selectObserver,
6890
6924
  menuObserver,
6891
6925
  classObserver,
6892
- module
6926
+ module,
6927
+ tempDisableApiCache = false
6893
6928
  ;
6894
6929
 
6895
6930
  module = {
@@ -7656,11 +7691,12 @@
7656
7691
  if (!$module.api('get request')) {
7657
7692
  module.setup.api();
7658
7693
  }
7659
- apiSettings = $.extend(true, {}, apiSettings, settings.apiSettings, apiCallbacks);
7694
+ apiSettings = $.extend(true, {}, apiSettings, settings.apiSettings, apiCallbacks, tempDisableApiCache ? { cache: false } : {});
7660
7695
  $module
7661
7696
  .api('setting', apiSettings)
7662
7697
  .api('query')
7663
7698
  ;
7699
+ tempDisableApiCache = false;
7664
7700
  },
7665
7701
 
7666
7702
  filterItems: function (query) {
@@ -8192,11 +8228,13 @@
8192
8228
  if (settings.allowAdditions) {
8193
8229
  module.remove.userAddition();
8194
8230
  }
8195
- module.remove.filteredItem();
8231
+ if (!settings.keepSearchTerm) {
8232
+ module.remove.filteredItem();
8233
+ module.remove.searchTerm();
8234
+ }
8196
8235
  if (!module.is.visible() && $target.length > 0) {
8197
8236
  module.show();
8198
8237
  }
8199
- module.remove.searchTerm();
8200
8238
  if (!module.is.focusedOnSearch() && skipRefocus !== true) {
8201
8239
  module.focusSearch(true);
8202
8240
  }
@@ -8382,7 +8420,9 @@
8382
8420
  module.verbose('Selecting item from keyboard shortcut', $selectedItem);
8383
8421
  module.event.item.click.call($selectedItem, event);
8384
8422
  if (module.is.searchSelection()) {
8385
- module.remove.searchTerm();
8423
+ if (!settings.keepSearchTerm) {
8424
+ module.remove.searchTerm();
8425
+ }
8386
8426
  if (module.is.multiple()) {
8387
8427
  $search.trigger('focus');
8388
8428
  }
@@ -8599,7 +8639,7 @@
8599
8639
  ? value
8600
8640
  : text;
8601
8641
  if (module.can.activate($(element))) {
8602
- module.set.selected(value, $(element));
8642
+ module.set.selected(value, $(element), false, settings.keepSearchTerm);
8603
8643
  if (!module.is.multiple() && !(!settings.collapseOnActionable && $(element).hasClass(className.actionable))) {
8604
8644
  module.hideAndClear();
8605
8645
  }
@@ -9186,6 +9226,11 @@
9186
9226
  module.set.value('', null, null, preventChangeTrigger);
9187
9227
  },
9188
9228
 
9229
+ clearCache: function () {
9230
+ module.debug('Clearing API cache once');
9231
+ tempDisableApiCache = true;
9232
+ },
9233
+
9189
9234
  scrollPage: function (direction, $selectedItem) {
9190
9235
  var
9191
9236
  $currentItem = $selectedItem || module.get.selectedItem(),
@@ -9244,7 +9289,7 @@
9244
9289
  valueIsSet = searchValue !== ''
9245
9290
  ;
9246
9291
  if (isMultiple && hasSearchValue) {
9247
- module.verbose('Adjusting input width', searchWidth, settings.glyphWidth);
9292
+ module.verbose('Adjusting input width', searchWidth);
9248
9293
  $search.css('width', searchWidth + 'px');
9249
9294
  }
9250
9295
  if (hasSearchValue || (isSearchMultiple && valueIsSet)) {
@@ -9543,7 +9588,7 @@
9543
9588
  return false;
9544
9589
  }
9545
9590
  module.debug('Setting selected menu item to', $selectedItem);
9546
- if (module.is.multiple()) {
9591
+ if (module.is.multiple() && !keepSearchTerm) {
9547
9592
  module.remove.searchWidth();
9548
9593
  }
9549
9594
  if (module.is.single()) {
@@ -10236,7 +10281,7 @@
10236
10281
  return settings.apiSettings && module.can.useAPI();
10237
10282
  },
10238
10283
  noApiCache: function () {
10239
- return settings.apiSettings && !settings.apiSettings.cache;
10284
+ return tempDisableApiCache || (settings.apiSettings && !settings.apiSettings.cache);
10240
10285
  },
10241
10286
  single: function () {
10242
10287
  return !module.is.multiple();
@@ -10786,6 +10831,7 @@
10786
10831
  forceSelection: false, // force a choice on blur with search selection
10787
10832
 
10788
10833
  allowAdditions: false, // whether multiple select should allow user added values
10834
+ keepSearchTerm: false, // whether the search value should be kept and menu stays filtered on item selection
10789
10835
  ignoreCase: false, // whether to consider case sensitivity when creating labels
10790
10836
  ignoreSearchCase: true, // whether to consider case sensitivity when filtering items
10791
10837
  hideAdditions: true, // whether or not to hide special message prompting a user they can enter a value
@@ -10805,8 +10851,6 @@
10805
10851
  duration: 200, // duration of transition
10806
10852
  displayType: false, // displayType of transition
10807
10853
 
10808
- glyphWidth: 1.037, // widest glyph width in em (W is 1.037 em) used to calculate multiselect input width
10809
-
10810
10854
  headerDivider: true, // whether option headers should have an additional divider line underneath when converted from <select> <optgroup>
10811
10855
 
10812
10856
  collapseOnActionable: true, // whether the dropdown should collapse upon selection of an actionable item
@@ -11129,7 +11173,7 @@
11129
11173
  })(jQuery, window, document);
11130
11174
 
11131
11175
  /*!
11132
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Embed
11176
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Embed
11133
11177
  * https://github.com/fomantic/Fomantic-UI/
11134
11178
  *
11135
11179
  *
@@ -11808,7 +11852,7 @@
11808
11852
  })(jQuery, window, document);
11809
11853
 
11810
11854
  /*!
11811
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Flyout
11855
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Flyout
11812
11856
  * https://github.com/fomantic/Fomantic-UI/
11813
11857
  *
11814
11858
  *
@@ -11895,6 +11939,7 @@
11895
11939
  initialBodyMargin = '',
11896
11940
  tempBodyMargin = '',
11897
11941
  hadScrollbar = false,
11942
+ windowRefocused = false,
11898
11943
 
11899
11944
  elementNamespace,
11900
11945
  id,
@@ -12073,9 +12118,13 @@
12073
12118
  module.setup.heights();
12074
12119
  },
12075
12120
  focus: function () {
12076
- if (module.is.visible() && settings.autofocus && settings.dimPage) {
12121
+ windowRefocused = true;
12122
+ },
12123
+ click: function (event) {
12124
+ if (windowRefocused && document.activeElement !== event.target && module.is.visible() && settings.autofocus && settings.dimPage && $(document.activeElement).closest(selector.flyout).length === 0) {
12077
12125
  requestAnimationFrame(module.set.autofocus);
12078
12126
  }
12127
+ windowRefocused = false;
12079
12128
  },
12080
12129
  clickaway: function (event) {
12081
12130
  if (settings.closable) {
@@ -12182,6 +12231,9 @@
12182
12231
  $window
12183
12232
  .on('focus' + elementNamespace, module.event.focus)
12184
12233
  ;
12234
+ $context
12235
+ .on('click' + elementNamespace, module.event.click)
12236
+ ;
12185
12237
  },
12186
12238
  clickaway: function () {
12187
12239
  module.verbose('Adding clickaway events to context', $context);
@@ -12311,11 +12363,12 @@
12311
12363
 
12312
12364
  return nodes;
12313
12365
  },
12314
- shouldRefreshInputs = false
12366
+ shouldRefreshInputs = false,
12367
+ ignoreAutofocus = true
12315
12368
  ;
12316
12369
  mutations.every(function (mutation) {
12317
12370
  if (mutation.type === 'attributes') {
12318
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
12371
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
12319
12372
  shouldRefreshInputs = true;
12320
12373
  }
12321
12374
  } else {
@@ -12325,6 +12378,9 @@
12325
12378
  $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
12326
12379
  if ($addedInputs.length > 0 || $removedInputs.length > 0) {
12327
12380
  shouldRefreshInputs = true;
12381
+ if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
12382
+ ignoreAutofocus = false;
12383
+ }
12328
12384
  }
12329
12385
  }
12330
12386
 
@@ -12332,7 +12388,7 @@
12332
12388
  });
12333
12389
 
12334
12390
  if (shouldRefreshInputs) {
12335
- module.refreshInputs();
12391
+ module.refreshInputs(ignoreAutofocus);
12336
12392
  }
12337
12393
  });
12338
12394
  observer.observe(element, {
@@ -12357,7 +12413,7 @@
12357
12413
  $flyouts = $context.children(selector.flyout);
12358
12414
  },
12359
12415
 
12360
- refreshInputs: function () {
12416
+ refreshInputs: function (ignoreAutofocus) {
12361
12417
  if ($inputs) {
12362
12418
  $inputs
12363
12419
  .off('keydown' + elementNamespace)
@@ -12369,8 +12425,8 @@
12369
12425
  $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
12370
12426
  return $(this).closest('.disabled').length === 0;
12371
12427
  });
12372
- if ($inputs.length === 0) {
12373
- $inputs = $module;
12428
+ if ($inputs.filter(':input').length === 0) {
12429
+ $inputs = $module.add($inputs);
12374
12430
  $module.attr('tabindex', -1);
12375
12431
  } else {
12376
12432
  $module.removeAttr('tabindex');
@@ -12381,7 +12437,7 @@
12381
12437
  $inputs.last()
12382
12438
  .on('keydown' + elementNamespace, module.event.inputKeyDown.last)
12383
12439
  ;
12384
- if (settings.autofocus && $inputs.filter(':focus').length === 0) {
12440
+ if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
12385
12441
  module.set.autofocus();
12386
12442
  }
12387
12443
  },
@@ -12659,20 +12715,14 @@
12659
12715
  var
12660
12716
  $autofocus = $inputs.filter('[autofocus]'),
12661
12717
  $rawInputs = $inputs.filter(':input'),
12662
- $input = $autofocus.length > 0
12663
- ? $autofocus.first()
12718
+ $input = ($autofocus.length > 0
12719
+ ? $autofocus
12664
12720
  : ($rawInputs.length > 0
12665
12721
  ? $rawInputs
12666
- : $inputs.filter(':not(i.close)')
12667
- ).first()
12722
+ : $module)
12723
+ ).first()
12668
12724
  ;
12669
- // check if only the close icon is remaining
12670
- if ($input.length === 0 && $inputs.length > 0) {
12671
- $input = $inputs.first();
12672
- }
12673
- if ($input.length > 0) {
12674
- $input.trigger('focus');
12675
- }
12725
+ $input.trigger('focus');
12676
12726
  },
12677
12727
  dimmerStyles: function () {
12678
12728
  if (settings.blurring) {
@@ -13383,7 +13433,7 @@
13383
13433
  })(jQuery, window, document);
13384
13434
 
13385
13435
  /*!
13386
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Modal
13436
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Modal
13387
13437
  * https://github.com/fomantic/Fomantic-UI/
13388
13438
  *
13389
13439
  *
@@ -13472,6 +13522,7 @@
13472
13522
  tempBodyMargin = '',
13473
13523
  keepScrollingClass = false,
13474
13524
  hadScrollbar = false,
13525
+ windowRefocused = false,
13475
13526
 
13476
13527
  elementEventNamespace,
13477
13528
  id,
@@ -13635,6 +13686,7 @@
13635
13686
  .off(eventNamespace)
13636
13687
  ;
13637
13688
  $window.off(elementEventNamespace);
13689
+ $context.off(elementEventNamespace);
13638
13690
  $dimmer.off(elementEventNamespace);
13639
13691
  $closeIcon.off(elementEventNamespace);
13640
13692
  if ($inputs) {
@@ -13656,11 +13708,12 @@
13656
13708
  return nodes;
13657
13709
  },
13658
13710
  shouldRefresh = false,
13659
- shouldRefreshInputs = false
13711
+ shouldRefreshInputs = false,
13712
+ ignoreAutofocus = true
13660
13713
  ;
13661
13714
  mutations.every(function (mutation) {
13662
13715
  if (mutation.type === 'attributes') {
13663
- if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').length > 0)) {
13716
+ if (observeAttributes && (mutation.attributeName === 'disabled' || $(mutation.target).find(':input').addBack(':input').filter(':visible').length > 0)) {
13664
13717
  shouldRefreshInputs = true;
13665
13718
  }
13666
13719
  } else {
@@ -13671,6 +13724,9 @@
13671
13724
  $removedInputs = $(collectNodes(mutation.removedNodes)).filter('a[href], [tabindex], :input');
13672
13725
  if ($addedInputs.length > 0 || $removedInputs.length > 0) {
13673
13726
  shouldRefreshInputs = true;
13727
+ if ($addedInputs.filter(':input').length > 0 || $removedInputs.filter(':input').length > 0) {
13728
+ ignoreAutofocus = false;
13729
+ }
13674
13730
  }
13675
13731
  }
13676
13732
 
@@ -13682,7 +13738,7 @@
13682
13738
  module.refresh();
13683
13739
  }
13684
13740
  if (shouldRefreshInputs) {
13685
- module.refreshInputs();
13741
+ module.refreshInputs(ignoreAutofocus);
13686
13742
  }
13687
13743
  });
13688
13744
  observer.observe(element, {
@@ -13710,7 +13766,7 @@
13710
13766
  $allModals = $otherModals.add($module);
13711
13767
  },
13712
13768
 
13713
- refreshInputs: function () {
13769
+ refreshInputs: function (ignoreAutofocus) {
13714
13770
  if ($inputs) {
13715
13771
  $inputs
13716
13772
  .off('keydown' + elementEventNamespace)
@@ -13719,8 +13775,8 @@
13719
13775
  $inputs = $module.find('a[href], [tabindex], :input:enabled').filter(':visible').filter(function () {
13720
13776
  return $(this).closest('.disabled').length === 0;
13721
13777
  });
13722
- if ($inputs.length === 0) {
13723
- $inputs = $module;
13778
+ if ($inputs.filter(':input').length === 0) {
13779
+ $inputs = $module.add($inputs);
13724
13780
  $module.attr('tabindex', -1);
13725
13781
  } else {
13726
13782
  $module.removeAttr('tabindex');
@@ -13731,7 +13787,7 @@
13731
13787
  $inputs.last()
13732
13788
  .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
13733
13789
  ;
13734
- if (settings.autofocus && $inputs.filter(':focus').length === 0) {
13790
+ if (!ignoreAutofocus && settings.autofocus && $inputs.filter(':focus').length === 0) {
13735
13791
  module.set.autofocus();
13736
13792
  }
13737
13793
  },
@@ -13769,6 +13825,9 @@
13769
13825
  .on('resize' + elementEventNamespace, module.event.resize)
13770
13826
  .on('focus' + elementEventNamespace, module.event.focus)
13771
13827
  ;
13828
+ $context
13829
+ .on('click' + elementEventNamespace, module.event.click)
13830
+ ;
13772
13831
  },
13773
13832
  scrollLock: function () {
13774
13833
  // touch events default to passive, due to changes in chrome to optimize mobile perf
@@ -13926,9 +13985,13 @@
13926
13985
  }
13927
13986
  },
13928
13987
  focus: function () {
13929
- if ($dimmable.dimmer('is active') && module.is.active() && settings.autofocus) {
13988
+ windowRefocused = true;
13989
+ },
13990
+ click: function (event) {
13991
+ if (windowRefocused && document.activeElement !== event.target && $dimmable.dimmer('is active') && module.is.active() && settings.autofocus && $(document.activeElement).closest(selector.modal).length === 0) {
13930
13992
  requestAnimationFrame(module.set.autofocus);
13931
13993
  }
13994
+ windowRefocused = false;
13932
13995
  },
13933
13996
  },
13934
13997
 
@@ -13993,7 +14056,7 @@
13993
14056
  ignoreRepeatedEvents = false;
13994
14057
  if (settings.allowMultiple) {
13995
14058
  if (module.others.active()) {
13996
- $otherModals.filter('.' + className.active).find(selector.dimmer).addClass('active');
14059
+ $otherModals.filter('.' + className.active).find(selector.dimmer).removeClass('out').addClass('transition fade in active');
13997
14060
  }
13998
14061
 
13999
14062
  if (settings.detachable) {
@@ -14065,6 +14128,8 @@
14065
14128
  onStart: function () {
14066
14129
  if (!module.others.active() && !module.others.animating() && !keepDimmed) {
14067
14130
  module.hideDimmer();
14131
+ } else if (settings.allowMultiple) {
14132
+ (hideOthersToo ? $allModals : $previousModal).find(selector.dimmer).removeClass('in').addClass('out');
14068
14133
  }
14069
14134
  if (settings.keyboardShortcuts && !module.others.active()) {
14070
14135
  module.remove.keyboardShortcuts();
@@ -14077,11 +14142,7 @@
14077
14142
  $previousModal.addClass(className.front);
14078
14143
  $module.removeClass(className.front);
14079
14144
 
14080
- if (hideOthersToo) {
14081
- $allModals.find(selector.dimmer).removeClass('active');
14082
- } else {
14083
- $previousModal.find(selector.dimmer).removeClass('active');
14084
- }
14145
+ (hideOthersToo ? $allModals : $previousModal).find(selector.dimmer).removeClass('active');
14085
14146
  }
14086
14147
  if (isFunction(settings.onHidden)) {
14087
14148
  settings.onHidden.call(element);
@@ -14438,20 +14499,14 @@
14438
14499
  var
14439
14500
  $autofocus = $inputs.filter('[autofocus]'),
14440
14501
  $rawInputs = $inputs.filter(':input'),
14441
- $input = $autofocus.length > 0
14442
- ? $autofocus.first()
14502
+ $input = ($autofocus.length > 0
14503
+ ? $autofocus
14443
14504
  : ($rawInputs.length > 0
14444
14505
  ? $rawInputs
14445
- : $inputs.filter(':not(i.close)')
14446
- ).first()
14506
+ : $module)
14507
+ ).first()
14447
14508
  ;
14448
- // check if only the close icon is remaining
14449
- if ($input.length === 0 && $inputs.length > 0) {
14450
- $input = $inputs.first();
14451
- }
14452
- if ($input.length > 0) {
14453
- $input.trigger('focus');
14454
- }
14509
+ $input.trigger('focus');
14455
14510
  },
14456
14511
  bodyMargin: function () {
14457
14512
  var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
@@ -15012,7 +15067,7 @@
15012
15067
  })(jQuery, window, document);
15013
15068
 
15014
15069
  /*!
15015
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Nag
15070
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Nag
15016
15071
  * https://github.com/fomantic/Fomantic-UI/
15017
15072
  *
15018
15073
  *
@@ -15573,7 +15628,7 @@
15573
15628
  })(jQuery, window, document);
15574
15629
 
15575
15630
  /*!
15576
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Popup
15631
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Popup
15577
15632
  * https://github.com/fomantic/Fomantic-UI/
15578
15633
  *
15579
15634
  *
@@ -15822,9 +15877,11 @@
15822
15877
  // generates popup html from metadata
15823
15878
  create: function () {
15824
15879
  var
15880
+ targetSibling = $target.next(selector.popup),
15881
+ contentFallback = !settings.popup && targetSibling.length === 0 ? $module.attr('title') : false,
15825
15882
  html = module.get.html(),
15826
15883
  title = module.get.title(),
15827
- content = module.get.content()
15884
+ content = module.get.content(contentFallback)
15828
15885
  ;
15829
15886
 
15830
15887
  if (html || content || title) {
@@ -15865,10 +15922,10 @@
15865
15922
  if (settings.hoverable) {
15866
15923
  module.bind.popup();
15867
15924
  }
15868
- } else if ($target.next(selector.popup).length > 0) {
15925
+ } else if (targetSibling.length > 0) {
15869
15926
  module.verbose('Pre-existing popup found');
15870
15927
  settings.inline = true;
15871
- settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
15928
+ settings.popup = targetSibling.data(metadata.activator, $module);
15872
15929
  module.refresh();
15873
15930
  if (settings.hoverable) {
15874
15931
  module.bind.popup();
@@ -16058,10 +16115,10 @@
16058
16115
 
16059
16116
  return $module.data(metadata.title) || settings.title;
16060
16117
  },
16061
- content: function () {
16118
+ content: function (fallback) {
16062
16119
  $module.removeData(metadata.content);
16063
16120
 
16064
- return $module.data(metadata.content) || settings.content || $module.attr('title');
16121
+ return $module.data(metadata.content) || settings.content || fallback;
16065
16122
  },
16066
16123
  variation: function () {
16067
16124
  $module.removeData(metadata.variation);
@@ -17127,7 +17184,7 @@
17127
17184
  })(jQuery, window, document);
17128
17185
 
17129
17186
  /*!
17130
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Progress
17187
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Progress
17131
17188
  * https://github.com/fomantic/Fomantic-UI/
17132
17189
  *
17133
17190
  *
@@ -18105,7 +18162,7 @@
18105
18162
  })(jQuery, window, document);
18106
18163
 
18107
18164
  /*!
18108
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Slider
18165
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Slider
18109
18166
  * https://github.com/fomantic/Fomantic-UI/
18110
18167
  *
18111
18168
  *
@@ -18209,9 +18266,7 @@
18209
18266
  module.setup.layout();
18210
18267
  module.setup.labels();
18211
18268
 
18212
- if (!module.is.disabled()) {
18213
- module.bind.events();
18214
- }
18269
+ module.bind.events();
18215
18270
 
18216
18271
  module.read.metadata();
18217
18272
  module.read.settings();
@@ -18243,20 +18298,32 @@
18243
18298
  $module.attr('tabindex', 0);
18244
18299
  }
18245
18300
  if ($module.find('.inner').length === 0) {
18246
- $module.append("<div class='inner'>"
18247
- + "<div class='track'></div>"
18248
- + "<div class='track-fill'></div>"
18249
- + "<div class='thumb'></div>"
18301
+ $module.append('<div class="inner">'
18302
+ + '<div class="track"></div>'
18303
+ + '<div class="track-fill"></div>'
18304
+ + '<div class="thumb"></div>'
18250
18305
  + '</div>');
18251
18306
  }
18252
18307
  precision = module.get.precision();
18253
18308
  $thumb = $module.find('.thumb:not(.second)');
18309
+ if (settings.showThumbTooltip) {
18310
+ $thumb
18311
+ .attr('data-position', settings.tooltipConfig.position)
18312
+ .attr('data-variation', settings.tooltipConfig.variation)
18313
+ ;
18314
+ }
18254
18315
  $currThumb = $thumb;
18255
18316
  if (module.is.range()) {
18256
18317
  if ($module.find('.thumb.second').length === 0) {
18257
- $module.find('.inner').append("<div class='thumb second'></div>");
18318
+ $module.find('.inner').append('<div class="thumb second"></div>');
18258
18319
  }
18259
18320
  $secondThumb = $module.find('.thumb.second');
18321
+ if (settings.showThumbTooltip) {
18322
+ $secondThumb
18323
+ .attr('data-position', settings.tooltipConfig.position)
18324
+ .attr('data-variation', settings.tooltipConfig.variation)
18325
+ ;
18326
+ }
18260
18327
  }
18261
18328
  $track = $module.find('.track');
18262
18329
  $trackFill = $module.find('.track-fill');
@@ -18310,9 +18377,10 @@
18310
18377
  for (var i = 0, len = module.get.numLabels(); i <= len; i++) {
18311
18378
  var
18312
18379
  labelText = module.get.label(i),
18313
- $label = labelText !== ''
18380
+ showLabel = settings.restrictedLabels.length === 0 || settings.restrictedLabels.indexOf(labelText) >= 0,
18381
+ $label = labelText !== '' && (showLabel || settings.showLabelTicks === 'always')
18314
18382
  ? (!(i % module.get.gapRatio())
18315
- ? $('<li class="label">' + labelText + '</li>')
18383
+ ? $('<li class="label">' + (showLabel ? labelText : '') + '</li>')
18316
18384
  : $('<li class="halftick label"></li>'))
18317
18385
  : null,
18318
18386
  ratio = i / len
@@ -18456,6 +18524,18 @@
18456
18524
  ;
18457
18525
  $currThumb = initialPosition > newPos ? $thumb : $secondThumb;
18458
18526
  }
18527
+ if (module.is.range() && (settings.minRange || settings.maxRange)) {
18528
+ var currentRangeDiff = module.get.currentRangeDiff(value),
18529
+ isSecondThumb = $currThumb.hasClass('second')
18530
+ ;
18531
+ if ((settings.minRange && currentRangeDiff < settings.minRange)
18532
+ || (settings.maxRange && currentRangeDiff > settings.maxRange)
18533
+ || (settings.preventCrossover && !isSecondThumb && value > module.secondThumbVal)
18534
+ || (settings.preventCrossover && isSecondThumb && value < module.thumbVal)
18535
+ ) {
18536
+ return;
18537
+ }
18538
+ }
18459
18539
  if (module.get.step() === 0 || module.is.smooth()) {
18460
18540
  var
18461
18541
  thumbVal = module.thumbVal,
@@ -18491,6 +18571,17 @@
18491
18571
  return;
18492
18572
  }
18493
18573
  var value = module.determine.valueFromEvent(event);
18574
+ if (module.is.range() && (settings.minRange || settings.maxRange)) {
18575
+ if ($currThumb === undefined) {
18576
+ $currThumb = value <= module.get.currentThumbValue() ? $thumb : $secondThumb;
18577
+ }
18578
+ var currentRangeDiff = module.get.currentRangeDiff(value);
18579
+ if (settings.minRange && currentRangeDiff < settings.minRange) {
18580
+ value = module.get.edgeValue(value, settings.minRange);
18581
+ } else if (settings.maxRange && currentRangeDiff > settings.maxRange) {
18582
+ value = module.get.edgeValue(value, settings.maxRange);
18583
+ }
18584
+ }
18494
18585
  module.set.value(value);
18495
18586
  module.unbind.slidingEvents();
18496
18587
  touchIdentifier = undefined;
@@ -18507,6 +18598,9 @@
18507
18598
  }
18508
18599
  },
18509
18600
  keydown: function (event, first) {
18601
+ if (module.is.disabled()) {
18602
+ return;
18603
+ }
18510
18604
  if (settings.preventCrossover && module.is.range() && module.thumbVal === module.secondThumbVal) {
18511
18605
  $currThumb = undefined;
18512
18606
  }
@@ -18543,7 +18637,7 @@
18543
18637
  }
18544
18638
  },
18545
18639
  activateFocus: function (event) {
18546
- if (!module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
18640
+ if (!module.is.disabled() && !module.is.focused() && module.is.hover() && module.determine.keyMovement(event) !== NO_STEP) {
18547
18641
  event.preventDefault();
18548
18642
  module.event.keydown(event, true);
18549
18643
  $module.trigger('focus');
@@ -18608,7 +18702,13 @@
18608
18702
 
18609
18703
  is: {
18610
18704
  range: function () {
18611
- return $module.hasClass(settings.className.range);
18705
+ var isRange = $module.hasClass(className.range);
18706
+ if (!isRange && (settings.minRange || settings.maxRange)) {
18707
+ $module.addClass(className.range);
18708
+ isRange = true;
18709
+ }
18710
+
18711
+ return isRange;
18612
18712
  },
18613
18713
  hover: function () {
18614
18714
  return isHover;
@@ -18617,23 +18717,56 @@
18617
18717
  return $module.is(':focus');
18618
18718
  },
18619
18719
  disabled: function () {
18620
- return $module.hasClass(settings.className.disabled);
18720
+ return $module.hasClass(className.disabled);
18621
18721
  },
18622
18722
  labeled: function () {
18623
- return $module.hasClass(settings.className.labeled);
18723
+ var isLabeled = $module.hasClass(className.labeled);
18724
+ if (!isLabeled && (settings.restrictedLabels.length > 0 || settings.showLabelTicks !== false)) {
18725
+ $module.addClass(className.labeled);
18726
+ isLabeled = true;
18727
+ }
18728
+
18729
+ return isLabeled;
18624
18730
  },
18625
18731
  reversed: function () {
18626
- return $module.hasClass(settings.className.reversed);
18732
+ return $module.hasClass(className.reversed);
18627
18733
  },
18628
18734
  vertical: function () {
18629
- return $module.hasClass(settings.className.vertical);
18735
+ return $module.hasClass(className.vertical);
18630
18736
  },
18631
18737
  smooth: function () {
18632
- return settings.smooth || $module.hasClass(settings.className.smooth);
18738
+ return settings.smooth || $module.hasClass(className.smooth);
18633
18739
  },
18634
18740
  },
18635
18741
 
18636
18742
  get: {
18743
+ currentRangeDiff: function (value) {
18744
+ var currentRangeDiff;
18745
+ if ($currThumb.hasClass('second')) {
18746
+ currentRangeDiff = module.thumbVal < value
18747
+ ? value - module.thumbVal
18748
+ : module.thumbVal - value;
18749
+ } else {
18750
+ currentRangeDiff = module.secondThumbVal > value
18751
+ ? module.secondThumbVal - value
18752
+ : value - module.secondThumbVal;
18753
+ }
18754
+
18755
+ return currentRangeDiff;
18756
+ },
18757
+ edgeValue: function (value, edgeValue) {
18758
+ if ($currThumb.hasClass('second')) {
18759
+ value = module.thumbVal < value
18760
+ ? module.thumbVal + edgeValue
18761
+ : module.thumbVal - edgeValue;
18762
+ } else {
18763
+ value = module.secondThumbVal < value
18764
+ ? module.secondThumbVal + edgeValue
18765
+ : module.secondThumbVal - edgeValue;
18766
+ }
18767
+
18768
+ return value;
18769
+ },
18637
18770
  trackOffset: function () {
18638
18771
  if (module.is.vertical()) {
18639
18772
  return $track.offset().top;
@@ -18837,13 +18970,10 @@
18837
18970
  return thumbDelta <= secondThumbDelta ? thumbPos : secondThumbPos;
18838
18971
  },
18839
18972
  thumbPos: function ($element) {
18840
- var
18841
- pos = module.is.vertical()
18842
- ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
18843
- : (module.is.reversed() ? $element.css('right') : $element.css('left'))
18973
+ return module.is.vertical()
18974
+ ? (module.is.reversed() ? $element.css('bottom') : $element.css('top'))
18975
+ : (module.is.reversed() ? $element.css('right') : $element.css('left'))
18844
18976
  ;
18845
-
18846
- return pos;
18847
18977
  },
18848
18978
  positionFromValue: function (val) {
18849
18979
  var
@@ -18867,6 +18997,7 @@
18867
18997
  position = Math.round(ratio * trackLength),
18868
18998
  adjustedPos = step === 0 ? position : Math.round(position / step) * step
18869
18999
  ;
19000
+ module.verbose('Determined position: ' + position + ' from ratio: ' + ratio);
18870
19001
 
18871
19002
  return adjustedPos;
18872
19003
  },
@@ -19090,12 +19221,12 @@
19090
19221
  }
19091
19222
  if (!$currThumb.hasClass('second')) {
19092
19223
  if (settings.preventCrossover && module.is.range()) {
19093
- newValue = Math.min(module.secondThumbVal, newValue);
19224
+ newValue = Math.min(module.secondThumbVal - (settings.minRange || 0), newValue);
19094
19225
  }
19095
19226
  module.thumbVal = newValue;
19096
19227
  } else {
19097
19228
  if (settings.preventCrossover && module.is.range()) {
19098
- newValue = Math.max(module.thumbVal, newValue);
19229
+ newValue = Math.max(module.thumbVal + (settings.minRange || 0), newValue);
19099
19230
  }
19100
19231
  module.secondThumbVal = newValue;
19101
19232
  }
@@ -19114,6 +19245,10 @@
19114
19245
  thumbVal = module.thumbVal || module.get.min(),
19115
19246
  secondThumbVal = module.secondThumbVal || module.get.min()
19116
19247
  ;
19248
+ if (settings.showThumbTooltip) {
19249
+ var precision = module.get.precision();
19250
+ $targetThumb.attr('data-tooltip', Math.round(newValue * precision) / precision);
19251
+ }
19117
19252
  if (module.is.range()) {
19118
19253
  if (!$targetThumb.hasClass('second')) {
19119
19254
  position = newPos;
@@ -19202,6 +19337,14 @@
19202
19337
  settings: function () {
19203
19338
  if (settings.start !== false) {
19204
19339
  if (module.is.range()) {
19340
+ var rangeDiff = settings.end - settings.start;
19341
+ if (rangeDiff < 0
19342
+ || (settings.minRange && rangeDiff < settings.minRange)
19343
+ || (settings.maxRange && rangeDiff > settings.maxRange)
19344
+ || (settings.minRange && settings.maxRange && settings.minRange > settings.maxRange)
19345
+ ) {
19346
+ module.error(error.invalidRanges, settings.start, settings.end, settings.minRange, settings.maxRange);
19347
+ }
19205
19348
  module.debug('Start position set from settings', settings.start, settings.end);
19206
19349
  module.set.rangeValue(settings.start, settings.end);
19207
19350
  } else {
@@ -19394,6 +19537,7 @@
19394
19537
  error: {
19395
19538
  method: 'The method you called is not defined.',
19396
19539
  notrange: 'This slider is not a range slider',
19540
+ invalidRanges: 'Invalid range settings (start/end/minRange/maxRange)',
19397
19541
  },
19398
19542
 
19399
19543
  metadata: {
@@ -19406,6 +19550,8 @@
19406
19550
  step: 1,
19407
19551
  start: 0,
19408
19552
  end: 20,
19553
+ minRange: false,
19554
+ maxRange: false,
19409
19555
  labelType: 'number',
19410
19556
  showLabelTicks: false,
19411
19557
  smooth: false,
@@ -19442,6 +19588,13 @@
19442
19588
  downArrow: 40,
19443
19589
  },
19444
19590
 
19591
+ restrictedLabels: [],
19592
+ showThumbTooltip: false,
19593
+ tooltipConfig: {
19594
+ position: 'top center',
19595
+ variation: 'tiny black',
19596
+ },
19597
+
19445
19598
  labelTypes: {
19446
19599
  number: 'number',
19447
19600
  letter: 'letter',
@@ -19453,7 +19606,7 @@
19453
19606
  })(jQuery, window, document);
19454
19607
 
19455
19608
  /*!
19456
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Rating
19609
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Rating
19457
19610
  * https://github.com/fomantic/Fomantic-UI/
19458
19611
  *
19459
19612
  *
@@ -19992,7 +20145,7 @@
19992
20145
  })(jQuery, window, document);
19993
20146
 
19994
20147
  /*!
19995
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Search
20148
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Search
19996
20149
  * https://github.com/fomantic/Fomantic-UI/
19997
20150
  *
19998
20151
  *
@@ -20554,6 +20707,7 @@
20554
20707
  if (cache) {
20555
20708
  module.debug('Reading result from cache', searchTerm);
20556
20709
  module.save.results(cache.results);
20710
+ settings.onResults.call(element, cache.results, true);
20557
20711
  module.addResults(cache.html);
20558
20712
  module.inject.id(cache.results);
20559
20713
  callback();
@@ -21338,7 +21492,7 @@
21338
21492
  onResultsAdd: false,
21339
21493
 
21340
21494
  onSearchQuery: function (query) {},
21341
- onResults: function (response) {},
21495
+ onResults: function (response, fromCache) {},
21342
21496
 
21343
21497
  onResultsOpen: function () {},
21344
21498
  onResultsClose: function () {},
@@ -21569,7 +21723,7 @@
21569
21723
  })(jQuery, window, document);
21570
21724
 
21571
21725
  /*!
21572
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Shape
21726
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Shape
21573
21727
  * https://github.com/fomantic/Fomantic-UI/
21574
21728
  *
21575
21729
  *
@@ -22365,7 +22519,7 @@
22365
22519
  })(jQuery, window, document);
22366
22520
 
22367
22521
  /*!
22368
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Sidebar
22522
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Sidebar
22369
22523
  * https://github.com/fomantic/Fomantic-UI/
22370
22524
  *
22371
22525
  *
@@ -23448,7 +23602,7 @@
23448
23602
  })(jQuery, window, document);
23449
23603
 
23450
23604
  /*!
23451
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Sticky
23605
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Sticky
23452
23606
  * https://github.com/fomantic/Fomantic-UI/
23453
23607
  *
23454
23608
  *
@@ -24364,7 +24518,7 @@
24364
24518
  })(jQuery, window, document);
24365
24519
 
24366
24520
  /*!
24367
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Tab
24521
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Tab
24368
24522
  * https://github.com/fomantic/Fomantic-UI/
24369
24523
  *
24370
24524
  *
@@ -25328,7 +25482,7 @@
25328
25482
  })(jQuery, window, document);
25329
25483
 
25330
25484
  /*!
25331
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Toast
25485
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Toast
25332
25486
  * https://github.com/fomantic/Fomantic-UI/
25333
25487
  *
25334
25488
  *
@@ -25446,11 +25600,11 @@
25446
25600
  if ($toastBox) {
25447
25601
  module.debug('Removing toast', $toastBox);
25448
25602
  module.unbind.events();
25603
+ settings.onRemove.call($toastBox, element);
25449
25604
  $toastBox.remove();
25450
25605
  $toastBox = undefined;
25451
25606
  $toast = undefined;
25452
25607
  $animationObject = undefined;
25453
- settings.onRemove.call($toastBox, element);
25454
25608
  $progress = undefined;
25455
25609
  $progressBar = undefined;
25456
25610
  $close = undefined;
@@ -26289,7 +26443,7 @@
26289
26443
  })(jQuery, window, document);
26290
26444
 
26291
26445
  /*!
26292
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Transition
26446
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Transition
26293
26447
  * https://github.com/fomantic/Fomantic-UI/
26294
26448
  *
26295
26449
  *
@@ -27320,7 +27474,7 @@
27320
27474
  })(jQuery, window, document);
27321
27475
 
27322
27476
  /*!
27323
- * # Fomantic-UI 2.9.3-beta.2+824a375 - API
27477
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - API
27324
27478
  * https://github.com/fomantic/Fomantic-UI/
27325
27479
  *
27326
27480
  *
@@ -28541,7 +28695,7 @@
28541
28695
  })(jQuery, window, document);
28542
28696
 
28543
28697
  /*!
28544
- * # Fomantic-UI 2.9.3-beta.2+824a375 - State
28698
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - State
28545
28699
  * https://github.com/fomantic/Fomantic-UI/
28546
28700
  *
28547
28701
  *
@@ -29237,7 +29391,7 @@
29237
29391
  })(jQuery, window, document);
29238
29392
 
29239
29393
  /*!
29240
- * # Fomantic-UI 2.9.3-beta.2+824a375 - Visibility
29394
+ * # Fomantic-UI 2.9.3-beta.21+491b07a - Visibility
29241
29395
  * https://github.com/fomantic/Fomantic-UI/
29242
29396
  *
29243
29397
  *