@ons/design-system 55.1.0 → 55.2.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/access-code/_macro.njk +3 -3
- package/components/accordion/_macro.njk +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-output/_macro.njk +7 -7
- package/components/autosuggest/_macro.njk +19 -19
- package/components/breadcrumbs/_macro.njk +3 -3
- package/components/button/_button.scss +1 -1
- package/components/button/_macro.njk +24 -24
- package/components/call-to-action/_macro.njk +1 -1
- package/components/card/_macro.njk +10 -10
- package/components/checkboxes/_checkbox-macro.njk +9 -9
- package/components/checkboxes/_macro.njk +10 -10
- package/components/checkboxes/checkbox-with-fieldset.js +6 -5
- package/components/checkboxes/checkboxes.dom.js +6 -9
- package/components/code-highlight/_macro.njk +1 -1
- package/components/collapsible/_macro.njk +7 -7
- package/components/date-input/_macro.njk +5 -5
- package/components/document-list/_macro.njk +29 -29
- package/components/duration/_macro.njk +9 -9
- package/components/duration/_macro.spec.js +0 -3
- package/components/error/_macro.njk +1 -1
- package/components/external-link/_macro.njk +1 -1
- package/components/feedback/_macro.njk +2 -2
- package/components/field/_macro.njk +5 -5
- package/components/fieldset/_macro.njk +8 -8
- package/components/footer/_macro.njk +17 -17
- package/components/header/_macro.njk +33 -33
- package/components/hero/_macro.njk +15 -15
- package/components/icons/_macro.njk +2 -2
- package/components/images/_macro.njk +3 -3
- package/components/input/_input-type.scss +4 -0
- package/components/input/_macro.njk +40 -34
- package/components/input/_macro.spec.js +64 -59
- package/components/label/_macro.njk +1 -1
- package/components/language-selector/_macro.njk +1 -1
- package/components/lists/_macro.njk +22 -22
- package/components/message/_macro.njk +6 -6
- package/components/message-list/_macro.njk +1 -1
- package/components/metadata/_macro.njk +2 -2
- package/components/modal/_macro.njk +4 -4
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +8 -8
- package/components/pagination/_macro.njk +3 -3
- package/components/panel/_macro.njk +37 -39
- package/components/panel/_macro.spec.js +1 -13
- package/components/promotional-banner/_macro.njk +2 -2
- package/components/question/_macro.njk +18 -18
- package/components/quote/_macro.njk +2 -2
- package/components/radios/_macro.njk +8 -8
- package/components/radios/check-radios.js +5 -1
- package/components/related-content/_macro.njk +2 -2
- package/components/relationships/_macro.njk +2 -2
- package/components/section-navigation/_macro.njk +2 -2
- package/components/select/_macro.njk +8 -8
- package/components/share-page/_macro.njk +2 -2
- package/components/status/_macro.njk +2 -2
- package/components/summary/_macro.njk +25 -25
- package/components/table/_macro.njk +10 -10
- package/components/table-of-contents/_macro.njk +4 -4
- package/components/textarea/_macro.njk +8 -8
- package/components/timeline/_macro.njk +1 -1
- package/components/video/_macro.njk +1 -1
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/layout/_template.njk +35 -35
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% macro onsPanel(params) %}
|
|
2
2
|
|
|
3
|
-
{% if params
|
|
3
|
+
{% if params.classes %}
|
|
4
4
|
{% set classes = ' ' + params.classes %}
|
|
5
5
|
{% endif %}
|
|
6
6
|
|
|
@@ -8,37 +8,37 @@
|
|
|
8
8
|
{% set noTitleClass = ' ons-panel--no-title' %}
|
|
9
9
|
{% endif %}
|
|
10
10
|
|
|
11
|
-
{% if params
|
|
11
|
+
{% if params.type %}
|
|
12
12
|
{% set typeClass = ' ons-panel--' + params.type %}
|
|
13
13
|
{% else %}
|
|
14
14
|
{% set typeClass = ' ons-panel--info' %}
|
|
15
15
|
{% endif %}
|
|
16
16
|
|
|
17
|
-
{% if params
|
|
17
|
+
{% if params.type == "warn-branded" %}
|
|
18
18
|
{% set containerClass = 'ons-branded-warning' %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
|
|
21
|
-
{% if params
|
|
21
|
+
{% if params.type == "announcement" %}
|
|
22
22
|
{% set containerClass = 'ons-announcement' %}
|
|
23
23
|
{% endif %}
|
|
24
24
|
|
|
25
|
-
{% if params
|
|
25
|
+
{% if params.spacious %}
|
|
26
26
|
{% set spaciousClass = ' ons-panel--spacious' %}
|
|
27
27
|
{% endif %}
|
|
28
28
|
|
|
29
|
-
{% if params
|
|
29
|
+
{% if params.type == "warn-branded" or params.type == "announcement" %}
|
|
30
30
|
<div class="{{containerClass}}">
|
|
31
31
|
<div class="ons-container">
|
|
32
32
|
{% endif %}
|
|
33
33
|
|
|
34
|
-
<div {% if (params.type == 'error' and params.title) or params.type == 'success' %}aria-labelledby="alert" role="alert" tabindex="-1" {% if params.dsExample != true %}autofocus="autofocus" {% endif %}{% endif %}class="ons-panel{{ typeClass }}{{ iconClass }}{{ noTitleClass }}{{ spaciousClass }}{{ classes }}"{% if params
|
|
34
|
+
<div {% if (params.type == 'error' and params.title) or params.type == 'success' %}aria-labelledby="alert" role="alert" tabindex="-1" {% if params.dsExample != true %}autofocus="autofocus" {% endif %}{% endif %}class="ons-panel{{ typeClass }}{{ iconClass }}{{ noTitleClass }}{{ spaciousClass }}{{ classes }}"{% if params and params.attributes %}{% for attribute, value in (params.attributes.items() if params and params.attributes is mapping and params.attributes.items else params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}{% if params and params.id %} id="{{params.id}}"{% endif %}>
|
|
35
35
|
|
|
36
|
-
{% if params
|
|
36
|
+
{% if params.type == "warn" or params.type == "warn-branded" %}
|
|
37
37
|
<span class="ons-panel__icon" aria-hidden="true">!</span>
|
|
38
38
|
<span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Warning: ") }}</span>
|
|
39
39
|
{% endif %}
|
|
40
40
|
|
|
41
|
-
{% if params
|
|
41
|
+
{% if params.type == "announcement" %}
|
|
42
42
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
43
43
|
<span class="ons-panel__icon" aria-hidden="true">
|
|
44
44
|
{{
|
|
@@ -50,45 +50,43 @@
|
|
|
50
50
|
<span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Announcement: ") }}</span>
|
|
51
51
|
{% endif %}
|
|
52
52
|
|
|
53
|
-
{% if params
|
|
54
|
-
{% if params.
|
|
55
|
-
{%
|
|
56
|
-
{% set defaultTitleTag = "h2" %}
|
|
57
|
-
{% else %}
|
|
58
|
-
{% set defaultTitleTag = "div" %}
|
|
59
|
-
{% endif %}
|
|
60
|
-
{% set titleTag = params.titleTag | default(defaultTitleTag) %}
|
|
61
|
-
<div class="ons-panel__header">
|
|
62
|
-
<{{ titleTag }} id="alert"{% if params.type %} data-qa="{{ params.type }}-header"{% endif %} class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}</{{ titleTag }}>
|
|
63
|
-
</div>
|
|
53
|
+
{% if params.title %}
|
|
54
|
+
{% if params.type == 'error' %}
|
|
55
|
+
{% set defaultTitleTag = "h2" %}
|
|
64
56
|
{% else %}
|
|
65
|
-
{%
|
|
66
|
-
<span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Important information: ") }}</span>
|
|
67
|
-
{% elif params.type == 'error' or params.type == 'success' %}
|
|
68
|
-
{% set defaultText = "Completed" if params.type == "success" else "Error" %}
|
|
69
|
-
<span{% if params.type == "success" %} id="alert"{% endif %} class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default(defaultText ~ ": ") }}</span>
|
|
70
|
-
{% endif %}
|
|
57
|
+
{% set defaultTitleTag = "div" %}
|
|
71
58
|
{% endif %}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
{%
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</span>
|
|
59
|
+
{% set titleTag = params.titleTag | default(defaultTitleTag) %}
|
|
60
|
+
<div class="ons-panel__header">
|
|
61
|
+
<{{ titleTag }} id="alert"{% if params.type %} data-qa="{{ params.type }}-header"{% endif %} class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}</{{ titleTag }}>
|
|
62
|
+
</div>
|
|
63
|
+
{% else %}
|
|
64
|
+
{% if not params.type or params.type == "branded" or params.type == "info" or params.type == "bare" %}
|
|
65
|
+
<span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Important information: ") }}</span>
|
|
66
|
+
{% elif params.type == 'error' or params.type == 'success' %}
|
|
67
|
+
{% set defaultText = "Completed" if params.type == "success" else "Error" %}
|
|
68
|
+
<span{% if params.type == "success" %} id="alert"{% endif %} class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default(defaultText ~ ": ") }}</span>
|
|
83
69
|
{% endif %}
|
|
84
70
|
{% endif %}
|
|
85
71
|
|
|
86
|
-
|
|
72
|
+
{% if params.iconType %}
|
|
73
|
+
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
74
|
+
<span class= "ons-panel__icon ons-u-fs-{{ params.iconSize | default('r') }}">
|
|
75
|
+
{{
|
|
76
|
+
onsIcon({
|
|
77
|
+
"iconType": params.iconType,
|
|
78
|
+
"iconSize": params.iconSize
|
|
79
|
+
})
|
|
80
|
+
}}
|
|
81
|
+
</span>
|
|
82
|
+
{% endif %}
|
|
83
|
+
|
|
84
|
+
<div class="ons-panel__body{% if params.iconSize %} ons-svg-icon-margin--{{ params.iconSize }}{% endif %}">{{ (params.body if params else "") | safe }}
|
|
87
85
|
{{ caller() if caller }}
|
|
88
86
|
</div>
|
|
89
87
|
</div>
|
|
90
88
|
|
|
91
|
-
{% if params
|
|
89
|
+
{% if params.type == "warn-branded" or params.type == "announcement" %}
|
|
92
90
|
</div>
|
|
93
91
|
</div>
|
|
94
92
|
{% endif %}
|
|
@@ -13,6 +13,7 @@ const EXAMPLE_PANEL_BASIC = {
|
|
|
13
13
|
describe('macro: panel', () => {
|
|
14
14
|
describe.each([
|
|
15
15
|
['info', 'Important information:'],
|
|
16
|
+
['bare', 'Important information:'],
|
|
16
17
|
['error', 'Error:'],
|
|
17
18
|
['warn', 'Warning:'],
|
|
18
19
|
['warn-branded', 'Warning:'],
|
|
@@ -316,19 +317,6 @@ describe('macro: panel', () => {
|
|
|
316
317
|
});
|
|
317
318
|
});
|
|
318
319
|
|
|
319
|
-
describe('mode: bare', () => {
|
|
320
|
-
it('has the correct class set', () => {
|
|
321
|
-
const $ = cheerio.load(
|
|
322
|
-
renderComponent('panel', {
|
|
323
|
-
...EXAMPLE_PANEL_BASIC,
|
|
324
|
-
type: 'bare',
|
|
325
|
-
}),
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
expect($('.ons-panel').hasClass('ons-panel--bare')).toBe(true);
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
|
|
332
320
|
describe('mode: warn', () => {
|
|
333
321
|
it('has a default "!" prefix', () => {
|
|
334
322
|
const $ = cheerio.load(
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<div class="ons-grid ons-grid--gutterless">
|
|
8
8
|
|
|
9
|
-
{% if params.image
|
|
9
|
+
{% if params.image %}
|
|
10
10
|
|
|
11
11
|
<div class="ons-grid__col ons-col-7@s">
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<div class="ons-grid__col ons-col-4@s ons-push-1@s ons-u-d-no@xxs@s">
|
|
20
20
|
|
|
21
21
|
<div class="ons-promo-banner__image">
|
|
22
|
-
{% if params.image.smallSrc
|
|
22
|
+
{% if params.image.smallSrc %}
|
|
23
23
|
<img srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x" src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}">
|
|
24
24
|
{% else %}
|
|
25
25
|
<img src="{{ params.image.src }}" alt="{{ params.image.alt }}">
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{% macro onsQuestion(params) %}
|
|
2
2
|
|
|
3
|
-
{%- set titleHtml -%}{% if params.readDescriptionFirst
|
|
3
|
+
{%- set titleHtml -%}{% if params.readDescriptionFirst == true and params.description %}
|
|
4
4
|
<div class="ons-question__description ons-u-vh">{{ params.description | safe }} </div>{% endif %}{{- params.title | safe -}}
|
|
5
5
|
{%- endset -%}
|
|
6
6
|
|
|
7
|
-
{%- set descHtml -%}{% if params.readDescriptionFirst
|
|
7
|
+
{%- set descHtml -%}{% if params.readDescriptionFirst == true %}
|
|
8
8
|
<div aria-hidden="true" {% if params.legendIsQuestionTitle is not defined %}class="ons-question__description ons-question__description--aria-hidden"{% endif %}>{{- params.description | safe -}}</div>
|
|
9
9
|
{% elif params.legendIsQuestionTitle is not defined %}
|
|
10
10
|
<div class="ons-question__description ons-u-mb-m">{{- params.description | safe -}}</div>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<div class="ons-question__instruction ons-u-mb-m">{{ params.instruction | safe }}</div>
|
|
17
17
|
{% endset %}
|
|
18
18
|
|
|
19
|
-
{% if params.definition
|
|
19
|
+
{% if params.definition %}
|
|
20
20
|
{% set questionDefinition %}
|
|
21
21
|
{% from "components/collapsible/_macro.njk" import onsCollapsible %}
|
|
22
22
|
{% call onsCollapsible({
|
|
@@ -31,21 +31,21 @@
|
|
|
31
31
|
{% endset %}
|
|
32
32
|
{% endif %}
|
|
33
33
|
|
|
34
|
-
{% if params.guidance
|
|
34
|
+
{% if params.guidance %}
|
|
35
35
|
{% set questionGuidance %}
|
|
36
36
|
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
37
37
|
{% call onsPanel({
|
|
38
38
|
"classes": "ons-question-guidance ons-u-mb-m"
|
|
39
39
|
}) %}
|
|
40
|
-
{% if params.guidance.content
|
|
40
|
+
{% if params.guidance.content %}
|
|
41
41
|
{{ params.guidance.content | safe }}
|
|
42
42
|
{% endif %}
|
|
43
|
-
{% if params.guidance.lists
|
|
43
|
+
{% if params.guidance.lists %}
|
|
44
44
|
{%- for item in params.guidance.lists -%}
|
|
45
|
-
{% if item.listHeading
|
|
45
|
+
{% if item.listHeading %}
|
|
46
46
|
<h2 class="ons-question-guidance__list-heading ons-u-fs-r--b">{{ item.listHeading }}</h2>
|
|
47
47
|
{% endif %}
|
|
48
|
-
{% if item.listLeadingLine
|
|
48
|
+
{% if item.listLeadingLine %}
|
|
49
49
|
<p class="ons-question-guidance__list-leading-line">{{ item.listLeadingLine }}</p>
|
|
50
50
|
{% endif %}
|
|
51
51
|
{% from "components/lists/_macro.njk" import onsList %}
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
{% endif %}
|
|
62
62
|
|
|
63
63
|
<div
|
|
64
|
-
{% if params.id
|
|
65
|
-
class="ons-question ons-u-mb-l{% if params.classes
|
|
66
|
-
{% if params.attributes
|
|
64
|
+
{% if params.id %} id="{{ params.id }}"{% endif %}
|
|
65
|
+
class="ons-question ons-u-mb-l{% if params.classes %} {{ params.classes }}{% endif %}"
|
|
66
|
+
{% 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 %}
|
|
67
67
|
>
|
|
68
|
-
{% if params.legendIsQuestionTitle
|
|
68
|
+
{% if params.legendIsQuestionTitle %}
|
|
69
69
|
{% from "components/fieldset/_macro.njk" import onsFieldset %}
|
|
70
70
|
|
|
71
71
|
{# Resolves caller issue in jijna: https://github.com/pallets/jinja/issues/371 #}
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
{% call onsFieldset({
|
|
75
75
|
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
76
76
|
"legend": titleHtml,
|
|
77
|
-
"description": descHtml if params.description
|
|
77
|
+
"description": descHtml if params.description else '',
|
|
78
78
|
"legendClasses": params.legendClasses,
|
|
79
79
|
"legendTitleClasses": params.legendTitleClasses
|
|
80
80
|
}) %}
|
|
@@ -87,19 +87,19 @@
|
|
|
87
87
|
{{- titleHtml | safe -}}
|
|
88
88
|
</h1>
|
|
89
89
|
|
|
90
|
-
{% if params.description
|
|
90
|
+
{% if params.description %}
|
|
91
91
|
{{- descHtml | safe -}}
|
|
92
92
|
{% endif %}
|
|
93
93
|
|
|
94
|
-
{% if params.instruction
|
|
94
|
+
{% if params.instruction %}
|
|
95
95
|
{{- instHtml | safe -}}
|
|
96
96
|
{% endif %}
|
|
97
97
|
|
|
98
|
-
{% if params.definition
|
|
98
|
+
{% if params.definition %}
|
|
99
99
|
{{- questionDefinition | safe -}}
|
|
100
100
|
{% endif %}
|
|
101
101
|
|
|
102
|
-
{% if params.guidance
|
|
102
|
+
{% if params.guidance %}
|
|
103
103
|
{{- questionGuidance | safe -}}
|
|
104
104
|
{% endif %}
|
|
105
105
|
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
</div>
|
|
109
109
|
{% endif %}
|
|
110
110
|
|
|
111
|
-
{% if params.justification
|
|
111
|
+
{% if params.justification %}
|
|
112
112
|
{% from "components/collapsible/_macro.njk" import onsCollapsible %}
|
|
113
113
|
{% call onsCollapsible({
|
|
114
114
|
"id": params.justification.id,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"iconType": 'quote'
|
|
7
7
|
})
|
|
8
8
|
}}
|
|
9
|
-
<span class="ons-quote__text ons-u-fs-{{ params.textFontSize if params.textFontSize
|
|
10
|
-
{% if params.ref
|
|
9
|
+
<span class="ons-quote__text ons-u-fs-{{ params.textFontSize if params.textFontSize else 'l' }}">{{ caller() if caller else params.text | safe }}</span>
|
|
10
|
+
{% if params.ref %}<span class="ons-quote__ref">— {{ params.ref | safe }}</span>{% endif %}
|
|
11
11
|
</blockquote>
|
|
12
12
|
{% endmacro %}
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
}) %}
|
|
16
16
|
<div class="ons-radios__items">
|
|
17
17
|
{% for radio in params.radios %}
|
|
18
|
-
{% if params.or
|
|
18
|
+
{% if params.or and loop.revindex0 == 0 %}
|
|
19
19
|
<span class="ons-radios__label ons-u-mt-s ons-u-fs-r--b" aria-hidden="true">{{ params.or }}</span>
|
|
20
20
|
{% endif %}
|
|
21
21
|
<span class="ons-radios__item{{ " ons-radios__item--no-border" if params.borderless }}">
|
|
22
22
|
<span class="ons-radio{{ " ons-radio--no-border" if params.borderless }}">
|
|
23
|
-
{% if radio.other
|
|
23
|
+
{% if radio.other and radio.other.selectAllChildren == true %}
|
|
24
24
|
{% set selectAllClass = ' ons-js-select-all-children' %}
|
|
25
25
|
{% else %}
|
|
26
26
|
{% set selectAllClass = '' %}
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
<input
|
|
29
29
|
type="radio"
|
|
30
30
|
id="{{ radio.id }}"
|
|
31
|
-
class="ons-radio__input ons-js-radio{{ ' ' + params.inputClasses if params.inputClasses
|
|
31
|
+
class="ons-radio__input ons-js-radio{{ ' ' + params.inputClasses if params.inputClasses else '' }}{{ ' ' + radio.classes if radio.classes else '' }}{{ ' ons-js-other' if radio.other else '' }}{{ selectAllClass }}"
|
|
32
32
|
value="{{ radio.value }}"
|
|
33
33
|
name="{{ params.name }}"
|
|
34
|
-
{% if
|
|
35
|
-
{% if radio.other
|
|
36
|
-
{% if radio.attributes
|
|
34
|
+
{% if radio.checked or (params.value is defined and params.value == radio.value) %} checked {% endif %}
|
|
35
|
+
{% if radio.other and not radio.other.open %} aria-controls="{{ radio.id }}-other-wrap" aria-haspopup="true"{% endif %}
|
|
36
|
+
{% if radio.attributes %}{% for attribute, value in (radio.attributes.items() if radio.attributes is mapping and radio.attributes.items else radio.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
37
37
|
>
|
|
38
38
|
{{ onsLabel({
|
|
39
39
|
"id": radio.id + "-label",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"classes": "ons-radio__label " + radio.label.classes | default(''),
|
|
44
44
|
"description": radio.label.description
|
|
45
45
|
}) }}
|
|
46
|
-
{% if radio.other
|
|
46
|
+
{% if radio.other %}
|
|
47
47
|
{% set otherType = radio.other.otherType | default('input') %}
|
|
48
48
|
<span class="ons-radio__other{{ " " + 'ons-radio__other--open' if radio.other.open else "" }}" id="{{ radio.id }}-other-wrap">
|
|
49
49
|
{% if otherType == "input" %}
|
|
@@ -124,7 +124,7 @@
|
|
|
124
124
|
{% endif %}
|
|
125
125
|
{% endfor %}
|
|
126
126
|
</div>
|
|
127
|
-
{% if params.clearRadios
|
|
127
|
+
{% if params.clearRadios %}
|
|
128
128
|
{{ onsButton({
|
|
129
129
|
"text": params.clearRadios.text,
|
|
130
130
|
"name": params.clearRadios.name,
|
|
@@ -3,11 +3,15 @@ export default class CheckRadios {
|
|
|
3
3
|
this.radio = radio;
|
|
4
4
|
this.openOther = openOther;
|
|
5
5
|
this.input = this.openOther.querySelector('.ons-input');
|
|
6
|
+
this.input.tabIndex = -1;
|
|
6
7
|
|
|
7
8
|
this.setInputBlurAttributes();
|
|
8
9
|
this.input.addEventListener('focus', this.checkRadio.bind(this));
|
|
9
10
|
this.radio.addEventListener('change', this.setInputFocusAttributes.bind(this));
|
|
10
|
-
this.radio.addEventListener('
|
|
11
|
+
this.radio.addEventListener('focus', this.setInputFocusAttributes.bind(this));
|
|
12
|
+
if (this.radio.type == 'radio') {
|
|
13
|
+
this.input.addEventListener('blur', this.setInputBlurAttributes.bind(this));
|
|
14
|
+
}
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
checkRadio() {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{% macro onsRelatedContent(params) %}
|
|
2
2
|
|
|
3
|
-
{% if params
|
|
3
|
+
{% if params.classes %}
|
|
4
4
|
{% set classes = ' ' + params.classes %}
|
|
5
5
|
{% endif %}
|
|
6
6
|
|
|
7
7
|
<aside class="ons-related-content{{ classes }}" aria-label="{{ params.ariaLabel | default("Related content") }}">
|
|
8
8
|
|
|
9
9
|
<div class="ons-related-content__body">
|
|
10
|
-
{% if params.rows
|
|
10
|
+
{% if params.rows %}
|
|
11
11
|
{% for row in params.rows %}
|
|
12
12
|
{% from "components/related-content/_section-macro.njk" import onsRelatedContentSection %}
|
|
13
13
|
{% call onsRelatedContentSection(
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
{% macro onsRelationships(params) %}
|
|
4
4
|
<div
|
|
5
|
-
{% if params.id
|
|
6
|
-
class="ons-relationships ons-js-relationships{% if params.classes
|
|
5
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
6
|
+
class="ons-relationships ons-js-relationships{% if params.classes %} {{ params.classes }}{% endif %}"
|
|
7
7
|
>
|
|
8
8
|
{{ onsRadios({
|
|
9
9
|
"name": params.name,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% macro onsSectionNavigation(params) %}
|
|
2
|
-
<nav class="ons-section-nav{% if params.variants
|
|
2
|
+
<nav class="ons-section-nav{% if params.variants == 'vertical' %} ons-section-nav--vertical{% endif %}" id="{{ params.id }}" aria-label="{{ params.ariaLabel | default("Section menu") }}">
|
|
3
3
|
<ul class="ons-section-nav__list">
|
|
4
4
|
{% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) %}
|
|
5
5
|
{% if (params.currentPath and (item.url == params.currentPath or item.url in params.currentPath)) or (params.tabQuery and params.tabQuery == item.title|lower) %}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{% endif %}
|
|
10
10
|
<li class="ons-section-nav__item{% if item.classes %} ' ' + {{ item.classes }}{% endif %}{% if isCurrent == true %} ons-section-nav__item--active{% endif %}">
|
|
11
11
|
<a class="ons-section-nav__link" href="{{ item.url }}"{% if isCurrent == true %} aria-current="location"{% endif %}>{{ item.title }}</a>
|
|
12
|
-
{% if item.anchors
|
|
12
|
+
{% if item.anchors %}
|
|
13
13
|
<ul class="ons-section-nav__sub-items ons-list ons-list--dashed ons-u-mt-xs ons-u-mb-xs">
|
|
14
14
|
{% for anchor in item.anchors %}
|
|
15
15
|
<li class="ons-section-nav__item ons-list__item">
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"legendClasses": params.legendClasses,
|
|
9
9
|
"dontWrap": params.dontWrap,
|
|
10
10
|
"error": params.error,
|
|
11
|
-
"inline": params.label.inline if params.label
|
|
11
|
+
"inline": params.label.inline if params.label else ''
|
|
12
12
|
}) %}
|
|
13
13
|
{{
|
|
14
14
|
onsLabel({
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
<select
|
|
22
22
|
id="{{ params.id }}"
|
|
23
23
|
name="{{ params.name }}"
|
|
24
|
-
class="ons-input ons-input--select{% if params.classes %} {{ params.classes }}{% endif %}{% if params.error
|
|
25
|
-
{% if params.value
|
|
26
|
-
{% if params.attributes
|
|
24
|
+
class="ons-input ons-input--select{% if params.classes %} {{ params.classes }}{% endif %}{% if params.error %} ons-input--error{% endif %}"
|
|
25
|
+
{% if params.value %}value="{{ params.value}}" {% endif %}
|
|
26
|
+
{% 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 %}
|
|
27
27
|
>
|
|
28
28
|
{% for option in params.options %}
|
|
29
29
|
<option value="{{ option.value | default(option.text) }}"
|
|
30
|
-
{% if option.id
|
|
31
|
-
{% if option.selected
|
|
32
|
-
{% if option.disabled
|
|
33
|
-
{% if params.attributes
|
|
30
|
+
{% if option.id %}id="{{ option.id }}" {% endif %}
|
|
31
|
+
{% if option.selected %}selected {% endif %}
|
|
32
|
+
{% if option.disabled %}disabled {% endif %}
|
|
33
|
+
{% if params.attributes %}{% for attribute, value in option.attributes %}{{ attribute }}="{{ value }}"{% endfor %}{% endif %}
|
|
34
34
|
>
|
|
35
35
|
{{- option.text -}}
|
|
36
36
|
</option>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
{% endif %}
|
|
8
8
|
|
|
9
9
|
{% set list = [] %}
|
|
10
|
-
{% if params.facebook
|
|
10
|
+
{% if params.facebook and params.facebook == true %}
|
|
11
11
|
{% set facebook =
|
|
12
12
|
{
|
|
13
13
|
"url": 'https://www.facebook.com/sharer/sharer.php?u=' ~ params.pageURL|urlencode,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
{% set list = (list.push(facebook), list) %}
|
|
22
22
|
{% endif %}
|
|
23
|
-
{% if params.twitter
|
|
23
|
+
{% if params.twitter and params.twitter == true %}
|
|
24
24
|
{% set twitter =
|
|
25
25
|
{
|
|
26
26
|
"url": 'https://twitter.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.pageURL|urlencode,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{% macro onsStatus(params) %}
|
|
2
|
-
{% if params.type
|
|
2
|
+
{% if params.type %}
|
|
3
3
|
{% set typeClass = ' ons-status--' + params.type %}
|
|
4
4
|
{% else %}
|
|
5
5
|
{% set typeClass = ' ons-status--info' %}
|
|
6
6
|
{% endif %}
|
|
7
7
|
|
|
8
|
-
{% if params.size
|
|
8
|
+
{% if params.size == 'small' %}
|
|
9
9
|
{% set sizeClass = ' ons-status--small' %}
|
|
10
10
|
{% endif %}
|
|
11
11
|
|
|
@@ -2,25 +2,25 @@
|
|
|
2
2
|
{% set className = "ons-summary" %}
|
|
3
3
|
{% set titleSize = "2" %}
|
|
4
4
|
|
|
5
|
-
{% if params.classes
|
|
5
|
+
{% if params.classes %}
|
|
6
6
|
{% set className = className + " " + params.classes %}
|
|
7
7
|
{% endif %}
|
|
8
8
|
|
|
9
|
-
{% if params.hub
|
|
9
|
+
{% if params.hub %}
|
|
10
10
|
{% set className = className + " ons-summary--hub" %}
|
|
11
11
|
{% endif %}
|
|
12
12
|
<div class="{{ className }}">
|
|
13
13
|
{% for summary in params.summaries %}
|
|
14
|
-
{% if summary.summaryTitle
|
|
14
|
+
{% if summary.summaryTitle %}
|
|
15
15
|
<h2 class="ons-summary__title ons-u-mb-m">{{ summary.summaryTitle }}</h2>
|
|
16
16
|
{% set titleSize = "3" %}
|
|
17
17
|
{% endif %}
|
|
18
18
|
{% for group in summary.groups %}
|
|
19
|
-
<div {% if group.id
|
|
20
|
-
{% if group.groupTitle
|
|
19
|
+
<div {% if group.id %}id="{{ group.id }}" {% endif %} class="ons-summary__group">
|
|
20
|
+
{% if group.groupTitle %}
|
|
21
21
|
<h{{ titleSize }} class="ons-summary__group-title">{{ group.groupTitle }}</h{{ titleSize }}>
|
|
22
22
|
{% endif %}
|
|
23
|
-
{% if group.headers
|
|
23
|
+
{% if group.headers and group.rows %}
|
|
24
24
|
<table class="ons-summary__items">
|
|
25
25
|
<thead class="ons-u-vh">
|
|
26
26
|
<tr>
|
|
@@ -32,23 +32,23 @@
|
|
|
32
32
|
|
|
33
33
|
{% for row in (group.rows if group.rows is iterable else group.rows.items()) %}
|
|
34
34
|
{% set itemClass = "" %}
|
|
35
|
-
{% if row.error
|
|
36
|
-
{% if row.total
|
|
35
|
+
{% if row.error %} {% set itemClass = " ons-summary__item--error" %}{% endif %}
|
|
36
|
+
{% if row.total %} {% set itemClass = itemClass + " ons-summary__item--total" %}{% endif %}
|
|
37
37
|
|
|
38
|
-
<tbody {% if row.id
|
|
39
|
-
{% if row.errorMessage
|
|
38
|
+
<tbody {% if row.id %}id="{{ row.id }}" {% endif %}class="ons-summary__item{{ itemClass }}">
|
|
39
|
+
{% if row.errorMessage or (row.rowItems | length > 1 and row.rowTitle) %}
|
|
40
40
|
<tr class="ons-summary__row">
|
|
41
41
|
<th colspan="3" class="ons-summary__row-title ons-u-fs-r">{{ row.errorMessage or row.rowTitle }}</th>
|
|
42
42
|
</tr>
|
|
43
43
|
{% endif %}
|
|
44
44
|
|
|
45
45
|
{% for rowItem in row.rowItems %}
|
|
46
|
-
<tr {% if rowItem.id
|
|
46
|
+
<tr {% if rowItem.id %}id="{{ rowItem.id }}" {% endif %}class="ons-summary__row{{ " ons-summary__row--has-values" if rowItem.valueList else "" }}">
|
|
47
47
|
<td
|
|
48
48
|
class="ons-summary__item-title"
|
|
49
|
-
{% if rowItem.rowTitleAttributes
|
|
49
|
+
{% if rowItem.rowTitleAttributes %}{% for attribute, value in (rowItem.rowTitleAttributes.items() if rowItem.rowTitleAttributes is mapping and rowItem.rowTitleAttributes.items else rowItem.rowTitleAttributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
50
50
|
>
|
|
51
|
-
{% if rowItem.iconType
|
|
51
|
+
{% if rowItem.iconType %}
|
|
52
52
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
53
53
|
<span class="ons-summary__item-title-icon {% if rowItem.iconType == 'check' %} ons-summary__item-title-icon--check{% endif %}">
|
|
54
54
|
{{
|
|
@@ -62,19 +62,19 @@
|
|
|
62
62
|
<div class="ons-summary__item--text{{ ' ons-summary__item-title--text' if rowItem.iconType else "" }}">{{ rowItem.rowTitle | default(row.rowTitle) | safe }}</div>
|
|
63
63
|
|
|
64
64
|
{# Render section status for mobile if is hub #}
|
|
65
|
-
{% if params.hub
|
|
65
|
+
{% if params.hub and rowItem.valueList %}
|
|
66
66
|
<span class="ons-u-d-no@s ons-u-fs-r"> — {{ rowItem.valueList[0].text | safe }}</span>
|
|
67
67
|
{% endif %}
|
|
68
68
|
</td>
|
|
69
|
-
{% if rowItem.valueList
|
|
69
|
+
{% if rowItem.valueList %}
|
|
70
70
|
<td
|
|
71
71
|
class="ons-summary__values"
|
|
72
72
|
{% if rowItem.actions == null %} colspan="2"{% endif %}
|
|
73
|
-
{% if rowItem.attributes
|
|
73
|
+
{% if rowItem.attributes %}{% for attribute, value in (rowItem.attributes.items() if rowItem.attributes is mapping and rowItem.attributes.items else rowItem.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
74
74
|
>
|
|
75
75
|
{% if rowItem.valueList | length == 1 %}
|
|
76
76
|
<span class="ons-summary__text">{{ rowItem.valueList[0].text | safe }}</span>
|
|
77
|
-
{% if rowItem.valueList[0].other
|
|
77
|
+
{% if rowItem.valueList[0].other or rowItem.valueList[0].other == 0 %}
|
|
78
78
|
<ul class="ons-u-mb-no">
|
|
79
79
|
<li>{{ rowItem.valueList[0].other | safe }}</li>
|
|
80
80
|
</ul>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
{% for value in (rowItem.valueList if rowItem.valueList is iterable else rowItem.valueList.items()) %}
|
|
85
85
|
<li>
|
|
86
86
|
<span class="ons-summary__text">{{ value.text | safe }}</span>
|
|
87
|
-
{% if value.other
|
|
87
|
+
{% if value.other or value.other == 0 %}
|
|
88
88
|
<ul class="ons-u-mb-no">
|
|
89
89
|
<li>{{ value.other | safe }}</li>
|
|
90
90
|
</ul>
|
|
@@ -95,15 +95,15 @@
|
|
|
95
95
|
{% endif %}
|
|
96
96
|
</td>
|
|
97
97
|
{% endif %}
|
|
98
|
-
{% if rowItem.actions
|
|
98
|
+
{% if rowItem.actions %}
|
|
99
99
|
<td class="ons-summary__actions">
|
|
100
100
|
{% for action in (rowItem.actions if rowItem.actions is iterable else rowItem.actions.items()) %}
|
|
101
101
|
{% if loop.index > 1 %}<span class="ons-summary__spacer"></span>{% endif %}
|
|
102
102
|
<a
|
|
103
103
|
href="{{ action.url }}"
|
|
104
104
|
class="ons-summary__button"
|
|
105
|
-
{% if action.ariaLabel
|
|
106
|
-
{% if action.attributes
|
|
105
|
+
{% if action.ariaLabel %} aria-label="{{ action.ariaLabel }}"{% endif %}
|
|
106
|
+
{% if action.attributes %}{% for attribute, value in (action.attributes.items() if action.attributes is mapping and action.attributes.items else action.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
107
107
|
>{{ action.text }}</a>
|
|
108
108
|
{% endfor %}
|
|
109
109
|
</td>
|
|
@@ -113,13 +113,13 @@
|
|
|
113
113
|
</tbody>
|
|
114
114
|
{% endfor %}
|
|
115
115
|
</table>
|
|
116
|
-
{% elif group.placeholderText
|
|
116
|
+
{% elif group.placeholderText %}
|
|
117
117
|
<span class="ons-summary__placeholder">{{ group.placeholderText }}</span>
|
|
118
118
|
{% endif %}
|
|
119
119
|
|
|
120
|
-
{% if group.summaryLink
|
|
121
|
-
<div class="ons-summary__link{% if group.placeholderText
|
|
122
|
-
<a {% if group.summaryLink.attributes
|
|
120
|
+
{% if group.summaryLink %}
|
|
121
|
+
<div class="ons-summary__link{% if group.placeholderText or group.rows %} ons-u-pt-s{% endif %}{% if group.placeholderText is not defined and group.rows | length > 1 %} ons-u-bt{% endif %}">
|
|
122
|
+
<a {% if group.summaryLink.attributes %}{% for attribute, value in (group.summaryLink.attributes.items() if group.summaryLink.attributes is mapping and group.summaryLink.attributes.items else group.summaryLink.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %} href="{{ group.summaryLink.url }}">{{ group.summaryLink.text }}</a>
|
|
123
123
|
</div>
|
|
124
124
|
{% endif %}
|
|
125
125
|
</div>
|