@ons/design-system 73.13.1 → 74.0.0-cookies.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 (81) hide show
  1. package/README.md +12 -2
  2. package/components/access-code/example-access-code-error.njk +2 -2
  3. package/components/access-code/example-access-code.njk +2 -2
  4. package/components/address-input/_macro.njk +6 -6
  5. package/components/address-input/_macro.spec.js +0 -3
  6. package/components/address-output/_macro.njk +1 -1
  7. package/components/announcement-banner/_announcement-banner.scss +5 -0
  8. package/components/autosuggest/_autosuggest.scss +8 -0
  9. package/components/autosuggest/autosuggest.ui.js +8 -5
  10. package/components/back-to-top/_back-to-top.scss +7 -0
  11. package/components/back-to-top/_macro.njk +1 -1
  12. package/components/back-to-top/example-full-page-back-to-top.njk +1 -1
  13. package/components/breadcrumbs/_breadcrumbs.scss +4 -7
  14. package/components/breadcrumbs/_macro.njk +29 -25
  15. package/components/breadcrumbs/_macro.spec.js +39 -0
  16. package/components/breadcrumbs/example-breadcrumbs-wide.njk +52 -0
  17. package/components/char-check-limit/_macro.njk +16 -14
  18. package/components/cookies-banner/_macro.njk +1 -1
  19. package/components/cookies-banner/_macro.spec.js +15 -3
  20. package/components/details/_details.scss +9 -0
  21. package/components/details/example-details-with-warning.njk +1 -1
  22. package/components/details-panel/_macro.njk +1 -1
  23. package/components/featured-article/_macro.njk +4 -4
  24. package/components/featured-article/macro.spec.js +2 -2
  25. package/components/feedback/_macro.njk +4 -1
  26. package/components/feedback/_macro.spec.js +1 -1
  27. package/components/figure/_figure.scss +1 -0
  28. package/components/figure/_macro.njk +3 -3
  29. package/components/footer/_macro.njk +5 -2
  30. package/components/header/_macro.njk +7 -3
  31. package/components/header/_macro.spec.js +27 -0
  32. package/components/hero/_hero.scss +4 -0
  33. package/components/hero/_macro.njk +3 -2
  34. package/components/hero/_macro.spec.js +36 -0
  35. package/components/hero/example-hero-dark-wide.njk +17 -0
  36. package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +17 -21
  37. package/components/hero/example-hero-default-full-width.njk +16 -0
  38. package/components/hero/example-hero-default-with-external-breadcrumbs.njk +165 -169
  39. package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +207 -211
  40. package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +163 -167
  41. package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +165 -169
  42. package/components/input/_input.scss +4 -0
  43. package/components/input/_macro.njk +4 -1
  44. package/components/label/_label.scss +3 -0
  45. package/components/list/_list.scss +5 -0
  46. package/components/message-list/_message-list.scss +2 -0
  47. package/components/panel/_macro.njk +1 -1
  48. package/components/panel/_panel.scss +8 -0
  49. package/components/panel/example-panel-bare.njk +1 -1
  50. package/components/phase-banner/_phase-banner.scss +1 -0
  51. package/components/question/example-question-ccs.njk +1 -1
  52. package/components/question/example-question-fieldset.njk +1 -1
  53. package/components/question/example-question-interviewer-note.njk +1 -1
  54. package/components/question/example-question-no-fieldset.njk +1 -1
  55. package/components/quote/_macro.njk +1 -1
  56. package/components/relationships/example-relationships-error.njk +1 -1
  57. package/components/relationships/example-relationships-you.njk +1 -1
  58. package/components/relationships/example-relationships.njk +1 -1
  59. package/components/skip-to-content/_macro.njk +1 -1
  60. package/components/skip-to-content/_skip.scss +8 -0
  61. package/components/summary/_macro.njk +3 -2
  62. package/components/summary/_summary.scss +6 -1
  63. package/components/table-of-contents/example-table-of-contents-sticky-full-page-ordered.njk +105 -107
  64. package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +104 -106
  65. package/components/table-of-contents/example-table-of-contents-sticky.njk +1 -1
  66. package/components/table-of-contents/table-of-contents.spec.js +4 -5
  67. package/css/main.css +1 -1
  68. package/js/cookies-functions.js +46 -40
  69. package/js/cookies-functions.spec.js +103 -46
  70. package/layout/_template.njk +60 -47
  71. package/package.json +1 -1
  72. package/scripts/main.es5.js +1 -1
  73. package/scripts/main.js +1 -1
  74. package/scss/base/_typography.scss +9 -0
  75. package/scss/helpers/_mixins.scss +8 -0
  76. package/scss/objects/_page.scss +1 -1
  77. package/scss/objects/_spacing.scss +0 -4
  78. package/scss/utilities/_utilities.scss +10 -0
  79. package/scss/vars/_forms.scss +2 -1
  80. package/scss/vars/_index.scss +1 -0
  81. package/scss/vars/_utilities.scss +2 -0
