nsw-design-system 2.13.0 → 3.0.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/CHANGELOG.md +79 -0
- package/README.md +50 -20
- package/dist/css/core.css +2 -0
- package/dist/css/main.css +1 -1
- package/dist/js/main.js +208 -124
- package/package.json +4 -2
- package/src/components/_all.scss +27 -0
- package/src/components/accordion/_accordion.scss +68 -30
- package/src/components/accordion/accordion.js +61 -14
- package/src/components/breadcrumbs/_breadcrumbs.scss +34 -43
- package/src/components/button/_button.scss +171 -27
- package/src/components/callout/_callout.scss +13 -57
- package/src/components/card/_card.scss +222 -71
- package/src/components/content-block/_content-block.scss +16 -45
- package/src/components/filters/_filters.scss +25 -85
- package/src/components/filters/filters.js +0 -5
- package/src/components/footer/_footer.scss +80 -132
- package/src/components/{forms/_forms.scss → form/_form.scss} +122 -75
- package/src/components/global-alert/_global-alert.scss +68 -0
- package/src/components/{site-wide-message/site-wide-message.js → global-alert/global-alert.js} +3 -3
- package/src/components/header/_header.scss +196 -227
- package/src/components/hero-banner/_hero-banner.scss +152 -86
- package/src/components/hero-search/_hero-search.scss +26 -38
- package/src/components/in-page-alert/_in-page-alert.scss +54 -0
- package/src/components/in-page-nav/_in-page-nav.scss +22 -0
- package/src/components/link-list/_link-list.scss +28 -47
- package/src/components/list-item/_list-item.scss +31 -43
- package/src/components/main-nav/_main-nav.scss +272 -0
- package/src/components/{main-navigation/main-navigation.js → main-nav/main-nav.js} +40 -39
- package/src/components/masthead/_masthead.scss +61 -0
- package/src/components/media/_media.scss +14 -2
- package/src/components/pagination/_pagination.scss +37 -41
- package/src/components/progress-indicator/_progress-indicator.scss +11 -11
- package/src/components/side-nav/_side-nav.scss +73 -0
- package/src/components/table/_table.scss +56 -0
- package/src/components/tables/_tables.scss +0 -71
- package/src/components/tabs/_tabs.scss +79 -0
- package/src/components/{tab-navigation/tab-navigation.js → tabs/tabs.js} +9 -9
- package/src/components/tag/_tag.scss +60 -0
- package/src/core/_all.scss +6 -0
- package/src/core/grid/_grid.scss +117 -0
- package/src/core/iconography/_icon.scss +83 -0
- package/src/core/layout/_layout.scss +42 -0
- package/src/core/section/_section.scss +95 -0
- package/src/{global/scss/helpers → core/spacing}/_spacing.scss +27 -4
- package/src/core/typography/_typography.scss +266 -0
- package/src/global/scss/base/_all.scss +4 -0
- package/src/global/scss/base/_functions.scss +44 -0
- package/src/global/scss/{style/_base.scss → base/_global.scss} +1 -2
- package/src/global/scss/base/_mixins.scss +241 -0
- package/src/global/scss/{tools → base}/_print.scss +3 -3
- package/src/global/scss/helpers/_all.scss +4 -3
- package/src/global/scss/helpers/_colour.scss +86 -0
- package/src/global/scss/helpers/_list.scss +21 -0
- package/src/global/scss/helpers/_text.scss +9 -0
- package/src/global/scss/helpers/_visibility.scss +31 -0
- package/src/global/scss/settings/_palette.scss +69 -0
- package/src/global/scss/settings/_settings.scss +12 -296
- package/src/global/scss/settings/_theme.scss +82 -0
- package/src/main.js +8 -11
- package/src/main.scss +17 -21
- package/dist/assets/svg/sprite.svg +0 -1
- package/src/components/banner/_banner.scss +0 -170
- package/src/components/direction-links/_direction-links.scss +0 -62
- package/src/components/feature-tile/_feature-tile.scss +0 -175
- package/src/components/forms/_forms-prev.scss +0 -357
- package/src/components/in-page-navigation/_in-page-navigation.scss +0 -26
- package/src/components/main-navigation/_main-navigation.scss +0 -405
- package/src/components/notification/_notification.scss +0 -69
- package/src/components/side-navigation/_side-navigation.scss +0 -85
- package/src/components/site-wide-message/_site-wide-message.scss +0 -148
- package/src/components/social-bar/_social-bar.scss +0 -27
- package/src/components/social-bar/social-bar.js +0 -24
- package/src/components/tab-navigation/_tab-navigation.scss +0 -69
- package/src/components/tags/_tags.scss +0 -65
- package/src/global/scss/helpers/_section.scss +0 -50
- package/src/global/scss/helpers/_sr-only.scss +0 -8
- package/src/global/scss/style/_all.scss +0 -4
- package/src/global/scss/style/_docs.scss +0 -538
- package/src/global/scss/style/_grid.scss +0 -171
- package/src/global/scss/style/_icons.scss +0 -68
- package/src/global/scss/tools/_all.scss +0 -10
- package/src/global/scss/tools/_breakpoint.scss +0 -16
- package/src/global/scss/tools/_buttons.scss +0 -15
- package/src/global/scss/tools/_focus.scss +0 -26
- package/src/global/scss/tools/_general.scss +0 -189
- package/src/global/scss/tools/_grid.scss +0 -129
- package/src/global/scss/tools/_links.scss +0 -18
- package/src/global/scss/tools/_spacing.scss +0 -37
- package/src/global/scss/tools/_sr-only.scss +0 -21
- package/src/global/scss/tools/_typography.scss +0 -90
- package/src/styles/grid/_grid.scss +0 -0
- package/src/styles/iconography/_iconography.scss +0 -0
- package/src/styles/layout/_layout.scss +0 -0
- package/src/styles/typography/_typography.scss +0 -219
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
.main-nav-active {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.nsw-main-nav {
|
|
6
|
+
@include z-index('middle');
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
background-color: var(--nsw-white);
|
|
13
|
+
transition: all 0.25s ease-in-out;
|
|
14
|
+
transform: translateX(-100%);
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
|
|
18
|
+
&.activating,
|
|
19
|
+
&.active {
|
|
20
|
+
transform: translateX(0);
|
|
21
|
+
visibility: visible;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.closing {
|
|
25
|
+
transform: translateX(-100%);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
29
|
+
position: relative;
|
|
30
|
+
transform: none;
|
|
31
|
+
background-color: var(--nsw-off-white);
|
|
32
|
+
top: auto;
|
|
33
|
+
left: auto;
|
|
34
|
+
transition: none;
|
|
35
|
+
visibility: visible;
|
|
36
|
+
overflow-y: visible;
|
|
37
|
+
height: auto;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__header {
|
|
41
|
+
padding: rem(8px) rem(16px);
|
|
42
|
+
border-bottom: solid 2px var(--nsw-brand-dark);
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: space-between;
|
|
46
|
+
|
|
47
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nsw-icon-button {
|
|
52
|
+
&:first-child {
|
|
53
|
+
margin-left: rem(-16px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:last-child {
|
|
57
|
+
margin-right: rem(-16px);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&__list {
|
|
63
|
+
list-style: none;
|
|
64
|
+
padding: 0;
|
|
65
|
+
margin: 0;
|
|
66
|
+
|
|
67
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
68
|
+
@include container(0);
|
|
69
|
+
display: flex;
|
|
70
|
+
flex-direction: row;
|
|
71
|
+
align-items: stretch;
|
|
72
|
+
flex-wrap: wrap;
|
|
73
|
+
position: relative;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
> li > a {
|
|
77
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
78
|
+
.nsw-material-icons {
|
|
79
|
+
transform: rotate(90deg);
|
|
80
|
+
margin-left: rem(6px);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&.active {
|
|
84
|
+
background-color: var(--nsw-white);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&.active .nsw-material-icons {
|
|
88
|
+
transform: rotate(270deg);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__sub-list {
|
|
95
|
+
list-style: none;
|
|
96
|
+
padding: 0;
|
|
97
|
+
margin: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
li {
|
|
101
|
+
margin: 0;
|
|
102
|
+
border-bottom: solid 1px var(--nsw-grey-04);
|
|
103
|
+
|
|
104
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
105
|
+
border: 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
a {
|
|
109
|
+
padding: rem(16px);
|
|
110
|
+
color: var(--nsw-text-dark);
|
|
111
|
+
text-decoration: none;
|
|
112
|
+
display: flex;
|
|
113
|
+
flex-direction: row;
|
|
114
|
+
align-items: center;
|
|
115
|
+
justify-content: space-between;
|
|
116
|
+
flex-wrap: nowrap;
|
|
117
|
+
|
|
118
|
+
.nsw-material-icons {
|
|
119
|
+
color: var(--nsw-brand-dark);
|
|
120
|
+
margin-right: rem(-8px);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
124
|
+
font-weight: var(--nsw-font-bold);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
a {
|
|
130
|
+
font-weight: var(--nsw-font-normal);
|
|
131
|
+
|
|
132
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
133
|
+
@include z-index('middle');
|
|
134
|
+
position: relative;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:hover {
|
|
138
|
+
outline-width: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&:focus {
|
|
142
|
+
outline-width: 3px;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&__title {
|
|
147
|
+
font-weight: var(--nsw-font-bold);
|
|
148
|
+
|
|
149
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
150
|
+
@include font-size('md');
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.nsw-main-nav__sub-nav & {
|
|
155
|
+
border-bottom: solid 1px var(--nsw-grey-04);
|
|
156
|
+
|
|
157
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
158
|
+
border-bottom: 0;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
a {
|
|
163
|
+
font-weight: var(--nsw-font-bold);
|
|
164
|
+
|
|
165
|
+
.nsw-material-icons {
|
|
166
|
+
display: none;
|
|
167
|
+
|
|
168
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
169
|
+
display: block;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
&__description {
|
|
176
|
+
@include font-size('xs');
|
|
177
|
+
margin-top: rem(16px);
|
|
178
|
+
display: none;
|
|
179
|
+
|
|
180
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
181
|
+
display: block;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&__sub-nav {
|
|
186
|
+
@include z-index;
|
|
187
|
+
background-color: var(--nsw-white);
|
|
188
|
+
position: absolute;
|
|
189
|
+
top: 0;
|
|
190
|
+
left: 0;
|
|
191
|
+
width: 100%;
|
|
192
|
+
height: 100%;
|
|
193
|
+
transition: all 0.25s ease-in-out;
|
|
194
|
+
transform: translateX(-100%);
|
|
195
|
+
visibility: hidden;
|
|
196
|
+
overflow-y: auto;
|
|
197
|
+
|
|
198
|
+
&.active {
|
|
199
|
+
transform: translateX(0);
|
|
200
|
+
visibility: visible;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
204
|
+
@include container;
|
|
205
|
+
padding: rem(48) rem(40);
|
|
206
|
+
top: 100%;
|
|
207
|
+
background-color: var(--nsw-white);
|
|
208
|
+
box-shadow: 0 4px 9px -5px rgba(var(--nsw-black-rgb), 0.4);
|
|
209
|
+
transition: none;
|
|
210
|
+
transform: none;
|
|
211
|
+
height: auto;
|
|
212
|
+
overflow: auto;
|
|
213
|
+
|
|
214
|
+
&.active {
|
|
215
|
+
left: 50%;
|
|
216
|
+
transform: translateX(-50%);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
ul {
|
|
221
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
222
|
+
margin-top: rem(32px);
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-direction: row;
|
|
225
|
+
flex-wrap: wrap;
|
|
226
|
+
|
|
227
|
+
.nsw-material-icons {
|
|
228
|
+
display: none;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
li {
|
|
234
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
235
|
+
width: 32%;
|
|
236
|
+
border-top: solid 1px var(--nsw-grey-04);
|
|
237
|
+
|
|
238
|
+
&:nth-child(3n+2) {
|
|
239
|
+
margin-left: 2%;
|
|
240
|
+
margin-right: 2%;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
&:nth-last-child(-n+3) {
|
|
244
|
+
border-bottom: solid 1px var(--nsw-grey-04);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
a {
|
|
248
|
+
color: var(--nsw-brand-dark);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.nsw-main-nav__title {
|
|
254
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
255
|
+
a {
|
|
256
|
+
padding: 0;
|
|
257
|
+
color: var(--nsw-brand-dark);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.nsw-material-icons {
|
|
261
|
+
margin: 0 0 0 rem(12px);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.nsw-main-nav__sub-nav {
|
|
267
|
+
@include breakpoint($nsw-desktop-breakpoint) {
|
|
268
|
+
display: none;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
|
|
5
5
|
class Navigation {
|
|
6
6
|
constructor() {
|
|
7
|
-
this.openNavButton = document.querySelector('.js-open-
|
|
8
|
-
this.closeNavButtons = document.querySelectorAll('.js-close-
|
|
9
|
-
this.
|
|
10
|
-
this.
|
|
11
|
-
this.mainNavElement = document.getElementById('main-
|
|
7
|
+
this.openNavButton = document.querySelector('.js-open-nav')
|
|
8
|
+
this.closeNavButtons = document.querySelectorAll('.js-close-nav')
|
|
9
|
+
this.openSubNavButtons = document.querySelectorAll('.js-open-sub-nav')
|
|
10
|
+
this.closeSubNavButtons = document.querySelectorAll('.js-close-sub-nav')
|
|
11
|
+
this.mainNavElement = document.getElementById('main-nav')
|
|
12
12
|
this.isMegaMenuElement = !!document.querySelector('.js-mega-menu')
|
|
13
13
|
this.transitionEvent = whichTransitionEvent()
|
|
14
14
|
this.mobileToggleMainNavEvent = (e) => this.mobileToggleMainNav(e)
|
|
15
|
-
this.
|
|
15
|
+
this.mobileToggleSubNavEvent = () => this.closeSubNav()
|
|
16
16
|
this.mobileShowMainTransitionEndEvent = (e) => this.mobileShowMainNav(e)
|
|
17
17
|
this.mobileHideMainTransitionEndEvent = (e) => this.mobileHideMainNav(e)
|
|
18
18
|
this.showSubNavTransitionEndEvent = (e) => this.showSubNav(e)
|
|
@@ -38,8 +38,8 @@ class Navigation {
|
|
|
38
38
|
responsiveCheck(e) {
|
|
39
39
|
let megaMenuListItems = []
|
|
40
40
|
if (e.matches) {
|
|
41
|
-
megaMenuListItems = [].slice.call(this.mainNavElement.querySelectorAll('
|
|
42
|
-
this.body.classList.remove('
|
|
41
|
+
megaMenuListItems = [].slice.call(this.mainNavElement.querySelectorAll('ul > li'))
|
|
42
|
+
this.body.classList.remove('main-nav-active')
|
|
43
43
|
} else {
|
|
44
44
|
megaMenuListItems = [].slice.call(this.mainNavElement.querySelectorAll('li'))
|
|
45
45
|
}
|
|
@@ -51,7 +51,7 @@ class Navigation {
|
|
|
51
51
|
if (this.isMegaMenuElement) {
|
|
52
52
|
const listItems = [].slice.call(this.mainNavElement.querySelectorAll('li'))
|
|
53
53
|
listItems.forEach((item) => {
|
|
54
|
-
const submenu = item.querySelector('[id^=
|
|
54
|
+
const submenu = item.querySelector('[id^=sub-nav-]')
|
|
55
55
|
const link = item.querySelector('a')
|
|
56
56
|
if (submenu) {
|
|
57
57
|
link.removeAttribute('role')
|
|
@@ -71,8 +71,8 @@ class Navigation {
|
|
|
71
71
|
element.addEventListener('click', this.mobileToggleMainNavEvent, false)
|
|
72
72
|
})
|
|
73
73
|
|
|
74
|
-
this.
|
|
75
|
-
element.addEventListener('click', this.
|
|
74
|
+
this.closeSubNavButtons.forEach((element) => {
|
|
75
|
+
element.addEventListener('click', this.mobileToggleSubNavEvent, false)
|
|
76
76
|
})
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -84,7 +84,7 @@ class Navigation {
|
|
|
84
84
|
setUpNavControls(listItems) {
|
|
85
85
|
if (this.isMegaMenuElement) {
|
|
86
86
|
listItems.forEach((item) => {
|
|
87
|
-
const submenu = item.querySelector('[id^=
|
|
87
|
+
const submenu = item.querySelector('[id^=sub-nav-]')
|
|
88
88
|
const link = item.querySelector('a')
|
|
89
89
|
if (submenu) {
|
|
90
90
|
link.setAttribute('role', 'button')
|
|
@@ -101,8 +101,8 @@ class Navigation {
|
|
|
101
101
|
mobileShowMainNav({ propertyName }) {
|
|
102
102
|
if (!propertyName === 'transform') return
|
|
103
103
|
getFocusableElementBySelector(this.mainNavElement.id, ['> div button', '> ul > li > a']).all[1].focus()
|
|
104
|
-
this.mainNavElement.classList.add('
|
|
105
|
-
this.mainNavElement.classList.remove('
|
|
104
|
+
this.mainNavElement.classList.add('active')
|
|
105
|
+
this.mainNavElement.classList.remove('activating')
|
|
106
106
|
this.mainNavElement.removeEventListener(this.transitionEvent, this.mobileShowMainTransitionEndEvent, false)
|
|
107
107
|
this.mainNavElement.addEventListener('keydown', this.mobileTrapTabKeyEvent, false)
|
|
108
108
|
}
|
|
@@ -110,13 +110,13 @@ class Navigation {
|
|
|
110
110
|
mobileHideMainNav({ propertyName }) {
|
|
111
111
|
if (!propertyName === 'transform') return
|
|
112
112
|
|
|
113
|
-
this.mainNavElement.classList.remove('
|
|
114
|
-
this.mainNavElement.classList.remove('
|
|
113
|
+
this.mainNavElement.classList.remove('active')
|
|
114
|
+
this.mainNavElement.classList.remove('closing')
|
|
115
115
|
while (this.openSubNavElements.length > 0) {
|
|
116
116
|
const { submenu } = this.whichSubNavLatest()
|
|
117
117
|
submenu.removeEventListener('keydown', this.mobileSubNavTrapTabKeyEvent, false)
|
|
118
|
-
submenu.classList.remove('
|
|
119
|
-
submenu.classList.remove('
|
|
118
|
+
submenu.classList.remove('active')
|
|
119
|
+
submenu.classList.remove('closing')
|
|
120
120
|
this.openSubNavElements.pop()
|
|
121
121
|
}
|
|
122
122
|
this.mainNavElement.removeEventListener(this.transitionEvent, this.mobileHideMainTransitionEndEvent, false)
|
|
@@ -127,27 +127,27 @@ class Navigation {
|
|
|
127
127
|
const { currentTarget } = e
|
|
128
128
|
const isExpanded = currentTarget.getAttribute('aria-expanded') === 'true'
|
|
129
129
|
if (isExpanded) {
|
|
130
|
-
this.body.classList.remove('
|
|
130
|
+
this.body.classList.remove('main-nav-active')
|
|
131
131
|
this.openNavButton.focus()
|
|
132
|
-
this.mainNavElement.classList.add('
|
|
132
|
+
this.mainNavElement.classList.add('closing')
|
|
133
133
|
this.mainNavElement.addEventListener(this.transitionEvent, this.mobileHideMainTransitionEndEvent, false)
|
|
134
134
|
} else {
|
|
135
|
-
this.body.classList.add('
|
|
136
|
-
this.mainNavElement.classList.add('
|
|
135
|
+
this.body.classList.add('main-nav-active')
|
|
136
|
+
this.mainNavElement.classList.add('activating')
|
|
137
137
|
this.mainNavElement.addEventListener(this.transitionEvent, this.mobileShowMainTransitionEndEvent, false)
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
buttonClickDesktop(e) {
|
|
142
142
|
this.saveElements(e)
|
|
143
|
-
this.
|
|
143
|
+
this.toggleSubNavDesktop()
|
|
144
144
|
e.preventDefault()
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
buttonKeydownDesktop(e) {
|
|
148
148
|
if (e.key === ' ' || e.key === 'Enter' || e.key === 'Spacebar') {
|
|
149
149
|
this.saveElements(e)
|
|
150
|
-
this.
|
|
150
|
+
this.toggleSubNavDesktop()
|
|
151
151
|
e.preventDefault()
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -157,7 +157,7 @@ class Navigation {
|
|
|
157
157
|
const { link } = this.whichSubNavLatest()
|
|
158
158
|
const isExpanded = link.getAttribute('aria-expanded') === 'true'
|
|
159
159
|
if (isExpanded) {
|
|
160
|
-
this.
|
|
160
|
+
this.toggleSubNavDesktop(true)
|
|
161
161
|
e.preventDefault()
|
|
162
162
|
link.focus()
|
|
163
163
|
}
|
|
@@ -178,56 +178,57 @@ class Navigation {
|
|
|
178
178
|
showSubNav({ propertyName }) {
|
|
179
179
|
const { submenu } = this.whichSubNavLatest()
|
|
180
180
|
if (!propertyName === 'transform') return
|
|
181
|
-
getFocusableElementBySelector(submenu.id, ['> div button', '>
|
|
181
|
+
getFocusableElementBySelector(submenu.id, ['> div button', '> .nsw-main-nav__title a', '> ul > li > a']).all[2].focus()
|
|
182
182
|
submenu.removeEventListener(this.transitionEvent, this.showSubNavTransitionEndEvent, false)
|
|
183
183
|
}
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
closeSubNav() {
|
|
186
186
|
const { submenu, link } = this.whichSubNavLatest()
|
|
187
187
|
if (this.breakpoint.matches) {
|
|
188
188
|
link.setAttribute('aria-expanded', false)
|
|
189
|
-
link.classList.remove('
|
|
189
|
+
link.classList.remove('active')
|
|
190
190
|
this.mainNavElement.removeEventListener('focus', this.checkFocusEvent, true)
|
|
191
191
|
// fix: workaround for safari because it doesn't support focus event
|
|
192
|
-
this.mainNavElement.removeEventListener('
|
|
192
|
+
this.mainNavElement.removeEventListener('click', this.checkFocusEvent, true)
|
|
193
193
|
} else {
|
|
194
194
|
link.focus()
|
|
195
195
|
submenu.removeEventListener('keydown', this.mobileSubNavTrapTabKeyEvent, false)
|
|
196
196
|
}
|
|
197
|
-
submenu.classList.remove('
|
|
197
|
+
submenu.classList.remove('active')
|
|
198
198
|
this.openSubNavElements.pop()
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
|
|
201
|
+
openSubNav() {
|
|
202
202
|
const { submenu, link } = this.whichSubNavLatest()
|
|
203
203
|
if (this.breakpoint.matches) {
|
|
204
204
|
link.setAttribute('aria-expanded', true)
|
|
205
|
-
link.classList.add('
|
|
205
|
+
link.classList.add('active')
|
|
206
206
|
this.mainNavElement.addEventListener('focus', this.checkFocusEvent, true)
|
|
207
207
|
// fix: workaround for safari because it doesn't support focus event
|
|
208
|
-
this.mainNavElement.addEventListener('
|
|
208
|
+
this.mainNavElement.addEventListener('click', this.checkFocusEvent, true)
|
|
209
209
|
} else {
|
|
210
210
|
submenu.addEventListener('keydown', this.mobileSubNavTrapTabKeyEvent, false)
|
|
211
211
|
submenu.addEventListener(this.transitionEvent, this.showSubNavTransitionEndEvent, false)
|
|
212
212
|
}
|
|
213
|
-
submenu.classList.add('
|
|
213
|
+
submenu.classList.add('active')
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
toggleSubNavDesktop() {
|
|
217
217
|
const { link } = this.whichSubNavLatest()
|
|
218
218
|
const isExpanded = link.getAttribute('aria-expanded') === 'true'
|
|
219
219
|
if (isExpanded) {
|
|
220
|
-
this.
|
|
220
|
+
this.closeSubNav()
|
|
221
221
|
} else {
|
|
222
|
-
this.
|
|
222
|
+
this.openSubNav()
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
checkIfContainsFocus(e) {
|
|
227
227
|
const { linkParent } = this.whichSubNavLatest()
|
|
228
228
|
const focusWithin = linkParent.contains(e.target)
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
const isButton = e.target.getAttribute('role')
|
|
230
|
+
if (!focusWithin && isButton) {
|
|
231
|
+
this.toggleSubNavDesktop()
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
234
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
$masthead-brand-dark: #002664;
|
|
2
|
+
$masthead-off-white: #f2f2f2;
|
|
3
|
+
$masthead-text-dark: #22272b;
|
|
4
|
+
$masthead-text-light: #ffffff;
|
|
5
|
+
|
|
6
|
+
.nsw-skip {
|
|
7
|
+
position: fixed;
|
|
8
|
+
top: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
a {
|
|
13
|
+
@include font-size('xxs');
|
|
14
|
+
@include z-index('middle');
|
|
15
|
+
background-color: $masthead-brand-dark;
|
|
16
|
+
color: $masthead-text-light;
|
|
17
|
+
width: 100%;
|
|
18
|
+
text-decoration: none;
|
|
19
|
+
padding: rem(8px) rem(16px);
|
|
20
|
+
position: absolute;
|
|
21
|
+
top: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
transform: translateY(-101%);
|
|
24
|
+
|
|
25
|
+
&:focus {
|
|
26
|
+
transform: translateY(0);
|
|
27
|
+
outline: none;
|
|
28
|
+
|
|
29
|
+
span {
|
|
30
|
+
@include nsw-focus($color: $masthead-text-light);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include breakpoint('lg') {
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&--light {
|
|
40
|
+
a {
|
|
41
|
+
background-color: $masthead-off-white;
|
|
42
|
+
color: $masthead-text-dark;
|
|
43
|
+
|
|
44
|
+
&:focus span {
|
|
45
|
+
@include nsw-focus();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.nsw-masthead {
|
|
52
|
+
@include font-size('xxs');
|
|
53
|
+
padding: rem(8px) 0;
|
|
54
|
+
background-color: $masthead-brand-dark;
|
|
55
|
+
color: $masthead-text-light;
|
|
56
|
+
|
|
57
|
+
&--light {
|
|
58
|
+
background-color: $masthead-off-white;
|
|
59
|
+
color: $masthead-text-dark;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
.nsw-media {
|
|
3
2
|
width: 100%;
|
|
4
3
|
margin: rem(16px) auto;
|
|
@@ -85,10 +84,23 @@
|
|
|
85
84
|
|
|
86
85
|
figcaption {
|
|
87
86
|
@include font-size('xs');
|
|
88
|
-
background-color:
|
|
87
|
+
background-color: var(--nsw-off-white);
|
|
89
88
|
padding: rem(16px);
|
|
90
89
|
}
|
|
91
90
|
|
|
91
|
+
&--light {
|
|
92
|
+
figcaption {
|
|
93
|
+
background-color: var(--nsw-brand-light);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&--dark {
|
|
98
|
+
figcaption {
|
|
99
|
+
background-color: var(--nsw-brand-dark);
|
|
100
|
+
color: var(--nsw-text-light);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
92
104
|
&--transparent {
|
|
93
105
|
figcaption {
|
|
94
106
|
background-color: transparent;
|
|
@@ -1,60 +1,56 @@
|
|
|
1
1
|
.nsw-pagination {
|
|
2
|
-
@include font-stack('heading');
|
|
3
2
|
@include component-spacing();
|
|
4
|
-
@include nsw-spacing(padding-left, none);
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: flex-start;
|
|
7
|
-
flex-wrap: wrap;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
list-style: none;
|
|
10
|
-
|
|
11
|
-
&__item {
|
|
12
|
-
@include nsw-spacing(margin, none none none xs);
|
|
13
|
-
|
|
14
|
-
&--next-page {
|
|
15
|
-
@include nsw-spacing(margin, none none none md);
|
|
16
|
-
}
|
|
17
3
|
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
ul {
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-wrap: wrap;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
list-style: none;
|
|
10
|
+
padding: 0;
|
|
11
|
+
}
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
li {
|
|
14
|
+
margin: 0;
|
|
15
|
+
|
|
16
|
+
> span {
|
|
17
|
+
padding: rem(4px);
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
display: inline-flex;
|
|
21
|
+
a {
|
|
22
|
+
display: block;
|
|
30
23
|
text-decoration: none;
|
|
31
|
-
vertical-align: middle;
|
|
32
|
-
padding: rem(4px) rem(8px);
|
|
33
|
-
color: $dark80;
|
|
34
24
|
text-align: center;
|
|
35
|
-
|
|
25
|
+
padding: rem(4px);
|
|
26
|
+
min-width: rem(30px);
|
|
27
|
+
border-radius: var(--nsw-border-radius);
|
|
36
28
|
|
|
37
29
|
&:hover {
|
|
38
|
-
|
|
30
|
+
outline-width: 0;
|
|
39
31
|
}
|
|
40
32
|
|
|
41
33
|
&:focus {
|
|
42
|
-
|
|
34
|
+
outline-width: 3px;
|
|
43
35
|
}
|
|
44
36
|
|
|
45
|
-
&.
|
|
46
|
-
position:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
height: 2px;
|
|
53
|
-
background-color: $nsw-primary-blue;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
37
|
+
&.active {
|
|
38
|
+
position: relative;
|
|
39
|
+
color: var(--nsw-text-dark);
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
background-color: transparent;
|
|
43
|
+
}
|
|
56
44
|
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
&::after {
|
|
46
|
+
content: '';
|
|
47
|
+
position: absolute;
|
|
48
|
+
bottom: 0;
|
|
49
|
+
left: rem(4px);
|
|
50
|
+
right: rem(4px);
|
|
51
|
+
height: 2px;
|
|
52
|
+
background-color: var(--nsw-brand-accent);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
59
55
|
}
|
|
60
56
|
}
|
|
@@ -7,20 +7,20 @@
|
|
|
7
7
|
|
|
8
8
|
&__bar {
|
|
9
9
|
display: flex;
|
|
10
|
+
padding-top: rem(8px);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
border-top: 4px solid $light20;
|
|
16
|
-
width: 100%;
|
|
12
|
+
div {
|
|
13
|
+
height: rem(4px);
|
|
14
|
+
width: 100%;
|
|
15
|
+
background-color: var(--nsw-grey-04);
|
|
17
16
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
&:not(:first-child) {
|
|
18
|
+
margin-left: rem(4px);
|
|
19
|
+
}
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
&.active {
|
|
22
|
+
background-color: var(--nsw-brand-accent);
|
|
23
|
+
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|