govuk_publishing_components 12.8.0 → 12.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/app/views/govuk_publishing_components/components/_checkboxes.html.erb +1 -0
  3. data/app/views/govuk_publishing_components/components/docs/checkboxes.yml +13 -0
  4. data/lib/govuk_publishing_components/version.rb +1 -1
  5. data/node_modules/govuk-frontend/all.js +161 -1
  6. data/node_modules/govuk-frontend/components/back-link/README.md +3 -77
  7. data/node_modules/govuk-frontend/components/breadcrumbs/README.md +3 -101
  8. data/node_modules/govuk-frontend/components/button/README.md +3 -137
  9. data/node_modules/govuk-frontend/components/character-count/README.md +3 -149
  10. data/node_modules/govuk-frontend/components/character-count/character-count.js +1 -1
  11. data/node_modules/govuk-frontend/components/checkboxes/README.md +3 -257
  12. data/node_modules/govuk-frontend/components/checkboxes/checkboxes.js +1 -1
  13. data/node_modules/govuk-frontend/components/checkboxes/template.njk +5 -0
  14. data/node_modules/govuk-frontend/components/date-input/README.md +3 -173
  15. data/node_modules/govuk-frontend/components/date-input/macro-options.json +14 -0
  16. data/node_modules/govuk-frontend/components/date-input/template.njk +1 -1
  17. data/node_modules/govuk-frontend/components/details/README.md +3 -101
  18. data/node_modules/govuk-frontend/components/error-message/README.md +3 -77
  19. data/node_modules/govuk-frontend/components/error-summary/README.md +3 -125
  20. data/node_modules/govuk-frontend/components/error-summary/error-summary.js +405 -87
  21. data/node_modules/govuk-frontend/components/fieldset/README.md +3 -113
  22. data/node_modules/govuk-frontend/components/file-upload/README.md +3 -125
  23. data/node_modules/govuk-frontend/components/file-upload/macro-options.json +14 -0
  24. data/node_modules/govuk-frontend/components/file-upload/template.njk +1 -1
  25. data/node_modules/govuk-frontend/components/footer/README.md +3 -233
  26. data/node_modules/govuk-frontend/components/header/README.md +3 -197
  27. data/node_modules/govuk-frontend/components/hint/README.md +3 -77
  28. data/node_modules/govuk-frontend/components/input/README.md +3 -137
  29. data/node_modules/govuk-frontend/components/input/macro-options.json +14 -0
  30. data/node_modules/govuk-frontend/components/input/template.njk +1 -1
  31. data/node_modules/govuk-frontend/components/inset-text/README.md +7 -77
  32. data/node_modules/govuk-frontend/components/label/README.md +3 -89
  33. data/node_modules/govuk-frontend/components/panel/README.md +3 -89
  34. data/node_modules/govuk-frontend/components/phase-banner/README.md +3 -77
  35. data/node_modules/govuk-frontend/components/radios/README.md +3 -269
  36. data/node_modules/govuk-frontend/components/radios/radios.js +1 -1
  37. data/node_modules/govuk-frontend/components/select/README.md +3 -185
  38. data/node_modules/govuk-frontend/components/select/macro-options.json +14 -0
  39. data/node_modules/govuk-frontend/components/select/template.njk +1 -1
  40. data/node_modules/govuk-frontend/components/skip-link/README.md +3 -77
  41. data/node_modules/govuk-frontend/components/table/README.md +3 -233
  42. data/node_modules/govuk-frontend/components/tabs/README.md +3 -149
  43. data/node_modules/govuk-frontend/components/tabs/tabs.js +111 -111
  44. data/node_modules/govuk-frontend/components/tag/README.md +3 -65
  45. data/node_modules/govuk-frontend/components/textarea/README.md +3 -149
  46. data/node_modules/govuk-frontend/components/textarea/macro-options.json +14 -0
  47. data/node_modules/govuk-frontend/components/textarea/template.njk +1 -1
  48. data/node_modules/govuk-frontend/components/warning-text/README.md +3 -77
  49. data/node_modules/govuk-frontend/package.json +11 -11
  50. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/classList.js +141 -1
  51. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/closest.js +54 -0
  52. data/node_modules/govuk-frontend/vendor/polyfills/Element/prototype/matches.js +31 -0
  53. metadata +4 -2
