@ons/design-system 55.1.0 → 56.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.
Files changed (81) 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 +49 -51
  8. package/components/button/_macro.njk +61 -35
  9. package/components/button/_macro.spec.js +24 -24
  10. package/components/button/button.spec.js +11 -11
  11. package/components/call-to-action/_macro.njk +1 -1
  12. package/components/card/_macro.njk +10 -10
  13. package/components/checkboxes/_checkbox-macro.njk +9 -9
  14. package/components/checkboxes/_macro.njk +10 -10
  15. package/components/checkboxes/checkbox-with-fieldset.js +6 -5
  16. package/components/checkboxes/checkboxes.dom.js +6 -9
  17. package/components/code-highlight/_macro.njk +1 -1
  18. package/components/collapsible/_macro.njk +7 -7
  19. package/components/date-input/_macro.njk +5 -5
  20. package/components/document-list/_macro.njk +29 -29
  21. package/components/duration/_macro.njk +9 -9
  22. package/components/duration/_macro.spec.js +0 -3
  23. package/components/error/_macro.njk +1 -1
  24. package/components/external-link/_macro.njk +1 -1
  25. package/components/feedback/_macro.njk +2 -2
  26. package/components/field/_macro.njk +5 -5
  27. package/components/fieldset/_fieldset.scss +5 -0
  28. package/components/fieldset/_macro.njk +8 -8
  29. package/components/footer/_macro.njk +19 -23
  30. package/components/footer/_macro.spec.js +0 -6
  31. package/components/header/_macro.njk +39 -41
  32. package/components/header/_macro.spec.js +4 -8
  33. package/components/hero/_macro.njk +15 -15
  34. package/components/icons/_macro.njk +2 -2
  35. package/components/images/_macro.njk +3 -3
  36. package/components/input/_input-type.scss +4 -0
  37. package/components/input/_macro.njk +41 -34
  38. package/components/input/_macro.spec.js +66 -59
  39. package/components/label/_macro.njk +1 -1
  40. package/components/language-selector/_macro.njk +1 -1
  41. package/components/lists/_macro.njk +22 -22
  42. package/components/message/_macro.njk +6 -6
  43. package/components/message-list/_macro.njk +1 -1
  44. package/components/metadata/_macro.njk +2 -2
  45. package/components/modal/_macro.njk +4 -4
  46. package/components/mutually-exclusive/_macro.njk +1 -1
  47. package/components/mutually-exclusive/mutually-exclusive.js +3 -1
  48. package/components/navigation/_macro.njk +11 -10
  49. package/components/navigation/_macro.spec.js +3 -2
  50. package/components/pagination/_macro.njk +3 -3
  51. package/components/panel/_macro.njk +37 -39
  52. package/components/panel/_macro.spec.js +1 -13
  53. package/components/promotional-banner/_macro.njk +2 -2
  54. package/components/question/_macro.njk +20 -20
  55. package/components/question/_macro.spec.js +2 -2
  56. package/components/question/_question.scss +1 -1
  57. package/components/quote/_macro.njk +2 -2
  58. package/components/radios/_macro.njk +8 -8
  59. package/components/radios/check-radios.js +5 -1
  60. package/components/related-content/_macro.njk +2 -2
  61. package/components/relationships/_macro.njk +4 -3
  62. package/components/search/_macro.njk +12 -2
  63. package/components/search/_macro.spec.js +27 -2
  64. package/components/section-navigation/_macro.njk +2 -2
  65. package/components/select/_macro.njk +8 -8
  66. package/components/share-page/_macro.njk +2 -2
  67. package/components/status/_macro.njk +2 -2
  68. package/components/summary/_macro.njk +25 -25
  69. package/components/table/_macro.njk +10 -10
  70. package/components/table-of-contents/_macro.njk +4 -4
  71. package/components/textarea/_macro.njk +8 -8
  72. package/components/timeline/_macro.njk +1 -1
  73. package/components/video/_macro.njk +1 -1
  74. package/css/census.css +1 -1
  75. package/css/ids.css +1 -1
  76. package/css/main.css +1 -1
  77. package/layout/_template.njk +35 -35
  78. package/package.json +1 -1
  79. package/scripts/main.es5.js +1 -1
  80. package/scripts/main.js +1 -1
  81. package/scss/patternlib.scss +2 -2
