fomantic-ui 2.9.4-beta.4 → 2.9.4-beta.41

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 (242) hide show
  1. package/.all-contributorsrc +20 -1
  2. package/.eslintrc.js +17 -0
  3. package/.github/FUNDING.yml +1 -1
  4. package/.github/workflows/ci.yml +5 -5
  5. package/.github/workflows/nightly.yml +1 -1
  6. package/.github/workflows/release.yml +1 -1
  7. package/CONTRIBUTORS.md +2 -0
  8. package/dist/components/accordion.css +1 -1
  9. package/dist/components/accordion.js +4 -2
  10. package/dist/components/accordion.min.css +1 -1
  11. package/dist/components/accordion.min.js +2 -2
  12. package/dist/components/ad.css +1 -1
  13. package/dist/components/ad.min.css +1 -1
  14. package/dist/components/api.js +7 -3
  15. package/dist/components/api.min.js +2 -2
  16. package/dist/components/breadcrumb.css +1 -1
  17. package/dist/components/breadcrumb.min.css +1 -1
  18. package/dist/components/button.css +19 -3
  19. package/dist/components/button.min.css +2 -2
  20. package/dist/components/calendar.css +1 -1
  21. package/dist/components/calendar.js +4 -2
  22. package/dist/components/calendar.min.css +1 -1
  23. package/dist/components/calendar.min.js +2 -2
  24. package/dist/components/card.css +1 -1
  25. package/dist/components/card.min.css +1 -1
  26. package/dist/components/checkbox.css +1 -1
  27. package/dist/components/checkbox.js +10 -4
  28. package/dist/components/checkbox.min.css +1 -1
  29. package/dist/components/checkbox.min.js +3 -3
  30. package/dist/components/comment.css +1 -1
  31. package/dist/components/comment.min.css +1 -1
  32. package/dist/components/container.css +1 -1
  33. package/dist/components/container.min.css +1 -1
  34. package/dist/components/dimmer.css +1 -1
  35. package/dist/components/dimmer.js +4 -2
  36. package/dist/components/dimmer.min.css +1 -1
  37. package/dist/components/dimmer.min.js +2 -2
  38. package/dist/components/divider.css +1 -1
  39. package/dist/components/divider.min.css +1 -1
  40. package/dist/components/dropdown.css +18 -20
  41. package/dist/components/dropdown.js +99 -31
  42. package/dist/components/dropdown.min.css +2 -2
  43. package/dist/components/dropdown.min.js +3 -3
  44. package/dist/components/embed.css +1 -1
  45. package/dist/components/embed.js +17 -7
  46. package/dist/components/embed.min.css +1 -1
  47. package/dist/components/embed.min.js +3 -3
  48. package/dist/components/emoji.css +1 -1
  49. package/dist/components/emoji.min.css +1 -1
  50. package/dist/components/feed.css +1 -1
  51. package/dist/components/feed.min.css +1 -1
  52. package/dist/components/flag.css +1 -1
  53. package/dist/components/flag.min.css +1 -1
  54. package/dist/components/flyout.css +1 -1
  55. package/dist/components/flyout.js +4 -2
  56. package/dist/components/flyout.min.css +1 -1
  57. package/dist/components/flyout.min.js +2 -2
  58. package/dist/components/form.css +15 -5
  59. package/dist/components/form.js +42 -17
  60. package/dist/components/form.min.css +2 -2
  61. package/dist/components/form.min.js +3 -3
  62. package/dist/components/grid.css +5 -5
  63. package/dist/components/grid.min.css +2 -2
  64. package/dist/components/header.css +4 -1
  65. package/dist/components/header.min.css +2 -2
  66. package/dist/components/icon.css +1 -1
  67. package/dist/components/icon.min.css +1 -1
  68. package/dist/components/image.css +1 -1
  69. package/dist/components/image.min.css +1 -1
  70. package/dist/components/input.css +30 -10
  71. package/dist/components/input.min.css +2 -2
  72. package/dist/components/item.css +1 -1
  73. package/dist/components/item.min.css +1 -1
  74. package/dist/components/label.css +1 -2
  75. package/dist/components/label.min.css +2 -2
  76. package/dist/components/list.css +1 -1
  77. package/dist/components/list.min.css +1 -1
  78. package/dist/components/loader.css +1 -1
  79. package/dist/components/loader.min.css +1 -1
  80. package/dist/components/menu.css +1 -2
  81. package/dist/components/menu.min.css +2 -2
  82. package/dist/components/message.css +1 -1
  83. package/dist/components/message.min.css +1 -1
  84. package/dist/components/modal.css +1 -1
  85. package/dist/components/modal.js +7 -3
  86. package/dist/components/modal.min.css +1 -1
  87. package/dist/components/modal.min.js +2 -2
  88. package/dist/components/nag.css +1 -1
  89. package/dist/components/nag.js +11 -5
  90. package/dist/components/nag.min.css +1 -1
  91. package/dist/components/nag.min.js +3 -3
  92. package/dist/components/placeholder.css +1 -1
  93. package/dist/components/placeholder.min.css +1 -1
  94. package/dist/components/popup.css +1 -2
  95. package/dist/components/popup.js +10 -4
  96. package/dist/components/popup.min.css +2 -2
  97. package/dist/components/popup.min.js +2 -2
  98. package/dist/components/progress.css +1 -1
  99. package/dist/components/progress.js +4 -2
  100. package/dist/components/progress.min.css +1 -1
  101. package/dist/components/progress.min.js +2 -2
  102. package/dist/components/rail.css +1 -1
  103. package/dist/components/rail.min.css +1 -1
  104. package/dist/components/rating.css +1 -1
  105. package/dist/components/rating.js +4 -2
  106. package/dist/components/rating.min.css +1 -1
  107. package/dist/components/rating.min.js +2 -2
  108. package/dist/components/reset.css +1 -1
  109. package/dist/components/reset.min.css +1 -1
  110. package/dist/components/reveal.css +1 -1
  111. package/dist/components/reveal.min.css +1 -1
  112. package/dist/components/search.css +1 -1
  113. package/dist/components/search.js +64 -12
  114. package/dist/components/search.min.css +1 -1
  115. package/dist/components/search.min.js +3 -3
  116. package/dist/components/segment.css +1 -1
  117. package/dist/components/segment.min.css +1 -1
  118. package/dist/components/shape.css +1 -1
  119. package/dist/components/shape.js +4 -2
  120. package/dist/components/shape.min.css +1 -1
  121. package/dist/components/shape.min.js +2 -2
  122. package/dist/components/sidebar.css +1 -1
  123. package/dist/components/sidebar.js +4 -2
  124. package/dist/components/sidebar.min.css +1 -1
  125. package/dist/components/sidebar.min.js +2 -2
  126. package/dist/components/site.css +1 -1
  127. package/dist/components/site.js +4 -2
  128. package/dist/components/site.min.css +1 -1
  129. package/dist/components/site.min.js +2 -2
  130. package/dist/components/slider.css +1 -1
  131. package/dist/components/slider.js +4 -2
  132. package/dist/components/slider.min.css +1 -1
  133. package/dist/components/slider.min.js +2 -2
  134. package/dist/components/state.js +4 -2
  135. package/dist/components/state.min.js +2 -2
  136. package/dist/components/statistic.css +1 -1
  137. package/dist/components/statistic.min.css +1 -1
  138. package/dist/components/step.css +1 -1
  139. package/dist/components/step.min.css +1 -1
  140. package/dist/components/sticky.css +1 -1
  141. package/dist/components/sticky.js +4 -2
  142. package/dist/components/sticky.min.css +1 -1
  143. package/dist/components/sticky.min.js +2 -2
  144. package/dist/components/tab.css +1 -1
  145. package/dist/components/tab.js +4 -2
  146. package/dist/components/tab.min.css +1 -1
  147. package/dist/components/tab.min.js +2 -2
  148. package/dist/components/table.css +7 -7
  149. package/dist/components/table.min.css +2 -2
  150. package/dist/components/text.css +1 -1
  151. package/dist/components/text.min.css +1 -1
  152. package/dist/components/toast.css +1 -1
  153. package/dist/components/toast.js +4 -2
  154. package/dist/components/toast.min.css +1 -1
  155. package/dist/components/toast.min.js +2 -2
  156. package/dist/components/transition.css +1 -1
  157. package/dist/components/transition.js +7 -3
  158. package/dist/components/transition.min.css +1 -1
  159. package/dist/components/transition.min.js +2 -2
  160. package/dist/components/visibility.js +4 -2
  161. package/dist/components/visibility.min.js +2 -2
  162. package/dist/semantic.css +152 -101
  163. package/dist/semantic.js +336 -121
  164. package/dist/semantic.min.css +3 -3
  165. package/dist/semantic.min.js +3 -3
  166. package/dist/themes/basic/assets/fonts/LICENSE.txt +91 -0
  167. package/dist/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  168. package/dist/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  169. package/dist/themes/github/assets/fonts/LICENSE.txt +94 -0
  170. package/dist/themes/material/assets/fonts/LICENSE.txt +202 -0
  171. package/package.json +3 -3
  172. package/src/definitions/behaviors/api.js +6 -2
  173. package/src/definitions/behaviors/form.js +41 -16
  174. package/src/definitions/behaviors/state.js +3 -1
  175. package/src/definitions/behaviors/visibility.js +3 -1
  176. package/src/definitions/collections/form.less +14 -4
  177. package/src/definitions/collections/grid.less +4 -4
  178. package/src/definitions/collections/table.less +6 -6
  179. package/src/definitions/elements/button.less +25 -3
  180. package/src/definitions/elements/header.less +5 -0
  181. package/src/definitions/elements/input.less +14 -6
  182. package/src/definitions/globals/site.js +3 -1
  183. package/src/definitions/modules/accordion.js +3 -1
  184. package/src/definitions/modules/calendar.js +3 -1
  185. package/src/definitions/modules/checkbox.js +9 -3
  186. package/src/definitions/modules/dimmer.js +3 -1
  187. package/src/definitions/modules/dropdown.js +98 -30
  188. package/src/definitions/modules/dropdown.less +12 -5
  189. package/src/definitions/modules/embed.js +16 -6
  190. package/src/definitions/modules/flyout.js +3 -1
  191. package/src/definitions/modules/modal.js +6 -2
  192. package/src/definitions/modules/nag.js +10 -4
  193. package/src/definitions/modules/popup.js +9 -3
  194. package/src/definitions/modules/progress.js +3 -1
  195. package/src/definitions/modules/rating.js +3 -1
  196. package/src/definitions/modules/search.js +63 -11
  197. package/src/definitions/modules/search.less +9 -2
  198. package/src/definitions/modules/shape.js +3 -1
  199. package/src/definitions/modules/sidebar.js +3 -1
  200. package/src/definitions/modules/slider.js +3 -1
  201. package/src/definitions/modules/sticky.js +3 -1
  202. package/src/definitions/modules/tab.js +3 -1
  203. package/src/definitions/modules/toast.js +3 -1
  204. package/src/definitions/modules/transition.js +6 -2
  205. package/src/themes/basic/assets/fonts/LICENSE.txt +91 -0
  206. package/src/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  207. package/src/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  208. package/src/themes/default/collections/form.variables +1 -0
  209. package/src/themes/default/elements/button.variables +2 -0
  210. package/src/themes/default/globals/site.variables +3 -0
  211. package/src/themes/default/globals/variation.variables +3 -0
  212. package/src/themes/default/modules/dropdown.variables +3 -0
  213. package/src/themes/default/modules/search.variables +3 -0
  214. package/src/themes/github/assets/fonts/LICENSE.txt +94 -0
  215. package/src/themes/material/assets/fonts/LICENSE.txt +202 -0
  216. package/types/fomantic-ui-accordion.d.ts +1 -1
  217. package/types/fomantic-ui-api.d.ts +9 -3
  218. package/types/fomantic-ui-calendar.d.ts +93 -8
  219. package/types/fomantic-ui-checkbox.d.ts +14 -4
  220. package/types/fomantic-ui-dimmer.d.ts +1 -1
  221. package/types/fomantic-ui-dropdown.d.ts +36 -35
  222. package/types/fomantic-ui-embed.d.ts +1 -1
  223. package/types/fomantic-ui-flyout.d.ts +24 -10
  224. package/types/fomantic-ui-form.d.ts +123 -15
  225. package/types/fomantic-ui-modal.d.ts +75 -5
  226. package/types/fomantic-ui-nag.d.ts +4 -4
  227. package/types/fomantic-ui-popup.d.ts +11 -11
  228. package/types/fomantic-ui-progress.d.ts +12 -6
  229. package/types/fomantic-ui-rating.d.ts +1 -1
  230. package/types/fomantic-ui-search.d.ts +43 -13
  231. package/types/fomantic-ui-shape.d.ts +2 -2
  232. package/types/fomantic-ui-sidebar.d.ts +4 -4
  233. package/types/fomantic-ui-slider.d.ts +1 -1
  234. package/types/fomantic-ui-sticky.d.ts +1 -1
  235. package/types/fomantic-ui-tab.d.ts +5 -5
  236. package/types/fomantic-ui-toast.d.ts +7 -2
  237. package/types/fomantic-ui-transition.d.ts +29 -1
  238. package/types/fomantic-ui-visibility.d.ts +3 -3
  239. package/types/index.d.ts +25 -25
  240. package/types/tests.ts +188 -0
  241. package/types/tsconfig.json +1 -1
  242. package/types/fomantic-ui-tests.ts +0 -25
