fomantic-ui 2.9.0-beta.2 → 2.9.0-beta.202

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 (243) hide show
  1. package/.all-contributorsrc +197 -3
  2. package/CONTRIBUTING.md +1 -1
  3. package/CONTRIBUTORS.md +74 -37
  4. package/README.md +1 -1
  5. package/dist/components/accordion.css +162 -26
  6. package/dist/components/accordion.js +1 -1
  7. package/dist/components/accordion.min.css +2 -2
  8. package/dist/components/accordion.min.js +2 -2
  9. package/dist/components/ad.css +1 -1
  10. package/dist/components/ad.min.css +1 -1
  11. package/dist/components/api.js +30 -26
  12. package/dist/components/api.min.js +3 -3
  13. package/dist/components/breadcrumb.css +1 -1
  14. package/dist/components/breadcrumb.min.css +1 -1
  15. package/dist/components/button.css +81 -81
  16. package/dist/components/button.min.css +2 -2
  17. package/dist/components/calendar.css +1 -1
  18. package/dist/components/calendar.js +110 -11
  19. package/dist/components/calendar.min.css +1 -1
  20. package/dist/components/calendar.min.js +3 -3
  21. package/dist/components/card.css +26 -19
  22. package/dist/components/card.min.css +2 -2
  23. package/dist/components/checkbox.css +2 -1
  24. package/dist/components/checkbox.js +17 -11
  25. package/dist/components/checkbox.min.css +2 -2
  26. package/dist/components/checkbox.min.js +3 -3
  27. package/dist/components/comment.css +11 -11
  28. package/dist/components/comment.min.css +1 -1
  29. package/dist/components/container.css +77 -1
  30. package/dist/components/container.min.css +2 -2
  31. package/dist/components/dimmer.css +28 -14
  32. package/dist/components/dimmer.js +7 -1
  33. package/dist/components/dimmer.min.css +2 -2
  34. package/dist/components/dimmer.min.js +3 -3
  35. package/dist/components/divider.css +1 -1
  36. package/dist/components/divider.min.css +1 -1
  37. package/dist/components/dropdown.css +30 -7
  38. package/dist/components/dropdown.js +59 -34
  39. package/dist/components/dropdown.min.css +2 -2
  40. package/dist/components/dropdown.min.js +3 -3
  41. package/dist/components/embed.css +1 -1
  42. package/dist/components/embed.js +1 -1
  43. package/dist/components/embed.min.css +1 -1
  44. package/dist/components/embed.min.js +2 -2
  45. package/dist/components/emoji.css +2 -2
  46. package/dist/components/feed.css +28 -28
  47. package/dist/components/feed.min.css +2 -2
  48. package/dist/components/flag.css +731 -625
  49. package/dist/components/flag.min.css +2 -2
  50. package/dist/components/form.css +106 -55
  51. package/dist/components/form.js +25 -23
  52. package/dist/components/form.min.css +2 -2
  53. package/dist/components/form.min.js +3 -3
  54. package/dist/components/grid.css +11 -8
  55. package/dist/components/grid.min.css +2 -2
  56. package/dist/components/header.css +1 -1
  57. package/dist/components/header.min.css +1 -1
  58. package/dist/components/icon.css +6 -1
  59. package/dist/components/icon.min.css +2 -2
  60. package/dist/components/image.css +1 -1
  61. package/dist/components/image.min.css +1 -1
  62. package/dist/components/input.css +734 -17
  63. package/dist/components/input.min.css +2 -2
  64. package/dist/components/item.css +13 -13
  65. package/dist/components/item.min.css +1 -1
  66. package/dist/components/label.css +1 -1
  67. package/dist/components/label.min.css +1 -1
  68. package/dist/components/list.css +1 -1
  69. package/dist/components/list.min.css +1 -1
  70. package/dist/components/loader.css +1 -1
  71. package/dist/components/loader.min.css +1 -1
  72. package/dist/components/menu.css +31 -7
  73. package/dist/components/menu.min.css +1 -1
  74. package/dist/components/message.css +41 -41
  75. package/dist/components/message.min.css +2 -2
  76. package/dist/components/modal.css +13 -1
  77. package/dist/components/modal.js +121 -46
  78. package/dist/components/modal.min.css +2 -2
  79. package/dist/components/modal.min.js +3 -3
  80. package/dist/components/nag.css +1 -1
  81. package/dist/components/nag.js +1 -1
  82. package/dist/components/nag.min.css +1 -1
  83. package/dist/components/nag.min.js +2 -2
  84. package/dist/components/placeholder.css +1 -1
  85. package/dist/components/placeholder.min.css +1 -1
  86. package/dist/components/popup.css +5 -3
  87. package/dist/components/popup.js +1 -1
  88. package/dist/components/popup.min.css +2 -2
  89. package/dist/components/popup.min.js +2 -2
  90. package/dist/components/progress.css +1 -1
  91. package/dist/components/progress.js +6 -3
  92. package/dist/components/progress.min.css +1 -1
  93. package/dist/components/progress.min.js +3 -3
  94. package/dist/components/rail.css +1 -1
  95. package/dist/components/rail.min.css +1 -1
  96. package/dist/components/rating.css +7 -46
  97. package/dist/components/rating.js +1 -1
  98. package/dist/components/rating.min.css +2 -2
  99. package/dist/components/rating.min.js +2 -2
  100. package/dist/components/reset.css +1 -1
  101. package/dist/components/reset.min.css +1 -1
  102. package/dist/components/reveal.css +1 -1
  103. package/dist/components/reveal.min.css +1 -1
  104. package/dist/components/search.css +1 -1
  105. package/dist/components/search.js +1 -1
  106. package/dist/components/search.min.css +1 -1
  107. package/dist/components/search.min.js +2 -2
  108. package/dist/components/segment.css +90 -6
  109. package/dist/components/segment.min.css +2 -2
  110. package/dist/components/shape.css +1 -1
  111. package/dist/components/shape.js +1 -1
  112. package/dist/components/shape.min.css +1 -1
  113. package/dist/components/shape.min.js +2 -2
  114. package/dist/components/sidebar.css +4 -2
  115. package/dist/components/sidebar.js +1 -1
  116. package/dist/components/sidebar.min.css +2 -2
  117. package/dist/components/sidebar.min.js +2 -2
  118. package/dist/components/site.css +61 -39
  119. package/dist/components/site.js +1 -1
  120. package/dist/components/site.min.css +2 -2
  121. package/dist/components/site.min.js +2 -2
  122. package/dist/components/slider.js +1 -1
  123. package/dist/components/slider.min.js +2 -2
  124. package/dist/components/state.js +1 -1
  125. package/dist/components/state.min.js +2 -2
  126. package/dist/components/statistic.css +1 -1
  127. package/dist/components/statistic.min.css +1 -1
  128. package/dist/components/step.css +4 -4
  129. package/dist/components/step.min.css +2 -2
  130. package/dist/components/sticky.css +1 -1
  131. package/dist/components/sticky.js +2 -2
  132. package/dist/components/sticky.min.css +1 -1
  133. package/dist/components/sticky.min.js +3 -3
  134. package/dist/components/tab.css +1 -1
  135. package/dist/components/tab.js +23 -5
  136. package/dist/components/tab.min.css +1 -1
  137. package/dist/components/tab.min.js +3 -3
  138. package/dist/components/table.css +1168 -26
  139. package/dist/components/table.min.css +2 -2
  140. package/dist/components/text.css +1 -1
  141. package/dist/components/text.min.css +1 -1
  142. package/dist/components/toast.css +45 -1
  143. package/dist/components/toast.js +56 -28
  144. package/dist/components/toast.min.css +2 -2
  145. package/dist/components/toast.min.js +3 -3
  146. package/dist/components/transition.css +1 -1
  147. package/dist/components/transition.js +2 -2
  148. package/dist/components/transition.min.css +1 -1
  149. package/dist/components/transition.min.js +3 -3
  150. package/dist/components/visibility.js +2 -2
  151. package/dist/components/visibility.min.js +2 -2
  152. package/dist/semantic.css +4300 -1394
  153. package/dist/semantic.js +473 -207
  154. package/dist/semantic.min.css +3 -3
  155. package/dist/semantic.min.js +3 -3
  156. package/examples/assets/library/iframe-content.js +8 -8
  157. package/examples/assets/library/iframe.js +3 -3
  158. package/package.json +2 -2
  159. package/src/definitions/behaviors/api.js +29 -25
  160. package/src/definitions/behaviors/form.js +24 -22
  161. package/src/definitions/behaviors/visibility.js +1 -1
  162. package/src/definitions/collections/form.less +193 -140
  163. package/src/definitions/collections/grid.less +716 -680
  164. package/src/definitions/collections/menu.less +174 -127
  165. package/src/definitions/collections/message.less +48 -46
  166. package/src/definitions/collections/table.less +849 -262
  167. package/src/definitions/elements/button.less +360 -347
  168. package/src/definitions/elements/container.less +126 -8
  169. package/src/definitions/elements/emoji.less +15 -9
  170. package/src/definitions/elements/flag.less +7 -17
  171. package/src/definitions/elements/header.less +42 -35
  172. package/src/definitions/elements/icon.less +38 -31
  173. package/src/definitions/elements/input.less +256 -21
  174. package/src/definitions/elements/label.less +92 -91
  175. package/src/definitions/elements/list.less +55 -45
  176. package/src/definitions/elements/loader.less +30 -29
  177. package/src/definitions/elements/segment.less +146 -27
  178. package/src/definitions/elements/step.less +52 -48
  179. package/src/definitions/elements/text.less +17 -15
  180. package/src/definitions/globals/site.less +23 -2
  181. package/src/definitions/modules/accordion.less +175 -24
  182. package/src/definitions/modules/calendar.js +109 -10
  183. package/src/definitions/modules/checkbox.js +16 -10
  184. package/src/definitions/modules/checkbox.less +34 -178
  185. package/src/definitions/modules/dimmer.js +6 -0
  186. package/src/definitions/modules/dimmer.less +21 -8
  187. package/src/definitions/modules/dropdown.js +58 -33
  188. package/src/definitions/modules/dropdown.less +101 -69
  189. package/src/definitions/modules/modal.js +120 -45
  190. package/src/definitions/modules/modal.less +12 -0
  191. package/src/definitions/modules/nag.less +20 -19
  192. package/src/definitions/modules/popup.less +5 -1
  193. package/src/definitions/modules/progress.js +5 -2
  194. package/src/definitions/modules/progress.less +19 -18
  195. package/src/definitions/modules/rating.less +49 -42
  196. package/src/definitions/modules/search.less +32 -16
  197. package/src/definitions/modules/sidebar.less +33 -19
  198. package/src/definitions/modules/slider.less +39 -38
  199. package/src/definitions/modules/sticky.js +1 -1
  200. package/src/definitions/modules/tab.js +22 -4
  201. package/src/definitions/modules/toast.js +55 -27
  202. package/src/definitions/modules/toast.less +53 -16
  203. package/src/definitions/modules/transition.js +1 -1
  204. package/src/definitions/views/card.less +402 -361
  205. package/src/definitions/views/comment.less +92 -81
  206. package/src/definitions/views/feed.less +164 -144
  207. package/src/definitions/views/item.less +249 -196
  208. package/src/definitions/views/statistic.less +90 -88
  209. package/src/themes/bookish/elements/header.overrides +1 -1
  210. package/src/themes/chubby/elements/button.overrides +1 -1
  211. package/src/themes/chubby/elements/header.overrides +1 -1
  212. package/src/themes/default/collections/menu.variables +6 -0
  213. package/src/themes/default/collections/table.variables +52 -0
  214. package/src/themes/default/elements/button.variables +2 -1
  215. package/src/themes/default/elements/container.variables +8 -0
  216. package/src/themes/default/elements/flag.overrides +1635 -986
  217. package/src/themes/default/elements/flag.variables +7 -5
  218. package/src/themes/default/elements/icon.overrides +35 -28
  219. package/src/themes/default/elements/icon.variables +1 -0
  220. package/src/themes/default/elements/input.variables +15 -0
  221. package/src/themes/default/elements/segment.variables +8 -0
  222. package/src/themes/default/elements/step.overrides +1 -1
  223. package/src/themes/default/globals/site.variables +6 -0
  224. package/src/themes/default/globals/variation.variables +135 -6
  225. package/src/themes/default/modules/accordion.variables +49 -2
  226. package/src/themes/default/modules/checkbox.variables +5 -5
  227. package/src/themes/default/modules/dimmer.variables +1 -1
  228. package/src/themes/default/modules/dropdown.variables +1 -1
  229. package/src/themes/default/modules/modal.variables +13 -0
  230. package/src/themes/default/modules/toast.variables +3 -0
  231. package/src/themes/famfamfam/elements/flag.overrides +1026 -0
  232. package/src/themes/famfamfam/elements/flag.variables +13 -0
  233. package/src/themes/instagram/views/card.overrides +1 -1
  234. package/src/themes/material/collections/menu.overrides +1 -1
  235. package/src/themes/material/elements/button.overrides +1 -1
  236. package/src/themes/material/elements/header.overrides +1 -1
  237. package/src/themes/material/modules/dropdown.overrides +1 -1
  238. package/src/themes/material/modules/modal.overrides +1 -1
  239. package/src/themes/rtl/globals/site.overrides +1 -1
  240. package/tasks/admin/components/init.js +2 -2
  241. package/tasks/admin/distributions/init.js +2 -2
  242. package/tasks/build/css.js +6 -1
  243. package/test/helpers/sinon.js +1 -1
