govuk_publishing_components 12.20.0 → 12.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/components/_image-card.scss +2 -2
  3. data/app/assets/stylesheets/govuk_publishing_components/components/_related-navigation.scss +8 -0
  4. data/app/views/govuk_publishing_components/components/_contextual_breadcrumbs.html.erb +8 -8
  5. data/app/views/govuk_publishing_components/components/_contextual_footer.html.erb +10 -0
  6. data/app/views/govuk_publishing_components/components/_contextual_sidebar.html.erb +5 -14
  7. data/app/views/govuk_publishing_components/components/_layout_footer.html.erb +5 -3
  8. data/app/views/govuk_publishing_components/components/_related_navigation.html.erb +10 -6
  9. data/app/views/govuk_publishing_components/components/docs/contextual_breadcrumbs.yml +3 -2
  10. data/app/views/govuk_publishing_components/components/docs/contextual_footer.yml +71 -0
  11. data/app/views/govuk_publishing_components/components/docs/contextual_sidebar.yml +18 -9
  12. data/app/views/govuk_publishing_components/components/docs/layout_footer.yml +17 -0
  13. data/app/views/govuk_publishing_components/components/docs/related_navigation.yml +53 -0
  14. data/app/views/govuk_publishing_components/components/related_navigation/_section.html.erb +10 -5
  15. data/config/locales/en.yml +5 -6
  16. data/lib/govuk_publishing_components.rb +0 -2
  17. data/lib/govuk_publishing_components/presenters/contextual_navigation.rb +0 -4
  18. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +108 -90
  19. data/lib/govuk_publishing_components/version.rb +1 -1
  20. data/node_modules/govuk-frontend/components/back-link/README.md +4 -73
  21. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +4 -238
  22. data/node_modules/govuk-frontend/components/button/README.md +4 -174
  23. data/node_modules/govuk-frontend/components/character-count/README.md +4 -340
  24. data/node_modules/govuk-frontend/components/character-count/template.njk +0 -3
  25. data/node_modules/govuk-frontend/components/checkboxes/README.md +4 -705
  26. data/node_modules/govuk-frontend/components/checkboxes/template.njk +1 -0
  27. data/node_modules/govuk-frontend/components/date-input/README.md +4 -563
  28. data/node_modules/govuk-frontend/components/date-input/template.njk +1 -0
  29. data/node_modules/govuk-frontend/components/details/README.md +4 -128
  30. data/node_modules/govuk-frontend/components/error-message/README.md +4 -58
  31. data/node_modules/govuk-frontend/components/error-summary/README.md +4 -94
  32. data/node_modules/govuk-frontend/components/fieldset/README.md +4 -92
  33. data/node_modules/govuk-frontend/components/file-upload/README.md +4 -199
  34. data/node_modules/govuk-frontend/components/file-upload/template.njk +1 -0
  35. data/node_modules/govuk-frontend/components/footer/README.md +4 -91
  36. data/node_modules/govuk-frontend/components/footer/_footer.scss +22 -13
  37. data/node_modules/govuk-frontend/components/header/README.md +4 -351
  38. data/node_modules/govuk-frontend/components/hint/README.md +5 -77
  39. data/node_modules/govuk-frontend/components/input/README.md +4 -407
  40. data/node_modules/govuk-frontend/components/input/template.njk +1 -0
  41. data/node_modules/govuk-frontend/components/inset-text/README.md +4 -76
  42. data/node_modules/govuk-frontend/components/label/README.md +5 -97
  43. data/node_modules/govuk-frontend/components/panel/README.md +4 -93
  44. data/node_modules/govuk-frontend/components/phase-banner/README.md +4 -67
  45. data/node_modules/govuk-frontend/components/radios/README.md +4 -665
  46. data/node_modules/govuk-frontend/components/radios/template.njk +1 -0
  47. data/node_modules/govuk-frontend/components/select/README.md +4 -257
  48. data/node_modules/govuk-frontend/components/select/template.njk +1 -0
  49. data/node_modules/govuk-frontend/components/skip-link/README.md +4 -57
  50. data/node_modules/govuk-frontend/components/table/README.md +4 -368
  51. data/node_modules/govuk-frontend/components/tabs/README.md +4 -242
  52. data/node_modules/govuk-frontend/components/tag/README.md +4 -77
  53. data/node_modules/govuk-frontend/components/textarea/README.md +4 -193
  54. data/node_modules/govuk-frontend/components/textarea/template.njk +1 -0
  55. data/node_modules/govuk-frontend/components/warning-text/README.md +4 -63
  56. data/node_modules/govuk-frontend/components/warning-text/_warning-text.scss +1 -2
  57. data/node_modules/govuk-frontend/core/_lists.scss +17 -8
  58. data/node_modules/govuk-frontend/package.json +10 -10
  59. metadata +4 -5
  60. data/app/views/govuk_publishing_components/components/_taxonomy_navigation.html.erb +0 -116
  61. data/app/views/govuk_publishing_components/components/docs/taxonomy_navigation.yml +0 -119
  62. data/lib/govuk_publishing_components/presenters/taxonomy_navigation.rb +0 -47