@@ -793,7 +793,7 @@
793
793
  }
794
794
  if (module.is.multiple()) {
795
795
  $.each(preSelected, function (index, value) {
796
- $item.filter('[data-value="' + value + '"]')
796
+ $item.filter('[data-' + metadata.value + '="' + value + '"]')
797
797
  .addClass(className.filtered)
798
798
  ;
799
799
  });
@@ -890,11 +890,13 @@
890
890
  ? query
891
891
  : module.get.query()
892
892
  ),
893
- results = null,
894
- escapedTerm = module.escape.string(searchTerm),
895
- regExpFlags = (settings.ignoreSearchCase ? 'i' : '') + 'gm',
893
+ results = null,
894
+ escapedTerm = module.escape.string(searchTerm),
895
+ regExpIgnore = settings.ignoreSearchCase ? 'i' : '',
896
+ regExpFlags = regExpIgnore + 'gm',
896
897
  beginsWithRegExp = new RegExp('^' + escapedTerm, regExpFlags)
897
898
  ;
899
+ module.remove.filteredItem();
898
900
  // avoid loop if we're matching nothing
899
901
  if (module.has.query()) {
900
902
  results = [];
@@ -938,12 +940,34 @@
938
940
  ;
939
941
  }
940
942
  module.debug('Showing only matched items', searchTerm);