@@ -4,170 +4,165 @@ layout: ~
4
4
  ---
5
5
 
6
6
  {% from "components/hero/_macro.njk" import onsHero %}
7
- {% from "components/breadcrumbs/_macro.njk" import onsBreadcrumbs %}
8
7
  {% extends "layout/_template.njk" %}
9
8
  {%
10
9
  set pageConfig = {
11
10
  "header": {
12
11
  "variants": 'basic',
13
12
  "menuLinks": {
14
- "id": "menu-links",
15
- "keyLinks": [
16
- {
17
- 'heading': 'Taking part in a survey?',
18
- 'description': 'It’s never been more important.'
19
- },
20
- {
21
- 'heading': 'Release calendar',
22
- 'description': 'View our latest and upcoming releases.'
23
- },
24
- {
25
- 'heading': 'Explore local statistics',
26
- 'url': '#0',
27
- 'description': 'Explore statistics across the UK.'
28
- }
29
- ],
30
- "columns": [
31
- {
32
- "groups": [
33
- {
34
- "heading": "People, population and community",
35
- "groupItems": [
36
- {
37
- "text": "Armed forces community"
38
- },
39
- {
40
- "text": "Births, deaths and marriages"
41
- },
42
- {
43
- "text": "Crime and justice"
44
- },
45
- {
46
- "text": "Cultural identity"
47
- },
48
- {
49
- "text": "Education and childcare"
50
- },
51
- {
52
- "text": "Elections"
53
- },
54
- {
55
- "text": "Health and social care"
56
- },
57
- {
58
- "text": "Household characteristics"
59
- },
60
- {
61
- "text": "Housing"
62
- },
63
- {
64
- "text": "Leisure and tourism"
65
- },
66
- {
67
- "text": "Personal and household finances"
68
- },
69
- {
70
- "text": "Population and migration"
71
- },
72
- {
73
- "text": "Well-being"
74
- }
75
- ]
76
- }
77
- ]
78
- },
79
- {
80
- "groups": [
81
- {
82
- "heading": "Business, industry and trade",
83
- "groupItems": [
84
- {
85
- "text": "Business"
86
- },
87
- {
88
- "text": "Changes to business"
89
- },
90
- {
91
- "text": "Construction industry"
92
- },
93
- {
94
- "text": "International trade"
95
- },
96
- {
97
- "text": "IT and internet industry"
98
- },
99
- {
100
- "text": "Manufacturing and production industry"
101
- },
102
- {
103
- "text": "Retail industry",
104
- "url": "#0"
105
- },
106
- {
107
- "text": "Tourism industry"
108
- }
109
- ]
110
- },
111
- {
112
- "heading": "Employment and labour market",
113
- "url": "#0",
114
- "groupItems":
115
- [
116
- {
117
- "text": "People in work"
118
- },
119
- {
120
- "text": "People not in work"
121
- }
122
- ]
13
+ "id": "menu-links",
14
+ "keyLinks": [
15
+ {
16
+ 'heading': 'Taking part in a survey?',
17
+ 'description': 'It’s never been more important.'
18
+ },
19
+ {
20
+ 'heading': 'Release calendar',
21
+ 'description': 'View our latest and upcoming releases.'
22
+ },
23
+ {
24
+ 'heading': 'Explore local statistics',
25
+ 'url': '#0',
26
+ 'description': 'Explore statistics across the UK.'
27
+ }
28
+ ],
29
+ "columns": [
30
+ {
31
+ "groups": [
32
+ {
33
+ "heading": "People, population and community",
34
+ "groupItems": [
35
+ {
36
+ "text": "Armed forces community"
37
+ },
38
+ {
39
+ "text": "Births, deaths and marriages"
40
+ },
41
+ {
42
+ "text": "Crime and justice"
43
+ },
44
+ {
45
+ "text": "Cultural identity"
46
+ },
47
+ {
48
+ "text": "Education and childcare"
49
+ },
50
+ {
51
+ "text": "Elections"
52
+ },
53
+ {
54
+ "text": "Health and social care"
55
+ },
56
+ {
57
+ "text": "Household characteristics"
58
+ },
59
+ {
60
+ "text": "Housing"
61
+ },
62
+ {
63
+ "text": "Leisure and tourism"
64
+ },
65
+ {
66
+ "text": "Personal and household finances"
67
+ },
68
+ {
69
+ "text": "Population and migration"
70
+ },
71
+ {
72
+ "text": "Well-being"
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ },
78
+ {
79
+ "groups": [
80
+ {
81
+ "heading": "Business, industry and trade",
82
+ "groupItems": [
83
+ {
84
+ "text": "Business"
85
+ },
86
+ {
87
+ "text": "Changes to business"
88
+ },
89
+ {
90
+ "text": "Construction industry"
91
+ },
92
+ {
93
+ "text": "International trade"
94
+ },
95
+ {
96
+ "text": "IT and internet industry"
97
+ },
98
+ {
99
+ "text": "Manufacturing and production industry"
100
+ },
101
+ {
102
+ "text": "Retail industry",
103
+ "url": "#0"
104
+ },
105
+ {
106
+ "text": "Tourism industry"
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "heading": "Employment and labour market",
112
+ "url": "#0",
113
+ "groupItems":
114
+ [
115
+ {
116
+ "text": "People in work"
117
+ },
118
+ {
119
+ "text": "People not in work"
120
+ }
121
+ ]
123
122
 
124
- }
125
- ]
126
- },
127
- {
128
- "groups": [
129
- {
130
- "heading": "Economy",
131
- "groupItems": [
132
- {
133
- "text": "Economic output and productivity"
134
- },
135
- {
136
- "text": "Government, public sector and taxes"
137
- },
138
- {
139
- "text": "Gross Value Added (GVA)"
140
- },
141
- {
142
- "text": "Investments, pensions and trusts"
143
- },
144
- {
145
- "text": "Regional accounts"
146
- },
147
- {
148
- "text": "Environmental accounts"
149
- },
150
- {
151
- "text": "Gross Domestic Product (GDP)"
152
- },
153
- {
154
- "text": "Inflation and price indices"
155
- },
156
- {
157
- "text": "National accounts"
158
- }
159
- ]
160
- }
161
- ]
162
- }
163
- ]
164
- }
165
- }
166
- }
167
- %}
168
- {% block pageContent %}
169
- {{
170
- onsBreadcrumbs({
123
+ }
124
+ ]
125
+ },
126
+ {
127
+ "groups": [
128
+ {
129
+ "heading": "Economy",
130
+ "groupItems": [
131
+ {
132
+ "text": "Economic output and productivity"
133
+ },
134
+ {
135
+ "text": "Government, public sector and taxes"
136
+ },
137
+ {
138
+ "text": "Gross Value Added (GVA)"
139
+ },
140
+ {
141
+ "text": "Investments, pensions and trusts"
142
+ },
143
+ {
144
+ "text": "Regional accounts"
145
+ },
146
+ {
147
+ "text": "Environmental accounts"
148
+ },
149
+ {
150
+ "text": "Gross Domestic Product (GDP)"
151
+ },
152
+ {
153
+ "text": "Inflation and price indices"
154
+ },
155
+ {
156
+ "text": "National accounts"
157
+ }
158
+ ]
159
+ }
160
+ ]
161
+ }
162
+ ]
163
+ }
164
+ },
165
+ breadcrumbs: {
171
166
  "ariaLabel": 'Breadcrumbs',
172
167
  "variant": "pale-blue",
173
168
  "itemsList": [
@@ -184,18 +179,19 @@ layout: ~
184
179
  "text": 'Retail industry'
185
180
  }
186
181
  ]
182
+ }
183
+ }
184
+ %}
185
+
186
+ {% block hero %}
187
+ {{
188
+ onsHero({
189
+ "topic": 'Topic',
190
+ "title": 'Retail Industry',
191
+ "text": 'Sales by retailers in Great Britain directly to end consumers, including spending on goods (in store and online)
192
+ (Retail Sales Index) and spending on services (Index of Services). The industry as a whole is used as an indicator
193
+ of how the wider economy is performing and the strength of consumer spending.',
194
+ "variants": 'pale-blue'
187
195
  })
188
196
  }}
189
- <main id="main-content">
190
- {{
191
- onsHero({
192
- "topic": 'Topic',
193
- "title": 'Retail Industry',
194
- "text": 'Sales by retailers in Great Britain directly to end consumers, including spending on goods (in store and online)
195
- (Retail Sales Index) and spending on services (Index of Services). The industry as a whole is used as an indicator
196
- of how the wider economy is performing and the strength of consumer spending.',
197
- "variants": 'pale-blue'
198
- })
199
- }}
200
- </main>
201
197
  {% endblock %}
@@ -43,6 +43,10 @@
43
43
  &--textarea {
44
44
  // Prevent inner shadow on iOS
45
45
  appearance: none;
46
+
47
+ &:not(.ons-input--header-search, [class*='--w-']) {
48
+ @include reading-width;
49
+ }
46
50
  }
47
51
 
48
52
  &:focus {
@@ -60,7 +60,10 @@
60
60
  <!-- prettier-ignore-end -->
61
61
  {% endif %}
62
62
  {% if params.postTextboxLinkText %}
63
- <a class="ons-u-fs-s ons-input__post-link" href="{{ params.postTextboxLinkUrl }}">{{ params.postTextboxLinkText }}</a>
63
+ {# p tag ensures reading width is applied #}
64
+ <p class="ons-u-mb-no">
65
+ <a class="ons-u-fs-s ons-input__post-link" href="{{ params.postTextboxLinkUrl }}">{{ params.postTextboxLinkText }}</a>
66
+ </p>
64
67
  {% endif %}
65
68
  {% endset %}
66
69
 
@@ -1,4 +1,6 @@
1
1
  .ons-label {
2
+ @include reading-width;
3
+
2
4
  color: inherit;
3
5
  display: block;
4
6
  font-weight: $font-weight-bold;
@@ -6,6 +8,7 @@
6
8
 
7
9
  &__description {
8
10
  @extend .ons-u-fs-s;
11
+ @include reading-width;
9
12
 
10
13
  display: block;
11
14
  }
@@ -3,6 +3,8 @@
3
3
  padding: 0 0 0 1.5rem;
4
4
 
5
5
  &__item {
6
+ @include reading-width;
7
+
6
8
  &:first-child {
7
9
  margin-top: 0.5rem;
8
10
  }
@@ -109,14 +111,17 @@
109
111
  }
110
112
 
111
113
  @include bp-suffix('ons-list--inline') {
114
+ /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */
112
115
  &:not(.ons-list--icons) {
113
116
  margin: 0 1rem 0 0;
114
117
  .ons-list__item {
118
+ max-width: none;
115
119
  display: inline-block;
116
120
  margin: 0 1rem 0 0;
117
121
  }
118
122
  }
119
123
 
124
+ /* stylelint-disable-next-line nesting-selector-no-missing-scoping-root */
120
125
  &.ons-list--icons {
121
126
  align-items: center;
122
127
  display: flex;
@@ -16,6 +16,8 @@
16
16
  }
17
17
 
18
18
  &__metadata {
19
+ @include reading-width;
20
+
19
21
  margin: 0 0 1rem;
20
22
 
21
23
  &-term,
@@ -62,7 +62,7 @@
62
62
  {% set closingTag = "</" ~ titleTag ~ ">" %}
63
63
  <div class="ons-panel__header">
64
64
  {{ openingTag | safe }} id="alert"{% if params.variant %}data-qa="{{ params.variant }}-header"{% endif %}
65
- class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}{{ closingTag | safe }}
65
+ class="ons-panel__title ons-u-fs-r--b ons-u-reading-width">{{ params.title | safe }}{{ closingTag | safe }}
66
66
  </div>
67
67
  {% else %}
68
68
  {% if not params.variant or params.variant == "branded" or params.variant == "info" or params.variant == "bare" %}
@@ -112,6 +112,14 @@
112
112
  margin: 0;
113
113
  }
114
114
  }
115
+
116
+ // Restrict the width of textual content within the panel body (paragraphs are already globally restricted)
117
+ ul,
118
+ ol,
119
+ label,
120
+ legend {
121
+ @include reading-width;
122
+ }
115
123
  }
116
124
 
117
125
  &__error {
@@ -6,5 +6,5 @@
6
6
  "iconType": 'lock'
7
7
  })
8
8
  %}
9
- Here is some text with an icon
9
+ <p>Here is some text with an icon</p>
10
10
  {% endcall %}
@@ -15,5 +15,6 @@
15
15
 
16
16
  &__desc {
17
17
  margin-top: 0.25rem;
18
+ @include no-reading-width;
18
19
  }
19
20
  }
@@ -23,7 +23,7 @@ layout: ~
23
23
  }
24
24
  %}
25
25
 
26
- {% block main %}
26
+ {% block mainContent %}
27
27
  {%
28
28
  call onsQuestion({
29
29
  "title": "How many visitors do you have staying overnight at 3 Severn Road on Sunday 21 March 2021?",
@@ -24,7 +24,7 @@ layout: ~
24
24
  %}
25
25
  {% set questionTitle = "On 1 May 2016, what was the number of employees for Bolt and Ratchet?" %}
26
26
 
27
- {% block main %}
27
+ {% block mainContent %}
28
28
  {%
29
29
  call onsQuestion({
30
30
  "title": questionTitle,
@@ -23,7 +23,7 @@ layout: ~
23
23
  }
24
24
  %}
25
25
 
26
- {% block main %}
26
+ {% block mainContent %}
27
27
  {%
28
28
  call onsQuestion({
29
29
  "title": "<mark>Interviewer note:</mark>Who to interview",
@@ -23,7 +23,7 @@ layout: ~
23
23
  }
24
24
  %}
25
25
 
26
- {% block main %}
26
+ {% block mainContent %}
27
27
  {%
28
28
  call onsQuestion({
29
29
  "title": "How many visitors are staying overnight at 3 Severn Road on 13 May 2019?",
@@ -1,5 +1,5 @@
1
1
  {% macro onsQuote(params) %}
2
- <blockquote class="ons-quote">
2
+ <blockquote class="ons-quote ons-u-reading-width">
3
3
  {% from "components/icon/_macro.njk" import onsIcon %}
4
4
  {{-
5
5
  onsIcon({
@@ -25,7 +25,7 @@ layout: ~
25
25
  }
26
26
  %}
27
27
 
28
- {% block main %}
28
+ {% block mainContent %}
29
29
 
30
30
  {%
31
31
  call onsPanel({
@@ -23,7 +23,7 @@ layout: ~
23
23
  }
24
24
  %}
25
25
 
26
- {% block main %}
26
+ {% block mainContent %}
27
27
  {%
28
28
  call onsQuestion({
29
29
  "title": "Joe Bloggs is your <strong>…</strong>",
@@ -23,7 +23,7 @@ layout: ~
23
23
  }
24
24
  %}
25
25
 
26
- {% block main %}
26
+ {% block mainContent %}
27
27
  {%
28
28
  call onsQuestion({
29
29
  "title": "Thinking of Joe Bloggs, Amanda Bloggs is their <strong>…</strong>",
@@ -1,6 +1,6 @@
1
1
  {% macro onsSkipToContent(params) %}
2
2
  <div role="region">
3
3
  {% set text = params.text | default('Skip to content') %}
4
- <a class="ons-skip-to-content ons-u-fs-r--b" href="{{ params.url }}">{{ text }}</a>
4
+ <a class="ons-skip-to-content ons-u-fs-r--b" href="{{ params.url }}"><span class="ons-skip-to-content__text">{{ text }}</span></a>
5
5
  </div>
6
6
  {% endmacro %}
@@ -1,4 +1,5 @@
1
1
  .ons-skip-to-content {
2
+ /* stylelint-disable-next-line property-no-deprecated */
2
3
  clip: rect(0 0 0 0);
3
4
  clip-path: inset(50%);
4
5
  display: block;
@@ -13,6 +14,7 @@
13
14
  &:focus {
14
15
  background-color: var(--ons-color-focus);
15
16
  box-shadow: 0;
17
+ /* stylelint-disable-next-line property-no-deprecated */
16
18
  clip: auto;
17
19
  clip-path: none;
18
20
  color: var(--ons-color-text-link-focus);
@@ -28,4 +30,10 @@
28
30
  white-space: inherit;
29
31
  width: auto;
30
32
  }
33
+
34
+ &__text {
35
+ // Reading width max-width is hard-coded as skip to content sits outside the `ons-container` class
36
+ max-width: $reading-width;
37
+ display: block;
38
+ }
31
39
  }
@@ -24,8 +24,9 @@
24
24
  {% if group.title %}
25
25
  {% set openingHeadingTag = "<h" ~ headingLevel %}
26
26
  {% set closingHeadingTag = "</h" ~ headingLevel ~ ">" %}
27
- {{ openingHeadingTag | safe }}
28
- class="ons-summary__group-title">{{ group.title }}{{ closingHeadingTag | safe }}
27
+ <div class="ons-summary__group-title-wrapper">
28
+ {{ openingHeadingTag | safe }} class="ons-summary__group-title">{{ group.title }}{{ closingHeadingTag | safe }}
29
+ </div>
29
30
  {% endif %}
30
31
  {% if group.rows %}
31
32
  <dl class="ons-summary__items">
@@ -217,9 +217,14 @@ $hub-row-spacing: 1.3rem;
217
217
  border-bottom: 1px solid var(--ons-color-borders-light);
218
218
  }
219
219
  }
220
- .ons-summary__group-title {
220
+ .ons-summary__group-title-wrapper {
221
221
  background-color: var(--ons-color-grey-5);
222
222
  padding: 1rem 1.25rem;
223
+ margin-bottom: 1rem;
224
+
225
+ .ons-summary__group-title {
226
+ margin: 0;
227
+ }
223
228
  }
224
229
  .ons-summary__link {
225
230
  padding: 0 1.25rem;