@ons/design-system 50.0.0 → 52.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 (166) hide show
  1. package/README.md +35 -15
  2. package/components/access-code/_macro.njk +1 -1
  3. package/components/access-code/_macro.spec.js +162 -0
  4. package/components/access-code/uac.spec.js +26 -0
  5. package/components/accordion/_macro.spec.js +224 -0
  6. package/components/accordion/accordion.spec.js +134 -0
  7. package/components/address-input/_macro.njk +1 -1
  8. package/components/address-input/_macro.spec.js +465 -0
  9. package/components/address-input/autosuggest.address.js +5 -4
  10. package/components/address-input/autosuggest.address.setter.js +9 -3
  11. package/components/address-input/autosuggest.address.spec.js +733 -0
  12. package/components/address-output/_macro.njk +6 -6
  13. package/components/address-output/_macro.spec.js +122 -0
  14. package/components/autosuggest/_macro.njk +1 -1
  15. package/components/autosuggest/_macro.spec.js +229 -0
  16. package/components/autosuggest/autosuggest.helpers.js +2 -3
  17. package/components/autosuggest/autosuggest.helpers.spec.js +85 -0
  18. package/components/autosuggest/autosuggest.js +4 -2
  19. package/components/autosuggest/autosuggest.spec.js +625 -0
  20. package/components/autosuggest/autosuggest.ui.js +6 -2
  21. package/components/breadcrumbs/_macro.spec.js +129 -0
  22. package/components/button/_macro.njk +5 -5
  23. package/components/button/_macro.spec.js +446 -0
  24. package/components/button/button.spec.js +290 -0
  25. package/components/call-to-action/_macro.njk +3 -1
  26. package/components/call-to-action/_macro.spec.js +52 -0
  27. package/components/card/_macro.njk +26 -19
  28. package/components/card/_macro.spec.js +261 -0
  29. package/components/char-check-limit/_macro.spec.js +73 -0
  30. package/components/char-check-limit/character-check.spec.js +196 -0
  31. package/components/char-check-limit/character-limit.js +1 -1
  32. package/components/checkboxes/_checkbox-macro.spec.js +419 -0
  33. package/components/checkboxes/_macro.njk +1 -3
  34. package/components/checkboxes/_macro.spec.js +306 -0
  35. package/components/checkboxes/checkbox-with-autoselect.js +2 -1
  36. package/components/checkboxes/checkboxes.spec.js +208 -0
  37. package/components/code-highlight/_macro.spec.js +56 -0
  38. package/components/code-highlight/code-highlight.spec.js +18 -0
  39. package/components/collapsible/_macro.spec.js +204 -0
  40. package/components/collapsible/collapsible.js +2 -1
  41. package/components/collapsible/collapsible.spec.js +236 -0
  42. package/components/content-pagination/_macro.spec.js +199 -0
  43. package/components/cookies-banner/_macro.njk +1 -1
  44. package/components/cookies-banner/_macro.spec.js +171 -0
  45. package/components/cookies-banner/cookies-banner.spec.js +90 -0
  46. package/components/date-input/_macro.njk +6 -3
  47. package/components/date-input/_macro.spec.js +286 -0
  48. package/components/document-list/_macro.njk +3 -5
  49. package/components/document-list/_macro.spec.js +491 -0
  50. package/components/download-resources/download-resources.spec.js +540 -0
  51. package/components/duration/_macro.njk +7 -6
  52. package/components/duration/_macro.spec.js +251 -0
  53. package/components/error/_macro.spec.js +97 -0
  54. package/components/external-link/_macro.spec.js +60 -0
  55. package/components/feedback/_macro.njk +5 -3
  56. package/components/feedback/_macro.spec.js +122 -0
  57. package/components/field/_macro.njk +2 -2
  58. package/components/field/_macro.spec.js +97 -0
  59. package/components/fieldset/_macro.njk +3 -3
  60. package/components/fieldset/_macro.spec.js +173 -0
  61. package/components/footer/_macro.njk +12 -49
  62. package/components/footer/_macro.spec.js +549 -0
  63. package/components/header/_macro.njk +3 -3
  64. package/components/header/_macro.spec.js +562 -0
  65. package/components/hero/_hero.scss +0 -3
  66. package/components/hero/_macro.njk +4 -4
  67. package/components/hero/_macro.spec.js +224 -0
  68. package/components/icons/_macro.njk +15 -15
  69. package/components/icons/_macro.spec.js +140 -0
  70. package/components/images/_macro.njk +1 -1
  71. package/components/images/_macro.spec.js +121 -0
  72. package/components/input/_input-type.scss +12 -5
  73. package/components/input/_macro.njk +4 -5
  74. package/components/input/_macro.spec.js +658 -0
  75. package/components/label/_macro.spec.js +189 -0
  76. package/components/language-selector/_macro.spec.js +129 -0
  77. package/components/lists/_list.scss +4 -0
  78. package/components/lists/_macro.njk +4 -7
  79. package/components/lists/_macro.spec.js +618 -0
  80. package/components/message/_macro.spec.js +137 -0
  81. package/components/message-list/_macro.njk +7 -7
  82. package/components/message-list/_macro.spec.js +159 -0
  83. package/components/metadata/_macro.spec.js +167 -0
  84. package/components/modal/_macro.njk +6 -6
  85. package/components/modal/_macro.spec.js +87 -0
  86. package/components/modal/modal.js +0 -16
  87. package/components/modal/modal.spec.js +59 -0
  88. package/components/mutually-exclusive/_macro.njk +2 -2
  89. package/components/mutually-exclusive/_macro.spec.js +184 -0
  90. package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +203 -0
  91. package/components/mutually-exclusive/mutually-exclusive.date.spec.js +142 -0
  92. package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +141 -0
  93. package/components/mutually-exclusive/mutually-exclusive.email.spec.js +117 -0
  94. package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +213 -0
  95. package/components/mutually-exclusive/mutually-exclusive.number.spec.js +125 -0
  96. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +131 -0
  97. package/components/navigation/_macro.njk +6 -6
  98. package/components/navigation/_macro.spec.js +327 -0
  99. package/components/navigation/navigation.dom.js +1 -1
  100. package/components/navigation/navigation.spec.js +232 -0
  101. package/components/pagination/_macro.njk +1 -1
  102. package/components/pagination/_macro.spec.js +411 -0
  103. package/components/panel/_macro.njk +6 -6
  104. package/components/panel/_macro.spec.js +423 -0
  105. package/components/password/_macro.spec.js +137 -0
  106. package/components/password/password.spec.js +40 -0
  107. package/components/phase-banner/_macro.spec.js +73 -0
  108. package/components/promotional-banner/_macro.spec.js +97 -0
  109. package/components/question/_macro.njk +16 -22
  110. package/components/question/_macro.spec.js +309 -0
  111. package/components/quote/_macro.spec.js +81 -0
  112. package/components/radios/_macro.njk +3 -6
  113. package/components/radios/_macro.spec.js +575 -0
  114. package/components/radios/radios.spec.js +180 -0
  115. package/components/related-content/_macro.njk +1 -0
  116. package/components/related-content/_macro.spec.js +142 -0
  117. package/components/relationships/_macro.spec.js +108 -0
  118. package/components/relationships/relationships.spec.js +84 -0
  119. package/components/reply/_macro.njk +2 -2
  120. package/components/reply/_macro.spec.js +69 -0
  121. package/components/reply/reply.spec.js +78 -0
  122. package/components/search/_macro.njk +14 -12
  123. package/components/search/_macro.spec.js +44 -0
  124. package/components/search/_search.scss +7 -7
  125. package/components/section-navigation/_macro.njk +7 -2
  126. package/components/section-navigation/_macro.spec.js +206 -0
  127. package/components/select/_macro.njk +3 -3
  128. package/components/select/_macro.spec.js +203 -0
  129. package/components/select/select.spec.js +56 -0
  130. package/components/share-page/_macro.njk +2 -2
  131. package/components/share-page/_macro.spec.js +110 -0
  132. package/components/skip-to-content/_macro.spec.js +57 -0
  133. package/components/skip-to-content/skip-to-content.spec.js +44 -0
  134. package/components/status/_macro.spec.js +77 -0
  135. package/components/summary/_macro.njk +5 -5
  136. package/components/summary/_macro.spec.js +472 -0
  137. package/components/table/_macro.njk +2 -2
  138. package/components/table/_macro.spec.js +557 -0
  139. package/components/table/table.spec.js +155 -0
  140. package/components/table-of-contents/_macro.njk +35 -35
  141. package/components/table-of-contents/_macro.spec.js +178 -0
  142. package/components/table-of-contents/toc.js +29 -25
  143. package/components/table-of-contents/toc.spec.js +61 -0
  144. package/components/tabs/_macro.njk +1 -1
  145. package/components/tabs/_macro.spec.js +79 -0
  146. package/components/tabs/tabs.spec.js +162 -0
  147. package/components/text-indent/_macro.spec.js +52 -0
  148. package/components/textarea/_macro.njk +5 -3
  149. package/components/textarea/_macro.spec.js +300 -0
  150. package/components/textarea/textarea.spec.js +98 -0
  151. package/components/timeline/_macro.njk +3 -3
  152. package/components/timeline/_macro.spec.js +81 -0
  153. package/components/timeout-modal/_macro.spec.js +68 -0
  154. package/components/timeout-modal/timeout-modal.spec.js +226 -0
  155. package/components/timeout-panel/_macro.njk +0 -1
  156. package/components/timeout-panel/_macro.spec.js +54 -0
  157. package/components/timeout-panel/timeout-panel.dom.js +1 -2
  158. package/components/timeout-panel/timeout-panel.spec.js +161 -0
  159. package/components/upload/_macro.spec.js +75 -0
  160. package/components/video/_macro.spec.js +34 -0
  161. package/css/census.css +1 -1
  162. package/css/main.css +1 -1
  163. package/js/cookies-settings.spec.js +154 -0
  164. package/package.json +10 -23
  165. package/scripts/main.es5.js +1 -1
  166. package/scripts/main.js +2 -2
