@ons/design-system 55.2.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.
- 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/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/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/package.json +1 -1
- package/scss/patternlib.scss +2 -2
|
@@ -41,6 +41,7 @@ const EXAMPLE_WITH_SEARCH = {
|
|
|
41
41
|
attributes: { a: 42 },
|
|
42
42
|
classes: 'extra-search-button-class',
|
|
43
43
|
iconType: 'search',
|
|
44
|
+
visuallyHideButtonText: true,
|
|
44
45
|
},
|
|
45
46
|
};
|
|
46
47
|
|
|
@@ -540,6 +541,7 @@ describe('macro: input', () => {
|
|
|
540
541
|
attributes: { a: 42 },
|
|
541
542
|
classes: 'extra-search-button-class',
|
|
542
543
|
iconType: 'search',
|
|
544
|
+
visuallyHideButtonText: true,
|
|
543
545
|
},
|
|
544
546
|
});
|
|
545
547
|
});
|
|
@@ -64,8 +64,9 @@
|
|
|
64
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
|
-
"classes": "ons-u-d-no ons-js-sub-navigation-button
|
|
68
|
-
"
|
|
67
|
+
"classes": "ons-u-d-no ons-js-sub-navigation-button",
|
|
68
|
+
"type": "button",
|
|
69
|
+
"variants": ["mobile", "dropdown"],
|
|
69
70
|
"attributes": {
|
|
70
71
|
"aria-label": "Toggle section navigation",
|
|
71
72
|
"aria-controls": params.navigation.subNavigation.id,
|
|
@@ -206,8 +206,9 @@ describe('macro: navigation', () => {
|
|
|
206
206
|
|
|
207
207
|
expect(buttonSpy.occurrences).toContainEqual({
|
|
208
208
|
text: 'Main nav item 2',
|
|
209
|
-
classes: 'ons-u-d-no ons-js-sub-navigation-button
|
|
210
|
-
|
|
209
|
+
classes: 'ons-u-d-no ons-js-sub-navigation-button',
|
|
210
|
+
variants: ['mobile', 'dropdown'],
|
|
211
|
+
type: 'button',
|
|
211
212
|
attributes: {
|
|
212
213
|
'aria-label': 'Toggle section navigation',
|
|
213
214
|
'aria-controls': 'sub-nav',
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
{% if params.legendIsQuestionTitle %}
|
|
69
69
|
{% from "components/fieldset/_macro.njk" import onsFieldset %}
|
|
70
70
|
|
|
71
|
-
{# Resolves caller issue in
|
|
71
|
+
{# Resolves caller issue in Jinja: https://github.com/pallets/jinja/issues/371 #}
|
|
72
72
|
{% set content = caller() if caller %}
|
|
73
73
|
<div class="ons-question__answer ons-u-mb-m">
|
|
74
74
|
{% call onsFieldset({
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
{{
|
|
126
126
|
onsButton({
|
|
127
127
|
"id": params.submitButton.id,
|
|
128
|
-
"
|
|
128
|
+
"variants": params.submitButton.variants,
|
|
129
129
|
"text": params.submitButton.text | default ('Save and continue'),
|
|
130
130
|
"classes": params.submitButton.classes,
|
|
131
131
|
"attributes": params.submitButton.attributes
|
|
@@ -47,7 +47,7 @@ const EXAMPLE_QUESTION_BUTTON = {
|
|
|
47
47
|
...EXAMPLE_QUESTION_BASIC,
|
|
48
48
|
submitButton: {
|
|
49
49
|
id: 'button-id',
|
|
50
|
-
|
|
50
|
+
variants: 'timer',
|
|
51
51
|
text: 'Button text',
|
|
52
52
|
},
|
|
53
53
|
};
|
|
@@ -252,7 +252,7 @@ describe('macro: question', () => {
|
|
|
252
252
|
|
|
253
253
|
faker.renderComponent('question', EXAMPLE_QUESTION_BUTTON);
|
|
254
254
|
|
|
255
|
-
expect(buttonSpy.occurrences[0]).toHaveProperty('
|
|
255
|
+
expect(buttonSpy.occurrences[0]).toHaveProperty('variants', 'timer');
|
|
256
256
|
expect(buttonSpy.occurrences[0]).toHaveProperty('id', 'button-id');
|
|
257
257
|
expect(buttonSpy.occurrences[0]).toHaveProperty('text', 'Button text');
|
|
258
258
|
});
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"name": params.name,
|
|
10
10
|
"dontWrap": params.dontWrap,
|
|
11
11
|
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
12
|
-
"radios": params.radios
|
|
12
|
+
"radios": params.radios,
|
|
13
|
+
"error": params.error
|
|
13
14
|
}) }}
|
|
14
15
|
<p class="ons-relationships__playback ons-js-relationships-playback ons-u-d-no" aria-live="polite">{{ params.playback | safe }}</p>
|
|
15
16
|
</div>
|
|
@@ -5,15 +5,25 @@
|
|
|
5
5
|
|
|
6
6
|
<div class="ons-search-component">
|
|
7
7
|
{{ content | safe }}
|
|
8
|
+
|
|
9
|
+
{%- set buttonLabel -%}
|
|
10
|
+
{%- if params.searchButton.visuallyHideButtonText == true -%}
|
|
11
|
+
<span class="ons-u-vh">{{ params.searchButton.text }}</span>
|
|
12
|
+
{%- else -%}
|
|
13
|
+
{{ params.searchButton.text }}
|
|
14
|
+
{%- endif -%}
|
|
15
|
+
{%- endset -%}
|
|
16
|
+
|
|
8
17
|
{{
|
|
9
18
|
onsButton({
|
|
10
19
|
"type": params.searchButton.type,
|
|
11
|
-
"
|
|
20
|
+
"html": buttonLabel,
|
|
12
21
|
"id": params.searchButton.id,
|
|
13
22
|
"variants": 'small',
|
|
14
23
|
"classes": 'ons-search__btn ons-u-mt-xs@xxs@s' + (" " + params.searchButton.classes if params.searchButton.classes else ""),
|
|
15
24
|
"attributes": params.searchButton.attributes,
|
|
16
|
-
"iconType": params.searchButton.iconType
|
|
25
|
+
"iconType": params.searchButton.iconType,
|
|
26
|
+
"iconPosition": 'only' if params.searchButton.visuallyHideButtonText == true else 'before'
|
|
17
27
|
})
|
|
18
28
|
}}
|
|
19
29
|
</div>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as cheerio from 'cheerio';
|
|
4
4
|
|
|
5
|
-
import axe from '../../tests/helpers/axe';
|
|
6
5
|
import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
7
6
|
|
|
8
7
|
const EXAMPLE_SEARCH = {
|
|
@@ -34,11 +33,37 @@ describe('macro: search', () => {
|
|
|
34
33
|
expect(buttonSpy.occurrences[0]).toEqual({
|
|
35
34
|
id: 'search-button-id',
|
|
36
35
|
type: 'button',
|
|
37
|
-
|
|
36
|
+
html: 'Search for address',
|
|
38
37
|
variants: 'small',
|
|
39
38
|
classes: 'ons-search__btn ons-u-mt-xs@xxs@s extra-search-button-class',
|
|
40
39
|
attributes: EXAMPLE_SEARCH.searchButton.attributes,
|
|
41
40
|
iconType: 'search',
|
|
41
|
+
iconPosition: 'before',
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('renders button component with a visibly hidden label when specified', () => {
|
|
46
|
+
const faker = templateFaker();
|
|
47
|
+
const buttonSpy = faker.spy('button');
|
|
48
|
+
|
|
49
|
+
faker.renderComponent('input', {
|
|
50
|
+
searchButton: {
|
|
51
|
+
id: 'search-button-id',
|
|
52
|
+
type: 'button',
|
|
53
|
+
text: 'Search for address',
|
|
54
|
+
iconType: 'search',
|
|
55
|
+
visuallyHideButtonText: true,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(buttonSpy.occurrences[0]).toEqual({
|
|
60
|
+
id: 'search-button-id',
|
|
61
|
+
type: 'button',
|
|
62
|
+
html: '<span class="ons-u-vh">Search for address</span>',
|
|
63
|
+
variants: 'small',
|
|
64
|
+
classes: 'ons-search__btn ons-u-mt-xs@xxs@s',
|
|
65
|
+
iconPosition: 'only',
|
|
66
|
+
iconType: 'search',
|
|
42
67
|
});
|
|
43
68
|
});
|
|
44
69
|
});
|