941
- module.remove.filteredItem();
942
943
  if (results) {
943
944
  $item
944
945
  .not(results)
945
946
  .addClass(className.filtered)
946
947
  ;
948
+ if (settings.highlightMatches && (settings.match === 'both' || settings.match === 'text')) {
949
+ var querySplit = query.split(''),
950
+ diacriticReg = settings.ignoreDiacritics ? '[\u0300-\u036F]?' : '',
951
+ htmlReg = '(?![^<]*>)',
952
+ markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*?)' + htmlReg + '(') + diacriticReg + ')', regExpIgnore),
953
+ markedReplacer = function () {
954
+ var args = [].slice.call(arguments, 1, querySplit.length * 2).map(function (x, i) {
955
+ return i & 1 ? x : '<mark>' + x + '</mark>'; // eslint-disable-line no-bitwise
956
+ });
957
+
958
+ return args.join('');
959
+ }
960
+ ;
961
+ $.each(results, function (index, result) {
962
+ var $result = $(result),
963
+ markedHTML = module.get.choiceText($result, true)
964
+ ;
965
+ if (settings.ignoreDiacritics) {
966
+ markedHTML = markedHTML.normalize('NFD');
967
+ }
968
+ $result.html(markedHTML.replace(markedRegExp, markedReplacer));
969
+ });
970
+ }
947
971
  }
