@ons/design-system 46.1.3 → 48.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 +76 -2
- package/components/document-list/_macro.njk +114 -0
- package/components/document-list/document-list.scss +182 -0
- package/components/download-resources/_download-resources.scss +2 -9
- package/components/download-resources/download-resources.js +2 -2
- package/components/error/_macro.njk +0 -1
- package/components/header/_header-nav.scss +22 -1
- package/components/header/_header.scss +12 -20
- package/components/header/_macro.njk +65 -16
- package/components/header/header-nav.dom.js +9 -0
- package/components/header/header-nav.js +5 -2
- package/components/input/_macro.njk +1 -2
- package/components/lists/_macro.njk +13 -15
- package/components/panel/_macro.njk +3 -8
- package/components/panel/_panel.scss +5 -3
- package/components/select/_macro.njk +1 -2
- package/components/textarea/_macro.njk +0 -1
- package/components/upload/_macro.njk +0 -1
- package/css/census.css +1 -1
- package/css/main.css +1 -1
- package/img/large/alison-pritchard-featured.jpg +0 -0
- package/img/large/alison-pritchard.jpg +0 -0
- package/img/large/census-monuments-lights-featured.jpg +0 -0
- package/img/large/census-monuments-lights.jpg +0 -0
- package/img/large/ons-award-winners.jpg +0 -0
- package/img/small/alison-pritchard-featured.jpg +0 -0
- package/img/small/alison-pritchard.jpg +0 -0
- package/img/small/census-monuments-lights-featured.jpg +0 -0
- package/img/small/census-monuments-lights.jpg +0 -0
- package/img/small/ons-award-winners.jpg +0 -0
- package/img/small/placeholder-portrait.png +0 -0
- package/layout/_template.njk +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +1 -2
- package/scss/objects/_spacing.scss +1 -0
- package/scss/vars/_colors.scss +9 -3
- package/components/articles/_articles.scss +0 -86
- package/components/articles/_macro.njk +0 -81
- package/components/downloads/_downloads.scss +0 -39
- package/components/downloads/_macro.njk +0 -66
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
{% set currentLanguageISOCode = currentLanguage.ISOCode %}
|
|
12
12
|
{% endif %}
|
|
13
13
|
|
|
14
|
-
<header class="ons-header {{ params.
|
|
14
|
+
<header class="ons-header {% if params.variants is not string %}{% for variant in params.variants %} ons-header--{{ variant }}{% endfor %}{% else %} ons-header--{{ params.variants }}{% endif %}" role="banner">
|
|
15
15
|
{% if params.phase is defined and params.phase %}
|
|
16
16
|
{% from "components/phase-banner/_macro.njk" import onsPhaseBanner %}
|
|
17
17
|
{{ onsPhaseBanner(params.phase) }}
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
<div class="ons-header__top">
|
|
20
20
|
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
21
21
|
<div class="ons-header__grid-top ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap{{ ' ons-header__grid-top-tall' if params.customHeaderLogo is defined and params.customHeaderLogo }}">
|
|
22
|
-
|
|
23
22
|
<div class="ons-grid__col ons-col-auto">
|
|
24
23
|
<div class="ons-header__logo--large">
|
|
25
24
|
{%-if params.logoHref is defined and params.logoHref %}<a class="ons-header__logo-link" href="{{ params.logoHref }}">{% endif -%}
|
|
@@ -42,20 +41,28 @@
|
|
|
42
41
|
{% if params.logoHref is defined and params.logoHref %}</a>{% endif %}
|
|
43
42
|
</div>
|
|
44
43
|
</div>
|
|
45
|
-
|
|
46
44
|
{% if params.language is defined and params.language or params.serviceLinks is defined and params.serviceLinks %}
|
|
47
45
|
<div class="ons-header__links ons-grid__col ons-col-auto">
|
|
48
46
|
{% if params.language is defined and params.language %}
|
|
49
|
-
<div class="ons-grid__col ons-col-auto">
|
|
47
|
+
<div class="ons-grid__col ons-col-auto {{ ' ons-u-mr-s ons-u-d-no@xxs@xs' if params.serviceLinks is defined and params.serviceLinks else '' }}">
|
|
50
48
|
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
51
49
|
{{ onsLanguageSelector(params.language) }}
|
|
52
50
|
</div>
|
|
53
51
|
{% endif %}
|
|
54
52
|
{% if params.serviceLinks is defined and params.serviceLinks %}
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
{% if params.serviceLinks.itemsList | length == 1 and params.language is defined and params.language %}
|
|
54
|
+
{% set breakpoint = 'xs' %}
|
|
55
|
+
{% set controlVisibility = true %}
|
|
56
|
+
{% elif params.serviceLinks.itemsList | length > 1 %}
|
|
57
|
+
{% set breakpoint = 'm' %}
|
|
58
|
+
{% set controlVisibility = true %}
|
|
59
|
+
{% else %}
|
|
60
|
+
{% set controlVisibility = false %}
|
|
61
|
+
{% endif %}
|
|
62
|
+
<div class="ons-grid__col ons-col-auto{% if controlVisibility == true %} ons-u-d-no@xxs@{{ breakpoint }}{% endif %}">
|
|
63
|
+
<nav class="ons-header-service-nav ons{{ params.serviceLinks.classes }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
57
64
|
<ul class="ons-header-service-nav__list" aria-label="{{ params.serviceLinks.ariaListLabel | default("Service Links") }}">
|
|
58
|
-
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
65
|
+
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
59
66
|
<li class="ons-header-service-nav__item">
|
|
60
67
|
<a
|
|
61
68
|
href="{{ item.url }}"
|
|
@@ -67,13 +74,55 @@
|
|
|
67
74
|
</ul>
|
|
68
75
|
</nav>
|
|
69
76
|
</div>
|
|
77
|
+
{% if params.serviceLinks.itemsList | length > 1 or params.language is defined and params.language %}
|
|
78
|
+
{% if params.variants == 'internal' %}
|
|
79
|
+
{% set buttonVariant = ["text-link", "text-link-inverse"] %}
|
|
80
|
+
{% else %}
|
|
81
|
+
{% set buttonVariant = "text-link" %}
|
|
82
|
+
{% endif %}
|
|
83
|
+
<div class="ons-grid__col ons-col-auto ons-u-d-no@{{ breakpoint }}">
|
|
84
|
+
{{ onsButton({
|
|
85
|
+
"text": params.serviceLinks.toggleServicesButton.text | default("Menu") ,
|
|
86
|
+
"classes": "ons-u-d-no ons-js-toggle-services",
|
|
87
|
+
"buttonStyle": "mobile",
|
|
88
|
+
"variants": buttonVariant,
|
|
89
|
+
"attributes": {
|
|
90
|
+
"aria-label": params.serviceLinks.toggleServicesButton.ariaLabel | default("Toggle menu") ,
|
|
91
|
+
"aria-controls": params.serviceLinks.id,
|
|
92
|
+
"aria-haspopup": "true",
|
|
93
|
+
"aria-expanded": "false"
|
|
94
|
+
}
|
|
95
|
+
}) }}
|
|
96
|
+
</div>
|
|
97
|
+
{% endif %}
|
|
70
98
|
{% endif %}
|
|
71
99
|
</div>
|
|
72
100
|
{% endif %}
|
|
73
101
|
</div>
|
|
74
102
|
</div>
|
|
103
|
+
{% if params.serviceLinks is defined and params.serviceLinks %}
|
|
104
|
+
<nav class="ons-header-service-nav ons-header-service-nav--mobile ons-u-d-no ons-js-services-mobile-nav" id="{{ params.serviceLinks.id }}" aria-label="{{ params.serviceLinks.ariaLabel | default("Service links navigation") }}">
|
|
105
|
+
<ul class="ons-header-service-nav__list" aria-label="{{ params.serviceLinks.ariaListLabel | default("Service Links") }}">
|
|
106
|
+
{% for item in (params.serviceLinks.itemsList if params.serviceLinks.itemsList is iterable else params.serviceLinks.itemsList.items()) %}
|
|
107
|
+
<li class="ons-header-service-nav__item ons-header-service-nav__item--mobile">
|
|
108
|
+
<a
|
|
109
|
+
href="{{ item.url }}"
|
|
110
|
+
class="ons-header-service-nav__link"
|
|
111
|
+
{% if item.id is defined and item.id %} id="{{ item.id }}"{% endif %}
|
|
112
|
+
>{{ item.title }}</a>
|
|
113
|
+
</li>
|
|
114
|
+
{% endfor %}
|
|
115
|
+
{% if params.language is defined and params.language %}
|
|
116
|
+
<div class="ons-u-d-no@xs">
|
|
117
|
+
{% from "components/language-selector/_macro.njk" import onsLanguageSelector %}
|
|
118
|
+
{{ onsLanguageSelector(params.language) }}
|
|
119
|
+
</div>
|
|
120
|
+
{% endif %}
|
|
121
|
+
</ul>
|
|
122
|
+
</nav>
|
|
123
|
+
{% endif %}
|
|
75
124
|
</div>
|
|
76
|
-
<div class="ons-header__main
|
|
125
|
+
<div class="ons-header__main">
|
|
77
126
|
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
78
127
|
<div class="ons-grid ons-grid--gutterless ons-grid--flex ons-grid--between ons-grid--vertical-center ons-grid--no-wrap">
|
|
79
128
|
<div class="ons-grid__col ons-col-auto ons-u-flex-shrink{% if params.titleLogo == 'census-logo-en' %} ons-header__title-census-logo-en{% endif %}">
|
|
@@ -87,9 +136,12 @@
|
|
|
87
136
|
})
|
|
88
137
|
}}
|
|
89
138
|
{% else %}
|
|
90
|
-
<{{ title_tag }} class="ons-header__title
|
|
139
|
+
<{{ title_tag }} class="ons-header__title">{{ params.title }}</{{ title_tag }}>
|
|
91
140
|
{% endif %}
|
|
92
141
|
{% if params.titleLogoHref is defined and params.titleLogoHref %}</a>{% endif %}
|
|
142
|
+
{% if params.description is defined and params.description %}
|
|
143
|
+
<p class="ons-header__description">{{ params.description }}</p>
|
|
144
|
+
{% endif %}
|
|
93
145
|
</div>
|
|
94
146
|
{% if params.button is defined and params.button %}
|
|
95
147
|
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink ons-u-d-no@xxs@m">
|
|
@@ -105,7 +157,7 @@
|
|
|
105
157
|
}) }}
|
|
106
158
|
</div>
|
|
107
159
|
{% endif %}
|
|
108
|
-
{% if params.toggleButton is defined and params.toggleButton or params.autosuggest is defined and params.autosuggest %}
|
|
160
|
+
{% if params.navigation.toggleButton is defined and params.navigation.toggleButton or params.autosuggest is defined and params.autosuggest %}
|
|
109
161
|
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink ons-u-d-no@m">
|
|
110
162
|
{% if params.autosuggest is defined and params.autosuggest and isPatternLib is defined and isPatternLib %}
|
|
111
163
|
<span class="ons-grid ons-u-d-no@xxs@xs">
|
|
@@ -124,14 +176,14 @@
|
|
|
124
176
|
}) }}
|
|
125
177
|
</span>
|
|
126
178
|
{% endif %}
|
|
127
|
-
{% if params.toggleButton is defined and params.toggleButton %}
|
|
179
|
+
{% if params.navigation.toggleButton is defined and params.navigation.toggleButton %}
|
|
128
180
|
{{ onsButton({
|
|
129
|
-
"text": params.toggleButton.text,
|
|
181
|
+
"text": params.navigation.toggleButton.text | default("Menu"),
|
|
130
182
|
"classes": "ons-u-ml-xs ons-u-d-no ons-js-toggle-main",
|
|
131
183
|
"buttonStyle": "mobile",
|
|
132
184
|
"variants": ["mobile", "ghost"],
|
|
133
185
|
"attributes": {
|
|
134
|
-
"aria-label": params.toggleButton.ariaLabel | default("Toggle
|
|
186
|
+
"aria-label": params.navigation.toggleButton.ariaLabel | default("Toggle menu") ,
|
|
135
187
|
"aria-controls": params.navigation.id,
|
|
136
188
|
"aria-haspopup": "true",
|
|
137
189
|
"aria-expanded": "false"
|
|
@@ -141,9 +193,6 @@
|
|
|
141
193
|
</div>
|
|
142
194
|
{% endif %}
|
|
143
195
|
</div>
|
|
144
|
-
{% if params.desc is defined and params.desc %}
|
|
145
|
-
<p class="ons-header__desc">{{ params.desc }}</p>
|
|
146
|
-
{% endif %}
|
|
147
196
|
</div>
|
|
148
197
|
</div>
|
|
149
198
|
{% if params.navigation is defined and params.navigation %}
|
|
@@ -4,6 +4,9 @@ domready(async () => {
|
|
|
4
4
|
const toggleMainBtn = document.querySelector('.ons-js-toggle-main');
|
|
5
5
|
const navEl = document.querySelector('.ons-js-header-nav');
|
|
6
6
|
const navHideClass = 'ons-u-d-no@xxs@m';
|
|
7
|
+
const toggleServicesBtn = document.querySelector('.ons-js-toggle-services');
|
|
8
|
+
const servicesEl = document.querySelector('.ons-js-services-mobile-nav');
|
|
9
|
+
const servicesHideClass = 'ons-u-d-no';
|
|
7
10
|
const toggleSearchBtn = document.querySelector('.ons-js-toggle-search');
|
|
8
11
|
const searchEl = document.querySelector('.ons-js-header-search');
|
|
9
12
|
const searchHideClass = 'ons-u-d-no@xs@m';
|
|
@@ -19,4 +22,10 @@ domready(async () => {
|
|
|
19
22
|
|
|
20
23
|
new searchToggle(toggleSearchBtn, searchEl, searchHideClass).registerEvents();
|
|
21
24
|
}
|
|
25
|
+
|
|
26
|
+
if (toggleServicesBtn) {
|
|
27
|
+
const servicesToggle = (await import('./header-nav')).default;
|
|
28
|
+
|
|
29
|
+
new servicesToggle(toggleServicesBtn, servicesEl, servicesHideClass).registerEvents();
|
|
30
|
+
}
|
|
22
31
|
});
|
|
@@ -11,7 +11,6 @@ export default class NavToggle {
|
|
|
11
11
|
this.nav = nav;
|
|
12
12
|
this.hideClass = hideClass;
|
|
13
13
|
this.toggle.classList.remove('ons-u-d-no');
|
|
14
|
-
|
|
15
14
|
this.setAria();
|
|
16
15
|
onViewportChange(this.setAria.bind(this));
|
|
17
16
|
}
|
|
@@ -56,7 +55,11 @@ export default class NavToggle {
|
|
|
56
55
|
} else if (hasAria) {
|
|
57
56
|
this.toggle.removeAttribute(attrExpanded);
|
|
58
57
|
this.nav.removeAttribute(attrHidden);
|
|
59
|
-
|
|
58
|
+
if (this.hideClass !== 'ons-u-d-no') {
|
|
59
|
+
this.nav.classList.remove(this.hideClass);
|
|
60
|
+
} else {
|
|
61
|
+
this.closeNav();
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
}
|
|
@@ -153,9 +153,8 @@
|
|
|
153
153
|
"id": params.fieldId,
|
|
154
154
|
"classes": params.fieldClasses,
|
|
155
155
|
"dontWrap": params.dontWrap,
|
|
156
|
-
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
157
156
|
"error": params.error,
|
|
158
|
-
"inline": params.label.inline
|
|
157
|
+
"inline": params.label.inline if params.label is defined and params.label else ''
|
|
159
158
|
}) %}
|
|
160
159
|
{% if charCheckField is defined and charCheckField %}
|
|
161
160
|
{{ charCheckField | safe }}
|
|
@@ -38,21 +38,19 @@
|
|
|
38
38
|
{% set itemText = item.title %}
|
|
39
39
|
{% endif %}
|
|
40
40
|
|
|
41
|
-
{%- if item.
|
|
41
|
+
{%- if item.prefix is defined and item.prefix or (params.iconPosition is defined and params.iconPosition == 'before') -%}
|
|
42
42
|
<span class="ons-list__prefix"{% if listEl != 'ol' %} aria-hidden="true"{% endif %}>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}}
|
|
55
|
-
{%- endif -%}
|
|
43
|
+
{%- if item.prefix is defined and item.prefix -%}
|
|
44
|
+
{{- item.prefix -}}.
|
|
45
|
+
{% elif params.iconPosition is defined and params.iconPosition == 'before' %}
|
|
46
|
+
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
47
|
+
{{
|
|
48
|
+
onsIcon({
|
|
49
|
+
"iconType": iconType,
|
|
50
|
+
"iconSize": params.iconSize
|
|
51
|
+
})
|
|
52
|
+
}}
|
|
53
|
+
{%- endif -%}
|
|
56
54
|
</span>
|
|
57
55
|
{%- endif -%}
|
|
58
56
|
{%- if item.url is defined and item.url and item.current != true -%}
|
|
@@ -65,7 +63,7 @@
|
|
|
65
63
|
})
|
|
66
64
|
}}
|
|
67
65
|
{%- else -%}
|
|
68
|
-
<a href="{{ item.url }}" class="ons-list__link
|
|
66
|
+
<a href="{{ item.url }}" class="ons-list__link{% if item.variants == 'inPageLink' %} ons-js-inpagelink{% endif %}{% if item.classes is defined and item.classes %} {{ item.classes }}{% endif %}"{% if item.target is defined and item.target %} target="{{ item.target }}"{% endif %}{% if item.attributes is defined and item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %} {{ attribute }}{% if value is defined and value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
|
|
69
67
|
{%- if item.prefix is defined and item.prefix -%}<span class="ons-u-vh">{{- item.prefix -}}</span>{%- endif -%} {{- itemText | safe -}}
|
|
70
68
|
{%- if item.target is defined and item.target == "_blank" -%}<span class="ons-u-vh">{{- item.screenreaderMessage | default("this link will open in a new tab") -}}</span>{%- endif -%}
|
|
71
69
|
</a>
|
|
@@ -27,10 +27,8 @@
|
|
|
27
27
|
{% endif %}
|
|
28
28
|
|
|
29
29
|
{% if params is defined and params and params.type == "warn-branded" or params.type == "announcement" %}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{% elif params.type is defined and params.type == "warn" %}
|
|
33
|
-
<div class="ons-container">
|
|
30
|
+
<div class="{{containerClass}}">
|
|
31
|
+
<div class="ons-container">
|
|
34
32
|
{% endif %}
|
|
35
33
|
|
|
36
34
|
<div {% if params is defined and params and params.type == 'error' and params.title is defined and params.title %}aria-labelledby="error-summary-title" role="alert" tabindex="-1" {% if params.dsExample != true %}autofocus="autofocus" {% endif %}{% endif %}class="ons-panel{{ typeClass }}{{ iconClass }}{{ noTitleClass }}{{ spaciousClass }}{{ classes }}"{% if params is defined and params and params.attributes is defined and params.attributes %}{% for attribute, value in (params.attributes.items() if params is defined and params and params.attributes is mapping and params.attributes.items is defined and params.attributes.items else params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}{% if params is defined and params and params.id is defined and params.id %} id="{{params.id}}"{% endif %}>
|
|
@@ -91,14 +89,11 @@
|
|
|
91
89
|
<div class="ons-panel__body{% if params is defined and params and params.iconSize is defined and params.iconSize %} ons-svg-icon-margin--{{ params.iconSize }}{% endif %}">{{ (params.body if params else "") | safe }}
|
|
92
90
|
{{ caller() if caller }}
|
|
93
91
|
</div>
|
|
94
|
-
|
|
95
92
|
</div>
|
|
96
93
|
|
|
97
94
|
{% if params is defined and params and params.type == "warn-branded" or params.type == "announcement" %}
|
|
95
|
+
</div>
|
|
98
96
|
</div>
|
|
99
|
-
</div>
|
|
100
|
-
{% elif params.type is defined and params.type == "warn" %}
|
|
101
|
-
</div>
|
|
102
97
|
{% endif %}
|
|
103
98
|
|
|
104
99
|
{% endmacro %}
|
|
@@ -213,9 +213,10 @@
|
|
|
213
213
|
margin-top: -15% !important;
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&__icon + &__body {
|
|
219
|
+
padding-left: 2rem;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
&--bare & {
|
|
@@ -228,6 +229,7 @@
|
|
|
228
229
|
}
|
|
229
230
|
}
|
|
230
231
|
|
|
232
|
+
&--info,
|
|
231
233
|
&--bare,
|
|
232
234
|
&--success,
|
|
233
235
|
&--warn,
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
"classes": params.fieldClases,
|
|
8
8
|
"legendClasses": params.legendClasses,
|
|
9
9
|
"dontWrap": params.dontWrap,
|
|
10
|
-
"legendIsQuestionTitle": params.legendIsQuestionTitle,
|
|
11
10
|
"error": params.error,
|
|
12
|
-
"inline": params.label.inline
|
|
11
|
+
"inline": params.label.inline if params.label is defined and params.label else ''
|
|
13
12
|
}) %}
|
|
14
13
|
{{
|
|
15
14
|
onsLabel({
|