govuk_publishing_components 34.7.0 → 34.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +3 -10
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-form-tracker.js +113 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-link-tracker.js +2 -11
  5. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-schemas.js +15 -1
  6. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-specialist-link-tracker.js +20 -29
  7. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4.js +1 -0
  8. data/app/models/govuk_publishing_components/component_doc.rb +14 -0
  9. data/app/models/govuk_publishing_components/component_wrapper_helper_options.rb +14 -0
  10. data/app/views/govuk_publishing_components/component_guide/show.html.erb +21 -6
  11. data/app/views/govuk_publishing_components/components/_action_link.html.erb +5 -2
  12. data/app/views/govuk_publishing_components/components/_breadcrumbs.html.erb +6 -2
  13. data/app/views/govuk_publishing_components/components/_details.html.erb +3 -1
  14. data/app/views/govuk_publishing_components/components/docs/action_link.yml +1 -0
  15. data/app/views/govuk_publishing_components/components/docs/breadcrumbs.yml +1 -0
  16. data/app/views/govuk_publishing_components/components/docs/details.yml +17 -0
  17. data/lib/govuk_publishing_components/presenters/component_wrapper_helper.rb +78 -0
  18. data/lib/govuk_publishing_components/presenters/related_navigation_helper.rb +0 -7
  19. data/lib/govuk_publishing_components/version.rb +1 -1
  20. data/lib/govuk_publishing_components.rb +1 -0
  21. data/node_modules/govuk-frontend/govuk/all.js +4029 -3792
  22. data/node_modules/govuk-frontend/govuk/all.js.map +1 -0
  23. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js +52 -51
  24. data/node_modules/govuk-frontend/govuk/common/closest-attribute-value.js.map +1 -0
  25. data/node_modules/govuk-frontend/govuk/common/index.js +153 -145
  26. data/node_modules/govuk-frontend/govuk/common/index.js.map +1 -0
  27. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js +324 -321
  28. data/node_modules/govuk-frontend/govuk/common/normalise-dataset.js.map +1 -0
  29. data/node_modules/govuk-frontend/govuk/common.js +154 -146
  30. data/node_modules/govuk-frontend/govuk/common.js.map +1 -0
  31. data/node_modules/govuk-frontend/govuk/components/_all.scss +1 -1
  32. data/node_modules/govuk-frontend/govuk/components/accordion/_index.scss +23 -4
  33. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js +2059 -1654
  34. data/node_modules/govuk-frontend/govuk/components/accordion/accordion.js.map +1 -0
  35. data/node_modules/govuk-frontend/govuk/components/accordion/fixtures.json +11 -11
  36. data/node_modules/govuk-frontend/govuk/components/accordion/template.njk +1 -1
  37. data/node_modules/govuk-frontend/govuk/components/back-link/_index.scss +19 -19
  38. data/node_modules/govuk-frontend/govuk/components/breadcrumbs/_index.scss +21 -10
  39. data/node_modules/govuk-frontend/govuk/components/button/button.js +927 -917
  40. data/node_modules/govuk-frontend/govuk/components/button/button.js.map +1 -0
  41. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js +2050 -2040
  42. data/node_modules/govuk-frontend/govuk/components/character-count/character-count.js.map +1 -0
  43. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js +1155 -1147
  44. data/node_modules/govuk-frontend/govuk/components/checkboxes/checkboxes.js.map +1 -0
  45. data/node_modules/govuk-frontend/govuk/components/cookie-banner/fixtures.json +23 -23
  46. data/node_modules/govuk-frontend/govuk/components/cookie-banner/template.njk +1 -1
  47. data/node_modules/govuk-frontend/govuk/components/details/details.js +800 -799
  48. data/node_modules/govuk-frontend/govuk/components/details/details.js.map +1 -0
  49. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js +1058 -1045
  50. data/node_modules/govuk-frontend/govuk/components/error-summary/error-summary.js.map +1 -0
  51. data/node_modules/govuk-frontend/govuk/components/header/_index.scss +6 -0
  52. data/node_modules/govuk-frontend/govuk/components/header/header.js +646 -998
  53. data/node_modules/govuk-frontend/govuk/components/header/header.js.map +1 -0
  54. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js +760 -752
  55. data/node_modules/govuk-frontend/govuk/components/notification-banner/notification-banner.js.map +1 -0
  56. data/node_modules/govuk-frontend/govuk/components/pagination/fixtures.json +61 -0
  57. data/node_modules/govuk-frontend/govuk/components/pagination/template.njk +1 -1
  58. data/node_modules/govuk-frontend/govuk/components/phase-banner/macro-options.json +1 -1
  59. data/node_modules/govuk-frontend/govuk/components/radios/radios.js +1110 -1107
  60. data/node_modules/govuk-frontend/govuk/components/radios/radios.js.map +1 -0
  61. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js +1017 -1014
  62. data/node_modules/govuk-frontend/govuk/components/skip-link/skip-link.js.map +1 -0
  63. data/node_modules/govuk-frontend/govuk/components/summary-list/_index.scss +107 -0
  64. data/node_modules/govuk-frontend/govuk/components/summary-list/fixtures.json +318 -23
  65. data/node_modules/govuk-frontend/govuk/components/summary-list/macro-options.json +110 -0
  66. data/node_modules/govuk-frontend/govuk/components/summary-list/template.njk +72 -28
  67. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js +1392 -1264
  68. data/node_modules/govuk-frontend/govuk/components/tabs/tabs.js.map +1 -0
  69. data/node_modules/govuk-frontend/govuk/i18n.js +363 -364
  70. data/node_modules/govuk-frontend/govuk/i18n.js.map +1 -0
  71. data/node_modules/govuk-frontend/govuk/settings/_measurements.scss +5 -5
  72. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js +242 -241
  73. data/node_modules/govuk-frontend/govuk/vendor/polyfills/DOMTokenList.js.map +1 -0
  74. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js +13 -12
  75. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Date/now.js.map +1 -0
  76. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js +17 -16
  77. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Document.js.map +1 -0
  78. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js +547 -546
  79. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/classList.js.map +1 -0
  80. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js +37 -36
  81. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/closest.js.map +1 -0
  82. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js +251 -250
  83. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/dataset.js.map +1 -0
  84. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js +21 -20
  85. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/matches.js.map +1 -0
  86. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js +198 -197
  87. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/nextElementSibling.js.map +1 -0
  88. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js +198 -197
  89. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element/prototype/previousElementSibling.js.map +1 -0
  90. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js +106 -105
  91. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Element.js.map +1 -0
  92. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js +400 -399
  93. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Event.js.map +1 -0
  94. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js +239 -238
  95. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Function/prototype/bind.js.map +1 -0
  96. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js +72 -71
  97. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Object/defineProperty.js.map +1 -0
  98. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js +14 -13
  99. data/node_modules/govuk-frontend/govuk/vendor/polyfills/String/prototype/trim.js.map +1 -0
  100. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js +17 -16
  101. data/node_modules/govuk-frontend/govuk/vendor/polyfills/Window.js.map +1 -0
  102. data/node_modules/govuk-frontend/govuk-esm/all.mjs +2 -2
  103. data/node_modules/govuk-frontend/govuk-esm/common/index.mjs +17 -10
  104. data/node_modules/govuk-frontend/govuk-esm/common/normalise-dataset.mjs +3 -1
  105. data/node_modules/govuk-frontend/govuk-esm/components/accordion/accordion.mjs +135 -52
  106. data/node_modules/govuk-frontend/govuk-esm/components/button/button.mjs +11 -9
  107. data/node_modules/govuk-frontend/govuk-esm/components/character-count/character-count.mjs +10 -7
  108. data/node_modules/govuk-frontend/govuk-esm/components/checkboxes/checkboxes.mjs +24 -18
  109. data/node_modules/govuk-frontend/govuk-esm/components/details/details.mjs +23 -16
  110. data/node_modules/govuk-frontend/govuk-esm/components/error-summary/error-summary.mjs +15 -11
  111. data/node_modules/govuk-frontend/govuk-esm/components/header/header.mjs +3 -2
  112. data/node_modules/govuk-frontend/govuk-esm/components/notification-banner/notification-banner.mjs +3 -4
  113. data/node_modules/govuk-frontend/govuk-esm/components/radios/radios.mjs +10 -9
  114. data/node_modules/govuk-frontend/govuk-esm/components/skip-link/skip-link.mjs +5 -3
  115. data/node_modules/govuk-frontend/govuk-esm/components/tabs/tabs.mjs +165 -38
  116. data/node_modules/govuk-frontend/govuk-esm/i18n.mjs +9 -11
  117. data/node_modules/govuk-frontend/package.json +1 -1
  118. metadata +37 -2