@@ -1,20 +1,20 @@
1
1
  {% macro onsDocumentList(params) %}
2
- <ul{% if params.id is defined and params.id %} id="{{ params.id }}"{% endif %} class="ons-document-list{{ ' ' + params.classes if params.classes is defined and params.classes else '' }}"{% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
2
+ <ul{% if params.id %} id="{{ params.id }}"{% endif %} class="ons-document-list{{ ' ' + params.classes if params.classes else '' }}"{% 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 %}>
3
3
  {% for document in (params.documents if params.documents is iterable else params.documents.items()) %}
4
4
 
5
- <li class="ons-document-list__item{{ ' ons-document-list__item--featured' if document.featured is defined and document.featured }}{{ ' ons-document-list__item--full-width' if document.fullWidth is defined and document.fullWidth == true }}{{ ' ' + document.classes if document.classes is defined and document.classes else '' }}"{% if document.attributes is defined and document.attributes %}{% for attribute, value in (document.attributes.items() if document.attributes is mapping and document.attributes.items else document.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
5
+ <li class="ons-document-list__item{{ ' ons-document-list__item--featured' if document.featured }}{{ ' ons-document-list__item--full-width' if document.fullWidth == true }}{{ ' ' + document.classes if document.classes else '' }}"{% if document.attributes %}{% for attribute, value in (document.attributes.items() if document.attributes is mapping and document.attributes.items else document.attributes) %} {{attribute}}="{{value}}"{% endfor %}{% endif %}>
6
6
 
7
- {% if document.fullWidth is defined and document.fullWidth == true %}
7
+ {% if document.fullWidth == true %}
8
8
 
9
- <div class="ons-container{{ ' ons-container--wide' if document.wide is defined and document.wide == true }}">
9
+ <div class="ons-container{{ ' ons-container--wide' if document.wide == true }}">
10
10
 
11
11
  {% endif %}
12
12
 
13
- {% if document.thumbnail is defined or document.thumbnail == true %}
13
+ {% if document.thumbnail %}
14
14
 
15
- <div class="ons-document-list__item-image{%- if document.metadata.file is defined and document.metadata.file %} ons-document-list__item-image--file{% endif %}" aria-hidden="true">
15
+ <div class="ons-document-list__item-image{%- if document.metadata.file %} ons-document-list__item-image--file{% endif %}" aria-hidden="true">
16
16
  <a class="ons-document-list__image-link{{ ' ons-document-list__image-link--placeholder' if not document.thumbnail.smallSrc }}" href="{{ document.url }}" tabindex="-1">
17
- {% if document.thumbnail.smallSrc is defined and document.thumbnail.smallSrc and document.thumbnail.largeSrc is defined and document.thumbnail.largeSrc %}
17
+ {% if document.thumbnail.smallSrc and document.thumbnail.largeSrc %}
18
18
  <img srcset="{{ document.thumbnail.smallSrc }} 1x, {{ document.thumbnail.largeSrc }} 2x" src="{{ document.thumbnail.smallSrc }}" alt="" loading="lazy">
19
19
  {% endif %}
20
20
  </a>
@@ -24,18 +24,18 @@
24
24
 
25
25
  <div class="ons-document-list__item-content">
26
26
 
27
- <div class="ons-document-list__item-header{{ ' ons-document-list__item-header--reverse' if document.showMetadataFirst is defined and document.showMetadataFirst == true }}">
27
+ <div class="ons-document-list__item-header{{ ' ons-document-list__item-header--reverse' if document.showMetadataFirst == true }}">
28
28
 
29
29
  {% set titleTag = params.titleTag | default("h2") %}
30
30
 
31
31
  <{{ titleTag }} class="ons-document-list__item-title ons-u-fs-m ons-u-mt-no ons-u-mb-xs">
32
32
  <a href="{{ document.url }}">{{ document.title }}
33
- {%- if document.metadata is defined and document.metadata and document.metadata.file is defined and document.metadata.file %}
33
+ {%- if document.metadata and document.metadata.file %}
34
34
  <span class="ons-u-vh">
35
35
  {% set fileMetadataItems = [] %}
36
- {% if document.metadata.file.fileType is defined and document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType + ' document download'), fileMetadataItems) %}{% endif %}
37
- {% if document.metadata.file.fileSize is defined and document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
38
- {% if document.metadata.file.filePages is defined and document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
36
+ {% if document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType + ' document download'), fileMetadataItems) %}{% endif %}
37
+ {% if document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
38
+ {% if document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
39
39
 
40
40
  , {{ fileMetadataItems | join(', ') }}
41
41
 
@@ -44,45 +44,45 @@
44
44
  </span></a>
45
45
  </{{ titleTag }}>
46
46
 
47
- {%- if document.metadata is defined and document.metadata %}
47
+ {%- if document.metadata %}
48
48
 
49
- <ul class="ons-document-list__item-metadata{% if document.description is defined and document.description %} ons-u-mb-xs{% else %} ons-u-mb-no{% endif %}">
49
+ <ul class="ons-document-list__item-metadata{% if document.description %} ons-u-mb-xs{% else %} ons-u-mb-no{% endif %}">
50
50
 
51
- {%- if document.metadata.date is defined and document.metadata.date %}
51
+ {%- if document.metadata.date %}
52
52
  <li class="ons-document-list__item-attribute">
53
53
  {% if document.metadata.date -%}
54
- {% set prefixClasses = "ons-u-fw-b" if document.metadata.date.showPrefix is defined and document.metadata.date.showPrefix == true else "ons-u-vh" %}
54
+ {% set prefixClasses = "ons-u-fw-b" if document.metadata.date.showPrefix == true else "ons-u-vh" %}
55
55
  <span class="{{ prefixClasses }}">{{ document.metadata.date.prefix | default("Published") }}: </span>
56
56
  {%- endif -%}
57
- {% if document.metadata.date.iso is defined and document.metadata.date.iso -%}
57
+ {% if document.metadata.date.iso -%}
58
58
  <time datetime="{{ document.metadata.date.iso }}">{{ document.metadata.date.short }}</time>
59
59
  {%- endif %}
60
60
  </li>
61
61
  {% endif %}
62
62
 
63
- {%- if document.metadata.type is defined and document.metadata.type and document.metadata.type.text is defined and document.metadata.type.text %}
64
- <li class="ons-document-list__item-attribute{%- if document.metadata.file is defined and document.metadata.file %} ons-u-mr-no{% endif %}">
65
- {%- if document.metadata.type.url is defined and document.metadata.type.url %}
63
+ {%- if document.metadata.type and document.metadata.type.text %}
64
+ <li class="ons-document-list__item-attribute{%- if document.metadata.file %} ons-u-mr-no{% endif %}">
65
+ {%- if document.metadata.type.url %}
66
66
  <a class="ons-document-list__attribute-link" href="{{ document.metadata.type.url }}">
67
67
  {% endif %}
68
- <span {% if not document.metadata.file and not document.metadata.type.url %}class="ons-u-fw-b"{% endif %}>{{ document.metadata.type.text }}{%- if document.metadata.type.ref is defined and document.metadata.type.ref %}: {% elif document.metadata.file is defined and document.metadata.file %},{% endif %}</span>
69
- {%- if document.metadata.type.url is defined and document.metadata.type.url %}
68
+ <span {% if not document.metadata.file and not document.metadata.type.url %}class="ons-u-fw-b"{% endif %}>{{ document.metadata.type.text }}{%- if document.metadata.type.ref %}: {% elif document.metadata.file %},{% endif %}</span>
69
+ {%- if document.metadata.type.url %}
70
70
  </a>
71
71
  {% endif %}
72
- {%- if document.metadata.type.ref is defined and document.metadata.type.ref %}
72
+ {%- if document.metadata.type.ref %}
73
73
  <span>{{ document.metadata.type.ref }}</span>
74
74
  {% endif %}
75
75
  </li>
76
76
  {% endif %}
77
77
 
78
- {%- if document.metadata.file is defined and document.metadata.file and document.metadata.file.fileType is defined and document.metadata.file.fileType %}
78
+ {%- if document.metadata.file and document.metadata.file.fileType %}
79
79
 
80
80
  <li class="ons-document-list__item-attribute" aria-hidden="true">
81
81
  {% set fileMetadataItems = [] %}
82
82
 
83
- {% if document.metadata.file.fileType is defined and document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType), fileMetadataItems) %}{% endif %}
84
- {% if document.metadata.file.fileSize is defined and document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
85
- {% if document.metadata.file.filePages is defined and document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
83
+ {% if document.metadata.file.fileType %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileType), fileMetadataItems) %}{% endif %}
84
+ {% if document.metadata.file.fileSize %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.fileSize), fileMetadataItems) %}{% endif %}
85
+ {% if document.metadata.file.filePages %}{% set fileMetadataItems = (fileMetadataItems.push(document.metadata.file.filePages), fileMetadataItems) %}{% endif %}
86
86
 
