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
@@ -228,157 +228,11 @@ In order to include the images used in the components, you need to configure you
228
228
 
229
229
  app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
230
230
 
231
- ## Component arguments
231
+ ## Component options
232
232
 
233
- If you are using Nunjucks,then macros take the following arguments
233
+ Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
234
234
 
235
- **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).**
236
-
237
- <table class="govuk-table">
238
-
239
- <thead class="govuk-table__head">
240
-
241
- <tr class="govuk-table__row">
242
-
243
- <th class="govuk-table__header" scope="col">Name</th>
244
-
245
- <th class="govuk-table__header" scope="col">Type</th>
246
-
247
- <th class="govuk-table__header" scope="col">Required</th>
248
-
249
- <th class="govuk-table__header" scope="col">Description</th>
250
-
251
- </tr>
252
-
253
- </thead>
254
-
255
- <tbody class="govuk-table__body">
256
-
257
- <tr class="govuk-table__row">
258
-
259
- <th class="govuk-table__header" scope="row">id</th>
260
-
261
- <td class="govuk-table__cell">string</td>
262
-
263
- <td class="govuk-table__cell">No</td>
264
-
265
- <td class="govuk-table__cell">Optional id</td>
266
-
267
- </tr>
268
-
269
- <tr class="govuk-table__row">
270
-
271
- <th class="govuk-table__header" scope="row">classes</th>
272
-
273
- <td class="govuk-table__cell">string</td>
274
-
275
- <td class="govuk-table__cell">No</td>
276
-
277
- <td class="govuk-table__cell">Optional additional classes</td>
278
-
279
- </tr>
280
-
281
- <tr class="govuk-table__row">
282
-
283
- <th class="govuk-table__header" scope="row">attributes</th>
284
-
285
- <td class="govuk-table__cell">object</td>
286
-
287
- <td class="govuk-table__cell">No</td>
288
-
289
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the tabs container</td>
290
-
291
- </tr>
292
-
293
- <tr class="govuk-table__row">
294
-
295
- <th class="govuk-table__header" scope="row">idPrefix</th>
296
-
297
- <td class="govuk-table__cell">string</td>
298
-
299
- <td class="govuk-table__cell">No</td>
300
-
301
- <td class="govuk-table__cell">String to prefix id for each tab item if no id is specified on each item</td>
302
-
303
- </tr>
304
-
305
- <tr class="govuk-table__row">
306
-
307
- <th class="govuk-table__header" scope="row">items</th>
308
-
309
- <td class="govuk-table__cell">array</td>
310
-
311
- <td class="govuk-table__cell">Yes</td>
312
-
313
- <td class="govuk-table__cell">Array of tab items</td>
314
-
315
- </tr>
316
-
317
- <tr class="govuk-table__row">
318
-
319
- <th class="govuk-table__header" scope="row">items.{}.id</th>
320
-
321
- <td class="govuk-table__cell">string</td>
322
-
323
- <td class="govuk-table__cell">Yes</td>
324
-
325
- <td class="govuk-table__cell">Specific id attribute for the tab item. If ommited, then `idPrefix` string will be applied.</td>
326
-
327
- </tr>
328
-
329
- <tr class="govuk-table__row">
330
-
331
- <th class="govuk-table__header" scope="row">items.{}.label</th>
332
-
333
- <td class="govuk-table__cell">string</td>
334
-
335
- <td class="govuk-table__cell">Yes</td>
336
-
337
- <td class="govuk-table__cell">The text label of a tab item</td>
338
-
339
- </tr>
340
-
341
- <tr class="govuk-table__row">
342
-
343
- <th class="govuk-table__header" scope="row">items.{}.attributes</th>
344
-
345
- <td class="govuk-table__cell">object</td>
346
-
347
- <td class="govuk-table__cell">No</td>
348
-
349
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the tab item anchor.</td>
350
-
351
- </tr>
352
-
353
- <tr class="govuk-table__row">
354
-
355
- <th class="govuk-table__header" scope="row">items.{}.panel.text (or) items.{}.panel.html</th>
356
-
357
- <td class="govuk-table__cell">string</td>
358
-
359
- <td class="govuk-table__cell">No</td>
360
-
361
- <td class="govuk-table__cell">Text or HTML to use within each tab panel. If `html` is provided, the `text` argument will be ignored.</td>
362
-
363
- </tr>
364
-
365
- <tr class="govuk-table__row">
366
-
367
- <th class="govuk-table__header" scope="row">items.{}.panel.attributes</th>
368
-
369
- <td class="govuk-table__cell">object</td>
370
-
371
- <td class="govuk-table__cell">No</td>
372
-
373
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the tab panel.</td>
374
-
375
- </tr>
376
-
377
- </tbody>
378
-
379
- </table>
380
-
381
- **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).**
235
+ See [options table](https://design-system.service.gov.uk/components/tabs/#options-example-default) for details.
382
236
 
383
237
  ### Setting up Nunjucks views and paths
384
238
 
@@ -514,117 +514,6 @@ if (detect) return
514
514
 
515
515
  }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
