govuk_publishing_components 9.3.6 → 9.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (261) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/app/assets/stylesheets/component_guide/application.scss +10 -0
  4. data/app/assets/stylesheets/govuk_publishing_components/_all_components.scss +1 -0
  5. data/app/assets/stylesheets/govuk_publishing_components/admin_styles.scss +13 -0
  6. data/app/assets/stylesheets/govuk_publishing_components/components/_highlight-boxes.scss +66 -0
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-footer.scss +1 -0
  8. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-for-admin.scss +1 -0
  9. data/app/models/govuk_publishing_components/component_doc.rb +12 -0
  10. data/app/views/govuk_publishing_components/component_guide/component_doc/_preview.html.erb +7 -5
  11. data/app/views/govuk_publishing_components/component_guide/show.html.erb +22 -0
  12. data/app/views/govuk_publishing_components/components/_highlight_boxes.html.erb +39 -0
  13. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +26 -0
  14. data/app/views/govuk_publishing_components/components/_layout_for_admin.html.erb +10 -0
  15. data/app/views/govuk_publishing_components/components/docs/highlight_boxes.yml +142 -0
  16. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +12 -0
  17. data/app/views/govuk_publishing_components/components/docs/layout_for_admin.yml +28 -0
  18. data/app/views/govuk_publishing_components/components/docs/metadata.yml +1 -0
  19. data/app/views/layouts/govuk_publishing_components/application.html.erb +5 -0
  20. data/config/initializers/assets.rb +12 -0
  21. data/lib/govuk_publishing_components.rb +1 -0
  22. data/lib/govuk_publishing_components/presenters/highlight_boxes_helper.rb +13 -0
  23. data/lib/govuk_publishing_components/presenters/meta_tags.rb +1 -0
  24. data/lib/govuk_publishing_components/version.rb +1 -1
  25. data/node_modules/govuk-frontend/README.md +96 -0
  26. data/node_modules/govuk-frontend/all-ie8.scss +6 -0
  27. data/node_modules/govuk-frontend/all.js +1720 -0
  28. data/node_modules/govuk-frontend/all.scss +11 -0
  29. data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
  30. data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
  31. data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
  32. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
  33. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
  34. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
  35. data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
  36. data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
  37. data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
  38. data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
  39. data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
  40. data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
  41. data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
  42. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
  43. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
  44. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
  45. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
  46. data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
  47. data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
  48. data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
  49. data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
  50. data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
  51. data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
  52. data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
  53. data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
  54. data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
  55. data/node_modules/govuk-frontend/common.js +39 -0
  56. data/node_modules/govuk-frontend/components/_all.scss +26 -0
  57. data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
  58. data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
  59. data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
  60. data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
  61. data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
  62. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
  63. data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
  64. data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
  65. data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
  66. data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
  67. data/node_modules/govuk-frontend/components/button/README.md +319 -0
  68. data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
  69. data/node_modules/govuk-frontend/components/button/button.js +548 -0
  70. data/node_modules/govuk-frontend/components/button/button.njk +3 -0
  71. data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
  72. data/node_modules/govuk-frontend/components/button/template.njk +35 -0
  73. data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
  74. data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
  75. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
  76. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
  77. data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
  78. data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
  79. data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
  80. data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
  81. data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
  82. data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
  83. data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
  84. data/node_modules/govuk-frontend/components/details/README.md +237 -0
  85. data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
  86. data/node_modules/govuk-frontend/components/details/details.js +836 -0
  87. data/node_modules/govuk-frontend/components/details/details.njk +7 -0
  88. data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
  89. data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
  90. data/node_modules/govuk-frontend/components/details/template.njk +10 -0
  91. data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
  92. data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
  93. data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
  94. data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
  95. data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
  96. data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
  97. data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
  98. data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
  99. data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
  100. data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
  101. data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
  102. data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
  103. data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
  104. data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
  105. data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
  106. data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
  107. data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
  108. data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
  109. data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
  110. data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
  111. data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
  112. data/node_modules/govuk-frontend/components/footer/README.md +284 -0
  113. data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
  114. data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
  115. data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
  116. data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
  117. data/node_modules/govuk-frontend/components/header/README.md +524 -0
  118. data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
  119. data/node_modules/govuk-frontend/components/header/header.js +717 -0
  120. data/node_modules/govuk-frontend/components/header/header.njk +3 -0
  121. data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
  122. data/node_modules/govuk-frontend/components/header/template.njk +82 -0
  123. data/node_modules/govuk-frontend/components/hint/README.md +157 -0
  124. data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
  125. data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
  126. data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
  127. data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
  128. data/node_modules/govuk-frontend/components/input/README.md +416 -0
  129. data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
  130. data/node_modules/govuk-frontend/components/input/input.njk +9 -0
  131. data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
  132. data/node_modules/govuk-frontend/components/input/template.njk +42 -0
  133. data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
  134. data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
  135. data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
  136. data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
  137. data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
  138. data/node_modules/govuk-frontend/components/label/README.md +193 -0
  139. data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
  140. data/node_modules/govuk-frontend/components/label/label.njk +6 -0
  141. data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
  142. data/node_modules/govuk-frontend/components/label/template.njk +15 -0
  143. data/node_modules/govuk-frontend/components/panel/README.md +151 -0
  144. data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
  145. data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
  146. data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
  147. data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
  148. data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
  149. data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
  150. data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
  151. data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
  152. data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
  153. data/node_modules/govuk-frontend/components/radios/README.md +686 -0
  154. data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
  155. data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
  156. data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
  157. data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
  158. data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
  159. data/node_modules/govuk-frontend/components/select/README.md +387 -0
  160. data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
  161. data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
  162. data/node_modules/govuk-frontend/components/select/select.njk +24 -0
  163. data/node_modules/govuk-frontend/components/select/template.njk +44 -0
  164. data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
  165. data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
  166. data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
  167. data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
  168. data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
  169. data/node_modules/govuk-frontend/components/table/README.md +585 -0
  170. data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
  171. data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
  172. data/node_modules/govuk-frontend/components/table/table.njk +45 -0
  173. data/node_modules/govuk-frontend/components/table/template.njk +39 -0
  174. data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
  175. data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
  176. data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
  177. data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
  178. data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
  179. data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
  180. data/node_modules/govuk-frontend/components/tag/README.md +150 -0
  181. data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
  182. data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
  183. data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
  184. data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
  185. data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
  186. data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
  187. data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
  188. data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
  189. data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
  190. data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
  191. data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
  192. data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
  193. data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
  194. data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
  195. data/node_modules/govuk-frontend/core/_all.scss +6 -0
  196. data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
  197. data/node_modules/govuk-frontend/core/_links.scss +40 -0
  198. data/node_modules/govuk-frontend/core/_lists.scss +63 -0
  199. data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
  200. data/node_modules/govuk-frontend/core/_template.scss +16 -0
  201. data/node_modules/govuk-frontend/core/_typography.scss +186 -0
  202. data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
  203. data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
  204. data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
  205. data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
  206. data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
  207. data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
  208. data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
  209. data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
  210. data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
  211. data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
  212. data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
  213. data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
  214. data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
  215. data/node_modules/govuk-frontend/objects/_all.scss +4 -0
  216. data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
  217. data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
  218. data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
  219. data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
  220. data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
  221. data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
  222. data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
  223. data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
  224. data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
  225. data/node_modules/govuk-frontend/package.json +89 -0
  226. data/node_modules/govuk-frontend/settings/_all.scss +21 -0
  227. data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
  228. data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
  229. data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
  230. data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
  231. data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
  232. data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
  233. data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
  234. data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
  235. data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
  236. data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
  237. data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
  238. data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
  239. data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
  240. data/node_modules/govuk-frontend/template.njk +56 -0
  241. data/node_modules/govuk-frontend/tools/_all.scss +7 -0
  242. data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
  243. data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
  244. data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
  245. data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
  246. data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
  247. data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
  248. data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
  249. data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
  250. data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
  251. data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
  252. data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
  253. data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
  254. data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
  255. data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
  256. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
  257. data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
  258. data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
  259. data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
  260. data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
  261. metadata +249 -2
