govuk_fe_assets 0.1.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +5 -0
  5. data/Gemfile +4 -0
  6. data/LICENSE.txt +21 -0
  7. data/README.md +39 -0
  8. data/Rakefile +6 -0
  9. data/govuk_fe_assets.gemspec +26 -0
  10. data/lib/govuk_fe_assets.rb +5 -0
  11. data/lib/govuk_fe_assets/version.rb +3 -0
  12. data/node_modules/govuk-frontend/README.md +96 -0
  13. data/node_modules/govuk-frontend/all-ie8.scss +6 -0
  14. data/node_modules/govuk-frontend/all.js +1720 -0
  15. data/node_modules/govuk-frontend/all.scss +11 -0
  16. data/node_modules/govuk-frontend/assets/fonts/bold-a2452cb66f-v1.woff2 +0 -0
  17. data/node_modules/govuk-frontend/assets/fonts/bold-f38c792ac2-v1.woff +0 -0
  18. data/node_modules/govuk-frontend/assets/fonts/bold-fb2676462a-v1.eot +0 -0
  19. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-357fdfbcc3-v1.eot +0 -0
  20. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-784c21afb8-v1.woff +0 -0
  21. data/node_modules/govuk-frontend/assets/fonts/bold-tabular-b89238d840-v1.woff2 +0 -0
  22. data/node_modules/govuk-frontend/assets/fonts/light-2c037cf7e1-v1.eot +0 -0
  23. data/node_modules/govuk-frontend/assets/fonts/light-458f8ea81c-v1.woff +0 -0
  24. data/node_modules/govuk-frontend/assets/fonts/light-f38ad40456-v1.woff2 +0 -0
  25. data/node_modules/govuk-frontend/assets/fonts/light-tabular-498ea8ffe2-v1.eot +0 -0
  26. data/node_modules/govuk-frontend/assets/fonts/light-tabular-62cc6f0a28-v1.woff +0 -0
  27. data/node_modules/govuk-frontend/assets/fonts/light-tabular-851b10ccdd-v1.woff2 +0 -0
  28. data/node_modules/govuk-frontend/assets/images/favicon.ico +0 -0
  29. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-152x152.png +0 -0
  30. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-167x167.png +0 -0
  31. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon-180x180.png +0 -0
  32. data/node_modules/govuk-frontend/assets/images/govuk-apple-touch-icon.png +0 -0
  33. data/node_modules/govuk-frontend/assets/images/govuk-crest-2x.png +0 -0
  34. data/node_modules/govuk-frontend/assets/images/govuk-crest.png +0 -0
  35. data/node_modules/govuk-frontend/assets/images/govuk-logotype-crown.png +0 -0
  36. data/node_modules/govuk-frontend/assets/images/govuk-mask-icon.svg +7 -0
  37. data/node_modules/govuk-frontend/assets/images/govuk-opengraph-image.png +0 -0
  38. data/node_modules/govuk-frontend/assets/images/icon-arrow-left.png +0 -0
  39. data/node_modules/govuk-frontend/assets/images/icon-important.png +0 -0
  40. data/node_modules/govuk-frontend/assets/images/icon-pointer-2x.png +0 -0
  41. data/node_modules/govuk-frontend/assets/images/icon-pointer.png +0 -0
  42. data/node_modules/govuk-frontend/common.js +39 -0
  43. data/node_modules/govuk-frontend/components/_all.scss +26 -0
  44. data/node_modules/govuk-frontend/components/back-link/README.md +142 -0
  45. data/node_modules/govuk-frontend/components/back-link/_back-link.scss +54 -0
  46. data/node_modules/govuk-frontend/components/back-link/back-link.njk +3 -0
  47. data/node_modules/govuk-frontend/components/back-link/macro.njk +3 -0
  48. data/node_modules/govuk-frontend/components/back-link/template.njk +2 -0
  49. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +335 -0
  50. data/node_modules/govuk-frontend/components/breadcrumbs/_breadcrumbs.scss +119 -0
  51. data/node_modules/govuk-frontend/components/breadcrumbs/breadcrumbs.njk +14 -0
  52. data/node_modules/govuk-frontend/components/breadcrumbs/macro.njk +3 -0
  53. data/node_modules/govuk-frontend/components/breadcrumbs/template.njk +13 -0
  54. data/node_modules/govuk-frontend/components/button/README.md +319 -0
  55. data/node_modules/govuk-frontend/components/button/_button.scss +185 -0
  56. data/node_modules/govuk-frontend/components/button/button.js +548 -0
  57. data/node_modules/govuk-frontend/components/button/button.njk +3 -0
  58. data/node_modules/govuk-frontend/components/button/macro.njk +3 -0
  59. data/node_modules/govuk-frontend/components/button/template.njk +35 -0
  60. data/node_modules/govuk-frontend/components/checkboxes/README.md +782 -0
  61. data/node_modules/govuk-frontend/components/checkboxes/_checkboxes.scss +151 -0
  62. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +730 -0
  63. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.njk +27 -0
  64. data/node_modules/govuk-frontend/components/checkboxes/macro.njk +3 -0
  65. data/node_modules/govuk-frontend/components/checkboxes/template.njk +86 -0
  66. data/node_modules/govuk-frontend/components/date-input/README.md +640 -0
  67. data/node_modules/govuk-frontend/components/date-input/_date-input.scss +35 -0
  68. data/node_modules/govuk-frontend/components/date-input/date-input.njk +23 -0
  69. data/node_modules/govuk-frontend/components/date-input/macro.njk +3 -0
  70. data/node_modules/govuk-frontend/components/date-input/template.njk +76 -0
  71. data/node_modules/govuk-frontend/components/details/README.md +237 -0
  72. data/node_modules/govuk-frontend/components/details/_details.scss +86 -0
  73. data/node_modules/govuk-frontend/components/details/details.js +836 -0
  74. data/node_modules/govuk-frontend/components/details/details.njk +7 -0
  75. data/node_modules/govuk-frontend/components/details/implementation.md +43 -0
  76. data/node_modules/govuk-frontend/components/details/macro.njk +3 -0
  77. data/node_modules/govuk-frontend/components/details/template.njk +10 -0
  78. data/node_modules/govuk-frontend/components/error-message/README.md +143 -0
  79. data/node_modules/govuk-frontend/components/error-message/_error-message.scss +15 -0
  80. data/node_modules/govuk-frontend/components/error-message/error-message.njk +7 -0
  81. data/node_modules/govuk-frontend/components/error-message/macro.njk +3 -0
  82. data/node_modules/govuk-frontend/components/error-message/template.njk +3 -0
  83. data/node_modules/govuk-frontend/components/error-summary/README.md +215 -0
  84. data/node_modules/govuk-frontend/components/error-summary/_error-summary.scss +68 -0
  85. data/node_modules/govuk-frontend/components/error-summary/error-summary.js +520 -0
  86. data/node_modules/govuk-frontend/components/error-summary/error-summary.njk +17 -0
  87. data/node_modules/govuk-frontend/components/error-summary/macro.njk +3 -0
  88. data/node_modules/govuk-frontend/components/error-summary/template.njk +25 -0
  89. data/node_modules/govuk-frontend/components/fieldset/README.md +213 -0
  90. data/node_modules/govuk-frontend/components/fieldset/_fieldset.scss +58 -0
  91. data/node_modules/govuk-frontend/components/fieldset/fieldset.njk +13 -0
  92. data/node_modules/govuk-frontend/components/fieldset/macro.njk +3 -0
  93. data/node_modules/govuk-frontend/components/fieldset/template.njk +17 -0
  94. data/node_modules/govuk-frontend/components/file-upload/README.md +332 -0
  95. data/node_modules/govuk-frontend/components/file-upload/_file-upload.scss +19 -0
  96. data/node_modules/govuk-frontend/components/file-upload/file-upload.njk +9 -0
  97. data/node_modules/govuk-frontend/components/file-upload/macro.njk +3 -0
  98. data/node_modules/govuk-frontend/components/file-upload/template.njk +42 -0
  99. data/node_modules/govuk-frontend/components/footer/README.md +284 -0
  100. data/node_modules/govuk-frontend/components/footer/_footer.scss +216 -0
  101. data/node_modules/govuk-frontend/components/footer/footer.njk +3 -0
  102. data/node_modules/govuk-frontend/components/footer/macro.njk +3 -0
  103. data/node_modules/govuk-frontend/components/footer/template.njk +80 -0
  104. data/node_modules/govuk-frontend/components/header/README.md +524 -0
  105. data/node_modules/govuk-frontend/components/header/_header.scss +285 -0
  106. data/node_modules/govuk-frontend/components/header/header.js +717 -0
  107. data/node_modules/govuk-frontend/components/header/header.njk +3 -0
  108. data/node_modules/govuk-frontend/components/header/macro.njk +3 -0
  109. data/node_modules/govuk-frontend/components/header/template.njk +82 -0
  110. data/node_modules/govuk-frontend/components/hint/README.md +157 -0
  111. data/node_modules/govuk-frontend/components/hint/_hint.scss +29 -0
  112. data/node_modules/govuk-frontend/components/hint/hint.njk +7 -0
  113. data/node_modules/govuk-frontend/components/hint/macro.njk +3 -0
  114. data/node_modules/govuk-frontend/components/hint/template.njk +4 -0
  115. data/node_modules/govuk-frontend/components/input/README.md +416 -0
  116. data/node_modules/govuk-frontend/components/input/_input.scss +62 -0
  117. data/node_modules/govuk-frontend/components/input/input.njk +9 -0
  118. data/node_modules/govuk-frontend/components/input/macro.njk +3 -0
  119. data/node_modules/govuk-frontend/components/input/template.njk +42 -0
  120. data/node_modules/govuk-frontend/components/inset-text/README.md +157 -0
  121. data/node_modules/govuk-frontend/components/inset-text/_inset-text.scss +28 -0
  122. data/node_modules/govuk-frontend/components/inset-text/inset-text.njk +7 -0
  123. data/node_modules/govuk-frontend/components/inset-text/macro.njk +3 -0
  124. data/node_modules/govuk-frontend/components/inset-text/template.njk +4 -0
  125. data/node_modules/govuk-frontend/components/label/README.md +193 -0
  126. data/node_modules/govuk-frontend/components/label/_label.scss +45 -0
  127. data/node_modules/govuk-frontend/components/label/label.njk +6 -0
  128. data/node_modules/govuk-frontend/components/label/macro.njk +3 -0
  129. data/node_modules/govuk-frontend/components/label/template.njk +15 -0
  130. data/node_modules/govuk-frontend/components/panel/README.md +151 -0
  131. data/node_modules/govuk-frontend/components/panel/_panel.scss +42 -0
  132. data/node_modules/govuk-frontend/components/panel/macro.njk +3 -0
  133. data/node_modules/govuk-frontend/components/panel/panel.njk +7 -0
  134. data/node_modules/govuk-frontend/components/panel/template.njk +12 -0
  135. data/node_modules/govuk-frontend/components/phase-banner/README.md +152 -0
  136. data/node_modules/govuk-frontend/components/phase-banner/_phase-banner.scss +31 -0
  137. data/node_modules/govuk-frontend/components/phase-banner/macro.njk +3 -0
  138. data/node_modules/govuk-frontend/components/phase-banner/phase-banner.njk +7 -0
  139. data/node_modules/govuk-frontend/components/phase-banner/template.njk +17 -0
  140. data/node_modules/govuk-frontend/components/radios/README.md +686 -0
  141. data/node_modules/govuk-frontend/components/radios/_radios.scss +157 -0
  142. data/node_modules/govuk-frontend/components/radios/macro.njk +3 -0
  143. data/node_modules/govuk-frontend/components/radios/radios.js +730 -0
  144. data/node_modules/govuk-frontend/components/radios/radios.njk +27 -0
  145. data/node_modules/govuk-frontend/components/radios/template.njk +85 -0
  146. data/node_modules/govuk-frontend/components/select/README.md +387 -0
  147. data/node_modules/govuk-frontend/components/select/_select.scss +35 -0
  148. data/node_modules/govuk-frontend/components/select/macro.njk +3 -0
  149. data/node_modules/govuk-frontend/components/select/select.njk +24 -0
  150. data/node_modules/govuk-frontend/components/select/template.njk +44 -0
  151. data/node_modules/govuk-frontend/components/skip-link/README.md +142 -0
  152. data/node_modules/govuk-frontend/components/skip-link/_skip-link.scss +15 -0
  153. data/node_modules/govuk-frontend/components/skip-link/macro.njk +3 -0
  154. data/node_modules/govuk-frontend/components/skip-link/skip-link.njk +3 -0
  155. data/node_modules/govuk-frontend/components/skip-link/template.njk +3 -0
  156. data/node_modules/govuk-frontend/components/table/README.md +585 -0
  157. data/node_modules/govuk-frontend/components/table/_table.scss +50 -0
  158. data/node_modules/govuk-frontend/components/table/macro.njk +3 -0
  159. data/node_modules/govuk-frontend/components/table/table.njk +45 -0
  160. data/node_modules/govuk-frontend/components/table/template.njk +39 -0
  161. data/node_modules/govuk-frontend/components/tabs/README.md +375 -0
  162. data/node_modules/govuk-frontend/components/tabs/_tabs.scss +120 -0
  163. data/node_modules/govuk-frontend/components/tabs/macro.njk +3 -0
  164. data/node_modules/govuk-frontend/components/tabs/tabs.js +1302 -0
  165. data/node_modules/govuk-frontend/components/tabs/tabs.njk +3 -0
  166. data/node_modules/govuk-frontend/components/tabs/template.njk +29 -0
  167. data/node_modules/govuk-frontend/components/tag/README.md +150 -0
  168. data/node_modules/govuk-frontend/components/tag/_tag.scss +23 -0
  169. data/node_modules/govuk-frontend/components/tag/macro.njk +3 -0
  170. data/node_modules/govuk-frontend/components/tag/tag.njk +7 -0
  171. data/node_modules/govuk-frontend/components/tag/template.njk +3 -0
  172. data/node_modules/govuk-frontend/components/textarea/README.md +350 -0
  173. data/node_modules/govuk-frontend/components/textarea/_textarea.scss +31 -0
  174. data/node_modules/govuk-frontend/components/textarea/macro.njk +3 -0
  175. data/node_modules/govuk-frontend/components/textarea/template.njk +41 -0
  176. data/node_modules/govuk-frontend/components/textarea/textarea.njk +11 -0
  177. data/node_modules/govuk-frontend/components/warning-text/README.md +148 -0
  178. data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +50 -0
  179. data/node_modules/govuk-frontend/components/warning-text/macro.njk +3 -0
  180. data/node_modules/govuk-frontend/components/warning-text/template.njk +9 -0
  181. data/node_modules/govuk-frontend/components/warning-text/warning-text.njk +9 -0
  182. data/node_modules/govuk-frontend/core/_all.scss +6 -0
  183. data/node_modules/govuk-frontend/core/_global-styles.scss +19 -0
  184. data/node_modules/govuk-frontend/core/_links.scss +40 -0
  185. data/node_modules/govuk-frontend/core/_lists.scss +63 -0
  186. data/node_modules/govuk-frontend/core/_section-break.scss +56 -0
  187. data/node_modules/govuk-frontend/core/_template.scss +16 -0
  188. data/node_modules/govuk-frontend/core/_typography.scss +186 -0
  189. data/node_modules/govuk-frontend/helpers/_all.scss +12 -0
  190. data/node_modules/govuk-frontend/helpers/_clearfix.scss +15 -0
  191. data/node_modules/govuk-frontend/helpers/_colour.scss +51 -0
  192. data/node_modules/govuk-frontend/helpers/_device-pixels.scss +38 -0
  193. data/node_modules/govuk-frontend/helpers/_focusable.scss +34 -0
  194. data/node_modules/govuk-frontend/helpers/_font-faces.scss +67 -0
  195. data/node_modules/govuk-frontend/helpers/_grid.scss +100 -0
  196. data/node_modules/govuk-frontend/helpers/_links.scss +149 -0
  197. data/node_modules/govuk-frontend/helpers/_media-queries.scss +95 -0
  198. data/node_modules/govuk-frontend/helpers/_shape-arrow.scss +80 -0
  199. data/node_modules/govuk-frontend/helpers/_spacing.scss +152 -0
  200. data/node_modules/govuk-frontend/helpers/_typography.scss +153 -0
  201. data/node_modules/govuk-frontend/helpers/_visually-hidden.scss +76 -0
  202. data/node_modules/govuk-frontend/objects/_all.scss +4 -0
  203. data/node_modules/govuk-frontend/objects/_form-group.scss +21 -0
  204. data/node_modules/govuk-frontend/objects/_grid.scss +10 -0
  205. data/node_modules/govuk-frontend/objects/_main-wrapper.scss +37 -0
  206. data/node_modules/govuk-frontend/objects/_width-container.scss +28 -0
  207. data/node_modules/govuk-frontend/overrides/_all.scss +4 -0
  208. data/node_modules/govuk-frontend/overrides/_display.scss +14 -0
  209. data/node_modules/govuk-frontend/overrides/_spacing.scss +58 -0
  210. data/node_modules/govuk-frontend/overrides/_typography.scss +21 -0
  211. data/node_modules/govuk-frontend/overrides/_width.scss +41 -0
  212. data/node_modules/govuk-frontend/package.json +50 -0
  213. data/node_modules/govuk-frontend/settings/_all.scss +21 -0
  214. data/node_modules/govuk-frontend/settings/_assets.scss +82 -0
  215. data/node_modules/govuk-frontend/settings/_colours-applied.scss +130 -0
  216. data/node_modules/govuk-frontend/settings/_colours-organisations.scss +136 -0
  217. data/node_modules/govuk-frontend/settings/_colours-palette.scss +37 -0
  218. data/node_modules/govuk-frontend/settings/_compatibility.scss +51 -0
  219. data/node_modules/govuk-frontend/settings/_global-styles.scss +13 -0
  220. data/node_modules/govuk-frontend/settings/_ie8.scss +18 -0
  221. data/node_modules/govuk-frontend/settings/_measurements.scss +85 -0
  222. data/node_modules/govuk-frontend/settings/_media-queries.scss +23 -0
  223. data/node_modules/govuk-frontend/settings/_spacing.scss +80 -0
  224. data/node_modules/govuk-frontend/settings/_typography-font-families.scss +22 -0
  225. data/node_modules/govuk-frontend/settings/_typography-font.scss +48 -0
  226. data/node_modules/govuk-frontend/settings/_typography-responsive.scss +138 -0
  227. data/node_modules/govuk-frontend/template.njk +56 -0
  228. data/node_modules/govuk-frontend/tools/_all.scss +7 -0
  229. data/node_modules/govuk-frontend/tools/_compatibility.scss +36 -0
  230. data/node_modules/govuk-frontend/tools/_exports.scss +33 -0
  231. data/node_modules/govuk-frontend/tools/_font-url.scss +28 -0
  232. data/node_modules/govuk-frontend/tools/_ie8.scss +51 -0
  233. data/node_modules/govuk-frontend/tools/_iff.scss +15 -0
  234. data/node_modules/govuk-frontend/tools/_image-url.scss +28 -0
  235. data/node_modules/govuk-frontend/tools/_px-to-em.scss +20 -0
  236. data/node_modules/govuk-frontend/utilities/_all.scss +2 -0
  237. data/node_modules/govuk-frontend/utilities/_clearfix.scss +5 -0
  238. data/node_modules/govuk-frontend/utilities/_visually-hidden.scss +9 -0
  239. data/node_modules/govuk-frontend/vendor/_sass-mq.scss +351 -0
  240. data/node_modules/govuk-frontend/vendor/polyfills/DOMTokenList.js +272 -0
  241. data/node_modules/govuk-frontend/vendor/polyfills/Document.js +34 -0
  242. data/node_modules/govuk-frontend/vendor/polyfills/Element.js +147 -0
  243. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +449 -0
  244. data/node_modules/govuk-frontend/vendor/polyfills/Event.js +504 -0
  245. data/node_modules/govuk-frontend/vendor/polyfills/Function/prototype/bind.js +252 -0
  246. data/node_modules/govuk-frontend/vendor/polyfills/Object/defineProperty.js +94 -0
  247. data/node_modules/govuk-frontend/vendor/polyfills/Window.js +28 -0
  248. data/package-lock.json +10 -0
  249. data/package.json +5 -0
  250. metadata +334 -0
