@ons/design-system 46.1.4 → 48.0.1

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 (37) hide show
  1. package/components/button/_button.scss +76 -2
  2. package/components/document-list/_macro.njk +114 -0
  3. package/components/document-list/document-list.scss +182 -0
  4. package/components/download-resources/_download-resources.scss +2 -9
  5. package/components/download-resources/download-resources.js +2 -2
  6. package/components/error/_macro.njk +0 -1
  7. package/components/header/_header-nav.scss +22 -1
  8. package/components/header/_header.scss +12 -20
  9. package/components/header/_macro.njk +65 -16
  10. package/components/header/header-nav.dom.js +9 -0
  11. package/components/header/header-nav.js +5 -2
  12. package/components/lists/_macro.njk +14 -16
  13. package/components/panel/_macro.njk +3 -8
  14. package/components/panel/_panel.scss +5 -3
  15. package/css/census.css +1 -1
  16. package/css/main.css +1 -1
  17. package/img/large/alison-pritchard-featured.jpg +0 -0
  18. package/img/large/alison-pritchard.jpg +0 -0
  19. package/img/large/census-monuments-lights-featured.jpg +0 -0
  20. package/img/large/census-monuments-lights.jpg +0 -0
  21. package/img/large/ons-award-winners.jpg +0 -0
  22. package/img/small/alison-pritchard-featured.jpg +0 -0
  23. package/img/small/alison-pritchard.jpg +0 -0
  24. package/img/small/census-monuments-lights-featured.jpg +0 -0
  25. package/img/small/census-monuments-lights.jpg +0 -0
  26. package/img/small/ons-award-winners.jpg +0 -0
  27. package/img/small/placeholder-portrait.png +0 -0
  28. package/package.json +1 -1
  29. package/scripts/main.es5.js +1 -1
  30. package/scripts/main.js +1 -1
  31. package/scss/main.scss +1 -2
  32. package/scss/objects/_spacing.scss +1 -0
  33. package/scss/vars/_colors.scss +9 -3
  34. package/components/articles/_articles.scss +0 -86
  35. package/components/articles/_macro.njk +0 -81
  36. package/components/downloads/_downloads.scss +0 -39
  37. package/components/downloads/_macro.njk +0 -66
@@ -209,6 +209,76 @@ $button-shadow-size: 3px;
209
209
  }
210
210
  }
211
211
 
212
+ &--text-link {
213
+ vertical-align: baseline;
214
+ }
215
+
216
+ &--text-link & {
217
+ &__inner {
218
+ background: transparent;
219
+ border: none;
220
+ border-radius: 0;
221
+ box-shadow: none;
222
+ color: $color-text-link;
223
+ font-weight: normal;
224
+ padding: 0;
225
+ .ons-svg-icon {
226
+ fill: $color-text-link;
227
+ }
228
+ }
229
+ }
230
+
231
+ &--text-link-inverse & {
232
+ &__inner {
233
+ color: $color-white;
234
+ .ons-svg-icon {
235
+ fill: $color-white;
236
+ }
237
+ }
238
+ }
239
+
240
+ &--text-link:hover &,
241
+ &--text-link:active &,
242
+ &--text-link.active & {
243
+ &__inner {
244
+ background: none;
245
+ color: $color-text-link-hover;
246
+ .ons-svg-icon {
247
+ fill: $color-text-link-hover;
248
+ }
249
+ }
250
+ }
251
+
252
+ &--text-link-inverse:hover &,
253
+ &--text-link-inverse:active &,
254
+ &--text-link-inverse.active & {
255
+ &__inner {
256
+ color: $color-branded-tint;
257
+ .ons-svg-icon {
258
+ fill: $color-branded-tint;
259
+ }
260
+ }
261
+ }
262
+
263
+ &--text-link:focus:hover & {
264
+ &__inner {
265
+ color: $color-black;
266
+ }
267
+ }
268
+
269
+ &--text-link:focus &,
270
+ &--text-link.active:focus &,
271
+ &--text-link:active:focus & {
272
+ &__inner {
273
+ background-color: $color-focus;
274
+ box-shadow: 0 -2px $color-focus, 0 4px $color-text-link-focus !important;
275
+ color: $color-text-link-focus;
276
+ .ons-svg-icon {
277
+ fill: $color-text-link-focus;
278
+ }
279
+ }
280
+ }
281
+
212
282
  &--ghost &,
