@ons/design-system 74.0.0-next.1 → 74.0.0-next.10
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.
- package/README.md +15 -3
- package/components/access-code/example-access-code-error.njk +1 -1
- package/components/access-code/example-access-code.njk +1 -1
- package/components/address-input/autosuggest.address.spec.js +23 -0
- package/components/autosuggest/autosuggest.ui.js +3 -0
- package/components/back-to-top/example-full-page-back-to-top.njk +1 -1
- package/components/breadcrumbs/_breadcrumbs.scss +4 -7
- package/components/breadcrumbs/_macro.njk +29 -25
- package/components/breadcrumbs/_macro.spec.js +39 -0
- package/components/breadcrumbs/example-breadcrumbs-wide.njk +52 -0
- package/components/chart/_chart.scss +0 -9
- package/components/chart/_macro.njk +96 -128
- package/components/chart/_macro.spec.js +43 -28
- package/components/chart/example-area-chart-with-axis-min-and-max-values.njk +6 -3
- package/components/chart/example-area-chart.njk +6 -3
- package/components/chart/example-bar-chart-with-annotations.njk +6 -3
- package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +6 -3
- package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +6 -3
- package/components/chart/example-bar-chart.njk +6 -3
- package/components/chart/example-bar-with-confidence-levels.njk +6 -3
- package/components/chart/example-clustered-bar-chart.njk +6 -3
- package/components/chart/example-clustered-column-chart.njk +6 -3
- package/components/chart/example-column-chart-with-annotations.njk +6 -3
- package/components/chart/example-column-chart-with-axis-min-and-max-values.njk +6 -3
- package/components/chart/example-column-chart-with-custom-reference-line-value.njk +6 -3
- package/components/chart/example-column-chart-with-range-annotations.njk +6 -3
- package/components/chart/example-column-chart-with-reference-line-annotations.njk +6 -3
- package/components/chart/example-column-chart.njk +6 -3
- package/components/chart/example-column-with-confidence-levels.njk +6 -3
- package/components/chart/example-column-with-line-chart.njk +6 -3
- package/components/chart/example-iframe-chart.njk +6 -3
- package/components/chart/example-line-chart-with-annotations.njk +6 -3
- package/components/chart/example-line-chart-with-axis-min-and-max-values.njk +6 -3
- package/components/chart/example-line-chart-with-custom-reference-line-value.njk +6 -3
- package/components/chart/example-line-chart-with-label-format.njk +6 -3
- package/components/chart/example-line-chart-with-markers.njk +6 -3
- package/components/chart/example-line-chart-with-range-annotations-inside.njk +6 -3
- package/components/chart/example-line-chart-with-range-annotations-outside-left-right.njk +6 -3
- package/components/chart/example-line-chart-with-range-annotations-outside-top-bottom.njk +6 -3
- package/components/chart/example-line-chart-with-reference-line-annotations.njk +6 -3
- package/components/chart/example-line-chart.njk +6 -3
- package/components/chart/example-scatter-chart-with-axis-min-and-max-values.njk +6 -3
- package/components/chart/example-scatter-chart.njk +6 -3
- package/components/chart/example-stacked-bar-chart.njk +6 -3
- package/components/chart/example-stacked-column-chart.njk +6 -3
- package/components/document-list/_macro.njk +2 -2
- package/components/document-list/_macro.spec.js +55 -0
- package/components/featured-article/_macro.njk +3 -37
- package/components/featured-article/example-featured-article-with-chart.njk +19 -14
- package/components/featured-article/example-featured-article-with-image.njk +12 -7
- package/components/featured-article/featured-article.scss +1 -1
- package/components/featured-article/macro.spec.js +44 -67
- package/components/figure/_figure.scss +31 -0
- package/components/figure/_macro.njk +98 -0
- package/components/figure/_macro.spec.js +520 -0
- package/components/figure/example-figure-heading-level-2.njk +34 -0
- package/components/figure/example-figure-with-div.njk +29 -0
- package/components/figure/example-figure-without-footer.njk +12 -0
- package/components/figure/example-figure-without-header.njk +24 -0
- package/components/figure/example-figure.njk +34 -0
- package/components/header/_header.scss +1 -3
- package/components/header/_macro.njk +8 -4
- package/components/header/_macro.spec.js +48 -0
- package/components/hero/_macro.njk +3 -2
- package/components/hero/_macro.spec.js +36 -0
- package/components/hero/example-hero-dark-wide.njk +17 -0
- package/components/hero/example-hero-dark-with-external-breadcrumbs.njk +17 -21
- package/components/hero/example-hero-default-full-width.njk +16 -0
- package/components/hero/example-hero-default-with-external-breadcrumbs.njk +165 -169
- package/components/hero/example-hero-grey-with-external-breadcrumbs.njk +207 -211
- package/components/hero/example-hero-navy-blue-with-external-breadcrumbs.njk +163 -167
- package/components/hero/example-hero-pale-blue-with-external-breadcrumbs.njk +165 -169
- package/components/image/_image.scss +0 -7
- package/components/image/_macro.njk +25 -14
- package/components/image/_macro.spec.js +122 -7
- package/components/image/example-image-with-figure-fields.njk +25 -0
- package/components/list/_macro.njk +1 -0
- package/components/list/_macro.spec.js +16 -0
- package/components/question/example-question-ccs.njk +1 -1
- package/components/question/example-question-fieldset.njk +1 -1
- package/components/question/example-question-interviewer-note.njk +1 -1
- package/components/question/example-question-no-fieldset.njk +1 -1
- package/components/relationships/example-relationships-error.njk +1 -1
- package/components/relationships/example-relationships-you.njk +1 -1
- package/components/relationships/example-relationships.njk +1 -1
- package/components/table/_macro.njk +138 -111
- package/components/table/_macro.spec.js +175 -16
- package/components/table/_table.scss +6 -1
- package/components/table/example-table-basic-no-caption.njk +46 -0
- package/components/table/example-table-basic-visually-hidden-caption.njk +47 -0
- package/components/table/example-table-with-figure-fields.njk +86 -0
- package/components/table/table.spec.js +2 -0
- package/components/table-of-contents/_macro.njk +6 -4
- package/components/table-of-contents/_macro.spec.js +43 -3
- package/components/table-of-contents/example-table-of-contents-ordered.njk +64 -0
- package/components/table-of-contents/example-table-of-contents-sticky-full-page-ordered.njk +156 -0
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
- package/components/table-of-contents/table-of-contents.spec.js +4 -5
- package/css/main.css +1 -1
- package/layout/_template.njk +66 -46
- package/package.json +45 -36
- package/scripts/main.es5.js +3 -3
- package/scripts/main.js +2 -2
- package/scss/base/_global.scss +8 -0
- package/scss/main.scss +1 -0
- package/scss/objects/_page.scss +1 -1
- package/scss/objects/_spacing.scss +0 -4
package/README.md
CHANGED
|
@@ -143,11 +143,23 @@ Checkout the branch locally and run:
|
|
|
143
143
|
|
|
144
144
|
`yarn test-visual` - This will run the same tests locally as were run in Github Actions. After they have completed the report will open in your default browser.
|
|
145
145
|
|
|
146
|
+
`VR_SHARD_INDEX=0 VR_SHARD_COUNT=4 yarn test-visual` - This runs only one shard of the visual tests locally. Useful when one shard fails in CI.
|
|
147
|
+
|
|
148
|
+
### Handling VR test failures
|
|
149
|
+
|
|
150
|
+
If the VR tests fail locally, you'll see an error starting with `Error: docker run --rm -i --add-host=host.docker.internal:host-gateway...`
|
|
151
|
+
|
|
152
|
+
`npx http-server backstop_data -p 8008 -o /html_report/` - View the report in your browser.
|
|
153
|
+
|
|
154
|
+
### Approving VR test reference image changes
|
|
155
|
+
|
|
146
156
|
`yarn test-visual:approve` - This will approve the failures/diff caught by the tests.
|
|
147
157
|
|
|
148
|
-
|
|
158
|
+
Commit and approve the file changes in the normal way.
|
|
159
|
+
|
|
160
|
+
`git lfs push --all origin` - This will push the new reference images to Git LFS.
|
|
149
161
|
|
|
150
|
-
You can then
|
|
162
|
+
You can then push the updated references and your changes to your branch. The test images that would have been created when you ran `yarn test-visual` are gitignored and the new references images will be pushed to Git LFS.
|
|
151
163
|
|
|
152
164
|
If your local tests are failing but you have approved them, run `yarn test-visual:reference`. This will update the reference images locally on your machine.
|
|
153
165
|
|
|
@@ -176,7 +188,7 @@ yarn add @ons/design-system@next
|
|
|
176
188
|
|
|
177
189
|
### Publishing the stable major
|
|
178
190
|
|
|
179
|
-
1. Merge `next` into `main`.
|
|
191
|
+
1. Merge `next` into `main`. **Do not squash; use a regular merge commit to preserve history.**
|
|
180
192
|
2. Create a normal release tag, for example: `74.0.0`.
|
|
181
193
|
3. Publish the GitHub Release (not marked as a pre-release).
|
|
182
194
|
|
|
@@ -411,6 +411,29 @@ describe('script: address-input', () => {
|
|
|
411
411
|
});
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
|
+
|
|
415
|
+
describe('when a grouped suggestion is selected with the mouse', () => {
|
|
416
|
+
beforeEach(async () => {
|
|
417
|
+
const options = await page.$$('.ons-autosuggest__option');
|
|
418
|
+
await options[0].click();
|
|
419
|
+
await setTimeout(400);
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
it('makes expected bucket request', async () => {
|
|
423
|
+
expect(
|
|
424
|
+
await apiFaker.getRequestCount(
|
|
425
|
+
'/addresses/eq/bucket?postcode=CF14%202AA&streetname=Penlline%20Road&townname=Whitchurch&groupfullpostcodes=combo',
|
|
426
|
+
),
|
|
427
|
+
).toBe(1);
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
it('keeps nested suggestion entries after blur timeout', async () => {
|
|
431
|
+
const suggestions = await page.$$eval('.ons-autosuggest__option', (nodes) =>
|
|
432
|
+
nodes.map((node) => node.textContent.trim()),
|
|
433
|
+
);
|
|
434
|
+
expect(suggestions).toEqual(['197 College Road, Whitchurch, Cardiff, CF14 2AB']);
|
|
435
|
+
});
|
|
436
|
+
});
|
|
414
437
|
});
|
|
415
438
|
|
|
416
439
|
describe('when there is an error retrieving the address', () => {
|
|
@@ -201,6 +201,8 @@ export default class AutosuggestUI {
|
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
handleFocus() {
|
|
204
|
+
this.blurring = false;
|
|
205
|
+
|
|
204
206
|
if (this.allowMultiple === 'true' && this.allSelections.length && this.input.value.slice(-1) !== ' ' && this.input.value !== '') {
|
|
205
207
|
this.input.value = `${this.input.value}, `;
|
|
206
208
|
}
|
|
@@ -513,6 +515,7 @@ export default class AutosuggestUI {
|
|
|
513
515
|
|
|
514
516
|
selectResult(index) {
|
|
515
517
|
if (this.results.length) {
|
|
518
|
+
clearTimeout(this.blurTimeout);
|
|
516
519
|
this.settingResult = true;
|
|
517
520
|
const result = this.results[index || this.highlightedResultIndex || 0];
|
|
518
521
|
const resultItem = result.item ?? result;
|
|
@@ -3,7 +3,7 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
3
3
|
.ons-breadcrumbs-wrapper {
|
|
4
4
|
position: relative;
|
|
5
5
|
z-index: 10;
|
|
6
|
-
margin-bottom: -
|
|
6
|
+
margin-bottom: -1rem;
|
|
7
7
|
&--grey {
|
|
8
8
|
background-color: var(--ons-color-banner-bg);
|
|
9
9
|
}
|
|
@@ -14,9 +14,9 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
14
14
|
|
|
15
15
|
&--navy-blue {
|
|
16
16
|
background-color: var(--ons-color-navy-blue-light);
|
|
17
|
-
margin-bottom: -
|
|
17
|
+
margin-bottom: -0.75rem;
|
|
18
18
|
@include mq(l) {
|
|
19
|
-
margin-bottom: -
|
|
19
|
+
margin-bottom: -2.25rem;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
@@ -48,15 +48,12 @@ $breadcrumb-chevron-height: 0.65rem;
|
|
|
48
48
|
&--pale-blue {
|
|
49
49
|
background-color: var(--ons-color-pale-blue);
|
|
50
50
|
}
|
|
51
|
-
.ons-breadcrumbs {
|
|
52
|
-
padding: 1rem;
|
|
53
|
-
}
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
.ons-breadcrumbs {
|
|
57
54
|
align-items: center;
|
|
58
55
|
display: flex;
|
|
59
|
-
padding: 1rem 0;
|
|
56
|
+
padding: 1rem 0 0;
|
|
60
57
|
|
|
61
58
|
&__items {
|
|
62
59
|
margin: 0;
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
2
2
|
{% macro onsBreadcrumbs(params) %}
|
|
3
3
|
{% set breadcrumbs %}
|
|
4
|
-
<
|
|
5
|
-
class="ons-
|
|
6
|
-
aria-label="{{ params.ariaLabel | default('Breadcrumbs') }}"
|
|
7
|
-
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
4
|
+
<div
|
|
5
|
+
class="ons-container{{ ' ons-container--full-width' if params.fullWidth else "" }}{{ ' ons-container--wide' if params.wide else "" }}"
|
|
8
6
|
>
|
|
9
|
-
<
|
|
10
|
-
{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ ' ' }}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
20
|
-
>{{ item.text }}</a
|
|
7
|
+
<nav
|
|
8
|
+
class="ons-breadcrumbs{{ ' ' + params.classes if params.classes else '' }}"
|
|
9
|
+
aria-label="{{ params.ariaLabel | default('Breadcrumbs') }}"
|
|
10
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
11
|
+
>
|
|
12
|
+
<ol class="ons-breadcrumbs__items ons-u-fs-s">
|
|
13
|
+
{%- for item in params.itemsList -%}
|
|
14
|
+
<li
|
|
15
|
+
class="ons-breadcrumbs__item{{ ' ' + item.itemClasses if item.itemClasses else '' }}"
|
|
16
|
+
id="breadcrumb-{{ loop.index }}"
|
|
21
17
|
>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
18
|
+
<a
|
|
19
|
+
class="ons-breadcrumbs__link{{ ' ' + item.linkClasses if item.linkClasses else '' }}"
|
|
20
|
+
href="{% if not isDesignSystemExample %}{{ item.url }}{% else %}#0{% endif %}"
|
|
21
|
+
{% if item.id %}{{ ' ' }}id='{{ item.id }}'{% endif %}
|
|
22
|
+
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ ' ' }}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
23
|
+
>{{ item.text }}</a
|
|
24
|
+
>
|
|
25
|
+
{{-
|
|
26
|
+
onsIcon({
|
|
27
|
+
"iconType": "chevron"
|
|
28
|
+
})
|
|
29
|
+
-}}
|
|
30
|
+
</li>
|
|
31
|
+
{%- endfor -%}
|
|
32
|
+
</ol>
|
|
33
|
+
</nav>
|
|
34
|
+
</div>
|
|
31
35
|
{% endset %}
|
|
32
36
|
{% if params.variant %}
|
|
33
37
|
<div class="ons-breadcrumbs-wrapper ons-breadcrumbs-wrapper--{{ params.variant }}">{{ breadcrumbs | safe }}</div>
|
|
@@ -133,6 +133,45 @@ describe('FOR: Macro: Breadcrumbs', () => {
|
|
|
133
133
|
});
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
+
describe('GIVEN: Params: fullWidth', () => {
|
|
137
|
+
describe('WHEN: fullWidth is not provided', () => {
|
|
138
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS));
|
|
139
|
+
test('THEN: renders container without full-width class', () => {
|
|
140
|
+
expect($('.ons-container').hasClass('ons-container--full-width')).toBe(false);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe('WHEN: fullWidth is set to true', () => {
|
|
144
|
+
const $ = cheerio.load(
|
|
145
|
+
renderComponent('breadcrumbs', {
|
|
146
|
+
...EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS,
|
|
147
|
+
fullWidth: true,
|
|
148
|
+
}),
|
|
149
|
+
);
|
|
150
|
+
test('THEN: renders container with full-width class', () => {
|
|
151
|
+
expect($('.ons-container').hasClass('ons-container--full-width')).toBe(true);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe('GIVEN: Params: wide', () => {
|
|
156
|
+
describe('WHEN: wide is not provided', () => {
|
|
157
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS));
|
|
158
|
+
test('THEN: renders container without wide class', () => {
|
|
159
|
+
expect($('.ons-container').hasClass('ons-container--wide')).toBe(false);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe('WHEN: wide is set to true', () => {
|
|
163
|
+
const $ = cheerio.load(
|
|
164
|
+
renderComponent('breadcrumbs', {
|
|
165
|
+
...EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS,
|
|
166
|
+
wide: true,
|
|
167
|
+
}),
|
|
168
|
+
);
|
|
169
|
+
test('THEN: renders container with wide class', () => {
|
|
170
|
+
expect($('.ons-container').hasClass('ons-container--wide')).toBe(true);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
136
175
|
describe('GIVEN: Params: variant', () => {
|
|
137
176
|
describe('WHEN: variant is provided', () => {
|
|
138
177
|
const $ = cheerio.load(
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: 'Example: Breadcrumbs override wide'
|
|
3
|
+
layout: ~
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
{% from "components/hero/_macro.njk" import onsHero %}
|
|
7
|
+
{% from "components/breadcrumbs/_macro.njk" import onsBreadcrumbs %}
|
|
8
|
+
{% extends "layout/_template.njk" %}
|
|
9
|
+
{%
|
|
10
|
+
set pageConfig = {
|
|
11
|
+
"header": {
|
|
12
|
+
"title": 'Service title',
|
|
13
|
+
"mastheadLogoUrl": '#0',
|
|
14
|
+
"titleUrl": '#0',
|
|
15
|
+
"serviceLinks": {
|
|
16
|
+
"id": "service-links-internal",
|
|
17
|
+
"ariaLabel": 'Services menu',
|
|
18
|
+
"ariaListLabel": 'Menu',
|
|
19
|
+
"toggleServicesButton": {
|
|
20
|
+
"text": 'Account',
|
|
21
|
+
"ariaLabel": 'Toggle services menu'
|
|
22
|
+
},
|
|
23
|
+
"itemsList": [
|
|
24
|
+
{
|
|
25
|
+
"text": "Jacky Turner",
|
|
26
|
+
"iconType": 'person'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"text": "Sign out",
|
|
30
|
+
"url": "#0"
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"wide": true
|
|
36
|
+
}
|
|
37
|
+
%}
|
|
38
|
+
|
|
39
|
+
{% block breadcrumbs %}
|
|
40
|
+
{{
|
|
41
|
+
onsBreadcrumbs({
|
|
42
|
+
"wide": true,
|
|
43
|
+
"ariaLabel": 'Breadcrumbs',
|
|
44
|
+
"itemsList": [
|
|
45
|
+
{
|
|
46
|
+
"url": '/',
|
|
47
|
+
"text": 'Home'
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
})
|
|
51
|
+
}}
|
|
52
|
+
{% endblock %}
|
|
@@ -29,15 +29,6 @@
|
|
|
29
29
|
outline-offset: 2px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
&__download-title {
|
|
33
|
-
@extend .ons-u-pt-l;
|
|
34
|
-
@extend .ons-u-fs-r--b;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
&__caption {
|
|
38
|
-
color: var(--ons-color-grey-75);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
32
|
&__annotations-footnotes-number {
|
|
42
33
|
// !important is necessary for some range annotation labels at mobile, otherwise
|
|
43
34
|
// the inline-styled block display takes precedence. This inline style is only
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
{% from "components/list/_macro.njk" import onsList %}
|
|
2
|
-
{% from "components/details/_macro.njk" import onsDetails %}
|
|
3
|
-
|
|
4
1
|
{% macro onsChart(params) %}
|
|
2
|
+
{% from "components/figure/_macro.njk" import onsFigure %}
|
|
5
3
|
{% set supportedChartTypes = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
|
|
6
4
|
{% set supportedChartTypesWithLine = ['column'] %}
|
|
7
5
|
{% set supportedChartTypesWithScatter = ['columnrange'] %}
|
|
8
6
|
{% set supportedChartTypesWithXAxisMinAndMax = ['scatter'] %}
|
|
9
7
|
{% set supportedChartTypesWithYAxisMinAndMax = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
|
|
10
8
|
{% set supportedAspectRatios = ['16-9', '4-3', '21-9', '1-1', '3-2', '9-16'] %}
|
|
11
|
-
{% set headingLevel = params.headingLevel | default(2) %}
|
|
12
|
-
{% set openingTitleTag = "<h" ~ headingLevel %}
|
|
13
|
-
{% set closingTitleTag = "</h" ~ headingLevel ~ ">" %}
|
|
14
|
-
{% set openingSubtitleTag = "<h" ~ (headingLevel + 1) %}
|
|
15
|
-
{% set closingSubtitleTag = "</h" ~ (headingLevel + 1) ~ ">" %}
|
|
16
|
-
{% set openingDownloadTitleTag = "<h" ~ (headingLevel + 2) %}
|
|
17
|
-
{% set closingDownloadTitleTag = "</h" ~ (headingLevel + 2) ~ ">" %}
|
|
18
|
-
{% set audioDescriptionId = "chart-audio-description-" ~ params.id %}
|
|
19
9
|
{% set instructionsId = "chart-instructions-" ~ params.id %}
|
|
20
10
|
{% set iframeAspectRatio = params.iframeAspectRatio if params.iframeAspectRatio in supportedAspectRatios else '16-9' %}
|
|
21
11
|
{% set instructions = params.instructions | default('Use the Tab key to move focus into the chart. Once inside, use the arrow keys to navigate between data points. As you move, tooltips will be announced to describe each point. Touch device users, explore by touch or with swipe gestures.') %}
|
|
@@ -54,132 +44,110 @@
|
|
|
54
44
|
{% endif %}
|
|
55
45
|
{% endif %}
|
|
56
46
|
>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
src="{{ params.iframeUrl }}"
|
|
73
|
-
title="{{ params.title }}"
|
|
74
|
-
class="ons-chart__iframe ons-chart__iframe--{{ iframeAspectRatio }}"
|
|
75
|
-
frameborder="0"
|
|
76
|
-
scrolling="no"
|
|
77
|
-
></iframe>
|
|
78
|
-
</div>
|
|
79
|
-
{% else %}
|
|
80
|
-
{% if params.chartType == 'boxplot' and (params.estimateLineLabel or params.uncertaintyRangeLabel) and params.legend == true %}
|
|
81
|
-
<div class="ons-chart__boxplot-legend">
|
|
82
|
-
{% if params.uncertaintyRangeLabel %}
|
|
83
|
-
<div class="ons-chart__boxplot-legend-item">
|
|
84
|
-
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--uncertainty"></span>
|
|
85
|
-
<span class="ons-chart__boxplot-legend-label">{{ params.uncertaintyRangeLabel }}</span>
|
|
86
|
-
</div>
|
|
87
|
-
{% endif %}
|
|
88
|
-
{% if params.estimateLineLabel %}
|
|
89
|
-
<div class="ons-chart__boxplot-legend-item">
|
|
90
|
-
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--estimate"></span>
|
|
91
|
-
<span class="ons-chart__boxplot-legend-label">{{ params.estimateLineLabel }}</span>
|
|
92
|
-
</div>
|
|
93
|
-
{% endif %}
|
|
94
|
-
</div>
|
|
95
|
-
{% endif %}
|
|
96
|
-
{% if params.chartType in supportedChartTypes %}
|
|
47
|
+
{%
|
|
48
|
+
call onsFigure({
|
|
49
|
+
"id": params.id,
|
|
50
|
+
"headingLevel": params.headingLevel,
|
|
51
|
+
"figureNumber": params.figureNumber,
|
|
52
|
+
"title": params.title,
|
|
53
|
+
"subtitle": params.subtitle,
|
|
54
|
+
"audioDescription": params.description,
|
|
55
|
+
"caption": params.caption,
|
|
56
|
+
"footnotes": params.footnotes,
|
|
57
|
+
"download": params.download
|
|
58
|
+
})
|
|
59
|
+
%}
|
|
60
|
+
<div class="ons-chart">
|
|
61
|
+
{% if params.iframeUrl %}
|
|
97
62
|
<div
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
tabindex="0"
|
|
101
|
-
role="region"
|
|
102
|
-
aria-label="chart container"
|
|
103
|
-
aria-describedby="{{ instructionsId }}"
|
|
63
|
+
class="ons-chart__iframe-wrapper{{ ' ons-chart__non-js-hide' if params.fallbackImageUrl else '' }}"
|
|
64
|
+
id="iframe--{{ params.id }}"
|
|
104
65
|
>
|
|
105
|
-
<
|
|
106
|
-
|
|
66
|
+
<iframe
|
|
67
|
+
src="{{ params.iframeUrl }}"
|
|
68
|
+
title="{{ params.title }}"
|
|
69
|
+
class="ons-chart__iframe ons-chart__iframe--{{ iframeAspectRatio }}"
|
|
70
|
+
frameborder="0"
|
|
71
|
+
scrolling="no"
|
|
72
|
+
></iframe>
|
|
107
73
|
</div>
|
|
108
74
|
{% else %}
|
|
109
|
-
|
|
110
|
-
<
|
|
111
|
-
|
|
75
|
+
{% if params.chartType == 'boxplot' and (params.estimateLineLabel or params.uncertaintyRangeLabel) and params.legend == true %}
|
|
76
|
+
<div class="ons-chart__boxplot-legend">
|
|
77
|
+
{% if params.uncertaintyRangeLabel %}
|
|
78
|
+
<div class="ons-chart__boxplot-legend-item">
|
|
79
|
+
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--uncertainty"></span>
|
|
80
|
+
<span class="ons-chart__boxplot-legend-label">{{ params.uncertaintyRangeLabel }}</span>
|
|
81
|
+
</div>
|
|
82
|
+
{% endif %}
|
|
83
|
+
{% if params.estimateLineLabel %}
|
|
84
|
+
<div class="ons-chart__boxplot-legend-item">
|
|
85
|
+
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--estimate"></span>
|
|
86
|
+
<span class="ons-chart__boxplot-legend-label">{{ params.estimateLineLabel }}</span>
|
|
87
|
+
</div>
|
|
88
|
+
{% endif %}
|
|
89
|
+
</div>
|
|
90
|
+
{% endif %}
|
|
91
|
+
{% if params.chartType in supportedChartTypes %}
|
|
92
|
+
<div
|
|
93
|
+
data-highcharts-chart-container
|
|
94
|
+
class="ons-chart__container"
|
|
95
|
+
tabindex="0"
|
|
96
|
+
role="region"
|
|
97
|
+
aria-label="chart container"
|
|
98
|
+
aria-describedby="{{ instructionsId }}"
|
|
99
|
+
>
|
|
100
|
+
<div id="{{ instructionsId }}" class="ons-u-vh">{{ instructions }}</div>
|
|
101
|
+
<div data-highcharts-chart class="ons-chart__chart"></div>
|
|
102
|
+
</div>
|
|
103
|
+
{% else %}
|
|
104
|
+
<p data-invalid-chart-type data-unsupported-chart-text>
|
|
105
|
+
<b>{{ '"' + params.chartType + '" - ' + (params.unsupportedChartText or 'chart type is not supported') }}</b>
|
|
106
|
+
</p>
|
|
107
|
+
{% endif %}
|
|
112
108
|
{% endif %}
|
|
113
|
-
{% endif %}
|
|
114
109
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
110
|
+
{% if params.fallbackImageUrl %}
|
|
111
|
+
{% set fallbackImageId = ["fallback-image--", params.id] | join %}
|
|
112
|
+
<noscript id="{{ fallbackImageId }}">
|
|
113
|
+
{# Note that a more detailed description of the chart is provided in the figure's audio description #}
|
|
114
|
+
<img
|
|
115
|
+
src="{{ params.fallbackImageUrl }}"
|
|
116
|
+
alt="{{ params.fallbackImageAlt or 'Fallback image for the chart as JavaScript is disabled' }}"
|
|
117
|
+
class="ons-chart__fallback-image"
|
|
118
|
+
/>
|
|
119
|
+
</noscript>
|
|
120
|
+
{% endif %}
|
|
121
|
+
{#
|
|
127
122
|
Footnotes for the annotations at mobile
|
|
128
123
|
Hidden from screen readers because the full text will be read out where they appear in the chart
|
|
129
124
|
#}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
{% endif %}
|
|
157
|
-
</figure>
|
|
158
|
-
|
|
159
|
-
{% if params.download.title and params.download.itemsList | length > 0 %}
|
|
160
|
-
{{ openingDownloadTitleTag | safe }}
|
|
161
|
-
class="ons-chart__download-title">{{ params.download.title }}{{ closingDownloadTitleTag | safe }}
|
|
162
|
-
{{
|
|
163
|
-
onsList({
|
|
164
|
-
"element": "ol",
|
|
165
|
-
"itemsList": params.download.itemsList
|
|
166
|
-
})
|
|
167
|
-
}}
|
|
168
|
-
{% endif %}
|
|
169
|
-
|
|
170
|
-
{% if params.footnotes %}
|
|
171
|
-
{% set footnotesId = ["footnotes--", params.id] | join %}
|
|
172
|
-
|
|
173
|
-
{{
|
|
174
|
-
onsDetails({
|
|
175
|
-
"id": footnotesId,
|
|
176
|
-
"title": params.footnotes.title,
|
|
177
|
-
"content": params.footnotes.content,
|
|
178
|
-
"headingLevel": headingLevel + 2,
|
|
179
|
-
"classes": "ons-u-mt-xl"
|
|
180
|
-
})
|
|
181
|
-
}}
|
|
182
|
-
{% endif %}
|
|
125
|
+
{% if (params.annotations or params.rangeAnnotations or params.referenceLineAnnotations) and not params.iframeUrl %}
|
|
126
|
+
<ul class="ons-chart__annotations-footnotes" aria-hidden="true" data-annotations-footnotes>
|
|
127
|
+
{% for annotation in params.annotations %}
|
|
128
|
+
<li class="ons-chart__annotations-footnotes_item">
|
|
129
|
+
<span class="ons-chart__annotations-footnotes-number">{{ loop.index }}</span>
|
|
130
|
+
{{ annotation.text }}
|
|
131
|
+
</li>
|
|
132
|
+
{% endfor %}
|
|
133
|
+
{% for rangeAnnotation in params.rangeAnnotations %}
|
|
134
|
+
<li class="ons-chart__annotations-footnotes_item">
|
|
135
|
+
<span class="ons-chart__annotations-footnotes-number">{{ loop.index + params.annotations | length }}</span>
|
|
136
|
+
{{ rangeAnnotation.text }}
|
|
137
|
+
</li>
|
|
138
|
+
{% endfor %}
|
|
139
|
+
{% for referenceLineAnnotation in params.referenceLineAnnotations %}
|
|
140
|
+
<li class="ons-chart__annotations-footnotes_item">
|
|
141
|
+
<span class="ons-chart__annotations-footnotes-number"
|
|
142
|
+
>{{ loop.index + params.annotations | length + params.rangeAnnotations | length }}</span
|
|
143
|
+
>
|
|
144
|
+
{{ referenceLineAnnotation.text }}
|
|
145
|
+
</li>
|
|
146
|
+
{% endfor %}
|
|
147
|
+
</ul>
|
|
148
|
+
{% endif %}
|
|
149
|
+
</div>
|
|
150
|
+
{% endcall %}
|
|
183
151
|
|
|
184
152
|
{% if (params.chartType in supportedChartTypes) and not params.iframeUrl %}
|
|
185
153
|
{% set series = [] %}
|