@ons/design-system 62.2.4 → 63.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/access-code/example-access-code-error.njk +1 -1
- package/components/accordion/_macro.njk +1 -1
- package/components/breadcrumbs/_macro.njk +2 -2
- package/components/breadcrumbs/_macro.spec.js +1 -1
- package/components/button/_macro.njk +1 -1
- package/components/button/_macro.spec.js +6 -6
- package/components/card/_macro.njk +1 -1
- package/components/card/_macro.spec.js +1 -1
- package/components/collapsible/_macro.spec.js +1 -1
- package/components/content-pagination/_macro.njk +2 -2
- package/components/content-pagination/_macro.spec.js +2 -2
- package/components/details/_macro.njk +1 -1
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_macro.njk +1 -1
- package/components/footer/_macro.njk +2 -2
- package/components/footer/_macro.spec.js +7 -7
- package/components/header/_macro.njk +3 -3
- package/components/header/_macro.spec.js +5 -6
- package/components/{icons → icon}/_macro.spec.js +7 -7
- package/components/{images → image}/_macro.spec.js +13 -13
- package/components/{images/example-images-for-regular-screens.njk → image/example-image-for-regular-screens.njk} +1 -1
- package/components/{images/example-images-for-retina-screens.njk → image/example-image-for-retina-screens.njk} +1 -1
- package/components/{lists → list}/_macro.njk +3 -3
- package/components/{lists → list}/_macro.spec.js +42 -42
- package/components/message/_macro.njk +2 -2
- package/components/message/_macro.spec.js +0 -1
- package/components/metadata/_macro.njk +1 -1
- package/components/navigation/_macro.njk +3 -3
- package/components/pagination/_macro.njk +65 -69
- package/components/pagination/_macro.spec.js +18 -16
- package/components/pagination/example-pagination-first.njk +5 -5
- package/components/pagination/example-pagination-last.njk +5 -5
- package/components/pagination/example-pagination-with-no-range-indicator.njk +11 -11
- package/components/pagination/example-pagination.njk +2 -2
- package/components/panel/_macro.njk +2 -2
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/example-panel-with-error-summary.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +2 -1
- package/components/question/_macro.njk +1 -1
- package/components/question/_macro.spec.js +1 -1
- package/components/quote/_macro.njk +1 -1
- package/components/quote/_macro.spec.js +1 -1
- package/components/related-content/_macro.njk +1 -1
- package/components/related-content/_macro.spec.js +1 -1
- package/components/related-content/example-related-content-general.njk +1 -1
- package/components/relationships/example-relationships-error.njk +1 -1
- package/components/section-navigation/_macro.njk +2 -2
- package/components/share-page/_macro.njk +1 -1
- package/components/share-page/_macro.spec.js +5 -5
- package/components/summary/_macro.njk +4 -4
- package/components/summary/_macro.spec.js +1 -1
- package/components/table/_macro.njk +3 -3
- package/components/table/_macro.spec.js +1 -1
- package/components/table/example-table-basic.njk +1 -2
- package/components/table-of-contents/_macro.njk +1 -1
- package/components/table-of-contents/_macro.spec.js +2 -2
- package/components/tabs/_macro.njk +2 -2
- package/components/tabs/_macro.spec.js +2 -2
- package/components/timeline/_macro.njk +1 -1
- package/components/timeline/_macro.spec.js +1 -1
- package/css/main.css +3 -3
- package/css/print.css +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +3 -3
- /package/components/{icons/_icons.scss → icon/_icon.scss} +0 -0
- /package/components/{icons → icon}/_macro.njk +0 -0
- /package/components/{images/_images.scss → image/_image.scss} +0 -0
- /package/components/{images → image}/_macro.njk +0 -0
- /package/components/{lists → list}/_list.scss +0 -0
|
@@ -22,11 +22,11 @@ const EXAMPLE_ITEM_NAVIGATION_TITLE = {
|
|
|
22
22
|
navigationTitle: 'Nav friendly title',
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
describe('macro:
|
|
25
|
+
describe('macro: list', () => {
|
|
26
26
|
describe('list element', () => {
|
|
27
27
|
it('has `id` attribute when provided', () => {
|
|
28
28
|
const $ = cheerio.load(
|
|
29
|
-
renderComponent('
|
|
29
|
+
renderComponent('list', {
|
|
30
30
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
31
31
|
id: 'example-id',
|
|
32
32
|
}),
|
|
@@ -37,7 +37,7 @@ describe('macro: lists', () => {
|
|
|
37
37
|
|
|
38
38
|
it('has additionally provided style classes', () => {
|
|
39
39
|
const $ = cheerio.load(
|
|
40
|
-
renderComponent('
|
|
40
|
+
renderComponent('list', {
|
|
41
41
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
42
42
|
classes: 'extra-class another-extra-class',
|
|
43
43
|
}),
|
|
@@ -49,7 +49,7 @@ describe('macro: lists', () => {
|
|
|
49
49
|
|
|
50
50
|
it('has provided variant style class when one variant is provided', () => {
|
|
51
51
|
const $ = cheerio.load(
|
|
52
|
-
renderComponent('
|
|
52
|
+
renderComponent('list', {
|
|
53
53
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
54
54
|
variants: 'dashed',
|
|
55
55
|
}),
|
|
@@ -60,7 +60,7 @@ describe('macro: lists', () => {
|
|
|
60
60
|
|
|
61
61
|
it('has provided variant style classes when multiple variants are provided', () => {
|
|
62
62
|
const $ = cheerio.load(
|
|
63
|
-
renderComponent('
|
|
63
|
+
renderComponent('list', {
|
|
64
64
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
65
65
|
variants: ['dashed', 'inline'],
|
|
66
66
|
}),
|
|
@@ -72,7 +72,7 @@ describe('macro: lists', () => {
|
|
|
72
72
|
|
|
73
73
|
it('assumes the "bare" variant with a prefix modifier class when the first list item has a prefix', () => {
|
|
74
74
|
const $ = cheerio.load(
|
|
75
|
-
renderComponent('
|
|
75
|
+
renderComponent('list', {
|
|
76
76
|
itemsList: [{ text: 'Item text', prefix: 'Abc' }],
|
|
77
77
|
}),
|
|
78
78
|
);
|
|
@@ -83,7 +83,7 @@ describe('macro: lists', () => {
|
|
|
83
83
|
|
|
84
84
|
it('assumes the "bare" variant with a suffix modifier class when the first list item has a suffix', () => {
|
|
85
85
|
const $ = cheerio.load(
|
|
86
|
-
renderComponent('
|
|
86
|
+
renderComponent('list', {
|
|
87
87
|
itemsList: [{ text: 'Item text', suffix: 'Abc' }],
|
|
88
88
|
}),
|
|
89
89
|
);
|
|
@@ -94,7 +94,7 @@ describe('macro: lists', () => {
|
|
|
94
94
|
|
|
95
95
|
it('assumes the "bare" variant with a icons modifier class when the first list item has an icon', () => {
|
|
96
96
|
const $ = cheerio.load(
|
|
97
|
-
renderComponent('
|
|
97
|
+
renderComponent('list', {
|
|
98
98
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
99
99
|
iconPosition: 'before',
|
|
100
100
|
iconType: 'check',
|
|
@@ -106,14 +106,14 @@ describe('macro: lists', () => {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
it('renders a <ul> element by default', () => {
|
|
109
|
-
const $ = cheerio.load(renderComponent('
|
|
109
|
+
const $ = cheerio.load(renderComponent('list', EXAMPLE_LIST_TEXT_ITEMS));
|
|
110
110
|
|
|
111
111
|
expect($('.ons-list')[0].tagName).toBe('ul');
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
it('renders a custom element when a custom `element` is provided', () => {
|
|
115
115
|
const $ = cheerio.load(
|
|
116
|
-
renderComponent('
|
|
116
|
+
renderComponent('list', {
|
|
117
117
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
118
118
|
element: 'div',
|
|
119
119
|
}),
|
|
@@ -124,7 +124,7 @@ describe('macro: lists', () => {
|
|
|
124
124
|
|
|
125
125
|
it('renders a <ol> element when specified', () => {
|
|
126
126
|
const $ = cheerio.load(
|
|
127
|
-
renderComponent('
|
|
127
|
+
renderComponent('list', {
|
|
128
128
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
129
129
|
element: 'ol',
|
|
130
130
|
}),
|
|
@@ -135,7 +135,7 @@ describe('macro: lists', () => {
|
|
|
135
135
|
|
|
136
136
|
it('has the expected quantity of <li> elements when a <ol> element is specified', () => {
|
|
137
137
|
const $ = cheerio.load(
|
|
138
|
-
renderComponent('
|
|
138
|
+
renderComponent('list', {
|
|
139
139
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
140
140
|
element: 'ol',
|
|
141
141
|
}),
|
|
@@ -146,7 +146,7 @@ describe('macro: lists', () => {
|
|
|
146
146
|
|
|
147
147
|
describe('when <ol> is specified but there is only one list item', () => {
|
|
148
148
|
const $ = cheerio.load(
|
|
149
|
-
renderComponent('
|
|
149
|
+
renderComponent('list', {
|
|
150
150
|
element: 'ol',
|
|
151
151
|
itemsList: [{ text: 'Only item' }],
|
|
152
152
|
}),
|
|
@@ -167,7 +167,7 @@ describe('macro: lists', () => {
|
|
|
167
167
|
|
|
168
168
|
it('has additionally provided `attributes`', () => {
|
|
169
169
|
const $ = cheerio.load(
|
|
170
|
-
renderComponent('
|
|
170
|
+
renderComponent('list', {
|
|
171
171
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
172
172
|
attributes: {
|
|
173
173
|
a: 123,
|
|
@@ -189,7 +189,7 @@ describe('macro: lists', () => {
|
|
|
189
189
|
describe('content without link', () => {
|
|
190
190
|
it('passes jest-axe checks', async () => {
|
|
191
191
|
const $ = cheerio.load(
|
|
192
|
-
renderComponent('
|
|
192
|
+
renderComponent('list', {
|
|
193
193
|
itemsList: [item],
|
|
194
194
|
}),
|
|
195
195
|
);
|
|
@@ -200,7 +200,7 @@ describe('macro: lists', () => {
|
|
|
200
200
|
|
|
201
201
|
it('renders the expected list item text', () => {
|
|
202
202
|
const $ = cheerio.load(
|
|
203
|
-
renderComponent('
|
|
203
|
+
renderComponent('list', {
|
|
204
204
|
itemsList: [item],
|
|
205
205
|
}),
|
|
206
206
|
);
|
|
@@ -210,7 +210,7 @@ describe('macro: lists', () => {
|
|
|
210
210
|
|
|
211
211
|
it('does not render a hyperlink element', () => {
|
|
212
212
|
const $ = cheerio.load(
|
|
213
|
-
renderComponent('
|
|
213
|
+
renderComponent('list', {
|
|
214
214
|
itemsList: [item],
|
|
215
215
|
}),
|
|
216
216
|
);
|
|
@@ -222,7 +222,7 @@ describe('macro: lists', () => {
|
|
|
222
222
|
describe('content with an internal link', () => {
|
|
223
223
|
it('passes jest-axe checks', async () => {
|
|
224
224
|
const $ = cheerio.load(
|
|
225
|
-
renderComponent('
|
|
225
|
+
renderComponent('list', {
|
|
226
226
|
itemsList: [
|
|
227
227
|
{
|
|
228
228
|
...item,
|
|
@@ -238,7 +238,7 @@ describe('macro: lists', () => {
|
|
|
238
238
|
|
|
239
239
|
it('renders a hyperlink element', () => {
|
|
240
240
|
const $ = cheerio.load(
|
|
241
|
-
renderComponent('
|
|
241
|
+
renderComponent('list', {
|
|
242
242
|
itemsList: [
|
|
243
243
|
{
|
|
244
244
|
...item,
|
|
@@ -254,7 +254,7 @@ describe('macro: lists', () => {
|
|
|
254
254
|
|
|
255
255
|
it('does not render a hyperlink element for current item', () => {
|
|
256
256
|
const $ = cheerio.load(
|
|
257
|
-
renderComponent('
|
|
257
|
+
renderComponent('list', {
|
|
258
258
|
itemsList: [
|
|
259
259
|
{
|
|
260
260
|
...item,
|
|
@@ -270,7 +270,7 @@ describe('macro: lists', () => {
|
|
|
270
270
|
|
|
271
271
|
it('supports the `inPageLink` variant', () => {
|
|
272
272
|
const $ = cheerio.load(
|
|
273
|
-
renderComponent('
|
|
273
|
+
renderComponent('list', {
|
|
274
274
|
itemsList: [
|
|
275
275
|
{
|
|
276
276
|
...item,
|
|
@@ -286,7 +286,7 @@ describe('macro: lists', () => {
|
|
|
286
286
|
|
|
287
287
|
it('has additionally provided style classes', () => {
|
|
288
288
|
const $ = cheerio.load(
|
|
289
|
-
renderComponent('
|
|
289
|
+
renderComponent('list', {
|
|
290
290
|
itemsList: [
|
|
291
291
|
{
|
|
292
292
|
...item,
|
|
@@ -303,7 +303,7 @@ describe('macro: lists', () => {
|
|
|
303
303
|
|
|
304
304
|
it('has the provided `target` attribute', () => {
|
|
305
305
|
const $ = cheerio.load(
|
|
306
|
-
renderComponent('
|
|
306
|
+
renderComponent('list', {
|
|
307
307
|
itemsList: [
|
|
308
308
|
{
|
|
309
309
|
...item,
|
|
@@ -319,7 +319,7 @@ describe('macro: lists', () => {
|
|
|
319
319
|
|
|
320
320
|
it('renders visually hidden screen reader message when target is "_blank"', () => {
|
|
321
321
|
const $ = cheerio.load(
|
|
322
|
-
renderComponent('
|
|
322
|
+
renderComponent('list', {
|
|
323
323
|
itemsList: [
|
|
324
324
|
{
|
|
325
325
|
...item,
|
|
@@ -336,7 +336,7 @@ describe('macro: lists', () => {
|
|
|
336
336
|
|
|
337
337
|
it('renders a default visually hidden screen reader message when target is "_blank"', () => {
|
|
338
338
|
const $ = cheerio.load(
|
|
339
|
-
renderComponent('
|
|
339
|
+
renderComponent('list', {
|
|
340
340
|
itemsList: [
|
|
341
341
|
{
|
|
342
342
|
...item,
|
|
@@ -352,7 +352,7 @@ describe('macro: lists', () => {
|
|
|
352
352
|
|
|
353
353
|
it('has additionally provided `attributes`', () => {
|
|
354
354
|
const $ = cheerio.load(
|
|
355
|
-
renderComponent('
|
|
355
|
+
renderComponent('list', {
|
|
356
356
|
itemsList: [
|
|
357
357
|
{
|
|
358
358
|
...item,
|
|
@@ -372,7 +372,7 @@ describe('macro: lists', () => {
|
|
|
372
372
|
|
|
373
373
|
it('renders visually hidden prefix', () => {
|
|
374
374
|
const $ = cheerio.load(
|
|
375
|
-
renderComponent('
|
|
375
|
+
renderComponent('list', {
|
|
376
376
|
itemsList: [
|
|
377
377
|
{
|
|
378
378
|
...item,
|
|
@@ -390,7 +390,7 @@ describe('macro: lists', () => {
|
|
|
390
390
|
describe('content with an external link', () => {
|
|
391
391
|
it('passes jest-axe checks', async () => {
|
|
392
392
|
const $ = cheerio.load(
|
|
393
|
-
renderComponent('
|
|
393
|
+
renderComponent('list', {
|
|
394
394
|
itemsList: [
|
|
395
395
|
{
|
|
396
396
|
...item,
|
|
@@ -409,7 +409,7 @@ describe('macro: lists', () => {
|
|
|
409
409
|
const faker = templateFaker();
|
|
410
410
|
const externalLinkSpy = faker.spy('external-link');
|
|
411
411
|
|
|
412
|
-
faker.renderComponent('
|
|
412
|
+
faker.renderComponent('list', {
|
|
413
413
|
itemsList: [
|
|
414
414
|
{
|
|
415
415
|
...item,
|
|
@@ -429,7 +429,7 @@ describe('macro: lists', () => {
|
|
|
429
429
|
const faker = templateFaker();
|
|
430
430
|
const externalLinkSpy = faker.spy('external-link');
|
|
431
431
|
|
|
432
|
-
faker.renderComponent('
|
|
432
|
+
faker.renderComponent('list', {
|
|
433
433
|
itemsList: [
|
|
434
434
|
{
|
|
435
435
|
...item,
|
|
@@ -448,7 +448,7 @@ describe('macro: lists', () => {
|
|
|
448
448
|
describe('prefix', () => {
|
|
449
449
|
it('renders item `prefix` content', () => {
|
|
450
450
|
const $ = cheerio.load(
|
|
451
|
-
renderComponent('
|
|
451
|
+
renderComponent('list', {
|
|
452
452
|
itemsList: [
|
|
453
453
|
{
|
|
454
454
|
prefix: '[PREFIX]',
|
|
@@ -467,7 +467,7 @@ describe('macro: lists', () => {
|
|
|
467
467
|
|
|
468
468
|
it('marks `prefix` content as visually hidden when list element is not <ol>', () => {
|
|
469
469
|
const $ = cheerio.load(
|
|
470
|
-
renderComponent('
|
|
470
|
+
renderComponent('list', {
|
|
471
471
|
itemsList: [
|
|
472
472
|
{
|
|
473
473
|
prefix: '[PREFIX]',
|
|
@@ -482,7 +482,7 @@ describe('macro: lists', () => {
|
|
|
482
482
|
|
|
483
483
|
it('does not mark `prefix` content as visually hidden when list element is <ol>', () => {
|
|
484
484
|
const $ = cheerio.load(
|
|
485
|
-
renderComponent('
|
|
485
|
+
renderComponent('list', {
|
|
486
486
|
element: 'ol',
|
|
487
487
|
itemsList: [
|
|
488
488
|
{
|
|
@@ -504,7 +504,7 @@ describe('macro: lists', () => {
|
|
|
504
504
|
describe('suffix', () => {
|
|
505
505
|
it('renders item `suffix` content', () => {
|
|
506
506
|
const $ = cheerio.load(
|
|
507
|
-
renderComponent('
|
|
507
|
+
renderComponent('list', {
|
|
508
508
|
itemsList: [
|
|
509
509
|
{
|
|
510
510
|
suffix: '[SUFFIX]',
|
|
@@ -523,7 +523,7 @@ describe('macro: lists', () => {
|
|
|
523
523
|
|
|
524
524
|
it('marks `suffix` content as visually hidden when list element is not <ol>', () => {
|
|
525
525
|
const $ = cheerio.load(
|
|
526
|
-
renderComponent('
|
|
526
|
+
renderComponent('list', {
|
|
527
527
|
itemsList: [
|
|
528
528
|
{
|
|
529
529
|
suffix: '[SUFFIX]',
|
|
@@ -538,7 +538,7 @@ describe('macro: lists', () => {
|
|
|
538
538
|
|
|
539
539
|
it('does not mark `suffix` content as visually hidden when list element is <ol>', () => {
|
|
540
540
|
const $ = cheerio.load(
|
|
541
|
-
renderComponent('
|
|
541
|
+
renderComponent('list', {
|
|
542
542
|
element: 'ol',
|
|
543
543
|
itemsList: [
|
|
544
544
|
{
|
|
@@ -560,9 +560,9 @@ describe('macro: lists', () => {
|
|
|
560
560
|
describe('icons', () => {
|
|
561
561
|
it.each([['before'], ['after']])('renders default icon on list items when icon is positioned %s', iconPosition => {
|
|
562
562
|
const faker = templateFaker();
|
|
563
|
-
const iconsSpy = faker.spy('
|
|
563
|
+
const iconsSpy = faker.spy('icon');
|
|
564
564
|
|
|
565
|
-
faker.renderComponent('
|
|
565
|
+
faker.renderComponent('list', {
|
|
566
566
|
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
567
567
|
iconPosition,
|
|
568
568
|
iconType: 'check',
|
|
@@ -575,9 +575,9 @@ describe('macro: lists', () => {
|
|
|
575
575
|
|
|
576
576
|
it.each([['before'], ['after']])('renders a custom icon on specific list items when icon is positioned %s', iconPosition => {
|
|
577
577
|
const faker = templateFaker();
|
|
578
|
-
const iconsSpy = faker.spy('
|
|
578
|
+
const iconsSpy = faker.spy('icon');
|
|
579
579
|
|
|
580
|
-
faker.renderComponent('
|
|
580
|
+
faker.renderComponent('list', {
|
|
581
581
|
itemsList: [{ text: 'First item' }, { text: 'Second item', iconType: 'print' }, { text: 'Third item' }],
|
|
582
582
|
iconPosition,
|
|
583
583
|
iconType: 'check',
|
|
@@ -591,7 +591,7 @@ describe('macro: lists', () => {
|
|
|
591
591
|
|
|
592
592
|
it('renders the icon before the item text', () => {
|
|
593
593
|
const $ = cheerio.load(
|
|
594
|
-
renderComponent('
|
|
594
|
+
renderComponent('list', {
|
|
595
595
|
itemsList: [{ text: '<span id="first">First item</span>' }, { text: '<span id="second">Second item</span>' }],
|
|
596
596
|
iconPosition: 'before',
|
|
597
597
|
iconType: 'check',
|
|
@@ -604,7 +604,7 @@ describe('macro: lists', () => {
|
|
|
604
604
|
|
|
605
605
|
it('renders the icon after the item text', () => {
|
|
606
606
|
const $ = cheerio.load(
|
|
607
|
-
renderComponent('
|
|
607
|
+
renderComponent('list', {
|
|
608
608
|
itemsList: [{ text: '<span id="first">First item</span>' }, { text: '<span id="second">Second item</span>' }],
|
|
609
609
|
iconPosition: 'after',
|
|
610
610
|
iconType: 'check',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{%- macro onsMessage(params) -%}
|
|
2
2
|
<div class="ons-message ons-message--{{ params.type }}">
|
|
3
3
|
<div class="ons-message__head">
|
|
4
|
-
<dl class="ons-message__metadata" {% if params.id %} id="{{ params.id }}"{% endif %}
|
|
4
|
+
<dl class="ons-message__metadata" {% if params.id %} id="{{ params.id }}"{% endif %}>
|
|
5
5
|
<div class="ons-message__sender">
|
|
6
6
|
<dt class="ons-message__term ons-u-fw-b">{{ params.fromLabel }}:</dt>
|
|
7
7
|
<dd class="ons-message__value ons-u-fw-b" {% if params.fromId %} id="{{ params.fromId }}"{% endif %} {% if params.fromName %} name="{{ params.fromName }}"{% endif %}>{{ params.fromValue }}</dd>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<a class="ons-message__unread-link" {% if params.unreadLinkId %}id="{{ params.unreadLinkId }}"{% endif %} href="{{ params.unreadLink }}">{{ params.unreadLinkText }}</a>
|
|
16
16
|
{% endif %}
|
|
17
17
|
</div>
|
|
18
|
-
<div class="ons-message__body" {% if params.messageID %} id="{{ params.messageID }}"{% endif %}
|
|
18
|
+
<div class="ons-message__body" {% if params.messageID %} id="{{ params.messageID }}"{% endif %}>
|
|
19
19
|
{{ caller() }}
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% macro onsMetadata(params) %}
|
|
2
2
|
<dl class="ons-metadata ons-metadata__list ons-grid ons-grid--gutterless ons-u-cf{{ (' ' + params.classes) if params.classes }}"{% if params.id %} id="{{ params.id }}" {% endif %}{% if params.metadataLabel %} title="{{ params.metadataLabel }}" aria-label="{{ params.metadataLabel }}"{% endif %}>
|
|
3
|
-
{% for item in
|
|
3
|
+
{% for item in params.itemsList %}
|
|
4
4
|
{% if item.term | length %}
|
|
5
5
|
<dt class="ons-metadata__term ons-grid__col ons-col-{{ params.termCol }}@m">{{ item.term }}</dt>
|
|
6
6
|
{% endif %}
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
{% endif %}
|
|
41
41
|
<nav class="ons-navigation ons-navigation--main ons-js-navigation" id="{{ params.navigation.id }}" aria-label="{{ params.navigation.ariaLabel | default("Main menu") }}" data-analytics="header-navigation">
|
|
42
42
|
<ul class="ons-navigation__list">
|
|
43
|
-
{% for item in
|
|
43
|
+
{% for item in params.navigation.itemsList %}
|
|
44
44
|
<li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
|
|
45
45
|
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{{ item.title }}</a>
|
|
46
46
|
</li>
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
<nav class="ons-navigation ons-navigation--sub ons-u-d-no@xxs@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes }}" id="{{ params.navigation.subNavigation.id }}" aria-label="{{ params.navigation.subNavigation.ariaLabel | default("Section menu") }}" data-analytics="header-section-navigation">
|
|
54
54
|
<div class="ons-container ons-container--gutterless@xxs@l{{ ' ons-container--full-width' if params.fullWidth or params.navigation.fullWidth }}{{ ' ons-container--wide' if params.wide or params.navigation.wide }}">
|
|
55
55
|
<ul class="ons-navigation__list ons-navigation__list">
|
|
56
|
-
{% for item in
|
|
56
|
+
{% for item in params.navigation.subNavigation.itemsList %}
|
|
57
57
|
<li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
|
|
58
58
|
<a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
|
|
59
59
|
</li>
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
<li class="ons-navigation__item">
|
|
80
80
|
<a class="ons-navigation__link" href="{{ params.navigation.subNavigation.overviewURL }}">{{ params.navigation.subNavigation.overviewText | default('Overview') }}</a>
|
|
81
81
|
</li>
|
|
82
|
-
{% for item in
|
|
82
|
+
{% for item in params.navigation.subNavigation.itemsList %}
|
|
83
83
|
<li class="ons-navigation__item {{ ' ons-navigation__item--active' if (item.url == params.navigation.subNavigation.currentPath) or (item.url == params.navigation.currentPath) or (params.navigation.currentPath is not string and item.url in params.navigation.currentPath) }}">
|
|
84
84
|
<a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id %}id="{{ item.id }}--mobile" {% endif %}>{{ item.title }}</a>
|
|
85
85
|
{% if item.sections %}
|
|
@@ -1,72 +1,68 @@
|
|
|
1
1
|
{% macro onsPagination(params) %}
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
{% set currentPageIndex = params.currentPageNumber|int %}
|
|
3
|
+
{% set totalPages = params.pages | length|int %}
|
|
4
|
+
{% set position = "Page " ~ currentPageIndex ~ " of " ~ totalPages %}
|
|
5
|
+
{% set lastPage = params.pages | last %}
|
|
6
|
+
{% set firstPage = params.pages | first %}
|
|
7
|
+
{% set prevPageIndex = currentPageIndex - 1 %}
|
|
8
|
+
{% set nextPageIndex = currentPageIndex + 1 %}
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<a href="{{ params.pages[currentPageIndex].url }}" class="ons-pagination__link" rel="next" aria-label="Go to the next page (Page {{ currentPageIndex + 1 }})">{{ params.next }}</a>
|
|
68
|
-
</li>
|
|
69
|
-
{% endif %}
|
|
70
|
-
</ul>
|
|
71
|
-
</nav>
|
|
10
|
+
<nav class="ons-pagination {{ params.classes }}{% if params.hideRangeIndicator %} ons-pagination--no-indicator{% endif %}" aria-label="Pagination ({{ position }})">
|
|
11
|
+
<div class="ons-pagination__position">{{ position }}</div>
|
|
12
|
+
<ul class="ons-pagination__items">
|
|
13
|
+
{% if currentPageIndex != 1 %}
|
|
14
|
+
{% set prevPageIndex = currentPageIndex - 2 %}
|
|
15
|
+
<li class="ons-pagination__item ons-pagination__item--previous">
|
|
16
|
+
<a href="{{ params.pages[prevPageIndex].url }}" class="ons-pagination__link" rel="prev" aria-label="Go to the previous page (Page {{ currentPageIndex - 1 }})">{{ params.previous }}</a>
|
|
17
|
+
</li>
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% if currentPageIndex > 2 %}
|
|
20
|
+
<li class="ons-pagination__item{% if (currentPageIndex == 1) %} ons-pagination__item--current{% endif %}">
|
|
21
|
+
<a href="{{ firstPage.url }}" class="ons-pagination__link" aria-label="Go to the first page (Page 1)">1</a>
|
|
22
|
+
</li>
|
|
23
|
+
{% endif %}
|
|
24
|
+
{% if currentPageIndex > 4 %}
|
|
25
|
+
<li class="ons-pagination__item ons-pagination__item--gap">…</li>
|
|
26
|
+
{% endif %}
|
|
27
|
+
{% for page in params.pages %}
|
|
28
|
+
{% set showPage = false %}
|
|
29
|
+
{# Show the current, next and previous page
|
|
30
|
+
Show page 2 if the current page index is within the first 4 pages
|
|
31
|
+
Show the penultimate page if the current page index is within the last 4 pages #}
|
|
32
|
+
{% if (loop.index == currentPageIndex) or (loop.index == currentPageIndex + 1) or (loop.index == currentPageIndex - 1) or (loop.index == 2 and currentPageIndex <= 4) or ((loop.index == totalPages - 1) and (currentPageIndex > totalPages - 4)) %}
|
|
33
|
+
{% set showPage = true %}
|
|
34
|
+
{% endif %}
|
|
35
|
+
{% if showPage == true %}
|
|
36
|
+
<li class="ons-pagination__item{% if loop.index == currentPageIndex %} ons-pagination__item--current{% endif %}">
|
|
37
|
+
<a href="{{ page.url }}" class="ons-pagination__link"
|
|
38
|
+
{%- if loop.index == currentPageIndex -%}
|
|
39
|
+
aria-current="true" aria-label="Current page ({{ position }})"
|
|
40
|
+
{%- else -%}
|
|
41
|
+
aria-label="Go to page {{ loop.index }}"
|
|
42
|
+
{%- endif -%}
|
|
43
|
+
{%- if loop.index == currentPageIndex - 1 -%}
|
|
44
|
+
rel="prev"
|
|
45
|
+
{%- endif -%}
|
|
46
|
+
{%- if loop.index == currentPageIndex + 1 -%}
|
|
47
|
+
rel="next"
|
|
48
|
+
{%- endif -%}
|
|
49
|
+
>{{ loop.index }}</a>
|
|
50
|
+
</li>
|
|
51
|
+
{% endif %}
|
|
52
|
+
{% endfor %}
|
|
53
|
+
{% if currentPageIndex < totalPages - 3 %}
|
|
54
|
+
<li class="ons-pagination__item ons-pagination__item--gap">…</li>
|
|
55
|
+
{% endif %}
|
|
56
|
+
{% if currentPageIndex < totalPages - 1 %}
|
|
57
|
+
<li class="ons-pagination__item{% if currentPageIndex == totalPages %} ons-pagination__item--current{% endif %}">
|
|
58
|
+
<a href="{{ lastPage.url }}" class="ons-pagination__link" aria-label="Go to the last page (Page {{ totalPages }})">{{ totalPages }}</a>
|
|
59
|
+
</li>
|
|
60
|
+
{% endif %}
|
|
61
|
+
{% if totalPages > 1 and totalPages != currentPageIndex %}
|
|
62
|
+
<li class="ons-pagination__item ons-pagination__item--next">
|
|
63
|
+
<a href="{{ params.pages[currentPageIndex].url }}" class="ons-pagination__link" rel="next" aria-label="Go to the next page (Page {{ currentPageIndex + 1 }})">{{ params.next }}</a>
|
|
64
|
+
</li>
|
|
65
|
+
{% endif %}
|
|
66
|
+
</ul>
|
|
67
|
+
</nav>
|
|
72
68
|
{% endmacro %}
|