fomantic-ui 2.9.0-beta.32 → 2.9.0-beta.321

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 (424) hide show
  1. package/.all-contributorsrc +274 -4
  2. package/.github/codeql/codeql-config.yml +4 -0
  3. package/.github/dependabot.yml +10 -0
  4. package/.github/workflows/ci.yml +10 -6
  5. package/.github/workflows/codeql.yml +68 -0
  6. package/.github/workflows/nightly.yml +16 -8
  7. package/.github/workflows/release.yml +34 -0
  8. package/CONTRIBUTORS.md +86 -37
  9. package/FAQ.md +38 -38
  10. package/README.md +8 -8
  11. package/dist/components/accordion.css +176 -36
  12. package/dist/components/accordion.js +10 -4
  13. package/dist/components/accordion.min.css +2 -2
  14. package/dist/components/accordion.min.js +3 -3
  15. package/dist/components/ad.css +4 -4
  16. package/dist/components/ad.min.css +2 -2
  17. package/dist/components/api.js +92 -33
  18. package/dist/components/api.min.js +3 -3
  19. package/dist/components/breadcrumb.css +1 -1
  20. package/dist/components/breadcrumb.min.css +1 -1
  21. package/dist/components/button.css +204 -157
  22. package/dist/components/button.min.css +2 -2
  23. package/dist/components/calendar.css +18 -1
  24. package/dist/components/calendar.js +93 -74
  25. package/dist/components/calendar.min.css +2 -2
  26. package/dist/components/calendar.min.js +3 -3
  27. package/dist/components/card.css +754 -117
  28. package/dist/components/card.min.css +2 -2
  29. package/dist/components/checkbox.css +92 -91
  30. package/dist/components/checkbox.js +21 -14
  31. package/dist/components/checkbox.min.css +2 -2
  32. package/dist/components/checkbox.min.js +3 -3
  33. package/dist/components/comment.css +12 -12
  34. package/dist/components/comment.min.css +2 -2
  35. package/dist/components/container.css +98 -4
  36. package/dist/components/container.min.css +2 -2
  37. package/dist/components/dimmer.css +33 -18
  38. package/dist/components/dimmer.js +19 -10
  39. package/dist/components/dimmer.min.css +2 -2
  40. package/dist/components/dimmer.min.js +3 -3
  41. package/dist/components/divider.css +31 -31
  42. package/dist/components/divider.min.css +2 -2
  43. package/dist/components/dropdown.css +100 -50
  44. package/dist/components/dropdown.js +212 -187
  45. package/dist/components/dropdown.min.css +2 -2
  46. package/dist/components/dropdown.min.js +3 -3
  47. package/dist/components/embed.css +5 -5
  48. package/dist/components/embed.js +14 -10
  49. package/dist/components/embed.min.css +2 -2
  50. package/dist/components/embed.min.js +3 -3
  51. package/dist/components/emoji.css +10799 -8841
  52. package/dist/components/emoji.min.css +1 -1
  53. package/dist/components/feed.css +29 -29
  54. package/dist/components/feed.min.css +2 -2
  55. package/dist/components/flag.css +1021 -915
  56. package/dist/components/flag.min.css +2 -2
  57. package/dist/components/flyout.css +592 -0
  58. package/dist/components/flyout.js +1529 -0
  59. package/dist/components/flyout.min.css +9 -0
  60. package/dist/components/flyout.min.js +11 -0
  61. package/dist/components/form.css +160 -83
  62. package/dist/components/form.js +46 -42
  63. package/dist/components/form.min.css +2 -2
  64. package/dist/components/form.min.js +3 -3
  65. package/dist/components/grid.css +25 -21
  66. package/dist/components/grid.min.css +2 -2
  67. package/dist/components/header.css +6 -4
  68. package/dist/components/header.min.css +2 -2
  69. package/dist/components/icon.css +2063 -1984
  70. package/dist/components/icon.min.css +2 -2
  71. package/dist/components/image.css +1 -1
  72. package/dist/components/image.min.css +1 -1
  73. package/dist/components/input.css +759 -22
  74. package/dist/components/input.min.css +2 -2
  75. package/dist/components/item.css +17 -17
  76. package/dist/components/item.min.css +2 -2
  77. package/dist/components/label.css +72 -68
  78. package/dist/components/label.min.css +2 -2
  79. package/dist/components/list.css +31 -31
  80. package/dist/components/list.min.css +2 -2
  81. package/dist/components/loader.css +352 -352
  82. package/dist/components/loader.min.css +2 -2
  83. package/dist/components/menu.css +108 -76
  84. package/dist/components/menu.min.css +1 -1
  85. package/dist/components/message.css +43 -43
  86. package/dist/components/message.min.css +2 -2
  87. package/dist/components/modal.css +37 -6
  88. package/dist/components/modal.js +187 -84
  89. package/dist/components/modal.min.css +2 -2
  90. package/dist/components/modal.min.js +3 -3
  91. package/dist/components/nag.css +1 -1
  92. package/dist/components/nag.js +3 -3
  93. package/dist/components/nag.min.css +1 -1
  94. package/dist/components/nag.min.js +3 -3
  95. package/dist/components/placeholder.css +33 -33
  96. package/dist/components/placeholder.min.css +2 -2
  97. package/dist/components/popup.css +100 -104
  98. package/dist/components/popup.js +17 -23
  99. package/dist/components/popup.min.css +2 -2
  100. package/dist/components/popup.min.js +3 -3
  101. package/dist/components/progress.css +1 -1
  102. package/dist/components/progress.js +6 -3
  103. package/dist/components/progress.min.css +1 -1
  104. package/dist/components/progress.min.js +3 -3
  105. package/dist/components/rail.css +1 -1
  106. package/dist/components/rail.min.css +1 -1
  107. package/dist/components/rating.css +1 -1
  108. package/dist/components/rating.js +8 -4
  109. package/dist/components/rating.min.css +1 -1
  110. package/dist/components/rating.min.js +3 -3
  111. package/dist/components/reset.css +5 -4
  112. package/dist/components/reset.min.css +2 -2
  113. package/dist/components/reveal.css +1 -1
  114. package/dist/components/reveal.min.css +1 -1
  115. package/dist/components/search.css +6 -6
  116. package/dist/components/search.js +48 -21
  117. package/dist/components/search.min.css +2 -2
  118. package/dist/components/search.min.js +3 -3
  119. package/dist/components/segment.css +118 -34
  120. package/dist/components/segment.min.css +2 -2
  121. package/dist/components/shape.css +1 -1
  122. package/dist/components/shape.js +4 -4
  123. package/dist/components/shape.min.css +1 -1
  124. package/dist/components/shape.min.js +3 -3
  125. package/dist/components/sidebar.css +23 -9
  126. package/dist/components/sidebar.js +141 -44
  127. package/dist/components/sidebar.min.css +2 -2
  128. package/dist/components/sidebar.min.js +3 -3
  129. package/dist/components/site.css +139 -42
  130. package/dist/components/site.js +2 -2
  131. package/dist/components/site.min.css +2 -2
  132. package/dist/components/site.min.js +3 -3
  133. package/dist/components/slider.css +17 -17
  134. package/dist/components/slider.js +79 -64
  135. package/dist/components/slider.min.css +1 -1
  136. package/dist/components/slider.min.js +3 -3
  137. package/dist/components/state.js +3 -3
  138. package/dist/components/state.min.js +3 -3
  139. package/dist/components/statistic.css +4 -4
  140. package/dist/components/statistic.min.css +2 -2
  141. package/dist/components/step.css +31 -31
  142. package/dist/components/step.min.css +2 -2
  143. package/dist/components/sticky.css +1 -1
  144. package/dist/components/sticky.js +11 -18
  145. package/dist/components/sticky.min.css +1 -1
  146. package/dist/components/sticky.min.js +3 -3
  147. package/dist/components/tab.css +5 -5
  148. package/dist/components/tab.js +25 -7
  149. package/dist/components/tab.min.css +2 -2
  150. package/dist/components/tab.min.js +3 -3
  151. package/dist/components/table.css +1684 -272
  152. package/dist/components/table.min.css +2 -2
  153. package/dist/components/text.css +1 -1
  154. package/dist/components/text.min.css +1 -1
  155. package/dist/components/toast.css +43 -1
  156. package/dist/components/toast.js +68 -34
  157. package/dist/components/toast.min.css +2 -2
  158. package/dist/components/toast.min.js +3 -3
  159. package/dist/components/transition.css +1 -1
  160. package/dist/components/transition.js +27 -22
  161. package/dist/components/transition.min.css +1 -1
  162. package/dist/components/transition.min.js +3 -3
  163. package/dist/components/visibility.js +5 -5
  164. package/dist/components/visibility.min.js +3 -3
  165. package/dist/semantic.css +42008 -34578
  166. package/dist/semantic.js +2719 -763
  167. package/dist/semantic.min.css +3 -3
  168. package/dist/semantic.min.js +3 -3
  169. package/dist/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  170. package/dist/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  171. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  172. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  173. package/dist/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  174. package/dist/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  175. package/dist/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  176. package/dist/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  177. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  178. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  179. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  180. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  181. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  182. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  183. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  184. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  185. package/dist/themes/default/assets/fonts/brand-icons.eot +0 -0
  186. package/dist/themes/default/assets/fonts/brand-icons.svg +801 -654
  187. package/dist/themes/default/assets/fonts/brand-icons.ttf +0 -0
  188. package/dist/themes/default/assets/fonts/brand-icons.woff +0 -0
  189. package/dist/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  190. package/dist/themes/default/assets/fonts/icons.eot +0 -0
  191. package/dist/themes/default/assets/fonts/icons.svg +1175 -1079
  192. package/dist/themes/default/assets/fonts/icons.ttf +0 -0
  193. package/dist/themes/default/assets/fonts/icons.woff +0 -0
  194. package/dist/themes/default/assets/fonts/icons.woff2 +0 -0
  195. package/dist/themes/default/assets/fonts/outline-icons.eot +0 -0
  196. package/dist/themes/default/assets/fonts/outline-icons.svg +93 -95
  197. package/dist/themes/default/assets/fonts/outline-icons.ttf +0 -0
  198. package/dist/themes/default/assets/fonts/outline-icons.woff +0 -0
  199. package/dist/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  200. package/dist/themes/{default → famfamfam}/assets/images/flags.png +0 -0
  201. package/examples/assets/library/iframe-content.js +8 -8
  202. package/examples/assets/library/iframe.js +3 -3
  203. package/examples/components/button.html +1 -1
  204. package/examples/components/card.html +1 -1
  205. package/examples/components/input.html +1 -1
  206. package/examples/components/menu.html +1 -1
  207. package/examples/components/site.html +1 -1
  208. package/examples/components/table.html +1 -1
  209. package/package.json +18 -16
  210. package/scripts/nightly-version.js +47 -38
  211. package/src/definitions/behaviors/api.js +91 -32
  212. package/src/definitions/behaviors/form.js +45 -41
  213. package/src/definitions/behaviors/state.js +2 -2
  214. package/src/definitions/behaviors/visibility.js +4 -4
  215. package/src/definitions/collections/form.less +229 -166
  216. package/src/definitions/collections/grid.less +723 -687
  217. package/src/definitions/collections/menu.less +232 -170
  218. package/src/definitions/collections/message.less +49 -47
  219. package/src/definitions/collections/table.less +882 -272
  220. package/src/definitions/elements/button.less +611 -469
  221. package/src/definitions/elements/container.less +145 -8
  222. package/src/definitions/elements/divider.less +24 -24
  223. package/src/definitions/elements/emoji.less +39 -10
  224. package/src/definitions/elements/flag.less +54 -18
  225. package/src/definitions/elements/header.less +46 -37
  226. package/src/definitions/elements/icon.less +39 -32
  227. package/src/definitions/elements/input.less +281 -33
  228. package/src/definitions/elements/label.less +132 -128
  229. package/src/definitions/elements/list.less +84 -75
  230. package/src/definitions/elements/loader.less +99 -98
  231. package/src/definitions/elements/placeholder.less +32 -32
  232. package/src/definitions/elements/segment.less +177 -56
  233. package/src/definitions/elements/step.less +76 -72
  234. package/src/definitions/elements/text.less +17 -15
  235. package/src/definitions/globals/reset.less +2 -2
  236. package/src/definitions/globals/site.js +1 -1
  237. package/src/definitions/globals/site.less +25 -2
  238. package/src/definitions/modules/accordion.js +9 -3
  239. package/src/definitions/modules/accordion.less +371 -219
  240. package/src/definitions/modules/calendar.js +92 -73
  241. package/src/definitions/modules/calendar.less +20 -0
  242. package/src/definitions/modules/checkbox.js +20 -13
  243. package/src/definitions/modules/checkbox.less +83 -227
  244. package/src/definitions/modules/dimmer.js +18 -9
  245. package/src/definitions/modules/dimmer.less +26 -12
  246. package/src/definitions/modules/dropdown.js +211 -186
  247. package/src/definitions/modules/dropdown.less +201 -136
  248. package/src/definitions/modules/embed.js +13 -9
  249. package/src/definitions/modules/embed.less +4 -4
  250. package/src/definitions/modules/flyout.js +1529 -0
  251. package/src/definitions/modules/flyout.less +650 -0
  252. package/src/definitions/modules/modal.js +186 -83
  253. package/src/definitions/modules/modal.less +70 -33
  254. package/src/definitions/modules/nag.js +2 -2
  255. package/src/definitions/modules/nag.less +20 -19
  256. package/src/definitions/modules/popup.js +16 -22
  257. package/src/definitions/modules/popup.less +86 -90
  258. package/src/definitions/modules/progress.js +5 -2
  259. package/src/definitions/modules/progress.less +19 -18
  260. package/src/definitions/modules/rating.js +7 -3
  261. package/src/definitions/modules/rating.less +35 -34
  262. package/src/definitions/modules/search.js +47 -20
  263. package/src/definitions/modules/search.less +35 -19
  264. package/src/definitions/modules/shape.js +3 -3
  265. package/src/definitions/modules/sidebar.js +140 -43
  266. package/src/definitions/modules/sidebar.less +53 -24
  267. package/src/definitions/modules/slider.js +78 -63
  268. package/src/definitions/modules/slider.less +48 -47
  269. package/src/definitions/modules/sticky.js +10 -17
  270. package/src/definitions/modules/sticky.less +3 -1
  271. package/src/definitions/modules/tab.js +24 -6
  272. package/src/definitions/modules/tab.less +4 -4
  273. package/src/definitions/modules/toast.js +67 -33
  274. package/src/definitions/modules/toast.less +52 -16
  275. package/src/definitions/modules/transition.js +26 -21
  276. package/src/definitions/views/ad.less +3 -3
  277. package/src/definitions/views/card.less +522 -375
  278. package/src/definitions/views/comment.less +93 -82
  279. package/src/definitions/views/feed.less +164 -144
  280. package/src/definitions/views/item.less +251 -198
  281. package/src/definitions/views/statistic.less +91 -89
  282. package/src/semantic.less +1 -0
  283. package/src/theme.config.example +1 -0
  284. package/src/theme.less +13 -2
  285. package/src/themes/amazon/globals/site.variables +1 -0
  286. package/src/themes/basic/elements/icon.overrides +149 -149
  287. package/src/themes/basic/elements/step.overrides +2 -2
  288. package/src/themes/bookish/elements/header.overrides +1 -1
  289. package/src/themes/chubby/elements/button.overrides +1 -1
  290. package/src/themes/chubby/elements/header.overrides +1 -1
  291. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  292. package/src/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  293. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  294. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  295. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  296. package/src/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  297. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  298. package/src/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  299. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  300. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  301. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  302. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  303. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  304. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  305. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  306. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  307. package/src/themes/default/assets/fonts/brand-icons.eot +0 -0
  308. package/src/themes/default/assets/fonts/brand-icons.svg +801 -654
  309. package/src/themes/default/assets/fonts/brand-icons.ttf +0 -0
  310. package/src/themes/default/assets/fonts/brand-icons.woff +0 -0
  311. package/src/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  312. package/src/themes/default/assets/fonts/icons.eot +0 -0
  313. package/src/themes/default/assets/fonts/icons.svg +1175 -1079
  314. package/src/themes/default/assets/fonts/icons.ttf +0 -0
  315. package/src/themes/default/assets/fonts/icons.woff +0 -0
  316. package/src/themes/default/assets/fonts/icons.woff2 +0 -0
  317. package/src/themes/default/assets/fonts/outline-icons.eot +0 -0
  318. package/src/themes/default/assets/fonts/outline-icons.svg +93 -95
  319. package/src/themes/default/assets/fonts/outline-icons.ttf +0 -0
  320. package/src/themes/default/assets/fonts/outline-icons.woff +0 -0
  321. package/src/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  322. package/src/themes/default/collections/form.variables +4 -0
  323. package/src/themes/default/collections/menu.variables +6 -0
  324. package/src/themes/default/collections/table.variables +52 -0
  325. package/src/themes/default/elements/button.variables +7 -1
  326. package/src/themes/default/elements/container.variables +12 -0
  327. package/src/themes/default/elements/divider.overrides +7 -7
  328. package/src/themes/default/elements/emoji.overrides +0 -3090
  329. package/src/themes/default/elements/emoji.variables +3563 -1
  330. package/src/themes/default/elements/flag.overrides +0 -991
  331. package/src/themes/default/elements/flag.variables +1603 -5
  332. package/src/themes/default/elements/icon.overrides +1975 -1949
  333. package/src/themes/default/elements/icon.variables +1 -0
  334. package/src/themes/default/elements/input.variables +15 -0
  335. package/src/themes/default/elements/segment.variables +8 -0
  336. package/src/themes/default/elements/step.overrides +3 -3
  337. package/src/themes/default/globals/site.variables +109 -8
  338. package/src/themes/default/globals/variation.variables +161 -6
  339. package/src/themes/default/modules/accordion.overrides +6 -5
  340. package/src/themes/default/modules/accordion.variables +49 -2
  341. package/src/themes/default/modules/calendar.variables +3 -0
  342. package/src/themes/default/modules/checkbox.overrides +9 -9
  343. package/src/themes/default/modules/checkbox.variables +5 -5
  344. package/src/themes/default/modules/dimmer.variables +1 -1
  345. package/src/themes/default/modules/dropdown.overrides +5 -5
  346. package/src/themes/default/modules/dropdown.variables +7 -10
  347. package/src/themes/default/modules/flyout.overrides +3 -0
  348. package/src/themes/default/modules/flyout.variables +100 -0
  349. package/src/themes/default/modules/modal.variables +16 -2
  350. package/src/themes/default/modules/popup.variables +0 -2
  351. package/src/themes/default/modules/sidebar.variables +4 -1
  352. package/src/themes/default/modules/toast.variables +3 -0
  353. package/src/themes/default/views/card.variables +8 -0
  354. package/src/themes/{default → famfamfam}/assets/images/flags.png +0 -0
  355. package/src/themes/famfamfam/elements/flag.overrides +1026 -0
  356. package/src/themes/famfamfam/elements/flag.variables +20 -0
  357. package/src/themes/github/elements/icon.overrides +206 -206
  358. package/src/themes/github/elements/step.overrides +5 -5
  359. package/src/themes/github/globals/site.variables +1 -0
  360. package/src/themes/github/modules/dropdown.overrides +6 -6
  361. package/src/themes/instagram/views/card.overrides +1 -1
  362. package/src/themes/joypixels/elements/emoji.overrides +0 -3089
  363. package/src/themes/joypixels/elements/emoji.variables +3562 -5
  364. package/src/themes/material/collections/menu.overrides +1 -1
  365. package/src/themes/material/elements/button.overrides +1 -1
  366. package/src/themes/material/elements/header.overrides +1 -1
  367. package/src/themes/material/elements/icon.overrides +932 -932
  368. package/src/themes/material/globals/site.variables +0 -1
  369. package/src/themes/material/modules/dropdown.overrides +1 -1
  370. package/src/themes/material/modules/modal.overrides +1 -1
  371. package/src/themes/pulsar/elements/loader.overrides +2 -2
  372. package/src/themes/resetcss/globals/reset.overrides +3 -3
  373. package/src/themes/rtl/globals/site.overrides +1 -1
  374. package/src/themes/striped/modules/progress.overrides +1 -1
  375. package/src/themes/systemfont/globals/reset.overrides +8 -0
  376. package/src/themes/systemfont/globals/site.variables +10 -0
  377. package/src/themes/twitter/elements/emoji.overrides +0 -3091
  378. package/src/themes/twitter/elements/emoji.variables +3558 -6
  379. package/tasks/admin/distributions/create.js +1 -1
  380. package/tasks/admin/publish.js +1 -1
  381. package/tasks/admin/release.js +1 -1
  382. package/tasks/build/assets.js +1 -1
  383. package/tasks/build/css.js +9 -4
  384. package/tasks/build/javascript.js +3 -3
  385. package/tasks/check-install.js +1 -1
  386. package/tasks/clean.js +1 -1
  387. package/tasks/collections/README.md +1 -1
  388. package/tasks/collections/admin.js +1 -1
  389. package/tasks/config/admin/oauth.example.js +1 -1
  390. package/tasks/config/admin/release.js +1 -0
  391. package/tasks/config/admin/templates/composer.json +1 -1
  392. package/tasks/config/defaults.js +1 -0
  393. package/tasks/config/project/install.js +16 -13
  394. package/tasks/install.js +1 -0
  395. package/tasks/rtl/watch.js +1 -1
  396. package/tasks/version.js +1 -1
  397. package/test/fixtures/accordion.html +1 -1
  398. package/test/fixtures/checkbox.html +1 -1
  399. package/test/fixtures/dropdown.html +1 -1
  400. package/test/fixtures/modal.html +1 -1
  401. package/test/fixtures/popup.html +1 -1
  402. package/test/fixtures/rating.html +1 -1
  403. package/test/fixtures/shape.html +1 -1
  404. package/test/fixtures/sidebar.html +1 -1
  405. package/test/fixtures/tab.html +1 -1
  406. package/test/fixtures/transition.html +1 -1
  407. package/test/fixtures/video.html +1 -1
  408. package/test/helpers/jasmine-jquery.js +2 -2
  409. package/test/helpers/jasmine-sinon.js +1 -1
  410. package/test/helpers/jquery-events.js +1 -1
  411. package/test/helpers/sinon.js +3 -3
  412. package/test/meteor/fonts.js +1 -1
  413. package/test/modules/accordion.spec.js +1 -1
  414. package/test/modules/checkbox.spec.js +1 -1
  415. package/test/modules/dropdown.spec.js +1 -1
  416. package/test/modules/modal.spec.js +1 -1
  417. package/test/modules/module.spec.js +1 -1
  418. package/test/modules/popup.spec.js +1 -1
  419. package/test/modules/search.spec.js +1 -1
  420. package/test/modules/shape.spec.js +1 -1
  421. package/test/modules/sidebar.spec.js +1 -1
  422. package/test/modules/tab.spec.js +1 -1
  423. package/test/modules/transition.spec.js +1 -1
  424. package/test/modules/video.spec.js +1 -1
