@ons/design-system 55.1.0 → 55.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/components/access-code/_macro.njk +3 -3
  2. package/components/accordion/_macro.njk +1 -1
  3. package/components/address-input/_macro.njk +7 -7
  4. package/components/address-output/_macro.njk +7 -7
  5. package/components/autosuggest/_macro.njk +19 -19
  6. package/components/breadcrumbs/_macro.njk +3 -3
  7. package/components/button/_button.scss +1 -1
  8. package/components/button/_macro.njk +24 -24
  9. package/components/call-to-action/_macro.njk +1 -1
  10. package/components/card/_macro.njk +10 -10
  11. package/components/checkboxes/_checkbox-macro.njk +9 -9
  12. package/components/checkboxes/_macro.njk +10 -10
  13. package/components/checkboxes/checkbox-with-fieldset.js +6 -5
  14. package/components/checkboxes/checkboxes.dom.js +6 -9
  15. package/components/code-highlight/_macro.njk +1 -1
  16. package/components/collapsible/_macro.njk +7 -7
  17. package/components/date-input/_macro.njk +5 -5
  18. package/components/document-list/_macro.njk +29 -29
  19. package/components/duration/_macro.njk +9 -9
  20. package/components/duration/_macro.spec.js +0 -3
  21. package/components/error/_macro.njk +1 -1
  22. package/components/external-link/_macro.njk +1 -1
  23. package/components/feedback/_macro.njk +2 -2
  24. package/components/field/_macro.njk +5 -5
  25. package/components/fieldset/_macro.njk +8 -8
  26. package/components/footer/_macro.njk +17 -17
  27. package/components/header/_macro.njk +33 -33
  28. package/components/hero/_macro.njk +15 -15
  29. package/components/icons/_macro.njk +2 -2
  30. package/components/images/_macro.njk +3 -3
  31. package/components/input/_input-type.scss +4 -0
  32. package/components/input/_macro.njk +40 -34
  33. package/components/input/_macro.spec.js +64 -59
  34. package/components/label/_macro.njk +1 -1
  35. package/components/language-selector/_macro.njk +1 -1
  36. package/components/lists/_macro.njk +22 -22
  37. package/components/message/_macro.njk +6 -6
  38. package/components/message-list/_macro.njk +1 -1
  39. package/components/metadata/_macro.njk +2 -2
  40. package/components/modal/_macro.njk +4 -4
  41. package/components/mutually-exclusive/_macro.njk +1 -1
  42. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  43. package/components/navigation/_macro.njk +8 -8
  44. package/components/pagination/_macro.njk +3 -3
  45. package/components/panel/_macro.njk +37 -39
  46. package/components/panel/_macro.spec.js +1 -13
  47. package/components/promotional-banner/_macro.njk +2 -2
  48. package/components/question/_macro.njk +18 -18
  49. package/components/quote/_macro.njk +2 -2
  50. package/components/radios/_macro.njk +8 -8
  51. package/components/radios/check-radios.js +5 -1
  52. package/components/related-content/_macro.njk +2 -2
  53. package/components/relationships/_macro.njk +2 -2
  54. package/components/section-navigation/_macro.njk +2 -2
  55. package/components/select/_macro.njk +8 -8
  56. package/components/share-page/_macro.njk +2 -2
  57. package/components/status/_macro.njk +2 -2
  58. package/components/summary/_macro.njk +25 -25
  59. package/components/table/_macro.njk +10 -10
  60. package/components/table-of-contents/_macro.njk +4 -4
  61. package/components/textarea/_macro.njk +8 -8
  62. package/components/timeline/_macro.njk +1 -1
  63. package/components/video/_macro.njk +1 -1
  64. package/css/census.css +1 -1
  65. package/css/ids.css +1 -1
  66. package/css/main.css +1 -1
  67. package/layout/_template.njk +35 -35
  68. package/package.json +1 -1
  69. package/scripts/main.es5.js +1 -1
  70. package/scripts/main.js +1 -1
@@ -79,6 +79,13 @@ const EXAMPLE_INPUT_WITH_MUTUALLY_EXCLUSIVE_WITH_ERROR = {
79
79
  };
80
80
 
81
81
  describe('macro: input', () => {
82
+ it('passes jest-axe checks', async () => {
83
+ const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_LABEL));
84
+
85
+ const results = await axe($.html());
86
+ expect(results).toHaveNoViolations();
87
+ });
88
+
82
89
  it('has the provided `id` attribute', () => {
83
90
  const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_MINIMAL));