@@ -0,0 +1,120 @@
1
+ @import "../../settings/all";
2
+ @import "../../tools/all";
3
+ @import "../../helpers/all";
4
+
5
+ @include govuk-exports("govuk/component/tabs") {
6
+
7
+ .govuk-tabs {
8
+ @include govuk-font($size: 19);
9
+ @include govuk-text-colour;
10
+ @include govuk-responsive-margin(1, "top");
11
+ }
12
+
13
+ .govuk-tabs__title {
14
+ @include govuk-font($size: 19);
15
+ margin-bottom: govuk-spacing(1);
16
+ }
17
+
18
+ .govuk-tabs__list {
19
+ margin: 0;
20
+ padding: 0;
21
+ list-style: none;
22
+ @include mq($until: tablet) {
23
+ @include govuk-responsive-margin(2, "bottom");
24
+ }
25
+ }
26
+
27
+ .govuk-tabs__list-item {
28
+ margin-left: govuk-spacing(5);
29
+
30
+ &::before {
31
+ content: "— ";
32
+ margin-left: - govuk-spacing(5);
33
+ padding-right: govuk-spacing(1);
34
+ }
35
+ }
36
+
37
+ .govuk-tabs__tab {
38
+ @include govuk-link-common;
39
+ @include govuk-link-style-default;
40
+ @include govuk-font($size: 19);
41
+
42
+ display: inline-block;
43
+ padding-top: govuk-spacing(2);
44
+ padding-bottom: govuk-spacing(2);
45
+
46
+ &[aria-current = "true"] {
47
+ color: govuk-colour("black");
48
+ text-decoration: none;
49
+ }
50
+ }
51
+
52
+ // JavaScript enabled
53
+ .js-enabled {
54
+
55
+ @include mq($from: tablet) {
56
+
57
+ .govuk-tabs__list {
58
+ @include govuk-clearfix;
59
+ border-bottom: 1px solid $govuk-border-colour;
60
+ }
61
+
62
+ .govuk-tabs__list-item {
63
+ margin-left: 0;
64
+
65
+ &::before {
66
+ content: none;
67
+ }
68
+ }
69
+
70
+ .govuk-tabs__title {
71
+ display: none;
72
+ }
73
+
74
+ .govuk-tabs__tab {
75
+ margin-right: govuk-spacing(1);
76
+ padding-right: govuk-spacing(4);
77
+ padding-left: govuk-spacing(4);
78
+ float: left;
79
+ color: govuk-colour("black");
80
+ background-color: govuk-colour("grey-4");
81
+ text-align: center;
82
+ text-decoration: none;
83
+
84
+ &[aria-selected= "true"] {
85
+ margin-top: - govuk-spacing(1);
86
+ margin-bottom: -1px;
87
+
88
+ // 1px is compensation for border (otherwise we get a 1px shift)
89
+ padding-top: govuk-spacing(3) - 1px;
90
+ padding-right: govuk-spacing(4) - 1px;
91
+ padding-bottom: govuk-spacing(3) + 1px;
92
+ padding-left: govuk-spacing(4) - 1px;
93
+
94
+ border: 1px solid $govuk-border-colour;
95
+ border-bottom: 0;
96
+ color: govuk-colour("black");
97
+ background-color: govuk-colour("white");
98
+
99
+ &:focus {
100
+ background-color: transparent;
101
+ }
102
+ }
103
+ }
104
+
105
+ .govuk-tabs__panel {
106
+ padding-top: govuk-spacing(6);
107
+ padding-right: govuk-spacing(4);
108
+ padding-bottom: govuk-spacing(2);
109
+ padding-left: govuk-spacing(4);
110
+ border: 1px solid $govuk-border-colour;
111
+ border-top: 0;
112
+ }
113
+ }
114
+
115
+ }
116
+
117
+ .js-hidden {
118
+ display: none;
119
+ }
120
+ }
@@ -0,0 +1,3 @@
1
+ {% macro govukTabs(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,1302 @@
1
+ (function (global, factory) {
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3
+ typeof define === 'function' && define.amd ? define('GOVUKFrontend', factory) :
4
+ (global.GOVUKFrontend = factory());
5
+ }(this, (function () { 'use strict';
6
+
7
+ (function(undefined) {
8
+
9
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Object/defineProperty/detect.js
10
+ var detect = (
11
+ // In IE8, defineProperty could only act on DOM elements, so full support
12
+ // for the feature requires the ability to set a property on an arbitrary object
13
+ 'defineProperty' in Object && (function() {
14
+ try {
15
+ var a = {};
16
+ Object.defineProperty(a, 'test', {value:42});
17
+ return true;
18
+ } catch(e) {
19
+ return false
20
+ }
21
+ }())
22
+ );
23
+
24
+ if (detect) return
25
+
26
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Object.defineProperty&flags=always
27
+ (function (nativeDefineProperty) {
28
+
29
+ var supportsAccessors = Object.prototype.hasOwnProperty('__defineGetter__');
30
+ var ERR_ACCESSORS_NOT_SUPPORTED = 'Getters & setters cannot be defined on this javascript engine';
31
+ var ERR_VALUE_ACCESSORS = 'A property cannot both have accessors and be writable or have a value';
32
+
33
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
34
+
35
+ // Where native support exists, assume it
36
+ if (nativeDefineProperty && (object === window || object === document || object === Element.prototype || object instanceof Element)) {
37
+ return nativeDefineProperty(object, property, descriptor);
38
+ }
39
+
40
+ if (object === null || !(object instanceof Object || typeof object === 'object')) {
41
+ throw new TypeError('Object.defineProperty called on non-object');
42
+ }
43
+
44
+ if (!(descriptor instanceof Object)) {
45
+ throw new TypeError('Property description must be an object');
46
+ }
47
+
48
+ var propertyString = String(property);
49
+ var hasValueOrWritable = 'value' in descriptor || 'writable' in descriptor;
50
+ var getterType = 'get' in descriptor && typeof descriptor.get;
51
+ var setterType = 'set' in descriptor && typeof descriptor.set;
52
+
53
+ // handle descriptor.get
54
+ if (getterType) {
55
+ if (getterType !== 'function') {
56
+ throw new TypeError('Getter must be a function');
57
+ }
58
+ if (!supportsAccessors) {
59
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
60
+ }
61
+ if (hasValueOrWritable) {
62
+ throw new TypeError(ERR_VALUE_ACCESSORS);
63
+ }
64
+ Object.__defineGetter__.call(object, propertyString, descriptor.get);
65
+ } else {
66
+ object[propertyString] = descriptor.value;
67
+ }
68
+
69
+ // handle descriptor.set
70
+ if (setterType) {
71
+ if (setterType !== 'function') {
72
+ throw new TypeError('Setter must be a function');
73
+ }
74
+ if (!supportsAccessors) {
75
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
76
+ }
77
+ if (hasValueOrWritable) {
78
+ throw new TypeError(ERR_VALUE_ACCESSORS);
79
+ }
80
+ Object.__defineSetter__.call(object, propertyString, descriptor.set);
81
+ }
82
+
83
+ // OK to define value unconditionally - if a getter has been specified as well, an error would be thrown above
84
+ if ('value' in descriptor) {
85
+ object[propertyString] = descriptor.value;
86
+ }
87
+
88
+ return object;
89
+ };
90
+ }(Object.defineProperty));
91
+ })
92
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
93
+
94
+ (function(undefined) {
95
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Function/prototype/bind/detect.js
96
+ var detect = 'bind' in Function.prototype;
97
+
98
+ if (detect) return
99
+
100
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Function.prototype.bind&flags=always
101
+ Object.defineProperty(Function.prototype, 'bind', {
102
+ value: function bind(that) { // .length is 1
103
+ // add necessary es5-shim utilities
104
+ var $Array = Array;
105
+ var $Object = Object;
106
+ var ObjectPrototype = $Object.prototype;
107
+ var ArrayPrototype = $Array.prototype;
108
+ var Empty = function Empty() {};
109
+ var to_string = ObjectPrototype.toString;
110
+ var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
111
+ var isCallable; /* inlined from https://npmjs.com/is-callable */ var fnToStr = Function.prototype.toString, tryFunctionObject = function tryFunctionObject(value) { try { fnToStr.call(value); return true; } catch (e) { return false; } }, fnClass = '[object Function]', genClass = '[object GeneratorFunction]'; isCallable = function isCallable(value) { if (typeof value !== 'function') { return false; } if (hasToStringTag) { return tryFunctionObject(value); } var strClass = to_string.call(value); return strClass === fnClass || strClass === genClass; };
112
+ var array_slice = ArrayPrototype.slice;
113
+ var array_concat = ArrayPrototype.concat;
114
+ var array_push = ArrayPrototype.push;
115
+ var max = Math.max;
116
+ // /add necessary es5-shim utilities
117
+
118
+ // 1. Let Target be the this value.
119
+ var target = this;
120
+ // 2. If IsCallable(Target) is false, throw a TypeError exception.
121
+ if (!isCallable(target)) {
122
+ throw new TypeError('Function.prototype.bind called on incompatible ' + target);
123
+ }
124
+ // 3. Let A be a new (possibly empty) internal list of all of the
125
+ // argument values provided after thisArg (arg1, arg2 etc), in order.
126
+ // XXX slicedArgs will stand in for "A" if used
127
+ var args = array_slice.call(arguments, 1); // for normal call
128
+ // 4. Let F be a new native ECMAScript object.
129
+ // 11. Set the [[Prototype]] internal property of F to the standard
130
+ // built-in Function prototype object as specified in 15.3.3.1.
131
+ // 12. Set the [[Call]] internal property of F as described in
132
+ // 15.3.4.5.1.
133
+ // 13. Set the [[Construct]] internal property of F as described in
134
+ // 15.3.4.5.2.
135
+ // 14. Set the [[HasInstance]] internal property of F as described in
136
+ // 15.3.4.5.3.
137
+ var bound;
138
+ var binder = function () {
139
+
140
+ if (this instanceof bound) {
141
+ // 15.3.4.5.2 [[Construct]]
142
+ // When the [[Construct]] internal method of a function object,
143
+ // F that was created using the bind function is called with a
144
+ // list of arguments ExtraArgs, the following steps are taken:
145
+ // 1. Let target be the value of F's [[TargetFunction]]
146
+ // internal property.
147
+ // 2. If target has no [[Construct]] internal method, a
148
+ // TypeError exception is thrown.
149
+ // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
150
+ // property.
151
+ // 4. Let args be a new list containing the same values as the
152
+ // list boundArgs in the same order followed by the same
153
+ // values as the list ExtraArgs in the same order.
154
+ // 5. Return the result of calling the [[Construct]] internal
155
+ // method of target providing args as the arguments.
156
+
157
+ var result = target.apply(
158
+ this,
159
+ array_concat.call(args, array_slice.call(arguments))
160
+ );
161
+ if ($Object(result) === result) {
162
+ return result;
163
+ }
164
+ return this;
165
+
166
+ } else {
167
+ // 15.3.4.5.1 [[Call]]
168
+ // When the [[Call]] internal method of a function object, F,
169
+ // which was created using the bind function is called with a
170
+ // this value and a list of arguments ExtraArgs, the following
171
+ // steps are taken:
172
+ // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
173
+ // property.
174
+ // 2. Let boundThis be the value of F's [[BoundThis]] internal
175
+ // property.
176
+ // 3. Let target be the value of F's [[TargetFunction]] internal
177
+ // property.
178
+ // 4. Let args be a new list containing the same values as the
179
+ // list boundArgs in the same order followed by the same
180
+ // values as the list ExtraArgs in the same order.
181
+ // 5. Return the result of calling the [[Call]] internal method
182
+ // of target providing boundThis as the this value and
183
+ // providing args as the arguments.
184
+
185
+ // equiv: target.call(this, ...boundArgs, ...args)
186
+ return target.apply(
187
+ that,
188
+ array_concat.call(args, array_slice.call(arguments))
189
+ );
190
+
191
+ }
192
+
193
+ };
194
+
195
+ // 15. If the [[Class]] internal property of Target is "Function", then
196
+ // a. Let L be the length property of Target minus the length of A.
197
+ // b. Set the length own property of F to either 0 or L, whichever is
198
+ // larger.
199
+ // 16. Else set the length own property of F to 0.
200
+
201
+ var boundLength = max(0, target.length - args.length);
202
+
203
+ // 17. Set the attributes of the length own property of F to the values
204
+ // specified in 15.3.5.1.
205
+ var boundArgs = [];
206
+ for (var i = 0; i < boundLength; i++) {
207
+ array_push.call(boundArgs, '$' + i);
208
+ }
209
+
210
+ // XXX Build a dynamic function with desired amount of arguments is the only
211
+ // way to set the length property of a function.
212
+ // In environments where Content Security Policies enabled (Chrome extensions,
213
+ // for ex.) all use of eval or Function costructor throws an exception.
214
+ // However in all of these environments Function.prototype.bind exists
215
+ // and so this code will never be executed.
216
+ bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
217
+
218
+ if (target.prototype) {
219
+ Empty.prototype = target.prototype;
220
+ bound.prototype = new Empty();
221
+ // Clean up dangling references.
222
+ Empty.prototype = null;
223
+ }
224
+
225
+ // TODO
226
+ // 18. Set the [[Extensible]] internal property of F to true.
227
+
228
+ // TODO
229
+ // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
230
+ // 20. Call the [[DefineOwnProperty]] internal method of F with
231
+ // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
232
+ // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
233
+ // false.
234
+ // 21. Call the [[DefineOwnProperty]] internal method of F with
235
+ // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
236
+ // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
237
+ // and false.
238
+
239
+ // TODO
240
+ // NOTE Function objects created using Function.prototype.bind do not
241
+ // have a prototype property or the [[Code]], [[FormalParameters]], and
242
+ // [[Scope]] internal properties.
243
+ // XXX can't delete prototype in pure-js.
244
+
245
+ // 22. Return F.
246
+ return bound;
247
+ }
248
+ });
249
+ })
250
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
251
+
252
+ (function(undefined) {
253
+
254
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/detect.js
255
+ var detect = (
256
+ 'DOMTokenList' in this && (function (x) {
257
+ return 'classList' in x ? !x.classList.toggle('x', false) && !x.className : true;
258
+ })(document.createElement('x'))
259
+ );
260
+
261
+ if (detect) return
262
+
263
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/master/packages/polyfill-library/polyfills/DOMTokenList/polyfill.js
264
+ (function (global) {
265
+ var nativeImpl = "DOMTokenList" in global && global.DOMTokenList;
266
+
267
+ if (
268
+ !nativeImpl ||
269
+ (
270
+ !!document.createElementNS &&
271
+ !!document.createElementNS('http://www.w3.org/2000/svg', 'svg') &&
272
+ !(document.createElementNS("http://www.w3.org/2000/svg", "svg").classList instanceof DOMTokenList)
273
+ )
274
+ ) {
275
+ global.DOMTokenList = (function() { // eslint-disable-line no-unused-vars
276
+ var dpSupport = true;
277
+ var defineGetter = function (object, name, fn, configurable) {
278
+ if (Object.defineProperty)
279
+ Object.defineProperty(object, name, {
280
+ configurable: false === dpSupport ? true : !!configurable,
281
+ get: fn
282
+ });
283
+
284
+ else object.__defineGetter__(name, fn);
285
+ };
286
+
287
+ /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
288
+ try {
289
+ defineGetter({}, "support");
290
+ }
291
+ catch (e) {
292
+ dpSupport = false;
293
+ }
294
+
295
+
296
+ var _DOMTokenList = function (el, prop) {
297
+ var that = this;
298
+ var tokens = [];
299
+ var tokenMap = {};
300
+ var length = 0;
301
+ var maxLength = 0;
302
+ var addIndexGetter = function (i) {
303
+ defineGetter(that, i, function () {
304
+ preop();
305
+ return tokens[i];
306
+ }, false);
307
+
308
+ };
309
+ var reindex = function () {
310
+
311
+ /** Define getter functions for array-like access to the tokenList's contents. */
312
+ if (length >= maxLength)
313
+ for (; maxLength < length; ++maxLength) {
314
+ addIndexGetter(maxLength);
315
+ }
316
+ };
317
+
318
+ /** Helper function called at the start of each class method. Internal use only. */
319
+ var preop = function () {
320
+ var error;
321
+ var i;
322
+ var args = arguments;
323
+ var rSpace = /\s+/;
324
+
325
+ /** Validate the token/s passed to an instance method, if any. */
326
+ if (args.length)
327
+ for (i = 0; i < args.length; ++i)
328
+ if (rSpace.test(args[i])) {
329
+ error = new SyntaxError('String "' + args[i] + '" ' + "contains" + ' an invalid character');
330
+ error.code = 5;
331
+ error.name = "InvalidCharacterError";
332
+ throw error;
333
+ }
334
+
335
+
336
+ /** Split the new value apart by whitespace*/
337
+ if (typeof el[prop] === "object") {
338
+ tokens = ("" + el[prop].baseVal).replace(/^\s+|\s+$/g, "").split(rSpace);
339
+ } else {
340
+ tokens = ("" + el[prop]).replace(/^\s+|\s+$/g, "").split(rSpace);
341
+ }
342
+
343
+ /** Avoid treating blank strings as single-item token lists */
344
+ if ("" === tokens[0]) tokens = [];
345
+
346
+ /** Repopulate the internal token lists */
347
+ tokenMap = {};
348
+ for (i = 0; i < tokens.length; ++i)
349
+ tokenMap[tokens[i]] = true;
350
+ length = tokens.length;
351
+ reindex();
352
+ };
353
+
354
+ /** Populate our internal token list if the targeted attribute of the subject element isn't empty. */
355
+ preop();
356
+
357
+ /** Return the number of tokens in the underlying string. Read-only. */
358
+ defineGetter(that, "length", function () {
359
+ preop();
360
+ return length;
361
+ });
362
+
363
+ /** Override the default toString/toLocaleString methods to return a space-delimited list of tokens when typecast. */
364
+ that.toLocaleString =
365
+ that.toString = function () {
366
+ preop();
367
+ return tokens.join(" ");
368
+ };
369
+
370
+ that.item = function (idx) {
371
+ preop();
372
+ return tokens[idx];
373
+ };
374
+
375
+ that.contains = function (token) {
376
+ preop();
377
+ return !!tokenMap[token];
378
+ };
379
+
380
+ that.add = function () {
381
+ preop.apply(that, args = arguments);
382
+
383
+ for (var args, token, i = 0, l = args.length; i < l; ++i) {
384
+ token = args[i];
385
+ if (!tokenMap[token]) {
386
+ tokens.push(token);
387
+ tokenMap[token] = true;
388
+ }
389
+ }
390
+
391
+ /** Update the targeted attribute of the attached element if the token list's changed. */
392
+ if (length !== tokens.length) {
393
+ length = tokens.length >>> 0;
394
+ if (typeof el[prop] === "object") {
395
+ el[prop].baseVal = tokens.join(" ");
396
+ } else {
397
+ el[prop] = tokens.join(" ");
398
+ }
399
+ reindex();
400
+ }
401
+ };
402
+
403
+ that.remove = function () {
404
+ preop.apply(that, args = arguments);
405
+
406
+ /** Build a hash of token names to compare against when recollecting our token list. */
407
+ for (var args, ignore = {}, i = 0, t = []; i < args.length; ++i) {
408
+ ignore[args[i]] = true;
409
+ delete tokenMap[args[i]];
410
+ }
411
+
412
+ /** Run through our tokens list and reassign only those that aren't defined in the hash declared above. */
413
+ for (i = 0; i < tokens.length; ++i)
414
+ if (!ignore[tokens[i]]) t.push(tokens[i]);
415
+
416
+ tokens = t;
417
+ length = t.length >>> 0;
418
+
419
+ /** Update the targeted attribute of the attached element. */
420
+ if (typeof el[prop] === "object") {
421
+ el[prop].baseVal = tokens.join(" ");
422
+ } else {
423
+ el[prop] = tokens.join(" ");
424
+ }
425
+ reindex();
426
+ };
427
+
428
+ that.toggle = function (token, force) {
429
+ preop.apply(that, [token]);
430
+
431
+ /** Token state's being forced. */
432
+ if (undefined !== force) {
433
+ if (force) {
434
+ that.add(token);
435
+ return true;
436
+ } else {
437
+ that.remove(token);
438
+ return false;
439
+ }
440
+ }
441
+
442
+ /** Token already exists in tokenList. Remove it, and return FALSE. */
443
+ if (tokenMap[token]) {
444
+ that.remove(token);
445
+ return false;
446
+ }
447
+
448
+ /** Otherwise, add the token and return TRUE. */
449
+ that.add(token);
450
+ return true;
451
+ };
452
+
453
+ return that;
454
+ };
455
+
456
+ return _DOMTokenList;
457
+ }());
458
+ }
459
+
460
+ // Add second argument to native DOMTokenList.toggle() if necessary
461
+ (function () {
462
+ var e = document.createElement('span');
463
+ if (!('classList' in e)) return;
464
+ e.classList.toggle('x', false);
465
+ if (!e.classList.contains('x')) return;
466
+ e.classList.constructor.prototype.toggle = function toggle(token /*, force*/) {
467
+ var force = arguments[1];
468
+ if (force === undefined) {
469
+ var add = !this.contains(token);
470
+ this[add ? 'add' : 'remove'](token);
471
+ return add;
472
+ }
473
+ force = !!force;
474
+ this[force ? 'add' : 'remove'](token);
475
+ return force;
476
+ };
477
+ }());
478
+
479
+ // Add multiple arguments to native DOMTokenList.add() if necessary
480
+ (function () {
481
+ var e = document.createElement('span');
482
+ if (!('classList' in e)) return;
483
+ e.classList.add('a', 'b');
484
+ if (e.classList.contains('b')) return;
485
+ var native = e.classList.constructor.prototype.add;
486
+ e.classList.constructor.prototype.add = function () {
487
+ var args = arguments;
488
+ var l = arguments.length;
489
+ for (var i = 0; i < l; i++) {
490
+ native.call(this, args[i]);
491
+ }
492
+ };
493
+ }());
494
+
495
+ // Add multiple arguments to native DOMTokenList.remove() if necessary
496
+ (function () {
497
+ var e = document.createElement('span');
498
+ if (!('classList' in e)) return;
499
+ e.classList.add('a');
500
+ e.classList.add('b');
501
+ e.classList.remove('a', 'b');
502
+ if (!e.classList.contains('b')) return;
503
+ var native = e.classList.constructor.prototype.remove;
504
+ e.classList.constructor.prototype.remove = function () {
505
+ var args = arguments;
506
+ var l = arguments.length;
507
+ for (var i = 0; i < l; i++) {
508
+ native.call(this, args[i]);
509
+ }
510
+ };
511
+ }());
512
+
513
+ }(this));
514
+
515
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
516
+
517
+ (function(undefined) {
518
+
519
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
520
+ var detect = (
521
+ 'document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () {
522
+ var e = document.createElement('span');
523
+ e.classList.add('a', 'b');
524
+ return e.classList.contains('b');
525
+ }())
526
+ );
527
+
528
+ if (detect) return
529
+
530
+ // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/polyfill.js
531
+ (function (global) {
532
+ var dpSupport = true;
533
+ var defineGetter = function (object, name, fn, configurable) {
534
+ if (Object.defineProperty)
535
+ Object.defineProperty(object, name, {
536
+ configurable: false === dpSupport ? true : !!configurable,
537
+ get: fn
538
+ });
539
+
540
+ else object.__defineGetter__(name, fn);
541
+ };
542
+ /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
543
+ try {
544
+ defineGetter({}, "support");
545
+ }
546
+ catch (e) {
547
+ dpSupport = false;
548
+ }
549
+ /** Polyfills a property with a DOMTokenList */
550
+ var addProp = function (o, name, attr) {
551
+
552
+ defineGetter(o.prototype, name, function () {
553
+ var tokenList;
554
+
555
+ var THIS = this,
556
+
557
+ /** Prevent this from firing twice for some reason. What the hell, IE. */
558
+ gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name;
559
+ if(THIS[gibberishProperty]) return tokenList;
560
+ THIS[gibberishProperty] = true;
561
+
562
+ /**
563
+ * IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead.
564
+ *
565
+ * What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror")
566
+ * that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML
567
+ * element instead, this would conflict with element types which use indexed properties (such as forms and
568
+ * select lists).
569
+ */
570
+ if (false === dpSupport) {
571
+
572
+ var visage;
573
+ var mirror = addProp.mirror || document.createElement("div");
574
+ var reflections = mirror.childNodes;
575
+ var l = reflections.length;
576
+
577
+ for (var i = 0; i < l; ++i)
578
+ if (reflections[i]._R === THIS) {
579
+ visage = reflections[i];
580
+ break;
581
+ }
582
+
583
+ /** Couldn't find an element's reflection inside the mirror. Materialise one. */
584
+ visage || (visage = mirror.appendChild(document.createElement("div")));
585
+
586
+ tokenList = DOMTokenList.call(visage, THIS, attr);
587
+ } else tokenList = new DOMTokenList(THIS, attr);
588
+
589
+ defineGetter(THIS, name, function () {
590
+ return tokenList;
591
+ });
592
+ delete THIS[gibberishProperty];
593
+
594
+ return tokenList;
595
+ }, true);
596
+ };
597
+
598
+ addProp(global.Element, "classList", "className");
599
+ addProp(global.HTMLElement, "classList", "className");
600
+ addProp(global.HTMLLinkElement, "relList", "rel");
601
+ addProp(global.HTMLAnchorElement, "relList", "rel");
602
+ addProp(global.HTMLAreaElement, "relList", "rel");
603
+ }(this));
604
+
605
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
606
+
607
+ (function(undefined) {
608
+
609
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Window/detect.js
610
+ var detect = ('Window' in this);
611
+
612
+ if (detect) return
613
+
614
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Window&flags=always
615
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
616
+ (function (global) {
617
+ if (global.constructor) {
618
+ global.Window = global.constructor;
619
+ } else {
620
+ (global.Window = global.constructor = new Function('return function Window() {}')()).prototype = this;
621
+ }
622
+ }(this));
623
+ }
624
+
625
+ })
626
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
627
+
628
+ (function(undefined) {
629
+
630
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
631
+ var detect = ("Document" in this);
632
+
633
+ if (detect) return
634
+
635
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Document&flags=always
636
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
637
+
638
+ if (this.HTMLDocument) { // IE8
639
+
640
+ // HTMLDocument is an extension of Document. If the browser has HTMLDocument but not Document, the former will suffice as an alias for the latter.
641
+ this.Document = this.HTMLDocument;
642
+
643
+ } else {
644
+
645
+ // Create an empty function to act as the missing constructor for the document object, attach the document object as its prototype. The function needs to be anonymous else it is hoisted and causes the feature detect to prematurely pass, preventing the assignments below being made.
646
+ this.Document = this.HTMLDocument = document.constructor = (new Function('return function Document() {}')());
647
+ this.Document.prototype = document;
648
+ }
649
+ }
650
+
651
+
652
+ })
653
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
654
+
655
+ (function(undefined) {
656
+
657
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Element/detect.js
658
+ var detect = ('Element' in this && 'HTMLElement' in this);
659
+
660
+ if (detect) return
661
+
662
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element&flags=always
663
+ (function () {
664
+
665
+ // IE8
666
+ if (window.Element && !window.HTMLElement) {
667
+ window.HTMLElement = window.Element;
668
+ return;
669
+ }
670
+
671
+ // create Element constructor
672
+ window.Element = window.HTMLElement = new Function('return function Element() {}')();
673
+
674
+ // generate sandboxed iframe
675
+ var vbody = document.appendChild(document.createElement('body'));
676
+ var frame = vbody.appendChild(document.createElement('iframe'));
677
+
678
+ // use sandboxed iframe to replicate Element functionality
679
+ var frameDocument = frame.contentWindow.document;
680
+ var prototype = Element.prototype = frameDocument.appendChild(frameDocument.createElement('*'));
681
+ var cache = {};
682
+
683
+ // polyfill Element.prototype on an element
684
+ var shiv = function (element, deep) {
685
+ var
686
+ childNodes = element.childNodes || [],
687
+ index = -1,
688
+ key, value, childNode;
689
+
690
+ if (element.nodeType === 1 && element.constructor !== Element) {
691
+ element.constructor = Element;
692
+
693
+ for (key in cache) {
694
+ value = cache[key];
695
+ element[key] = value;
696
+ }
697
+ }
698
+
699
+ while (childNode = deep && childNodes[++index]) {
700
+ shiv(childNode, deep);
701
+ }
702
+
703
+ return element;
704
+ };
705
+
706
+ var elements = document.getElementsByTagName('*');
707
+ var nativeCreateElement = document.createElement;
708
+ var interval;
709
+ var loopLimit = 100;
710
+
711
+ prototype.attachEvent('onpropertychange', function (event) {
712
+ var
713
+ propertyName = event.propertyName,
714
+ nonValue = !cache.hasOwnProperty(propertyName),
715
+ newValue = prototype[propertyName],
716
+ oldValue = cache[propertyName],
717
+ index = -1,
718
+ element;
719
+
720
+ while (element = elements[++index]) {
721
+ if (element.nodeType === 1) {
722
+ if (nonValue || element[propertyName] === oldValue) {
723
+ element[propertyName] = newValue;
724
+ }
725
+ }
726
+ }
727
+
728
+ cache[propertyName] = newValue;
729
+ });
730
+
731
+ prototype.constructor = Element;
732
+
733
+ if (!prototype.hasAttribute) {
734
+ // <Element>.hasAttribute
735
+ prototype.hasAttribute = function hasAttribute(name) {
736
+ return this.getAttribute(name) !== null;
737
+ };
738
+ }
739
+
740
+ // Apply Element prototype to the pre-existing DOM as soon as the body element appears.
741
+ function bodyCheck() {
742
+ if (!(loopLimit--)) clearTimeout(interval);
743
+ if (document.body && !document.body.prototype && /(complete|interactive)/.test(document.readyState)) {
744
+ shiv(document, true);
745
+ if (interval && document.body.prototype) clearTimeout(interval);
746
+ return (!!document.body.prototype);
747
+ }
748
+ return false;
749
+ }
750
+ if (!bodyCheck()) {
751
+ document.onreadystatechange = bodyCheck;
752
+ interval = setInterval(bodyCheck, 25);
753
+ }
754
+
755
+ // Apply to any new elements created after load
756
+ document.createElement = function createElement(nodeName) {
757
+ var element = nativeCreateElement(String(nodeName).toLowerCase());
758
+ return shiv(element);
759
+ };
760
+
761
+ // remove sandboxed iframe
762
+ document.removeChild(vbody);
763
+ }());
764
+
765
+ })
766
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
767
+
768
+ (function(undefined) {
769
+
770
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Event/detect.js
771
+ var detect = (
772
+ (function(global) {
773
+
774
+ if (!('Event' in global)) return false;
775
+ if (typeof global.Event === 'function') return true;
776
+
777
+ try {
778
+
779
+ // In IE 9-11, the Event object exists but cannot be instantiated
780
+ new Event('click');
781
+ return true;
782
+ } catch(e) {
783
+ return false;
784
+ }
785
+ }(this))
786
+ );
787
+
788
+ if (detect) return
789
+
790
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Event&flags=always
791
+ (function () {
792
+ var unlistenableWindowEvents = {
793
+ click: 1,
794
+ dblclick: 1,
795
+ keyup: 1,
796
+ keypress: 1,
797
+ keydown: 1,
798
+ mousedown: 1,
799
+ mouseup: 1,
800
+ mousemove: 1,
801
+ mouseover: 1,
802
+ mouseenter: 1,
803
+ mouseleave: 1,
804
+ mouseout: 1,
805
+ storage: 1,
806
+ storagecommit: 1,
807
+ textinput: 1
808
+ };
809
+
810
+ // This polyfill depends on availability of `document` so will not run in a worker
811
+ // However, we asssume there are no browsers with worker support that lack proper
812
+ // support for `Event` within the worker
813
+ if (typeof document === 'undefined' || typeof window === 'undefined') return;
814
+
815
+ function indexOf(array, element) {
816
+ var
817
+ index = -1,
818
+ length = array.length;
819
+
820
+ while (++index < length) {
821
+ if (index in array && array[index] === element) {
822
+ return index;
823
+ }
824
+ }
825
+
826
+ return -1;
827
+ }
828
+
829
+ var existingProto = (window.Event && window.Event.prototype) || null;
830
+ window.Event = Window.prototype.Event = function Event(type, eventInitDict) {
831
+ if (!type) {
832
+ throw new Error('Not enough arguments');
833
+ }
834
+
835
+ var event;
836
+ // Shortcut if browser supports createEvent
837
+ if ('createEvent' in document) {
838
+ event = document.createEvent('Event');
839
+ var bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false;
840
+ var cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false;
841
+
842
+ event.initEvent(type, bubbles, cancelable);
843
+
844
+ return event;
845
+ }
846
+
847
+ event = document.createEventObject();
848
+
849
+ event.type = type;
850
+ event.bubbles = eventInitDict && eventInitDict.bubbles !== undefined ? eventInitDict.bubbles : false;
851
+ event.cancelable = eventInitDict && eventInitDict.cancelable !== undefined ? eventInitDict.cancelable : false;
852
+
853
+ return event;
854
+ };
855
+ if (existingProto) {
856
+ Object.defineProperty(window.Event, 'prototype', {
857
+ configurable: false,
858
+ enumerable: false,
859
+ writable: true,
860
+ value: existingProto
861
+ });
862
+ }
863
+
864
+ if (!('createEvent' in document)) {
865
+ window.addEventListener = Window.prototype.addEventListener = Document.prototype.addEventListener = Element.prototype.addEventListener = function addEventListener() {
866
+ var
867
+ element = this,
868
+ type = arguments[0],
869
+ listener = arguments[1];
870
+
871
+ if (element === window && type in unlistenableWindowEvents) {
872
+ throw new Error('In IE8 the event: ' + type + ' is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.');
873
+ }
874
+
875
+ if (!element._events) {
876
+ element._events = {};
877
+ }
878
+
879
+ if (!element._events[type]) {
880
+ element._events[type] = function (event) {
881
+ var
882
+ list = element._events[event.type].list,
883
+ events = list.slice(),
884
+ index = -1,
885
+ length = events.length,
886
+ eventElement;
887
+
888
+ event.preventDefault = function preventDefault() {
889
+ if (event.cancelable !== false) {
890
+ event.returnValue = false;
891
+ }
892
+ };
893
+
894
+ event.stopPropagation = function stopPropagation() {
895
+ event.cancelBubble = true;
896
+ };
897
+
898
+ event.stopImmediatePropagation = function stopImmediatePropagation() {
899
+ event.cancelBubble = true;
900
+ event.cancelImmediate = true;
901
+ };
902
+
903
+ event.currentTarget = element;
904
+ event.relatedTarget = event.fromElement || null;
905
+ event.target = event.target || event.srcElement || element;
906
+ event.timeStamp = new Date().getTime();
907
+
908
+ if (event.clientX) {
909
+ event.pageX = event.clientX + document.documentElement.scrollLeft;
910
+ event.pageY = event.clientY + document.documentElement.scrollTop;
911
+ }
912
+
913
+ while (++index < length && !event.cancelImmediate) {
914
+ if (index in events) {
915
+ eventElement = events[index];
916
+
917
+ if (indexOf(list, eventElement) !== -1 && typeof eventElement === 'function') {
918
+ eventElement.call(element, event);
919
+ }
920
+ }
921
+ }
922
+ };
923
+
924
+ element._events[type].list = [];
925
+
926
+ if (element.attachEvent) {
927
+ element.attachEvent('on' + type, element._events[type]);
928
+ }
929
+ }
930
+
931
+ element._events[type].list.push(listener);
932
+ };
933
+
934
+ window.removeEventListener = Window.prototype.removeEventListener = Document.prototype.removeEventListener = Element.prototype.removeEventListener = function removeEventListener() {
935
+ var
936
+ element = this,
937
+ type = arguments[0],
938
+ listener = arguments[1],
939
+ index;
940
+
941
+ if (element._events && element._events[type] && element._events[type].list) {
942
+ index = indexOf(element._events[type].list, listener);
943
+
944
+ if (index !== -1) {
945
+ element._events[type].list.splice(index, 1);
946
+
947
+ if (!element._events[type].list.length) {
948
+ if (element.detachEvent) {
949
+ element.detachEvent('on' + type, element._events[type]);
950
+ }
951
+ delete element._events[type];
952
+ }
953
+ }
954
+ }
955
+ };
956
+
957
+ window.dispatchEvent = Window.prototype.dispatchEvent = Document.prototype.dispatchEvent = Element.prototype.dispatchEvent = function dispatchEvent(event) {
958
+ if (!arguments.length) {
959
+ throw new Error('Not enough arguments');
960
+ }
961
+
962
+ if (!event || typeof event.type !== 'string') {
963
+ throw new Error('DOM Events Exception 0');
964
+ }
965
+
966
+ var element = this, type = event.type;
967
+
968
+ try {
969
+ if (!event.bubbles) {
970
+ event.cancelBubble = true;
971
+
972
+ var cancelBubbleEvent = function (event) {
973
+ event.cancelBubble = true;
974
+
975
+ (element || window).detachEvent('on' + type, cancelBubbleEvent);
976
+ };
977
+
978
+ this.attachEvent('on' + type, cancelBubbleEvent);
979
+ }
980
+
981
+ this.fireEvent('on' + type, event);
982
+ } catch (error) {
983
+ event.target = element;
984
+
985
+ do {
986
+ event.currentTarget = element;
987
+
988
+ if ('_events' in element && typeof element._events[type] === 'function') {
989
+ element._events[type].call(element, event);
990
+ }
991
+
992
+ if (typeof element['on' + type] === 'function') {
993
+ element['on' + type].call(element, event);
994
+ }
995
+
996
+ element = element.nodeType === 9 ? element.parentWindow : element.parentNode;
997
+ } while (element && !event.cancelBubble);
998
+ }
999
+
1000
+ return true;
1001
+ };
1002
+
1003
+ // Add the DOMContentLoaded Event
1004
+ document.attachEvent('onreadystatechange', function() {
1005
+ if (document.readyState === 'complete') {
1006
+ document.dispatchEvent(new Event('DOMContentLoaded', {
1007
+ bubbles: true
1008
+ }));
1009
+ }
1010
+ });
1011
+ }
1012
+ }());
1013
+
1014
+ })
1015
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
1016
+
1017
+ /**
1018
+ * TODO: Ideally this would be a NodeList.prototype.forEach polyfill
1019
+ * This seems to fail in IE8, requires more investigation.
1020
+ * See: https://github.com/imagitama/nodelist-foreach-polyfill
1021
+ */
1022
+ function nodeListForEach (nodes, callback) {
1023
+ if (window.NodeList.prototype.forEach) {
1024
+ return nodes.forEach(callback)
1025
+ }
1026
+ for (var i = 0; i < nodes.length; i++) {
1027
+ callback.call(window, nodes[i], i, nodes);
1028
+ }
1029
+ }
1030
+
1031
+ function Tabs ($module) {
1032
+ this.$module = $module;
1033
+ this.$tabs = $module.querySelectorAll('.govuk-tabs__tab');
1034
+
1035
+ this.keys = { left: 37, right: 39, up: 38, down: 40 };
1036
+ this.jsHiddenClass = 'js-hidden';
1037
+ }
1038
+
1039
+ Tabs.prototype.init = function () {
1040
+ if (typeof window.matchMedia === 'function') {
1041
+ this.setupResponsiveChecks();
1042
+ } else {
1043
+ this.setup();
1044
+ }
1045
+ };
1046
+
1047
+ Tabs.prototype.setupResponsiveChecks = function () {
1048
+ this.mql = window.matchMedia('(min-width: 40.0625em)');
1049
+ this.mql.addListener(this.checkMode.bind(this));
1050
+ this.checkMode();
1051
+ };
1052
+
1053
+ Tabs.prototype.checkMode = function () {
1054
+ if (this.mql.matches) {
1055
+ this.setup();
1056
+ } else {
1057
+ this.teardown();
1058
+ }
1059
+ };
1060
+
1061
+ Tabs.prototype.setup = function () {
1062
+ var $module = this.$module;
1063
+ var $tabs = this.$tabs;
1064
+ var $tabList = $module.querySelector('.govuk-tabs__list');
1065
+ var $tabListItems = $module.querySelectorAll('.govuk-tabs__list-item');
1066
+
1067
+ if (!$tabs || !$tabList || !$tabListItems) {
1068
+ return
1069
+ }
1070
+
1071
+ $tabList.setAttribute('role', 'tablist');
1072
+
1073
+ nodeListForEach($tabListItems, function ($item) {
1074
+ $item.setAttribute('role', 'presentation');
1075
+ });
1076
+
1077
+ nodeListForEach($tabs, function ($tab) {
1078
+ // Set HTML attributes
1079
+ this.setAttributes($tab);
1080
+
1081
+ // Save bounded functions to use when removing event listeners during teardown
1082
+ $tab.boundTabClick = this.onTabClick.bind(this);
1083
+ $tab.boundTabKeydown = this.onTabKeydown.bind(this);
1084
+
1085
+ // Handle events
1086
+ $tab.addEventListener('click', $tab.boundTabClick, true);
1087
+ $tab.addEventListener('keydown', $tab.boundTabKeydown, true);
1088
+
1089
+ // Remove old active panels
1090
+ this.hideTab($tab);
1091
+ }.bind(this));
1092
+
1093
+ // Show either the active tab according to the URL's hash or the first tab
1094
+ var $activeTab = this.getTab(window.location.hash) || this.$tabs[0];
1095
+ this.showTab($activeTab);
1096
+
1097
+ // Handle hashchange events
1098
+ $module.boundOnHashChange = this.onHashChange.bind(this);
1099
+ window.addEventListener('hashchange', $module.boundOnHashChange, true);
1100
+ };
1101
+
1102
+ Tabs.prototype.teardown = function () {
1103
+ var $module = this.$module;
1104
+ var $tabs = this.$tabs;
1105
+ var $tabList = $module.querySelector('.govuk-tabs__list');
1106
+ var $tabListItems = $module.querySelectorAll('.govuk-tabs__list-item');
1107
+
1108
+ if (!$tabs || !$tabList || !$tabListItems) {
1109
+ return
1110
+ }
1111
+
1112
+ $tabList.removeAttribute('role');
1113
+
1114
+ nodeListForEach($tabListItems, function ($item) {
1115
+ $item.removeAttribute('role', 'presentation');
1116
+ });
1117
+
1118
+ nodeListForEach($tabs, function ($tab) {
1119
+ // Remove events
1120
+ $tab.removeEventListener('click', $tab.boundTabClick, true);
1121
+ $tab.removeEventListener('keydown', $tab.boundTabKeydown, true);
1122
+
1123
+ // Unset HTML attributes
1124
+ this.unsetAttributes($tab);
1125
+ }.bind(this));
1126
+
1127
+ // Remove hashchange event handler
1128
+ window.removeEventListener('hashchange', $module.boundOnHashChange, true);
1129
+ };
1130
+
1131
+ Tabs.prototype.onHashChange = function (e) {
1132
+ var hash = window.location.hash;
1133
+ if (!this.hasTab(hash)) {
1134
+ return
1135
+ }
1136
+ // Prevent changing the hash
1137
+ if (this.changingHash) {
1138
+ this.changingHash = false;
1139
+ return
1140
+ }
1141
+
1142
+ // Show either the active tab according to the URL's hash or the first tab
1143
+ var $previousTab = this.getCurrentTab();
1144
+ var $activeTab = this.getTab(hash) || this.$tabs[0];
1145
+
1146
+ this.hideTab($previousTab);
1147
+ this.showTab($activeTab);
1148
+ $activeTab.focus();
1149
+ };
1150
+
1151
+ Tabs.prototype.hasTab = function (hash) {
1152
+ return this.$module.querySelector(hash)
1153
+ };
1154
+
1155
+ Tabs.prototype.hideTab = function ($tab) {
1156
+ this.unhighlightTab($tab);
1157
+ this.hidePanel($tab);
1158
+ };
1159
+
1160
+ Tabs.prototype.showTab = function ($tab) {
1161
+ this.highlightTab($tab);
1162
+ this.showPanel($tab);
1163
+ };
1164
+
1165
+ Tabs.prototype.getTab = function (hash) {
1166
+ return this.$module.querySelector('a[role="tab"][href="' + hash + '"]')
1167
+ };
1168
+
1169
+ Tabs.prototype.setAttributes = function ($tab) {
1170
+ // set tab attributes
1171
+ var panelId = this.getHref($tab).slice(1);
1172
+ $tab.setAttribute('id', 'tab_' + panelId);
1173
+ $tab.setAttribute('role', 'tab');
1174
+ $tab.setAttribute('aria-controls', panelId);
1175
+ $tab.setAttribute('tabindex', '-1');
1176
+
1177
+ // set panel attributes
1178
+ var $panel = this.getPanel($tab);
1179
+ $panel.setAttribute('role', 'tabpanel');
1180
+ $panel.setAttribute('aria-labelledby', $tab.id);
1181
+ $panel.classList.add(this.jsHiddenClass);
1182
+ };
1183
+
1184
+ Tabs.prototype.unsetAttributes = function ($tab) {
1185
+ // unset tab attributes
1186
+ $tab.removeAttribute('id');
1187
+ $tab.removeAttribute('role');
1188
+ $tab.removeAttribute('aria-controls');
1189
+ $tab.removeAttribute('tabindex');
1190
+
1191
+ // unset panel attributes
1192
+ var $panel = this.getPanel($tab);
1193
+ $panel.removeAttribute('role');
1194
+ $panel.removeAttribute('aria-labelledby');
1195
+ $panel.classList.remove(this.jsHiddenClass);
1196
+ };
1197
+
1198
+ Tabs.prototype.onTabClick = function (e) {
1199
+ e.preventDefault();
1200
+ var $newTab = e.target;
1201
+ var $currentTab = this.getCurrentTab();
1202
+ this.hideTab($currentTab);
1203
+ this.showTab($newTab);
1204
+ this.createHistoryEntry($newTab);
1205
+ };
1206
+
1207
+ Tabs.prototype.createHistoryEntry = function ($tab) {
1208
+ var $panel = this.getPanel($tab);
1209
+
1210
+ // Save and restore the id
1211
+ // so the page doesn't jump when a user clicks a tab (which changes the hash)
1212
+ var id = $panel.id;
1213
+ $panel.id = '';
1214
+ this.changingHash = true;
1215
+ window.location.hash = this.getHref($tab).slice(1);
1216
+ $panel.id = id;
1217
+ };
1218
+
1219
+ Tabs.prototype.onTabKeydown = function (e) {
1220
+ switch (e.keyCode) {
1221
+ case this.keys.left:
1222
+ case this.keys.up:
1223
+ this.activatePreviousTab();
1224
+ e.preventDefault();
1225
+ break
1226
+ case this.keys.right:
1227
+ case this.keys.down:
1228
+ this.activateNextTab();
1229
+ e.preventDefault();
1230
+ break
1231
+ }
1232
+ };
1233
+
1234
+ Tabs.prototype.activateNextTab = function () {
1235
+ var currentTab = this.getCurrentTab();
1236
+ var nextTabListItem = currentTab.parentNode.nextElementSibling;
1237
+ if (nextTabListItem) {
1238
+ var nextTab = nextTabListItem.firstElementChild;
1239
+ }
1240
+ if (nextTab) {
1241
+ this.hideTab(currentTab);
1242
+ this.showTab(nextTab);
1243
+ nextTab.focus();
1244
+ this.createHistoryEntry(nextTab);
1245
+ }
1246
+ };
1247
+
1248
+ Tabs.prototype.activatePreviousTab = function () {
1249
+ var currentTab = this.getCurrentTab();
1250
+ var previousTabListItem = currentTab.parentNode.previousElementSibling;
1251
+ if (previousTabListItem) {
1252
+ var previousTab = previousTabListItem.firstElementChild;
1253
+ }
1254
+ if (previousTab) {
1255
+ this.hideTab(currentTab);
1256
+ this.showTab(previousTab);
1257
+ previousTab.focus();
1258
+ this.createHistoryEntry(previousTab);
1259
+ }
1260
+ };
1261
+
1262
+ Tabs.prototype.getPanel = function ($tab) {
1263
+ var $panel = this.$module.querySelector(this.getHref($tab));
1264
+ return $panel
1265
+ };
1266
+
1267
+ Tabs.prototype.showPanel = function ($tab) {
1268
+ var $panel = this.getPanel($tab);
1269
+ $panel.classList.remove(this.jsHiddenClass);
1270
+ };
1271
+
1272
+ Tabs.prototype.hidePanel = function (tab) {
1273
+ var $panel = this.getPanel(tab);
1274
+ $panel.classList.add(this.jsHiddenClass);
1275
+ };
1276
+
1277
+ Tabs.prototype.unhighlightTab = function ($tab) {
1278
+ $tab.setAttribute('aria-selected', 'false');
1279
+ $tab.setAttribute('tabindex', '-1');
1280
+ };
1281
+
1282
+ Tabs.prototype.highlightTab = function ($tab) {
1283
+ $tab.setAttribute('aria-selected', 'true');
1284
+ $tab.setAttribute('tabindex', '0');
1285
+ };
1286
+
1287
+ Tabs.prototype.getCurrentTab = function () {
1288
+ return this.$module.querySelector('[role=tab][aria-selected=true]')
1289
+ };
1290
+
1291
+ // this is because IE doesn't always return the actual value but a relative full path
1292
+ // should be a utility function most prob
1293
+ // http://labs.thesedays.com/blog/2010/01/08/getting-the-href-value-with-jquery-in-ie/
1294
+ Tabs.prototype.getHref = function ($tab) {
1295
+ var href = $tab.getAttribute('href');
1296
+ var hash = href.slice(href.indexOf('#'), href.length);
1297
+ return hash
1298
+ };
1299
+
1300
+ return Tabs;
1301
+
1302
+ })));