@@ -0,0 +1,1529 @@
1
+ /*!
2
+ * # Fomantic-UI 2.9.0-beta.321+b9608b1 - Flyout
3
+ * http://github.com/fomantic/Fomantic-UI/
4
+ *
5
+ *
6
+ * Released under the MIT license
7
+ * http://opensource.org/licenses/MIT
8
+ *
9
+ */
10
+
11
+ ;(function ($, window, document, undefined) {
12
+
13
+ 'use strict';
14
+
15
+ $.isFunction = $.isFunction || function(obj) {
16
+ return typeof obj === "function" && typeof obj.nodeType !== "number";
17
+ };
18
+
19
+ window = (typeof window != 'undefined' && window.Math == Math)
20
+ ? window
21
+ : (typeof self != 'undefined' && self.Math == Math)
22
+ ? self
23
+ : Function('return this')()
24
+ ;
25
+
26
+ $.flyout = $.fn.flyout = function(parameters) {
27
+ var
28
+ $allModules = $(this),
29
+ $window = $(window),
30
+ $document = $(document),
31
+ $html = $('html'),
32
+ $head = $('head'),
33
+ $body = $('body'),
34
+
35
+ moduleSelector = $allModules.selector || '',
36
+
37
+ time = new Date().getTime(),
38
+ performance = [],
39
+
40
+ query = arguments[0],
41
+ methodInvoked = (typeof query == 'string'),
42
+ queryArguments = [].slice.call(arguments, 1),
43
+
44
+ requestAnimationFrame = window.requestAnimationFrame
45
+ || window.mozRequestAnimationFrame
46
+ || window.webkitRequestAnimationFrame
47
+ || window.msRequestAnimationFrame
48
+ || function(callback) { setTimeout(callback, 0); },
49
+
50
+ returnedValue
51
+ ;
52
+
53
+ $allModules
54
+ .each(function() {
55
+ var
56
+ settings = ( $.isPlainObject(parameters) )
57
+ ? $.extend(true, {}, $.fn.flyout.settings, parameters)
58
+ : $.extend({}, $.fn.flyout.settings),
59
+
60
+ selector = settings.selector,
61
+ className = settings.className,
62
+ namespace = settings.namespace,
63
+ fields = settings.fields,
64
+ regExp = settings.regExp,
65
+ error = settings.error,
66
+
67
+ eventNamespace = '.' + namespace,
68
+ moduleNamespace = 'module-' + namespace,
69
+
70
+ $module = $(this),
71
+ $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
72
+ $closeIcon = $module.find(selector.close),
73
+ $inputs,
74
+ $focusedElement,
75
+
76
+ $flyouts = $module.children(selector.flyout),
77
+ $pusher = $context.children(selector.pusher),
78
+ $style,
79
+
80
+ isFlyoutComponent = $module.hasClass('flyout'),
81
+
82
+ element = this,
83
+ instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined,
84
+
85
+ ignoreRepeatedEvents = false,
86
+ isBody = $context[0] === $body[0],
87
+ initialBodyMargin = '',
88
+ tempBodyMargin = '',
89
+ hadScrollbar = false,
90
+
91
+ elementNamespace,
92
+ id,
93
+ observer,
94
+ currentScroll,
95
+ transitionEvent,
96
+
97
+ module
98
+ ;
99
+
100
+ module = {
101
+
102
+ initialize: function() {
103
+ module.debug('Initializing flyout', parameters);
104
+
105
+ module.create.id();
106
+ if(!isFlyoutComponent) {
107
+ module.create.flyout();
108
+ if(!$.isFunction(settings.onHidden)) {
109
+ settings.onHidden = function () {
110
+ module.destroy();
111
+ $module.remove();
112
+ };
113
+ }
114
+ if(!settings.autoShow) {
115
+ settings.autoShow = true;
116
+ }
117
+ }
118
+ $module.addClass(settings.class);
119
+ if (settings.title !== '') {
120
+ $module.find(selector.header).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
121
+ }
122
+ if (settings.content !== '') {
123
+ $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
124
+ }
125
+ if(module.has.configActions()){
126
+ var $actions = $module.find(selector.actions).addClass(settings.classActions);
127
+ if ($actions.length === 0) {
128
+ $actions = $('<div/>', {class: className.actions + ' ' + (settings.classActions || '')}).appendTo($module);
129
+ } else {
130
+ $actions.empty();
131
+ }
132
+ settings.actions.forEach(function (el) {
133
+ var
134
+ icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
135
+ text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
136
+ cls = module.helpers.deQuote(el[fields.class] || ''),
137
+ click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {}
138
+ ;
139
+ $actions.append($('<button/>', {
140
+ html: icon + text,
141
+ 'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g,''),
142
+ class: className.button + ' ' + cls,
143
+ click: function () {
144
+ if (click.call(element, $module) === false) {
145
+ return;
146
+ }
147
+ module.hide();
148
+ }
149
+ }));
150
+ });
151
+ }
152
+
153
+ transitionEvent = module.get.transitionEvent();
154
+
155
+ // avoids locking rendering if initialized in onReady
156
+ if(settings.delaySetup) {
157
+ requestAnimationFrame(module.setup.layout);
158
+ }
159
+ else {
160
+ module.setup.layout();
161
+ }
162
+
163
+ requestAnimationFrame(function() {
164
+ module.setup.cache();
165
+ });
166
+
167
+ if (module.get.direction() == 'left' || module.get.direction() == 'right') {
168
+ module.setup.heights();
169
+ module.bind.resize();
170
+ }
171
+ module.refreshInputs();
172
+ module.bind.events();
173
+ module.observeChanges();
174
+ module.instantiate();
175
+
176
+ if(settings.autoShow){
177
+ module.show();
178
+ }
179
+ },
180
+
181
+ instantiate: function() {
182
+ module.verbose('Storing instance of module', module);
183
+ instance = module;
184
+ $module
185
+ .data(moduleNamespace, instance)
186
+ ;
187
+ },
188
+
189
+ create: {
190
+ flyout: function() {
191
+ module.verbose('Programmaticaly create flyout', $context);
192
+ $module = $('<div/>', {class: className.flyout, role: 'dialog', 'aria-modal': settings.dimPage});
193
+ if (settings.closeIcon) {
194
+ $closeIcon = $('<i/>', {class: className.close, role: 'button', tabindex: 0, 'aria-label': settings.text.close})
195
+ $module.append($closeIcon);
196
+ }
197
+ if (settings.title !== '') {
198
+ var titleId = '_' + module.get.id() + 'title';
199
+ $module.attr('aria-labelledby', titleId);
200
+ $('<div/>', {class: className.header, id: titleId}).appendTo($module);
201
+ }
202
+ if (settings.content !== '') {
203
+ var descId = '_' + module.get.id() + 'desc';
204
+ $module.attr('aria-describedby', descId);
205
+ $('<div/>', {class: className.content, id: descId}).appendTo($module);
206
+ }
207
+ if (module.has.configActions()) {
208
+ $('<div/>', {class: className.actions}).appendTo($module);
209
+ }
210
+ $module.prependTo($context);
211
+ },
212
+ id: function() {
213
+ id = (Math.random().toString(16) + '000000000').slice(2, 10);
214
+ elementNamespace = '.' + id;
215
+ module.verbose('Creating unique id for element', id);
216
+ }
217
+ },
218
+
219
+ destroy: function() {
220
+ if (observer) {
221
+ observer.disconnect();
222
+ }
223
+ module.verbose('Destroying previous module for', $module);
224
+ $module
225
+ .off(eventNamespace)
226
+ .removeData(moduleNamespace)
227
+ ;
228
+ if(module.is.ios()) {
229
+ module.remove.ios();
230
+ }
231
+ $closeIcon.off(elementNamespace);
232
+ if($inputs) {
233
+ $inputs.off(elementNamespace);
234
+ }
235
+ // bound by uuid
236
+ $context.off(elementNamespace);
237
+ $window.off(elementNamespace);
238
+ $document.off(elementNamespace);
239
+ },
240
+
241
+ event: {
242
+ keyboard: function(event) {
243
+ var
244
+ keyCode = event.which
245
+ ;
246
+ if(keyCode === settings.keys.escape) {
247
+ if(settings.closable) {
248
+ module.debug('Escape key pressed hiding flyout');
249
+ module.hide();
250
+ }
251
+ else {
252
+ module.debug('Escape key pressed, but closable is set to false');
253
+ }
254
+ event.preventDefault();
255
+ }
256
+ },
257
+ resize: function() {
258
+ module.setup.heights();
259
+ },
260
+ clickaway: function(event) {
261
+ if(settings.closable){
262
+ var
263
+ clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
264
+ clickedContext = ($context.is(event.target))
265
+ ;
266
+ if(clickedInPusher) {
267
+ module.verbose('User clicked on dimmed page');
268
+ module.hide();
269
+ }
270
+ if(clickedContext) {
271
+ module.verbose('User clicked on dimmable context (scaled out page)');
272
+ module.hide();
273
+ }
274
+ }
275
+ },
276
+ close: function(event) {
277
+ module.hide();
278
+ },
279
+ closeKeyUp: function(event){
280
+ var
281
+ keyCode = event.which
282
+ ;
283
+ if (keyCode === settings.keys.enter || keyCode === settings.keys.space) {
284
+ module.hide();
285
+ }
286
+ },
287
+ inputKeyDown: {
288
+ first: function(event) {
289
+ var
290
+ keyCode = event.which
291
+ ;
292
+ if (keyCode === settings.keys.tab && event.shiftKey) {
293
+ $inputs.last().focus();
294
+ event.preventDefault();
295
+ }
296
+ },
297
+ last: function(event) {
298
+ var
299
+ keyCode = event.which
300
+ ;
301
+ if (keyCode === settings.keys.tab && !event.shiftKey) {
302
+ $inputs.first().focus();
303
+ event.preventDefault();
304
+ }
305
+ }
306
+ },
307
+ approve: function(event) {
308
+ if (ignoreRepeatedEvents || settings.onApprove.call(module.element, $(this)) === false) {
309
+ module.verbose('Approve callback returned false cancelling close');
310
+ return;
311
+ }
312
+ ignoreRepeatedEvents = true;
313
+ module.hide(function() {
314
+ ignoreRepeatedEvents = false;
315
+ });
316
+ },
317
+ deny: function(event) {
318
+ if (ignoreRepeatedEvents || settings.onDeny.call(module.element, $(this)) === false) {
319
+ module.verbose('Deny callback returned false cancelling close');
320
+ return;
321
+ }
322
+ ignoreRepeatedEvents = true;
323
+ module.hide(function() {
324
+ ignoreRepeatedEvents = false;
325
+ });
326
+ },
327
+ touch: function(event) {
328
+ //event.stopPropagation();
329
+ },
330
+ containScroll: function(event) {
331
+ if(element.scrollTop <= 0) {
332
+ element.scrollTop = 1;
333
+ }
334
+ if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
335
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
336
+ }
337
+ },
338
+ scroll: function(event) {
339
+ if( $(event.target).closest(selector.flyout).length === 0 ) {
340
+ event.preventDefault();
341
+ }
342
+ }
343
+ },
344
+
345
+ bind: {
346
+ resize: function() {
347
+ module.verbose('Adding resize event to window', $window);
348
+ $window.on('resize' + elementNamespace, module.event.resize);
349
+ },
350
+ events: function() {
351
+ module.verbose('Attaching events');
352
+ $module
353
+ .on('click' + eventNamespace, selector.close, module.event.close)
354
+ .on('click' + eventNamespace, selector.approve, module.event.approve)
355
+ .on('click' + eventNamespace, selector.deny, module.event.deny)
356
+ ;
357
+ $closeIcon
358
+ .on('keyup' + elementNamespace, module.event.closeKeyUp)
359
+ ;
360
+ },
361
+ clickaway: function() {
362
+ module.verbose('Adding clickaway events to context', $context);
363
+ $context
364
+ .on('click' + elementNamespace, module.event.clickaway)
365
+ .on('touchend' + elementNamespace, module.event.clickaway)
366
+ ;
367
+ },
368
+ scrollLock: function() {
369
+ if(settings.scrollLock) {
370
+ module.debug('Disabling page scroll');
371
+ hadScrollbar = module.has.scrollbar();
372
+ if(hadScrollbar) {
373
+ module.save.bodyMargin();
374
+ module.set.bodyMargin();
375
+ }
376
+ $context.addClass(className.locked);
377
+ }
378
+ module.verbose('Adding events to contain flyout scroll');
379
+ $document
380
+ .on('touchmove' + elementNamespace, module.event.touch)
381
+ ;
382
+ $module
383
+ .on('scroll' + eventNamespace, module.event.containScroll)
384
+ ;
385
+ }
386
+ },
387
+ unbind: {
388
+ clickaway: function() {
389
+ module.verbose('Removing clickaway events from context', $context);
390
+ $context.off(elementNamespace);
391
+ },
392
+ scrollLock: function() {
393
+ module.verbose('Removing scroll lock from page');
394
+ if(hadScrollbar) {
395
+ module.restore.bodyMargin();
396
+ }
397
+ $context.removeClass(className.locked);
398
+ $document.off(elementNamespace);
399
+ $module.off('scroll' + eventNamespace);
400
+ }
401
+ },
402
+
403
+ add: {
404
+ inlineCSS: function() {
405
+ var
406
+ width = module.cache.width || $module.outerWidth(),
407
+ height = module.cache.height || $module.outerHeight(),
408
+ isRTL = module.is.rtl(),
409
+ direction = module.get.direction(),
410
+ distance = {
411
+ left : width,
412
+ right : -width,
413
+ top : height,
414
+ bottom : -height
415
+ },
416
+ style
417
+ ;
418
+
419
+ if(isRTL){
420
+ module.verbose('RTL detected, flipping widths');
421
+ distance.left = -width;
422
+ distance.right = width;
423
+ }
424
+
425
+ style = '<style>';
426
+
427
+ if(direction === 'left' || direction === 'right') {
428
+ module.debug('Adding CSS rules for animation distance', width);
429
+ style += ''
430
+ + ' .ui.visible.' + direction + '.flyout ~ .fixed,'
431
+ + ' .ui.visible.' + direction + '.flyout ~ .pusher {'
432
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
433
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
434
+ + ' }'
435
+ ;
436
+ }
437
+ else if(direction === 'top' || direction == 'bottom') {
438
+ style += ''
439
+ + ' .ui.visible.' + direction + '.flyout ~ .fixed,'
440
+ + ' .ui.visible.' + direction + '.flyout ~ .pusher {'
441
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
442
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
443
+ + ' }'
444
+ ;
445
+ }
446
+
447
+ /* IE is only browser not to create context with transforms */
448
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
449
+ if( module.is.ie() ) {
450
+ if(direction === 'left' || direction === 'right') {
451
+ module.debug('Adding CSS rules for animation distance', width);
452
+ style += ''
453
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
454
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
455
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
456
+ + ' }'
457
+ ;
458
+ }
459
+ else if(direction === 'top' || direction == 'bottom') {
460
+ style += ''
461
+ + ' body.pushable > .ui.visible.' + direction + '.flyout ~ .pusher::after {'
462
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
463
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
464
+ + ' }'
465
+ ;
466
+ }
467
+ /* opposite sides visible forces content overlay */
468
+ style += ''
469
+ + ' body.pushable > .ui.visible.left.flyout ~ .ui.visible.right.flyout ~ .pusher::after,'
470
+ + ' body.pushable > .ui.visible.right.flyout ~ .ui.visible.left.flyout ~ .pusher::after {'
471
+ + ' -webkit-transform: translate3d(0, 0, 0);'
472
+ + ' transform: translate3d(0, 0, 0);'
473
+ + ' }'
474
+ ;
475
+ }
476
+ style += '</style>';
477
+ $style = $(style)
478
+ .appendTo($head)
479
+ ;
480
+ module.debug('Adding sizing css to head', $style);
481
+ },
482
+ keyboardShortcuts: function() {
483
+ module.verbose('Adding keyboard shortcuts');
484
+ $document
485
+ .on('keydown' + eventNamespace, module.event.keyboard)
486
+ ;
487
+ }
488
+ },
489
+ observeChanges: function() {
490
+ if('MutationObserver' in window) {
491
+ observer = new MutationObserver(function(mutations) {
492
+ module.refreshInputs();
493
+ });
494
+ observer.observe(element, {
495
+ childList : true,
496
+ subtree : true
497
+ });
498
+ module.debug('Setting up mutation observer', observer);
499
+ }
500
+ },
501
+ refresh: function() {
502
+ module.verbose('Refreshing selector cache');
503
+ $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
504
+ module.refreshFlyouts();
505
+ $pusher = $context.children(selector.pusher);
506
+ module.clear.cache();
507
+ },
508
+
509
+ refreshFlyouts: function() {
510
+ module.verbose('Refreshing other flyouts');
511
+ $flyouts = $context.children(selector.flyout);
512
+ },
513
+
514
+ refreshInputs: function(){
515
+ if($inputs){
516
+ $inputs
517
+ .off('keydown' + elementNamespace)
518
+ ;
519
+ }
520
+ if(!settings.dimPage){
521
+ return;
522
+ }
523
+ $inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
524
+ return $(this).closest('.disabled').length === 0;
525
+ });
526
+ $inputs.first()
527
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.first)
528
+ ;
529
+ $inputs.last()
530
+ .on('keydown' + elementNamespace, module.event.inputKeyDown.last)
531
+ ;
532
+ },
533
+
534
+ setup: {
535
+ cache: function() {
536
+ module.cache = {
537
+ width : $module.outerWidth(),
538
+ height : $module.outerHeight()
539
+ };
540
+ },
541
+ layout: function() {
542
+ if( $context.children(selector.pusher).length === 0 ) {
543
+ module.debug('Adding wrapper element for flyout');
544
+ module.error(error.pusher);
545
+ $pusher = $('<div class="pusher" />');
546
+ $context
547
+ .children()
548
+ .not(selector.omitted)
549
+ .not($flyouts)
550
+ .wrapAll($pusher)
551
+ ;
552
+ module.refresh();
553
+ }
554
+ if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
555
+ module.debug('Moved flyout to correct parent element');
556
+ module.error(error.movedFlyout, element);
557
+ $module.detach().prependTo($context);
558
+ module.refresh();
559
+ }
560
+ if( module.is.mobile() ) {
561
+ $module.addClass(className.fullscreen);
562
+ }
563
+ module.clear.cache();
564
+ module.set.pushable();
565
+ module.set.direction();
566
+ },
567
+ heights: function() {
568
+ module.debug('Setting up heights', $module);
569
+ var
570
+ $header = $module.children(selector.header),
571
+ $content = $module.children(selector.content),
572
+ $actions = $module.children(selector.actions)
573
+ ;
574
+ $content.css('min-height', ($context.height() - $header.outerHeight() - $actions.outerHeight()) + 'px');
575
+ }
576
+ },
577
+
578
+ attachEvents: function(selector, event) {
579
+ var
580
+ $toggle = $(selector)
581
+ ;
582
+ event = $.isFunction(module[event])
583
+ ? module[event]
584
+ : module.toggle
585
+ ;
586
+ if($toggle.length > 0) {
587
+ module.debug('Attaching flyout events to element', selector, event);
588
+ $toggle
589
+ .on('click' + eventNamespace, event)
590
+ ;
591
+ }
592
+ else {
593
+ module.error(error.notFound, selector);
594
+ }
595
+ },
596
+
597
+ show: function(callback) {
598
+ callback = $.isFunction(callback)
599
+ ? callback
600
+ : function(){}
601
+ ;
602
+ if(module.is.hidden()) {
603
+ if(settings.onShow.call(element) === false) {
604
+ module.verbose('Show callback returned false cancelling show');
605
+ return;
606
+ }
607
+ module.refresh();
608
+ if(module.othersActive()) {
609
+ module.debug('Other flyouts currently visible');
610
+ if(settings.exclusive) {
611
+ module.hideOthers();
612
+ } else {
613
+ ignoreRepeatedEvents = false;
614
+ }
615
+ }
616
+ module.set.dimmerStyles();
617
+ module.pushPage(function() {
618
+ callback.call(element);
619
+ settings.onVisible.call(element);
620
+ if(settings.keyboardShortcuts) {
621
+ module.add.keyboardShortcuts();
622
+ }
623
+ module.save.focus();
624
+ if(settings.autofocus) {
625
+ module.set.autofocus();
626
+ }
627
+ });
628
+ settings.onChange.call(element);
629
+ }
630
+ else {
631
+ module.debug('Flyout is already visible');
632
+ }
633
+ },
634
+
635
+ hide: function(callback) {
636
+ callback = $.isFunction(callback)
637
+ ? callback
638
+ : function(){}
639
+ ;
640
+ if(settings.onHide.call(element, $(this)) === false) {
641
+ module.verbose('Hide callback returned false cancelling hide');
642
+ ignoreRepeatedEvents = false;
643
+ return false;
644
+ }
645
+ if(module.is.visible() || module.is.animating()) {
646
+ module.debug('Hiding flyout', callback);
647
+ module.refreshFlyouts();
648
+ module.pullPage(function() {
649
+ callback.call(element);
650
+ if($.isFunction(settings.onHidden)) {
651
+ settings.onHidden.call(element);
652
+ }
653
+ module.restore.focus();
654
+ });
655
+ settings.onChange.call(element);
656
+ }
657
+ },
658
+
659
+ othersAnimating: function() {
660
+ return ($flyouts.not($module).filter('.' + className.animating).length > 0);
661
+ },
662
+ othersVisible: function() {
663
+ return ($flyouts.not($module).filter('.' + className.visible).length > 0);
664
+ },
665
+ othersActive: function() {
666
+ return(module.othersVisible() || module.othersAnimating());
667
+ },
668
+
669
+ hideOthers: function(callback) {
670
+ var
671
+ $otherFlyouts = $flyouts.not($module).filter('.' + className.visible),
672
+ flyoutCount = $otherFlyouts.length,
673
+ callbackCount = 0
674
+ ;
675
+ callback = callback || function(){};
676
+ $otherFlyouts
677
+ .flyout('hide', function() {
678
+ callbackCount++;
679
+ if(callbackCount == flyoutCount) {
680
+ callback();
681
+ }
682
+ })
683
+ ;
684
+ },
685
+
686
+ toggle: function() {
687
+ module.verbose('Determining toggled direction');
688
+ if(module.is.hidden()) {
689
+ module.show();
690
+ }
691
+ else {
692
+ module.hide();
693
+ }
694
+ },
695
+
696
+ pushPage: function(callback) {
697
+ var
698
+ animate,
699
+ dim,
700
+ transitionEnd
701
+ ;
702
+ callback = $.isFunction(callback)
703
+ ? callback
704
+ : function(){}
705
+ ;
706
+ module.set.overlay();
707
+ if(settings.returnScroll) {
708
+ currentScroll = (isBody ? $window : $context).scrollTop();
709
+ }
710
+ module.bind.scrollLock();
711
+ animate = function() {
712
+ module.bind.clickaway();
713
+ module.add.inlineCSS();
714
+ module.set.animating();
715
+ module.set.visible();
716
+ };
717
+ dim = function() {
718
+ module.set.dimmed();
719
+ };
720
+ transitionEnd = function(event) {
721
+ if( event.target == $module[0] ) {
722
+ $module.off(transitionEvent + elementNamespace, transitionEnd);
723
+ module.remove.animating();
724
+ callback.call(element);
725
+ }
726
+ };
727
+ $module.off(transitionEvent + elementNamespace);
728
+ $module.on(transitionEvent + elementNamespace, transitionEnd);
729
+ requestAnimationFrame(animate);
730
+ if(settings.dimPage && !module.othersVisible()) {
731
+ requestAnimationFrame(dim);
732
+ }
733
+ },
734
+
735
+ pullPage: function(callback) {
736
+ var
737
+ animate,
738
+ transitionEnd
739
+ ;
740
+ callback = $.isFunction(callback)
741
+ ? callback
742
+ : function(){}
743
+ ;
744
+ module.verbose('Removing context push state', module.get.direction());
745
+
746
+ module.unbind.clickaway();
747
+ if(!module.othersActive()) {
748
+ module.unbind.scrollLock();
749
+ if( settings.keyboardShortcuts ) {
750
+ module.remove.keyboardShortcuts();
751
+ }
752
+ }
753
+
754
+
755
+ animate = function() {
756
+ module.set.overlay();
757
+ module.set.animating();
758
+ if(settings.dimPage && !module.othersVisible()) {
759
+ module.set.closing();
760
+ }
761
+ module.remove.visible();
762
+ };
763
+ transitionEnd = function(event) {
764
+ if( event.target == $module[0] ) {
765
+ $module.off(transitionEvent + elementNamespace, transitionEnd);
766
+ module.remove.animating();
767
+ module.remove.closing();
768
+ module.remove.overlay();
769
+ module.remove.inlineCSS();
770
+ if(settings.returnScroll) {
771
+ module.scrollBack();
772
+ }
773
+ if (settings.dimPage && !module.othersVisible()) {
774
+ $pusher.removeClass(className.dimmed);
775
+ }
776
+ callback.call(element);
777
+ }
778
+ };
779
+ $module.off(transitionEvent + elementNamespace);
780
+ $module.on(transitionEvent + elementNamespace, transitionEnd);
781
+ requestAnimationFrame(animate);
782
+ },
783
+
784
+ scrollToTop: function() {
785
+ module.verbose('Scrolling to top of page to avoid animation issues');
786
+ $module.scrollTop(0);
787
+ (isBody ? $window : $context)[0].scrollTo(0, 0);
788
+ },
789
+
790
+ scrollBack: function() {
791
+ module.verbose('Scrolling back to original page position');
792
+ (isBody ? $window : $context)[0].scrollTo(0, currentScroll);
793
+ },
794
+
795
+ clear: {
796
+ cache: function() {
797
+ module.verbose('Clearing cached dimensions');
798
+ module.cache = {};
799
+ }
800
+ },
801
+
802
+ set: {
803
+ autofocus: function() {
804
+ var
805
+ $autofocus = $inputs.filter('[autofocus]'),
806
+ $input = ($autofocus.length > 0)
807
+ ? $autofocus.first()
808
+ : ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
809
+ ;
810
+ if($input.length > 0) {
811
+ $input.focus();
812
+ }
813
+ },
814
+ dimmerStyles: function() {
815
+ if(settings.blurring) {
816
+ $pusher.addClass(className.blurring);
817
+ }
818
+ else {
819
+ $pusher.removeClass(className.blurring);
820
+ }
821
+ },
822
+ bodyMargin: function() {
823
+ var position = module.can.leftBodyScrollbar() ? 'left':'right';
824
+ $context.css((isBody ? 'margin-':'padding-')+position, tempBodyMargin + 'px');
825
+ $context.find(selector.bodyFixed.replace('right',position)).each(function(){
826
+ var el = $(this),
827
+ attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
828
+ ;
829
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
830
+ });
831
+ },
832
+
833
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
834
+ // (This is no longer necessary in latest iOS)
835
+ ios: function() {
836
+ $html.addClass(className.ios);
837
+ },
838
+
839
+ // container
840
+ pushed: function() {
841
+ $context.addClass(className.pushed);
842
+ },
843
+ pushable: function() {
844
+ $context.addClass(className.pushable);
845
+ },
846
+
847
+ // pusher
848
+ dimmed: function() {
849
+ $pusher.addClass(className.dimmed);
850
+ },
851
+
852
+ // flyout
853
+ active: function() {
854
+ $module.addClass(className.active);
855
+ },
856
+ animating: function() {
857
+ $module.addClass(className.animating);
858
+ },
859
+ closing: function() {
860
+ $pusher.addClass(className.closing);
861
+ },
862
+ direction: function(direction) {
863
+ direction = direction || module.get.direction();
864
+ $module.addClass(className[direction]);
865
+ },
866
+ visible: function() {
867
+ $module.addClass(className.visible);
868
+ },
869
+ overlay: function() {
870
+ $module.addClass(className.overlay);
871
+ }
872
+ },
873
+ remove: {
874
+
875
+ inlineCSS: function() {
876
+ module.debug('Removing inline css styles', $style);
877
+ if($style && $style.length > 0) {
878
+ $style.remove();
879
+ }
880
+ },
881
+ keyboardShortcuts: function() {
882
+ module.verbose('Removing keyboard shortcuts');
883
+ $document
884
+ .off('keydown' + eventNamespace)
885
+ ;
886
+ },
887
+
888
+ // ios scroll on html not document
889
+ ios: function() {
890
+ $html.removeClass(className.ios);
891
+ },
892
+
893
+ // context
894
+ pushed: function() {
895
+ $context.removeClass(className.pushed);
896
+ },
897
+ pushable: function() {
898
+ $context.removeClass(className.pushable);
899
+ },
900
+
901
+ // flyout
902
+ active: function() {
903
+ $module.removeClass(className.active);
904
+ },
905
+ animating: function() {
906
+ $module.removeClass(className.animating);
907
+ },
908
+ closing: function() {
909
+ $pusher.removeClass(className.closing);
910
+ },
911
+ direction: function(direction) {
912
+ direction = direction || module.get.direction();
913
+ $module.removeClass(className[direction]);
914
+ },
915
+ visible: function() {
916
+ $module.removeClass(className.visible);
917
+ },
918
+ overlay: function() {
919
+ $module.removeClass(className.overlay);
920
+ }
921
+ },
922
+
923
+ get: {
924
+ direction: function() {
925
+ if($module.hasClass(className.top)) {
926
+ return className.top;
927
+ }
928
+ else if($module.hasClass(className.right)) {
929
+ return className.right;
930
+ }
931
+ else if($module.hasClass(className.bottom)) {
932
+ return className.bottom;
933
+ }
934
+ return className.left;
935
+ },
936
+ transitionEvent: function() {
937
+ var
938
+ element = document.createElement('element'),
939
+ transitions = {
940
+ 'transition' :'transitionend',
941
+ 'OTransition' :'oTransitionEnd',
942
+ 'MozTransition' :'transitionend',
943
+ 'WebkitTransition' :'webkitTransitionEnd'
944
+ },
945
+ transition
946
+ ;
947
+ for(transition in transitions){
948
+ if( element.style[transition] !== undefined ){
949
+ return transitions[transition];
950
+ }
951
+ }
952
+ },
953
+ id: function() {
954
+ return id;
955
+ },
956
+ element: function() {
957
+ return $module;
958
+ },
959
+ settings: function() {
960
+ return settings;
961
+ }
962
+ },
963
+
964
+ can: {
965
+ leftBodyScrollbar: function () {
966
+ if (module.cache.leftBodyScrollbar === undefined) {
967
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
968
+ }
969
+ return module.cache.leftBodyScrollbar;
970
+ }
971
+ },
972
+
973
+ save: {
974
+ focus: function() {
975
+ var
976
+ $activeElement = $(document.activeElement),
977
+ inCurrentFlyout = $activeElement.closest($module).length > 0
978
+ ;
979
+ if(!inCurrentFlyout) {
980
+ $focusedElement = $(document.activeElement).blur();
981
+ }
982
+ },
983
+ bodyMargin: function() {
984
+ initialBodyMargin = $context.css((isBody ? 'margin-':'padding-')+(module.can.leftBodyScrollbar() ? 'left':'right'));
985
+ var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
986
+ bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
987
+ tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
988
+ }
989
+ },
990
+
991
+ is: {
992
+ safari: function() {
993
+ if(module.cache.isSafari === undefined) {
994
+ module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
995
+ }
996
+ return module.cache.isSafari;
997
+ },
998
+ edge: function(){
999
+ if(module.cache.isEdge === undefined) {
1000
+ module.cache.isEdge = !!window.setImmediate && !module.is.ie();
1001
+ }
1002
+ return module.cache.isEdge;
1003
+ },
1004
+ firefox: function(){
1005
+ if(module.cache.isFirefox === undefined) {
1006
+ module.cache.isFirefox = !!window.InstallTrigger;
1007
+ }
1008
+ return module.cache.isFirefox;
1009
+ },
1010
+ iframe: function() {
1011
+ return !(self === top);
1012
+ },
1013
+ ie: function() {
1014
+ if(module.cache.isIE === undefined) {
1015
+ var
1016
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
1017
+ isIE = ('ActiveXObject' in window)
1018
+ ;
1019
+ module.cache.isIE = (isIE11 || isIE);
1020
+ }
1021
+ return module.cache.isIE;
1022
+ },
1023
+ ios: function() {
1024
+ var
1025
+ userAgent = navigator.userAgent,
1026
+ isIOS = userAgent.match(regExp.ios),
1027
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
1028
+ ;
1029
+ if(isIOS && !isMobileChrome) {
1030
+ module.verbose('Browser was found to be iOS', userAgent);
1031
+ return true;
1032
+ }
1033
+ else {
1034
+ return false;
1035
+ }
1036
+ },
1037
+ mobile: function() {
1038
+ var
1039
+ userAgent = navigator.userAgent,
1040
+ isMobile = userAgent.match(regExp.mobile)
1041
+ ;
1042
+ if(isMobile) {
1043
+ module.verbose('Browser was found to be mobile', userAgent);
1044
+ return true;
1045
+ }
1046
+ else {
1047
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
1048
+ return false;
1049
+ }
1050
+ },
1051
+ hidden: function() {
1052
+ return !module.is.visible();
1053
+ },
1054
+ visible: function() {
1055
+ return $module.hasClass(className.visible);
1056
+ },
1057
+ animating: function() {
1058
+ return $context.hasClass(className.animating);
1059
+ },
1060
+ rtl: function () {
1061
+ if(module.cache.isRTL === undefined) {
1062
+ module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
1063
+ }
1064
+ return module.cache.isRTL;
1065
+ }
1066
+ },
1067
+
1068
+ has: {
1069
+ configActions: function () {
1070
+ return Array.isArray(settings.actions) && settings.actions.length > 0;
1071
+ },
1072
+ scrollbar: function() {
1073
+ return isBody || $context.css('overflow-y') !== 'hidden';
1074
+ }
1075
+ },
1076
+
1077
+ restore: {
1078
+ focus: function() {
1079
+ if($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
1080
+ $focusedElement.focus();
1081
+ }
1082
+ },
1083
+ bodyMargin: function() {
1084
+ var position = module.can.leftBodyScrollbar() ? 'left':'right';
1085
+ $context.css((isBody ? 'margin-':'padding-')+position, initialBodyMargin);
1086
+ $context.find(selector.bodyFixed.replace('right',position)).each(function(){
1087
+ var el = $(this),
1088
+ attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
1089
+ ;
1090
+ el.css(attribute, '');
1091
+ });
1092
+ }
1093
+ },
1094
+
1095
+ helpers: {
1096
+ deQuote: function(string) {
1097
+ return String(string).replace(/"/g,"");
1098
+ },
1099
+ escape: function(string, preserveHTML) {
1100
+ if (preserveHTML){
1101
+ return string;
1102
+ }
1103
+ var
1104
+ badChars = /[<>"'`]/g,
1105
+ shouldEscape = /[&<>"'`]/,
1106
+ escape = {
1107
+ "<": "&lt;",
1108
+ ">": "&gt;",
1109
+ '"': "&quot;",
1110
+ "'": "&#x27;",
1111
+ "`": "&#x60;"
1112
+ },
1113
+ escapedChar = function(chr) {
1114
+ return escape[chr];
1115
+ }
1116
+ ;
1117
+ if(shouldEscape.test(string)) {
1118
+ string = string.replace(/&(?![a-z0-9#]{1,12};)/gi, "&amp;");
1119
+ return string.replace(badChars, escapedChar);
1120
+ }
1121
+ return string;
1122
+ }
1123
+ },
1124
+
1125
+ setting: function(name, value) {
1126
+ module.debug('Changing setting', name, value);
1127
+ if( $.isPlainObject(name) ) {
1128
+ $.extend(true, settings, name);
1129
+ }
1130
+ else if(value !== undefined) {
1131
+ if($.isPlainObject(settings[name])) {
1132
+ $.extend(true, settings[name], value);
1133
+ }
1134
+ else {
1135
+ settings[name] = value;
1136
+ }
1137
+ }
1138
+ else {
1139
+ return settings[name];
1140
+ }
1141
+ },
1142
+ internal: function(name, value) {
1143
+ if( $.isPlainObject(name) ) {
1144
+ $.extend(true, module, name);
1145
+ }
1146
+ else if(value !== undefined) {
1147
+ module[name] = value;
1148
+ }
1149
+ else {
1150
+ return module[name];
1151
+ }
1152
+ },
1153
+ debug: function() {
1154
+ if(!settings.silent && settings.debug) {
1155
+ if(settings.performance) {
1156
+ module.performance.log(arguments);
1157
+ }
1158
+ else {
1159
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1160
+ module.debug.apply(console, arguments);
1161
+ }
1162
+ }
1163
+ },
1164
+ verbose: function() {
1165
+ if(!settings.silent && settings.verbose && settings.debug) {
1166
+ if(settings.performance) {
1167
+ module.performance.log(arguments);
1168
+ }
1169
+ else {
1170
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1171
+ module.verbose.apply(console, arguments);
1172
+ }
1173
+ }
1174
+ },
1175
+ error: function() {
1176
+ if(!settings.silent) {
1177
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1178
+ module.error.apply(console, arguments);
1179
+ }
1180
+ },
1181
+ performance: {
1182
+ log: function(message) {
1183
+ var
1184
+ currentTime,
1185
+ executionTime,
1186
+ previousTime
1187
+ ;
1188
+ if(settings.performance) {
1189
+ currentTime = new Date().getTime();
1190
+ previousTime = time || currentTime;
1191
+ executionTime = currentTime - previousTime;
1192
+ time = currentTime;
1193
+ performance.push({
1194
+ 'Name' : message[0],
1195
+ 'Arguments' : [].slice.call(message, 1) || '',
1196
+ 'Element' : element,
1197
+ 'Execution Time' : executionTime
1198
+ });
1199
+ }
1200
+ clearTimeout(module.performance.timer);
1201
+ module.performance.timer = setTimeout(module.performance.display, 500);
1202
+ },
1203
+ display: function() {
1204
+ var
1205
+ title = settings.name + ':',
1206
+ totalTime = 0
1207
+ ;
1208
+ time = false;
1209
+ clearTimeout(module.performance.timer);
1210
+ $.each(performance, function(index, data) {
1211
+ totalTime += data['Execution Time'];
1212
+ });
1213
+ title += ' ' + totalTime + 'ms';
1214
+ if(moduleSelector) {
1215
+ title += ' \'' + moduleSelector + '\'';
1216
+ }
1217
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1218
+ console.groupCollapsed(title);
1219
+ if(console.table) {
1220
+ console.table(performance);
1221
+ }
1222
+ else {
1223
+ $.each(performance, function(index, data) {
1224
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
1225
+ });
1226
+ }
1227
+ console.groupEnd();
1228
+ }
1229
+ performance = [];
1230
+ }
1231
+ },
1232
+ invoke: function(query, passedArguments, context) {
1233
+ var
1234
+ object = instance,
1235
+ maxDepth,
1236
+ found,
1237
+ response
1238
+ ;
1239
+ passedArguments = passedArguments || queryArguments;
1240
+ context = element || context;
1241
+ if(typeof query == 'string' && object !== undefined) {
1242
+ query = query.split(/[\. ]/);
1243
+ maxDepth = query.length - 1;
1244
+ $.each(query, function(depth, value) {
1245
+ var camelCaseValue = (depth != maxDepth)
1246
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1247
+ : query
1248
+ ;
1249
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
1250
+ object = object[camelCaseValue];
1251
+ }
1252
+ else if( object[camelCaseValue] !== undefined ) {
1253
+ found = object[camelCaseValue];
1254
+ return false;
1255
+ }
1256
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
1257
+ object = object[value];
1258
+ }
1259
+ else if( object[value] !== undefined ) {
1260
+ found = object[value];
1261
+ return false;
1262
+ }
1263
+ else {
1264
+ module.error(error.method, query);
1265
+ return false;
1266
+ }
1267
+ });
1268
+ }
1269
+ if ( $.isFunction( found ) ) {
1270
+ response = found.apply(context, passedArguments);
1271
+ }
1272
+ else if(found !== undefined) {
1273
+ response = found;
1274
+ }
1275
+ if(Array.isArray(returnedValue)) {
1276
+ returnedValue.push(response);
1277
+ }
1278
+ else if(returnedValue !== undefined) {
1279
+ returnedValue = [returnedValue, response];
1280
+ }
1281
+ else if(response !== undefined) {
1282
+ returnedValue = response;
1283
+ }
1284
+ return found;
1285
+ }
1286
+ }
1287
+ ;
1288
+
1289
+ if(methodInvoked) {
1290
+ if(instance === undefined) {
1291
+ if ($.isFunction(settings.templates[query])) {
1292
+ settings.autoShow = true;
1293
+ settings.className.flyout = settings.className.template;
1294
+ settings = $.extend(true, {}, settings, settings.templates[query].apply(module ,queryArguments));
1295
+
1296
+ // reassign shortcuts
1297
+ className = settings.className;
1298
+ namespace = settings.namespace;
1299
+ fields = settings.fields;
1300
+ error = settings.error;
1301
+ }
1302
+ module.initialize();
1303
+ }
1304
+ if (!$.isFunction(settings.templates[query])) {
1305
+ module.invoke(query);
1306
+ }
1307
+ }
1308
+ else {
1309
+ if(instance !== undefined) {
1310
+ instance.invoke('destroy');
1311
+ }
1312
+ module.initialize();
1313
+ returnedValue = $module;
1314
+ }
1315
+ });
1316
+
1317
+ return (returnedValue !== undefined)
1318
+ ? returnedValue
1319
+ : this
1320
+ ;
1321
+ };
1322
+
1323
+ $.fn.flyout.settings = {
1324
+
1325
+ name : 'Flyout',
1326
+ namespace : 'flyout',
1327
+
1328
+ silent : false,
1329
+ debug : false,
1330
+ verbose : false,
1331
+ performance : true,
1332
+
1333
+ context : 'body',
1334
+ exclusive : false,
1335
+ closable : true,
1336
+ autofocus : true,
1337
+ restoreFocus : true,
1338
+ dimPage : true,
1339
+ scrollLock : false,
1340
+ returnScroll : false,
1341
+ delaySetup : false,
1342
+ autoShow : false,
1343
+
1344
+ keyboardShortcuts: true,
1345
+
1346
+ //dynamic content
1347
+ title : '',
1348
+ content : '',
1349
+ class : '',
1350
+ classTitle : '',
1351
+ classContent : '',
1352
+ classActions : '',
1353
+ closeIcon : false,
1354
+ actions : false,
1355
+ preserveHTML : true,
1356
+
1357
+ fields : {
1358
+ class : 'class',
1359
+ text : 'text',
1360
+ icon : 'icon',
1361
+ click : 'click'
1362
+ },
1363
+
1364
+ onChange : function(){},
1365
+ onShow : function(){},
1366
+ onHide : function(){ return true; },
1367
+
1368
+ onHidden : false,
1369
+ onVisible : function(){},
1370
+
1371
+ onApprove : function(){},
1372
+ onDeny : function(){},
1373
+
1374
+ keys : {
1375
+ space : 32,
1376
+ enter : 13,
1377
+ escape : 27,
1378
+ tab : 9,
1379
+ },
1380
+
1381
+ className : {
1382
+ flyout : 'ui flyout',
1383
+ close : 'close icon',
1384
+ header : 'ui header',
1385
+ content : 'content',
1386
+ actions : 'actions',
1387
+ active : 'active',
1388
+ animating : 'animating',
1389
+ blurring : 'blurring',
1390
+ closing : 'closing',
1391
+ dimmed : 'dimmed',
1392
+ ios : 'ios',
1393
+ locked : 'locked',
1394
+ pushable : 'pushable',
1395
+ pushed : 'pushed',
1396
+ right : 'right',
1397
+ top : 'top',
1398
+ left : 'left',
1399
+ bottom : 'bottom',
1400
+ visible : 'visible',
1401
+ overlay : 'overlay',
1402
+ fullscreen : 'fullscreen',
1403
+ template : 'ui flyout',
1404
+ button : 'ui button',
1405
+ ok : 'positive',
1406
+ cancel : 'negative',
1407
+ prompt : 'ui fluid input'
1408
+ },
1409
+
1410
+ selector: {
1411
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.right.flyout, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1412
+ fixed : '.fixed',
1413
+ omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1414
+ pusher : '.pusher',
1415
+ flyout : '.ui.flyout',
1416
+ header : '.ui.header',
1417
+ content : '.content',
1418
+ actions : '.actions',
1419
+ close : '.close',
1420
+ approve : '.actions .positive, .actions .approve, .actions .ok',
1421
+ deny : '.actions .negative, .actions .deny, .actions .cancel'
1422
+ },
1423
+
1424
+ regExp: {
1425
+ ios : /(iPad|iPhone|iPod)/g,
1426
+ mobileChrome : /(CriOS)/g,
1427
+ mobile : /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
1428
+ },
1429
+
1430
+ error : {
1431
+ method : 'The method you called is not defined.',
1432
+ pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1433
+ movedFlyout : 'Had to move flyout. For optimal performance make sure flyout and pusher are direct children of your body tag',
1434
+ notFound : 'There were no elements that matched the specified selector'
1435
+ },
1436
+
1437
+ text: {
1438
+ ok : 'Ok',
1439
+ cancel : 'Cancel',
1440
+ close : 'Close'
1441
+ }
1442
+ };
1443
+
1444
+ $.fn.flyout.settings.templates = {
1445
+ getArguments: function(args) {
1446
+ var queryArguments = [].slice.call(args);
1447
+ if($.isPlainObject(queryArguments[0])){
1448
+ return $.extend({
1449
+ handler:function(){},
1450
+ content:'',
1451
+ title: ''
1452
+ }, queryArguments[0]);
1453
+ } else {
1454
+ if(!$.isFunction(queryArguments[queryArguments.length-1])) {
1455
+ queryArguments.push(function() {});
1456
+ }
1457
+ return {
1458
+ handler: queryArguments.pop(),
1459
+ content: queryArguments.pop() || '',
1460
+ title: queryArguments.pop() || ''
1461
+ };
1462
+ }
1463
+ },
1464
+ alert: function () {
1465
+ var
1466
+ settings = this.get.settings(),
1467
+ args = settings.templates.getArguments(arguments)
1468
+ ;
1469
+ return {
1470
+ title : args.title,
1471
+ content: args.content,
1472
+ actions: [{
1473
+ text : settings.text.ok,
1474
+ class: settings.className.ok,
1475
+ click: args.handler
1476
+ }]
1477
+ }
1478
+ },
1479
+ confirm: function () {
1480
+ var
1481
+ settings = this.get.settings(),
1482
+ args = settings.templates.getArguments(arguments)
1483
+ ;
1484
+ return {
1485
+ title : args.title,
1486
+ content: args.content,
1487
+ actions: [{
1488
+ text : settings.text.ok,
1489
+ class: settings.className.ok,
1490
+ click: function(){args.handler(true)}
1491
+ },{
1492
+ text: settings.text.cancel,
1493
+ class: settings.className.cancel,
1494
+ click: function(){args.handler(false)}
1495
+ }]
1496
+ }
1497
+ },
1498
+ prompt: function () {
1499
+ var
1500
+ $this = this,
1501
+ settings = this.get.settings(),
1502
+ args = settings.templates.getArguments(arguments),
1503
+ input = $($.parseHTML(args.content)).filter('.ui.input')
1504
+ ;
1505
+ if (input.length === 0) {
1506
+ 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>';
1507
+ }
1508
+ return {
1509
+ title : args.title,
1510
+ content: args.content,
1511
+ actions: [{
1512
+ text: settings.text.ok,
1513
+ class: settings.className.ok,
1514
+ click: function(){
1515
+ var settings = $this.get.settings(),
1516
+ inputField = $this.get.element().find(settings.selector.prompt)[0]
1517
+ ;
1518
+ args.handler($(inputField).val());
1519
+ }
1520
+ },{
1521
+ text: settings.text.cancel,
1522
+ class: settings.className.cancel,
1523
+ click: function(){args.handler(null)}
1524
+ }]
1525
+ }
1526
+ }
1527
+ };
1528
+
1529
+ })( jQuery, window, document );