948
972
 
949
973
  if (!module.has.query()) {
@@ -979,8 +1003,10 @@
979
1003
  termLength = term.length,
980
1004
  queryLength = query.length
981
1005
  ;
982
- query = settings.ignoreSearchCase ? query.toLowerCase() : query;
983
- term = settings.ignoreSearchCase ? term.toLowerCase() : term;
1006
+ if (settings.ignoreSearchCase) {
1007
+ query = query.toLowerCase();
1008
+ term = term.toLowerCase();
1009
+ }
984
1010
  if (queryLength > termLength) {
985
1011
  return false;
986
1012
  }
@@ -1187,7 +1213,7 @@
1187
1213
  if (!itemActivated && !pageLostFocus) {
1188
1214
  if (settings.forceSelection) {
1189
1215
  module.forceSelection();
1190
- } else if (!settings.allowAdditions) {
1216
+ } else if (!settings.allowAdditions && !settings.keepSearchTerm && !module.has.menuSearch()) {
1191
1217
  module.remove.searchTerm();
1192
1218
  }
1193
1219
  module.hide();
@@ -1236,7 +1262,9 @@
1236
1262
  module.set.filtered();
1237
1263
  }
1238
1264
  clearTimeout(module.timer);
1239
- module.timer = setTimeout(function () { module.search(); }, settings.delay.search);
1265
+ module.timer = setTimeout(function () {
1266
+ module.search();
1267
+ }, settings.delay.search);
1240
1268
  },