84
91
 
@@ -374,7 +381,7 @@ describe('macro: input', () => {
374
381
  });
375
382
 
376
383
  describe('prefix and suffix', () => {
377
- it('adds `aria-labelledby` attribute when `prefix` is provided', () => {
384
+ it('passes jest-axe checks', async () => {
378
385
  const $ = cheerio.load(
379
386
  renderComponent('input', {
380
387
  ...EXAMPLE_INPUT_MINIMAL,
@@ -385,10 +392,11 @@ describe('macro: input', () => {
385
392
  }),
386
393
  );
387
394
 
388
- expect($('.ons-input').attr('aria-labelledby')).toBe('example-prefix-id');
395
+ const results = await axe($.html());
396
+ expect(results).toHaveNoViolations();
389
397
  });
390
398
 
391
- it('renders prefix element from `prefix.title`', () => {
399
+ it('adds `aria-labelledby` attribute when `prefix` is provided', () => {
392
400
  const $ = cheerio.load(
393
401
  renderComponent('input', {
394
402
  ...EXAMPLE_INPUT_MINIMAL,
@@ -399,13 +407,7 @@ describe('macro: input', () => {
399
407
  }),
400
408
  );
401
409
 
402
- expect($('.ons-input-type--prefix .ons-js-input-abbr').attr('id')).toBe('example-prefix-id');
403
- expect($('.ons-input-type--prefix .ons-js-input-abbr').attr('title')).toBe('Example prefix title');
404
- expect(
405
- $('.ons-input-type--prefix .ons-js-input-abbr')
406
- .text()
407
- .trim(),
408
- ).toBe('Example prefix title');
410
+ expect($('.ons-input').attr('aria-labelledby')).toBe('example-prefix-id');
409
411
  });
410
412
 
411
413
  it('renders prefix element from `prefix.text`', () => {
@@ -443,20 +445,6 @@ describe('macro: input', () => {
443
445
  expect($('.ons-input-type--prefix').length).toBe(0);
444
446
  });
445
447
 
446
- it('does not render prefix element when `prefix.title` not set', () => {
447
- const $ = cheerio.load(
448
- renderComponent('input', {
449
- ...EXAMPLE_INPUT_MINIMAL,
450
- prefix: {
451
- text: 'Example prefix text',
452
- id: 'example-prefix-id',
453
- },
454
- }),
455
- );
456
-
457
- expect($('.ons-input-type--prefix').length).toBe(0);
458
- });
459
-
460
448
  it('adds `aria-labelledby` attribute when `suffix` is provided', () => {
461
449
  const $ = cheerio.load(
462
450
  renderComponent('input', {
@@ -471,13 +459,14 @@ describe('macro: input', () => {
471
459
  expect($('.ons-input').attr('aria-labelledby')).toBe('example-suffix-id');
472
460
  });
473
461
 
474
- it('renders suffix element from `suffix.title`', () => {
462
+ it('renders suffix element from `suffix.text`', () => {
475
463
  const $ = cheerio.load(
476
464
  renderComponent('input', {
477
465
  ...EXAMPLE_INPUT_MINIMAL,
478
466
  suffix: {
479
467
  id: 'example-suffix-id',
480
468
  title: 'Example suffix title',
469
+ text: 'Example suffix text',
481
470
  },
482
471
  }),
483
472
  );
@@ -488,57 +477,51 @@ describe('macro: input', () => {
488
477
  $('.ons-js-input-abbr')
489
478
  .text()
490
479
  .trim(),
491
- ).toBe('Example suffix title');
480
+ ).toBe('Example suffix text');
492
481
  });
493
482
 
494
- it('renders suffix element from `suffix.text`', () => {
483
+ it('does not render suffix element when `suffix.id` not set', () => {
495
484
  const $ = cheerio.load(
496
485
  renderComponent('input', {
497
486
  ...EXAMPLE_INPUT_MINIMAL,
498
487
  suffix: {
499
- id: 'example-suffix-id',
500
488
  title: 'Example suffix title',
501
489
  text: 'Example suffix text',
502
490
  },
503
491
  }),
504
492
  );
505
493
 
506
- expect($('.ons-js-input-abbr').attr('id')).toBe('example-suffix-id');
507
- expect($('.ons-js-input-abbr').attr('title')).toBe('Example suffix title');
508
- expect(
509
- $('.ons-js-input-abbr')
510
- .text()
511
- .trim(),
512
- ).toBe('Example suffix text');
494
+ expect($('.ons-input').length).toBe(0);
513
495
  });
514
- });
515
496
 
516
- it('does not render suffix element when `suffix.id` not set', () => {
517
- const $ = cheerio.load(
518
- renderComponent('input', {
519
- ...EXAMPLE_INPUT_MINIMAL,
520
- suffix: {
521
- title: 'Example suffix title',
522
- text: 'Example suffix text',
523
- },
524
- }),
525
- );
497
+ it('renders an `abbr` tag when `title` set', () => {
498
+ const $ = cheerio.load(
499
+ renderComponent('input', {
500
+ ...EXAMPLE_INPUT_MINIMAL,
501
+ suffix: {
502
+ text: 'Example suffix text',
503
+ title: 'Example suffix title',
504
+ id: 'example-suffix-id',
505
+ },
506
+ }),
507
+ );
526
508
 
527
- expect($('.ons-input').length).toBe(0);
528
- });
509
+ expect($('.ons-input + abbr').length).toBe(1);
510
+ });
529
511
 
530
- it('does not render suffix element when `suffix.title` not set', () => {
531
- const $ = cheerio.load(
532
- renderComponent('input', {
533
- ...EXAMPLE_INPUT_MINIMAL,
534
- suffix: {
535
- text: 'Example suffix text',
536
- id: 'example-suffix-id',
537
- },
538
- }),
539
- );
512
+ it('renders a `span` tag when `title` not set', () => {
513
+ const $ = cheerio.load(
514
+ renderComponent('input', {
515
+ ...EXAMPLE_INPUT_MINIMAL,
516
+ suffix: {
517
+ text: 'Example suffix text',
518
+ id: 'example-suffix-id',
519
+ },
520
+ }),
521
+ );
540
522
 
541
- expect($('.ons-input').length).toBe(0);
523
+ expect($('.ons-input + span').length).toBe(1);
524
+ });
542
525
  });
543
526
 
544
527
  describe('search', () => {
@@ -577,6 +560,21 @@ describe('macro: input', () => {
577
560
  });
578
561
 
579
562
  describe('with character limit', () => {
563
+ it('passes jest-axe checks', async () => {
564
+ const $ = cheerio.load(
565
+ renderComponent('input', {
566
+ ...EXAMPLE_INPUT_WITH_CHARACTER_LIMIT,
567
+ label: {
568
+ id: 'example-input-label',
569
+ text: 'Example input label',
570
+ },
571
+ }),
572
+ );
573
+
574
+ const results = await axe($.html());
575
+ expect(results).toHaveNoViolations();
576
+ });
577
+
580
578
  it('has the provided minimum length', () => {
581
579
  const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_CHARACTER_LIMIT));
582
580
 
@@ -673,6 +671,13 @@ describe('macro: input', () => {
673
671
  });
674
672
 
675
673
  describe('mutually exclusive', () => {
674
+ it('passes jest-axe checks', async () => {
675
+ const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_MUTUALLY_EXCLUSIVE_WITH_ERROR));
676
+
677
+ const results = await axe($.html());
678
+ expect(results).toHaveNoViolations();
679
+ });
680
+
676
681
  it('has the `ons-js-exclusive-group-item` class', () => {
677
682
  const $ = cheerio.load(renderComponent('input', EXAMPLE_INPUT_WITH_MUTUALLY_EXCLUSIVE_WITH_ERROR));
678
683
 
@@ -22,7 +22,7 @@
22
22
  {% if params.description %}aria-describedby="{{ descriptionID }}"{% endif %}
23
23
  {% if params.for %} for="{{ params.for }}"{% endif %}
24
24
  {% if params.id %} id="{{ params.id }}"{% endif %}
25
- {% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
25
+ {% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
26
26
  >
27
27
 
28
28
  {{- params.text | safe -}}
@@ -5,7 +5,7 @@
5
5
  <ul class="ons-language-links{% if languageNumber and languageNumber != 2 %} ons-u-d-no@xxs@m{% endif %}">
6
6
  {% for language in alternativeLanguages %}
7
7
  <li class="ons-language-links__item">
8
- <a href="{{ language.url }}" lang="{{ language.ISOCode }}" {% if language.attributes is defined and language.attributes %}{% for attribute, value in (language.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}>{% if language.abbrText %}<span class="ons-u-d-no@s">{{ language.abbrText }}</span><span class="ons-u-d-no@xxs@s">{{ language.text }}</span>{% else %}{{ language.text }}{% endif %}</a>
8
+ <a href="{{ language.url }}" lang="{{ language.ISOCode }}" {% if language.attributes %}{% for attribute, value in (language.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}>{% if language.abbrText %}<span class="ons-u-d-no@s">{{ language.abbrText }}</span><span class="ons-u-d-no@xxs@s">{{ language.text }}</span>{% else %}{{ language.text }}{% endif %}</a>
9
9
  </li>
10
10
  {% endfor %}
11
11
  </ul>
@@ -2,44 +2,44 @@
2
2
  {% set variants = params.variants if params.variants else '' %}
3
3
  {% set listLength = params.itemsList | length %}
4
4
 
5
- {% if params.itemsList[0] is defined and params.itemsList[0].prefix %}
5
+ {% if params.itemsList[0].prefix %}
6
6
  {% set otherClasses = 'ons-list--bare ons-list--prefix' %}
7
- {% elif params.itemsList[0] is defined and params.itemsList[0].suffix %}
7
+ {% elif params.itemsList[0].suffix %}
8
8
  {% set otherClasses = 'ons-list--bare ons-list--suffix' %}
9
- {% elif params.itemsList[0] is defined and params.iconPosition is defined and params.iconPosition %}
9
+ {% elif params.iconPosition %}
10
10
  {% set otherClasses = 'ons-list--bare ons-list--icons' %}
11
11
  {% set iconType = params.iconType if params.iconType else '' %}
12
12
  {% else %}
13
13
  {% set otherClasses = '' %}
14
14
  {% endif %}
15
15
 
16
- {% if params.element is defined and params.element and listLength > 1 %}
16
+ {% if params.element and listLength > 1 %}
17
17
  {% set listEl = params.element | lower %}
18
- {% elif (params.element is defined and params.element == 'ol') and listLength < 2 %}
18
+ {% elif (params.element == 'ol') and listLength < 2 %}
19
19
  {% set listEl = 'p' %}
20
20
  {% else %}
21
21
  {% set listEl = 'ul' %}
22
22
  {% endif %}
23
- <{{listEl}} {% if params.id is defined and params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes is defined and params.classes %} {{ params.classes -}}{% endif %}{% if params.variants is defined and params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% 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 }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
23
+ <{{listEl}} {% if params.id %}id="{{ params.id }}"{% endif %} class="ons-list{% if listEl == 'p' %} ons-list--p{% endif %}{% if params.classes %} {{ params.classes -}}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-list--{{ variant }}{% endfor %}{% else %} ons-list--{{ params.variants }}{% endif %}{% endif %}{% if otherClasses %} {{ otherClasses -}}{% endif %}"{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
24
24
  {%- for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) -%}
25
25
  {% if listLength > 1 or listEl == 'ul' %}
26
- <li class="ons-list__item{% if item.listClasses is defined and item.listClasses %} {{ item.listClasses }}{% endif %}"{% if item.current is defined and item.current %} aria-current="true"{% endif %}>
26
+ <li class="ons-list__item{% if item.listClasses %} {{ item.listClasses }}{% endif %}"{% if item.current %} aria-current="true"{% endif %}>
27
27
  {% endif %}
28
28
  {% set itemText = item.text %}
29
- {% set itemIconType = item.iconType if item.iconType is defined and item.iconType else iconType %}
29
+ {% set itemIconType = item.iconType if item.iconType else iconType %}
30
30
 
31
31
  {# For Craft support we also support title and navigation title #}
32
- {% if item.navigationTitle is defined and item.navigationTitle %}
32
+ {% if item.navigationTitle %}
33
33
  {% set itemText = item.navigationTitle %}
34
- {% elif item.title is defined and item.title %}
34
+ {% elif item.title %}
35
35
  {% set itemText = item.title %}
36
36
  {% endif %}
37
37
 
38
- {%- if item.prefix is defined and item.prefix or (params.iconPosition is defined and params.iconPosition == 'before') -%}
38
+ {%- if item.prefix or (params.iconPosition == 'before') -%}
39
39
  <span class="ons-list__prefix"{% if listEl != 'ol' %} aria-hidden="true"{% endif %}>
40
- {%- if item.prefix is defined and item.prefix -%}
40
+ {%- if item.prefix -%}
41
41
  {{- item.prefix -}}.
42
- {% elif params.iconPosition is defined and params.iconPosition == 'before' %}
42
+ {% elif params.iconPosition == 'before' %}
43
43
  {% from "components/icons/_macro.njk" import onsIcon %}
44
44
  {{
45
45
  onsIcon({
@@ -50,8 +50,8 @@
50
50
  {%- endif -%}
51
51
  </span>
52
52
  {%- endif -%}
53
- {%- if item.url is defined and item.url and item.current != true -%}
54
- {%- if item.external is defined and item.external -%}
53
+ {%- if item.url and item.current != true -%}
54
+ {%- if item.external -%}
55
55
  {% from "components/external-link/_macro.njk" import onsExternalLink %}
56
56
  {{
57
57
  onsExternalLink({
@@ -60,21 +60,21 @@
60
60
  })
61
61
  }}
62
62
  {%- else -%}
63
- <a href="{{ item.url }}" class="ons-list__link{% if item.variants == 'inPageLink' %} ons-js-inpagelink{% endif %}{% if item.classes is defined and item.classes %} {{ item.classes }}{% endif %}"{% if item.target is defined and item.target %} target="{{ item.target }}"{% endif %}{% if item.attributes is defined and item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %} {{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
64
- {%- if item.prefix is defined and item.prefix -%}<span class="ons-u-vh">{{- item.prefix -}}</span>{%- endif -%} {{- itemText | safe -}}
65
- {%- if item.target is defined and item.target == "_blank" -%}<span class="ons-u-vh"> ({{- item.screenreaderMessage | default("opens in a new tab") -}})</span>{%- endif -%}
63
+ <a href="{{ item.url }}" class="ons-list__link{% if item.variants == 'inPageLink' %} ons-js-inpagelink{% endif %}{% if item.classes %} {{ item.classes }}{% endif %}"{% if item.target %} target="{{ item.target }}"{% endif %}{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %} {{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
64
+ {%- if item.prefix -%}<span class="ons-u-vh">{{- item.prefix -}}</span>{%- endif -%} {{- itemText | safe -}}
65
+ {%- if item.target == "_blank" -%}<span class="ons-u-vh"> ({{- item.screenreaderMessage | default("opens in a new tab") -}})</span>{%- endif -%}
66
66
  </a>
67
67
  {%- endif -%}
68
68
  {%- else -%}
69
69
  {{- itemText | safe -}}
70
70
  {%- endif -%}
71
- {%- if item.suffix is defined and item.suffix or (params.iconPosition is defined and params.iconPosition == 'after') -%}
71
+ {%- if item.suffix or (params.iconPosition == 'after') -%}
72
72
  <span class="ons-list__suffix"{% if listEl != 'ol' %} aria-hidden="true"{% endif %}>
73
- {%- if item.suffix is defined and item.suffix -%}
73
+ {%- if item.suffix -%}
74
74
  {{- item.suffix -}}
75
- {%- elif (item.index is defined and item.index and listEl != 'ol') or (item.index is defined and item.index and listEl == 'ol' and 'bare' in variants) -%}
75
+ {%- elif (item.index and listEl != 'ol') or (item.index and listEl == 'ol' and 'bare' in variants) -%}
76
76
  {{- loop.index -}}
77
- {% elif params.iconPosition is defined and params.iconPosition == 'after' %}
77
+ {% elif params.iconPosition == 'after' %}
78
78
  {% from "components/icons/_macro.njk" import onsIcon %}
79
79
  {{
80
80
  onsIcon({
@@ -1,21 +1,21 @@
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 is defined and params.id %} id="{{ params.id }}"{% endif %} {% if params.name is defined and params.name %} name="{{ params.name }}"{% endif %}>
4
+ <dl class="ons-message__metadata" {% if params.id %} id="{{ params.id }}"{% endif %} {% if params.name %} name="{{ params.name }}"{% endif %}>
5
5
  <div class="ons-message__sender">
6
6
  <dt class="ons-message__term ons-u-fw-b">{{ params.fromLabel }}:</dt>
7
- <dd class="ons-message__value ons-u-fw-b" {% if params.fromId is defined and params.fromId %} id="{{ params.fromId }}"{% endif %} {% if params.fromName is defined and params.fromName %} name="{{ params.fromName }}"{% endif %}>{{ params.fromValue }}</dd>
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>
8
8
  </div>
9
9
  <div class="ons-message__timestamp">
10
10
  <dt class="ons-message__term ons-u-fs-s">{{ params.sentLabel }}:</dt>
11
- <dd class="ons-message__value ons-u-fs-s" {% if params.sentId is defined and params.sentId %} id="{{ params.sentId }}"{% endif %} {% if params.sentName is defined and params.sentName %} name="{{ params.sentName }}"{% endif %}>{{ params.sentValue }}</dd>
11
+ <dd class="ons-message__value ons-u-fs-s" {% if params.sentId %} id="{{ params.sentId }}"{% endif %} {% if params.sentName %} name="{{ params.sentName }}"{% endif %}>{{ params.sentValue }}</dd>
12
12
  </div>
13
13
  </dl>
14
- {% if params.unreadLink is defined and params.unreadLink %}
15
- <a class="ons-message__unread-link" {% if params.unreadLinkId is defined and params.unreadLinkId %}id="{{ params.unreadLinkId }}"{% endif %} href="{{ params.unreadLink }}">{{ params.unreadLinkText }}</a>
14
+ {% if params.unreadLink %}
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 is defined and params.messageID %} id="{{ params.messageID }}"{% endif %} {% if params.messageName is defined and params.messageName %} name="{{ params.messageName }}"{% endif %}>
18
+ <div class="ons-message__body" {% if params.messageID %} id="{{ params.messageID }}"{% endif %} {% if params.messageName %} name="{{ params.messageName }}"{% endif %}>
19
19
  {{ caller() }}
20
20
  </div>
21
21
  </div>
@@ -4,7 +4,7 @@
4
4
  <li class="ons-message-item" aria-labelledby="{{ message.id }}">
5
5
  <h3 class="ons-message-item__subject" id="{{ message.id }}">
6
6
  <a href="{{ message.url }}" class="ons-u-fs-r--b">{{ message.subject }}</a>
7
- {% if message.unread is defined and message.unread %}<span class="ons-message-item__unread ons-u-fs-s">({{ params.unreadText }})</span>{% endif %}
7
+ {% if message.unread %}<span class="ons-message-item__unread ons-u-fs-s">({{ params.unreadText }})</span>{% endif %}
8
8
  </h3>
9
9
  <dl class="ons-message-item__metadata" aria-label="{{ params.ariaLabelMetaData | default("Message metadata") }}">
10
10
  <dt class="ons-message-item__metadata-term ons-message-item__metadata-term--from ons-u-vh">{{ params.fromLabel }}:</dt>
@@ -1,12 +1,12 @@
1
1
  {% macro onsMetadata(params) %}
2
- <dl class="ons-metadata ons-metadata__list ons-grid ons-grid--gutterless ons-u-cf{{ (' ' + params.classes) if params.classes is defined and params.classes }}"{% if params.id is defined and params.id %} id="{{ params.id }}" {% endif %}{% if params.metadataLabel is defined and params.metadataLabel %} title="{{ params.metadataLabel }}" aria-label="{{ params.metadataLabel }}"{% endif %}>
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
3
  {% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) %}
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 %}
7
7
  {% for description in item.descriptions %}
8
8
  {% if description.description | length %}
9
- <dd {% if description.id is defined and description.id %}id="{{ description.id }}" {% endif %}class="ons-metadata__value ons-grid__col ons-col-{{ params.descriptionCol }}@m">{{ description.description }}</dd>
9
+ <dd {% if description.id %}id="{{ description.id }}" {% endif %}class="ons-metadata__value ons-grid__col ons-col-{{ params.descriptionCol }}@m">{{ description.description }}</dd>
10
10
  {% endif %}
11
11
  {% endfor %}
12
12
  {% endfor %}
@@ -1,19 +1,19 @@
1
1
  {% macro onsModal(params) %}
2
2
  {% set modalId = params.id | default('dialog') %}
3
- <dialog class="ons-modal ons-js-modal {{ params.classes if params.classes is defined and params.classes else '' }}"
3
+ <dialog class="ons-modal ons-js-modal {{ params.classes if params.classes else '' }}"
4
4
  id="{{ modalId }}"
5
5
  role="dialog"
6
6
  aria-labelledby="ons-modal-title"
7
- {% 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 %}
7
+ {% if 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 %}
8
8
  >
9
9
  <div class="ons-modal__content">
10
10
  <h2 id="ons-modal-title" class="ons-modal__title">
11
11
  {{ params.title }}
12
12
  </h2>
13
13
  <div class="ons-modal__body">
14
- {{ (params.body if params.body is defined and params.body else "") | safe }}{{ caller() if caller }}
14
+ {{ (params.body if params.body else "") | safe }}{{ caller() if caller }}
15
15
  </div>
16
- {% if params.btnText is defined and params.btnText %}
16
+ {% if params.btnText %}
17
17
  {% from "components/button/_macro.njk" import onsButton %}
18
18
  {{ onsButton({
19
19
  "text": params.btnText,
@@ -21,7 +21,7 @@
21
21
  }) %}
22
22
  <div class="ons-js-mutually-exclusive ons-mutually-exclusive">
23
23
  {{ content | safe }}
24
- {% if params.autosuggestResults is defined and params.autosuggestResults %}
24
+ {% if params.autosuggestResults %}
25
25
  {{ params.autosuggestResults | safe }}
26
26
  {% endif %}
27
27
  {% if exclusiveOptionsLength == 1 %}
@@ -106,8 +106,10 @@ export default class MutuallyExclusive {
106
106
  let labelText;
107
107
 
108
108
  if (label) {
109
- if (label.classList.contains(inputAbbrClass)) {
109
+ if (label.classList.contains(inputAbbrClass) && label.querySelector('abbr')) {
110
110
  labelText = label.getAttribute('title');
111
+ } else if (label.classList.contains(inputAbbrClass) && label.querySelector('span')) {
112
+ labelText = label.querySelector('span').innerText;
111
113
  } else if (label.classList.contains(inputLegendClass) && label.querySelector('h1')) {
112
114
  labelText = label.querySelector('h1').innerText;
113
115
  } else {
@@ -3,7 +3,7 @@
3
3
  {% from "components/autosuggest/_macro.njk" import onsAutosuggest %}
4
4
  <div class="ons-navigation-wrapper{% if params.variants == 'neutral' %} ons-navigation-wrapper--neutral{% endif %}">
5
5
  <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 }}">
6
- {% if params.navigation.siteSearchAutosuggest is defined and params.navigation.siteSearchAutosuggest and isPatternLib is defined and isPatternLib %}
6
+ {% if params.navigation.siteSearchAutosuggest and isPatternLib %}
7
7
  <div class="ons-navigation-search ons-js-navigation-search">
8
8
  {% set autosuggestClasses = "ons-input-search ons-input-search--icon" %}
9
9
  {% set autosuggestLabelClasses = "ons-u-pl-m" %}
@@ -42,26 +42,26 @@
42
42
  <ul class="ons-navigation__list">
43
43
  {% for item in (params.navigation.itemsList if params.navigation.itemsList is iterable else params.navigation.itemsList.items()) %}
44
44
  <li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.currentPath) or (item.url != (params.navigation.siteBasePath | default('/')) and item.url in params.navigation.currentPath) }}">
45
- <a class="ons-navigation__link" href="{{ item.url }}" {% if item.id is defined and item.id %}id="{{ item.id }}" {% endif %}{% if item.ariaLabel is defined and item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %}>{{ item.title }}</a>
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>
47
47
  {% endfor %}
48
48
  </ul>
49
49
  </nav>
50
50
  </div>
51
51
  </div>
52
- {% if params.navigation.subNavigation is defined and params.navigation.subNavigation %}
53
- <nav class="ons-navigation ons-navigation--sub ons-u-d-no@xxs@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes is defined and params.navigation.subNavigation.classes }}" id="{{ params.navigation.subNavigation.id }}" aria-label="{{ params.navigation.subNavigation.ariaLabel | default("Section menu") }}" data-analytics="header-section-navigation">
52
+ {% if params.navigation.subNavigation %}
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.navigation.fullWidth }}{{ ' ons-container--wide' if params.navigation.wide }}">
55
55
  <ul class="ons-navigation__list ons-navigation__list">
56
56
  {% for item in (params.navigation.subNavigation.itemsList if params.navigation.subNavigation.itemsList is iterable else params.navigation.subNavigation.itemsList.items()) %}
57
57
  <li class="ons-navigation__item {{ item.classes }}{{ ' ons-navigation__item--active' if (item.url == params.navigation.subNavigation.currentPath) or (item.url != (params.navigation.subNavigation.siteBasePath | default('/')) and item.url in params.navigation.subNavigation.currentPath) }}">
58
- <a class="ons-navigation__link ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel is defined and item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id is defined and item.id %}id="{{ item.id }}" {% endif %}>{{ item.title }}</a>
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>
60
60
  {% endfor %}
61
61
  </ul>
62
62
  </div>
63
63
  </nav>
64
- <div class="ons-u-d-no@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes is defined and params.navigation.subNavigation.classes }}">
64
+ <div class="ons-u-d-no@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes }}">
65
65
  {{ onsButton({
66
66
  "text": params.navigation.currentPageTitle,
67
67
  "classes": "ons-u-d-no ons-js-sub-navigation-button ons-btn--dropdown",
@@ -80,14 +80,14 @@
80
80
  </li>
81
81
  {% for item in (params.navigation.subNavigation.itemsList if params.navigation.subNavigation.itemsList is iterable else params.navigation.subNavigation.itemsList.items()) %}
82
82
  <li class="ons-navigation__item {{ ' ons-navigation__item--active' if (item.url == params.navigation.subNavigation.currentPath) or (item.url != (params.navigation.subNavigation.siteBasePath | default('/')) and item.url in params.navigation.subNavigation.currentPath) }}">
83
- <a class="ons-navigation__link" href="{{ item.url }}" {% if item.ariaLabel is defined and item.ariaLabel %}aria-label="{{ item.ariaLabel }}" {% endif %} {% if item.id is defined and item.id %}id="{{ item.id }}--mobile" {% endif %}>{{ item.title }}</a>
83
+ <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>
84
84
  {% if item.sections %}
85
85
  {% for section in item.sections %}
86
86
  {% if section.sectionTitle %}<h3 class="ons-navigation__list-header">{{ section.sectionTitle }}</h3>{% endif %}
87
87
  <ul class="ons-navigation__list ons-navigation__list--child ons-list--dashed ons-u-ml-s ons-u-mt-xs">
88
88
  {% for child in section.children %}
89
89
  <li class="ons-navigation__item ons-list__item {{ ' ons-navigation__item--active' if (child.url == params.navigation.subNavigation.currentPath) or (child.url != (params.navigation.subNavigation.sitsiteBasePatheBasePath | default('/')) and child.url in params.navigation.subNavigation.currentPath) }}">
90
- <a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel is defined and child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id is defined and child.id %}id="{{ child.id }}" {% endif %}>{{ child.title }}</a>
90
+ <a class="ons-navigation__link ons-navigation__link--section" href="{{ child.url }}" {% if child.ariaLabel %}aria-label="{{ child.ariaLabel }}" {% endif %} {% if child.id %}id="{{ child.id }}" {% endif %}>{{ child.title }}</a>
91
91
  </li>
92
92
  {% endfor %}
93
93
  </ul>
@@ -1,7 +1,7 @@
1
1
  {% macro onsPagination(params) %}
2
2
  {% set currentPageIndex = "" %}
3
3
  {% for page in params.pages %}
4
- {% if page.current is defined and page.current %}
4
+ {% if page.current %}
5
5
  {% set currentPageIndex = loop.index %}
6
6
  {% endif %}
7
7
  {% endfor %}
@@ -25,7 +25,7 @@
25
25
  {% endif %}
26
26
 
27
27
 
28
- <nav class="ons-pagination {{ params.classes }}{% if params.hideRangeIndicator is defined and params.hideRangeIndicator %} ons-pagination--no-indicator{% endif %}" aria-label="Pagination ({{ position }})">
28
+ <nav class="ons-pagination {{ params.classes }}{% if params.hideRangeIndicator %} ons-pagination--no-indicator{% endif %}" aria-label="Pagination ({{ position }})">
29
29
  <div class="ons-pagination__position">{{ position }}</div>
30
30
  <ul class="ons-pagination__items">
31
31
  {% if currentPageIndex != 1 %}
@@ -45,7 +45,7 @@
45
45
  {% endif %}
46
46
  {% for page in params.pages %}
47
47
  {% if loop.index >= middlePagesStart and loop.index <= middlePagesEnd %}
48
- <li class="ons-pagination__item{% if page.current is defined and page.current == true %} ons-pagination__item--current{% endif %}">
48
+ <li class="ons-pagination__item{% if page.current == true %} ons-pagination__item--current{% endif %}">
49
49
  <a href="{{ page.url }}" class="ons-pagination__link"
50
50
  {%- if page.current -%}
51
51
  aria-current="true" aria-label="Current page ({{ position }})"