@@ -326,157 +326,11 @@ In order to include the images used in the components, you need to configure you
326
326
 
327
327
  app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
328
328
 
329
- ## Component arguments
329
+ ## Component options
330
330
 
331
- If you are using Nunjucks,then macros take the following arguments
331
+ Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
332
332
 
333
- **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).**
334
-
335
- <table class="govuk-table">
336
-
337
- <thead class="govuk-table__head">
338
-
339
- <tr class="govuk-table__row">
340
-
341
- <th class="govuk-table__header" scope="col">Name</th>
342
-
343
- <th class="govuk-table__header" scope="col">Type</th>
344
-
345
- <th class="govuk-table__header" scope="col">Required</th>
346
-
347
- <th class="govuk-table__header" scope="col">Description</th>
348
-
349
- </tr>
350
-
351
- </thead>
352
-
353
- <tbody class="govuk-table__body">
354
-
355
- <tr class="govuk-table__row">
356
-
357
- <th class="govuk-table__header" scope="row">id</th>
358
-
359
- <td class="govuk-table__cell">string</td>
360
-
361
- <td class="govuk-table__cell">Yes</td>
362
-
363
- <td class="govuk-table__cell">The id of the textarea</td>
364
-
365
- </tr>
366
-
367
- <tr class="govuk-table__row">
368
-
369
- <th class="govuk-table__header" scope="row">describedBy</th>
370
-
371
- <td class="govuk-table__cell">string</td>
372
-
373
- <td class="govuk-table__cell">No</td>
374
-
375
- <td class="govuk-table__cell">Text or element id to add to the `aria-describedby` attribute to provide description for screenreader users.</td>
376
-
377
- </tr>
378
-
379
- <tr class="govuk-table__row">
380
-
381
- <th class="govuk-table__header" scope="row">name</th>
382
-
383
- <td class="govuk-table__cell">string</td>
384
-
385
- <td class="govuk-table__cell">Yes</td>
386
-
387
- <td class="govuk-table__cell">The name of the textarea, which is submitted with the form data.</td>
388
-
389
- </tr>
390
-
391
- <tr class="govuk-table__row">
392
-
393
- <th class="govuk-table__header" scope="row">rows</th>
394
-
395
- <td class="govuk-table__cell">string</td>
396
-
397
- <td class="govuk-table__cell">No</td>
398
-
399
- <td class="govuk-table__cell">Optional number of textarea rows (default is 5 rows).</td>
400
-
401
- </tr>
402
-
403
- <tr class="govuk-table__row">
404
-
405
- <th class="govuk-table__header" scope="row">value</th>
406
-
407
- <td class="govuk-table__cell">string</td>
408
-
409
- <td class="govuk-table__cell">No</td>
410
-
411
- <td class="govuk-table__cell">Optional initial value of the textarea.</td>
412
-
413
- </tr>
414
-
415
- <tr class="govuk-table__row">
416
-
417
- <th class="govuk-table__header" scope="row">label</th>
418
-
419
- <td class="govuk-table__cell">object</td>
420
-
421
- <td class="govuk-table__cell">Yes</td>
422
-
423
- <td class="govuk-table__cell">Arguments for the label component. See label component.</td>
424
-
425
- </tr>
426
-
427
- <tr class="govuk-table__row">
428
-
429
- <th class="govuk-table__header" scope="row">hint</th>
430
-
431
- <td class="govuk-table__cell">object</td>
432
-
433
- <td class="govuk-table__cell">No</td>
434
-
435
- <td class="govuk-table__cell">Arguments for the hint component (e.g. text). See hint component.</td>
436
-
437
- </tr>
438
-
439
- <tr class="govuk-table__row">
440
-
441
- <th class="govuk-table__header" scope="row">errorMessage</th>
442
-
443
- <td class="govuk-table__cell">object</td>
444
-
445
- <td class="govuk-table__cell">No</td>
446
-
447
- <td class="govuk-table__cell">Arguments for the errorMessage component (e.g. text). See errorMessage component.</td>
448
-
449
- </tr>
450
-
451
- <tr class="govuk-table__row">
452
-
453
- <th class="govuk-table__header" scope="row">classes</th>
454
-
455
- <td class="govuk-table__cell">string</td>
456
-
457
- <td class="govuk-table__cell">No</td>
458
-
459
- <td class="govuk-table__cell">Optional additional classes to add to the textarea tag.</td>
460
-
461
- </tr>
462
-
463
- <tr class="govuk-table__row">
464
-
465
- <th class="govuk-table__header" scope="row">attributes</th>
466
-
467
- <td class="govuk-table__cell">object</td>
468
-
469
- <td class="govuk-table__cell">No</td>
470
-
471
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the textarea tag.</td>
472
-
473
- </tr>
474
-
475
- </tbody>
476
-
477
- </table>
478
-
479
- **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).**
333
+ See [options table](https://design-system.service.gov.uk/components/character-count/#options-example-default) for details.
480
334
 
481
335
  ### Setting up Nunjucks views and paths
482
336
 
@@ -937,7 +937,7 @@ if (detect) return
937
937
 
938
938
  if (detect) return
939
939
 
940
- // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/polyfill.js
940
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.classList&flags=always
941
941
  (function (global) {
942
942
  var dpSupport = true;
943
943
  var defineGetter = function (object, name, fn, configurable) {
@@ -691,265 +691,11 @@ In order to include the images used in the components, you need to configure you
691
691
 
692
692
  app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
693
693
 
694
- ## Component arguments
694
+ ## Component options
695
695
 
696
- If you are using Nunjucks,then macros take the following arguments
696
+ Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
697
697
 
698
- **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).**
699
-
700
- <table class="govuk-table">
701
-
702
- <thead class="govuk-table__head">
703
-
704
- <tr class="govuk-table__row">
705
-
706
- <th class="govuk-table__header" scope="col">Name</th>
707
-
708
- <th class="govuk-table__header" scope="col">Type</th>
709
-
710
- <th class="govuk-table__header" scope="col">Required</th>
711
-
712
- <th class="govuk-table__header" scope="col">Description</th>
713
-
714
- </tr>
715
-
716
- </thead>
717
-
718
- <tbody class="govuk-table__body">
719
-
720
- <tr class="govuk-table__row">
721
-
722
- <th class="govuk-table__header" scope="row">fieldset</th>
723
-
724
- <td class="govuk-table__cell">object</td>
725
-
726
- <td class="govuk-table__cell">No</td>
727
-
728
- <td class="govuk-table__cell">Arguments for the fieldset component (e.g. legend). See <a href="../fieldset/README.md#component-arguments">fieldset</a> component.</td>
729
-
730
- </tr>
731
-
732
- <tr class="govuk-table__row">
733
-
734
- <th class="govuk-table__header" scope="row">hint</th>
735
-
736
- <td class="govuk-table__cell">object</td>
737
-
738
- <td class="govuk-table__cell">No</td>
739
-
740
- <td class="govuk-table__cell">Arguments for the hint component (e.g. text). See <a href="../hint/README.md#component-arguments">hint</a> component.</td>
741
-
742
- </tr>
743
-
744
- <tr class="govuk-table__row">
745
-
746
- <th class="govuk-table__header" scope="row">errorMessage</th>
747
-
748
- <td class="govuk-table__cell">object</td>
749
-
750
- <td class="govuk-table__cell">No</td>
751
-
752
- <td class="govuk-table__cell">Arguments for the errorMessage component (e.g. text). See <a href="../error-message/README.md#component-arguments">errorMessage</a> component.</td>
753
-
754
- </tr>
755
-
756
- <tr class="govuk-table__row">
757
-
758
- <th class="govuk-table__header" scope="row">idPrefix</th>
759
-
760
- <td class="govuk-table__cell">string</td>
761
-
762
- <td class="govuk-table__cell">No</td>
763
-
764
- <td class="govuk-table__cell">String to prefix id for each checkbox item if no id is specified on each item. If`idPrefix` is not passed, fallback to using the name attribute instead.</td>
765
-
766
- </tr>
767
-
768
- <tr class="govuk-table__row">
769
-
770
- <th class="govuk-table__header" scope="row">name</th>
771
-
772
- <td class="govuk-table__cell">string</td>
773
-
774
- <td class="govuk-table__cell">Yes</td>
775
-
776
- <td class="govuk-table__cell">Name attribute for each checkbox item.</td>
777
-
778
- </tr>
779
-
780
- <tr class="govuk-table__row">
781
-
782
- <th class="govuk-table__header" scope="row">items</th>
783
-
784
- <td class="govuk-table__cell">array</td>
785
-
786
- <td class="govuk-table__cell">Yes</td>
787
-
788
- <td class="govuk-table__cell">Array of checkbox items objects.</td>
789
-
790
- </tr>
791
-
792
- <tr class="govuk-table__row">
793
-
794
- <th class="govuk-table__header" scope="row">items.{}.text (or) items.{}.html</th>
795
-
796
- <td class="govuk-table__cell">string</td>
797
-
798
- <td class="govuk-table__cell">Yes</td>
799
-
800
- <td class="govuk-table__cell">Text or HTML to use within each checkbox item label. If `html` is provided, the `text` argument will be ignored.</td>
801
-
802
- </tr>
803
-
804
- <tr class="govuk-table__row">
805
-
806
- <th class="govuk-table__header" scope="row">items.{}.id</th>
807
-
808
- <td class="govuk-table__cell">string</td>
809
-
810
- <td class="govuk-table__cell">No</td>
811
-
812
- <td class="govuk-table__cell">Specific id attribute for the checkbox item. If ommited, then `idPrefix` string will be applied.</td>
813
-
814
- </tr>
815
-
816
- <tr class="govuk-table__row">
817
-
818
- <th class="govuk-table__header" scope="row">items.{}.name</th>
819
-
820
- <td class="govuk-table__cell">string</td>
821
-
822
- <td class="govuk-table__cell">Yes</td>
823
-
824
- <td class="govuk-table__cell">Specific name for the checkbox item. If ommited, then component global `name` string will be applied.</td>
825
-
826
- </tr>
827
-
828
- <tr class="govuk-table__row">
829
-
830
- <th class="govuk-table__header" scope="row">items.{}.value</th>
831
-
832
- <td class="govuk-table__cell">string</td>
833
-
834
- <td class="govuk-table__cell">Yes</td>
835
-
836
- <td class="govuk-table__cell">Value for the checkbox input.</td>
837
-
838
- </tr>
839
-
840
- <tr class="govuk-table__row">
841
-
842
- <th class="govuk-table__header" scope="row">items.{}.label</th>
843
-
844
- <td class="govuk-table__cell">object</td>
845
-
846
- <td class="govuk-table__cell">No</td>
847
-
848
- <td class="govuk-table__cell">Provide additional attributes and classes to each checkbox item label. See [label](../label/README.md#component-arguments) component for more details.</td>
849
-
850
- </tr>
851
-
852
- <tr class="govuk-table__row">
853
-
854
- <th class="govuk-table__header" scope="row">items.{}.hint</th>
855
-
856
- <td class="govuk-table__cell">object</td>
857
-
858
- <td class="govuk-table__cell">No</td>
859
-
860
- <td class="govuk-table__cell">Provide optional hint to each checkbox item. See `hint` component for more details.</td>
861
-
862
- </tr>
863
-
864
- <tr class="govuk-table__row">
865
-
866
- <th class="govuk-table__header" scope="row">items.{}.checked</th>
867
-
868
- <td class="govuk-table__cell">boolean</td>
869
-
870
- <td class="govuk-table__cell">No</td>
871
-
872
- <td class="govuk-table__cell">If true, checkbox will be checked.</td>
873
-
874
- </tr>
875
-
876
- <tr class="govuk-table__row">
877
-
878
- <th class="govuk-table__header" scope="row">items.{}.conditional</th>
879
-
880
- <td class="govuk-table__cell">boolean</td>
881
-
882
- <td class="govuk-table__cell">No</td>
883
-
884
- <td class="govuk-table__cell">If true, content provided will be revealed when the item is checked.</td>
885
-
886
- </tr>
887
-
888
- <tr class="govuk-table__row">
889
-
890
- <th class="govuk-table__header" scope="row">items.{}.conditional.html</th>
891
-
892
- <td class="govuk-table__cell">boolean</td>
893
-
894
- <td class="govuk-table__cell">No</td>
895
-
896
- <td class="govuk-table__cell">Provide content for the conditional reveal.</td>
897
-
898
- </tr>
899
-
900
- <tr class="govuk-table__row">
901
-
902
- <th class="govuk-table__header" scope="row">items.{}.disabled</th>
903
-
904
- <td class="govuk-table__cell">boolean</td>
905
-
906
- <td class="govuk-table__cell">No</td>
907
-
908
- <td class="govuk-table__cell">If true, checkbox will be disabled.</td>
909
-
910
- </tr>
911
-
912
- <tr class="govuk-table__row">
913
-
914
- <th class="govuk-table__header" scope="row">items.{}.attributes</th>
915
-
916
- <td class="govuk-table__cell">object</td>
917
-
918
- <td class="govuk-table__cell">No</td>
919
-
920
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the checkbox input tag.</td>
921
-
922
- </tr>
923
-
924
- <tr class="govuk-table__row">
925
-
926
- <th class="govuk-table__header" scope="row">classes</th>
927
-
928
- <td class="govuk-table__cell">string</td>
929
-
930
- <td class="govuk-table__cell">No</td>
931
-
932
- <td class="govuk-table__cell">Optional additional classes to add to the checkboxes container.</td>
933
-
934
- </tr>
935
-
936
- <tr class="govuk-table__row">
937
-
938
- <th class="govuk-table__header" scope="row">attributes</th>
939
-
940
- <td class="govuk-table__cell">object</td>
941
-
942
- <td class="govuk-table__cell">No</td>
943
-
944
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the checkboxes container.</td>
945
-
946
- </tr>
947
-
948
- </tbody>
949
-
950
- </table>
951
-
952
- **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).**
698
+ See [options table](https://design-system.service.gov.uk/components/checkboxes/#options-example-default) for details.
953
699
 
954
700
  ### Setting up Nunjucks views and paths
955
701
 
@@ -937,7 +937,7 @@ if (detect) return
937
937
 
938
938
  if (detect) return
939
939
 
940
- // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/polyfill.js
940
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.classList&flags=always
941
941
  (function (global) {
942
942
  var dpSupport = true;
943
943
  var defineGetter = function (object, name, fn, configurable) {
@@ -18,6 +18,9 @@
18
18
  {% endif %}
19
19
  {% endfor %}
20
20
 
21
+ {#- fieldset is false by default -#}
22
+ {% set hasFieldset = true if params.fieldset else false %}
23
+
21
24
  {#- Capture the HTML so we can optionally nest it in a fieldset -#}
22
25
  {% set innerHtml %}
23
26
  {% if params.hint %}
@@ -54,6 +57,8 @@
54
57
  <input class="govuk-checkboxes__input" id="{{ id }}" name="{{ name }}" type="checkbox" value="{{ item.value }}"
55
58
  {{-" checked" if item.checked }}
56
59
  {{-" disabled" if item.disabled }}
60
+ {#- fieldset is false by default -#}
61
+ {%- if (not hasFieldset) and ((describedBy | length) > 0) %} aria-describedby="{{ describedBy }}"{% endif -%}
57
62
  {%- if item.conditional %} data-aria-controls="{{ conditionalId }}"{% endif -%}
58
63
  {%- if hasHint %} aria-describedby="{{ itemHintId }}"{% endif -%}
59
64
  {%- for attribute, value in item.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}>