1241
1269
  label: {
1242
1270
  click: function (event) {
@@ -1413,7 +1441,9 @@
1413
1441
  module.remove.userAddition();
1414
1442
  }
1415
1443
  if (!settings.keepSearchTerm) {
1416
- module.remove.filteredItem();
1444
+ if (module.is.multiple()) {
1445
+ module.remove.filteredItem();
1446
+ }
1417
1447
  module.remove.searchTerm();
1418
1448
  }
1419
1449
  if (!module.is.visible() && $target.length > 0) {
@@ -2587,7 +2617,7 @@
2587
2617
  } else {
2588
2618
  $combo.text(text);
2589
2619
  }
2590
- } else if (settings.action === 'activate') {
2620
+ } else if (settings.action === 'activate' || isFunction(settings.action)) {
2591
2621
  if (text !== module.get.placeholderText() || isNotPlaceholder) {
2592
2622
  $text.removeClass(className.placeholder);
2593
2623
  }
@@ -2768,19 +2798,27 @@
2768
2798
  $selectedItem = settings.allowAdditions
2769
2799
  ? $selectedItem || module.get.itemWithAdditions(value)
2770
2800
  : $selectedItem || module.get.item(value);
2771
- if (!$selectedItem) {
2801
+ if (!$selectedItem && value !== undefined) {
2772
2802
  return false;
2773
2803
  }
2774
- module.debug('Setting selected menu item to', $selectedItem);
2775
- if (module.is.multiple() && !keepSearchTerm) {
2776
- module.remove.searchWidth();
2777
- }
2778
- if (module.is.single()) {
2804
+ if (isMultiple) {
2805
+ if (!keepSearchTerm) {
2806
+ module.remove.searchWidth();
2807
+ }
2808
+ if (settings.useLabels) {
2809
+ module.remove.selectedItem();
2810
+ if (value === undefined) {
2811
+ module.remove.labels($module.find(selector.label), true);
2812
+ }
2813
+ }
2814
+ } else {
2779
2815
  module.remove.activeItem();
2780
2816
  module.remove.selectedItem();
2781
- } else if (settings.useLabels) {
2782
- module.remove.selectedItem();
2783
2817
  }
2818
+ if (!$selectedItem) {
2819
+ return false;
2820
+ }
2821
+ module.debug('Setting selected menu item to', $selectedItem);
2784
2822
  // select each item
2785
2823
  $selectedItem
2786
2824
  .each(function () {
@@ -3080,6 +3118,12 @@
3080
3118
  $item.removeClass(className.active);
3081
3119
  },
3082
3120
  filteredItem: function () {
3121
+ if (settings.highlightMatches) {
3122
+ $.each($item, function (index, item) {
3123
+ var $markItem = $(item);
3124
+ $markItem.html($markItem.html().replace(/<\/?mark>/g, ''));
3125
+ });
3126
+ }
3083
3127
  if (settings.useLabels && module.has.maxSelections()) {
3084
3128
  return;
3085
3129
  }
@@ -3424,7 +3468,12 @@
3424
3468
  return $selectedMenu.hasClass(className.leftward);
3425
3469
  },
3426
3470
  clearable: function () {
3427
- return $module.hasClass(className.clearable) || settings.clearable;
3471
+ var hasClearableClass = $module.hasClass(className.clearable);
3472
+ if (!hasClearableClass && settings.clearable) {
3473
+ $module.addClass(className.clearable);
3474
+ }
3475
+
3476
+ return hasClearableClass || settings.clearable;
3428
3477
  },
3429
3478
  disabled: function () {
3430
3479
  return $module.hasClass(className.disabled);
@@ -3747,12 +3796,16 @@
3747
3796
  show: function () {
3748
3797
  module.verbose('Delaying show event to ensure user intent');
3749
3798
  clearTimeout(module.timer);
3750
- module.timer = setTimeout(function () { module.show(); }, settings.delay.show);
3799
+ module.timer = setTimeout(function () {
3800
+ module.show();
3801
+ }, settings.delay.show);
3751
3802
  },
3752
3803
  hide: function () {
3753
3804
  module.verbose('Delaying hide event to ensure user intent');
3754
3805
  clearTimeout(module.timer);
3755
- module.timer = setTimeout(function () { module.hide(); }, settings.delay.hide);
3806
+ module.timer = setTimeout(function () {
3807
+ module.hide();
3808
+ }, settings.delay.hide);
3756
3809
  },
3757
3810
  },
3758
3811
 
@@ -3785,6 +3838,7 @@
3785
3838
  return text.replace(regExp.escape, '\\$&');
3786
3839
  },
3787
3840
  htmlEntities: function (string, forceAmpersand) {
3841
+ forceAmpersand = typeof forceAmpersand === 'number' ? false : forceAmpersand;
3788
3842
  var
3789
3843
  badChars = /["'<>`]/g,
3790
3844
  shouldEscape = /["&'<>`]/,
@@ -3801,8 +3855,7 @@
3801
3855
  ;
3802
3856
  if (shouldEscape.test(string)) {
3803
3857
  string = string.replace(forceAmpersand ? /&/g : /&(?![\d#a-z]{1,12};)/gi, '&amp;');
3804
-
3805
- return string.replace(badChars, escapedChar);
3858
+ string = string.replace(badChars, escapedChar);
3806
3859
  }
3807
3860
 
3808
3861
  return string;
@@ -3878,7 +3931,9 @@
3878
3931
  });
3879
3932
  }
3880
3933
  clearTimeout(module.performance.timer);
3881
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
3934
+ module.performance.timer = setTimeout(function () {
3935
+ module.performance.display();
3936
+ }, 500);
3882
3937
  },
3883
3938
  display: function () {
3884
3939
  var
@@ -4005,6 +4060,7 @@
4005
4060
 
4006
4061
  match: 'both', // what to match against with search selection (both, text, or label)
4007
4062
  fullTextSearch: 'exact', // search anywhere in value (set to 'exact' to require exact matches)
4063
+ highlightMatches: false, // Whether search result should highlight matching strings
4008
4064
  ignoreDiacritics: false, // match results also if they contain diacritics of the same base character (for example searching for "a" will also match "á" or "â" or "à", etc...)
4009
4065
  hideDividers: false, // Whether to hide any divider elements (specified in selector.divider) that are sibling to any items when searched (set to true will hide all dividers, set to 'empty' will hide them when they are not followed by a visible item)
4010
4066
 
@@ -4120,6 +4176,7 @@
4120
4176
  descriptionVertical: 'descriptionVertical', // whether description should be vertical
4121
4177
  value: 'value', // actual dropdown value
4122
4178
  text: 'text', // displayed text when selected
4179
+ data: 'data', // custom data attributes
4123
4180
  type: 'type', // type of dropdown element
4124
4181
  image: 'image', // optional image path
4125
4182
  imageClass: 'imageClass', // optional individual class for image
@@ -4229,8 +4286,7 @@
4229
4286
  ;
4230
4287
  if (shouldEscape.test(string)) {
4231
4288
  string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&amp;');
4232
-
4233
- return string.replace(badChars, escapedChar);
4289
+ string = string.replace(badChars, escapedChar);
4234
4290
  }
4235
4291
 
4236
4292
  return string;
@@ -4265,9 +4321,21 @@
4265
4321
  $.each(values, function (index, option) {
4266
4322
  var
4267
4323
  itemType = option[fields.type] || 'item',
4268
- isMenu = itemType.indexOf('menu') !== -1
4324
+ isMenu = itemType.indexOf('menu') !== -1,
4325
+ maybeData = '',
4326
+ dataObject = option[fields.data]
4269
4327
  ;
4270
-
4328
+ if (dataObject) {
4329
+ var dataKey,
4330
+ dataKeyEscaped
4331
+ ;
4332
+ for (dataKey in dataObject) {
4333
+ dataKeyEscaped = String(dataKey).replace(/\W/g, '');
4334
+ if (Object.prototype.hasOwnProperty.call(dataObject, dataKey) && ['text', 'value'].indexOf(dataKeyEscaped.toLowerCase()) === -1) {
4335
+ maybeData += ' data-' + dataKeyEscaped + '="' + deQuote(String(dataObject[dataKey])) + '"';
4336
+ }
4337
+ }
4338
+ }
4271
4339
  if (itemType === 'item' || isMenu) {
4272
4340
  var
4273
4341
  maybeText = option[fields.text]
@@ -4284,7 +4352,7 @@
4284
4352
  : '',
4285
4353
  hasDescription = escape(option[fields.description] || '', preserveHTML) !== ''
4286
4354
  ;
4287
- html += '<div class="' + deQuote(maybeActionable + maybeDisabled + maybeDescriptionVertical + (option[fields.class] || className.item)) + '" data-value="' + deQuote(option[fields.value], true) + '"' + maybeText + '>';
4355
+ html += '<div class="' + deQuote(maybeActionable + maybeDisabled + maybeDescriptionVertical + (option[fields.class] || className.item)) + '" data-value="' + deQuote(option[fields.value], true) + '"' + maybeText + maybeData + '>';
4288
4356
  if (isMenu) {
4289
4357
  html += '<i class="' + (itemType.indexOf('left') !== -1 ? 'left' : '') + ' dropdown icon"></i>';
4290
4358
  }
@@ -811,14 +811,14 @@ select.ui.dropdown {
811
811
  }
812
812
  }
813
813
 
814
- .ui.clearable.dropdown .text,
815
- .ui.clearable.dropdown a:last-of-type {
814
+ .ui.clearable.dropdown .text:not(.default),
815
+ .ui.clearable.dropdown:not(.search) > .ui.label:last-of-type {
816
816
  margin-right: @clearableTextMargin;
817
817
  }
818
818
 
819
819
  .ui.dropdown select.noselection ~ .remove.icon,
820
820
  .ui.dropdown input[value=""] ~ .remove.icon,
821
- .ui.dropdown input:not([value]) ~ .remove.icon,
821
+ .ui.dropdown input:not([value]):not(.search) ~ .remove.icon,
822
822
  .ui.dropdown.loading > .remove.icon {
823
823
  display: none;
824
824
  }
@@ -1853,13 +1853,20 @@ select.ui.dropdown {
1853
1853
  & when not (@variationDropdownSizes = false) {
1854
1854
  each(@variationDropdownSizes, {
1855
1855
  @s: @@value;
1856
- .ui.@{value}.dropdown,
1857
- .ui.@{value}.dropdown .menu > .item {
1856
+ .ui.ui.@{value}.dropdown,
1857
+ .ui.ui.@{value}.dropdown .menu > .item {
1858
1858
  font-size: @s;
1859
1859
  }
1860
1860
  });
1861
1861
  }
1862
1862
 
1863
+ & when (@variationDropdownHighlightMatches) {
1864
+ .ui.dropdown .menu > .item mark {
1865
+ background: @highlightMatchesBackground;
1866
+ color: @highlightMatchesColor;
1867
+ }
1868
+ }
1869
+
1863
1870
  & when (@variationDropdownInverted) {
1864
1871
  /* --------------
1865
1872
  Inverted
@@ -119,11 +119,12 @@
119
119
 
120
120
  createPlaceholder: function (placeholder) {
121
121
  var
122
- icon = module.get.icon()
122
+ icon = module.get.icon(),
123
+ alt = module.get.alt()
123
124
  ;
124
125
  placeholder = placeholder || module.get.placeholder();
125
- $module.html(templates.placeholder(placeholder, icon));
126
- module.debug('Creating placeholder for embed', placeholder, icon);
126
+ $module.html(templates.placeholder(placeholder, icon, alt));
127
+ module.debug('Creating placeholder for embed', placeholder, icon, alt);
127
128
  },
128
129
 
129
130
  createEmbed: function (url) {
@@ -203,6 +204,9 @@
203
204
  placeholder: function () {
204
205
  return settings.placeholder || $module.data(metadata.placeholder);
205
206
  },
207
+ alt: function () {
208
+ return settings.alt || $module.data(metadata.alt);
209
+ },
206
210
  icon: function () {
207
211
  return settings.icon || ($module.data(metadata.icon) !== undefined
208
212
  ? $module.data(metadata.icon)
@@ -288,6 +292,7 @@
288
292
  .removeData(metadata.id)
289
293
  .removeData(metadata.icon)
290
294
  .removeData(metadata.placeholder)
295
+ .removeData(metadata.alt)
291
296
  .removeData(metadata.source)
292
297
  .removeData(metadata.url)
293
298
  ;
@@ -440,7 +445,9 @@
440
445
  });
441
446
  }
442
447
  clearTimeout(module.performance.timer);
443
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
448
+ module.performance.timer = setTimeout(function () {
449
+ module.performance.display();
450
+ }, 500);
444
451
  },
445
452
  display: function () {
446
453
  var
@@ -555,6 +562,8 @@
555
562
  source: false,
556
563
  url: false,
557
564
  id: false,
565
+ placeholder: false,
566
+ alt: false,
558
567
 
559
568
  // standard video settings
560
569
  autoplay: 'auto',
@@ -577,6 +586,7 @@
577
586
  id: 'id',
578
587
  icon: 'icon',
579
588
  placeholder: 'placeholder',
589
+ alt: 'alt',
580
590
  source: 'source',
581
591
  url: 'url',
582
592
  },
@@ -652,7 +662,7 @@
652
662
  + ' width="100%" height="100%"'
653
663
  + ' msallowFullScreen allowFullScreen></iframe>';
654
664
  },
655
- placeholder: function (image, icon) {
665
+ placeholder: function (image, icon, alt) {
656
666
  var
657
667
  html = '',
658
668
  deQuote = $.fn.embed.settings.templates.deQuote
@@ -661,7 +671,7 @@
661
671
  html += '<i class="' + deQuote(icon) + ' icon"></i>';
662
672
  }
663
673
  if (image) {
664
- html += '<img class="placeholder" src="' + deQuote(image) + '">';
674
+ html += '<img class="placeholder" src="' + deQuote(image) + (alt ? '" alt="' + deQuote(alt) : '') + '">';
665
675
  }
666
676
 
667
677
  return html;
@@ -1219,7 +1219,9 @@
1219
1219
  });
1220
1220
  }
1221
1221
  clearTimeout(module.performance.timer);
1222
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
1222
+ module.performance.timer = setTimeout(function () {
1223
+ module.performance.display();
1224
+ }, 500);
1223
1225
  },
1224
1226
  display: function () {
1225
1227
  var
@@ -527,7 +527,9 @@
527
527
  },
528
528
  debounce: function (method, delay) {
529
529
  clearTimeout(module.timer);
530
- module.timer = setTimeout(function () { method(); }, delay);
530
+ module.timer = setTimeout(function () {
531
+ method();
532
+ }, delay);
531
533
  },
532
534
  keyboard: function (event) {
533
535
  var
@@ -1273,7 +1275,9 @@
1273
1275
  });
1274
1276
  }
1275
1277
  clearTimeout(module.performance.timer);
1276
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
1278
+ module.performance.timer = setTimeout(function () {
1279
+ module.performance.display();
1280
+ }, 500);
1277
1281
  },
1278
1282
  display: function () {
1279
1283
  var
@@ -88,7 +88,9 @@
88
88
  }
89
89
 
90
90
  if (settings.displayTime > 0) {
91
- setTimeout(function () { module.hide(); }, settings.displayTime);
91
+ setTimeout(function () {
92
+ module.hide();
93
+ }, settings.displayTime);
92
94
  }
93
95
  module.show();
94
96
  },
@@ -144,8 +146,10 @@
144
146
  module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
145
147
  module.storage.set(settings.key, settings.value);
146
148
  }
147
- event.stopImmediatePropagation();
148
- event.preventDefault();
149
+ if (event) {
150
+ event.stopImmediatePropagation();
151
+ event.preventDefault();
152
+ }
149
153
  },
150
154
 
151
155
  should: {
@@ -377,7 +381,9 @@
377
381
  });
378
382
  }
379
383
  clearTimeout(module.performance.timer);
380
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
384
+ module.performance.timer = setTimeout(function () {
385
+ module.performance.display();
386
+ }, 500);
381
387
  },
382
388
  display: function () {
383
389
  var
@@ -194,7 +194,9 @@
194
194
  ;
195
195
  clearTimeout(module.hideTimer);
196
196
  if (!openedWithTouch || (openedWithTouch && settings.addTouchEvents)) {
197
- module.showTimer = setTimeout(function () { module.show(); }, delay);
197
+ module.showTimer = setTimeout(function () {
198
+ module.show();
199
+ }, delay);
198
200
  }
199
201
  },
200
202
  end: function () {
@@ -204,7 +206,9 @@
204
206
  : settings.delay
205
207
  ;
206
208
  clearTimeout(module.showTimer);
207
- module.hideTimer = setTimeout(function () { module.hide(); }, delay);
209
+ module.hideTimer = setTimeout(function () {
210
+ module.hide();
211
+ }, delay);
208
212
  },
209
213
  touchstart: function (event) {
210
214
  openedWithTouch = true;
@@ -1244,7 +1248,9 @@
1244
1248
  });
1245
1249
  }
1246
1250
  clearTimeout(module.performance.timer);
1247
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
1251
+ module.performance.timer = setTimeout(function () {
1252
+ module.performance.display();
1253
+ }, 500);
1248
1254
  },
1249
1255
  display: function () {
1250
1256
  var
@@ -791,7 +791,9 @@
791
791
  });
792
792
  }
793
793
  clearTimeout(module.performance.timer);
794
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
794
+ module.performance.timer = setTimeout(function () {
795
+ module.performance.display();
796
+ }, 500);
795
797
  },
796
798
  display: function () {
797
799
  var
@@ -368,7 +368,9 @@
368
368
  });
369
369
  }
370
370
  clearTimeout(module.performance.timer);
371
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
371
+ module.performance.timer = setTimeout(function () {
372
+ module.performance.display();
373
+ }, 500);
372
374
  },
373
375
  display: function () {
374
376
  var