fomantic-ui 2.9.4-beta.7 → 2.9.4-beta.70

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 (265) 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/depsreview.yml +14 -0
  6. package/.github/workflows/nightly.yml +1 -1
  7. package/.github/workflows/release.yml +1 -1
  8. package/CONTRIBUTORS.md +2 -0
  9. package/README.md +2 -12
  10. package/dist/components/accordion.css +1 -1
  11. package/dist/components/accordion.js +4 -2
  12. package/dist/components/accordion.min.css +1 -1
  13. package/dist/components/accordion.min.js +2 -2
  14. package/dist/components/ad.css +1 -1
  15. package/dist/components/ad.min.css +1 -1
  16. package/dist/components/api.js +7 -3
  17. package/dist/components/api.min.js +2 -2
  18. package/dist/components/breadcrumb.css +1 -1
  19. package/dist/components/breadcrumb.min.css +1 -1
  20. package/dist/components/button.css +21 -3
  21. package/dist/components/button.min.css +2 -2
  22. package/dist/components/calendar.css +1 -1
  23. package/dist/components/calendar.js +15 -3
  24. package/dist/components/calendar.min.css +1 -1
  25. package/dist/components/calendar.min.js +3 -3
  26. package/dist/components/card.css +1 -1
  27. package/dist/components/card.min.css +1 -1
  28. package/dist/components/checkbox.css +1 -1
  29. package/dist/components/checkbox.js +10 -4
  30. package/dist/components/checkbox.min.css +1 -1
  31. package/dist/components/checkbox.min.js +3 -3
  32. package/dist/components/comment.css +1 -1
  33. package/dist/components/comment.min.css +1 -1
  34. package/dist/components/container.css +1 -1
  35. package/dist/components/container.min.css +1 -1
  36. package/dist/components/dimmer.css +7 -3
  37. package/dist/components/dimmer.js +4 -2
  38. package/dist/components/dimmer.min.css +2 -2
  39. package/dist/components/dimmer.min.js +2 -2
  40. package/dist/components/divider.css +1 -1
  41. package/dist/components/divider.min.css +1 -1
  42. package/dist/components/dropdown.css +46 -38
  43. package/dist/components/dropdown.js +104 -33
  44. package/dist/components/dropdown.min.css +2 -2
  45. package/dist/components/dropdown.min.js +3 -3
  46. package/dist/components/embed.css +1 -1
  47. package/dist/components/embed.js +17 -7
  48. package/dist/components/embed.min.css +1 -1
  49. package/dist/components/embed.min.js +3 -3
  50. package/dist/components/emoji.css +1 -1
  51. package/dist/components/emoji.min.css +1 -1
  52. package/dist/components/feed.css +12 -1
  53. package/dist/components/feed.min.css +2 -2
  54. package/dist/components/flag.css +1 -1
  55. package/dist/components/flag.min.css +1 -1
  56. package/dist/components/flyout.css +1 -1
  57. package/dist/components/flyout.js +4 -2
  58. package/dist/components/flyout.min.css +1 -1
  59. package/dist/components/flyout.min.js +2 -2
  60. package/dist/components/form.css +15 -3
  61. package/dist/components/form.js +66 -23
  62. package/dist/components/form.min.css +2 -2
  63. package/dist/components/form.min.js +3 -3
  64. package/dist/components/grid.css +5 -5
  65. package/dist/components/grid.min.css +2 -2
  66. package/dist/components/header.css +1 -1
  67. package/dist/components/header.min.css +1 -1
  68. package/dist/components/icon.css +1 -1
  69. package/dist/components/icon.min.css +1 -1
  70. package/dist/components/image.css +1 -1
  71. package/dist/components/image.min.css +1 -1
  72. package/dist/components/input.css +1 -1
  73. package/dist/components/input.min.css +1 -1
  74. package/dist/components/item.css +1 -1
  75. package/dist/components/item.min.css +1 -1
  76. package/dist/components/label.css +1 -1
  77. package/dist/components/label.min.css +1 -1
  78. package/dist/components/list.css +1 -1
  79. package/dist/components/list.min.css +1 -1
  80. package/dist/components/loader.css +1 -1
  81. package/dist/components/loader.min.css +1 -1
  82. package/dist/components/menu.css +1 -1
  83. package/dist/components/menu.min.css +1 -1
  84. package/dist/components/message.css +2 -1
  85. package/dist/components/message.min.css +2 -2
  86. package/dist/components/modal.css +1 -1
  87. package/dist/components/modal.js +7 -3
  88. package/dist/components/modal.min.css +1 -1
  89. package/dist/components/modal.min.js +2 -2
  90. package/dist/components/nag.css +1 -1
  91. package/dist/components/nag.js +11 -5
  92. package/dist/components/nag.min.css +1 -1
  93. package/dist/components/nag.min.js +3 -3
  94. package/dist/components/placeholder.css +1 -1
  95. package/dist/components/placeholder.min.css +1 -1
  96. package/dist/components/popup.css +1 -1
  97. package/dist/components/popup.js +10 -4
  98. package/dist/components/popup.min.css +1 -1
  99. package/dist/components/popup.min.js +2 -2
  100. package/dist/components/progress.css +15 -6
  101. package/dist/components/progress.js +4 -2
  102. package/dist/components/progress.min.css +2 -2
  103. package/dist/components/progress.min.js +2 -2
  104. package/dist/components/rail.css +1 -1
  105. package/dist/components/rail.min.css +1 -1
  106. package/dist/components/rating.css +1 -1
  107. package/dist/components/rating.js +4 -2
  108. package/dist/components/rating.min.css +1 -1
  109. package/dist/components/rating.min.js +2 -2
  110. package/dist/components/reset.css +1 -1
  111. package/dist/components/reset.min.css +1 -1
  112. package/dist/components/reveal.css +1 -1
  113. package/dist/components/reveal.min.css +1 -1
  114. package/dist/components/search.css +1 -1
  115. package/dist/components/search.js +67 -14
  116. package/dist/components/search.min.css +1 -1
  117. package/dist/components/search.min.js +3 -3
  118. package/dist/components/segment.css +1 -1
  119. package/dist/components/segment.min.css +1 -1
  120. package/dist/components/shape.css +1 -1
  121. package/dist/components/shape.js +7 -5
  122. package/dist/components/shape.min.css +1 -1
  123. package/dist/components/shape.min.js +3 -3
  124. package/dist/components/sidebar.css +1 -1
  125. package/dist/components/sidebar.js +4 -2
  126. package/dist/components/sidebar.min.css +1 -1
  127. package/dist/components/sidebar.min.js +2 -2
  128. package/dist/components/site.css +14 -6
  129. package/dist/components/site.js +4 -2
  130. package/dist/components/site.min.css +2 -2
  131. package/dist/components/site.min.js +2 -2
  132. package/dist/components/slider.css +1 -1
  133. package/dist/components/slider.js +4 -2
  134. package/dist/components/slider.min.css +1 -1
  135. package/dist/components/slider.min.js +2 -2
  136. package/dist/components/state.js +4 -2
  137. package/dist/components/state.min.js +2 -2
  138. package/dist/components/statistic.css +1 -1
  139. package/dist/components/statistic.min.css +1 -1
  140. package/dist/components/step.css +1 -1
  141. package/dist/components/step.min.css +1 -1
  142. package/dist/components/sticky.css +1 -1
  143. package/dist/components/sticky.js +4 -2
  144. package/dist/components/sticky.min.css +1 -1
  145. package/dist/components/sticky.min.js +2 -2
  146. package/dist/components/tab.css +1 -1
  147. package/dist/components/tab.js +4 -2
  148. package/dist/components/tab.min.css +1 -1
  149. package/dist/components/tab.min.js +2 -2
  150. package/dist/components/table.css +32 -21
  151. package/dist/components/table.min.css +2 -2
  152. package/dist/components/text.css +1 -1
  153. package/dist/components/text.min.css +1 -1
  154. package/dist/components/toast.css +1 -1
  155. package/dist/components/toast.js +7 -3
  156. package/dist/components/toast.min.css +1 -1
  157. package/dist/components/toast.min.js +3 -3
  158. package/dist/components/transition.css +1 -1
  159. package/dist/components/transition.js +7 -3
  160. package/dist/components/transition.min.css +1 -1
  161. package/dist/components/transition.min.js +2 -2
  162. package/dist/components/visibility.js +4 -2
  163. package/dist/components/visibility.min.js +2 -2
  164. package/dist/semantic.css +234 -132
  165. package/dist/semantic.js +385 -136
  166. package/dist/semantic.min.css +3 -3
  167. package/dist/semantic.min.js +3 -3
  168. package/dist/themes/basic/assets/fonts/LICENSE.txt +91 -0
  169. package/dist/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  170. package/dist/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  171. package/dist/themes/github/assets/fonts/LICENSE.txt +94 -0
  172. package/dist/themes/material/assets/fonts/LICENSE.txt +202 -0
  173. package/package.json +14 -14
  174. package/src/definitions/behaviors/api.js +6 -2
  175. package/src/definitions/behaviors/form.js +65 -22
  176. package/src/definitions/behaviors/state.js +3 -1
  177. package/src/definitions/behaviors/visibility.js +3 -1
  178. package/src/definitions/collections/form.less +9 -2
  179. package/src/definitions/collections/grid.less +4 -4
  180. package/src/definitions/collections/message.less +1 -0
  181. package/src/definitions/collections/table.less +69 -54
  182. package/src/definitions/elements/button.less +27 -3
  183. package/src/definitions/globals/site.js +3 -1
  184. package/src/definitions/globals/site.less +17 -12
  185. package/src/definitions/modules/accordion.js +3 -1
  186. package/src/definitions/modules/calendar.js +14 -2
  187. package/src/definitions/modules/checkbox.js +9 -3
  188. package/src/definitions/modules/dimmer.js +3 -1
  189. package/src/definitions/modules/dimmer.less +8 -5
  190. package/src/definitions/modules/dropdown.js +103 -32
  191. package/src/definitions/modules/dropdown.less +43 -29
  192. package/src/definitions/modules/embed.js +16 -6
  193. package/src/definitions/modules/flyout.js +3 -1
  194. package/src/definitions/modules/modal.js +6 -2
  195. package/src/definitions/modules/nag.js +10 -4
  196. package/src/definitions/modules/popup.js +9 -3
  197. package/src/definitions/modules/progress.js +3 -1
  198. package/src/definitions/modules/progress.less +17 -5
  199. package/src/definitions/modules/rating.js +3 -1
  200. package/src/definitions/modules/search.js +66 -13
  201. package/src/definitions/modules/search.less +9 -2
  202. package/src/definitions/modules/shape.js +6 -4
  203. package/src/definitions/modules/sidebar.js +3 -1
  204. package/src/definitions/modules/slider.js +3 -1
  205. package/src/definitions/modules/sticky.js +3 -1
  206. package/src/definitions/modules/tab.js +3 -1
  207. package/src/definitions/modules/toast.js +6 -2
  208. package/src/definitions/modules/transition.js +6 -2
  209. package/src/definitions/views/feed.less +11 -0
  210. package/src/themes/basic/assets/fonts/LICENSE.txt +91 -0
  211. package/src/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
  212. package/src/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
  213. package/src/themes/default/elements/button.variables +3 -0
  214. package/src/themes/default/globals/site.variables +3 -0
  215. package/src/themes/default/globals/variation.variables +3 -0
  216. package/src/themes/default/modules/dropdown.variables +3 -0
  217. package/src/themes/default/modules/progress.variables +1 -1
  218. package/src/themes/default/modules/search.variables +3 -0
  219. package/src/themes/default/views/feed.variables +3 -0
  220. package/src/themes/github/assets/fonts/LICENSE.txt +94 -0
  221. package/src/themes/material/assets/fonts/LICENSE.txt +202 -0
  222. package/tasks/admin/components/create.js +4 -4
  223. package/tasks/admin/components/init.js +2 -2
  224. package/tasks/admin/components/update.js +3 -3
  225. package/tasks/admin/distributions/create.js +3 -3
  226. package/tasks/admin/distributions/init.js +2 -2
  227. package/tasks/admin/distributions/update.js +4 -4
  228. package/tasks/build/assets.js +1 -1
  229. package/tasks/build/css.js +19 -10
  230. package/tasks/build/javascript.js +12 -5
  231. package/tasks/check-install.js +1 -1
  232. package/tasks/config/defaults.js +2 -0
  233. package/tasks/config/tasks.js +1 -1
  234. package/tasks/docs/build.js +3 -3
  235. package/tasks/docs/metadata.js +1 -1
  236. package/tasks/docs/serve.js +3 -1
  237. package/tasks/install.js +2 -2
  238. package/tasks/watch.js +1 -1
  239. package/types/fomantic-ui-accordion.d.ts +1 -1
  240. package/types/fomantic-ui-api.d.ts +9 -3
  241. package/types/fomantic-ui-calendar.d.ts +110 -9
  242. package/types/fomantic-ui-checkbox.d.ts +14 -4
  243. package/types/fomantic-ui-dimmer.d.ts +1 -1
  244. package/types/fomantic-ui-dropdown.d.ts +76 -44
  245. package/types/fomantic-ui-embed.d.ts +19 -2
  246. package/types/fomantic-ui-flyout.d.ts +25 -11
  247. package/types/fomantic-ui-form.d.ts +123 -15
  248. package/types/fomantic-ui-modal.d.ts +101 -5
  249. package/types/fomantic-ui-nag.d.ts +4 -4
  250. package/types/fomantic-ui-popup.d.ts +38 -12
  251. package/types/fomantic-ui-progress.d.ts +12 -6
  252. package/types/fomantic-ui-rating.d.ts +1 -1
  253. package/types/fomantic-ui-search.d.ts +138 -22
  254. package/types/fomantic-ui-shape.d.ts +2 -2
  255. package/types/fomantic-ui-sidebar.d.ts +4 -4
  256. package/types/fomantic-ui-slider.d.ts +2 -2
  257. package/types/fomantic-ui-sticky.d.ts +1 -1
  258. package/types/fomantic-ui-tab.d.ts +6 -6
  259. package/types/fomantic-ui-toast.d.ts +14 -2
  260. package/types/fomantic-ui-transition.d.ts +41 -7
  261. package/types/fomantic-ui-visibility.d.ts +3 -3
  262. package/types/index.d.ts +25 -25
  263. package/types/tests.ts +188 -0
  264. package/types/tsconfig.json +1 -1
  265. package/types/fomantic-ui-tests.ts +0 -25
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.4-beta.7+74bca06 - Dropdown
2
+ * # Fomantic-UI 2.9.4-beta.70+6ca9e03 - Dropdown
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -442,70 +442,70 @@ select.ui.dropdown {
442
442
  padding: 0.78571429rem 1.14285714rem;
443
443
  }
