@ons/design-system 70.0.16 → 72.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/README.md +10 -1
- package/components/access-code/_macro.njk +4 -4
- package/components/access-code/_macro.spec.js +10 -10
- package/components/access-code/example-access-code-error.njk +2 -2
- package/components/access-code/example-access-code.njk +2 -2
- package/components/accordion/_macro.njk +1 -1
- package/components/accordion/_macro.spec.js +162 -91
- package/components/accordion/_test_examples.js +13 -0
- package/components/address-input/_macro.njk +7 -7
- package/components/address-input/_macro.spec.js +16 -15
- package/components/address-input/autosuggest.address.error.js +1 -1
- package/components/address-input/autosuggest.address.js +25 -25
- package/components/address-input/autosuggest.address.spec.js +6 -5
- package/components/address-input/example-address-input-editable.njk +5 -4
- package/components/address-input/example-address-input.njk +4 -5
- package/components/autosuggest/_autosuggest.scss +8 -8
- package/components/autosuggest/_macro.njk +5 -5
- package/components/autosuggest/autosuggest.spec.js +1 -1
- package/components/back-to-top/_back-to-top.scss +2 -2
- package/components/back-to-top/_macro.spec.js +1 -1
- package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
- package/components/breadcrumbs/_breadcrumbs.scss +1 -1
- package/components/breadcrumbs/_macro.spec.js +121 -115
- package/components/breadcrumbs/_test_examples.js +36 -0
- package/components/browser-banner/_macro.spec.js +1 -1
- package/components/button/_button.scss +24 -16
- package/components/button/_macro.njk +5 -5
- package/components/button/_macro.spec.js +2 -2
- package/components/button/example-button-custom.njk +1 -1
- package/components/card/_card.scss +0 -6
- package/components/card/_macro.njk +9 -9
- package/components/card/_macro.spec.js +57 -24
- package/components/card/example-card-set-with-images.njk +30 -18
- package/components/card/example-card-set-with-lists.njk +57 -45
- package/components/card/example-card-set.njk +27 -15
- package/components/card/example-card.njk +9 -5
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +4 -4
- package/components/checkboxes/_checkboxes.scss +1 -1
- package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
- package/components/cookies-banner/_cookies-banner.scss +5 -5
- package/components/cookies-banner/_macro.njk +15 -13
- package/components/cookies-banner/_macro.spec.js +1 -1
- package/components/details/_details.scss +5 -6
- package/components/details/_macro.njk +4 -4
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_document-list.scss +0 -2
- package/components/document-list/_macro.njk +18 -18
- package/components/document-list/_macro.spec.js +16 -14
- package/components/document-list/example-document-list-article-featured.njk +5 -3
- package/components/document-list/example-document-list-articles.njk +15 -9
- package/components/document-list/example-document-list-downloads.njk +15 -9
- package/components/document-list/example-document-list-search-result-featured.njk +5 -3
- package/components/document-list/example-document-list-search-results.njk +20 -12
- package/components/download-resources/_download-resources.scss +1 -2
- package/components/download-resources/download-resources.spec.js +12 -6
- package/components/external-link/_macro.njk +1 -1
- package/components/external-link/_macro.spec.js +1 -1
- package/components/external-link/example-external-link.njk +1 -1
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +3 -3
- package/components/feedback/example-feedback-call-to-action.njk +1 -1
- package/components/field/_field-group.scss +0 -2
- package/components/field/_field.scss +1 -2
- package/components/fieldset/_fieldset.scss +2 -2
- package/components/fieldset/_macro.njk +1 -1
- package/components/fieldset/_macro.spec.js +1 -1
- package/components/footer/_footer.scss +12 -7
- package/components/footer/_macro.njk +54 -34
- package/components/footer/_macro.spec.js +90 -28
- package/components/footer/example-footer-cymraeg.njk +1 -1
- package/components/footer/example-footer-transactional.njk +1 -1
- package/components/footer/example-footer-warning.njk +1 -1
- package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
- package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
- package/components/footer/example-footer-with-copyright.njk +1 -1
- package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
- package/components/footer/example-footer-with-multiple-logos.njk +172 -0
- package/components/footer/example-footer.njk +1 -1
- package/components/header/_header.scss +7 -14
- package/components/header/_macro.njk +19 -19
- package/components/header/_macro.spec.js +18 -18
- package/components/header/example-header-external-for-surveys.njk +2 -2
- package/components/header/example-header-external-welsh.njk +2 -2
- package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
- package/components/header/example-header-external-with-sub-navigation.njk +1 -1
- package/components/header/example-header-multiple-logos.njk +4 -4
- package/components/hero/_hero.scss +6 -8
- package/components/hero/_macro.njk +1 -1
- package/components/icon/_icon.scss +4 -4
- package/components/icon/_macro.njk +4 -4
- package/components/icon/_macro.spec.js +2 -2
- package/components/image/_image.scss +1 -1
- package/components/image/_macro.njk +1 -1
- package/components/image/_macro.spec.js +10 -10
- package/components/image/example-image-for-regular-screens.njk +1 -1
- package/components/input/_input-type.scss +0 -2
- package/components/input/_input.scss +10 -10
- package/components/input/_macro.njk +4 -2
- package/components/input/example-input-search-with-character-check.njk +1 -1
- package/components/input/example-input-search.njk +1 -1
- package/components/label/_label.scss +1 -3
- package/components/language-selector/_macro.njk +3 -3
- package/components/language-selector/_macro.spec.js +7 -7
- package/components/list/_list.scss +1 -5
- package/components/list/_macro.njk +9 -10
- package/components/list/_macro.spec.js +50 -9
- package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
- package/components/message/_macro.njk +3 -3
- package/components/message/_macro.spec.js +3 -3
- package/components/message-list/_macro.njk +2 -2
- package/components/message-list/_macro.spec.js +8 -4
- package/components/message-list/_message-list.scss +2 -2
- package/components/navigation/_macro.njk +9 -9
- package/components/navigation/_macro.spec.js +2 -2
- package/components/navigation/_navigation.scss +2 -6
- package/components/navigation/navigation.dom.js +1 -1
- package/components/navigation/navigation.spec.js +4 -4
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/_pagination.scss +1 -7
- package/components/panel/_macro.njk +5 -4
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/_panel.scss +12 -8
- package/components/password/_macro.njk +1 -1
- package/components/password/_macro.spec.js +2 -2
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +3 -4
- package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
- package/components/phase-banner/example-phase-banner-beta.njk +1 -1
- package/components/question/_macro.njk +8 -8
- package/components/question/_macro.spec.js +3 -3
- package/components/question/_question.scss +3 -3
- package/components/radios/_macro.njk +1 -1
- package/components/radios/_macro.spec.js +1 -1
- package/components/radios/_radios.scss +1 -1
- package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
- package/components/radios/example-radios-with-clear-button.njk +1 -1
- package/components/related-content/_macro.spec.js +2 -2
- package/components/related-content/_related-content.scss +1 -1
- package/components/related-content/example-related-content-general.njk +2 -2
- package/components/related-content/example-related-content-social-media.njk +1 -1
- package/components/reply/_macro.njk +3 -1
- package/components/reply/_macro.spec.js +1 -1
- package/components/reply/reply.spec.js +1 -1
- package/components/section-navigation/_macro.njk +10 -10
- package/components/section-navigation/_macro.spec.js +15 -15
- package/components/section-navigation/_section-navigation.scss +3 -8
- package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
- package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
- package/components/section-navigation/example-section-navigation.njk +3 -3
- package/components/select/example-select-with-inline-label.njk +1 -1
- package/components/share-page/_macro.njk +7 -7
- package/components/share-page/_macro.spec.js +2 -2
- package/components/share-page/example-share-page.njk +1 -1
- package/components/status/_status.scss +1 -1
- package/components/summary/_macro.njk +33 -33
- package/components/summary/_macro.spec.js +34 -34
- package/components/summary/_summary.scss +2 -4
- package/components/summary/example-summary-card-grouped.njk +34 -34
- package/components/summary/example-summary-grouped-total.njk +7 -7
- package/components/summary/example-summary-grouped-with-errors.njk +9 -9
- package/components/summary/example-summary-grouped.njk +34 -34
- package/components/summary/example-summary-household.njk +7 -7
- package/components/summary/example-summary-hub-minimal.njk +8 -8
- package/components/summary/example-summary-hub.njk +16 -16
- package/components/summary/example-summary-multiple.njk +7 -7
- package/components/summary/example-summary-no-action.njk +5 -5
- package/components/summary/example-summary.njk +9 -9
- package/components/table/_table.scss +2 -3
- package/components/table-of-contents/_macro.njk +3 -3
- package/components/table-of-contents/_macro.spec.js +3 -3
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
- package/components/tabs/_macro.njk +3 -3
- package/components/tabs/_macro.spec.js +3 -3
- package/components/tabs/_tabs.scss +3 -4
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/text-indent/_text-indent.scss +1 -1
- package/components/text-indent/example-text-indent.njk +1 -1
- package/components/timeline/_macro.njk +4 -4
- package/components/timeline/_macro.spec.js +3 -3
- package/components/timeline/_timeline.scss +4 -3
- package/components/timeline/example-timeline.njk +1 -1
- package/components/upload/_upload.scss +2 -2
- package/components/video/_macro.njk +4 -4
- package/components/video/_macro.spec.js +2 -2
- package/components/video/_video.scss +1 -1
- package/components/video/example-video.njk +2 -2
- package/components/video/video.spec.js +2 -2
- package/css/main.css +1 -1
- package/layout/_dsTemplate.njk +1 -1
- package/layout/_template.njk +31 -31
- package/package.json +3 -2
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +2 -0
- package/scss/base/_typography.scss +0 -2
- package/scss/main.scss +0 -1
- package/scss/objects/_container.scss +1 -1
- package/scss/objects/_page.scss +2 -3
- package/scss/overrides/rtl.scss +1 -1
- package/scss/utilities/_grid.scss +103 -96
- package/scss/utilities/_margin.scss +11 -5
- package/scss/utilities/_padding.scss +12 -5
- package/scss/utilities/_typography.scss +2 -1
- package/scss/vars/_forms.scss +8 -10
- package/scss/vars/_grid.scss +4 -4
- package/scss/vars/_typography.scss +26 -19
- package/components/call-to-action/_call-to-action.scss +0 -8
- package/components/call-to-action/_macro.njk +0 -24
- package/components/call-to-action/_macro.spec.js +0 -48
- package/components/call-to-action/example-call-to-action-default.njk +0 -15
- package/components/metadata/_macro.njk +0 -14
|
@@ -9,33 +9,33 @@
|
|
|
9
9
|
"title": "Section Title",
|
|
10
10
|
"itemsList": [
|
|
11
11
|
{
|
|
12
|
-
"
|
|
12
|
+
"text": "Section 1",
|
|
13
13
|
"url": "#section-1",
|
|
14
14
|
"anchors": [
|
|
15
15
|
{
|
|
16
|
-
"
|
|
16
|
+
"text": "Sub section 1",
|
|
17
17
|
"url": "#sub-section-1"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"
|
|
20
|
+
"text": "Sub section 2",
|
|
21
21
|
"url": "#sub-section-2"
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
|
-
"
|
|
24
|
+
"text": "Sub section 3",
|
|
25
25
|
"url": "#sub-section-3"
|
|
26
26
|
}
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"
|
|
30
|
+
"text": "Section 2",
|
|
31
31
|
"url": "#section-2"
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
"
|
|
34
|
+
"text": "Section 3",
|
|
35
35
|
"url": "#section-3"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
"
|
|
38
|
+
"text": "Section 4",
|
|
39
39
|
"url": "#section-4"
|
|
40
40
|
}
|
|
41
41
|
]
|
|
@@ -44,33 +44,33 @@
|
|
|
44
44
|
"title": "Section Title",
|
|
45
45
|
"itemsList": [
|
|
46
46
|
{
|
|
47
|
-
"
|
|
47
|
+
"text": "Section 5",
|
|
48
48
|
"url": "#section-5"
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"
|
|
51
|
+
"text": "Section 6",
|
|
52
52
|
"url": "#section-6",
|
|
53
53
|
"anchors": [
|
|
54
54
|
{
|
|
55
|
-
"
|
|
55
|
+
"text": "Sub section 1",
|
|
56
56
|
"url": "#sub-section-1"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
"
|
|
59
|
+
"text": "Sub section 2",
|
|
60
60
|
"url": "#sub-section-2"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
"
|
|
63
|
+
"text": "Sub section 3",
|
|
64
64
|
"url": "#sub-section-3"
|
|
65
65
|
}
|
|
66
66
|
]
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
|
-
"
|
|
69
|
+
"text": "Section 7",
|
|
70
70
|
"url": "#0"
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
"
|
|
73
|
+
"text": "Section 8",
|
|
74
74
|
"url": "#0"
|
|
75
75
|
}
|
|
76
76
|
]
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"currentPath": "#section-1",
|
|
6
6
|
"itemsList": [
|
|
7
7
|
{
|
|
8
|
-
"
|
|
8
|
+
"text": "Section 1",
|
|
9
9
|
"url": "#section-1"
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
|
-
"
|
|
12
|
+
"text": "Section 2",
|
|
13
13
|
"url": "#0"
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"
|
|
16
|
+
"text": "Section 3",
|
|
17
17
|
"url": "#0"
|
|
18
18
|
}
|
|
19
19
|
]
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
{% from "components/list/_macro.njk" import onsList %}
|
|
3
3
|
|
|
4
4
|
{% if params.title %}
|
|
5
|
-
{% set titleTag = params.
|
|
6
|
-
{% set openingTag = "<"
|
|
7
|
-
{% set closingTag = "</"
|
|
5
|
+
{% set titleTag = params.headingLevel | default(2) %}
|
|
6
|
+
{% set openingTag = "<h" ~ titleTag %}
|
|
7
|
+
{% set closingTag = "</h" ~ titleTag ~ ">" %}
|
|
8
8
|
{{ openingTag | safe }}
|
|
9
|
-
class="ons-u-fs-r--b ons-u-mb-
|
|
9
|
+
class="ons-u-fs-r--b ons-u-mb-2xs">{{ params.title }}{{ closingTag | safe }}
|
|
10
10
|
{% endif %}
|
|
11
11
|
|
|
12
12
|
{% if params.facebook and params.facebook == true %}
|
|
13
13
|
{%
|
|
14
14
|
set facebook =
|
|
15
15
|
{
|
|
16
|
-
"url": 'https://www.facebook.com/sharer/sharer.php?u=' ~ params.
|
|
16
|
+
"url": 'https://www.facebook.com/sharer/sharer.php?u=' ~ params.pageUrl|urlencode,
|
|
17
17
|
"text": 'Facebook',
|
|
18
18
|
"iconType": 'facebook',
|
|
19
19
|
"rel": 'noreferrer external',
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
{%
|
|
26
26
|
set twitter =
|
|
27
27
|
{
|
|
28
|
-
"url": 'https://twitter.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.
|
|
28
|
+
"url": 'https://twitter.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.pageUrl|urlencode,
|
|
29
29
|
"text": 'Twitter',
|
|
30
30
|
"iconType": 'twitter',
|
|
31
31
|
"rel": 'noreferrer external',
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
onsList({
|
|
38
38
|
"variants": 'inline',
|
|
39
39
|
"iconPosition": 'before',
|
|
40
|
-
"iconSize": params.iconSize | default("
|
|
40
|
+
"iconSize": params.iconSize | default("2xl"),
|
|
41
41
|
"itemsList": [facebook, twitter]
|
|
42
42
|
})
|
|
43
43
|
}}
|
|
@@ -8,7 +8,7 @@ import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
|
8
8
|
const EXAMPLE_SHARE_PAGE = {
|
|
9
9
|
title: 'Share page',
|
|
10
10
|
pageTitle: 'An example page',
|
|
11
|
-
|
|
11
|
+
pageUrl: 'https://example.com/an-example-page',
|
|
12
12
|
facebook: true,
|
|
13
13
|
twitter: true,
|
|
14
14
|
};
|
|
@@ -31,7 +31,7 @@ describe('macro: share-page', () => {
|
|
|
31
31
|
const $ = cheerio.load(
|
|
32
32
|
renderComponent('share-page', {
|
|
33
33
|
...EXAMPLE_SHARE_PAGE,
|
|
34
|
-
|
|
34
|
+
headingLevel: 4,
|
|
35
35
|
}),
|
|
36
36
|
);
|
|
37
37
|
|
|
@@ -15,17 +15,17 @@
|
|
|
15
15
|
|
|
16
16
|
<div class="{{ className }}">
|
|
17
17
|
{% for summary in params.summaries %}
|
|
18
|
-
{% if summary.
|
|
19
|
-
<h2 class="ons-summary__title ons-u-mb-
|
|
18
|
+
{% if summary.title %}
|
|
19
|
+
<h2 class="ons-summary__title ons-u-mb-l{{ ' ons-u-mt-l' if loop.index > 1 else "" }}">{{ summary.title }}</h2>
|
|
20
20
|
{% set headingLevel = "3" %}
|
|
21
21
|
{% endif %}
|
|
22
22
|
{% for group in summary.groups %}
|
|
23
|
-
<div {% if group.id %}id="{{ group.id }}"{
|
|
24
|
-
{% if group.
|
|
25
|
-
{% set openingHeadingTag = "<h"
|
|
26
|
-
{% set closingHeadingTag = "</h"
|
|
23
|
+
<div {% if group.id %}id="{{ group.id }}"{% endif %} class="ons-summary__group{{ variantClasses }}">
|
|
24
|
+
{% if group.title %}
|
|
25
|
+
{% set openingHeadingTag = "<h" ~ headingLevel %}
|
|
26
|
+
{% set closingHeadingTag = "</h" ~ headingLevel ~ ">" %}
|
|
27
27
|
{{ openingHeadingTag | safe }}
|
|
28
|
-
class="ons-summary__group-title">{{ group.
|
|
28
|
+
class="ons-summary__group-title">{{ group.title }}{{ closingHeadingTag | safe }}
|
|
29
29
|
{% endif %}
|
|
30
30
|
{% if group.rows %}
|
|
31
31
|
<dl class="ons-summary__items">
|
|
@@ -37,63 +37,63 @@
|
|
|
37
37
|
{% if row.errorMessage %}
|
|
38
38
|
<div class="ons-summary__row-title--error ons-u-fs-r">{{ row.errorMessage }}</div>
|
|
39
39
|
{% endif %}
|
|
40
|
-
{% if row.
|
|
40
|
+
{% if row.itemsList | length > 1 and row.title %}
|
|
41
41
|
<div class="ons-summary__row-title ons-summary__row-title--no-group-title ons-u-fs-r">
|
|
42
|
-
{{- row.
|
|
42
|
+
{{- row.title -}}
|
|
43
43
|
</div>
|
|
44
44
|
{% endif %}
|
|
45
45
|
|
|
46
|
-
{% for
|
|
46
|
+
{% for item in row.itemsList %}
|
|
47
47
|
<div
|
|
48
|
-
class="ons-summary__row{{ ' ons-summary__row--has-values' if
|
|
49
|
-
{% if
|
|
48
|
+
class="ons-summary__row{{ ' ons-summary__row--has-values' if item.valueList else "" }}"
|
|
49
|
+
{% if item.id %}id="{{ item.id }}"{% endif %}
|
|
50
50
|
>
|
|
51
51
|
<dt
|
|
52
52
|
class="ons-summary__item-title"
|
|
53
|
-
{% if
|
|
53
|
+
{% if item.titleAttributes %}{% for attribute, value in (item.titleAttributes.items() if item.titleAttributes is mapping and item.titleAttributes.items else item.titleAttributes) %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
54
54
|
>
|
|
55
|
-
{% if
|
|
55
|
+
{% if item.iconType %}
|
|
56
56
|
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
57
57
|
<span
|
|
58
|
-
class="ons-summary__item-title-icon{{ ' ons-summary__item-title-icon--check' if
|
|
58
|
+
class="ons-summary__item-title-icon{{ ' ons-summary__item-title-icon--check' if item.iconType == 'check' else "" }}"
|
|
59
59
|
>
|
|
60
60
|
{{-
|
|
61
61
|
onsIcon({
|
|
62
|
-
"iconType":
|
|
62
|
+
"iconType": item.iconType
|
|
63
63
|
})
|
|
64
64
|
-}}
|
|
65
|
-
{% if
|
|
66
|
-
<span class="ons-u-vh">{{
|
|
65
|
+
{% if item.iconVisuallyHiddenText %}
|
|
66
|
+
<span class="ons-u-vh">{{ item.iconVisuallyHiddenText }}</span>
|
|
67
67
|
{% endif %}
|
|
68
68
|
</span>
|
|
69
69
|
{% endif %}
|
|
70
70
|
|
|
71
71
|
<div
|
|
72
|
-
class="ons-summary__item--text{{ ' ons-summary__item-title--text' if
|
|
72
|
+
class="ons-summary__item--text{{ ' ons-summary__item-title--text' if item.iconType else "" }}"
|
|
73
73
|
>
|
|
74
|
-
{{-
|
|
74
|
+
{{- item.title | default(row.title) | safe -}}
|
|
75
75
|
</div>
|
|
76
76
|
|
|
77
77
|
{# Render section status for mobile if is hub #}
|
|
78
|
-
{% if variantHub and
|
|
79
|
-
<span class="ons-u-d-no@m ons-u-fs-r"> — {{
|
|
78
|
+
{% if variantHub and item.valueList %}
|
|
79
|
+
<span class="ons-u-d-no@m ons-u-fs-r"> — {{ item.valueList[0].text | safe }}</span>
|
|
80
80
|
{% endif %}
|
|
81
81
|
</dt>
|
|
82
|
-
{% if
|
|
82
|
+
{% if item.valueList %}
|
|
83
83
|
<dd
|
|
84
|
-
class="ons-summary__values{{ ' ons-summary__values--2' if not
|
|
85
|
-
{% if
|
|
84
|
+
class="ons-summary__values{{ ' ons-summary__values--2' if not item.actions }}"
|
|
85
|
+
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
86
86
|
>
|
|
87
|
-
{% if
|
|
88
|
-
<span class="ons-summary__text">{{
|
|
89
|
-
{% if
|
|
87
|
+
{% if item.valueList | length == 1 %}
|
|
88
|
+
<span class="ons-summary__text">{{ item.valueList[0].text | safe }}</span>
|
|
89
|
+
{% if item.valueList[0].other or item.valueList[0].other == 0 %}
|
|
90
90
|
<ul class="ons-u-mb-no">
|
|
91
|
-
<li>{{
|
|
91
|
+
<li>{{ item.valueList[0].other | safe }}</li>
|
|
92
92
|
</ul>
|
|
93
93
|
{% endif %}
|
|
94
94
|
{% else %}
|
|
95
95
|
<ul class="ons-u-mb-no">
|
|
96
|
-
{% for value in
|
|
96
|
+
{% for value in item.valueList %}
|
|
97
97
|
<li>
|
|
98
98
|
<span class="ons-summary__text">{{ value.text | safe }}</span>
|
|
99
99
|
{% if value.other or value.other == 0 %}
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
{% endif %}
|
|
108
108
|
</dd>
|
|
109
109
|
{% endif %}
|
|
110
|
-
{% if
|
|
110
|
+
{% if item.actions %}
|
|
111
111
|
<dd class="ons-summary__actions">
|
|
112
|
-
{% for action in
|
|
112
|
+
{% for action in item.actions %}
|
|
113
113
|
{% if loop.index > 1 %}<span class="ons-summary__spacer"></span>{% endif %}
|
|
114
114
|
<a
|
|
115
115
|
href="{{ action.url }}"
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
|
|
136
136
|
{% if group.summaryLink %}
|
|
137
137
|
<div
|
|
138
|
-
class="ons-summary__link{{ ' ons-u-pt-s' if params.variant != 'card' and (group.placeholderText or group.rows) }}{{ ' ons-u-bt' if group.placeholderText is not defined and group.rows | length > 1 and params.variant != 'card' }}{{ ' ons-u-mb-
|
|
138
|
+
class="ons-summary__link{{ ' ons-u-pt-s' if params.variant != 'card' and (group.placeholderText or group.rows) }}{{ ' ons-u-bt' if group.placeholderText is not defined and group.rows | length > 1 and params.variant != 'card' }}{{ ' ons-u-mb-3xl' if not group.last }}"
|
|
139
139
|
>
|
|
140
140
|
{% set link %}
|
|
141
141
|
<a
|
|
@@ -8,12 +8,12 @@ import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
|
8
8
|
const EXAMPLE_SUMMARY_ROWS = {
|
|
9
9
|
rows: [
|
|
10
10
|
{
|
|
11
|
-
// Contains - row with icon, attributes and
|
|
11
|
+
// Contains - row with icon, attributes and titleAttributes, other value, no action
|
|
12
12
|
id: 'row-id-1',
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
title: 'row title 1',
|
|
14
|
+
itemsList: [
|
|
15
15
|
{
|
|
16
|
-
|
|
16
|
+
titleAttributes: {
|
|
17
17
|
a: 123,
|
|
18
18
|
b: 456,
|
|
19
19
|
},
|
|
@@ -36,10 +36,10 @@ const EXAMPLE_SUMMARY_ROWS = {
|
|
|
36
36
|
{
|
|
37
37
|
// Contains - row with error and multiple actions
|
|
38
38
|
id: 'row-id-2',
|
|
39
|
-
|
|
39
|
+
title: 'row title 2',
|
|
40
40
|
error: true,
|
|
41
41
|
errorMessage: 'there are errors',
|
|
42
|
-
|
|
42
|
+
itemsList: [
|
|
43
43
|
{
|
|
44
44
|
id: 'item-id-2',
|
|
45
45
|
valueList: [
|
|
@@ -69,8 +69,8 @@ const EXAMPLE_SUMMARY_ROWS = {
|
|
|
69
69
|
{
|
|
70
70
|
// Contains - row with multiple rows and multiple values
|
|
71
71
|
id: 'row-id-3',
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
title: 'row title 3',
|
|
73
|
+
itemsList: [
|
|
74
74
|
{
|
|
75
75
|
id: 'item-id-3',
|
|
76
76
|
valueList: [
|
|
@@ -95,9 +95,9 @@ const EXAMPLE_SUMMARY_ROWS = {
|
|
|
95
95
|
{
|
|
96
96
|
// Contains - row with total
|
|
97
97
|
id: 'row-id-4',
|
|
98
|
-
|
|
98
|
+
title: 'row title 4',
|
|
99
99
|
total: true,
|
|
100
|
-
|
|
100
|
+
itemsList: [
|
|
101
101
|
{
|
|
102
102
|
id: 'item-id-5',
|
|
103
103
|
valueList: [
|
|
@@ -115,7 +115,7 @@ const EXAMPLE_SUMMARY_GROUPS = {
|
|
|
115
115
|
groups: [
|
|
116
116
|
{
|
|
117
117
|
id: 'group-id-1',
|
|
118
|
-
|
|
118
|
+
title: 'group title',
|
|
119
119
|
...EXAMPLE_SUMMARY_ROWS,
|
|
120
120
|
},
|
|
121
121
|
],
|
|
@@ -139,9 +139,9 @@ const EXAMPLE_SUMMARY_GROUPS_NO_ROWS = {
|
|
|
139
139
|
const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
140
140
|
rows: [
|
|
141
141
|
{
|
|
142
|
-
|
|
142
|
+
itemsList: [
|
|
143
143
|
{
|
|
144
|
-
|
|
144
|
+
title: 'row item 1',
|
|
145
145
|
valueList: [
|
|
146
146
|
{
|
|
147
147
|
text: 'list item 1',
|
|
@@ -161,7 +161,7 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
161
161
|
],
|
|
162
162
|
},
|
|
163
163
|
{
|
|
164
|
-
|
|
164
|
+
title: 'row item 2',
|
|
165
165
|
valueList: [
|
|
166
166
|
{
|
|
167
167
|
text: 'list item 2',
|
|
@@ -176,7 +176,7 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
176
176
|
],
|
|
177
177
|
},
|
|
178
178
|
{
|
|
179
|
-
|
|
179
|
+
title: 'row item 3',
|
|
180
180
|
valueList: [
|
|
181
181
|
{
|
|
182
182
|
text: 'list item 3',
|
|
@@ -193,9 +193,9 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
193
193
|
],
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
|
|
196
|
+
itemsList: [
|
|
197
197
|
{
|
|
198
|
-
|
|
198
|
+
title: 'row item 4',
|
|
199
199
|
valueList: [
|
|
200
200
|
{
|
|
201
201
|
text: 'list item 4',
|
|
@@ -215,7 +215,7 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
215
215
|
],
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
|
-
|
|
218
|
+
title: 'row item 5',
|
|
219
219
|
valueList: [
|
|
220
220
|
{
|
|
221
221
|
text: 'list item 5',
|
|
@@ -230,7 +230,7 @@ const EXAMPLE_SUMMARY_HOUSEHOLD_GROUP = {
|
|
|
230
230
|
],
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
|
-
|
|
233
|
+
title: 'row item 6',
|
|
234
234
|
valueList: [
|
|
235
235
|
{
|
|
236
236
|
text: 'list item 6',
|
|
@@ -264,7 +264,7 @@ const EXAMPLE_SUMMARY_BASIC = {
|
|
|
264
264
|
const EXAMPLE_SUMMARY_WITH_TITLE = {
|
|
265
265
|
summaries: [
|
|
266
266
|
{
|
|
267
|
-
|
|
267
|
+
title: 'summary title',
|
|
268
268
|
...EXAMPLE_SUMMARY_GROUPS,
|
|
269
269
|
},
|
|
270
270
|
],
|
|
@@ -273,7 +273,7 @@ const EXAMPLE_SUMMARY_WITH_TITLE = {
|
|
|
273
273
|
const EXAMPLE_SUMMARY_WITH_NO_ROWS = {
|
|
274
274
|
summaries: [
|
|
275
275
|
{
|
|
276
|
-
|
|
276
|
+
title: 'summary title',
|
|
277
277
|
...EXAMPLE_SUMMARY_GROUPS_NO_ROWS,
|
|
278
278
|
},
|
|
279
279
|
],
|
|
@@ -282,21 +282,21 @@ const EXAMPLE_SUMMARY_WITH_NO_ROWS = {
|
|
|
282
282
|
const EXAMPLE_SUMMARY_MULTIPLE_GROUPS = {
|
|
283
283
|
summaries: [
|
|
284
284
|
{
|
|
285
|
-
|
|
285
|
+
title: 'summary title',
|
|
286
286
|
groups: [
|
|
287
287
|
{
|
|
288
288
|
id: 'group-id-1',
|
|
289
|
-
|
|
289
|
+
title: 'group title',
|
|
290
290
|
...EXAMPLE_SUMMARY_ROWS,
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
293
|
id: 'group-id-2',
|
|
294
|
-
|
|
294
|
+
title: 'group title',
|
|
295
295
|
...EXAMPLE_SUMMARY_HOUSEHOLD_GROUP,
|
|
296
296
|
},
|
|
297
297
|
{
|
|
298
298
|
id: 'group-id-3',
|
|
299
|
-
|
|
299
|
+
title: 'group title',
|
|
300
300
|
...EXAMPLE_SUMMARY_ROWS,
|
|
301
301
|
},
|
|
302
302
|
],
|
|
@@ -345,13 +345,13 @@ describe('macro: summary', () => {
|
|
|
345
345
|
expect($('#group-id-1').length).toBe(1);
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
it('has the correct `
|
|
348
|
+
it('has the correct group `title` tag', () => {
|
|
349
349
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
|
|
350
350
|
|
|
351
351
|
expect($('.ons-summary__group-title')[0].tagName).toBe('h2');
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
-
it('has the `
|
|
354
|
+
it('has the group `title` text', () => {
|
|
355
355
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
|
|
356
356
|
|
|
357
357
|
expect($('.ons-summary__group-title').text()).toBe('group title');
|
|
@@ -360,7 +360,7 @@ describe('macro: summary', () => {
|
|
|
360
360
|
it('has larger margin between groups if the top one is a household style summary', () => {
|
|
361
361
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_MULTIPLE_GROUPS));
|
|
362
362
|
|
|
363
|
-
expect($('.ons-summary__group:nth-last-of-type(2) .ons-summary__link').hasClass('ons-u-mb-
|
|
363
|
+
expect($('.ons-summary__group:nth-last-of-type(2) .ons-summary__link').hasClass('ons-u-mb-3xl')).toBe(true);
|
|
364
364
|
});
|
|
365
365
|
});
|
|
366
366
|
|
|
@@ -377,13 +377,13 @@ describe('macro: summary', () => {
|
|
|
377
377
|
expect($('.ons-summary__items .ons-summary__item:nth-of-type(4)').hasClass('ons-summary__item--total')).toBe(true);
|
|
378
378
|
});
|
|
379
379
|
|
|
380
|
-
it('displays the `
|
|
380
|
+
it('displays the row `title` text', () => {
|
|
381
381
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
|
|
382
382
|
|
|
383
383
|
expect($('.ons-summary__items .ons-summary__item:nth-of-type(3) .ons-summary__row-title').text()).toBe('row title 3');
|
|
384
384
|
});
|
|
385
385
|
|
|
386
|
-
it('overrides the `
|
|
386
|
+
it('overrides the row `title` with the `errorMessage` if provided', () => {
|
|
387
387
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_WITH_TITLE));
|
|
388
388
|
|
|
389
389
|
expect($('.ons-summary__items .ons-summary__item:nth-of-type(2) .ons-summary__row-title--error').text()).toBe(
|
|
@@ -405,7 +405,7 @@ describe('macro: summary', () => {
|
|
|
405
405
|
expect($('.ons-summary__row--has-values').length).toBe(5);
|
|
406
406
|
});
|
|
407
407
|
|
|
408
|
-
it('has custom `
|
|
408
|
+
it('has custom row `titleAttributes`', () => {
|
|
409
409
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
|
|
410
410
|
|
|
411
411
|
expect($('.ons-summary__item-title').attr('a')).toBe('123');
|
|
@@ -414,7 +414,7 @@ describe('macro: summary', () => {
|
|
|
414
414
|
});
|
|
415
415
|
|
|
416
416
|
describe('part: item title', () => {
|
|
417
|
-
it('displays the `
|
|
417
|
+
it('displays the row `title` text', () => {
|
|
418
418
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_BASIC));
|
|
419
419
|
|
|
420
420
|
expect($('.ons-summary__items .ons-summary__item:nth-of-type(1) .ons-summary__item--text').text().trim()).toBe(
|
|
@@ -562,7 +562,7 @@ describe('macro: summary', () => {
|
|
|
562
562
|
expect(results).toHaveNoViolations();
|
|
563
563
|
});
|
|
564
564
|
|
|
565
|
-
it('displays the `
|
|
565
|
+
it('displays the summary `title`', () => {
|
|
566
566
|
const $ = cheerio.load(renderComponent('summary', EXAMPLE_SUMMARY_WITH_TITLE));
|
|
567
567
|
|
|
568
568
|
expect($('.ons-summary__title').text()).toBe('summary title');
|
|
@@ -593,7 +593,7 @@ describe('macro: summary', () => {
|
|
|
593
593
|
expect($('.ons-summary').hasClass('ons-summary--hub')).toBe(true);
|
|
594
594
|
});
|
|
595
595
|
|
|
596
|
-
it('has the value rendered after the `
|
|
596
|
+
it('has the value rendered after the row `title` that shows on mobile', () => {
|
|
597
597
|
const $ = cheerio.load(
|
|
598
598
|
renderComponent('summary', {
|
|
599
599
|
...EXAMPLE_SUMMARY_BASIC,
|
|
@@ -24,8 +24,6 @@ $hub-row-spacing: 1.3rem;
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
&__item {
|
|
27
|
-
line-height: 1.4;
|
|
28
|
-
|
|
29
27
|
&:not(:last-child),
|
|
30
28
|
&:not(.ons-summary__group--card .ons-summary__item):nth-of-type(1) {
|
|
31
29
|
border-bottom: 1px solid var(--ons-color-borders);
|
|
@@ -92,7 +90,7 @@ $hub-row-spacing: 1.3rem;
|
|
|
92
90
|
background: var(--ons-color-black);
|
|
93
91
|
display: inline-block;
|
|
94
92
|
height: 1.15rem;
|
|
95
|
-
margin: 0.
|
|
93
|
+
margin: 0.25rem 0.25rem 0;
|
|
96
94
|
vertical-align: middle;
|
|
97
95
|
width: 1px;
|
|
98
96
|
}
|
|
@@ -148,7 +146,7 @@ $hub-row-spacing: 1.3rem;
|
|
|
148
146
|
}
|
|
149
147
|
|
|
150
148
|
// Breakpoints
|
|
151
|
-
@include mq(
|
|
149
|
+
@include mq('2xs', m, none, '<') {
|
|
152
150
|
&__item-title,
|
|
153
151
|
&__values,
|
|
154
152
|
&__actions {
|