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,17 @@
1
+ {% from "error-summary/macro.njk" import govukErrorSummary %}
2
+
3
+ {{ govukErrorSummary({
4
+ "titleText": "Message to alert the user to a problem goes here",
5
+ "descriptionText": "Optional description of the errors and how to correct them",
6
+ "classes": "optional-extra-class",
7
+ "errorList": [
8
+ {
9
+ "text": "Descriptive link to the question with an error",
10
+ "href": "#example-error-1"
11
+ },
12
+ {
13
+ "text": "Descriptive link to the question with an error",
14
+ "href": "#example-error-1"
15
+ }
16
+ ]
17
+ }) }}
@@ -0,0 +1,3 @@
1
+ {% macro govukErrorSummary(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,25 @@
1
+ <div class="govuk-error-summary
2
+ {%- if params.classes %} {{ params.classes }}{% endif %}" aria-labelledby="error-summary-title" role="alert" tabindex="-1"
3
+ {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %} data-module="error-summary">
4
+ <h2 class="govuk-error-summary__title" id="error-summary-title">
5
+ {{ params.titleHtml | safe if params.titleHtml else params.titleText }}
6
+ </h2>
7
+ <div class="govuk-error-summary__body">
8
+ {% if params.descriptionHtml or params.descriptionText %}
9
+ <p>
10
+ {{ params.descriptionHtml | safe if params.descriptionHtml else params.descriptionText }}
11
+ </p>
12
+ {% endif %}
13
+ <ul class="govuk-list govuk-error-summary__list">
14
+ {% for item in params.errorList %}
15
+ <li>
16
+ {% if item.href %}
17
+ <a href="{{ item.href }}">{{ item.html | safe if item.html else item.text }}</a>
18
+ {% else %}
19
+ {{ item.html | safe if item.html else item.text }}
20
+ {% endif %}
21
+ </li>
22
+ {% endfor %}
23
+ </ul>
24
+ </div>
25
+ </div>
@@ -0,0 +1,213 @@
1
+ # Fieldset
2
+
3
+ ## Introduction
4
+
5
+ The fieldset element is used to group several controls within a web form. The legend element represents a caption for the content of its parent fieldset.
6
+
7
+ ## Guidance
8
+
9
+ Find out when to use the Fieldset component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/fieldset).
10
+
11
+ ## Quick start examples
12
+
13
+ ### Component default
14
+
15
+ [Preview the fieldset component](http://govuk-frontend-review.herokuapp.com/components/fieldset/preview)
16
+
17
+ #### Markup
18
+
19
+ <fieldset class="govuk-fieldset">
20
+
21
+ <legend class="govuk-fieldset__legend">
22
+ What is your address?
23
+ </legend>
24
+
25
+ </fieldset>
26
+
27
+ #### Macro
28
+
29
+ {% from 'fieldset/macro.njk' import govukFieldset %}
30
+
31
+ {{ govukFieldset({
32
+ "legend": {
33
+ "text": "What is your address?"
34
+ }
35
+ }) }}
36
+
37
+ ### Fieldset--as page heading
38
+
39
+ [Preview the fieldset--as page heading example](http://govuk-frontend-review.herokuapp.com/components/fieldset/as page heading/preview)
40
+
41
+ #### Markup
42
+
43
+ <fieldset class="govuk-fieldset">
44
+
45
+ <legend class="govuk-fieldset__legend govuk-fieldset__legend--xl">
46
+ <h1 class="govuk-fieldset__heading">
47
+ What is your address?
48
+ </h1>
49
+ </legend>
50
+
51
+ </fieldset>
52
+
53
+ #### Macro
54
+
55
+ {% from 'fieldset/macro.njk' import govukFieldset %}
56
+
57
+ {{ govukFieldset({
58
+ "legend": {
59
+ "text": "What is your address?",
60
+ "classes": "govuk-fieldset__legend--xl",
61
+ "isPageHeading": true
62
+ }
63
+ }) }}
64
+
65
+ ## Requirements
66
+
67
+ ### Build tool configuration
68
+
69
+ When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
70
+
71
+ .pipe(sass({
72
+ includePaths: 'node_modules/'
73
+ }))
74
+
75
+ ### Static asset path configuration
76
+
77
+ In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js:
78
+
79
+ app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
80
+
81
+ ## Component arguments
82
+
83
+ If you are using Nunjucks,then macros take the following arguments
84
+
85
+ **If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
86
+
87
+ <table class="govuk-table">
88
+
89
+ <thead class="govuk-table__head">
90
+
91
+ <tr class="govuk-table__row">
92
+
93
+ <th class="govuk-table__header" scope="col">Name</th>
94
+
95
+ <th class="govuk-table__header" scope="col">Type</th>
96
+
97
+ <th class="govuk-table__header" scope="col">Required</th>
98
+
99
+ <th class="govuk-table__header" scope="col">Description</th>
100
+
101
+ </tr>
102
+
103
+ </thead>
104
+
105
+ <tbody class="govuk-table__body">
106
+
107
+ <tr class="govuk-table__row">
108
+
109
+ <th class="govuk-table__header" scope="row">describedBy</th>
110
+
111
+ <td class="govuk-table__cell ">string</td>
112
+
113
+ <td class="govuk-table__cell ">No</td>
114
+
115
+ <td class="govuk-table__cell ">Text or element id to add to the `aria-describedby` attribute to provide description of the group of fields for screenreader users.</td>
116
+
117
+ </tr>
118
+
119
+ <tr class="govuk-table__row">
120
+
121
+ <th class="govuk-table__header" scope="row">legend</th>
122
+
123
+ <td class="govuk-table__cell ">object</td>
124
+
125
+ <td class="govuk-table__cell ">No</td>
126
+
127
+ <td class="govuk-table__cell ">Arguments for the legend</td>
128
+
129
+ </tr>
130
+
131
+ <tr class="govuk-table__row">
132
+
133
+ <th class="govuk-table__header" scope="row">legend.{}.text (or) legend.{}.html</th>
134
+
135
+ <td class="govuk-table__cell ">string</td>
136
+
137
+ <td class="govuk-table__cell ">No</td>
138
+
139
+ <td class="govuk-table__cell ">Legend text or HTML. If `html` is provided, the `text` argument will be ignored.</td>
140
+
141
+ </tr>
142
+
143
+ <tr class="govuk-table__row">
144
+
145
+ <th class="govuk-table__header" scope="row">legend.{}.classes</th>
146
+
147
+ <td class="govuk-table__cell ">string</td>
148
+
149
+ <td class="govuk-table__cell ">No</td>
150
+
151
+ <td class="govuk-table__cell ">Optional additional classes to add to the legend container.</td>
152
+
153
+ </tr>
154
+
155
+ <tr class="govuk-table__row">
156
+
157
+ <th class="govuk-table__header" scope="row">legend.{}.isPageHeading</th>
158
+
159
+ <td class="govuk-table__cell ">boolean</td>
160
+
161
+ <td class="govuk-table__cell ">No</td>
162
+
163
+ <td class="govuk-table__cell ">Whether the legend also acts as the heading for the page.</td>
164
+
165
+ </tr>
166
+
167
+ <tr class="govuk-table__row">
168
+
169
+ <th class="govuk-table__header" scope="row">classes</th>
170
+
171
+ <td class="govuk-table__cell ">string</td>
172
+
173
+ <td class="govuk-table__cell ">No</td>
174
+
175
+ <td class="govuk-table__cell ">Optional additional classes to add to the fieldset container.</td>
176
+
177
+ </tr>
178
+
179
+ <tr class="govuk-table__row">
180
+
181
+ <th class="govuk-table__header" scope="row">attributes</th>
182
+
183
+ <td class="govuk-table__cell ">object</td>
184
+
185
+ <td class="govuk-table__cell ">No</td>
186
+
187
+ <td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the fieldset container.</td>
188
+
189
+ </tr>
190
+
191
+ </tbody>
192
+
193
+ </table>
194
+
195
+ **If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
196
+
197
+ ### Setting up Nunjucks views and paths
198
+
199
+ Below is an example setup using express configure views:
200
+
201
+ nunjucks.configure('node_modules/govuk-frontend/components', {
202
+ autoescape: true,
203
+ cache: false,
204
+ express: app
205
+ })
206
+
207
+ ## Contribution
208
+
209
+ Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository")
210
+
211
+ ## License
212
+
213
+ MIT
@@ -0,0 +1,58 @@
1
+ @import "../../settings/all";
2
+ @import "../../tools/all";
3
+ @import "../../helpers/all";
4
+
5
+ @include govuk-exports("govuk/component/fieldset") {
6
+ .govuk-fieldset {
7
+ margin: 0;
8
+ padding: 0;
9
+ border: 0;
10
+ @include govuk-clearfix;
11
+ }
12
+
13
+ .govuk-fieldset__legend {
14
+ @include govuk-font($size: 19);
15
+ @include govuk-text-colour;
16
+
17
+ // Fix legend text wrapping in Edge and IE
18
+ // 1. IE9-11 & Edge 12-13
19
+ // 2. IE8-11
20
+ -webkit-box-sizing: border-box;
21
+ box-sizing: border-box; // 1
22
+ display: table; // 2
23
+ max-width: 100%; // 1
24
+ margin-bottom: govuk-spacing(3);
25
+ padding: 0;
26
+ // Hack to let legends or elements within legends have margins in webkit browsers
27
+ overflow: hidden;
28
+
29
+ white-space: normal; // 1
30
+ }
31
+
32
+ // Modifiers that make legends look more like their equivalent headings
33
+
34
+ .govuk-fieldset__legend--xl {
35
+ @include govuk-font($size: 48, $weight: bold);
36
+ }
37
+
38
+ .govuk-fieldset__legend--l {
39
+ @include govuk-font($size: 36, $weight: bold);
40
+ }
41
+
42
+ .govuk-fieldset__legend--m {
43
+ @include govuk-font($size: 24, $weight: bold);
44
+ }
45
+
46
+ .govuk-fieldset__legend--s {
47
+ @include govuk-font($size: 19, $weight: bold);
48
+ }
49
+
50
+ // When the legend contains an H1, we want the H1 to inherit all styles from
51
+ // the legend. Effectively we want to be able to treat the heading as if it is
52
+ // not there.
53
+ .govuk-fieldset__heading {
54
+ margin: 0;
55
+ font-size: inherit;
56
+ font-weight: inherit;
57
+ }
58
+ }
@@ -0,0 +1,13 @@
1
+ {% from "fieldset/macro.njk" import govukFieldset %}
2
+
3
+ {{ govukFieldset({
4
+ "legend": {
5
+ "text": "Legend text goes here"
6
+ },
7
+ "hint": {
8
+ "text": "Legend hint text goes here"
9
+ },
10
+ "errorMessage": {
11
+ "text": "Error message goes here"
12
+ }
13
+ }) }}
@@ -0,0 +1,3 @@
1
+ {% macro govukFieldset(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,17 @@
1
+ <fieldset class="govuk-fieldset
2
+ {%- if params.classes %} {{ params.classes }}{% endif %}"
3
+ {%- if params.describedBy %} aria-describedby="{{ params.describedBy }}"{% endif %}
4
+ {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
5
+ {% if params.legend.html or params.legend.text %}
6
+ <legend class="govuk-fieldset__legend {%- if params.legend.classes %} {{ params.legend.classes }}{% endif %}">
7
+ {%- if params.legend.isPageHeading %}
8
+ <h1 class="govuk-fieldset__heading">
9
+ {{ params.legend.html | safe if params.legend.html else params.legend.text }}
10
+ </h1>
11
+ {% else %}
12
+ {{ params.legend.html | safe if params.legend.html else params.legend.text }}
13
+ {% endif -%}
14
+ </legend>
15
+ {% endif %}
16
+ {{ caller() if caller }} {#- if statement allows usage of `call` to be optional -#}
17
+ </fieldset>
@@ -0,0 +1,332 @@
1
+ # File upload
2
+
3
+ ## Introduction
4
+
5
+ The HTML `<input>` element with type="file" lets a user pick one or more files, to upload to a server.
6
+
7
+ ## Guidance
8
+
9
+ Find out when to use the File upload component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/file-upload).
10
+
11
+ ## Quick start examples
12
+
13
+ ### Component default
14
+
15
+ [Preview the file-upload component](http://govuk-frontend-review.herokuapp.com/components/file-upload/preview)
16
+
17
+ #### Markup
18
+
19
+ <div class="govuk-form-group">
20
+ <label class="govuk-label" for="file-upload-1">
21
+ Upload a file
22
+ </label>
23
+
24
+ <input class="govuk-file-upload" id="file-upload-1" name="file-upload-1" type="file">
25
+ </div>
26
+
27
+ #### Macro
28
+
29
+ {% from 'file-upload/macro.njk' import govukFileUpload %}
30
+
31
+ {{ govukFileUpload({
32
+ "id": "file-upload-1",
33
+ "name": "file-upload-1",
34
+ "label": {
35
+ "text": "Upload a file"
36
+ }
37
+ }) }}
38
+
39
+ ### File-upload--with-hint-text
40
+
41
+ [Preview the file-upload--with-hint-text example](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-hint-text/preview)
42
+
43
+ #### Markup
44
+
45
+ <div class="govuk-form-group">
46
+ <label class="govuk-label" for="file-upload-2">
47
+ Upload your photo
48
+ </label>
49
+
50
+ <span id="file-upload-2-hint" class="govuk-hint">
51
+ Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.
52
+ </span>
53
+
54
+ <input class="govuk-file-upload" id="file-upload-2" name="file-upload-2" type="file" aria-describedby="file-upload-2-hint">
55
+ </div>
56
+
57
+ #### Macro
58
+
59
+ {% from 'file-upload/macro.njk' import govukFileUpload %}
60
+
61
+ {{ govukFileUpload({
62
+ "id": "file-upload-2",
63
+ "name": "file-upload-2",
64
+ "label": {
65
+ "text": "Upload your photo"
66
+ },
67
+ "hint": {
68
+ "text": "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
69
+ }
70
+ }) }}
71
+
72
+ ### File-upload--with-error-message
73
+
74
+ [Preview the file-upload--with-error-message example](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-error-message/preview)
75
+
76
+ #### Markup
77
+
78
+ <div class="govuk-form-group govuk-form-group--error">
79
+ <label class="govuk-label" for="file-upload-3">
80
+ Upload a file
81
+ </label>
82
+
83
+ <span id="file-upload-3-hint" class="govuk-hint">
84
+ Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto.
85
+ </span>
86
+
87
+ <span id="file-upload-3-error" class="govuk-error-message">
88
+ Error message goes here
89
+ </span>
90
+
91
+ <input class="govuk-file-upload govuk-file-upload--error" id="file-upload-3" name="file-upload-3" type="file" aria-describedby="file-upload-3-hint file-upload-3-error">
92
+ </div>
93
+
94
+ #### Macro
95
+
96
+ {% from 'file-upload/macro.njk' import govukFileUpload %}
97
+
98
+ {{ govukFileUpload({
99
+ "id": "file-upload-3",
100
+ "name": "file-upload-3",
101
+ "label": {
102
+ "text": "Upload a file"
103
+ },
104
+ "hint": {
105
+ "text": "Your photo may be in your Pictures, Photos, Downloads or Desktop folder. Or in an app like iPhoto."
106
+ },
107
+ "errorMessage": {
108
+ "text": "Error message goes here"
109
+ }
110
+ }) }}
111
+
112
+ ### File-upload--with-value-and-attributes
113
+
114
+ [Preview the file-upload--with-value-and-attributes example](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-value-and-attributes/preview)
115
+
116
+ #### Markup
117
+
118
+ <div class="govuk-form-group">
119
+ <label class="govuk-label" for="file-upload-4">
120
+ Upload a photo
121
+ </label>
122
+
123
+ <input class="govuk-file-upload" id="file-upload-4" name="file-upload-4" type="file" value="C:\fakepath\myphoto.jpg" accept=".jpg, .jpeg, .png">
124
+ </div>
125
+
126
+ #### Macro
127
+
128
+ {% from 'file-upload/macro.njk' import govukFileUpload %}
129
+
130
+ {{ govukFileUpload({
131
+ "id": "file-upload-4",
132
+ "name": "file-upload-4",
133
+ "value": "C:\\fakepath\\myphoto.jpg",
134
+ "label": {
135
+ "text": "Upload a photo"
136
+ },
137
+ "attributes": {
138
+ "accept": ".jpg, .jpeg, .png"
139
+ }
140
+ }) }}
141
+
142
+ ### File-upload--with-label-as-page-heading
143
+
144
+ [Preview the file-upload--with-label-as-page-heading example](http://govuk-frontend-review.herokuapp.com/components/file-upload/with-label-as-page-heading/preview)
145
+
146
+ #### Markup
147
+
148
+ <div class="govuk-form-group">
149
+ <h1 class="govuk-label-wrapper">
150
+ <label class="govuk-label" for="file-upload-1">
151
+ Upload a file
152
+ </label>
153
+
154
+ </h1>
155
+
156
+ <input class="govuk-file-upload" id="file-upload-1" name="file-upload-1" type="file">
157
+ </div>
158
+
159
+ #### Macro
160
+
161
+ {% from 'file-upload/macro.njk' import govukFileUpload %}
162
+
163
+ {{ govukFileUpload({
164
+ "id": "file-upload-1",
165
+ "name": "file-upload-1",
166
+ "label": {
167
+ "text": "Upload a file",
168
+ "isPageHeading": true
169
+ }
170
+ }) }}
171
+
172
+ ## Requirements
173
+
174
+ ### Build tool configuration
175
+
176
+ When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
177
+
178
+ .pipe(sass({
179
+ includePaths: 'node_modules/'
180
+ }))
181
+
182
+ ### Static asset path configuration
183
+
184
+ In order to include the images used in the components, you need to configure your app to show these assets. Below is a sample configuration using Express js:
185
+
186
+ app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
187
+
188
+ ## Component arguments
189
+
190
+ If you are using Nunjucks,then macros take the following arguments
191
+
192
+ **If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
193
+
194
+ <table class="govuk-table">
195
+
196
+ <thead class="govuk-table__head">
197
+
198
+ <tr class="govuk-table__row">
199
+
200
+ <th class="govuk-table__header" scope="col">Name</th>
201
+
202
+ <th class="govuk-table__header" scope="col">Type</th>
203
+
204
+ <th class="govuk-table__header" scope="col">Required</th>
205
+
206
+ <th class="govuk-table__header" scope="col">Description</th>
207
+
208
+ </tr>
209
+
210
+ </thead>
211
+
212
+ <tbody class="govuk-table__body">
213
+
214
+ <tr class="govuk-table__row">
215
+
216
+ <th class="govuk-table__header" scope="row">name</th>
217
+
218
+ <td class="govuk-table__cell ">string</td>
219
+
220
+ <td class="govuk-table__cell ">Yes</td>
221
+
222
+ <td class="govuk-table__cell ">The name of the input, which is submitted with the form data.</td>
223
+
224
+ </tr>
225
+
226
+ <tr class="govuk-table__row">
227
+
228
+ <th class="govuk-table__header" scope="row">id</th>
229
+
230
+ <td class="govuk-table__cell ">string</td>
231
+
232
+ <td class="govuk-table__cell ">Yes</td>
233
+
234
+ <td class="govuk-table__cell ">The id of the input</td>
235
+
236
+ </tr>
237
+
238
+ <tr class="govuk-table__row">
239
+
240
+ <th class="govuk-table__header" scope="row">value</th>
241
+
242
+ <td class="govuk-table__cell ">string</td>
243
+
244
+ <td class="govuk-table__cell ">No</td>
245
+
246
+ <td class="govuk-table__cell ">Optional initial value of the input</td>
247
+
248
+ </tr>
249
+
250
+ <tr class="govuk-table__row">
251
+
252
+ <th class="govuk-table__header" scope="row">label</th>
253
+
254
+ <td class="govuk-table__cell ">object</td>
255
+
256
+ <td class="govuk-table__cell ">Yes</td>
257
+
258
+ <td class="govuk-table__cell ">Arguments for the label component. See label component.</td>
259
+
260
+ </tr>
261
+
262
+ <tr class="govuk-table__row">
263
+
264
+ <th class="govuk-table__header" scope="row">hint</th>
265
+
266
+ <td class="govuk-table__cell ">object</td>
267
+
268
+ <td class="govuk-table__cell ">No</td>
269
+
270
+ <td class="govuk-table__cell ">Arguments for the hint component (e.g. text). See hint component.</td>
271
+
272
+ </tr>
273
+
274
+ <tr class="govuk-table__row">
275
+
276
+ <th class="govuk-table__header" scope="row">errorMessage</th>
277
+
278
+ <td class="govuk-table__cell ">object</td>
279
+
280
+ <td class="govuk-table__cell ">No</td>
281
+
282
+ <td class="govuk-table__cell ">Arguments for the errorMessage component (e.g. text). See errorMessage component.</td>
283
+
284
+ </tr>
285
+
286
+ <tr class="govuk-table__row">
287
+
288
+ <th class="govuk-table__header" scope="row">classes</th>
289
+
290
+ <td class="govuk-table__cell ">string</td>
291
+
292
+ <td class="govuk-table__cell ">No</td>
293
+
294
+ <td class="govuk-table__cell ">Optional additional classes to add to the input tag.</td>
295
+
296
+ </tr>
297
+
298
+ <tr class="govuk-table__row">
299
+
300
+ <th class="govuk-table__header" scope="row">attributes</th>
301
+
302
+ <td class="govuk-table__cell ">object</td>
303
+
304
+ <td class="govuk-table__cell ">No</td>
305
+
306
+ <td class="govuk-table__cell ">Any extra HTML attributes (for example accept or data attributes) to add to the input tag.</td>
307
+
308
+ </tr>
309
+
310
+ </tbody>
311
+
312
+ </table>
313
+
314
+ **If you’re using Nunjucks macros in production be aware that using `html` arguments, or ones ending with `Html` can be a [security risk](https://en.wikipedia.org/wiki/Cross-site_scripting). More about it in the [Nunjucks documentation](https://mozilla.github.io/nunjucks/api.html#user-defined-templates-warning).**
315
+
316
+ ### Setting up Nunjucks views and paths
317
+
318
+ Below is an example setup using express configure views:
319
+
320
+ nunjucks.configure('node_modules/govuk-frontend/components', {
321
+ autoescape: true,
322
+ cache: false,
323
+ express: app
324
+ })
325
+
326
+ ## Contribution
327
+
328
+ Guidelines can be found at [on our Github repository.](https://github.com/alphagov/govuk-frontend/blob/master/CONTRIBUTING.md "link to contributing guidelines on our github repository")
329
+
330
+ ## License
331
+
332
+ MIT