@ons/design-system 53.1.1 → 54.0.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.
- package/components/accordion/_macro.njk +2 -3
- package/components/accordion/_macro.spec.js +3 -40
- package/components/accordion/accordion.dom.js +19 -0
- package/components/{collapsible/collapsible.group.js → accordion/accordion.js} +12 -5
- package/components/accordion/accordion.spec.js +56 -51
- package/components/collapsible/_collapsible.scss +58 -85
- package/components/collapsible/_macro.njk +6 -39
- package/components/collapsible/_macro.spec.js +0 -53
- package/components/collapsible/collapsible.dom.js +3 -12
- package/components/collapsible/collapsible.js +3 -45
- package/components/collapsible/collapsible.spec.js +6 -139
- package/components/cookies-banner/_cookies-banner.scss +15 -7
- package/components/cookies-banner/_macro.njk +66 -22
- package/components/cookies-banner/_macro.spec.js +172 -114
- package/components/cookies-banner/cookies-banner.js +35 -13
- package/components/cookies-banner/cookies-banner.spec.js +58 -54
- package/components/input/_macro.njk +20 -15
- package/components/input/_macro.spec.js +56 -0
- package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +2 -0
- package/components/mutually-exclusive/mutually-exclusive.number.spec.js +1 -0
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/js/main.js +1 -0
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +2 -2
- package/scss/objects/_page.scss +1 -1
|
@@ -2,20 +2,11 @@ import domready from '../../js/domready';
|
|
|
2
2
|
|
|
3
3
|
async function initialiseCollapsibles() {
|
|
4
4
|
const collapsibleComponents = [...document.querySelectorAll('.ons-js-collapsible')];
|
|
5
|
+
const accordionComponents = [...document.querySelectorAll('.ons-js-accordion')];
|
|
5
6
|
|
|
6
|
-
if (collapsibleComponents.length) {
|
|
7
|
-
const toggleAllButtons = [...document.querySelectorAll('.ons-js-collapsible-all')];
|
|
8
|
-
|
|
7
|
+
if (collapsibleComponents.length && !accordionComponents.length) {
|
|
9
8
|
const Collapsible = (await import('./collapsible')).default;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (toggleAllButtons.length) {
|
|
13
|
-
const CollapsibleGroup = (await import('./collapsible.group')).default;
|
|
14
|
-
|
|
15
|
-
toggleAllButtons.forEach(button => {
|
|
16
|
-
new CollapsibleGroup(button, collapsibles);
|
|
17
|
-
});
|
|
18
|
-
}
|
|
9
|
+
collapsibleComponents.map(element => new Collapsible(element));
|
|
19
10
|
}
|
|
20
11
|
}
|
|
21
12
|
|
|
@@ -2,79 +2,38 @@ export default class Collapsible {
|
|
|
2
2
|
constructor(collapsibleElement) {
|
|
3
3
|
this.saveState = collapsibleElement.getAttribute('data-save-state') === 'true';
|
|
4
4
|
this.open = collapsibleElement.getAttribute('data-open') === 'true';
|
|
5
|
-
|
|
6
|
-
// State
|
|
7
5
|
this.group = collapsibleElement.getAttribute('data-group');
|
|
8
|
-
this.isAccordion = collapsibleElement.classList.contains('ons-collapsible--accordion');
|
|
9
|
-
this.isSimpleAccordion = collapsibleElement.classList.contains('ons-collapsible--simple');
|
|
10
6
|
|
|
11
7
|
// Elements
|
|
12
8
|
this.collapsible = collapsibleElement;
|
|
13
9
|
this.collapsibleHeader = this.collapsible.querySelector('.ons-js-collapsible-heading');
|
|
14
|
-
this.content = this.collapsible.querySelector('.ons-js-collapsible-content');
|
|
15
|
-
this.button = this.collapsible.querySelector('.ons-js-collapsible-button');
|
|
16
|
-
this.buttonInner = this.collapsible.querySelector('.ons-js-collapsible-button-inner');
|
|
17
10
|
|
|
18
11
|
// Initialise
|
|
19
12
|
const collapsibleId = collapsibleElement.getAttribute('id');
|
|
20
13
|
|
|
21
|
-
if (this.button) {
|
|
22
|
-
this.button.addEventListener('click', this.toggle.bind(this));
|
|
23
|
-
this.button.setAttribute('aria-controls', collapsibleId);
|
|
24
|
-
this.button.classList.remove('ons-u-d-no');
|
|
25
|
-
this.buttonOpen = this.buttonInner.innerHTML.trim();
|
|
26
|
-
this.closeButton = this.collapsible.getAttribute('data-btn-close') || this.buttonOpen;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
this.collapsible.setAttribute('role', 'group');
|
|
30
|
-
this.collapsibleHeader.setAttribute('role', 'link');
|
|
31
|
-
this.collapsibleHeader.setAttribute('aria-controls', collapsibleId);
|
|
32
|
-
|
|
33
|
-
if (!this.isAccordion || this.isSimpleAccordion) {
|
|
34
|
-
this.collapsibleHeader.setAttribute('tabindex', 0);
|
|
35
|
-
}
|
|
36
14
|
if (localStorage.getItem(collapsibleId) || this.open) {
|
|
37
15
|
this.setOpen(true);
|
|
38
|
-
|
|
39
|
-
this.setOpen(false);
|
|
16
|
+
this.collapsible['setAttribute']('open', '');
|
|
40
17
|
}
|
|
41
18
|
|
|
42
19
|
this.collapsibleHeader.addEventListener('click', this.toggle.bind(this));
|
|
43
20
|
this.collapsibleHeader.addEventListener('keydown', this.keyboardInteraction.bind(this));
|
|
44
|
-
|
|
45
|
-
this.collapsible.classList.add('ons-collapsible--initialised');
|
|
46
21
|
}
|
|
47
22
|
|
|
48
23
|
toggle(event) {
|
|
49
24
|
event.preventDefault();
|
|
50
|
-
|
|
51
|
-
// Storing previous timestamp and checking against the current event's timestamp prevents event propagation
|
|
52
|
-
// to collapsibleHeader element when the button is in the collapsibleHeader, but does not prevent event propagation to the body for analytics
|
|
53
|
-
if (this.previousTimestamp !== event.timeStamp) {
|
|
54
|
-
this.previousTimestamp = event.timeStamp;
|
|
55
|
-
this.setOpen(!this.isOpen);
|
|
56
|
-
}
|
|
25
|
+
this.setOpen(!this.isOpen);
|
|
57
26
|
}
|
|
58
27
|
|
|
59
28
|
setOpen(open) {
|
|
60
29
|
if (open !== this.isOpen) {
|
|
61
|
-
const openAttribute = open ? 'set' : 'remove';
|
|
62
|
-
const cls = open ? 'add' : 'remove';
|
|
63
30
|
const action = open ? 'Open' : 'Close';
|
|
31
|
+
const openAttribute = open ? 'set' : 'remove';
|
|
64
32
|
|
|
65
33
|
this.isOpen = open;
|
|
66
34
|
this.collapsible[`${openAttribute}Attribute`]('open', '');
|
|
67
|
-
this.collapsible.classList[cls]('ons-collapsible--open');
|
|
68
|
-
this.collapsibleHeader.setAttribute('aria-expanded', open);
|
|
69
|
-
this.content.setAttribute('aria-hidden', !open);
|
|
70
|
-
|
|
71
35
|
this.collapsibleHeader.setAttribute('data-ga-action', `${action} panel`);
|
|
72
36
|
|
|
73
|
-
if (this.button) {
|
|
74
|
-
this.button.setAttribute('data-ga-action', `${action} panel`);
|
|
75
|
-
this.buttonInner.innerHTML = open ? this.closeButton : this.buttonOpen;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
37
|
if (this.onOpen && this.onClose) {
|
|
79
38
|
if (open) {
|
|
80
39
|
this.onOpen();
|
|
@@ -100,7 +59,6 @@ export default class Collapsible {
|
|
|
100
59
|
event.preventDefault();
|
|
101
60
|
event.stopPropagation();
|
|
102
61
|
|
|
103
|
-
// Show answer content
|
|
104
62
|
this.toggle(event);
|
|
105
63
|
break;
|
|
106
64
|
}
|
|
@@ -7,53 +7,6 @@ const EXAMPLE_COLLAPSIBLE_BASIC = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
describe('script: collapsible', () => {
|
|
10
|
-
it('begins closed', async () => {
|
|
11
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
12
|
-
|
|
13
|
-
const openItemCount = await page.$$eval('.ons-collapsible--open', elements => elements.length);
|
|
14
|
-
expect(openItemCount).toBe(0);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('sets the `role` attribute', async () => {
|
|
18
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
19
|
-
|
|
20
|
-
const role = await page.$eval('.ons-collapsible', element => element.getAttribute('role'));
|
|
21
|
-
expect(role).toBe('group');
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('adds the correct class', async () => {
|
|
25
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
26
|
-
|
|
27
|
-
const className = await page.$eval('.ons-collapsible', element => element.classList.contains('ons-collapsible--initialised'));
|
|
28
|
-
expect(className).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
it('sets attributes on the heading element', async () => {
|
|
32
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
33
|
-
|
|
34
|
-
const role = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('role'));
|
|
35
|
-
const ariaControls = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('aria-controls'));
|
|
36
|
-
const tabIndex = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('tabindex'));
|
|
37
|
-
|
|
38
|
-
expect(role).toBe('link');
|
|
39
|
-
expect(ariaControls).toBe('collapsible-id');
|
|
40
|
-
expect(tabIndex).toBe('0');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('sets attributes on the button element', async () => {
|
|
44
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
45
|
-
|
|
46
|
-
const ariaControls = await page.$eval('.ons-js-collapsible-button', element => element.getAttribute('aria-controls'));
|
|
47
|
-
expect(ariaControls).toBe('collapsible-id');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('sets the button element to be visible', async () => {
|
|
51
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
52
|
-
|
|
53
|
-
const openClass = await page.$eval('.ons-collapsible', element => element.classList.contains('ons-collapsible--open'));
|
|
54
|
-
expect(openClass).toBe(false);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
10
|
it('begins open when specified', async () => {
|
|
58
11
|
await setTestPage(
|
|
59
12
|
'/test',
|
|
@@ -63,8 +16,8 @@ describe('script: collapsible', () => {
|
|
|
63
16
|
}),
|
|
64
17
|
);
|
|
65
18
|
|
|
66
|
-
const
|
|
67
|
-
expect(
|
|
19
|
+
const openAttribute = await page.$eval('.ons-js-collapsible', node => node.open !== null);
|
|
20
|
+
expect(openAttribute).toBe(true);
|
|
68
21
|
});
|
|
69
22
|
|
|
70
23
|
describe('when the collapsible heading is clicked to open the collapsible', () => {
|
|
@@ -78,59 +31,10 @@ describe('script: collapsible', () => {
|
|
|
78
31
|
expect(openAttribute).toBe(true);
|
|
79
32
|
});
|
|
80
33
|
|
|
81
|
-
it('sets the open class', async () => {
|
|
82
|
-
const openClass = await page.$eval('.ons-collapsible', element => element.classList.contains('ons-collapsible--open'));
|
|
83
|
-
expect(openClass).toBe(true);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it('sets the `aria` attributes', async () => {
|
|
87
|
-
const ariaExpanded = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('aria-expanded'));
|
|
88
|
-
const ariaHidden = await page.$eval('.ons-js-collapsible-content', element => element.getAttribute('aria-hidden'));
|
|
89
|
-
|
|
90
|
-
expect(ariaExpanded).toBe('true');
|
|
91
|
-
expect(ariaHidden).toBe('false');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
34
|
it('sets the `ga` attributes', async () => {
|
|
95
35
|
const gaHeadingAttribute = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('data-ga-action'));
|
|
96
|
-
const gaButtonAttribute = await page.$eval('.ons-js-collapsible-button', element => element.getAttribute('data-ga-action'));
|
|
97
36
|
|
|
98
37
|
expect(gaHeadingAttribute).toBe('Open panel');
|
|
99
|
-
expect(gaButtonAttribute).toBe('Open panel');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('when the collapsible button is clicked to close the collapsible', () => {
|
|
104
|
-
beforeEach(async () => {
|
|
105
|
-
await setTestPage('/test', renderComponent('collapsible', EXAMPLE_COLLAPSIBLE_BASIC));
|
|
106
|
-
await page.click('.ons-js-collapsible-heading');
|
|
107
|
-
await page.click('.ons-js-collapsible-button');
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('removes the `open` attribute', async () => {
|
|
111
|
-
const openAttribute = await page.$eval('.ons-js-collapsible', node => node.open === true);
|
|
112
|
-
expect(openAttribute).toBe(false);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it('removes the open class', async () => {
|
|
116
|
-
const openClass = await page.$eval('.ons-collapsible', element => element.classList.contains('ons-collapsible--open'));
|
|
117
|
-
expect(openClass).toBe(false);
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('sets the `aria` attributes', async () => {
|
|
121
|
-
const ariaExpanded = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('aria-expanded'));
|
|
122
|
-
const ariaHidden = await page.$eval('.ons-js-collapsible-content', element => element.getAttribute('aria-hidden'));
|
|
123
|
-
|
|
124
|
-
expect(ariaExpanded).toBe('false');
|
|
125
|
-
expect(ariaHidden).toBe('true');
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('sets the `ga` attributes', async () => {
|
|
129
|
-
const gaHeadingAttribute = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('data-ga-action'));
|
|
130
|
-
const gaButtonAttribute = await page.$eval('.ons-js-collapsible-button', element => element.getAttribute('data-ga-action'));
|
|
131
|
-
|
|
132
|
-
expect(gaHeadingAttribute).toBe('Close panel');
|
|
133
|
-
expect(gaButtonAttribute).toBe('Close panel');
|
|
134
38
|
});
|
|
135
39
|
});
|
|
136
40
|
|
|
@@ -146,8 +50,8 @@ describe('script: collapsible', () => {
|
|
|
146
50
|
});
|
|
147
51
|
|
|
148
52
|
it('opens the collapsible content', async () => {
|
|
149
|
-
const
|
|
150
|
-
expect(
|
|
53
|
+
const openAttribute = await page.$eval('.ons-js-collapsible', node => node.open !== null);
|
|
54
|
+
expect(openAttribute).toBe(true);
|
|
151
55
|
});
|
|
152
56
|
});
|
|
153
57
|
|
|
@@ -157,8 +61,8 @@ describe('script: collapsible', () => {
|
|
|
157
61
|
});
|
|
158
62
|
|
|
159
63
|
it('opens the collapsible content', async () => {
|
|
160
|
-
const
|
|
161
|
-
expect(
|
|
64
|
+
const openAttribute = await page.$eval('.ons-js-collapsible', node => node.open !== null);
|
|
65
|
+
expect(openAttribute).toBe(true);
|
|
162
66
|
});
|
|
163
67
|
});
|
|
164
68
|
});
|
|
@@ -196,41 +100,4 @@ describe('script: collapsible', () => {
|
|
|
196
100
|
});
|
|
197
101
|
});
|
|
198
102
|
});
|
|
199
|
-
|
|
200
|
-
describe('when the collapsible is an accordion', () => {
|
|
201
|
-
beforeEach(async () => {
|
|
202
|
-
await setTestPage(
|
|
203
|
-
'/test',
|
|
204
|
-
renderComponent('collapsible', {
|
|
205
|
-
...EXAMPLE_COLLAPSIBLE_BASIC,
|
|
206
|
-
isAccordion: true,
|
|
207
|
-
}),
|
|
208
|
-
);
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it('does not set `tabindex` on the heading element', async () => {
|
|
212
|
-
const tabIndex = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('tabindex'));
|
|
213
|
-
|
|
214
|
-
expect(tabIndex).toBe(null);
|
|
215
|
-
});
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
describe('when the collapsible is an accordion and the simple variant', () => {
|
|
219
|
-
beforeEach(async () => {
|
|
220
|
-
await setTestPage(
|
|
221
|
-
'/test',
|
|
222
|
-
renderComponent('collapsible', {
|
|
223
|
-
...EXAMPLE_COLLAPSIBLE_BASIC,
|
|
224
|
-
isAccordion: true,
|
|
225
|
-
variants: 'simple',
|
|
226
|
-
}),
|
|
227
|
-
);
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
it('does set `tabindex` on the heading element', async () => {
|
|
231
|
-
const tabIndex = await page.$eval('.ons-js-collapsible-heading', element => element.getAttribute('tabindex'));
|
|
232
|
-
|
|
233
|
-
expect(tabIndex).toBe('0');
|
|
234
|
-
});
|
|
235
|
-
});
|
|
236
103
|
});
|
|
@@ -1,22 +1,30 @@
|
|
|
1
1
|
.ons-cookies-banner {
|
|
2
2
|
background: $color-banner-bg;
|
|
3
3
|
display: none;
|
|
4
|
-
padding: 1rem 0;
|
|
4
|
+
padding: 1rem 0 1.5rem;
|
|
5
5
|
|
|
6
6
|
&__title {
|
|
7
7
|
color: $color-text;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
&
|
|
10
|
+
&__statement {
|
|
11
11
|
color: $color-text;
|
|
12
|
-
margin-bottom: 1rem;
|
|
13
12
|
word-break: break-word;
|
|
13
|
+
p {
|
|
14
|
+
margin: 0 0 0.5rem;
|
|
15
|
+
|
|
16
|
+
@include mq(xxs, s) {
|
|
17
|
+
font-size: 0.9rem;
|
|
18
|
+
line-height: 1.4;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&__link {
|
|
24
|
+
line-height: 2.1rem;
|
|
14
25
|
}
|
|
15
26
|
|
|
16
27
|
&__btn {
|
|
17
|
-
|
|
18
|
-
display: block;
|
|
19
|
-
width: 100%;
|
|
20
|
-
}
|
|
28
|
+
margin: 0 0 0.8rem;
|
|
21
29
|
}
|
|
22
30
|
}
|
|
@@ -1,40 +1,84 @@
|
|
|
1
1
|
{% macro onsCookiesBanner(params) %}
|
|
2
|
-
|
|
2
|
+
{% if params.lang == 'cy' %}
|
|
3
|
+
{% set ariaLabel = 'Cwcis' %}
|
|
4
|
+
{% set serviceName = 'ons.gov.uk' %}
|
|
5
|
+
{% set statementTitle = 'Cwcis ar' %}
|
|
6
|
+
{% set settingsLinkText = 'Gweld cwcis' %}
|
|
7
|
+
{% set settingsLinkURL = '/cwics' %}
|
|
8
|
+
{% set statementText = '<p>Ffeiliau bach a gaiff eu storio ar eich dyfais pan fyddwch yn mynd ar wefan yw cwcis. Rydym ni’n defnyddio rhai cwcis hanfodol i wneud i’r wefan hon weithio.</p><p>Hoffem osod <a href="' + settingsLinkURL + '">cwcis ychwanegol</a> er mwyn cofio eich gosodiadau a deall sut rydych chi’n defnyddio’r wefan. Mae hyn yn ein helpu ni i wella ein gwasanaethau.</p>' %}
|
|
9
|
+
{% set acceptButtonText = 'Derbyn cwcis ychwanegol' %}
|
|
10
|
+
{% set rejectButtonText = 'Gwrthod cwcis ychwanegol' %}
|
|
11
|
+
{% set acceptedText = 'Rydych chi wedi derbyn yr holl gwcis ychwanegol.' %}
|
|
12
|
+
{% set rejectedText = 'Rydych chi wedi gwrthod yr holl gwcis ychwanegol. ' %}
|
|
13
|
+
{% set preferencesText = 'Gallwch chi <a href="' + settingsLinkURL + '">newid eich dewisiadau o ran cwcis</a> ar unrhyw adeg.' %}
|
|
14
|
+
{% set confirmationButtonText = 'Cuddio' %}
|
|
15
|
+
{% set confirmationButtonTextAria = 'neges hon' %}
|
|
16
|
+
{% else %}
|
|
17
|
+
{% set ariaLabel = 'Cookies banner' %}
|
|
18
|
+
{% set serviceName = 'ons.gov.uk' %}
|
|
19
|
+
{% set statementTitle = 'Cookies on' %}
|
|
20
|
+
{% set settingsLinkText = 'View cookies' %}
|
|
21
|
+
{% set settingsLinkURL = '/cookies' %}
|
|
22
|
+
{% set statementText = '<p>Cookies are small files stored on your device when you visit a website. We use some essential cookies to make this website work.</p><p>We would like to set <a href="' + settingsLinkURL + '">additional cookies</a> to remember your settings and understand how you use the site. This helps us to improve our services. </p>' %}
|
|
23
|
+
{% set acceptButtonText = 'Accept additional cookies' %}
|
|
24
|
+
{% set rejectButtonText = 'Reject additional cookies' %}
|
|
25
|
+
{% set acceptedText = 'You have accepted all additional cookies.' %}
|
|
26
|
+
{% set rejectedText = 'You have rejected all additional cookies.' %}
|
|
27
|
+
{% set preferencesText = 'You can <a href="' + settingsLinkURL + '">change your cookie preferences</a> at any time.' %}
|
|
28
|
+
{% set confirmationButtonText = 'Hide' %}
|
|
29
|
+
{% set confirmationButtonTextAria = 'this message' %}
|
|
30
|
+
{% endif %}
|
|
31
|
+
|
|
32
|
+
<div class="ons-cookies-banner" role="region" aria-label="{{ params.ariaLabel | default(ariaLabel)}}">
|
|
3
33
|
<div class="ons-container ons-cookies-banner__primary">
|
|
4
34
|
<div class="ons-grid">
|
|
5
35
|
<div class="ons-grid__col ons-col-8@m">
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
<h2 class="ons-cookies-banner__title ons-u-mb-xs">{{ params.statementTitle | default(statementTitle) }} {{ params.serviceName | default(serviceName) }}</h2>
|
|
37
|
+
<div class="ons-cookies-banner__statement">{{ params.statementText | default(statementText) | safe }}</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="ons-grid ons-grid--flex ons-u-mt-s">
|
|
41
|
+
<div class="ons-grid__col">
|
|
42
|
+
{% from "components/button/_macro.njk" import onsButton %}
|
|
43
|
+
{{
|
|
44
|
+
onsButton({
|
|
45
|
+
"type": 'button',
|
|
46
|
+
"attributes": {
|
|
47
|
+
"data-button": 'accept'
|
|
48
|
+
},
|
|
49
|
+
"text": params.acceptButtonText | default(acceptButtonText),
|
|
50
|
+
"classes": 'ons-btn--small ons-js-accept-cookies ons-cookies-banner__btn'
|
|
51
|
+
})
|
|
52
|
+
}}
|
|
53
|
+
</div>
|
|
54
|
+
<div class="ons-grid__col">
|
|
55
|
+
{{
|
|
56
|
+
onsButton({
|
|
57
|
+
"type": 'button',
|
|
58
|
+
"attributes": {
|
|
59
|
+
"data-button": 'reject'
|
|
60
|
+
},
|
|
61
|
+
"text": params.rejectButtonText | default(rejectButtonText),
|
|
62
|
+
"classes": 'ons-btn--small ons-js-reject-cookies ons-cookies-banner__btn'
|
|
63
|
+
})
|
|
64
|
+
}}
|
|
65
|
+
</div>
|
|
66
|
+
<div class="ons-grid__col">
|
|
67
|
+
<a class="ons-cookies-banner__link" href="{{ params.settingsLinkURL | default(settingsLinkURL) }}">{{ params.settingsLinkText | default(settingsLinkText) }}</a>
|
|
24
68
|
</div>
|
|
25
69
|
</div>
|
|
26
70
|
</div>
|
|
27
71
|
<div class="ons-container ons-cookies-banner__confirmation ons-u-d-no">
|
|
28
72
|
<div class="ons-grid ons-grid--flex ons-grid--between ons-grid--gutterless ons-grid--no-wrap@s ons-grid--vertical-center">
|
|
29
73
|
<div class="ons-grid__col ons-grid__col--flex ons-col-auto ons-u-flex-shrink@s">
|
|
30
|
-
<p class="ons-cookies-banner__desc ons-u-mb-no@s ons-u-mr-s@s">{{ params.
|
|
74
|
+
<p class="ons-cookies-banner__desc ons-u-mb-no@s ons-u-mr-s@s"><span class="ons-js-accepted-text ons-u-d-no">{{ params.acceptedText | default(acceptedText) | safe }} </span><span class="ons-js-rejected-text ons-u-d-no">{{ params.rejectedText | default(rejectedText) | safe }} </span><span class="ons-cookies-banner__preferences-text">{{ params.preferencesText | default(preferencesText) | safe }}</span></p>
|
|
31
75
|
</div>
|
|
32
76
|
<div class="ons-grid__col">
|
|
33
77
|
{{
|
|
34
78
|
onsButton({
|
|
35
79
|
"type": 'button',
|
|
36
|
-
"text": params.confirmationButtonText | default(
|
|
37
|
-
"buttonContext": params.confirmationButtonTextAria | default(
|
|
80
|
+
"text": params.confirmationButtonText | default(confirmationButtonText),
|
|
81
|
+
"buttonContext": params.confirmationButtonTextAria | default(confirmationButtonTextAria),
|
|
38
82
|
"classes": 'ons-btn--secondary ons-btn--small ons-js-hide-button'
|
|
39
83
|
})
|
|
40
84
|
}}
|