87
87
  {{ fileMetadataItems | join(', ') }}
88
88
  </li>
@@ -93,13 +93,13 @@
93
93
  {% endif %}
94
94
  </div>
95
95
 
96
- {% if document.description is defined and document.description %}
96
+ {% if document.description %}
97
97
  <div class="ons-document-list__item-description">{{ document.description | safe }}</div>
98
98
  {% endif %}
99
99
 
100
100
  </div>
101
101
 
102
- {% if document.fullWidth is defined and document.fullWidth == true %}
102
+ {% if document.fullWidth == true %}
103
103
 
104
104
  </div>
105
105
 
@@ -7,26 +7,26 @@
7
7
  {% macro onsDuration(params) %}
8
8
  {% set numberOfFields = 0 %}
9
9
 
10
- {% if params.field1 is defined and params.field1 %}
10
+ {% if params.field1 %}
11
11
  {% set numberOfFields = numberOfFields + 1 %}
12
12
  {% endif %}
13
13
 
14
- {% if params.field2 is defined and params.field2 %}
14
+ {% if params.field2 %}
15
15
  {% set numberOfFields = numberOfFields + 1 %}
16
16
  {% endif %}
17
17
 
18
18
  {% set fields %}
19
- {% if params.field1 is defined and params.field1 %}
19
+ {% if params.field1 %}
20
20
  {{ onsInput({
21
21
  "id": params.field1.id,
22
- "classes": (" ons-input--error" if (params.error is defined and params.error and params.field1.error is defined and params.field1.error) or (numberOfFields > 1 and params.error is defined and params.error and not params.field1.error and not params.field2.error) else "") + (" ons-js-exclusive-group-item" if params.mutuallyExclusive else ""),
22
+ "classes": (" ons-input--error" if (params.error and params.field1.error) or (numberOfFields > 1 and params.error and not params.field1.error and not params.field2.error) else "") + (" ons-js-exclusive-group-item" if params.mutuallyExclusive else ""),
23
23
  "width": "2",
24
24
  "type": "number",
25
25
  "name": params.field1.name,
26
26
  "value": params.field1.value,
27
27
  "suffix": {
28
28
  "text": params.field1.suffix.text,
29
- "title": params.field1.suffix.title | default(params.field1.suffix.text),
29
+ "title": params.field1.suffix.title,
30
30
  "id": params.field1.suffix.id
31
31
  },
32
32
  "label": {
@@ -39,17 +39,17 @@
39
39
  }) }}
40
40
  {% endif %}
41
41
 
42
- {% if params.field2 is defined and params.field2 %}
42
+ {% if params.field2 %}
43
43
  {{ onsInput({
44
44
  "id": params.field2.id,
45
- "classes": (" ons-input--error" if (params.error is defined and params.error and params.field2.error is defined and params.field2.error) or (numberOfFields > 1 and params.error is defined and params.error and not params.field1.error and not params.field2.error) else "") + (" ons-js-exclusive-group-item" if params.mutuallyExclusive else ""),
45
+ "classes": (" ons-input--error" if (params.error and params.field2.error) or (numberOfFields > 1 and params.error and not params.field1.error and not params.field2.error) else "") + (" ons-js-exclusive-group-item" if params.mutuallyExclusive else ""),
46
46
  "width": "2",
47
47
  "type": "number",
48
48
  "name": params.field2.name,
49
49
  "value": params.field2.value,
50
50
  "suffix": {
51
51
  "text": params.field2.suffix.text,
52
- "title": params.field2.suffix.title | default(params.field2.suffix.text),
52
+ "title": params.field2.suffix.title,
53
53
  "id": params.field2.suffix.id
54
54
  },
55
55
  "label": {
@@ -63,7 +63,7 @@
63
63
  {% endif %}
64
64
  {% endset %}
65
65
 
66
- {% if params.mutuallyExclusive is defined and params.mutuallyExclusive %}
66
+ {% if params.mutuallyExclusive %}
67
67
  {% set mutuallyExclusive = params.mutuallyExclusive | setAttributes({
68
68
  "id": params.id,
69
69
  "legend": params.legendOrLabel,
@@ -78,7 +78,6 @@ describe('macro: duration', () => {
78
78
  suffix: {
79
79
  id: 'address-duration-years-suffix',
80
80
  text: 'Years',
81
- title: 'Years',
82
81
  },
83
82
  });
84
83
 
@@ -100,7 +99,6 @@ describe('macro: duration', () => {
100
99
  suffix: {
101
100
  id: 'address-duration-months-suffix',
102
101
  text: 'Months',
103
- title: 'Months',
104
102
  },
105
103
  });
106
104
  });
@@ -228,7 +226,6 @@ describe('macro: duration', () => {
228
226
  suffix: {
229
227
  id: 'address-duration-years-suffix',
230
228
  text: 'Years',
231
- title: 'Years',
232
229
  },
233
230
  });
234
231
  });
@@ -4,7 +4,7 @@
4
4
  {% set content %}
5
5
  <p
6
6
  class="ons-panel__error"
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 }}{% if value is defined and value %}="{{ value }}"{% endif %} {% 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 }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
8
8
  >
9
9
  <strong>{{ params.text }}</strong>
10
10
  </p>
@@ -1,6 +1,6 @@
1
1
  {# Icon needed to be directly put here instead of calling macro to solve an issue with extra space on the end of links being underlined #}
2
2
  {% macro onsExternalLink(params) %}
3
- <a href="{{ params.url }}" class="ons-external-link{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}" target="_blank" rel="noopener">
3
+ <a href="{{ params.url }}" class="ons-external-link{% if params.classes %} {{ params.classes }}{% endif %}" target="_blank" rel="noopener">
4
4
  <span class="ons-external-link__text">
5
5
  {{- params.linkText | safe -}}
6
6
  </span><span class="ons-external-link__icon">&nbsp;<svg class="ons-svg-icon" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true">
@@ -1,7 +1,7 @@
1
1
  {% macro onsFeedback(params) %}
2
2
  {% set headingLevel = params.headingLevel | default("2") %}
3
- <div {% if params.id is defined and params.id %} id="{{ params.id }}"{% endif %} class="ons-feedback{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}">
4
- <h{{ headingLevel }} class="ons-feedback__heading{{ ' ' + params.headingClasses if params.headingClasses is defined and params.headingClasses }}">
3
+ <div {% if params.id %} id="{{ params.id }}"{% endif %} class="ons-feedback{% if params.classes %} {{ params.classes }}{% endif %}">
4
+ <h{{ headingLevel }} class="ons-feedback__heading{{ ' ' + params.headingClasses if params.headingClasses }}">
5
5
  {{ params.heading }}
6
6
  </h{{ headingLevel }}>
7
7
  <p class="ons-feedback__content">{{- params.content | safe -}}</p>
@@ -6,20 +6,20 @@
6
6
  {% endif %}
7
7
 
8
8
  {% set field %}
9
- {% if params.dontWrap is defined and params.dontWrap %}
9
+ {% if params.dontWrap %}
10
10
  {{- caller() if caller -}}
11
11
  {% else %}
12
12
  <div
13
- {% if params.id is defined and params.id %}id="{{ params.id }}"{% endif %}
14
- class="ons-field{% if params.inline is defined and params.inline %} ons-field--inline{% endif %}{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}"
15
- {% 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 %}
13
+ {% if params.id %}id="{{ params.id }}"{% endif %}
14
+ class="ons-field{% if params.inline %} ons-field--inline{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}"
15
+ {% 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 %}
16
16
  >
17
17
  {{- caller() if caller -}}
18
18
  </div>
19
19
  {% endif %}
20
20
  {% endset %}
21
21
 
22
- {% if params.error is defined and params.error %}
22
+ {% if params.error %}
23
23
  {% call onsError(params.error) %}
24
24
  {{ field | safe }}
25
25
  {% endcall %}
@@ -9,6 +9,11 @@
9
9
  display: block;
10
10
  margin: 0;
11
11
  padding: 0 0 1.5rem;
12
+
13
+ em,
14
+ .ons-highlight {
15
+ @extend .ons-highlight;
16
+ }
12
17
  }
13
18
  }
14
19
 
@@ -3,19 +3,19 @@
3
3
  {% macro onsFieldset(params) %}
4
4
  {% set descriptionID = (params.id ~ "-" if params.id else "") ~ "legend-description" %}
5
5
  {% set fieldset -%}
6
- {% if params.dontWrap is defined and params.dontWrap -%}
6
+ {% if params.dontWrap -%}
7
7
  <div class="ons-input-items">
8
8
  {{- caller() if caller -}}
9
9
  </div>
10
- {%- elif (params.legend is defined and params.legend) or (params.legendIsQuestionTitle is defined and params.legendIsQuestionTitle) -%}
10
+ {%- elif params.legend or params.legendIsQuestionTitle -%}
11
11
  <fieldset
12
- {% if params.id is defined and params.id %}id="{{ params.id }}"{% endif %}
13
- class="ons-fieldset{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}"
14
- {% 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 %}
12
+ {% if params.id %}id="{{ params.id }}"{% endif %}
13
+ class="ons-fieldset{% if params.classes %} {{ params.classes }}{% endif %}"
14
+ {% 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 %}
15
15
  >
16
- <legend{% if params.description %} aria-describedBy="{{ descriptionID }}"{% endif %} class="ons-fieldset__legend{% if params.legendIsQuestionTitle %} ons-u-mb-no{% endif %}{% if params.legendClasses is defined and params.legendClasses %} {{ params.legendClasses }}{% endif %}{% if params.description %} ons-fieldset__legend--with-description{% endif %}">
16
+ <legend{% if params.description %} aria-describedBy="{{ descriptionID }}"{% endif %} class="ons-fieldset__legend{% if params.legendIsQuestionTitle %} ons-u-mb-no{% endif %}{% if params.legendClasses %} {{ params.legendClasses }}{% endif %}{% if params.description %} ons-fieldset__legend--with-description{% endif %}">
17
17
  {%- if params.legendIsQuestionTitle -%}
18
- <h1 id="fieldset-legend-title" class="ons-fieldset__legend-title{% if params.legendTitleClasses is defined and params.legendTitleClasses %} {{ params.legendTitleClasses }}{% endif %}">
18
+ <h1 id="fieldset-legend-title" class="ons-fieldset__legend-title{% if params.legendTitleClasses %} {{ params.legendTitleClasses }}{% endif %}">
19
19
  {{- params.legend | safe -}}
20
20
  </h1>
21
21
  {%- else -%}
@@ -32,7 +32,7 @@
32
32
  {%- endif %}
33
33
  {%- endset %}
34
34
 
35
- {% if params.error is defined and params.error -%}
35
+ {% if params.error -%}
36
36
  {% call onsError(params.error) %}
37
37
  {{- fieldset | safe -}}
38
38
  {% endcall %}
@@ -3,7 +3,7 @@
3
3
  {% from "components/lists/_macro.njk" import onsList %}
4
4
  {% from "components/icons/_macro.njk" import onsIcon %}
5
5
 
6
- {% if params.lang is defined and params.lang %}
6
+ {% if params.lang %}
7
7
  {% set lang = params.lang %}
8
8
  {% else %}
9
9
  {% set lang = 'en' %}
@@ -30,7 +30,7 @@
30
30
  {% endset %}
31
31
 
32
32
  {% set poweredByLogo %}
33
- {% if params.poweredBy is defined and params.poweredBy and params.poweredBy.logo is defined and params.poweredBy.logo %}
33
+ {% if params.poweredBy and params.poweredBy.logo %}
34
34
  {{
35
35
  onsIcon({
36
36
  "iconType": params.poweredBy.logo,
@@ -43,7 +43,7 @@
43
43
 
44
44
  <footer class="ons-footer">
45
45
 
46
- {% if params.footerWarning is defined and params.footerWarning %}
46
+ {% if params.footerWarning %}
47
47
  {% from "components/panel/_macro.njk" import onsPanel %}
48
48
  <div class="ons-footer__warning">
49
49
  <div class="ons-container">
@@ -58,39 +58,35 @@
58
58
  </div>
59
59
  {% endif %}
60
60
 
61
- {% if params.button is defined and params.button %}
61
+ {% if params.button %}
62
62
  {% from "components/button/_macro.njk" import onsButton %}
63
63
  <div class="ons-footer__button-container ons-u-d-no@m">
64
64
  {{
65
65
  onsButton({
66
66
  "id": params.button.id,
67
- "type": params.button.type,
68
67
  "classes": params.button.classes if params.button.classes else "",
69
68
  "variants": "ghost",
70
69
  "text": params.button.text,
71
- "html": params.button.html,
72
70
  "name": params.button.name,
73
- "value": params.button.value,
74
71
  "attributes": params.button.attributes,
75
72
  "url": params.button.url,
76
- "buttonStyle": params.button.buttonStyle,
77
- "iconType": params.button.iconType,
78
- "iconPosition": params.button.iconPosition
73
+ "iconType": "exit",
74
+ "iconPosition": "after"
79
75
  })
80
76
  }}
81
77
  </div>
82
78
  {% endif %}
83
79
 
84
- <div class="ons-footer__body{{ ' ' + params.classes if params.classes else '' }}" data-analytics="footer" {% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}>
80
+ <div class="ons-footer__body{{ ' ' + params.classes if params.classes else '' }}" data-analytics="footer" {% if params.attributes %}{% for attribute, value in (params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}>
85
81
  <div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
86
82
  <div class="ons-grid">
87
- {% if params.newTabWarning is defined and params.newTabWarning %}
83
+ {% if params.newTabWarning %}
88
84
  <div class="ons-grid__col">
89
85
  <p class="ons-u-fs-s ons-u-mb-m ons-footer__new-tab-warning">{{ params.newTabWarning | safe }}</p>
90
86
  </div>
91
87
  {% endif %}
92
88
 
93
- {% if params.cols is defined and params.cols %}
89
+ {% if params.cols %}
94
90
  {% for col in params.cols %}
95
91
  <!-- Full footer columns -->
96
92
  <div class="ons-grid__col ons-col-4@m{{ ' ons-u-mt-m@xxs@m' if loop.index > 1 }}">
@@ -106,7 +102,7 @@
106
102
  }}
107
103
  </div>
108
104
  {% endfor %}
109
- {% elif params.rows is defined and params.rows %}
105
+ {% elif params.rows %}
110
106
  {% for row in params.rows %}
111
107
  <!-- Transactional footer row -->
112
108
  <div class="ons-grid__col">
@@ -121,7 +117,7 @@
121
117
  {% endfor %}
122
118
  {% endif %}
123
119
 
124
- {% if (params.cols is defined and params.cols) or (params.rows is defined and params.rows) %}
120
+ {% if (params.cols) or (params.rows) %}
125
121
  <div class="ons-grid__col ons-u-mb-m">
126
122
  <hr class="ons-footer__hr">
127
123
  </div>
@@ -131,7 +127,7 @@
131
127
 
132
128
  <div class="ons-grid ons-grid--flex ons-grid--vertical-top ons-grid--between">
133
129
  <div class="ons-grid__col">
134
- {% if params.legal is defined and params.legal %}
130
+ {% if params.legal %}
135
131
  <!-- Legal -->
136
132
  {% for legal in params.legal %}
137
133
  {{
@@ -144,7 +140,7 @@
144
140
  {% endfor %}
145
141
  {% endif %}
146
142
 
147
- {% if params.OGLLink == true or params.OGLLink is defined %}
143
+ {% if params.OGLLink %}
148
144
  <!-- OGL -->
149
145
  <div class="ons-footer__license ons-u-mb-m">
150
146
  {{
@@ -152,9 +148,9 @@
152
148
  "iconType": 'ogl'
153
149
  })
154
150
  }}
155
- {% if params.OGLLink.HTML is defined and params.OGLLink.HTML %}
151
+ {% if params.OGLLink.HTML %}
156
152
  {{ params.OGLLink.HTML | safe }}
157
- {% elif params.OGLLink == true or params.OGLLink is defined %}
153
+ {% elif params.OGLLink %}
158
154
  {% from "components/external-link/_macro.njk" import onsExternalLink %}
159
155
  {% if params.lang == 'cy' %}
160
156
  {{ params.OGLLink.pre | default('Mae’r holl gynnwys ar gael o dan y') }} {{
@@ -175,7 +171,7 @@
175
171
  </div>
176
172
  {% endif %}
177
173
 
178
- {% if params.poweredBy is defined and params.poweredBy %}
174
+ {% if params.poweredBy %}
179
175
  {% if not params.poweredBy.partnership %}
180
176
  <div class="ons-footer__poweredby ons-u-mb-m">
181
177
  {{ poweredByLogo | safe }}
@@ -188,7 +184,7 @@
188
184
  {% endif %}
189
185
  </div>
190
186
 
191
- {% if params.crest is defined and params.crest %}
187
+ {% if params.crest %}
192
188
  <!-- Crest -->
193
189
  <div class="ons-grid__col ons-footer__crest ons-u-mb-m@xxs@l">
194
190
  {{
@@ -200,7 +196,7 @@
200
196
  {% endif %}
201
197
  </div>
202
198
 
203
- {% if (params.poweredBy is defined and params.poweredBy) and (params.poweredBy.partnership is defined and params.poweredBy.partnership) %}
199
+ {% if (params.poweredBy) and (params.poweredBy.partnership) %}
204
200
  <div class="ons-grid ons-grid--flex ons-grid--vertical-bottom ons-grid--between ons-u-mt-l">
205
201
  <div class="ons-grid__col ons-footer__poweredby ons-u-mb-m">
206
202
  {{ poweredByLogo | safe }}
@@ -229,7 +225,7 @@
229
225
  </div>
230
226
  {% endif %}
231
227
 
232
- {% if params.copyrightDeclaration is defined and params.copyrightDeclaration %}
228
+ {% if params.copyrightDeclaration %}
233
229
  <!-- Copyright -->
234
230
  <div class="ons-grid">
235
231
  <div class="ons-grid__col">
@@ -547,17 +547,11 @@ describe('macro: footer', () => {
547
547
  const params = {
548
548
  button: {
549
549
  id: 'save-and-sign-out',
550
- type: 'button',
551
550
  classes: 'extra-class',
552
551
  text: 'Save changes and sign out',
553
- html: '<strong>html</strong>',
554
552
  name: 'button-name',
555
- value: 'button-value',
556
553
  attributes: { a: 42 },
557
554
  url: 'https://example.com/',
558
- buttonStyle: 'mobile',
559
- iconType: 'exit',
560
- iconPosition: 'before',
561
555
  },
562
556
  };
563
557