@@ -40,6 +40,7 @@
40
40
  {{ govukErrorMessage({
41
41
  id: errorId,
42
42
  classes: params.errorMessage.classes,
43
+ attributes: params.errorMessage.attributes,
43
44
  html: params.errorMessage.html,
44
45
  text: params.errorMessage.text
45
46
  }) | indent(2) | trim }}
@@ -1,574 +1,15 @@
1
1
  # Date input
2
2
 
3
- ## Introduction
3
+ ## Installation
4
4
 
5
- A component for entering dates, for example - date of birth.
5
+ See the [main README quick start guide](https://github.com/alphagov/govuk-frontend#quick-start) for how to install this component.
6
6
 
7
- ## Guidance
7
+ ## Guidance and Examples
8
8
 
9
9
  Find out when to use the date input component in your service in the [GOV.UK Design System](https://design-system.service.gov.uk/components/date-input).
10
10
 
11
- ## Quick start examples
12
-
13
- ### Date input
14
-
15
- [Preview this example in the Frontend review app](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">
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 govuk-input--width-2" id="dob-day" name="dob-day" type="number" pattern="[0-9]*">
39
- </div>
40
- </div>
41
-
42
- <div class="govuk-date-input__item">
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 govuk-input--width-2" id="dob-month" name="dob-month" type="number" pattern="[0-9]*">
49
- </div>
50
- </div>
51
-
52
- <div class="govuk-date-input__item">
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 govuk-input--width-4" 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
- "namePrefix": "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
- "classes": "govuk-input--width-2"
86
- },
87
- {
88
- "name": "month",
89
- "classes": "govuk-input--width-2"
90
- },
91
- {
92
- "name": "year",
93
- "classes": "govuk-input--width-4"
94
- }
95
- ]
96
- }) }}
97
-
98
- ### Date input with errors
99
-
100
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/date-input/with-errors/preview)
101
-
102
- #### Markup
103
-
104
- <div class="govuk-form-group govuk-form-group--error">
105
- <fieldset class="govuk-fieldset" aria-describedby="dob-errors-hint dob-errors-error" role="group">
106
-
107
- <legend class="govuk-fieldset__legend">
108
- What is your date of birth?
109
- </legend>
110
-
111
- <span id="dob-errors-hint" class="govuk-hint">
112
- For example, 31 3 1980
113
- </span>
114
-
115
- <span id="dob-errors-error" class="govuk-error-message">
116
- Error message goes here
117
- </span>
118
-
119
- <div class="govuk-date-input" id="dob-errors">
120
-
121
- <div class="govuk-date-input__item">
122
- <div class="govuk-form-group">
123
- <label class="govuk-label govuk-date-input__label" for="dob-errors-day">
124
- Day
125
- </label>
126
-
127
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="dob-errors-day" name="day" type="number" pattern="[0-9]*">
128
- </div>
129
- </div>
130
-
131
- <div class="govuk-date-input__item">
132
- <div class="govuk-form-group">
133
- <label class="govuk-label govuk-date-input__label" for="dob-errors-month">
134
- Month
135
- </label>
136
-
137
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="dob-errors-month" name="month" type="number" pattern="[0-9]*">
138
- </div>
139
- </div>
140
-
141
- <div class="govuk-date-input__item">
142
- <div class="govuk-form-group">
143
- <label class="govuk-label govuk-date-input__label" for="dob-errors-year">
144
- Year
145
- </label>
146
-
147
- <input class="govuk-input govuk-date-input__input govuk-input--width-4 govuk-input--error" id="dob-errors-year" name="year" type="number" pattern="[0-9]*">
148
- </div>
149
- </div>
150
-
151
- </div>
152
- </fieldset>
153
-
154
- </div>
155
-
156
- #### Macro
157
-
158
- {% from "date-input/macro.njk" import govukDateInput %}
159
-
160
- {{ govukDateInput({
161
- "id": "dob-errors",
162
- "fieldset": {
163
- "legend": {
164
- "text": "What is your date of birth?"
165
- }
166
- },
167
- "hint": {
168
- "text": "For example, 31 3 1980"
169
- },
170
- "errorMessage": {
171
- "text": "Error message goes here"
172
- },
173
- "items": [
174
- {
175
- "name": "day",
176
- "classes": "govuk-input--width-2 govuk-input--error"
177
- },
178
- {
179
- "name": "month",
180
- "classes": "govuk-input--width-2 govuk-input--error"
181
- },
182
- {
183
- "name": "year",
184
- "classes": "govuk-input--width-4 govuk-input--error"
185
- }
186
- ]
187
- }) }}
188
-
189
- ### Date input with error on day input
190
-
191
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/date-input/with-error-on-day-input/preview)
192
-
193
- #### Markup
194
-
195
- <div class="govuk-form-group govuk-form-group--error">
196
- <fieldset class="govuk-fieldset" aria-describedby="dob-day-error-hint dob-day-error-error" role="group">
197
-
198
- <legend class="govuk-fieldset__legend">
199
- What is your date of birth?
200
- </legend>
201
-
202
- <span id="dob-day-error-hint" class="govuk-hint">
203
- For example, 31 3 1980
204
- </span>
205
-
206
- <span id="dob-day-error-error" class="govuk-error-message">
207
- Error message goes here
208
- </span>
209
-
210
- <div class="govuk-date-input" id="dob-day-error">
211
-
212
- <div class="govuk-date-input__item">
213
- <div class="govuk-form-group">
214
- <label class="govuk-label govuk-date-input__label" for="dob-day-error-day">
215
- Day
216
- </label>
217
-
218
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="dob-day-error-day" name="dob-day-error-day" type="number" pattern="[0-9]*">
219
- </div>
220
- </div>
221
-
222
- <div class="govuk-date-input__item">
223
- <div class="govuk-form-group">
224
- <label class="govuk-label govuk-date-input__label" for="dob-day-error-month">
225
- Month
226
- </label>
227
-
228
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="dob-day-error-month" name="dob-day-error-month" type="number" pattern="[0-9]*">
229
- </div>
230
- </div>
231
-
232
- <div class="govuk-date-input__item">
233
- <div class="govuk-form-group">
234
- <label class="govuk-label govuk-date-input__label" for="dob-day-error-year">
235
- Year
236
- </label>
237
-
238
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="dob-day-error-year" name="dob-day-error-year" type="number" pattern="[0-9]*">
239
- </div>
240
- </div>
241
-
242
- </div>
243
- </fieldset>
244
-
245
- </div>
246
-
247
- #### Macro
248
-
249
- {% from "date-input/macro.njk" import govukDateInput %}
250
-
251
- {{ govukDateInput({
252
- "id": "dob-day-error",
253
- "namePrefix": "dob-day-error",
254
- "fieldset": {
255
- "legend": {
256
- "text": "What is your date of birth?"
257
- }
258
- },
259
- "hint": {
260
- "text": "For example, 31 3 1980"
261
- },
262
- "errorMessage": {
263
- "text": "Error message goes here"
264
- },
265
- "items": [
266
- {
267
- "name": "day",
268
- "classes": "govuk-input--width-2 govuk-input--error"
269
- },
270
- {
271
- "name": "month",
272
- "classes": "govuk-input--width-2"
273
- },
274
- {
275
- "name": "year",
276
- "classes": "govuk-input--width-4"
277
- }
278
- ]
279
- }) }}
280
-
281
- ### Date input with error on month input
282
-
283
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/date-input/with-error-on-month-input/preview)
284
-
285
- #### Markup
286
-
287
- <div class="govuk-form-group govuk-form-group--error">
288
- <fieldset class="govuk-fieldset" aria-describedby="dob-month-error-hint dob-month-error-error" role="group">
289
-
290
- <legend class="govuk-fieldset__legend">
291
- What is your date of birth?
292
- </legend>
293
-
294
- <span id="dob-month-error-hint" class="govuk-hint">
295
- For example, 31 3 1980
296
- </span>
297
-
298
- <span id="dob-month-error-error" class="govuk-error-message">
299
- Error message goes here
300
- </span>
301
-
302
- <div class="govuk-date-input" id="dob-month-error">
303
-
304
- <div class="govuk-date-input__item">
305
- <div class="govuk-form-group">
306
- <label class="govuk-label govuk-date-input__label" for="dob-month-error-day">
307
- Day
308
- </label>
309
-
310
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="dob-month-error-day" name="dob-month-error-day" type="number" pattern="[0-9]*">
311
- </div>
312
- </div>
313
-
314
- <div class="govuk-date-input__item">
315
- <div class="govuk-form-group">
316
- <label class="govuk-label govuk-date-input__label" for="dob-month-error-month">
317
- Month
318
- </label>
319
-
320
- <input class="govuk-input govuk-date-input__input govuk-input--width-2 govuk-input--error" id="dob-month-error-month" name="dob-month-error-month" type="number" pattern="[0-9]*">
321
- </div>
322
- </div>
323
-
324
- <div class="govuk-date-input__item">
325
- <div class="govuk-form-group">
326
- <label class="govuk-label govuk-date-input__label" for="dob-month-error-year">
327
- Year
328
- </label>
329
-
330
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="dob-month-error-year" name="dob-month-error-year" type="number" pattern="[0-9]*">
331
- </div>
332
- </div>
333
-
334
- </div>
335
- </fieldset>
336
-
337
- </div>
338
-
339
- #### Macro
340
-
341
- {% from "date-input/macro.njk" import govukDateInput %}
342
-
343
- {{ govukDateInput({
344
- "id": "dob-month-error",
345
- "namePrefix": "dob-month-error",
346
- "fieldset": {
347
- "legend": {
348
- "text": "What is your date of birth?"
349
- }
350
- },
351
- "hint": {
352
- "text": "For example, 31 3 1980"
353
- },
354
- "errorMessage": {
355
- "text": "Error message goes here"
356
- },
357
- "items": [
358
- {
359
- "name": "day",
360
- "classes": "govuk-input--width-2"
361
- },
362
- {
363
- "name": "month",
364
- "classes": "govuk-input--width-2 govuk-input--error"
365
- },
366
- {
367
- "name": "year",
368
- "classes": "govuk-input--width-4"
369
- }
370
- ]
371
- }) }}
372
-
373
- ### Date input with error on year input
374
-
375
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/date-input/with-error-on-year-input/preview)
376
-
377
- #### Markup
378
-
379
- <div class="govuk-form-group govuk-form-group--error">
380
- <fieldset class="govuk-fieldset" aria-describedby="dob-year-error-hint dob-year-error-error" role="group">
381
-
382
- <legend class="govuk-fieldset__legend">
383
- What is your date of birth?
384
- </legend>
385
-
386
- <span id="dob-year-error-hint" class="govuk-hint">
387
- For example, 31 3 1980
388
- </span>
389
-
390
- <span id="dob-year-error-error" class="govuk-error-message">
391
- Error message goes here
392
- </span>
393
-
394
- <div class="govuk-date-input" id="dob-year-error">
395
-
396
- <div class="govuk-date-input__item">
397
- <div class="govuk-form-group">
398
- <label class="govuk-label govuk-date-input__label" for="dob-year-error-day">
399
- Day
400
- </label>
401
-
402
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="dob-year-error-day" name="dob-year-error-day" type="number" pattern="[0-9]*">
403
- </div>
404
- </div>
405
-
406
- <div class="govuk-date-input__item">
407
- <div class="govuk-form-group">
408
- <label class="govuk-label govuk-date-input__label" for="dob-year-error-month">
409
- Month
410
- </label>
411
-
412
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="dob-year-error-month" name="dob-year-error-month" type="number" pattern="[0-9]*">
413
- </div>
414
- </div>
415
-
416
- <div class="govuk-date-input__item">
417
- <div class="govuk-form-group">
418
- <label class="govuk-label govuk-date-input__label" for="dob-year-error-year">
419
- Year
420
- </label>
421
-
422
- <input class="govuk-input govuk-date-input__input govuk-input--width-4 govuk-input--error" id="dob-year-error-year" name="dob-year-error-year" type="number" pattern="[0-9]*">
423
- </div>
424
- </div>
425
-
426
- </div>
427
- </fieldset>
428
-
429
- </div>
430
-
431
- #### Macro
432
-
433
- {% from "date-input/macro.njk" import govukDateInput %}
434
-
435
- {{ govukDateInput({
436
- "id": "dob-year-error",
437
- "namePrefix": "dob-year-error",
438
- "fieldset": {
439
- "legend": {
440
- "text": "What is your date of birth?"
441
- }
442
- },
443
- "hint": {
444
- "text": "For example, 31 3 1980"
445
- },
446
- "errorMessage": {
447
- "text": "Error message goes here"
448
- },
449
- "items": [
450
- {
451
- "name": "day",
452
- "classes": "govuk-input--width-2"
453
- },
454
- {
455
- "name": "month",
456
- "classes": "govuk-input--width-2"
457
- },
458
- {
459
- "name": "year",
460
- "classes": "govuk-input--width-4 govuk-input--error"
461
- }
462
- ]
463
- }) }}
464
-
465
- ### Date input with default items
466
-
467
- [Preview this example in the Frontend review app](http://govuk-frontend-review.herokuapp.com/components/date-input/with-default-items/preview)
468
-
469
- #### Markup
470
-
471
- <div class="govuk-form-group">
472
- <fieldset class="govuk-fieldset" aria-describedby="dob-hint" role="group">
473
-
474
- <legend class="govuk-fieldset__legend">
475
- What is your date of birth?
476
- </legend>
477
-
478
- <span id="dob-hint" class="govuk-hint">
479
- For example, 31 3 1980
480
- </span>
481
-
482
- <div class="govuk-date-input" id="dob">
483
-
484
- <div class="govuk-date-input__item">
485
- <div class="govuk-form-group">
486
- <label class="govuk-label govuk-date-input__label" for="dob-day">
487
- Day
488
- </label>
489
-
490
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="dob-day" name="dob-day" type="number" pattern="[0-9]*">
491
- </div>
492
- </div>
493
-
494
- <div class="govuk-date-input__item">
495
- <div class="govuk-form-group">
496
- <label class="govuk-label govuk-date-input__label" for="dob-month">
497
- Month
498
- </label>
499
-
500
- <input class="govuk-input govuk-date-input__input govuk-input--width-2" id="dob-month" name="dob-month" type="number" pattern="[0-9]*">
501
- </div>
502
- </div>
503
-
504
- <div class="govuk-date-input__item">
505
- <div class="govuk-form-group">
506
- <label class="govuk-label govuk-date-input__label" for="dob-year">
507
- Year
508
- </label>
509
-
510
- <input class="govuk-input govuk-date-input__input govuk-input--width-4" id="dob-year" name="dob-year" type="number" pattern="[0-9]*">
511
- </div>
512
- </div>
513
-
514
- </div>
515
- </fieldset>
516
-
517
- </div>
518
-
519
- #### Macro
520
-
521
- {% from "date-input/macro.njk" import govukDateInput %}
522
-
523
- {{ govukDateInput({
524
- "id": "dob",
525
- "namePrefix": "dob",
526
- "fieldset": {
527
- "legend": {
528
- "text": "What is your date of birth?"
529
- }
530
- },
531
- "hint": {
532
- "text": "For example, 31 3 1980"
533
- }
534
- }) }}
535
-
536
- ## Requirements
537
-
538
- ### Build tool configuration
539
-
540
- When compiling the Sass files you'll need to define includePaths to reference the node_modules directory. Below is a sample configuration using gulp
541
-
542
- .pipe(sass({
543
- includePaths: 'node_modules/'
544
- }))
545
-
546
- ### Static asset path configuration
547
-
548
- 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:
549
-
550
- app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
551
-
552
11
  ## Component options
553
12
 
554
13
  Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
555
14
 
556
- See [options table](https://design-system.service.gov.uk/components/date-input/#options-example-default) for details.
557
-
558
- ### Setting up Nunjucks views and paths
559
-
560
- Below is an example setup using express configure views:
561
-
562
- nunjucks.configure('node_modules/govuk-frontend/components', {
563
- autoescape: true,
564
- cache: false,
565
- express: app
566
- })
567
-
568
- ## Contribution
569
-
570
- 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")
571
-
572
- ## License
573
-
574
- MIT
15
+ See [options table](https://design-system.service.gov.uk/components/date-input/#options-example-default) for details.