@@ -0,0 +1,189 @@
1
+ /** @jest-environment jsdom */
2
+
3
+ import * as cheerio from 'cheerio';
4
+
5
+ import axe from '../../tests/helpers/axe';
6
+ import { renderComponent } from '../../tests/helpers/rendering';
7
+
8
+ const EXAMPLE_LABEL = {
9
+ id: 'example-label',
10
+ for: 'some-input',
11
+ text: 'Example label text',
12
+ };
13
+
14
+ const EXAMPLE_LABEL_WITH_INPUT_TYPE = {
15
+ ...EXAMPLE_LABEL,
16
+ inputType: 'checkbox',
17
+ };
18
+
19
+ const EXAMPLE_LABEL_WITH_DESCRIPTION = {
20
+ ...EXAMPLE_LABEL,
21
+ description: 'An example description',
22
+ };
23
+
24
+ const EXAMPLE_LABEL_WITH_ACCESSIBLE_PLACEHOLDER = {
25
+ ...EXAMPLE_LABEL,
26
+ accessiblePlaceholder: 'An example placeholder',
27
+ };
28
+
29
+ describe('macro: label', () => {
30
+ it('passes jest-axe checks', async () => {
31
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL));
32
+
33
+ const results = await axe($.html());
34
+ expect(results).toHaveNoViolations();
35
+ });
36
+
37
+ it('passes jest-axe checks with description', async () => {
38
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL_WITH_DESCRIPTION));
39
+
40
+ const results = await axe($.html());
41
+ expect(results).toHaveNoViolations();
42
+ });
43
+
44
+ it('has the provided `id` attribute', () => {
45
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL));
46
+
47
+ expect($('.ons-label').attr('id')).toBe('example-label');
48
+ });
49
+
50
+ it('has the provided `for` attribute', () => {
51
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL));
52
+
53
+ expect($('.ons-label').attr('for')).toBe('some-input');
54
+ });
55
+
56
+ it.each([
57
+ ['`inputType` parameter is not provided', EXAMPLE_LABEL, true],
58
+ ['`inputType` parameter is provided', EXAMPLE_LABEL_WITH_INPUT_TYPE, false],
59
+ ])('has the `ons-label` block class when %s', (_, params, expectedState) => {
60
+ const $ = cheerio.load(renderComponent('label', params));
61
+
62
+ expect($('label').hasClass('ons-label')).toBe(expectedState);
63
+ });
64
+
65
+ it.each([
66
+ ['`description` parameter is not provided', EXAMPLE_LABEL, false],
67
+ ['`description` parameter is provided', EXAMPLE_LABEL_WITH_DESCRIPTION, true],
68
+ ])('has the `ons-label--with-description` modifier class when %s', (_, params, expectedState) => {
69
+ const $ = cheerio.load(renderComponent('label', params));
70
+
71
+ expect($('.ons-label').hasClass('ons-label--with-description')).toBe(expectedState);
72
+ });
73
+
74
+ it.each([
75
+ ['`accessiblePlaceholder` parameter is not provided', EXAMPLE_LABEL, false],
76
+ ['`accessiblePlaceholder` parameter is provided', EXAMPLE_LABEL_WITH_ACCESSIBLE_PLACEHOLDER, true],
77
+ ])('has the `ons-label--placeholder` modifier class when %s', (_, params, expectedState) => {
78
+ const $ = cheerio.load(renderComponent('label', params));
79
+
80
+ expect($('.ons-label').hasClass('ons-label--placeholder')).toBe(expectedState);
81
+ });
82
+
83
+ it('has additionally provided style classes', () => {
84
+ const $ = cheerio.load(
85
+ renderComponent('label', {
86
+ ...EXAMPLE_LABEL,
87
+ classes: 'extra-class another-extra-class',
88
+ }),
89
+ );
90
+
91
+ expect($('.ons-label').hasClass('extra-class')).toBe(true);
92
+ expect($('.ons-label').hasClass('another-extra-class')).toBe(true);
93
+ });
94
+
95
+ it('has additionally provided `attributes`', () => {
96
+ const $ = cheerio.load(
97
+ renderComponent('label', {
98
+ ...EXAMPLE_LABEL,
99
+ attributes: {
100
+ a: 123,
101
+ b: 456,
102
+ },
103
+ }),
104
+ );
105
+
106
+ expect($('.ons-label').attr('a')).toBe('123');
107
+ expect($('.ons-label').attr('b')).toBe('456');
108
+ });
109
+
110
+ it.each([
111
+ ['when without a description', EXAMPLE_LABEL],
112
+ ['when with a description', EXAMPLE_LABEL_WITH_DESCRIPTION],
113
+ ])('has the provided `text` %s', (_, params) => {
114
+ const $ = cheerio.load(renderComponent('label', params));
115
+
116
+ expect(
117
+ $('.ons-label')
118
+ .text()
119
+ .trim()
120
+ .startsWith('Example label text'),
121
+ ).toBe(true);
122
+ });
123
+
124
+ describe('description element', () => {
125
+ it.each([
126
+ ['when the `inputType` parameter is not provided', EXAMPLE_LABEL_WITH_DESCRIPTION],
127
+ [
128
+ 'when the "checkbox" `inputType` parameter is provided',
129
+ {
130
+ ...EXAMPLE_LABEL_WITH_DESCRIPTION,
131
+ inputType: 'checkbox',
132
+ },
133
+ ],
134
+ [
135
+ 'when the "radio" `inputType` parameter is provided',
136
+ {
137
+ ...EXAMPLE_LABEL_WITH_DESCRIPTION,
138
+ inputType: 'radio',
139
+ },
140
+ ],
141
+ ])('has the provided `description` text %s', (_, params) => {
142
+ const $ = cheerio.load(renderComponent('label', params));
143
+
144
+ expect(
145
+ $('.ons-label__description')
146
+ .text()
147
+ .trim(),
148
+ ).toBe('An example description');
149
+ });
150
+
151
+ it('has a default `id` attribute of `description-hint`', () => {
152
+ const $ = cheerio.load(
153
+ renderComponent('label', {
154
+ ...EXAMPLE_LABEL_WITH_DESCRIPTION,
155
+ id: undefined,
156
+ }),
157
+ );
158
+
159
+ expect($('.ons-label__description').attr('id')).toBe('description-hint');
160
+ });
161
+
162
+ it('has an `id` attribute which adds `-description-hint` to the provided `id`', () => {
163
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL_WITH_DESCRIPTION));
164
+
165
+ expect($('.ons-label__description').attr('id')).toBe('example-label-description-hint');
166
+ });
167
+
168
+ it('has the modifier class `ons-input--with-description` when `inputType` is not provided', () => {
169
+ const $ = cheerio.load(renderComponent('label', EXAMPLE_LABEL_WITH_DESCRIPTION));
170
+
171
+ expect($('.ons-label__description').hasClass('ons-input--with-description')).toBe(true);
172
+ });
173
+
174
+ it.each([
175
+ ['checkbox', 'ons-checkbox__label--with-description'],
176
+ ['radio', 'ons-radio__label--with-description'],
177
+ ])('has an input-specific modifier class when "%s" `inputType` is provided', (inputType, expectedInputSpecificModifier) => {
178
+ const $ = cheerio.load(
179
+ renderComponent('label', {
180
+ ...EXAMPLE_LABEL_WITH_DESCRIPTION,
181
+ inputType,
182
+ }),
183
+ );
184
+
185
+ expect($('.ons-label__description').hasClass(expectedInputSpecificModifier)).toBe(true);
186
+ expect($('.ons-label__description').hasClass('ons-input--with-description')).toBe(false);
187
+ });
188
+ });
189
+ });
@@ -0,0 +1,129 @@
1
+ /** @jest-environment jsdom */
2
+
3
+ import * as cheerio from 'cheerio';
4
+
5
+ import axe from '../../tests/helpers/axe';
6
+ import { renderComponent } from '../../tests/helpers/rendering';
7
+
8
+ const EXAMPLE_WITH_TWO_LANGUAGES = {
9
+ languages: [
10
+ {
11
+ url: '/english',
12
+ ISOCode: 'en',
13
+ text: 'English',
14
+ current: true,
15
+ },
16
+ {
17
+ url: '/cymraeg',
18
+ ISOCode: 'cy',
19
+ text: 'Cymraeg',
20
+ current: false,
21
+ attributes: {
22
+ a: 123,
23
+ b: 456,
24
+ },
25
+ },
26
+ ],
27
+ };
28
+
29
+ const EXAMPLE_WITH_THREE_LANGUAGES = {
30
+ languages: [
31
+ {
32
+ url: '/english',
33
+ ISOCode: 'en',
34
+ text: 'English',
35
+ current: false,
36
+ },
37
+ {
38
+ url: '/cymraeg',
39
+ ISOCode: 'cy',
40
+ text: 'Cymraeg',
41
+ current: true,
42
+ },
43
+ {
44
+ url: '/polski',
45
+ ISOCode: 'pl',
46
+ text: 'Polski',
47
+ current: false,
48
+ },
49
+ ],
50
+ };
51
+
52
+ describe('macro: language-selector', () => {
53
+ describe('mode: with two languages', () => {
54
+ it('passes jest-axe checks', async () => {
55
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
56
+
57
+ const results = await axe($.html());
58
+ expect(results).toHaveNoViolations();
59
+ });
60
+
61
+ it('has one language selector displayed', () => {
62
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
63
+
64
+ const $items = $('.ons-language-links__item');
65
+ expect($items.length).toBe(1);
66
+ });
67
+
68
+ it('does not show the current language', () => {
69
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
70
+
71
+ expect($('.ons-language-links__item a').text()).toBe('Cymraeg');
72
+ });
73
+
74
+ it('has the expected hyperlink URL', async () => {
75
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
76
+
77
+ const $hyperlink = $('.ons-language-links__item a');
78
+ expect($hyperlink.attr('href')).toBe('/cymraeg');
79
+ });
80
+
81
+ it('has the expected lang attribute value', async () => {
82
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
83
+
84
+ expect($('.ons-language-links__item a').attr('lang')).toBe('cy');
85
+ });
86
+
87
+ it('has additionally provided `attributes`', () => {
88
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
89
+
90
+ expect($('.ons-language-links__item a').attr('a')).toBe('123');
91
+ expect($('.ons-language-links__item a').attr('b')).toBe('456');
92
+ });
93
+
94
+ it('does not have a visibility class applied', () => {
95
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
96
+
97
+ expect($('.ons-language-links').hasClass('ons-u-d-no@xxs@m')).toBe(false);
98
+ });
99
+ });
100
+
101
+ describe('mode: with three languages', () => {
102
+ it('passes jest-axe checks', async () => {
103
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_THREE_LANGUAGES));
104
+
105
+ const results = await axe($.html());
106
+ expect(results).toHaveNoViolations();
107
+ });
108
+
109
+ it('has two language selectors displayed', () => {
110
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_THREE_LANGUAGES));
111
+
112
+ const $items = $('.ons-language-links__item');
113
+ expect($items.length).toBe(2);
114
+ });
115
+
116
+ it('does not show the current language', () => {
117
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_THREE_LANGUAGES));
118
+
119
+ expect($('.ons-language-links__item:first-child a').text()).toBe('English');
120
+ expect($('.ons-language-links__item:last-child a').text()).toBe('Polski');
121
+ });
122
+
123
+ it('has the visibility class applied', () => {
124
+ const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_THREE_LANGUAGES));
125
+
126
+ expect($('.ons-language-links').hasClass('ons-u-d-no@xxs@m')).toBe(true);
127
+ });
128
+ });
129
+ });
@@ -84,6 +84,10 @@
84
84
  margin-right: 0;