@@ -98,6 +98,116 @@
98
98
  }
99
99
  ]
100
100
  },
101
+ {
102
+ "name": "card",
103
+ "type": "object",
104
+ "required": false,
105
+ "description": "Options for the summary card. If any of these options are present, a summary card will wrap around the summary list.",
106
+ "params": [
107
+ {
108
+ "name": "title",
109
+ "type": "object",
110
+ "required": false,
111
+ "description": "Data for the summary card header.",
112
+ "params": [
113
+ {
114
+ "name": "text",
115
+ "type": "string",
116
+ "required": false,
117
+ "description": "Text to use within the each title. If `html` is provided, the `text` option will be ignored."
118
+ },
119
+ {
120
+ "name": "html",
121
+ "type": "string",
122
+ "required": false,
123
+ "description": "Text to use within the each title. If `html` is provided, the `text` option will be ignored."
124
+ },
125
+ {
126
+ "name": "headingLevel",
127
+ "type": "integer",
128
+ "required": false,
129
+ "description": "Heading level, from `1` to `6`. Default is `2`."
130
+ },
131
+ {
132
+ "name": "classes",
133
+ "type": "string",
134
+ "required": false,
135
+ "description": "Classes to add to the title wrapper."
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "name": "actions",
141
+ "type": "object",
142
+ "required": false,
143
+ "description": "Data for the summary card actions",
144
+ "params": [
145
+ {
146
+ "name": "items",
147
+ "type": "array",
148
+ "required": false,
149
+ "description": "Array of action item objects.",
150
+ "params": [
151
+ {
152
+ "name": "href",
153
+ "type": "string",
154
+ "required": true,
155
+ "description": "The value of the link's `href` attribute for an action item."
156
+ },
157
+ {
158
+ "name": "text",
159
+ "type": "string",
160
+ "required": true,
161
+ "description": "If `html` is set, this is not required. Text to use within each action item. If `html` is provided, the `text` option will be ignored."
162
+ },
163
+ {
164
+ "name": "html",
165
+ "type": "string",
166
+ "required": true,
167
+ "description": "If `text` is set, this is not required. HTML to use within the each action item. If `html` is provided, the `text` option will be ignored."
168
+ },
169
+ {
170
+ "name": "visuallyHiddenText",
171
+ "type": "string",
172
+ "required": false,
173
+ "description": "Actions rely on context from the surrounding content so may require additional accessible text. Text supplied to this option is appended to the end. Use `html` for more complicated scenarios."
174
+ },
175
+ {
176
+ "name": "classes",
177
+ "type": "string",
178
+ "required": false,
179
+ "description": "Classes to add to the action item."
180
+ },
181
+ {
182
+ "name": "attributes",
183
+ "type": "object",
184
+ "required": false,
185
+ "description": "HTML attributes (for example data attributes) to add to the action item."
186
+ }
187
+ ]
188
+ },
189
+ {
190
+ "name": "classes",
191
+ "type": "string",
192
+ "required": false,
193
+ "description": "Classes to add to the actions wrapper."
194
+ }
195
+ ]
196
+ },
197
+ {
198
+ "name": "classes",
199
+ "type": "string",
200
+ "required": false,
201
+ "description": "Classes to add to the container."
202
+ },
203
+ {
204
+ "name": "attributes",
205
+ "type": "object",
206
+ "required": false,
207
+ "description": "HTML attributes (for example data attributes) to add to the container."
208
+ }
209
+ ]
210
+ },
101
211
  {
102
212
  "name": "classes",
103
213
  "type": "string",
@@ -7,38 +7,82 @@
7
7
  </a>
8
8
  {% endmacro -%}
9
9
 
10
+ {%- macro _summaryCard(params) %}
11
+ {%- set headingLevel = params.title.headingLevel if params.title.headingLevel else 2 -%}
12
+
13
+ <div class="govuk-summary-card {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
14
+ <div class="govuk-summary-card__title-wrapper">
15
+ {%- if params.title -%}
16
+ <h{{ headingLevel }} class="govuk-summary-card__title {%- if params.title.classes %} {{ params.title.classes }}{% endif %}">
17
+ {{- params.title.html | safe if params.title.html else params.title.text -}}
18
+ </h{{ headingLevel }}>
19
+ {%- endif -%}
20
+
21
+ {%- if params.actions.items.length -%}
22
+ {%- if params.actions.items.length == 1 -%}
23
+ <div class="govuk-summary-card__actions {%- if params.actions.classes %} {{ params.actions.classes }}{% endif %}">
24
+ {{- _actionLink(params.actions.items[0]) -}}
25
+ </div>
26
+ {%- else -%}
27
+ <ul class="govuk-summary-card__actions {%- if params.actions.classes %} {{ params.actions.classes }}{% endif %}">
28
+ {%- for action in params.actions.items -%}
29
+ <li class="govuk-summary-card__action">
30
+ {{- _actionLink(action) -}}
31
+ </li>
32
+ {%- endfor -%}
33
+ </ul>
34
+ {% endif -%}
35
+ {%- endif -%}
36
+ </div>
37
+
38
+ <div class="govuk-summary-card__content">
39
+ {{- caller() -}}
40
+ </div>
41
+ </div>
42
+ {% endmacro -%}
43
+
10
44
  {# Determine if we need 2 or 3 columns #}
11
45
  {% set anyRowHasActions = false %}
12
46
  {% for row in params.rows %}
13
47
  {% set anyRowHasActions = true if row.actions.items | length else anyRowHasActions %}
14
48
  {% endfor -%}
15
49
 
16
- <dl class="govuk-summary-list {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
17
- {% for row in params.rows %}
18
- {% if row %}
19
- <div class="govuk-summary-list__row {%- if anyRowHasActions and not row.actions.items %} govuk-summary-list__row--no-actions{% endif %} {%- if row.classes %} {{ row.classes }}{% endif %}">
20
- <dt class="govuk-summary-list__key {%- if row.key.classes %} {{ row.key.classes }}{% endif %}">
21
- {{ row.key.html | safe if row.key.html else row.key.text }}
22
- </dt>
23
- <dd class="govuk-summary-list__value {%- if row.value.classes %} {{ row.value.classes }}{% endif %}">
24
- {{ row.value.html | indent(8) | trim | safe if row.value.html else row.value.text }}
25
- </dd>
26
- {% if row.actions.items.length %}
27
- <dd class="govuk-summary-list__actions {%- if row.actions.classes %} {{ row.actions.classes }}{% endif %}">
28
- {% if row.actions.items.length == 1 %}
29
- {{ _actionLink(row.actions.items[0]) | indent(12) | trim }}
30
- {% else %}
31
- <ul class="govuk-summary-list__actions-list">
32
- {%- for action in row.actions.items -%}
33
- <li class="govuk-summary-list__actions-list-item">
34
- {{- _actionLink(action) | indent(18) | trim -}}
35
- </li>
36
- {%- endfor -%}
37
- </ul>
38
- {% endif %}
50
+ {%- set summaryList -%}
51
+ <dl class="govuk-summary-list {%- if params.classes %} {{ params.classes }}{% endif %}"{% for attribute, value in params.attributes %} {{attribute}}="{{value}}"{% endfor %}>
52
+ {% for row in params.rows %}
53
+ {% if row %}
54
+ <div class="govuk-summary-list__row {%- if anyRowHasActions and not row.actions.items %} govuk-summary-list__row--no-actions{% endif %} {%- if row.classes %} {{ row.classes }}{% endif %}">
55
+ <dt class="govuk-summary-list__key {%- if row.key.classes %} {{ row.key.classes }}{% endif %}">
56
+ {{ row.key.html | indent(4 if params.card else 0) | safe if row.key.html else row.key.text }}
57
+ </dt>
58
+ <dd class="govuk-summary-list__value {%- if row.value.classes %} {{ row.value.classes }}{% endif %}">
59
+ {{ row.value.html | indent(12 if params.card else 8) | trim | safe if row.value.html else row.value.text }}
39
60
  </dd>
40
- {% endif %}
41
- </div>
42
- {% endif %}
43
- {% endfor %}
44
- </dl>
61
+ {% if row.actions.items.length %}
62
+ <dd class="govuk-summary-list__actions {%- if row.actions.classes %} {{ row.actions.classes }}{% endif %}">
63
+ {% if row.actions.items.length == 1 %}
64
+ {{ _actionLink(row.actions.items[0]) | indent(16 if params.card else 12) | trim }}
65
+ {% else %}
66
+ <ul class="govuk-summary-list__actions-list">
67
+ {%- for action in row.actions.items -%}
68
+ <li class="govuk-summary-list__actions-list-item">
69
+ {{- _actionLink(action) | indent(22 if params.card else 18) | trim -}}
70
+ </li>
71
+ {%- endfor -%}
72
+ </ul>
73
+ {% endif %}
74
+ </dd>
75
+ {% endif %}
76
+ </div>
77
+ {% endif %}
78
+ {% endfor %}
79
+ </dl>
80
+ {%- endset %}
81
+
82
+ {%- if params.card -%}
83
+ {% call _summaryCard(params.card) -%}
84
+ {{ summaryList | safe }}
85
+ {%- endcall %}
86
+ {%- else -%}
87
+ {{ summaryList | safe }}
88
+ {%- endif %}