@ons/design-system 55.2.0 → 56.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/button/_button.scss +48 -50
- package/components/button/_macro.njk +45 -19
- package/components/button/_macro.spec.js +24 -24
- package/components/button/button.spec.js +11 -11
- package/components/fieldset/_fieldset.scss +5 -0
- package/components/footer/_macro.njk +2 -6
- package/components/footer/_macro.spec.js +0 -6
- package/components/header/_macro.njk +6 -8
- package/components/header/_macro.spec.js +4 -8
- package/components/input/_macro.njk +1 -0
- package/components/input/_macro.spec.js +2 -0
- package/components/modal/_macro.njk +1 -0
- package/components/modal/modal.js +33 -0
- package/components/modal/modal.spec.js +76 -0
- package/components/navigation/_macro.njk +3 -2
- package/components/navigation/_macro.spec.js +3 -2
- package/components/question/_macro.njk +2 -2
- package/components/question/_macro.spec.js +2 -2
- package/components/question/_question.scss +1 -1
- package/components/relationships/_macro.njk +2 -1
- package/components/search/_macro.njk +12 -2
- package/components/search/_macro.spec.js +27 -2
- package/components/summary/_macro.njk +23 -29
- package/components/summary/_macro.spec.js +38 -38
- package/components/summary/_summary.scss +41 -10
- package/components/timeout-modal/_macro.njk +1 -0
- package/components/timeout-modal/timeout-modal.js +1 -1
- package/components/timeout-modal/timeout-modal.spec.js +68 -0
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/patternlib.scss +2 -2
|
@@ -30,13 +30,6 @@ $button-shadow-size: 3px;
|
|
|
30
30
|
top: 0;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
.ons-svg-icon {
|
|
34
|
-
height: 18px;
|
|
35
|
-
margin-top: -$button-shadow-size;
|
|
36
|
-
vertical-align: middle;
|
|
37
|
-
width: 18px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
33
|
&--search {
|
|
41
34
|
.ons-svg-icon {
|
|
42
35
|
@include mq(s, l) {
|
|
@@ -55,6 +48,14 @@ $button-shadow-size: 3px;
|
|
|
55
48
|
// Required for Google Tag Manager
|
|
56
49
|
pointer-events: none;
|
|
57
50
|
position: relative;
|
|
51
|
+
|
|
52
|
+
.ons-svg-icon {
|
|
53
|
+
fill: $color-text-inverse;
|
|
54
|
+
height: 18px;
|
|
55
|
+
margin-top: -$button-shadow-size;
|
|
56
|
+
vertical-align: middle;
|
|
57
|
+
width: 18px;
|
|
58
|
+
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
61
|
// When preceded by another button (for example, in a group)
|
|
@@ -74,6 +75,10 @@ $button-shadow-size: 3px;
|
|
|
74
75
|
background: $color-focus;
|
|
75
76
|
box-shadow: 0 ems($button-shadow-size) 0 $color-text-link-focus;
|
|
76
77
|
color: $color-text-link-focus;
|
|
78
|
+
|
|
79
|
+
.ons-svg-icon {
|
|
80
|
+
fill: $color-text-link-focus;
|
|
81
|
+
}
|
|
77
82
|
}
|
|
78
83
|
|
|
79
84
|
&:focus:hover:not(:active) &__inner {
|
|
@@ -87,6 +92,10 @@ $button-shadow-size: 3px;
|
|
|
87
92
|
background: $color-button;
|
|
88
93
|
box-shadow: none;
|
|
89
94
|
color: $color-text-inverse;
|
|
95
|
+
|
|
96
|
+
.ons-svg-icon {
|
|
97
|
+
fill: $color-text-inverse;
|
|
98
|
+
}
|
|
90
99
|
}
|
|
91
100
|
}
|
|
92
101
|
|
|
@@ -156,16 +165,6 @@ $button-shadow-size: 3px;
|
|
|
156
165
|
text-decoration: none;
|
|
157
166
|
}
|
|
158
167
|
|
|
159
|
-
&--link:not(&--secondary) &,
|
|
160
|
-
&--link:active:not(&--secondary) &,
|
|
161
|
-
&--link:hover:not(&--secondary) & {
|
|
162
|
-
&__inner {
|
|
163
|
-
.ons-svg-icon {
|
|
164
|
-
fill: $color-text-inverse;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
168
|
&--link:focus:not(:active):not(&--secondary) &,
|
|
170
169
|
&--link:focus:hover:not(:active):not(&--secondary) & {
|
|
171
170
|
outline: inherit;
|
|
@@ -177,38 +176,6 @@ $button-shadow-size: 3px;
|
|
|
177
176
|
}
|
|
178
177
|
}
|
|
179
178
|
|
|
180
|
-
&--loader &__inner {
|
|
181
|
-
position: relative;
|
|
182
|
-
transition: color 0.3s ease-in-out;
|
|
183
|
-
.ons-svg-icon {
|
|
184
|
-
height: 27px;
|
|
185
|
-
left: 50%;
|
|
186
|
-
margin: 0;
|
|
187
|
-
opacity: 0;
|
|
188
|
-
position: absolute;
|
|
189
|
-
top: 50%;
|
|
190
|
-
transform: translate(-50%, -50%);
|
|
191
|
-
transition: opacity 0.3s ease-in-out;
|
|
192
|
-
width: 27px;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&--loader.ons-btn--small {
|
|
197
|
-
.ons-svg-icon {
|
|
198
|
-
height: 24px;
|
|
199
|
-
width: 24px;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
&--loader.ons-is-loading &__inner {
|
|
204
|
-
color: transparent;
|
|
205
|
-
.ons-svg-icon {
|
|
206
|
-
fill: $color-white;
|
|
207
|
-
margin-left: 0 !important;
|
|
208
|
-
opacity: 1;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
179
|
&--text-link {
|
|
213
180
|
vertical-align: baseline;
|
|
214
181
|
}
|
|
@@ -298,7 +265,7 @@ $button-shadow-size: 3px;
|
|
|
298
265
|
box-shadow: none;
|
|
299
266
|
color: $color-text;
|
|
300
267
|
.ons-svg-icon {
|
|
301
|
-
fill: $color-
|
|
268
|
+
fill: $color-text;
|
|
302
269
|
}
|
|
303
270
|
}
|
|
304
271
|
}
|
|
@@ -394,6 +361,37 @@ $button-shadow-size: 3px;
|
|
|
394
361
|
}
|
|
395
362
|
}
|
|
396
363
|
|
|
364
|
+
&--loader &__inner {
|
|
365
|
+
position: relative;
|
|
366
|
+
transition: color 0.3s ease-in-out;
|
|
367
|
+
.ons-svg-icon {
|
|
368
|
+
height: 27px;
|
|
369
|
+
left: 50%;
|
|
370
|
+
margin: 0;
|
|
371
|
+
opacity: 0;
|
|
372
|
+
position: absolute;
|
|
373
|
+
top: 50%;
|
|
374
|
+
transform: translate(-50%, -50%);
|
|
375
|
+
transition: opacity 0.3s ease-in-out;
|
|
376
|
+
width: 27px;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
&--loader.ons-btn--small {
|
|
381
|
+
.ons-svg-icon {
|
|
382
|
+
height: 24px;
|
|
383
|
+
width: 24px;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&--loader.ons-is-loading &__inner {
|
|
388
|
+
color: transparent;
|
|
389
|
+
.ons-svg-icon {
|
|
390
|
+
margin-left: 0 !important;
|
|
391
|
+
opacity: 1;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
|
|
397
395
|
&--dropdown:focus & {
|
|
398
396
|
&__inner {
|
|
399
397
|
box-shadow: inset 0 -4px 0 0 $color-text-link-focus;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
{% macro onsButton(params) %}
|
|
4
4
|
|
|
5
|
-
{#
|
|
5
|
+
{# Set button icon #}
|
|
6
6
|
{% if params.iconType %}
|
|
7
7
|
{% set iconType = params.iconType %}
|
|
8
8
|
{% if params.iconPosition %}
|
|
@@ -12,29 +12,55 @@
|
|
|
12
12
|
{% set iconPosition = "before" %}
|
|
13
13
|
{% endif %}
|
|
14
14
|
{% elif params.iconType is not defined and params.noIcon is not defined %}
|
|
15
|
-
{# Opens in new tab #}
|
|
16
15
|
{% if params.url and params.newWindow %}
|
|
16
|
+
{# CTA link opening in new tab #}
|
|
17
17
|
{% set iconType = "external-link" %}
|
|
18
18
|
{% set iconPosition = "after" %}
|
|
19
|
-
{
|
|
20
|
-
{
|
|
21
|
-
{% set iconType = "
|
|
22
|
-
{% set iconPosition = "
|
|
23
|
-
{
|
|
24
|
-
|
|
19
|
+
{% elif params.url %}
|
|
20
|
+
{# CTA link #}
|
|
21
|
+
{% set iconType = "arrow-next" %}
|
|
22
|
+
{% set iconPosition = "after" %}
|
|
23
|
+
{% endif %}
|
|
24
|
+
{% endif %}
|
|
25
|
+
|
|
26
|
+
{# Set button type #}
|
|
27
|
+
{% if params.type %}
|
|
28
|
+
{% set buttonType = params.type %}
|
|
29
|
+
{% else %}
|
|
30
|
+
{% set buttonType = 'submit' %}
|
|
31
|
+
{% endif %}
|
|
32
|
+
|
|
33
|
+
{# Set button variant attributes #}
|
|
34
|
+
{% if params.variants %}
|
|
35
|
+
{% if 'print' in params.variants %}
|
|
36
|
+
{# Print #}
|
|
37
|
+
{% if params.type is not defined %}
|
|
38
|
+
{% set buttonType = "button" %}
|
|
39
|
+
{% endif %}
|
|
25
40
|
{% set iconType = "print" %}
|
|
26
41
|
{% set iconPosition = "before" %}
|
|
27
|
-
|
|
28
|
-
{% elif params.
|
|
29
|
-
{
|
|
30
|
-
{% set
|
|
31
|
-
|
|
32
|
-
|
|
42
|
+
{% set variantClasses = "ons-u-d-no ons-js-print-btn" %}
|
|
43
|
+
{% elif 'download' in params.variants %}
|
|
44
|
+
{# Download #}
|
|
45
|
+
{% set iconType = "download" %}
|
|
46
|
+
{% set iconPosition = "before" %}
|
|
47
|
+
{% if not params.removeDownloadAttribute %}
|
|
48
|
+
{% set variantAttributes = "download" %}
|
|
49
|
+
{% endif %}
|
|
50
|
+
{% elif 'mobile' in params.variants %}
|
|
51
|
+
{# CTA or mobile menu toggle #}
|
|
33
52
|
{% set iconType = "chevron" %}
|
|
34
53
|
{% set iconPosition = "after" %}
|
|
35
|
-
{% elif params.
|
|
36
|
-
{% set
|
|
54
|
+
{% elif 'disabled' in params.variants %}
|
|
55
|
+
{% set variantAttributes = "disabled" %}
|
|
56
|
+
{% elif 'timer' in params.variants %}
|
|
57
|
+
{# Timer #}
|
|
58
|
+
{% set variantClasses = "ons-js-timer ons-js-submit-btn" %}
|
|
59
|
+
{% elif 'loader' in params.variants %}
|
|
60
|
+
{# Loader #}
|
|
61
|
+
{% set iconType = "loader" %}
|
|
37
62
|
{% set iconPosition = "after" %}
|
|
63
|
+
{% set variantClasses = "ons-btn--loader ons-js-loader ons-js-submit-btn" %}
|
|
38
64
|
{% endif %}
|
|
39
65
|
{% endif %}
|
|
40
66
|
|
|
@@ -45,14 +71,14 @@
|
|
|
45
71
|
href="{{ params.url }}"
|
|
46
72
|
role="button"
|
|
47
73
|
{% else %}
|
|
48
|
-
type="{{
|
|
74
|
+
type="{{ buttonType }}"
|
|
49
75
|
{% endif %}
|
|
50
|
-
class="ons-btn{% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-btn--{{ variant }}{% endfor %}{% else %} ons-btn--{{ params.variants }}{% endif %}{% endif %}{% if params.url %} ons-btn--link ons-js-submit-btn{% endif %}{% if
|
|
76
|
+
class="ons-btn{% if params.classes %} {{ params.classes }}{% endif %}{% if params.variants %}{% if params.variants is not string %}{% for variant in params.variants %} ons-btn--{{ variant }}{% endfor %}{% else %} ons-btn--{{ params.variants }}{% endif %}{% endif %}{% if params.url %} ons-btn--link ons-js-submit-btn{% endif %}{% if variantClasses %} {{ variantClasses }}{% endif %}"
|
|
51
77
|
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
52
78
|
{% if params.value and tag != "a" %}value="{{ params.value }}"{% endif %}
|
|
53
79
|
{% if params.name and tag != "a" %}name="{{ params.name }}"{% endif %}
|
|
54
80
|
{% if params.url and params.newWindow %}target="_blank" rel="noopener"{% endif %}
|
|
55
|
-
{
|
|
81
|
+
{{ variantAttributes }}
|
|
56
82
|
{% 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 %}
|
|
57
83
|
>
|
|
58
84
|
<span class="ons-btn__inner{% if params.innerClasses %} {{ params.innerClasses }}{% endif %}">
|
|
@@ -57,33 +57,33 @@ describe('macro: button', () => {
|
|
|
57
57
|
expect($('.ons-btn').hasClass('ons-btn--variant-b')).toBe(true);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
it('has download variant style class when `
|
|
60
|
+
it('has download variant style class when `variants` contains `download`', () => {
|
|
61
61
|
const $ = cheerio.load(
|
|
62
62
|
renderComponent('button', {
|
|
63
63
|
url: 'http://example.com',
|
|
64
|
-
|
|
64
|
+
variants: 'download',
|
|
65
65
|
}),
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
expect($('.ons-btn').hasClass('ons-btn--download')).toBe(true);
|
|
69
69
|
});
|
|
70
70
|
|
|
71
|
-
it('has `download` icon when `
|
|
71
|
+
it('has `download` icon when `variants` contains "download"', () => {
|
|
72
72
|
const faker = templateFaker();
|
|
73
73
|
const iconsSpy = faker.spy('icons');
|
|
74
74
|
|
|
75
75
|
faker.renderComponent('button', {
|
|
76
76
|
url: 'http://example.com',
|
|
77
|
-
|
|
77
|
+
variants: 'download',
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
expect(iconsSpy.occurrences[0].iconType).toBe('download');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
it('has provided variant style classes when `
|
|
83
|
+
it('has provided variant style classes when `variants` contains "print"', () => {
|
|
84
84
|
const $ = cheerio.load(
|
|
85
85
|
renderComponent('button', {
|
|
86
|
-
|
|
86
|
+
variants: 'print',
|
|
87
87
|
}),
|
|
88
88
|
);
|
|
89
89
|
|
|
@@ -92,22 +92,22 @@ describe('macro: button', () => {
|
|
|
92
92
|
expect($('.ons-btn').hasClass('ons-js-print-btn')).toBe(true);
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it('has `print` icon when `
|
|
95
|
+
it('has `print` icon when `variants` contains "print"', () => {
|
|
96
96
|
const faker = templateFaker();
|
|
97
97
|
const iconsSpy = faker.spy('icons');
|
|
98
98
|
|
|
99
99
|
faker.renderComponent('button', {
|
|
100
100
|
url: 'http://example.com',
|
|
101
|
-
|
|
101
|
+
variants: 'print',
|
|
102
102
|
});
|
|
103
103
|
|
|
104
104
|
expect(iconsSpy.occurrences[0].iconType).toBe('print');
|
|
105
105
|
});
|
|
106
106
|
|
|
107
|
-
it('has provided variant style classes when `
|
|
107
|
+
it('has provided variant style classes when `variants` contains "loader"', () => {
|
|
108
108
|
const $ = cheerio.load(
|
|
109
109
|
renderComponent('button', {
|
|
110
|
-
|
|
110
|
+
variants: 'loader',
|
|
111
111
|
}),
|
|
112
112
|
);
|
|
113
113
|
|
|
@@ -116,32 +116,32 @@ describe('macro: button', () => {
|
|
|
116
116
|
expect($('.ons-btn').hasClass('ons-js-submit-btn')).toBe(true);
|
|
117
117
|
});
|
|
118
118
|
|
|
119
|
-
it('has `loader` icon when `
|
|
119
|
+
it('has `loader` icon when `variants` contains "loader"', () => {
|
|
120
120
|
const faker = templateFaker();
|
|
121
121
|
const iconsSpy = faker.spy('icons');
|
|
122
122
|
|
|
123
123
|
faker.renderComponent('button', {
|
|
124
|
-
|
|
124
|
+
variants: 'loader',
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
expect(iconsSpy.occurrences[0].iconType).toBe('loader');
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('has `chevron` icon when `
|
|
130
|
+
it('has `chevron` icon when `variants` contains "mobile"', () => {
|
|
131
131
|
const faker = templateFaker();
|
|
132
132
|
const iconsSpy = faker.spy('icons');
|
|
133
133
|
|
|
134
134
|
faker.renderComponent('button', {
|
|
135
|
-
|
|
135
|
+
variants: 'mobile',
|
|
136
136
|
});
|
|
137
137
|
|
|
138
138
|
expect(iconsSpy.occurrences[0].iconType).toBe('chevron');
|
|
139
139
|
});
|
|
140
140
|
|
|
141
|
-
it('has provided variant style classes when `
|
|
141
|
+
it('has provided variant style classes when `variants` contains "timer"', () => {
|
|
142
142
|
const $ = cheerio.load(
|
|
143
143
|
renderComponent('button', {
|
|
144
|
-
|
|
144
|
+
variants: 'timer',
|
|
145
145
|
}),
|
|
146
146
|
);
|
|
147
147
|
|
|
@@ -259,11 +259,11 @@ describe('macro: button', () => {
|
|
|
259
259
|
expect($('button').attr('type')).toBe('special-type');
|
|
260
260
|
});
|
|
261
261
|
|
|
262
|
-
it('has the provided `type` attribute even if
|
|
262
|
+
it('has the provided `type` attribute even if print variant is provided', () => {
|
|
263
263
|
const $ = cheerio.load(
|
|
264
264
|
renderComponent('button', {
|
|
265
265
|
type: 'special-type',
|
|
266
|
-
|
|
266
|
+
variants: 'print',
|
|
267
267
|
}),
|
|
268
268
|
);
|
|
269
269
|
|
|
@@ -276,10 +276,10 @@ describe('macro: button', () => {
|
|
|
276
276
|
expect($('button').attr('type')).toBe('submit');
|
|
277
277
|
});
|
|
278
278
|
|
|
279
|
-
it('defaults to being a "button" when `type` is not provided and `
|
|
279
|
+
it('defaults to being a "button" when `type` is not provided and `variants` contains "print"', () => {
|
|
280
280
|
const $ = cheerio.load(
|
|
281
281
|
renderComponent('button', {
|
|
282
|
-
|
|
282
|
+
variants: 'print',
|
|
283
283
|
}),
|
|
284
284
|
);
|
|
285
285
|
|
|
@@ -422,20 +422,20 @@ describe('macro: button', () => {
|
|
|
422
422
|
expect($('.ons-btn__new-window-description').text()).toBe(' (custom opens in a new window text)');
|
|
423
423
|
});
|
|
424
424
|
|
|
425
|
-
it('has the `download` attribute when `
|
|
425
|
+
it('has the `download` attribute when `variants` contains "download"', () => {
|
|
426
426
|
const $ = cheerio.load(
|
|
427
427
|
renderComponent('button', {
|
|
428
|
-
|
|
428
|
+
variants: 'download',
|
|
429
429
|
}),
|
|
430
430
|
);
|
|
431
431
|
|
|
432
432
|
expect($('.ons-btn').attr('download')).toBeDefined();
|
|
433
433
|
});
|
|
434
434
|
|
|
435
|
-
it('does not have the `download` attribute when `
|
|
435
|
+
it('does not have the `download` attribute when `variants` contains "download" and `removeDownloadAttribute` is `true`', () => {
|
|
436
436
|
const $ = cheerio.load(
|
|
437
437
|
renderComponent('button', {
|
|
438
|
-
|
|
438
|
+
variants: 'download',
|
|
439
439
|
removeDownloadAttribute: true,
|
|
440
440
|
}),
|
|
441
441
|
);
|
|
@@ -56,7 +56,7 @@ describe('script: button', () => {
|
|
|
56
56
|
renderComponent('button', {
|
|
57
57
|
id: 'test-button',
|
|
58
58
|
text: 'Submit',
|
|
59
|
-
|
|
59
|
+
variants: 'loader',
|
|
60
60
|
}),
|
|
61
61
|
);
|
|
62
62
|
|
|
@@ -72,7 +72,7 @@ describe('script: button', () => {
|
|
|
72
72
|
renderComponent('button', {
|
|
73
73
|
id: 'test-button',
|
|
74
74
|
text: 'Submit',
|
|
75
|
-
|
|
75
|
+
variants: 'loader',
|
|
76
76
|
}),
|
|
77
77
|
);
|
|
78
78
|
|
|
@@ -86,7 +86,7 @@ describe('script: button', () => {
|
|
|
86
86
|
renderComponent('button', {
|
|
87
87
|
id: 'test-button',
|
|
88
88
|
text: 'Submit',
|
|
89
|
-
|
|
89
|
+
variants: 'loader',
|
|
90
90
|
}),
|
|
91
91
|
);
|
|
92
92
|
|
|
@@ -104,7 +104,7 @@ describe('script: button', () => {
|
|
|
104
104
|
${renderComponent('button', {
|
|
105
105
|
id: 'test-button',
|
|
106
106
|
text: 'Submit',
|
|
107
|
-
|
|
107
|
+
variants: 'loader',
|
|
108
108
|
})}
|
|
109
109
|
</form>
|
|
110
110
|
`,
|
|
@@ -124,7 +124,7 @@ describe('script: button', () => {
|
|
|
124
124
|
${renderComponent('button', {
|
|
125
125
|
id: 'test-button',
|
|
126
126
|
text: 'Submit',
|
|
127
|
-
|
|
127
|
+
variants: 'loader',
|
|
128
128
|
})}
|
|
129
129
|
</form>
|
|
130
130
|
`,
|
|
@@ -142,7 +142,7 @@ describe('script: button', () => {
|
|
|
142
142
|
${renderComponent('button', {
|
|
143
143
|
id: 'test-button',
|
|
144
144
|
text: 'Submit',
|
|
145
|
-
|
|
145
|
+
variants: 'loader',
|
|
146
146
|
})}
|
|
147
147
|
</form>
|
|
148
148
|
`,
|
|
@@ -161,7 +161,7 @@ describe('script: button', () => {
|
|
|
161
161
|
'/test',
|
|
162
162
|
renderComponent('button', {
|
|
163
163
|
id: 'test-button',
|
|
164
|
-
|
|
164
|
+
variants: 'timer',
|
|
165
165
|
text: 'Submit',
|
|
166
166
|
}),
|
|
167
167
|
);
|
|
@@ -186,7 +186,7 @@ describe('script: button', () => {
|
|
|
186
186
|
'/test',
|
|
187
187
|
renderComponent('button', {
|
|
188
188
|
id: 'test-button',
|
|
189
|
-
|
|
189
|
+
variants: 'timer',
|
|
190
190
|
text: 'Submit',
|
|
191
191
|
}),
|
|
192
192
|
);
|
|
@@ -213,7 +213,7 @@ describe('script: button', () => {
|
|
|
213
213
|
<form>
|
|
214
214
|
${renderComponent('button', {
|
|
215
215
|
id: 'test-button',
|
|
216
|
-
|
|
216
|
+
variants: 'timer',
|
|
217
217
|
text: 'Submit',
|
|
218
218
|
})}
|
|
219
219
|
</form>
|
|
@@ -242,7 +242,7 @@ describe('script: button', () => {
|
|
|
242
242
|
<form>
|
|
243
243
|
${renderComponent('button', {
|
|
244
244
|
id: 'test-button',
|
|
245
|
-
|
|
245
|
+
variants: 'timer',
|
|
246
246
|
text: 'Submit',
|
|
247
247
|
})}
|
|
248
248
|
</form>
|
|
@@ -273,7 +273,7 @@ describe('script: button', () => {
|
|
|
273
273
|
id: 'test-button',
|
|
274
274
|
type: 'button',
|
|
275
275
|
text: 'Print this page',
|
|
276
|
-
|
|
276
|
+
variants: 'print',
|
|
277
277
|
}),
|
|
278
278
|
);
|
|
279
279
|
|
|
@@ -64,18 +64,14 @@
|
|
|
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
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"iconPosition": params.button.iconPosition
|
|
73
|
+
"iconType": "exit",
|
|
74
|
+
"iconPosition": "after"
|
|
79
75
|
})
|
|
80
76
|
}}
|
|
81
77
|
</div>
|
|
@@ -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
|
|
|
@@ -105,16 +105,15 @@
|
|
|
105
105
|
</div>
|
|
106
106
|
{% if params.serviceLinks.itemsList | length > 1 or params.language %}
|
|
107
107
|
{% if params.variants == 'internal' or params.variants == 'neutral' %}
|
|
108
|
-
{% set buttonVariant = ["text-link", "text-link-inverse"] %}
|
|
108
|
+
{% set buttonVariant = ["mobile", "text-link", "text-link-inverse"] %}
|
|
109
109
|
{% else %}
|
|
110
|
-
{% set buttonVariant = "text-link" %}
|
|
110
|
+
{% set buttonVariant = ["mobile", "text-link"] %}
|
|
111
111
|
{% endif %}
|
|
112
112
|
<div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
|
|
113
113
|
{{ onsButton({
|
|
114
114
|
"text": params.serviceLinks.toggleServicesButton.text | default("Account"),
|
|
115
115
|
"classes": "ons-u-d-no ons-js-toggle-services",
|
|
116
116
|
"type": "button",
|
|
117
|
-
"buttonStyle": "mobile",
|
|
118
117
|
"variants": buttonVariant,
|
|
119
118
|
"attributes": {
|
|
120
119
|
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu"),
|
|
@@ -210,7 +209,7 @@
|
|
|
210
209
|
|
|
211
210
|
{% if params.button %}
|
|
212
211
|
{% if params.variants == 'neutral' %}
|
|
213
|
-
{% set buttonVariant =
|
|
212
|
+
{% set buttonVariant = "ghost-dark" %}
|
|
214
213
|
{% else %}
|
|
215
214
|
{% set buttonVariant = "ghost" %}
|
|
216
215
|
{% endif %}
|
|
@@ -222,8 +221,8 @@
|
|
|
222
221
|
"name": params.button.name,
|
|
223
222
|
"attributes": params.button.attributes,
|
|
224
223
|
"url": params.button.url,
|
|
225
|
-
"iconType":
|
|
226
|
-
"iconPosition":
|
|
224
|
+
"iconType": "exit",
|
|
225
|
+
"iconPosition": "after"
|
|
227
226
|
}) }}
|
|
228
227
|
</div>
|
|
229
228
|
{% endif %}
|
|
@@ -239,7 +238,7 @@
|
|
|
239
238
|
{% endif %}
|
|
240
239
|
{% if params.navigation.siteSearchAutosuggest %}
|
|
241
240
|
{% if params.variants == 'neutral' %}
|
|
242
|
-
{% set buttonVariant = ["small", "ghost
|
|
241
|
+
{% set buttonVariant = ["small", "ghost-dark"] %}
|
|
243
242
|
{% else %}
|
|
244
243
|
{% set buttonVariant = ["small", "ghost"] %}
|
|
245
244
|
{% endif %}
|
|
@@ -267,7 +266,6 @@
|
|
|
267
266
|
{{ onsButton({
|
|
268
267
|
"text": params.navigation.toggleNavigationButton.text,
|
|
269
268
|
"classes": "ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
|
|
270
|
-
"buttonStyle": "mobile",
|
|
271
269
|
"variants": buttonVariant,
|
|
272
270
|
"attributes": {
|
|
273
271
|
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
|
|
@@ -333,8 +333,6 @@ describe('macro: header', () => {
|
|
|
333
333
|
a: 'b',
|
|
334
334
|
},
|
|
335
335
|
url: '#0',
|
|
336
|
-
iconType: 'button-icon',
|
|
337
|
-
iconPosition: 'before',
|
|
338
336
|
},
|
|
339
337
|
});
|
|
340
338
|
|
|
@@ -347,8 +345,8 @@ describe('macro: header', () => {
|
|
|
347
345
|
a: 'b',
|
|
348
346
|
},
|
|
349
347
|
url: '#0',
|
|
350
|
-
iconType: '
|
|
351
|
-
iconPosition: '
|
|
348
|
+
iconType: 'exit',
|
|
349
|
+
iconPosition: 'after',
|
|
352
350
|
});
|
|
353
351
|
});
|
|
354
352
|
|
|
@@ -491,8 +489,7 @@ describe('macro: header', () => {
|
|
|
491
489
|
text: 'Menu',
|
|
492
490
|
classes: 'ons-u-d-no ons-js-toggle-services',
|
|
493
491
|
type: 'button',
|
|
494
|
-
|
|
495
|
-
variants: 'text-link',
|
|
492
|
+
variants: ['mobile', 'text-link'],
|
|
496
493
|
attributes: {
|
|
497
494
|
'aria-label': 'Toggle services menu',
|
|
498
495
|
'aria-controls': 'service-links',
|
|
@@ -523,7 +520,7 @@ describe('macro: header', () => {
|
|
|
523
520
|
},
|
|
524
521
|
});
|
|
525
522
|
|
|
526
|
-
expect(buttonSpy.occurrences[0]).toHaveProperty('variants', ['text-link', 'text-link-inverse']);
|
|
523
|
+
expect(buttonSpy.occurrences[0]).toHaveProperty('variants', ['mobile', 'text-link', 'text-link-inverse']);
|
|
527
524
|
});
|
|
528
525
|
|
|
529
526
|
it('does not render a button for a single services link', () => {
|
|
@@ -623,7 +620,6 @@ describe('macro: header', () => {
|
|
|
623
620
|
expect(buttonSpy.occurrences[0]).toEqual({
|
|
624
621
|
text: 'Menu',
|
|
625
622
|
classes: 'ons-u-ml-xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l',
|
|
626
|
-
buttonStyle: 'mobile',
|
|
627
623
|
variants: ['mobile', 'ghost'],
|
|
628
624
|
attributes: {
|
|
629
625
|
'aria-label': 'Toggle main menu',
|
|
@@ -102,6 +102,7 @@
|
|
|
102
102
|
"searchButton": {
|
|
103
103
|
"type": params.searchButton.type,
|
|
104
104
|
"text": params.searchButton.text,
|
|
105
|
+
"visuallyHideButtonText": params.searchButton.visuallyHideButtonText,
|
|
105
106
|
"id": params.searchButton.id,
|
|
106
107
|
"attributes": params.searchButton.attributes,
|
|
107
108
|
"classes": params.searchButton.classes,
|