444
444
  @media only screen and (max-width: 767.98px) {
445
- .ui.selection.dropdown.short .menu {
445
+ .ui.ui.selection.dropdown.short .menu {
446
446
  max-height: 6.01071429rem;
447
447
  }
448
- .ui.selection.dropdown[class*="very short"] .menu {
448
+ .ui.ui.selection.dropdown[class*="very short"] .menu {
449
449
  max-height: 4.00714286rem;
450
450
  }
451
451
  .ui.selection.dropdown:not(.unlimited) .menu {
452
452
  max-height: 8.01428571rem;
453
453
  }
454
- .ui.selection.dropdown.long .menu {
454
+ .ui.ui.selection.dropdown.long .menu {
455
455
  max-height: 16.02857143rem;
456
456
  }
457
- .ui.selection.dropdown[class*="very long"] .menu {
457
+ .ui.ui.selection.dropdown[class*="very long"] .menu {
458
458
  max-height: 24.04285714rem;
459
459
  }
460
460
  }
461
461
  @media only screen and (min-width: 768px) {
462
- .ui.selection.dropdown.short .menu {
462
+ .ui.ui.selection.dropdown.short .menu {
463
463
  max-height: 8.01428571rem;
464
464
  }
465
- .ui.selection.dropdown[class*="very short"] .menu {
465
+ .ui.ui.selection.dropdown[class*="very short"] .menu {
466
466
  max-height: 5.34285714rem;
467
467
  }
468
468
  .ui.selection.dropdown:not(.unlimited) .menu {
469
469
  max-height: 10.68571429rem;
470
470
  }
471
- .ui.selection.dropdown.long .menu {
471
+ .ui.ui.selection.dropdown.long .menu {
472
472
  max-height: 21.37142857rem;
473
473
  }
474
- .ui.selection.dropdown[class*="very long"] .menu {
474
+ .ui.ui.selection.dropdown[class*="very long"] .menu {
475
475
  max-height: 32.05714286rem;
476
476
  }
477
477
  }
478
478
  @media only screen and (min-width: 992px) {
479
- .ui.selection.dropdown.short .menu {
479
+ .ui.ui.selection.dropdown.short .menu {
480
480
  max-height: 12.02142857rem;
481
481
  }
482
- .ui.selection.dropdown[class*="very short"] .menu {
482
+ .ui.ui.selection.dropdown[class*="very short"] .menu {
483
483
  max-height: 8.01428571rem;
484
484
  }
485
485
  .ui.selection.dropdown:not(.unlimited) .menu {
486
486
  max-height: 16.02857143rem;
487
487
  }
488
- .ui.selection.dropdown.long .menu {
488
+ .ui.ui.selection.dropdown.long .menu {
489
489
  max-height: 32.05714286rem;
490
490
  }
491
- .ui.selection.dropdown[class*="very long"] .menu {
491
+ .ui.ui.selection.dropdown[class*="very long"] .menu {
492
492
  max-height: 48.08571429rem;
493
493
  }
494
494
  }
495
495
  @media only screen and (min-width: 1920px) {
496
- .ui.selection.dropdown.short .menu {
496
+ .ui.ui.selection.dropdown.short .menu {
497
497
  max-height: 16.02857143rem;
498
498
  }
499
- .ui.selection.dropdown[class*="very short"] .menu {
499
+ .ui.ui.selection.dropdown[class*="very short"] .menu {
500
500
  max-height: 10.68571429rem;
501
501
  }
502
502
  .ui.selection.dropdown:not(.unlimited) .menu {
503
503
  max-height: 21.37142857rem;
504
504
  }
505
- .ui.selection.dropdown.long .menu {
505
+ .ui.ui.selection.dropdown.long .menu {
506
506
  max-height: 42.74285714rem;
507
507
  }
508
- .ui.selection.dropdown[class*="very long"] .menu {
508
+ .ui.ui.selection.dropdown[class*="very long"] .menu {
509
509
  max-height: 64.11428571rem;
510
510
  }
511
511
  }
@@ -701,7 +701,7 @@ select.ui.dropdown {
701
701
  opacity: 0.45;
702
702
  }
703
703
  .ui.active.search.dropdown input.search:focus + .text {
704
- color: rgba(115, 115, 115, 0.87) !important;
704
+ color: rgba(115, 115, 115, 0.87);
705
705
  }
706
706
  .ui.search.dropdown.button > span.sizer {
707
707
  display: none;
@@ -755,13 +755,13 @@ select.ui.dropdown {
755
755
  .ui.inline.dropdown > .remove.icon {
756
756
  right: 2.2em;
757
757
  }
758
- .ui.clearable.dropdown .text,
759
- .ui.clearable.dropdown a:last-of-type {
758
+ .ui.clearable.dropdown .text:not(.default),
759
+ .ui.clearable.dropdown:not(.search) > .ui.label:last-of-type {
760
760
  margin-right: 1.5em;
761
761
  }
762
762
  .ui.dropdown select.noselection ~ .remove.icon,
763
763
  .ui.dropdown input[value=""] ~ .remove.icon,
764
- .ui.dropdown input:not([value]) ~ .remove.icon,
764
+ .ui.dropdown input:not([value]):not(.search) ~ .remove.icon,
765
765
  .ui.dropdown.loading > .remove.icon {
766
766
  display: none;
767
767
  }
@@ -860,6 +860,9 @@ select.ui.dropdown {
860
860
  margin: 0.45238095em 0 0.45238095em 0.64285714em;
861
861
  line-height: 1.21428571em;
862
862
  }
863
+ .ui.multiple.search.dropdown > .text.default {
864
+ z-index: -1;
865
+ }
863
866
  .ui.multiple.search.dropdown > .label ~ .text {
864
867
  display: none;
865
868
  }
@@ -1789,32 +1792,32 @@ select.ui.dropdown {
1789
1792
  .ui.dropdown .menu > .item {
1790
1793
  font-size: 1rem;
1791
1794
  }
1792
- .ui.mini.dropdown,
1793
- .ui.mini.dropdown .menu > .item {
1795
+ .ui.ui.mini.dropdown,
1796
+ .ui.ui.mini.dropdown .menu > .item {
1794
1797
  font-size: 0.78571429rem;
1795
1798
  }
1796
- .ui.tiny.dropdown,
1797
- .ui.tiny.dropdown .menu > .item {
1799
+ .ui.ui.tiny.dropdown,
1800
+ .ui.ui.tiny.dropdown .menu > .item {
1798
1801
  font-size: 0.85714286rem;
1799
1802
  }
1800
- .ui.small.dropdown,
1801
- .ui.small.dropdown .menu > .item {
1803
+ .ui.ui.small.dropdown,
1804
+ .ui.ui.small.dropdown .menu > .item {
1802
1805
  font-size: 0.92857143rem;
1803
1806
  }
1804
- .ui.large.dropdown,
1805
- .ui.large.dropdown .menu > .item {
1807
+ .ui.ui.large.dropdown,
1808
+ .ui.ui.large.dropdown .menu > .item {
1806
1809
  font-size: 1.14285714rem;
1807
1810
  }
1808
- .ui.big.dropdown,
1809
- .ui.big.dropdown .menu > .item {
1811
+ .ui.ui.big.dropdown,
1812
+ .ui.ui.big.dropdown .menu > .item {
1810
1813
  font-size: 1.28571429rem;
1811
1814
  }
1812
- .ui.huge.dropdown,
1813
- .ui.huge.dropdown .menu > .item {
1815
+ .ui.ui.huge.dropdown,
1816
+ .ui.ui.huge.dropdown .menu > .item {
1814
1817
  font-size: 1.42857143rem;
1815
1818
  }
1816
- .ui.massive.dropdown,
1817
- .ui.massive.dropdown .menu > .item {
1819
+ .ui.ui.massive.dropdown,
1820
+ .ui.ui.massive.dropdown .menu > .item {
1818
1821
  font-size: 1.71428571rem;
1819
1822
  }
1820
1823
 
@@ -1909,7 +1912,7 @@ select.ui.dropdown {
1909
1912
  opacity: 0.45;
1910
1913
  }
1911
1914
  .ui.inverted.active.search.dropdown input.search:focus + .text {
1912
- color: rgba(255, 255, 255, 0.7) !important;
1915
+ color: rgba(255, 255, 255, 0.7);
1913
1916
  }
1914
1917
  .ui.dropdown .inverted.menu > .message:not(.ui),
1915
1918
  .ui.inverted.dropdown .menu > .message:not(.ui) {
@@ -1976,9 +1979,14 @@ select.ui.dropdown {
1976
1979
  scrollbar-shadow-color: #656565;
1977
1980
  scrollbar-track-color: #323232;
1978
1981
  scrollbar-arrow-color: #323232;
1979
-
1982
+ }
1983
+ @supports (-moz-appearance: none) {
1984
+ .ui.dropdown .inverted.menu,
1985
+ .ui.inverted.dropdown .menu {
1986
+
1980
1987
  /* firefox: first color thumb, second track */
1981
- scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.1);
1988
+ scrollbar-color: rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.1);
1989
+ }
1982
1990
  }
1983
1991
  .ui.pointing.dropdown > .inverted.menu::after,
1984
1992
  .ui.inverted.pointing.dropdown > .menu::after {
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.4-beta.7+74bca06 - Dropdown
2
+ * # Fomantic-UI 2.9.4-beta.70+6ca9e03 - Dropdown
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -126,6 +126,8 @@
126
126
  module.set.initialLoad();
127
127
  module.change.values(settings.values);
128
128
  module.remove.initialLoad();
129
+ } else if (module.get.placeholderText() !== '') {
130
+ module.set.placeholderText();
129
131
  }
130
132
 
131
133
  module.refreshData();
@@ -793,7 +795,7 @@
793
795
  }
794
796
  if (module.is.multiple()) {
795
797
  $.each(preSelected, function (index, value) {
796
- $item.filter('[data-value="' + value + '"]')
798
+ $item.filter('[data-' + metadata.value + '="' + value + '"]')
797
799
  .addClass(className.filtered)
798
800
  ;
799
801
  });
@@ -890,11 +892,13 @@
890
892
  ? query
891
893
  : module.get.query()
892
894
  ),
893
- results = null,
894
- escapedTerm = module.escape.string(searchTerm),
895
- regExpFlags = (settings.ignoreSearchCase ? 'i' : '') + 'gm',
895
+ results = null,
896
+ escapedTerm = module.escape.string(searchTerm),
897
+ regExpIgnore = settings.ignoreSearchCase ? 'i' : '',
898
+ regExpFlags = regExpIgnore + 'gm',
896
899
  beginsWithRegExp = new RegExp('^' + escapedTerm, regExpFlags)
897
900
  ;
901
+ module.remove.filteredItem();
898
902
  // avoid loop if we're matching nothing
899
903
  if (module.has.query()) {
900
904
  results = [];
@@ -938,12 +942,34 @@
938
942
  ;
939
943
  }
940
944
  module.debug('Showing only matched items', searchTerm);
941
- module.remove.filteredItem();
942
945
  if (results) {
943
946
  $item
944
947
  .not(results)
945
948
  .addClass(className.filtered)
946
949
  ;
950
+ if (settings.highlightMatches && (settings.match === 'both' || settings.match === 'text')) {
951
+ var querySplit = query.split(''),
952
+ diacriticReg = settings.ignoreDiacritics ? '[\u0300-\u036F]?' : '',
953
+ htmlReg = '(?![^<]*>)',
954
+ markedRegExp = new RegExp(htmlReg + '(' + querySplit.join(diacriticReg + ')(.*?)' + htmlReg + '(') + diacriticReg + ')', regExpIgnore),
955
+ markedReplacer = function () {
956
+ var args = [].slice.call(arguments, 1, querySplit.length * 2).map(function (x, i) {
957
+ return i & 1 ? x : '<mark>' + x + '</mark>'; // eslint-disable-line no-bitwise
958
+ });
959
+
960
+ return args.join('');
961
+ }
962
+ ;
963
+ $.each(results, function (index, result) {
964
+ var $result = $(result),
965
+ markedHTML = module.get.choiceText($result, true)
966
+ ;
967
+ if (settings.ignoreDiacritics) {
968
+ markedHTML = markedHTML.normalize('NFD');
969
+ }
970
+ $result.html(markedHTML.replace(markedRegExp, markedReplacer));
971
+ });
972
+ }
947
973
  }
948
974
 
949
975
  if (!module.has.query()) {
@@ -979,8 +1005,10 @@
979
1005
  termLength = term.length,
980
1006
  queryLength = query.length
981
1007
  ;
982
- query = settings.ignoreSearchCase ? query.toLowerCase() : query;
983
- term = settings.ignoreSearchCase ? term.toLowerCase() : term;
1008
+ if (settings.ignoreSearchCase) {
1009
+ query = query.toLowerCase();
1010
+ term = term.toLowerCase();
1011
+ }
984
1012
  if (queryLength > termLength) {
985
1013
  return false;
986
1014
  }
@@ -1187,7 +1215,7 @@
1187
1215
  if (!itemActivated && !pageLostFocus) {
1188
1216
  if (settings.forceSelection) {
1189
1217
  module.forceSelection();
1190
- } else if (!settings.allowAdditions) {
1218
+ } else if (!settings.allowAdditions && !settings.keepSearchTerm && !module.has.menuSearch()) {
1191
1219
  module.remove.searchTerm();
1192
1220
  }
1193
1221
  module.hide();
@@ -1236,7 +1264,9 @@
1236
1264
  module.set.filtered();
1237
1265
  }
1238
1266
  clearTimeout(module.timer);
1239
- module.timer = setTimeout(function () { module.search(); }, settings.delay.search);
1267
+ module.timer = setTimeout(function () {
1268
+ module.search();
1269
+ }, settings.delay.search);
1240
1270
  },
1241
1271
  label: {
1242
1272
  click: function (event) {
@@ -1413,7 +1443,9 @@
1413
1443
  module.remove.userAddition();
1414
1444
  }
1415
1445
  if (!settings.keepSearchTerm) {
1416
- module.remove.filteredItem();
1446
+ if (module.is.multiple()) {
1447
+ module.remove.filteredItem();
1448
+ }
1417
1449
  module.remove.searchTerm();
1418
1450
  }
1419
1451
  if (!module.is.visible() && $target.length > 0) {
@@ -2587,7 +2619,7 @@
2587
2619
  } else {
2588
2620
  $combo.text(text);
2589
2621
  }
2590
- } else if (settings.action === 'activate') {
2622
+ } else if (settings.action === 'activate' || isFunction(settings.action)) {
2591
2623
  if (text !== module.get.placeholderText() || isNotPlaceholder) {
2592
2624
  $text.removeClass(className.placeholder);
2593
2625
  }
@@ -2647,7 +2679,7 @@
2647
2679
  module.set.scrollPosition($nextValue);
2648
2680
  $selectedItem.removeClass(className.selected);
2649
2681
  $nextValue.addClass(className.selected);
2650
- if (settings.selectOnKeydown && module.is.single() && !$nextItem.hasClass(className.actionable)) {
2682
+ if (settings.selectOnKeydown && module.is.single() && (!$nextItem || !$nextItem.hasClass(className.actionable))) {
2651
2683
  module.set.selectedItem($nextValue);
2652
2684
  }
2653
2685
  }
@@ -2768,19 +2800,27 @@
2768
2800
  $selectedItem = settings.allowAdditions
2769
2801
  ? $selectedItem || module.get.itemWithAdditions(value)
2770
2802
  : $selectedItem || module.get.item(value);
2771
- if (!$selectedItem) {
2803
+ if (!$selectedItem && value !== undefined) {
2772
2804
  return false;
2773
2805
  }
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()) {
2806
+ if (isMultiple) {
2807
+ if (!keepSearchTerm) {
2808
+ module.remove.searchWidth();
2809
+ }
2810
+ if (settings.useLabels) {
2811
+ module.remove.selectedItem();
2812
+ if (value === undefined) {
2813
+ module.remove.labels($module.find(selector.label), true);
2814
+ }
2815
+ }
2816
+ } else {
2779
2817
  module.remove.activeItem();
2780
2818
  module.remove.selectedItem();
2781
- } else if (settings.useLabels) {
2782
- module.remove.selectedItem();
2783
2819
  }
2820
+ if (!$selectedItem) {
2821
+ return false;
2822
+ }
2823
+ module.debug('Setting selected menu item to', $selectedItem);
2784
2824
  // select each item
2785
2825
  $selectedItem
2786
2826
  .each(function () {
@@ -3080,6 +3120,12 @@
3080
3120
  $item.removeClass(className.active);
3081
3121
  },
3082
3122
  filteredItem: function () {
3123
+ if (settings.highlightMatches) {
3124
+ $.each($item, function (index, item) {
3125
+ var $markItem = $(item);
3126
+ $markItem.html($markItem.html().replace(/<\/?mark>/g, ''));
3127
+ });
3128
+ }
3083
3129
  if (settings.useLabels && module.has.maxSelections()) {
3084
3130
  return;
3085
3131
  }
@@ -3424,7 +3470,12 @@
3424
3470
  return $selectedMenu.hasClass(className.leftward);
3425
3471
  },
3426
3472
  clearable: function () {
3427
- return $module.hasClass(className.clearable) || settings.clearable;
3473
+ var hasClearableClass = $module.hasClass(className.clearable);
3474
+ if (!hasClearableClass && settings.clearable) {
3475
+ $module.addClass(className.clearable);
3476
+ }
3477
+
3478
+ return hasClearableClass || settings.clearable;
3428
3479
  },
3429
3480
  disabled: function () {
3430
3481
  return $module.hasClass(className.disabled);
@@ -3747,12 +3798,16 @@
3747
3798
  show: function () {
3748
3799
  module.verbose('Delaying show event to ensure user intent');
3749
3800
  clearTimeout(module.timer);
3750
- module.timer = setTimeout(function () { module.show(); }, settings.delay.show);
3801
+ module.timer = setTimeout(function () {
3802
+ module.show();
3803
+ }, settings.delay.show);
3751
3804
  },
3752
3805
  hide: function () {
3753
3806
  module.verbose('Delaying hide event to ensure user intent');
3754
3807
  clearTimeout(module.timer);
3755
- module.timer = setTimeout(function () { module.hide(); }, settings.delay.hide);
3808
+ module.timer = setTimeout(function () {
3809
+ module.hide();
3810
+ }, settings.delay.hide);
3756
3811
  },
3757
3812
  },
3758
3813
 
@@ -3785,6 +3840,7 @@
3785
3840
  return text.replace(regExp.escape, '\\$&');
3786
3841
  },
3787
3842
  htmlEntities: function (string, forceAmpersand) {
3843
+ forceAmpersand = typeof forceAmpersand === 'number' ? false : forceAmpersand;
3788
3844
  var
3789
3845
  badChars = /["'<>`]/g,
3790
3846
  shouldEscape = /["&'<>`]/,
@@ -3801,8 +3857,7 @@
3801
3857
  ;
3802
3858
  if (shouldEscape.test(string)) {
3803
3859
  string = string.replace(forceAmpersand ? /&/g : /&(?![\d#a-z]{1,12};)/gi, '&amp;');
3804
-
3805
- return string.replace(badChars, escapedChar);
3860
+ string = string.replace(badChars, escapedChar);
3806
3861
  }
3807
3862
 
3808
3863
  return string;
@@ -3878,7 +3933,9 @@
3878
3933
  });
3879
3934
  }
3880
3935
  clearTimeout(module.performance.timer);
3881
- module.performance.timer = setTimeout(function () { module.performance.display(); }, 500);
3936
+ module.performance.timer = setTimeout(function () {
3937
+ module.performance.display();
3938
+ }, 500);
3882
3939
  },
3883
3940
  display: function () {
3884
3941
  var
@@ -4005,6 +4062,7 @@
4005
4062
 
4006
4063
  match: 'both', // what to match against with search selection (both, text, or label)
4007
4064
  fullTextSearch: 'exact', // search anywhere in value (set to 'exact' to require exact matches)
4065
+ highlightMatches: false, // Whether search result should highlight matching strings
4008
4066
  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
4067
  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
4068
 
@@ -4120,9 +4178,11 @@
4120
4178
  descriptionVertical: 'descriptionVertical', // whether description should be vertical
4121
4179
  value: 'value', // actual dropdown value
4122
4180
  text: 'text', // displayed text when selected
4181
+ data: 'data', // custom data attributes
4123
4182
  type: 'type', // type of dropdown element
4124
4183
  image: 'image', // optional image path
4125
4184
  imageClass: 'imageClass', // optional individual class for image
4185
+ alt: 'alt', // optional alt text for image
4126
4186
  icon: 'icon', // optional icon name
4127
4187
  iconClass: 'iconClass', // optional individual class for icon (for example to use flag instead)
4128
4188
  class: 'class', // optional individual class for item/header
@@ -4229,8 +4289,7 @@
4229
4289
  ;
4230
4290
  if (shouldEscape.test(string)) {
4231
4291
  string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&amp;');
4232
-
4233
- return string.replace(badChars, escapedChar);
4292
+ string = string.replace(badChars, escapedChar);
4234
4293
  }
4235
4294
 
4236
4295
  return string;
@@ -4265,9 +4324,21 @@
4265
4324
  $.each(values, function (index, option) {
4266
4325
  var
4267
4326
  itemType = option[fields.type] || 'item',
4268
- isMenu = itemType.indexOf('menu') !== -1
4327
+ isMenu = itemType.indexOf('menu') !== -1,
4328
+ maybeData = '',
4329
+ dataObject = option[fields.data]
4269
4330
  ;
4270
-
4331
+ if (dataObject) {
4332
+ var dataKey,
4333
+ dataKeyEscaped
4334
+ ;
4335
+ for (dataKey in dataObject) {
4336
+ dataKeyEscaped = String(dataKey).replace(/\W/g, '');
4337
+ if (Object.prototype.hasOwnProperty.call(dataObject, dataKey) && ['text', 'value'].indexOf(dataKeyEscaped.toLowerCase()) === -1) {
4338
+ maybeData += ' data-' + dataKeyEscaped + '="' + deQuote(String(dataObject[dataKey])) + '"';
4339
+ }
4340
+ }
4341
+ }
4271
4342
  if (itemType === 'item' || isMenu) {
4272
4343
  var
4273
4344
  maybeText = option[fields.text]
@@ -4284,12 +4355,12 @@
4284
4355
  : '',
4285
4356
  hasDescription = escape(option[fields.description] || '', preserveHTML) !== ''
4286
4357
  ;
4287
- html += '<div class="' + deQuote(maybeActionable + maybeDisabled + maybeDescriptionVertical + (option[fields.class] || className.item)) + '" data-value="' + deQuote(option[fields.value], true) + '"' + maybeText + '>';
4358
+ html += '<div class="' + deQuote(maybeActionable + maybeDisabled + maybeDescriptionVertical + (option[fields.class] || className.item)) + '" data-value="' + deQuote(option[fields.value], true) + '"' + maybeText + maybeData + '>';
4288
4359
  if (isMenu) {
4289
4360
  html += '<i class="' + (itemType.indexOf('left') !== -1 ? 'left' : '') + ' dropdown icon"></i>';
4290
4361
  }
4291
4362
  if (option[fields.image]) {
4292
- html += '<img class="' + deQuote(option[fields.imageClass] || className.image) + '" src="' + deQuote(option[fields.image]) + '">';
4363
+ html += '<img class="' + deQuote(option[fields.imageClass] || className.image) + '" src="' + deQuote(option[fields.image]) + (option[fields.alt] ? '" alt="' + deQuote(option[fields.alt]) : '') + '">';
4293
4364
  }
4294
4365
  if (option[fields.icon]) {
4295
4366
  html += '<i class="' + deQuote(option[fields.icon] + ' ' + (option[fields.iconClass] || className.icon)) + '"></i>';