516
516
 
517
- (function(undefined) {
518
-
519
- // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
520
- var detect = (
521
- 'document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () {
522
- var e = document.createElement('span');
523
- e.classList.add('a', 'b');
524
- return e.classList.contains('b');
525
- }())
526
- );
527
-
528
- if (detect) return
529
-
530
- // Polyfill from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/polyfill.js
531
- (function (global) {
532
- var dpSupport = true;
533
- var defineGetter = function (object, name, fn, configurable) {
534
- if (Object.defineProperty)
535
- Object.defineProperty(object, name, {
536
- configurable: false === dpSupport ? true : !!configurable,
537
- get: fn
538
- });
539
-
540
- else object.__defineGetter__(name, fn);
541
- };
542
- /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
543
- try {
544
- defineGetter({}, "support");
545
- }
546
- catch (e) {
547
- dpSupport = false;
548
- }
549
- /** Polyfills a property with a DOMTokenList */
550
- var addProp = function (o, name, attr) {
551
-
552
- defineGetter(o.prototype, name, function () {
553
- var tokenList;
554
-
555
- var THIS = this,
556
-
557
- /** Prevent this from firing twice for some reason. What the hell, IE. */
558
- gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name;
559
- if(THIS[gibberishProperty]) return tokenList;
560
- THIS[gibberishProperty] = true;
561
-
562
- /**
563
- * IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead.
564
- *
565
- * What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror")
566
- * that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML
567
- * element instead, this would conflict with element types which use indexed properties (such as forms and
568
- * select lists).
569
- */
570
- if (false === dpSupport) {
571
-
572
- var visage;
573
- var mirror = addProp.mirror || document.createElement("div");
574
- var reflections = mirror.childNodes;
575
- var l = reflections.length;
576
-
577
- for (var i = 0; i < l; ++i)
578
- if (reflections[i]._R === THIS) {
579
- visage = reflections[i];
580
- break;
581
- }
582
-
583
- /** Couldn't find an element's reflection inside the mirror. Materialise one. */
584
- visage || (visage = mirror.appendChild(document.createElement("div")));
585
-
586
- tokenList = DOMTokenList.call(visage, THIS, attr);
587
- } else tokenList = new DOMTokenList(THIS, attr);
588
-
589
- defineGetter(THIS, name, function () {
590
- return tokenList;
591
- });
592
- delete THIS[gibberishProperty];
593
-
594
- return tokenList;
595
- }, true);
596
- };
597
-
598
- addProp(global.Element, "classList", "className");
599
- addProp(global.HTMLElement, "classList", "className");
600
- addProp(global.HTMLLinkElement, "relList", "rel");
601
- addProp(global.HTMLAnchorElement, "relList", "rel");
602
- addProp(global.HTMLAreaElement, "relList", "rel");
603
- }(this));
604
-
605
- }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
606
-
607
- (function(undefined) {
608
-
609
- // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Window/detect.js
610
- var detect = ('Window' in this);
611
-
612
- if (detect) return
613
-
614
- // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Window&flags=always
615
- if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
616
- (function (global) {
617
- if (global.constructor) {
618
- global.Window = global.constructor;
619
- } else {
620
- (global.Window = global.constructor = new Function('return function Window() {}')()).prototype = this;
621
- }
622
- }(this));
623
- }
624
-
625
- })
626
- .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
627
-
628
517
  (function(undefined) {
629
518
 
630
519
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Document/detect.js
@@ -765,6 +654,117 @@ if (detect) return
765
654
  })