@@ -0,0 +1,27 @@
1
+ {% from 'checkboxes/macro.njk' import govukCheckboxes %}
2
+
3
+ {{ govukCheckboxes({
4
+ "idPrefix": "waste-types",
5
+ "name": "waste-types",
6
+ "items": [
7
+ {
8
+ "value": "waste-animal",
9
+ "text": "Waste from animal carcasses"
10
+ },
11
+ {
12
+ "id": "custom-id",
13
+ "value": "waste-mines",
14
+ "text": "Waste from mines or quarries"
15
+ },
16
+ {
17
+ "value": "waste-farm",
18
+ "text": "Farm or agricultural waste",
19
+ "checked": true
20
+ },
21
+ {
22
+ "value": "waste-disabled",
23
+ "text": "Disabled checkbox option",
24
+ "disabled": true
25
+ }
26
+ ]
27
+ }) }}
@@ -0,0 +1,3 @@
1
+ {% macro govukCheckboxes(params) %}
2
+ {%- include "./template.njk" -%}
3
+ {% endmacro %}
@@ -0,0 +1,86 @@
1
+ {% from "../error-message/macro.njk" import govukErrorMessage -%}
2
+ {% from "../fieldset/macro.njk" import govukFieldset %}
3
+ {% from "../hint/macro.njk" import govukHint %}
4
+ {% from "../label/macro.njk" import govukLabel %}
5
+
6
+ {#- If an id 'prefix' is not passed, fall back to using the name attribute
7
+ instead. We need this for error messages and hints as well -#}
8
+ {% set idPrefix = params.idPrefix if params.idPrefix else params.name %}
9
+
10
+ {#- a record of other elements that we need to associate with the input using
11
+ aria-describedby – for example hints or error messages -#}
12
+ {% set describedBy = "" %}
13
+
14
+ {% set isConditional = false %}
15
+ {% for item in params.items %}
16
+ {% if item.conditional %}
17
+ {% set isConditional = true %}
18
+ {% endif %}
19
+ {% endfor %}
20
+
21
+ {#- Capture the HTML so we can optionally nest it in a fieldset -#}
22
+ {% set innerHtml %}
23
+ {% if params.hint %}
24
+ {% set hintId = idPrefix + '-hint' %}
25
+ {% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
26
+ {{ govukHint({
27
+ id: hintId,
28
+ classes: params.hint.classes,
29
+ attributes: params.hint.attributes,
30
+ html: params.hint.html,
31
+ text: params.hint.text
32
+ }) | indent(2) | trim }}
33
+ {% endif %}
34
+ {% if params.errorMessage %}
35
+ {% set errorId = idPrefix + '-error' %}
36
+ {% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
37
+ {{ govukErrorMessage({
38
+ id: errorId,
39
+ classes: params.errorMessage.classes,
40
+ html: params.errorMessage.html,
41
+ text: params.errorMessage.text
42
+ }) | indent(2) | trim }}
43
+ {% endif %}
44
+ <div class="govuk-checkboxes {%- if params.classes %} {{ params.classes }}{% endif %}"
45
+ {%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}
46
+ {%- if isConditional %} data-module="checkboxes"{% endif -%}>
47
+ {% for item in params.items %}
48
+ {% set id = item.id if item.id else idPrefix + "-" + loop.index %}
49
+ {% set name = item.name if item.name else params.name %}
50
+ {% set conditionalId = "conditional-" + id %}
51
+ <div class="govuk-checkboxes__item">
52
+ <input class="govuk-checkboxes__input" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
53
+ {{-" checked" if item.checked }}
54
+ {{-" disabled" if item.disabled }}
55
+ {%- if item.conditional %} data-aria-controls="{{ conditionalId }}"{% endif -%}>
56
+ {{ govukLabel({
57
+ html: item.html,
58
+ text: item.text,
59
+ classes: 'govuk-checkboxes__label',
60
+ attributes: item.label.attributes,
61
+ for: id
62
+ }) | indent(6) | trim }}
63
+ </div>
64
+ {% if item.conditional %}
65
+ <div class="govuk-checkboxes__conditional" id="{{ conditionalId }}">
66
+ {{ item.conditional.html | safe }}
67
+ </div>
68
+ {% endif %}
69
+ {% endfor %}
70
+ </div>
71
+ {% endset -%}
72
+
73
+ <div class="govuk-form-group {%- if params.errorMessage %} govuk-form-group--error{% endif %}">
74
+ {% if params.fieldset %}
75
+ {% call govukFieldset({
76
+ describedBy: describedBy,
77
+ classes: params.fieldset.classes,
78
+ attributes: params.fieldset.attributes,
79
+ legend: params.fieldset.legend
80
+ }) %}
81
+ {{ innerHtml | trim | safe }}
82
+ {% endcall %}
83
+ {% else %}
84
+ {{ innerHtml | trim | safe }}
85
+ {% endif %}
86
+ </div>
@@ -0,0 +1,640 @@
1
+ # Date input
2
+
3
+ ## Introduction
4
+
5
+ A component for entering dates, for example - date of birth.
6
+
7
+ ## Guidance
8
+
9
+ Find out when to use the Date input component in your service in the [GOV.UK Design System](https://govuk-design-system-production.cloudapps.digital/components/date-input).
10
+
11
+ ## Quick start examples
12
+
13
+ ### Component default
14
+
15
+ [Preview the date-input component](http://govuk-frontend-review.herokuapp.com/components/date-input/preview)
16
+
17
+ #### Markup
18
+
19
+ <div class="govuk-form-group">
20
+ <fieldset class="govuk-fieldset" aria-describedby="dob-hint" role="group">
21
+
22
+ <legend class="govuk-fieldset__legend">
23
+ What is your date of birth?
24
+ </legend>
25
+
26
+ <span id="dob-hint" class="govuk-hint">
27
+ For example, 31 3 1980
28
+ </span>
29
+
30
+ <div class="govuk-date-input" id="dob">
31
+
32
+ <div class="govuk-date-input__item govuk-date-input__item--day">
33
+ <div class="govuk-form-group">
34
+ <label class="govuk-label govuk-date-input__label" for="dob-day">
35
+ Day
36
+ </label>
37
+
38
+ <input class="govuk-input govuk-date-input__input" id="dob-day" name="dob-day" type="number" pattern="[0-9]*">
39
+ </div>
40
+ </div>
41
+
42
+ <div class="govuk-date-input__item govuk-date-input__item--month">
43
+ <div class="govuk-form-group">
44
+ <label class="govuk-label govuk-date-input__label" for="dob-month">
45
+ Month
46
+ </label>
47
+
48
+ <input class="govuk-input govuk-date-input__input" id="dob-month" name="dob-month" type="number" pattern="[0-9]*">
49
+ </div>
50
+ </div>
51
+
52
+ <div class="govuk-date-input__item govuk-date-input__item--year">
53
+ <div class="govuk-form-group">
54
+ <label class="govuk-label govuk-date-input__label" for="dob-year">
55
+ Year
56
+ </label>
57
+
58
+ <input class="govuk-input govuk-date-input__input" id="dob-year" name="dob-year" type="number" pattern="[0-9]*">
59
+ </div>
60
+ </div>
61
+
62
+ </div>
63
+ </fieldset>
64
+
65
+ </div>
66
+
67
+ #### Macro
68
+
69
+ {% from 'date-input/macro.njk' import govukDateInput %}
70
+
71
+ {{ govukDateInput({
72
+ "id": "dob",
73
+ "name": "dob",
74
+ "fieldset": {
75
+ "legend": {
76
+ "text": "What is your date of birth?"
77
+ }
78
+ },
79
+ "hint": {
80
+ "text": "For example, 31 3 1980"
81
+ },
82
+ "items": [
83
+ {
84
+ "name": "day"
85
+ },
86
+ {
87
+ "name": "month"
88
+ },
89
+ {
90
+ "name": "year"
91
+ }
92
+ ]
93
+ }) }}
94
+
95
+ ### Date-input--with-errors
96
+
97
+ [Preview the date-input--with-errors example](http://govuk-frontend-review.herokuapp.com/components/date-input/with-errors/preview)
98
+
99
+ #### Markup
100
+
101
+ <div class="govuk-form-group govuk-form-group--error">
102
+ <fieldset class="govuk-fieldset" aria-describedby="dob-errors-hint dob-errors-error" role="group">
103
+
104
+ <legend class="govuk-fieldset__legend">
105
+ What is your date of birth?
106
+ </legend>
107
+
108
+ <span id="dob-errors-hint" class="govuk-hint">
109
+ For example, 31 3 1980
110
+ </span>
111
+
112
+ <span id="dob-errors-error" class="govuk-error-message">
113
+ Error message goes here
114
+ </span>
115
+
116
+ <div class="govuk-date-input" id="dob-errors">
117
+
118
+ <div class="govuk-date-input__item govuk-date-input__item--day">
119
+ <div class="govuk-form-group">
120
+ <label class="govuk-label govuk-date-input__label" for="dob-errors-day">
121
+ Day
122
+ </label>
123
+
124
+ <input class="govuk-input govuk-date-input__input govuk-input--error" id="dob-errors-day" name="undefined-day" type="number" pattern="[0-9]*">
125
+ </div>
126
+ </div>
127
+
128
+ <div class="govuk-date-input__item govuk-date-input__item--month">
129
+ <div class="govuk-form-group">
130
+ <label class="govuk-label govuk-date-input__label" for="dob-errors-month">
131
+ Month
132
+ </label>
133
+
134
+ <input class="govuk-input govuk-date-input__input govuk-input--error" id="dob-errors-month" name="undefined-month" type="number" pattern="[0-9]*">
135
+ </div>
136
+ </div>
137
+
138
+ <div class="govuk-date-input__item govuk-date-input__item--year">
139
+ <div class="govuk-form-group">
140
+ <label class="govuk-label govuk-date-input__label" for="dob-errors-year">
141
+ Year
142
+ </label>
143
+
144
+ <input class="govuk-input govuk-date-input__input govuk-input--error" id="dob-errors-year" name="undefined-year" type="number" pattern="[0-9]*">
145
+ </div>
146
+ </div>
147
+
148
+ </div>
149
+ </fieldset>
150
+
151
+ </div>
152
+
153
+ #### Macro
154
+
155
+ {% from 'date-input/macro.njk' import govukDateInput %}
156
+
157
+ {{ govukDateInput({
158
+ "id": "dob-errors",
159
+ "fieldset": {
160
+ "legend": {
161
+ "text": "What is your date of birth?"
162
+ }
163
+ },
164
+ "hint": {
165
+ "text": "For example, 31 3 1980"
166
+ },
167
+ "errorMessage": {
168
+ "text": "Error message goes here"
169
+ },
170
+ "items": [
171
+ {
172
+ "name": "day",
173
+ "classes": "govuk-input--error"
174
+ },
175
+ {
176
+ "name": "month",
177
+ "classes": "govuk-input--error"
178
+ },
179
+ {
180
+ "name": "year",
181
+ "classes": "govuk-input--error"
182
+ }
183
+ ]
184
+ }) }}
185
+
186
+ ### Date-input--with-day-error
187
+
188
+ [Preview the date-input--with-day-error example](http://govuk-frontend-review.herokuapp.com/components/date-input/with-day-error/preview)
189
+
190
+ #### Markup
191
+
192
+ <div class="govuk-form-group govuk-form-group--error">
193
+ <fieldset class="govuk-fieldset" aria-describedby="dob-day-error-hint dob-day-error-error" role="group">
194
+
195
+ <legend class="govuk-fieldset__legend">
196
+ What is your date of birth?
197
+ </legend>
198
+
199
+ <span id="dob-day-error-hint" class="govuk-hint">
200
+ For example, 31 3 1980
201
+ </span>
202
+
203
+ <span id="dob-day-error-error" class="govuk-error-message">
204
+ Error message goes here
205
+ </span>
206
+
207
+ <div class="govuk-date-input" id="dob-day-error">
208
+
209
+ <div class="govuk-date-input__item govuk-date-input__item--day">
210
+ <div class="govuk-form-group">
211
+ <label class="govuk-label govuk-date-input__label" for="dob-day-error-day">
212
+ Day
213
+ </label>
214
+
215
+ <input class="govuk-input govuk-date-input__input govuk-input--error" id="dob-day-error-day" name="dob-day-error-day" type="number" pattern="[0-9]*">
216
+ </div>
217
+ </div>
218
+
219
+ <div class="govuk-date-input__item govuk-date-input__item--month">
220
+ <div class="govuk-form-group">
221
+ <label class="govuk-label govuk-date-input__label" for="dob-day-error-month">
222
+ Month
223
+ </label>
224
+
225
+ <input class="govuk-input govuk-date-input__input" id="dob-day-error-month" name="dob-day-error-month" type="number" pattern="[0-9]*">
226
+ </div>
227
+ </div>
228
+
229
+ <div class="govuk-date-input__item govuk-date-input__item--year">
230
+ <div class="govuk-form-group">
231
+ <label class="govuk-label govuk-date-input__label" for="dob-day-error-year">
232
+ Year
233
+ </label>
234
+
235
+ <input class="govuk-input govuk-date-input__input" id="dob-day-error-year" name="dob-day-error-year" type="number" pattern="[0-9]*">
236
+ </div>
237
+ </div>
238
+
239
+ </div>
240
+ </fieldset>
241
+
242
+ </div>
243
+
244
+ #### Macro
245
+
246
+ {% from 'date-input/macro.njk' import govukDateInput %}
247
+
248
+ {{ govukDateInput({
249
+ "id": "dob-day-error",
250
+ "name": "dob-day-error",
251
+ "fieldset": {
252
+ "legend": {
253
+ "text": "What is your date of birth?"
254
+ }
255
+ },
256
+ "hint": {
257
+ "text": "For example, 31 3 1980"
258
+ },
259
+ "errorMessage": {
260
+ "text": "Error message goes here"
261
+ },
262
+ "items": [
263
+ {
264
+ "name": "day",
265
+ "classes": "govuk-input--error"
266
+ },
267
+ {
268
+ "name": "month"
269
+ },
270
+ {
271
+ "name": "year"
272
+ }
273
+ ]
274
+ }) }}
275
+
276
+ ### Date-input--with-month-error
277
+
278
+ [Preview the date-input--with-month-error example](http://govuk-frontend-review.herokuapp.com/components/date-input/with-month-error/preview)
279
+
280
+ #### Markup
281
+
282
+ <div class="govuk-form-group govuk-form-group--error">
283
+ <fieldset class="govuk-fieldset" aria-describedby="dob-month-error-hint dob-month-error-error" role="group">
284
+
285
+ <legend class="govuk-fieldset__legend">
286
+ What is your date of birth?
287
+ </legend>
288
+
289
+ <span id="dob-month-error-hint" class="govuk-hint">
290
+ For example, 31 3 1980
291
+ </span>
292
+
293
+ <span id="dob-month-error-error" class="govuk-error-message">
294
+ Error message goes here
295
+ </span>
296
+
297
+ <div class="govuk-date-input" id="dob-month-error">
298
+
299
+ <div class="govuk-date-input__item govuk-date-input__item--day">
300
+ <div class="govuk-form-group">
301
+ <label class="govuk-label govuk-date-input__label" for="dob-month-error-day">
302
+ Day
303
+ </label>
304
+
305
+ <input class="govuk-input govuk-date-input__input" id="dob-month-error-day" name="dob-month-error-day" type="number" pattern="[0-9]*">
306
+ </div>
307
+ </div>
308
+
309
+ <div class="govuk-date-input__item govuk-date-input__item--month">
310
+ <div class="govuk-form-group">
311
+ <label class="govuk-label govuk-date-input__label" for="dob-month-error-month">
312
+ Month
313
+ </label>
314
+
315
+ <input class="govuk-input govuk-date-input__input govuk-input--error" id="dob-month-error-month" name="dob-month-error-month" type="number" pattern="[0-9]*">
316
+ </div>
317
+ </div>
318
+
319
+ <div class="govuk-date-input__item govuk-date-input__item--year">
320
+ <div class="govuk-form-group">
321
+ <label class="govuk-label govuk-date-input__label" for="dob-month-error-year">
322
+ Year
323
+ </label>
324
+
325
+ <input class="govuk-input govuk-date-input__input" id="dob-month-error-year" name="dob-month-error-year" type="number" pattern="[0-9]*">
326
+ </div>
327
+ </div>
328
+
329
+ </div>
330
+ </fieldset>
331
+
332
+ </div>
333
+
334
+ #### Macro
335
+
336
+ {% from 'date-input/macro.njk' import govukDateInput %}
337
+
338
+ {{ govukDateInput({
339
+ "id": "dob-month-error",
340
+ "name": "dob-month-error",
341
+ "fieldset": {
342
+ "legend": {
343
+ "text": "What is your date of birth?"
344
+ }
345
+ },
346
+ "hint": {
347
+ "text": "For example, 31 3 1980"
348
+ },
349
+ "errorMessage": {
350
+ "text": "Error message goes here"
351
+ },
352
+ "items": [
353
+ {
354
+ "name": "day"
355
+ },
356
+ {
357
+ "name": "month",
358
+ "classes": "govuk-input--error"
359
+ },
360
+ {
361
+ "name": "year"
362
+ }
363
+ ]
364
+ }) }}
365
+
366
+ ### Date-input--with-year-error
367
+
368
+ [Preview the date-input--with-year-error example](http://govuk-frontend-review.herokuapp.com/components/date-input/with-year-error/preview)
369
+
370
+ #### Markup
371
+
372
+ <div class="govuk-form-group govuk-form-group--error">
373
+ <fieldset class="govuk-fieldset" aria-describedby="dob-year-error-hint dob-year-error-error" role="group">
374
+
375
+ <legend class="govuk-fieldset__legend">
376
+ What is your date of birth?
377
+ </legend>
378
+
379
+ <span id="dob-year-error-hint" class="govuk-hint">
380
+ For example, 31 3 1980
381
+ </span>
382
+
383
+ <span id="dob-year-error-error" class="govuk-error-message">
384
+ Error message goes here
385
+ </span>
386
+
387
+ <div class="govuk-date-input" id="dob-year-error">
388
+
389
+ <div class="govuk-date-input__item govuk-date-input__item--day">
390
+ <div class="govuk-form-group">
391
+ <label class="govuk-label govuk-date-input__label" for="dob-year-error-day">
392
+ Day
393
+ </label>
394
+
395
+ <input class="govuk-input govuk-date-input__input" id="dob-year-error-day" name="dob-year-error-day" type="number" pattern="[0-9]*">
396
+ </div>
397
+ </div>
398
+
399
+ <div class="govuk-date-input__item govuk-date-input__item--month">
400
+ <div class="govuk-form-group">
401
+ <label class="govuk-label govuk-date-input__label" for="dob-year-error-month">
402
+ Month
403
+ </label>
404
+
405
+ <input class="govuk-input govuk-date-input__input" id="dob-year-error-month" name="dob-year-error-month" type="number" pattern="[0-9]*">
406
+ </div>
407
+ </div>
408
+
409
+ <div class="govuk-date-input__item govuk-date-input__item--year">
410
+ <div class="govuk-form-group">
411
+ <label class="govuk-label govuk-date-input__label" for="dob-year-error-year">
412
+ Year
413
+ </label>
414
+
415
+ <input class="govuk-input govuk-date-input__input govuk-input--error" id="dob-year-error-year" name="dob-year-error-year" type="number" pattern="[0-9]*">
416
+ </div>
417
+ </div>
418
+
419
+ </div>
420
+ </fieldset>
421
+
422
+ </div>
423
+
424
+ #### Macro
425
+
426
+ {% from 'date-input/macro.njk' import govukDateInput %}
427
+
428
+ {{ govukDateInput({
429
+ "id": "dob-year-error",
430
+ "name": "dob-year-error",
431
+ "fieldset": {
432
+ "legend": {
433
+ "text": "What is your date of birth?"
434
+ }
435
+ },
436
+ "hint": {
437
+ "text": "For example, 31 3 1980"
438
+ },
439
+ "errorMessage": {
440
+ "text": "Error message goes here"
441
+ },
442
+ "items": [
443
+ {
444
+ "name": "day"
445
+ },
446
+ {
447
+ "name": "month"
448
+ },
449
+ {
450
+ "name": "year",
451
+ "classes": "govuk-input--error"
452
+ }
453
+ ]
454
+ }) }}
455
+
456
+ ## Requirements
457
+
458
+ ### Build tool configuration
459
+
460
+ When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
461
+
462
+ .pipe(sass({
463
+ includePaths: 'node_modules/'
464
+ }))
465
+
466
+ ### Static asset path configuration
467
+
468
+ 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:
469
+
470
+ app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
471
+
472
+ ## Component arguments
473
+
474
+ If you are using Nunjucks,then macros take the following arguments
475
+
476
+ **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).**
477
+
478
+ <table class="govuk-table">
479
+
480
+ <thead class="govuk-table__head">
481
+
482
+ <tr class="govuk-table__row">
483
+
484
+ <th class="govuk-table__header" scope="col">Name</th>
485
+
486
+ <th class="govuk-table__header" scope="col">Type</th>
487
+
488
+ <th class="govuk-table__header" scope="col">Required</th>
489
+
490
+ <th class="govuk-table__header" scope="col">Description</th>
491
+
492
+ </tr>
493
+
494
+ </thead>
495
+
496
+ <tbody class="govuk-table__body">
497
+
498
+ <tr class="govuk-table__row">
499
+
500
+ <th class="govuk-table__header" scope="row">id</th>
501
+
502
+ <td class="govuk-table__cell ">string</td>
503
+
504
+ <td class="govuk-table__cell ">No</td>
505
+
506
+ <td class="govuk-table__cell ">Optional id. This is used for the main component and to compose id attribute for each item.</td>
507
+
508
+ </tr>
509
+
510
+ <tr class="govuk-table__row">
511
+
512
+ <th class="govuk-table__header" scope="row">name</th>
513
+
514
+ <td class="govuk-table__cell ">string</td>
515
+
516
+ <td class="govuk-table__cell ">No</td>
517
+
518
+ <td class="govuk-table__cell ">Optional name. This is used to compose the name attribute for each item.</td>
519
+
520
+ </tr>
521
+
522
+ <tr class="govuk-table__row">
523
+
524
+ <th class="govuk-table__header" scope="row">items</th>
525
+
526
+ <td class="govuk-table__cell ">array</td>
527
+
528
+ <td class="govuk-table__cell ">Yes</td>
529
+
530
+ <td class="govuk-table__cell ">An array of input objects with name, value and optional classes</td>
531
+
532
+ </tr>
533
+
534
+ <tr class="govuk-table__row">
535
+
536
+ <th class="govuk-table__header" scope="row">items.{}.id</th>
537
+
538
+ <td class="govuk-table__cell ">string</td>
539
+
540
+ <td class="govuk-table__cell ">No</td>
541
+
542
+ <td class="govuk-table__cell ">Optional item-specific id. If provided, it will be used instead of the generated.</td>
543
+
544
+ </tr>
545
+
546
+ <tr class="govuk-table__row">
547
+
548
+ <th class="govuk-table__header" scope="row">items.{}.name</th>
549
+
550
+ <td class="govuk-table__cell ">array</td>
551
+
552
+ <td class="govuk-table__cell ">Yes</td>
553
+
554
+ <td class="govuk-table__cell ">Optional item-specific name attribute. If provided, it will be used instead of the generated name.</td>
555
+
556
+ </tr>
557
+
558
+ <tr class="govuk-table__row">
559
+
560
+ <th class="govuk-table__header" scope="row">hint</th>
561
+
562
+ <td class="govuk-table__cell ">object</td>
563
+
564
+ <td class="govuk-table__cell ">No</td>
565
+
566
+ <td class="govuk-table__cell ">Optional hint. See hint component.</td>
567
+
568
+ </tr>
569
+
570
+ <tr class="govuk-table__row">
571
+
572
+ <th class="govuk-table__header" scope="row">errorMessage</th>
573
+
574
+ <td class="govuk-table__cell ">object</td>
575
+
576
+ <td class="govuk-table__cell ">No</td>
577
+
578
+ <td class="govuk-table__cell ">Optional error message. See errorMessage component.</td>
579
+
580
+ </tr>
581
+
582
+ <tr class="govuk-table__row">
583
+
584
+ <th class="govuk-table__header" scope="row">fieldset</th>
585
+
586
+ <td class="govuk-table__cell ">object</td>
587
+
588
+ <td class="govuk-table__cell ">No</td>
589
+
590
+ <td class="govuk-table__cell ">Arguments for the fieldset component (e.g. legend). See fieldset component.</td>
591
+
592
+ </tr>
593
+
594
+ <tr class="govuk-table__row">
595
+
596
+ <th class="govuk-table__header" scope="row">classes</th>
597
+
598
+ <td class="govuk-table__cell ">string</td>
599
+
600
+ <td class="govuk-table__cell ">No</td>
601
+
602
+ <td class="govuk-table__cell ">Optional additional classes to add to the date-input container.</td>
603
+
604
+ </tr>
605
+
606
+ <tr class="govuk-table__row">
607
+
608
+ <th class="govuk-table__header" scope="row">attributes</th>
609
+
610
+ <td class="govuk-table__cell ">object</td>
611
+
612
+ <td class="govuk-table__cell ">No</td>
613
+
614
+ <td class="govuk-table__cell ">Any extra HTML attributes (for example data attributes) to add to the date-input container.</td>
615
+
616
+ </tr>
617
+
618
+ </tbody>
619
+
620
+ </table>
621
+
622
+ **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).**
623
+
624
+ ### Setting up Nunjucks views and paths
625
+
626
+ Below is an example setup using express configure views:
627
+
628
+ nunjucks.configure('node_modules/govuk-frontend/components', {
629
+ autoescape: true,
630
+ cache: false,
631
+ express: app
632
+ })
633
+
634
+ ## Contribution
635
+
636
+ 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")
637
+
638
+ ## License
639
+
640
+ MIT