213
283
  &--mobile & {
214
284
  &__inner {
@@ -232,6 +302,7 @@ $button-shadow-size: 3px;
232
302
  }
233
303
 
234
304
  &--ghost,
305
+ &--text-link,
235
306
  &--mobile {
236
307
  &:active,
237
308
  .active {
@@ -245,6 +316,7 @@ $button-shadow-size: 3px;
245
316
  }
246
317
 
247
318
  &--ghost:focus:hover,
319
+ &--text-link:focus:hover,
248
320
  &--mobile:focus:hover {
249
321
  outline: none;
250
322
  }
@@ -294,13 +366,15 @@ $button-shadow-size: 3px;
294
366
  }
295
367
  }
296
368
 
297
- &--mobile[aria-expanded='true'] {
369
+ &--mobile[aria-expanded='true'],
370
+ &--text-link[aria-expanded='true'] {
298
371
  .ons-svg-icon {
299
372
  transform: rotate(270deg);
300
373
  }
301
374
  }
302
375
 
303
- &--mobile {
376
+ &--mobile,
377
+ &--text-link {
304
378
  .ons-svg-icon {
305
379
  transform: rotate(90deg);
306
380
  }
@@ -0,0 +1,114 @@
1
+ {% macro onsDocumentList(params) %}
2
+ <ul{% if params.id is defined and params.id %} id="{{ params.id }}"{% endif %} class="ons-document-list{{ ' ' + params.classes if params.classes is defined and params.classes else '' }}"{% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
3
+ {% for document in (params.documents if params.documents is iterable else params.documents.items()) %}
4
+
5
+ <li class="ons-document-list__item{{ ' ons-document-list__item--featured' if document.featured is defined and document.featured }}{{ ' ons-document-list__item--full-width' if document.fullWidth is defined and document.fullWidth == true }}{{ ' ' + document.classes if document.classes is defined and document.classes else '' }}"{% if document.attributes is defined and document.attributes %}{% for attribute, value in (document.attributes.items() if document.attributes is mapping and document.attributes.items else document.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
6
+
7
+ {% if document.fullWidth is defined and document.fullWidth == true %}
8
+
9
+ <div class="ons-container{{ ' ons-container--wide' if document.wide is defined and document.wide == true }}">
10
+
11
+ {% endif %}
12
+
13
+ {% if document.thumbnail is defined or document.thumbnail == true %}
14
+
15
+ <div class="ons-document-list__item-image{%- if document.metadata.file is defined and document.metadata.file %} ons-document-list__item-image--file{% endif %}" aria-hidden="true">
16
+ <a class="ons-document-list__image-link{{ ' ons-document-list__image-link--placeholder' if not document.thumbnail.smallSrc }}" href="{{ document.url }}" tabindex="-1">
17
+ {% if document.thumbnail.smallSrc is defined and document.thumbnail.smallSrc and document.thumbnail.largeSrc is defined and document.thumbnail.largeSrc %}
18
+ <img srcset="{{ document.thumbnail.smallSrc }} 1x, {{ document.thumbnail.largeSrc }} 2x" src="{{ document.thumbnail.smallSrc }}" alt="" loading="lazy">
19
+ {% endif %}
20
+ </a>
21
+ </div>
22
+
23
+ {% endif %}
24
+
25
+ <div class="ons-document-list__item-content">
26
+
27
+ <div class="ons-document-list__item-header{{ ' ons-document-list__item-header--reverse' if document.showMetadataFirst is defined and document.showMetadataFirst == true }}">
28
+
29
+ {% set titleTag = params.titleTag | default("h2") %}
30
+
31
+ <{{ titleTag }} class="ons-document-list__item-title ons-u-fs-m ons-u-mt-no ons-u-mb-xs">
32
+ <a href="{{ document.url }}">{{ document.title }}
33
+ {%- if document.metadata is defined and document.metadata and document.metadata.file is defined and document.metadata.file %}
34
+ <span class="ons-u-vh">,
35
+
36
+ {% set fileMetadataItems = [] %}
37
+
38
+ {% if document.metadata.file.fileType is defined and document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType + ' document download'), fileMetadataItems) %}{% endif %}
39
+ {% if document.metadata.file.fileSize is defined and document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
40
+ {% if document.metadata.file.filePages is defined and document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
41
+
42
+ {{ fileMetadataItems | join(', ') }}
43
+
44
+ {% endif -%}
45
+
46
+ </span></a>
47
+ </{{ titleTag }}>
48
+
49
+ {%- if document.metadata is defined and document.metadata %}
50
+
51
+ <ul class="ons-document-list__item-metadata{% if document.description is defined and document.description %} ons-u-mb-xs{% else %} ons-u-mb-no{% endif %}">
52
+
53
+ {%- if document.metadata.date is defined and document.metadata.date %}
54
+ <li class="ons-document-list__item-attribute">
55
+ {% if document.metadata.date -%}
56
+ {% set prefixClasses = "ons-u-fw-b" if document.metadata.date.showPrefix is defined and document.metadata.date.showPrefix == true else "ons-u-vh" %}
57
+ <span class="{{ prefixClasses }}">{{ document.metadata.date.prefix | default("Published") }}: </span>
58
+ {%- endif -%}
59
+ {% if document.metadata.date.iso is defined and document.metadata.date.iso -%}
60
+ <time datetime="{{ document.metadata.date.iso }}">{{ document.metadata.date.short }}</time>
61
+ {%- endif %}
62
+ </li>
63
+ {% endif %}
64
+
65
+ {%- if document.metadata.type is defined and document.metadata.type and document.metadata.type.text is defined and document.metadata.type.text %}
66
+ <li class="ons-document-list__item-attribute{%- if document.metadata.file is defined and document.metadata.file %} ons-u-mr-no{% endif %}">
67
+ {%- if document.metadata.type.url is defined and document.metadata.type.url %}
68
+ <a class="ons-document-list__attribute-link" href="{{ document.metadata.type.url }}">
69
+ {% endif %}
70
+ <span {% if not document.metadata.file and not document.metadata.type.url %}class="ons-u-fw-b"{% endif %}>{{ document.metadata.type.text }}{%- if document.metadata.type.ref is defined and document.metadata.type.ref %}: {% elif document.metadata.file is defined and document.metadata.file %},{% endif %}</span>
71
+ {%- if document.metadata.type.url is defined and document.metadata.type.url %}
72
+ </a>
73
+ {% endif %}
74
+ {%- if document.metadata.type.ref is defined and document.metadata.type.ref %}
75
+ <span>{{ document.metadata.type.ref }}</span>
76
+ {% endif %}
77
+ </li>
78
+ {% endif %}
79
+
80
+ {%- if document.metadata.file is defined and document.metadata.file and document.metadata.file.fileType is defined and document.metadata.file.fileType %}
81
+
82
+ <li class="ons-document-list__item-attribute" aria-hidden="true">
83
+ {% set fileMetadataItems = [] %}
84
+
85
+ {% if document.metadata.file.fileType is defined and document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType), fileMetadataItems) %}{% endif %}
86
+ {% if document.metadata.file.fileSize is defined and document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
87
+ {% if document.metadata.file.filePages is defined and document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
88
+
89
+ {{ fileMetadataItems | join(', ') }}
90
+ </li>
91
+
92
+ {% endif -%}
93
+ </ul>
94
+
95
+ {% endif %}
96
+ </div>
97
+
98
+ {% if document.description is defined and document.description %}
99
+ <div class="ons-document-list__item-description">{{ document.description | safe }}</div>
100
+ {% endif %}
101
+
102
+ </div>
103
+
104
+ {% if document.fullWidth is defined and document.fullWidth == true %}
105
+
106
+ </div>
107
+
108
+ {% endif %}
109
+
110
+ </li>
111
+ {% endfor %}
112
+ </ul>
113
+
114
+ {% endmacro %}
@@ -0,0 +1,182 @@
1
+ .ons-document-list {
2
+ @extend .ons-list--bare;
3
+
4
+ margin-bottom: 0;
5
+
6
+ &__item {
7
+ border-bottom: 1px solid $color-borders-list;
8
+ margin: 0 0 1.5rem;
9
+ padding: 0 0 1.5rem;
10
+
11
+ @include mq(xs) {
12
+ align-items: flex-start;
13
+ display: flex;
14
+ }
15
+
16
+ &:last-of-type {
17
+ border-bottom: 0;
18
+ margin: 0;
19
+ }
20
+ }
21
+
22
+ &__item-image {
23
+ flex: 0 0 auto;
24
+ margin-bottom: 1rem;
25
+ width: 136px;
26
+
27
+ @include mq(xs) {
28
+ margin-right: 1.5rem;
29
+ }
30
+
31
+ @include mq(m) {
32
+ margin-bottom: 0;
33
+ }
34
+ }
35
+
36
+ &__item-image & {
37
+ &__image-link {
38
+ &--placeholder {
39
+ height: 96px;
40
+ }
41
+ }
42
+ }
43
+
44
+ &__item-image--file {
45
+ width: 96px;
46
+ }
47
+
48
+ &__item-image--file & {
49
+ &__image-link {
50
+ border-color: $color-borders-document-image;
51
+
52
+ &--placeholder {
53
+ height: 136px;
54
+ }
55
+ }
56
+ }
57
+
58
+ &__image-link {
59
+ border: 2px solid transparent;
60
+ box-sizing: content-box;
61
+ display: block;
62
+ width: 100%;
63
+
64
+ &:focus {
65
+ background-color: $color-placeholder !important;
66
+ border: 2px solid $color-borders-document-image-focus;
67
+ box-shadow: none;
68
+ outline: 4px solid $color-focus !important;
69
+ outline-offset: 0;
70
+ }
71
+
72
+ &--placeholder {
73
+ background-clip: padding-box;
74
+ background-color: $color-borders-document-image;
75
+ background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e%3cpath fill='%23fff' d='M0 19.39c.49-1 1-2 1.55-2.93A31.59 31.59 0 0 1 0 11.72v7.67ZM3 0S0 0 0 3.7v2a34.85 34.85 0 0 0 2.17 9.76A31.2 31.2 0 0 1 8.3 8.3c4.84-4.16 11.36-7 20.21-8.29Zm28.84 2c-10.11 1-17 3.86-22 8.1a29.78 29.78 0 0 0-6.49 8C7.26 25.65 14.66 31.19 27 32h1.21A3.71 3.71 0 0 0 32 27.91V2a.41.41 0 0 1-.16 0Zm-26 21.49a25.94 25.94 0 0 1-3-4.4A48 48 0 0 0 0 25.71V32h20.23a26.41 26.41 0 0 1-14.39-8.49Z'/%3e%3c/svg%3e");
76
+ background-position: center;
77
+ background-repeat: no-repeat;
78
+ background-size: 32px 32px;
79
+ height: 100%;
80
+ }
81
+ }
82
+
83
+ &__item-metadata {
84
+ @extend .ons-list--bare;
85
+
86
+ line-height: 1.2 !important;
87
+ }
88
+
89
+ &__item-attribute {
90
+ color: $color-text-metadata;
91
+ display: inline-block;
92
+ margin: 0 1rem 0 0;
93
+
94
+ @extend .ons-u-fs-s;
95
+ }
96
+
97
+ &__attribute-link {
98
+ color: inherit;
99
+
100
+ &:hover {
101
+ color: $color-text-metadata;
102
+ text-decoration: underline solid $color-text-metadata 2px;
103
+ }
104
+ }
105
+
106
+ &__item-description {
107
+ margin-bottom: 0;
108
+ max-width: 660px; // Equivalent to 8 Columns
109
+
110
+ p:last-of-type {
111
+ margin-bottom: 0;
112
+ }
113
+ }
114
+ }
115
+
116
+ // Featured document
117
+ .ons-document-list {
118
+ &__item {
119
+ &--featured {
120
+ background-color: $color-banner-bg;
121
+ border-bottom: none;
122
+ display: block;
123
+ padding: 2rem;
124
+
125
+ @include mq(m) {
126
+ align-items: flex-start;
127
+ display: flex;
128
+
129
+ .ons-container {
130
+ display: flex;
131
+ }
132
+ }
133
+
134
+ // Increase thumbnail image size
135
+ .ons-document-list__item-image {
136
+ width: 248px;
137
+
138
+ & &__image-link {
139
+ &--placeholder {
140
+ height: 96px;
141
+ }
142
+ }
143
+
144
+ @include mq(m) {
145
+ margin-right: 2.5rem;
146
+ width: 379px;
147
+
148
+ & &__image-link {
149
+ &--placeholder {
150
+ height: 248px;
151
+ }
152
+ }
153
+ }
154
+ }
155
+
156
+ // Show metadata above title
157
+ .ons-document-list__item-header {
158
+ &--reverse {
159
+ display: flex;
160
+ flex-direction: column-reverse;
161
+ margin-bottom: 0.5rem;
162
+ }
163
+ }
164
+
165
+ // Increase font size
166
+ .ons-document-list__item-title {
167
+ @extend .ons-u-fs-l;
168
+ }
169
+
170
+ // If featured item is first in same list
171
+ & + .ons-document-list__item {
172
+ border-top: none;
173
+ margin-top: 0;
174
+ }
175
+ }
176
+
177
+ // If featured item is full width
178
+ &--full-width {
179
+ padding: 2rem 0;
180
+ }
181
+ }
182
+ }
@@ -1,8 +1,9 @@
1
1
  .ons-adv-filter {
2
2
  &__gallery {
3
- border-top: 1px solid $color-grey-15;
3
+ border-top: 1px solid $color-borders-list;
4
4
  margin-left: 0;
5
5
  padding-left: 0;
6
+ padding-top: 1.5rem;
6
7
  }
7
8
 
8
9
  &__item {
@@ -137,14 +138,6 @@ body:not(.ons-js-enabled) {
137
138
  }
138
139
  }
139
140
 
140
- .ons-filter__item {
141
- border-bottom: 1px solid $color-grey-15;
142
- display: block; // Accessible way of removing bullets (don’t use list-style-type: none; https://github.com/jensimmons/cssremedy/issues/15#issuecomment-462174177)
143
- margin-bottom: 0; // Reset default margin bottom on list items
144
- padding-bottom: 1.5rem;
145
- padding-top: 1.5rem;
146
- }
147
-
148
141
  // Prevent scrollbars on body
149
142
  .ons-no-scroll {
150
143
  overflow-y: hidden;
@@ -920,8 +920,8 @@ Math.easeInOutQuad = function(t, b, c, d) {
920
920
  }
921
921
 
922
922
  function getInputListLabel(section, inputs) {
923
- let counter = 0;
924
- label = '';
923
+ let counter = 0,
924
+ label = '';
925
925
  for (let i = 0; i < inputs.length; i++) {
926
926
  if (inputs[i].checked) {
927
927
  let labelElement = inputs[i].parentNode.getElementsByTagName('label');
@@ -14,7 +14,6 @@
14
14
  {% call onsPanel({
15
15
  "type": "error",
16
16
  "id": params.id,
17
- "classes": "ons-u-mb-s",
18
17
  "dsExample": params.dsExample
19
18
  }) %}
20
19
  {{ content | safe }}
@@ -70,6 +70,14 @@
70
70
  }
71
71
 
72
72
  .ons-header-service-nav {
73
+ display: inline-block;
74
+
75
+ &--mobile {
76
+ background: $color-branded-tint;
77
+ padding: 1rem;
78
+ width: 100%;
79
+ }
80
+
73
81
  &__list {
74
82
  list-style: none;
75
83
  margin: 0;
@@ -79,9 +87,22 @@
79
87
  &__item {
80
88
  display: inline-block;
81
89
  margin: 0 0 0 1rem;
82
-
90
+ &--mobile {
91
+ display: block;
92
+ margin: 0 0 0.5rem;
93
+ }
83
94
  &:first-child {
84
95
  margin-left: 0;
85
96
  }
86
97
  }
98
+
99
+ .ons-language-links {
100
+ border-top: 1px solid $color-branded;
101
+ margin: 1.5rem 0 0;
102
+ padding: 1rem 0 0;
103
+
104
+ &__item {
105
+ margin: 0 0 0.5rem;
106
+ }
107
+ }
87
108
  }
@@ -44,9 +44,6 @@
44
44
  border-top: 3px solid $color-header;
45
45
  padding: 0.934rem 0;
46
46
  }
47
- &--with-description {
48
- height: auto;
49
- }
50
47
  }
51
48
  &__title {
52
49
  @extend .ons-u-fs-r--b;
@@ -59,13 +56,6 @@
59
56
  margin-top: 0.8rem;
60
57
  }
61
58
 
62
- &--with-description {
63
- @include mq(m) {
64
- margin-bottom: 0;
65
- margin-top: 0.5rem;
66
- }
67
- }
68
-
69
59
  //to allow for differences in size between welsh and english logos
70
60
  &-census-logo-en {
71
61
  @include mq(xxs) {
@@ -94,7 +84,7 @@
94
84
  }
95
85
  }
96
86
  }
97
- &__desc {
87
+ &__description {
98
88
  @extend .ons-u-fs-s;
99
89
  @extend .ons-u-fs-r\@s;
100
90
 
@@ -105,12 +95,14 @@
105
95
  margin: 0 0 1.1rem;
106
96
  }
107
97
  }
108
- // Modifier - Hero variant
109
- &--hero {
98
+ // Modifier - variants
99
+ &--description {
110
100
  .ons-header {
111
101
  &__title {
112
102
  @extend .ons-u-fs-m;
113
103
  @extend .ons-u-fs-xxl\@m;
104
+
105
+ margin-bottom: 0;
114
106
  }
115
107
  }
116
108
  }
@@ -135,11 +127,11 @@
135
127
  }
136
128
  &__grid-top {
137
129
  min-height: 36px;
138
- }
139
- &-service-nav__link {
140
- color: $color-white;
141
- &:hover {
142
- text-decoration: underline solid $color-white 3px;
130
+ a {
131
+ color: $color-white;
132
+ &:hover {
133
+ text-decoration: underline solid $color-white 3px;
134
+ }
143
135
  }
144
136
  }
145
137
  }
@@ -157,13 +149,13 @@
157
149
  }
158
150
 
159
151
  .ons-header__logo--large {
160
- @include mq(xxs, 399px) {
152
+ @include mq(xxs, 454px) {
161
153
  display: none;
162
154
  }
163
155
  }
164
156
 
165
157
  .ons-header__logo--small {
166
- @include mq(400px) {
158
+ @include mq(455px) {
167
159
  display: none;
168
160
  }
169
161
  }