766
655
  .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
767
656
 
657
+ (function(undefined) {
658
+
659
+ // Detection from https://raw.githubusercontent.com/Financial-Times/polyfill-service/8717a9e04ac7aff99b4980fbedead98036b0929a/packages/polyfill-library/polyfills/Element/prototype/classList/detect.js
660
+ var detect = (
661
+ 'document' in this && "classList" in document.documentElement && 'Element' in this && 'classList' in Element.prototype && (function () {
662
+ var e = document.createElement('span');
663
+ e.classList.add('a', 'b');
664
+ return e.classList.contains('b');
665
+ }())
666
+ );
667
+
668
+ if (detect) return
669
+
670
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Element.prototype.classList&flags=always
671
+ (function (global) {
672
+ var dpSupport = true;
673
+ var defineGetter = function (object, name, fn, configurable) {
674
+ if (Object.defineProperty)
675
+ Object.defineProperty(object, name, {
676
+ configurable: false === dpSupport ? true : !!configurable,
677
+ get: fn
678
+ });
679
+
680
+ else object.__defineGetter__(name, fn);
681
+ };
682
+ /** Ensure the browser allows Object.defineProperty to be used on native JavaScript objects. */
683
+ try {
684
+ defineGetter({}, "support");
685
+ }
686
+ catch (e) {
687
+ dpSupport = false;
688
+ }
689
+ /** Polyfills a property with a DOMTokenList */
690
+ var addProp = function (o, name, attr) {
691
+
692
+ defineGetter(o.prototype, name, function () {
693
+ var tokenList;
694
+
695
+ var THIS = this,
696
+
697
+ /** Prevent this from firing twice for some reason. What the hell, IE. */
698
+ gibberishProperty = "__defineGetter__" + "DEFINE_PROPERTY" + name;
699
+ if(THIS[gibberishProperty]) return tokenList;
700
+ THIS[gibberishProperty] = true;
701
+
702
+ /**
703
+ * IE8 can't define properties on native JavaScript objects, so we'll use a dumb hack instead.
704
+ *
705
+ * What this is doing is creating a dummy element ("reflection") inside a detached phantom node ("mirror")
706
+ * that serves as the target of Object.defineProperty instead. While we could simply use the subject HTML
707
+ * element instead, this would conflict with element types which use indexed properties (such as forms and
708
+ * select lists).
709
+ */
710
+ if (false === dpSupport) {
711
+
712
+ var visage;
713
+ var mirror = addProp.mirror || document.createElement("div");
714
+ var reflections = mirror.childNodes;
715
+ var l = reflections.length;
716
+
717
+ for (var i = 0; i < l; ++i)
718
+ if (reflections[i]._R === THIS) {
719
+ visage = reflections[i];
720
+ break;
721
+ }
722
+
723
+ /** Couldn't find an element's reflection inside the mirror. Materialise one. */
724
+ visage || (visage = mirror.appendChild(document.createElement("div")));
725
+
726
+ tokenList = DOMTokenList.call(visage, THIS, attr);
727
+ } else tokenList = new DOMTokenList(THIS, attr);
728
+
729
+ defineGetter(THIS, name, function () {
730
+ return tokenList;
731
+ });
732
+ delete THIS[gibberishProperty];
733
+
734
+ return tokenList;
735
+ }, true);
736
+ };
737
+
738
+ addProp(global.Element, "classList", "className");
739
+ addProp(global.HTMLElement, "classList", "className");
740
+ addProp(global.HTMLLinkElement, "relList", "rel");
741
+ addProp(global.HTMLAnchorElement, "relList", "rel");
742
+ addProp(global.HTMLAreaElement, "relList", "rel");
743
+ }(this));
744
+
745
+ }).call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
746
+
747
+ (function(undefined) {
748
+
749
+ // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Window/detect.js
750
+ var detect = ('Window' in this);
751
+
752
+ if (detect) return
753
+
754
+ // Polyfill from https://cdn.polyfill.io/v2/polyfill.js?features=Window&flags=always
755
+ if ((typeof WorkerGlobalScope === "undefined") && (typeof importScripts !== "function")) {
756
+ (function (global) {
757
+ if (global.constructor) {
758
+ global.Window = global.constructor;
759
+ } else {
760
+ (global.Window = global.constructor = new Function('return function Window() {}')()).prototype = this;
761
+ }
762
+ }(this));
763
+ }
764
+
765
+ })
766
+ .call('object' === typeof window && window || 'object' === typeof self && self || 'object' === typeof global && global || {});
767
+
768
768
  (function(undefined) {
769
769
 
770
770
  // Detection from https://github.com/Financial-Times/polyfill-service/blob/master/packages/polyfill-library/polyfills/Event/detect.js
@@ -63,73 +63,11 @@ In order to include the images used in the components, you need to configure you
63
63
 
64
64
  app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/assets')))
65
65
 
66
- ## Component arguments
66
+ ## Component options
67
67
 
68
- If you are using Nunjucks,then macros take the following arguments
68
+ Use options to customise the appearance, content and behaviour of a component when using a macro, for example, changing the text.
69
69
 
70
- **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).**
71
-
72
- <table class="govuk-table">
73
-
74
- <thead class="govuk-table__head">
75
-
76
- <tr class="govuk-table__row">
77
-
78
- <th class="govuk-table__header" scope="col">Name</th>
79
-
80
- <th class="govuk-table__header" scope="col">Type</th>
81
-
82
- <th class="govuk-table__header" scope="col">Required</th>
83
-
84
- <th class="govuk-table__header" scope="col">Description</th>
85
-
86
- </tr>
87
-
88
- </thead>
89
-
90
- <tbody class="govuk-table__body">
91
-
92
- <tr class="govuk-table__row">
93
-
94
- <th class="govuk-table__header" scope="row">text (or) html</th>
95
-
96
- <td class="govuk-table__cell">string</td>
97
-
98
- <td class="govuk-table__cell">No</td>
99
-
100
- <td class="govuk-table__cell">Text or HTML to use within for the tag component. If `html` is provided, the `text` argument will be ignored.</td>
101
-
102
- </tr>
103
-
104
- <tr class="govuk-table__row">
105
-
106
- <th class="govuk-table__header" scope="row">classes</th>
107
-
108
- <td class="govuk-table__cell">string</td>
109
-
110
- <td class="govuk-table__cell">No</td>
111
-
112
- <td class="govuk-table__cell">Optional additional classes to add to the tag container.</td>
113
-
114
- </tr>
115
-
116
- <tr class="govuk-table__row">
117
-
118
- <th class="govuk-table__header" scope="row">attributes</th>
119
-
120
- <td class="govuk-table__cell">object</td>
121
-
122
- <td class="govuk-table__cell">No</td>
123
-
124
- <td class="govuk-table__cell">Any extra HTML attributes (for example data attributes) to add to the tag container.</td>
125
-
126
- </tr>
127
-
128
- </tbody>
129
-
130
- </table>
131
-
132
- **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).**
70
+ See [options table](https://design-system.service.gov.uk/components/tag/#options-example-default) for details.
133
71
 
134
72
  ### Setting up Nunjucks views and paths
135
73