fomantic-ui 2.9.1-beta.8 → 2.9.1

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