@ons/design-system 45.0.2 → 45.1.2
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/accordion/_macro.njk +3 -1
- package/components/checkboxes/_macro.njk +7 -1
- package/components/collapsible/_collapsible.scss +10 -4
- package/components/collapsible/_macro.njk +14 -15
- package/components/collapsible/collapsible.js +2 -1
- package/components/field/_field.scss +10 -0
- package/components/field/_macro.njk +1 -1
- package/components/fieldset/_macro.njk +2 -2
- package/components/icons/_macro.njk +18 -18
- package/components/input/_macro.njk +4 -2
- package/components/lists/_macro.njk +73 -67
- package/components/question/_macro.njk +97 -21
- package/components/question/_question.scss +9 -1
- package/components/select/_macro.njk +2 -1
- package/components/summary/_macro.njk +3 -3
- package/components/table/_macro.njk +2 -2
- package/components/timeout-modal/timeout.js +3 -2
- package/css/census.css +1 -1
- package/css/main.css +1 -1
- package/package.json +4 -3
- package/scripts/main.es5.js +2 -2
- package/scripts/main.js +2 -2
- package/scss/objects/_spacing.scss +1 -3
- package/scss/utilities/_utilities.scss +1 -1
|
@@ -8,44 +8,85 @@
|
|
|
8
8
|
{% endset %}
|
|
9
9
|
|
|
10
10
|
{% set descHtml %}
|
|
11
|
-
{% if params.readDescriptionFirst is defined and params.readDescriptionFirst == true %}
|
|
11
|
+
{% if params.readDescriptionFirst is defined and params.readDescriptionFirst == true %}
|
|
12
12
|
<div aria-hidden="true" {% if params.legendIsQuestionTitle is not defined %}class="ons-question__description"{% endif %}>{{ params.description | safe }}</div>
|
|
13
13
|
{% elif params.legendIsQuestionTitle is not defined %}
|
|
14
|
-
<div class="ons-question__description">{{ params.description | safe }}</div>
|
|
14
|
+
<div class="ons-question__description ons-u-mb-m">{{ params.description | safe }}</div>
|
|
15
15
|
{% else %}
|
|
16
16
|
{{ params.description | safe }}
|
|
17
17
|
{% endif %}
|
|
18
18
|
{% endset %}
|
|
19
19
|
|
|
20
20
|
{% set instHtml %}
|
|
21
|
-
<div class="ons-question__instruction ons-u-mb-
|
|
21
|
+
<div class="ons-question__instruction ons-u-mb-m">{{ params.instruction | safe }}</div>
|
|
22
22
|
{% endset %}
|
|
23
23
|
|
|
24
|
+
{% if params.definition is defined and params.definition %}
|
|
25
|
+
{% set questionDefinition %}
|
|
26
|
+
{% from "components/collapsible/_macro.njk" import onsCollapsible %}
|
|
27
|
+
{% call onsCollapsible({
|
|
28
|
+
"id": params.definition.id if params.definition.id is defined and params.definition.id else '',
|
|
29
|
+
"titleTag": 'h2',
|
|
30
|
+
"classes": 'ons-u-mb-m',
|
|
31
|
+
"title": params.definition.title if params.definition.title is defined and params.definition.title else ''
|
|
32
|
+
}) %}
|
|
33
|
+
{% if params.definition.content %}
|
|
34
|
+
{{ params.definition.content | safe }}
|
|
35
|
+
{% endif %}
|
|
36
|
+
{% endcall %}
|
|
37
|
+
{% endset %}
|
|
38
|
+
{% endif %}
|
|
39
|
+
|
|
40
|
+
{% if params.guidance is defined and params.guidance %}
|
|
41
|
+
{% set questionGuidance %}
|
|
42
|
+
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
43
|
+
{% call onsPanel({
|
|
44
|
+
"classes": "ons-u-mb-m"
|
|
45
|
+
}) %}
|
|
46
|
+
{% if params.guidance.content is defined and params.guidance.content %}
|
|
47
|
+
{{ params.guidance.content | safe }}
|
|
48
|
+
{% endif %}
|
|
49
|
+
{% if params.guidance.lists is defined and params.guidance.lists %}
|
|
50
|
+
{%- for item in params.guidance.lists -%}
|
|
51
|
+
{% if item.listHeading is defined and item.listHeading %}
|
|
52
|
+
<h2 class="ons-u-fs-r--b">{{ item.listHeading }}</h2>
|
|
53
|
+
{% endif %}
|
|
54
|
+
{% if item.listLeadingLine is defined and item.listLeadingLine %}
|
|
55
|
+
<p>{{ item.listLeadingLine }}</h2>
|
|
56
|
+
{% endif %}
|
|
57
|
+
{% from "components/lists/_macro.njk" import onsList %}
|
|
58
|
+
{{
|
|
59
|
+
onsList({
|
|
60
|
+
"itemsList": item.itemsList
|
|
61
|
+
})
|
|
62
|
+
}}
|
|
63
|
+
{% endfor -%}
|
|
64
|
+
{% endif -%}
|
|
65
|
+
{% endcall %}
|
|
66
|
+
{% endset %}
|
|
67
|
+
{% endif %}
|
|
68
|
+
|
|
24
69
|
<div
|
|
25
70
|
{% if params.id is defined and params.id %} id="{{ params.id }}"{% endif %}
|
|
26
|
-
class="ons-question{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}"
|
|
71
|
+
class="ons-question ons-u-mb-l{% if params.classes is defined and params.classes %} {{ params.classes }}{% endif %}"
|
|
27
72
|
{% if params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
28
73
|
>
|
|
29
|
-
{% if params.legendIsQuestionTitle %}
|
|
74
|
+
{% if params.legendIsQuestionTitle is defined and params.legendIsQuestionTitle %}
|
|
30
75
|
{% from "components/fieldset/_macro.njk" import onsFieldset %}
|
|
31
76
|
|
|
32
77
|
{# Resolves caller issue in jijna: https://github.com/pallets/jinja/issues/371 #}
|
|
33
78
|
{% set content = caller() %}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{%
|
|
44
|
-
|
|
45
|
-
{% endif %}
|
|
46
|
-
|
|
47
|
-
{{ content }}
|
|
48
|
-
{% endcall %}
|
|
79
|
+
<div class="ons-question__answer ons-u-mb-m">
|
|
80
|
+
{% call onsFieldset({
|
|
81
|
+
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
82
|
+
"legend": titleHtml,
|
|
83
|
+
"description": descHtml if params.description is defined and params.description else '',
|
|
84
|
+
"legendClasses": params.legendClasses,
|
|
85
|
+
"legendTitleClasses": params.legendTitleClasses
|
|
86
|
+
}) %}
|
|
87
|
+
{{ content }}
|
|
88
|
+
{% endcall %}
|
|
89
|
+
</div>
|
|
49
90
|
|
|
50
91
|
{% else %}
|
|
51
92
|
<h1 id="question-title" class="ons-question__title">
|
|
@@ -60,8 +101,43 @@
|
|
|
60
101
|
{{- instHtml | safe -}}
|
|
61
102
|
{% endif %}
|
|
62
103
|
|
|
63
|
-
{
|
|
104
|
+
{% if params.definition is defined and params.definition %}
|
|
105
|
+
{{- questionDefinition | safe -}}
|
|
106
|
+
{% endif %}
|
|
107
|
+
|
|
108
|
+
{% if params.guidance is defined and params.guidance %}
|
|
109
|
+
{{- questionGuidance | safe -}}
|
|
110
|
+
{% endif %}
|
|
111
|
+
|
|
112
|
+
<div class="ons-question__answer ons-u-mb-m">
|
|
113
|
+
{{ caller () }}
|
|
114
|
+
</div>
|
|
64
115
|
{% endif %}
|
|
65
116
|
|
|
117
|
+
{% if params.justification is defined and params.justification %}
|
|
118
|
+
{% from "components/collapsible/_macro.njk" import onsCollapsible %}
|
|
119
|
+
{% call onsCollapsible({
|
|
120
|
+
"id": params.justification.id,
|
|
121
|
+
"titleTag": 'h2',
|
|
122
|
+
"classes": 'ons-u-mb-m',
|
|
123
|
+
"title": params.justification.title | default('Why we ask this question')
|
|
124
|
+
}) %}
|
|
125
|
+
{{ params.justification.content | safe }}
|
|
126
|
+
{% endcall %}
|
|
127
|
+
{% endif %}
|
|
66
128
|
</div>
|
|
129
|
+
|
|
130
|
+
{% if params.submitButton is defined and params.submitButton %}
|
|
131
|
+
{% from "components/button/_macro.njk" import onsButton %}
|
|
132
|
+
|
|
133
|
+
{{
|
|
134
|
+
onsButton({
|
|
135
|
+
"id": params.submitButton.id,
|
|
136
|
+
"submitType": params.submitButton.submitType,
|
|
137
|
+
"text": params.submitButton.text | default ('Save and continue'),
|
|
138
|
+
"classes": params.submitButton.classes,
|
|
139
|
+
"attributes": params.submitButton.attributes
|
|
140
|
+
})
|
|
141
|
+
}}
|
|
142
|
+
{% endif %}
|
|
67
143
|
{% endmacro %}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
margin: 1rem 0 0;
|
|
3
3
|
|
|
4
4
|
&__title {
|
|
5
|
-
|
|
5
|
+
@extend .ons-u-mb-m;
|
|
6
|
+
|
|
6
7
|
em,
|
|
7
8
|
.ons-highlight {
|
|
8
9
|
background-color: $color-highlight;
|
|
@@ -15,6 +16,13 @@
|
|
|
15
16
|
padding: 0 0.5rem;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
&__description {
|
|
21
|
+
p:last-of-type {
|
|
22
|
+
margin-bottom: 0 !important;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
&__instruction {
|
|
19
27
|
background-color: $color-instruction-tint;
|
|
20
28
|
border: 5px solid $color-instruction;
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<h{{ titleSize }} class="ons-summary__group-title">{{ group.groupTitle }}</h{{ titleSize }}>
|
|
22
22
|
{% endif %}
|
|
23
23
|
{% if group.headers is defined and group.headers and group.rows is defined and group.rows %}
|
|
24
|
-
<table class="ons-summary__items">
|
|
24
|
+
<table {% if group.id is defined and group.id %}id="{{ group.id }}" {% endif %} class="ons-summary__items">
|
|
25
25
|
<thead class="ons-u-vh">
|
|
26
26
|
<tr>
|
|
27
27
|
{% for header in group.headers %}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
{% if row.error is defined and row.error %} {% set itemClass = " ons-summary__item--error" %}{% endif %}
|
|
36
36
|
{% if row.total is defined and row.total %} {% set itemClass = itemClass + " ons-summary__item--total" %}{% endif %}
|
|
37
37
|
|
|
38
|
-
<tbody class="ons-summary__item{{ itemClass }}">
|
|
38
|
+
<tbody {% if row.id is defined and row.id %}id="{{ row.id }}" {% endif %}class="ons-summary__item{{ itemClass }}">
|
|
39
39
|
{% if row.errorMessage is defined and 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>
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
{% endif %}
|
|
44
44
|
|
|
45
45
|
{% for rowItem in row.rowItems %}
|
|
46
|
-
<tr class="ons-summary__row{{ " ons-summary__row--has-values" if rowItem.valueList else "" }}">
|
|
46
|
+
<tr {% if rowItem.id is defined and 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
49
|
{% if rowItem.rowTitleAttributes is defined and 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 %}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<thead class="ons-table__head">
|
|
16
16
|
<tr class="ons-table__row">
|
|
17
17
|
{% for th in params.ths %}
|
|
18
|
-
<th scope="col" class="ons-table__header{{ '' +
|
|
18
|
+
<th scope="col" class="ons-table__header{{ ' ' + th.thClasses if th.thClasses is defined and th.thClasses }}{{ " ons-table__header--numeric" if th.numeric is defined and th.numeric }}"{% if th.ariaSort is defined and th.ariaSort %} aria-sort="{{- th.ariaSort | default('none') -}}"{% endif %}>
|
|
19
19
|
<span {% if 'sortable' in variants %}class="ons-u-vh"{% endif %}>{{- th.value -}}</span>
|
|
20
20
|
{% if 'sortable' in variants %}
|
|
21
21
|
{{
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
{% for tr in params.trs %}
|
|
34
34
|
<tr class="ons-table__row{{ " ons-table__row--highlight" if tr.highlight }}" {% if tr.name is defined and tr.name %} name="{{ tr.name }}"{% endif %} {% if tr.id is defined and tr.id %} id="{{ tr.id }}"{% endif %}>
|
|
35
35
|
{% for td in tr.tds %}
|
|
36
|
-
<td class="ons-table__cell
|
|
36
|
+
<td class="ons-table__cell{{ ' ' + td.tdClasses if td.tdClasses is defined and td.tdClasses }}{{ " ons-table__cell--numeric" if td.numeric is defined and td.numeric }}" {% if td.id is defined and td.id %} id="{{ td.id }}"{% endif %} {% if td.name is defined and td.name %} name="{{ td.name }}"{% endif %} {% if td.data is defined and td.data %} data-th="{{ td.data }}"{% endif %} {% if td.dataSort is defined and td.dataSort %} data-sort-value="{{ td.dataSort }}"{% endif %}>
|
|
37
37
|
{% if td.form is defined and td.form %}
|
|
38
38
|
<form action="{{ td.form.action }}" method="{{ td.form.method | default('POST')}}">
|
|
39
39
|
{{
|
|
@@ -169,7 +169,8 @@ export default class Timeout {
|
|
|
169
169
|
if (!canSetNewExpiry) {
|
|
170
170
|
this.redirect();
|
|
171
171
|
} else {
|
|
172
|
-
this.
|
|
172
|
+
const newExpiryTimeInMilliseconds = this.convertTimeToMilliSeconds(canSetNewExpiry).toString();
|
|
173
|
+
this.closeModalAndRestartTimeout(newExpiryTimeInMilliseconds);
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
}
|
|
@@ -207,7 +208,7 @@ export default class Timeout {
|
|
|
207
208
|
method: fetchMethod,
|
|
208
209
|
headers: { 'Cache-Control': 'no-cache', 'Content-type': 'application/json; charset=UTF-8' },
|
|
209
210
|
});
|
|
210
|
-
if (
|
|
211
|
+
if (response.status === 401) {
|
|
211
212
|
this.redirect();
|
|
212
213
|
return false;
|
|
213
214
|
}
|