85
85
  }
86
86
  }
87
+
88
+ &--p {
89
+ padding: 0;
90
+ }
87
91
  }
88
92
 
89
93
  @include bp-suffix('ons-list--inline') {
@@ -20,16 +20,13 @@
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="{% if listLength > 1 or listEl == 'ul' %}ons-list{% else %}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 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 %}>
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
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 %}>
27
27
  {% endif %}
28
28
  {% set itemText = item.text %}
29
-
30
- {% if params.itemsList[0] is defined and item.iconType is defined and item.iconType %}
31
- {% set iconType = item.iconType if item.iconType else '' %}
32
- {% endif %}
29
+ {% set itemIconType = item.iconType if item.iconType is defined and item.iconType else iconType %}
33
30
 
34
31
  {# For Craft support we also support title and navigation title #}
35
32
  {% if item.navigationTitle is defined and item.navigationTitle %}
@@ -46,7 +43,7 @@
46
43
  {% from "components/icons/_macro.njk" import onsIcon %}
47
44
  {{
48
45
  onsIcon({
49
- "iconType": iconType,
46
+ "iconType": itemIconType,
50
47
  "iconSize": params.iconSize
51
48
  })
52
49
  }}
@@ -81,7 +78,7 @@
81
78
  {% from "components/icons/_macro.njk" import onsIcon %}
82
79
  {{
83
80
  onsIcon({
84
- "iconType": iconType,
81
+ "iconType": itemIconType,
85
82
  "iconSize": params.iconSize
86
83
  })
87
84
  }}