@@ -128,7 +128,7 @@
128
128
  font-size: @itemFontSize;
129
129
  color: @itemColor;
130
130
 
131
- padding: @itemPadding !important;
131
+ padding: @itemPadding;
132
132
  text-transform: @itemTextTransform;
133
133
  font-weight: @itemFontWeight;
134
134
  box-shadow: @itemBoxShadow;
@@ -367,9 +367,15 @@
367
367
  .ui.dropdown.icon.button > .dropdown.icon {
368
368
  margin: 0;
369
369
  }
370
- .ui.button.dropdown .menu {
370
+ .ui.dropdown.button .menu {
371
371
  min-width: 100%;
372
372
  }
373
+ .ui.dropdown.button:not(.pointing):not(.floating).active {
374
+ border-radius: @borderRadius @borderRadius 0 0;
375
+ }
376
+ .ui.dropdown.button:not(.pointing):not(.floating) > .menu {
377
+ border-radius: 0 0 @borderRadius @borderRadius;
378
+ }
373
379
  }
374
380
 
375
381
 
@@ -556,7 +562,7 @@ select.ui.dropdown {
556
562
  /* Menu Item */
557
563
  .ui.selection.dropdown .menu > .item {
558
564
  border-top: @selectionItemDivider;
559
- padding: @selectionItemPadding !important;
565
+ padding: @selectionItemPadding;
560
566
  white-space: normal;
561
567
  word-wrap: normal;
562
568
  }
@@ -1073,12 +1079,12 @@ select.ui.dropdown {
1073
1079
  display: none !important;
1074
1080
  }
1075
1081
 
1076
- & when (@variationDropdownStates) {
1082
+ & when not (@variationDropdownStates = false) {
1077
1083
  /*--------------------
1078
1084
  States
1079
1085
  ----------------------*/
1080
- each(@formStates, {
1081
- @state: replace(@key, '@', '');
1086
+ each(@variationDropdownStates, {
1087
+ @state: @value;
1082
1088
  @c: @formStates[@@state][dropdownLabelColor];
1083
1089
  @bdc: @formStates[@@state][borderColor];
1084
1090
 
@@ -1228,7 +1234,6 @@ select.ui.dropdown {
1228
1234
  top: auto;
1229
1235
  bottom: 100%;
1230
1236
  box-shadow: @upwardMenuBoxShadow;
1231
- border-radius: @upwardMenuBorderRadius;
1232
1237
  }
1233
1238
 
1234
1239
  /* Upward Sub Menu */
@@ -1237,42 +1242,54 @@ select.ui.dropdown {
1237
1242
  bottom: 0 !important;
1238
1243
  }
1239
1244
 
1240
- /* Active Upward */
1241
- .ui.simple.upward.active.dropdown,
1242
- .ui.simple.upward.dropdown:hover {
1243
- border-radius: @borderRadius @borderRadius 0 0 !important;
1244
- }
1245
- .ui.upward.dropdown.button:not(.pointing):not(.floating).active {
1246
- border-radius: @borderRadius @borderRadius 0 0;
1245
+ & when (@variationDropdownSimple) {
1246
+ /* Active Upward */
1247
+ .ui.simple.upward.active.dropdown,
1248
+ .ui.simple.upward.dropdown:hover {
1249
+ border-radius: @borderRadius @borderRadius 0 0 !important;
1250
+ }
1247
1251
  }
1248
1252
 
1249
- /* Selection */
1250
- .ui.upward.selection.dropdown .menu {
1251
- border-top-width: @menuBorderWidth !important;
1252
- border-bottom-width: 0 !important;
1253
- box-shadow: @upwardSelectionMenuBoxShadow;
1254
- }
1255
- .ui.upward.selection.dropdown:hover {
1256
- box-shadow: @upwardSelectionHoverBoxShadow;
1253
+ & when (@variationDropdownButton) {
1254
+ /* Button */
1255
+ .ui.upward.dropdown.button:not(.pointing):not(.floating).active {
1256
+ border-radius: 0 0 @borderRadius @borderRadius;
1257
+ }
1258
+ .ui.upward.dropdown.button:not(.pointing):not(.floating) > .menu {
1259
+ border-radius: @borderRadius @borderRadius 0 0;
1260
+ }
1257
1261
  }
1258
1262
 
1259
- /* Active Upward */
1260
- .ui.active.upward.selection.dropdown {
1261
- border-radius: @upwardSelectionVisibleBorderRadius !important;
1262
- }
1263
+ & when (@variationDropdownSelection) {
1264
+ /* Selection */
1265
+ .ui.upward.selection.dropdown .menu {
1266
+ border-top-width: @menuBorderWidth !important;
1267
+ border-bottom-width: 0 !important;
1268
+ box-shadow: @upwardSelectionMenuBoxShadow;
1269
+ border-radius: @upwardSelectionMenuBorderRadius;
1270
+ }
1271
+ .ui.upward.selection.dropdown:hover {
1272
+ box-shadow: @upwardSelectionHoverBoxShadow;
1273
+ }
1263
1274
 
1264
- /* Visible Upward */
1265
- .ui.upward.selection.dropdown.visible {
1266
- box-shadow: @upwardSelectionVisibleBoxShadow;
1267
- border-radius: @upwardSelectionVisibleBorderRadius !important;
1268
- }
1275
+ /* Active Upward */
1276
+ .ui.active.upward.selection.dropdown {
1277
+ border-radius: @upwardSelectionVisibleBorderRadius !important;
1278
+ }
1269
1279
 
1270
- /* Visible Hover Upward */
1271
- .ui.upward.active.selection.dropdown:hover {
1272
- box-shadow: @upwardSelectionActiveHoverBoxShadow;
1273
- }
1274
- .ui.upward.active.selection.dropdown:hover .menu {
1275
- box-shadow: @upwardSelectionActiveHoverMenuBoxShadow;
1280
+ /* Visible Upward */
1281
+ .ui.upward.selection.dropdown.visible {
1282
+ box-shadow: @upwardSelectionVisibleBoxShadow;
1283
+ border-radius: @upwardSelectionVisibleBorderRadius !important;
1284
+ }
1285
+
1286
+ /* Visible Hover Upward */
1287
+ .ui.upward.active.selection.dropdown:hover {
1288
+ box-shadow: @upwardSelectionActiveHoverBoxShadow;
1289
+ }
1290
+ .ui.upward.active.selection.dropdown:hover .menu {
1291
+ box-shadow: @upwardSelectionActiveHoverMenuBoxShadow;
1292
+ }
1276
1293
  }
1277
1294
  }
1278
1295
 
@@ -1378,23 +1395,25 @@ select.ui.dropdown {
1378
1395
  }
1379
1396
  }
1380
1397
 
1381
- /*--------------
1382
- Columnar
1383
- ---------------*/
1384
- .ui.column.dropdown > .menu {
1385
- flex-wrap:wrap;
1386
- }
1387
- .ui.dropdown[class*="two column"] > .menu > .item {
1388
- width: 50%;
1389
- }
1390
- .ui.dropdown[class*="three column"] > .menu > .item {
1391
- width: 33%;
1392
- }
1393
- .ui.dropdown[class*="four column"] > .menu > .item {
1394
- width: 25%;
1395
- }
1396
- .ui.dropdown[class*="five column"] > .menu > .item {
1397
- width: 20%;
1398
+ & when (@variationDropdownColumnar) {
1399
+ /*--------------
1400
+ Columnar
1401
+ ---------------*/
1402
+ .ui.column.dropdown > .menu {
1403
+ flex-wrap: wrap;
1404
+ }
1405
+ .ui.dropdown[class*="two column"] > .menu > .item {
1406
+ width: 50%;
1407
+ }
1408
+ .ui.dropdown[class*="three column"] > .menu > .item {
1409
+ width: 33%;
1410
+ }
1411
+ .ui.dropdown[class*="four column"] > .menu > .item {
1412
+ width: 25%;
1413
+ }
1414
+ .ui.dropdown[class*="five column"] > .menu > .item {
1415
+ width: 20%;
1416
+ }
1398
1417
  }
1399
1418
 
1400
1419
  & when (@variationDropdownSimple) {
@@ -1895,21 +1914,34 @@ select.ui.dropdown {
1895
1914
  }
1896
1915
 
1897
1916
  /* Scrollbars */
1898
- .ui.dropdown .inverted.menu::-webkit-scrollbar-track,
1899
- .ui.inverted.dropdown .menu::-webkit-scrollbar-track {
1900
- background: @trackInvertedBackground;
1901
- }
1902
- .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb,
1903
- .ui.inverted.dropdown .menu::-webkit-scrollbar-thumb {
1904
- background: @thumbInvertedBackground;
1905
- }
1906
- .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:window-inactive,
1907
- .ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:window-inactive {
1908
- background: @thumbInvertedInactiveBackground;
1909
- }
1910
- .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:hover,
1911
- .ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:hover {
1912
- background: @thumbInvertedHoverBackground;
1917
+ & when (@useCustomScrollbars) {
1918
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-track,
1919
+ .ui.inverted.dropdown .menu::-webkit-scrollbar-track {
1920
+ background: @trackInvertedBackground;
1921
+ }
1922
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb,
1923
+ .ui.inverted.dropdown .menu::-webkit-scrollbar-thumb {
1924
+ background: @thumbInvertedBackground;
1925
+ }
1926
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:window-inactive,
1927
+ .ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:window-inactive {
1928
+ background: @thumbInvertedInactiveBackground;
1929
+ }
1930
+ .ui.dropdown .inverted.menu::-webkit-scrollbar-thumb:hover,
1931
+ .ui.inverted.dropdown .menu::-webkit-scrollbar-thumb:hover {
1932
+ background: @thumbInvertedHoverBackground;
1933
+ }
1934
+ .ui.dropdown .inverted.menu,
1935
+ .ui.inverted.dropdown .menu {
1936
+ /* IE11 */
1937
+ scrollbar-face-color: @thumbInvertedBackgroundHex;
1938
+ scrollbar-shadow-color: @thumbInvertedBackgroundHex;
1939
+ scrollbar-track-color: @trackInvertedBackgroundHex;
1940
+ scrollbar-arrow-color: @trackInvertedBackgroundHex;
1941
+
1942
+ /* firefox : first color thumb, second track */
1943
+ scrollbar-color: @thumbInvertedBackground @trackInvertedBackground;
1944
+ }
1913
1945
  }
1914
1946
  & when (@variationDropdownPointing) {
1915
1947
  .ui.pointing.dropdown > .inverted.menu:after,
@@ -66,7 +66,8 @@ $.fn.modal = function(parameters) {
66
66
 
67
67
  $module = $(this),
68
68
  $context = $(settings.context),
69
- $close = $module.find(selector.close),
69
+ $closeIcon = $module.find(selector.closeIcon),
70
+ $inputs,
70
71
 
71
72
  $allModals,
72
73
  $otherModals,
@@ -92,6 +93,7 @@ $.fn.modal = function(parameters) {
92
93
  module = {
93
94
 
94
95
  initialize: function() {
96
+ module.create.id();
95
97
  if(!$module.hasClass('modal')) {
96
98
  module.create.modal();
97
99
  if(!$.isFunction(settings.onHidden)) {
@@ -116,15 +118,17 @@ $.fn.modal = function(parameters) {
116
118
  $actions.empty();
117
119
  }
118
120
  settings.actions.forEach(function (el) {
119
- var icon = el[fields.icon] ? '<i class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
121
+ var icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
120
122
  text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
121
123
  cls = module.helpers.deQuote(el[fields.class] || ''),
122
124
  click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {};
123
125
  $actions.append($('<button/>', {
124
126
  html: icon + text,
127
+ 'aria-label': $('<div>'+(el[fields.text] || el[fields.icon] || '')+'</div>').text(),
125
128
  class: className.button + ' ' + cls,
126
129
  click: function () {
127
- if (click.call(element, $module) === false) {
130
+ var button = $(this);
131
+ if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
128
132
  return;
129
133
  }
130
134
  module.hide();
@@ -135,7 +139,6 @@ $.fn.modal = function(parameters) {
135
139
  module.cache = {};
136
140
  module.verbose('Initializing dimmer', $context);
137
141
 
138
- module.create.id();
139
142
  module.create.dimmer();
140
143
 
141
144
  if ( settings.allowMultiple ) {
@@ -145,11 +148,9 @@ $.fn.modal = function(parameters) {
145
148
  $module.addClass('top aligned');
146
149
  }
147
150
  module.refreshModals();
148
-
151
+ module.refreshInputs();
149
152
  module.bind.events();
150
- if(settings.observeChanges) {
151
- module.observeChanges();
152
- }
153
+ module.observeChanges();
153
154
  module.instantiate();
154
155
  if(settings.autoShow){
155
156
  module.show();
@@ -166,16 +167,20 @@ $.fn.modal = function(parameters) {
166
167
 
167
168
  create: {
168
169
  modal: function() {
169
- $module = $('<div/>', {class: className.modal});
170
+ $module = $('<div/>', {class: className.modal, role: 'dialog', 'aria-modal': true});
170
171
  if (settings.closeIcon) {
171
- $close = $('<i/>', {class: className.close})
172
- $module.append($close);
172
+ $closeIcon = $('<i/>', {class: className.close, role: 'button', tabindex: 0, 'aria-label': settings.text.close})
173
+ $module.append($closeIcon);
173
174
  }
174
175
  if (settings.title !== '') {
175
- $('<div/>', {class: className.title}).appendTo($module);
176
+ var titleId = '_' + module.get.id() + 'title';
177
+ $module.attr('aria-labelledby', titleId);
178
+ $('<div/>', {class: className.title, id: titleId}).appendTo($module);
176
179
  }
177
180
  if (settings.content !== '') {
178
- $('<div/>', {class: className.content}).appendTo($module);
181
+ var descId = '_' + module.get.id() + 'desc';
182
+ $module.attr('aria-describedby', descId);
183
+ $('<div/>', {class: className.content, id: descId}).appendTo($module);
179
184
  }
180
185
  if (module.has.configActions()) {
181
186
  $('<div/>', {class: className.actions}).appendTo($module);
@@ -211,8 +216,8 @@ $.fn.modal = function(parameters) {
211
216
  module.verbose('Creating unique id for element', id);
212
217
  },
213
218
  innerDimmer: function() {
214
- if ( $module.find(selector.dimmer).length == 0 ) {
215
- $module.prepend('<div class="ui inverted dimmer"></div>');
219
+ if ( $module.find(selector.dimmer).length === 0 ) {
220
+ $('<div/>', {class: className.innerDimmer}).prependTo($module);
216
221
  }
217
222
  }
218
223
  },
@@ -228,15 +233,21 @@ $.fn.modal = function(parameters) {
228
233
  ;
229
234
  $window.off(elementEventNamespace);
230
235
  $dimmer.off(elementEventNamespace);
231
- $close.off(eventNamespace);
236
+ $closeIcon.off(elementEventNamespace);
237
+ if($inputs) {
238
+ $inputs.off(elementEventNamespace);
239
+ }
232
240
  $context.dimmer('destroy');
233
241
  },
234
242
 
235
243
  observeChanges: function() {
236
244
  if('MutationObserver' in window) {
237
245
  observer = new MutationObserver(function(mutations) {
238
- module.debug('DOM tree modified, refreshing');
239
- module.refresh();
246
+ if(settings.observeChanges) {
247
+ module.debug('DOM tree modified, refreshing');
248
+ module.refresh();
249
+ }
250
+ module.refreshInputs();
240
251
  });
241
252
  observer.observe(element, {
242
253
  childList : true,
@@ -261,6 +272,23 @@ $.fn.modal = function(parameters) {
261
272
  $allModals = $otherModals.add($module);
262
273
  },
263
274
 
275
+ refreshInputs: function(){
276
+ if($inputs){
277
+ $inputs
278
+ .off('keydown' + elementEventNamespace)
279
+ ;
280
+ }
281
+ $inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
282
+ return $(this).closest('.disabled').length === 0;
283
+ });
284
+ $inputs.first()
285
+ .on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
286
+ ;
287
+ $inputs.last()
288
+ .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
289
+ ;
290
+ },
291
+
264
292
  attachEvents: function(selector, event) {
265
293
  var
266
294
  $toggle = $(selector)
@@ -289,6 +317,9 @@ $.fn.modal = function(parameters) {
289
317
  .on('click' + eventNamespace, selector.approve, module.event.approve)
290
318
  .on('click' + eventNamespace, selector.deny, module.event.deny)
291
319
  ;
320
+ $closeIcon
321
+ .on('keyup' + elementEventNamespace, module.event.closeKeyUp)
322
+ ;
292
323
  $window
293
324
  .on('resize' + elementEventNamespace, module.event.resize)
294
325
  ;
@@ -307,7 +338,7 @@ $.fn.modal = function(parameters) {
307
338
 
308
339
  get: {
309
340
  id: function() {
310
- return (Math.random().toString(16) + '000000000').substr(2, 8);
341
+ return id;
311
342
  },
312
343
  element: function() {
313
344
  return $module;
@@ -346,10 +377,38 @@ $.fn.modal = function(parameters) {
346
377
  close: function() {
347
378
  module.hide();
348
379
  },
380
+ closeKeyUp: function(event){
381
+ var
382
+ keyCode = event.which
383
+ ;
384
+ if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
385
+ module.hide();
386
+ }
387
+ },
388
+ inputKeyDown: {
389
+ first: function(event) {
390
+ var
391
+ keyCode = event.which
392
+ ;
393
+ if (keyCode === settings.keys.tab && event.shiftKey) {
394
+ $inputs.last().focus();
395
+ event.preventDefault();
396
+ }
397
+ },
398
+ last: function(event) {
399
+ var
400
+ keyCode = event.which
401
+ ;
402
+ if (keyCode === settings.keys.tab && !event.shiftKey) {
403
+ $inputs.first().focus();
404
+ event.preventDefault();
405
+ }
406
+ }
407
+ },
349
408
  mousedown: function(event) {
350
409
  var
351
410
  $target = $(event.target),
352
- isRtl = module.is.rtl();
411
+ isRtl = module.is.rtl()
353
412
  ;
354
413
  initialMouseDownInModal = ($target.closest(selector.modal).length > 0);
355
414
  if(initialMouseDownInModal) {
@@ -397,10 +456,9 @@ $.fn.modal = function(parameters) {
397
456
  },
398
457
  keyboard: function(event) {
399
458
  var
400
- keyCode = event.which,
401
- escapeKey = 27
459
+ keyCode = event.which
402
460
  ;
403
- if(keyCode == escapeKey) {
461
+ if(keyCode === settings.keys.escape) {
404
462
  if(settings.closable) {
405
463
  module.debug('Escape key pressed hiding modal');
406
464
  if ( $module.hasClass(className.front) ) {
@@ -715,7 +773,7 @@ $.fn.modal = function(parameters) {
715
773
  $module
716
774
  .off('mousedown' + elementEventNamespace)
717
775
  ;
718
- }
776
+ }
719
777
  $dimmer
720
778
  .off('mousedown' + elementEventNamespace)
721
779
  ;
@@ -900,13 +958,10 @@ $.fn.modal = function(parameters) {
900
958
  set: {
901
959
  autofocus: function() {
902
960
  var
903
- $inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
904
- return $(this).closest('.disabled').length === 0;
905
- }),
906
961
  $autofocus = $inputs.filter('[autofocus]'),
907
962
  $input = ($autofocus.length > 0)
908
963
  ? $autofocus.first()
909
- : $inputs.first()
964
+ : ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
910
965
  ;
911
966
  if($input.length > 0) {
912
967
  $input.focus();
@@ -988,7 +1043,7 @@ $.fn.modal = function(parameters) {
988
1043
  ? $(document).scrollTop() + settings.padding
989
1044
  : $(document).scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding),
990
1045
  marginLeft: -(module.cache.width / 2)
991
- })
1046
+ })
992
1047
  ;
993
1048
  } else {
994
1049
  $module
@@ -997,7 +1052,7 @@ $.fn.modal = function(parameters) {
997
1052
  ? -(module.cache.height / 2)
998
1053
  : settings.padding / 2,
999
1054
  marginLeft: -(module.cache.width / 2)
1000
- })
1055
+ })
1001
1056
  ;
1002
1057
  }
1003
1058
  module.verbose('Setting modal offset for legacy mode');
@@ -1323,11 +1378,19 @@ $.fn.modal.settings = {
1323
1378
  // called after deny selector match
1324
1379
  onDeny : function(){ return true; },
1325
1380
 
1381
+ keys : {
1382
+ space : 32,
1383
+ enter : 13,
1384
+ escape : 27,
1385
+ tab : 9,
1386
+ },
1387
+
1326
1388
  selector : {
1327
1389
  title : '> .header',
1328
1390
  content : '> .content',
1329
1391
  actions : '> .actions',
1330
1392
  close : '> .close',
1393
+ closeIcon: '> .close',
1331
1394
  approve : '.actions .positive, .actions .approve, .actions .ok',
1332
1395
  deny : '.actions .negative, .actions .deny, .actions .cancel',
1333
1396
  modal : '.ui.modal',
@@ -1359,11 +1422,13 @@ $.fn.modal.settings = {
1359
1422
  template : 'ui tiny modal',
1360
1423
  ok : 'positive',
1361
1424
  cancel : 'negative',
1362
- prompt : 'ui fluid input'
1425
+ prompt : 'ui fluid input',
1426
+ innerDimmer: 'ui inverted dimmer'
1363
1427
  },
1364
1428
  text: {
1365
1429
  ok : 'Ok',
1366
- cancel: 'Cancel'
1430
+ cancel: 'Cancel',
1431
+ close : 'Close'
1367
1432
  }
1368
1433
  };
1369
1434
 
@@ -1389,33 +1454,39 @@ $.fn.modal.settings.templates = {
1389
1454
  },
1390
1455
  alert: function () {
1391
1456
  var settings = this.get.settings(),
1392
- args = settings.templates.getArguments(arguments)
1457
+ args = settings.templates.getArguments(arguments),
1458
+ approveFn = args.handler
1393
1459
  ;
1394
1460
  return {
1395
1461
  title : args.title,
1396
1462
  content: args.content,
1463
+ onApprove: approveFn,
1397
1464
  actions: [{
1398
1465
  text : settings.text.ok,
1399
1466
  class: settings.className.ok,
1400
- click: args.handler
1467
+ click: approveFn
1401
1468
  }]
1402
1469
  }
1403
1470
  },
1404
1471
  confirm: function () {
1405
1472
  var settings = this.get.settings(),
1406
- args = settings.templates.getArguments(arguments)
1473
+ args = settings.templates.getArguments(arguments),
1474
+ approveFn = function(){args.handler(true)},
1475
+ denyFn = function(){args.handler(false)}
1407
1476
  ;
1408
1477
  return {
1409
1478
  title : args.title,
1410
1479
  content: args.content,
1480
+ onApprove: approveFn,
1481
+ onDeny: denyFn,
1411
1482
  actions: [{
1412
1483
  text : settings.text.ok,
1413
1484
  class: settings.className.ok,
1414
- click: function(){args.handler(true)}
1485
+ click: approveFn
1415
1486
  },{
1416
1487
  text: settings.text.cancel,
1417
1488
  class: settings.className.cancel,
1418
- click: function(){args.handler(false)}
1489
+ click: denyFn
1419
1490
  }]
1420
1491
  }
1421
1492
  },
@@ -1423,7 +1494,14 @@ $.fn.modal.settings.templates = {
1423
1494
  var $this = this,
1424
1495
  settings = this.get.settings(),
1425
1496
  args = settings.templates.getArguments(arguments),
1426
- input = $($.parseHTML(args.content)).filter('.ui.input')
1497
+ input = $($.parseHTML(args.content)).filter('.ui.input'),
1498
+ approveFn = function(){
1499
+ var settings = $this.get.settings(),
1500
+ inputField = $this.get.element().find(settings.selector.prompt)[0]
1501
+ ;
1502
+ args.handler($(inputField).val());
1503
+ },
1504
+ denyFn = function(){args.handler(null)}
1427
1505
  ;
1428
1506
  if (input.length === 0) {
1429
1507
  args.content += '<p><div class="'+settings.className.prompt+'"><input placeholder="'+this.helpers.deQuote(args.placeholder || '')+'" type="text" value="'+this.helpers.deQuote(args.defaultValue || '')+'"></div></p>';
@@ -1431,19 +1509,16 @@ $.fn.modal.settings.templates = {
1431
1509
  return {
1432
1510
  title : args.title,
1433
1511
  content: args.content,
1512
+ onApprove: approveFn,
1513
+ onDeny: denyFn,
1434
1514
  actions: [{
1435
1515
  text: settings.text.ok,
1436
1516
  class: settings.className.ok,
1437
- click: function(){
1438
- var settings = $this.get.settings(),
1439
- inputField = $this.get.element().find(settings.selector.prompt)[0]
1440
- ;
1441
- args.handler($(inputField).val());
1442
- }
1517
+ click: approveFn
1443
1518
  },{
1444
1519
  text: settings.text.cancel,
1445
1520
  class: settings.className.cancel,
1446
- click: function(){args.handler(null)}
1521
+ click: denyFn
1447
1522
  }]
1448
1523
  }
1449
1524
  }
@@ -80,8 +80,10 @@
80
80
  height: @closeHitbox;
81
81
  padding: @closePadding;
82
82
  }
83
+ .ui.modal > .close:focus,
83
84
  .ui.modal > .close:hover {
84
85
  opacity: 1;
86
+ outline: none;
85
87
  }
86
88
 
87
89
  /*--------------
@@ -206,6 +208,16 @@
206
208
  .ui.modal:not(.fullscreen) {
207
209
  width: @tabletWidth;
208
210
  margin: @tabletMargin;
211
+ & > .active.dimmer + .close:not(.inside) {
212
+ pointer-events: none;
213
+ opacity: @closeOpacityDimmed;
214
+ }
215
+ }
216
+ .ui.dimmer > .ui.modal:not(.fullscreen) > .close:not(.inside){
217
+ text-shadow: @closeShadow;
218
+ }
219
+ .ui.inverted.dimmer > .ui.modal:not(.fullscreen) > .close:not(.inside){
220
+ text-shadow: @invertedCloseShadow;
209
221
  }
210
222
  }
211
223
  @media only screen and (min-width : @computerBreakpoint) {