nsw-design-system 3.26.0 → 3.26.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.
@@ -35,6 +35,7 @@ declare class Navigation {
35
35
  mobileToggleMainNav(e: any): void;
36
36
  buttonClickDesktop(event: any): void;
37
37
  buttonKeydownDesktop(event: any): void;
38
+ ensureSingleDesktopSubNav(currentTarget: any): void;
38
39
  escapeClose(e: any): void;
39
40
  saveElements(e: any): void;
40
41
  showSubNav({ propertyName }: {
package/dist/js/main.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! NSW Design System v3.26.0 | MIT License */
1
+ /*! NSW Design System v3.26.2 | MIT License */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
4
4
  typeof define === 'function' && define.amd ? define('NSW', ['exports'], factory) :
@@ -3328,6 +3328,7 @@
3328
3328
  this.closeButton.addEventListener('click', () => {
3329
3329
  this.closeMessage();
3330
3330
  });
3331
+ this.closeButton.hidden = false;
3331
3332
  }
3332
3333
  closeMessage() {
3333
3334
  this.element.hidden = true;
@@ -3499,6 +3500,7 @@
3499
3500
  buttonClickDesktop(event) {
3500
3501
  const isDesktop = this.breakpoint.matches;
3501
3502
  if (!isDesktop || !event.target.closest('.nsw-main-nav__sub-nav')) {
3503
+ this.ensureSingleDesktopSubNav(event.currentTarget);
3502
3504
  this.saveElements(event);
3503
3505
  this.toggleSubNavDesktop();
3504
3506
  event.preventDefault();
@@ -3506,11 +3508,28 @@
3506
3508
  }
3507
3509
  buttonKeydownDesktop(event) {
3508
3510
  if (event.key === ' ' || event.key === 'Enter' || event.key === 'Spacebar') {
3511
+ this.ensureSingleDesktopSubNav(event.currentTarget);
3509
3512
  this.saveElements(event);
3510
3513
  this.toggleSubNavDesktop();
3511
3514
  event.preventDefault();
3512
3515
  }
3513
3516
  }
3517
+ ensureSingleDesktopSubNav(currentTarget) {
3518
+ if (!this.breakpoint.matches) return;
3519
+ while (this.openSubNavElements.length > 0) {
3520
+ const {
3521
+ link
3522
+ } = this.whichSubNavLatest();
3523
+ const isExpanded = link.getAttribute('aria-expanded') === 'true';
3524
+ if (!isExpanded) {
3525
+ this.openSubNavElements.pop();
3526
+ } else if (link === currentTarget) {
3527
+ return;
3528
+ } else {
3529
+ this.closeSubNav();
3530
+ }
3531
+ }
3532
+ }
3514
3533
  escapeClose(e) {
3515
3534
  if (e.key === 'Escape') {
3516
3535
  // removes handleOutsideClick functionality from docs site
@@ -3535,6 +3554,11 @@
3535
3554
  link: currentTarget,
3536
3555
  linkParent: currentTarget.parentNode
3537
3556
  };
3557
+ if (this.breakpoint.matches) {
3558
+ this.openSubNavElements = this.openSubNavElements.filter(({
3559
+ link
3560
+ }) => link !== currentTarget);
3561
+ }
3538
3562
  this.openSubNavElements.push(temp);
3539
3563
  }
3540
3564
  showSubNav({
@@ -7570,4 +7594,4 @@
7570
7594
 
7571
7595
  }));
7572
7596
 
7573
- ;(function(g){try{g.NSW=g.NSW||{};g.NSW.VERSION="3.26.0";}catch(e){} }(typeof globalThis!=='undefined'?globalThis:(typeof window!=='undefined'?window:self)));
7597
+ ;(function(g){try{g.NSW=g.NSW||{};g.NSW.VERSION="3.26.2";}catch(e){} }(typeof globalThis!=='undefined'?globalThis:(typeof window!=='undefined'?window:self)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nsw-design-system",
3
- "version": "3.26.0",
3
+ "version": "3.26.2",
4
4
  "description": "Design system for Digital NSW",
5
5
  "main": "dist/js/main.js",
6
6
  "types": "dist/js/main.d.ts",
@@ -164,7 +164,9 @@
164
164
  margin: nsw.rem(12px) 0;
165
165
 
166
166
  @include nsw.breakpoint('md') {
167
+ flex: 0 0 auto;
167
168
  text-align: right;
169
+ white-space: nowrap;
168
170
  }
169
171
  }
170
172
 
@@ -11,6 +11,10 @@
11
11
  right: nsw.rem(4px);
12
12
  color: var(--nsw-text-light);
13
13
 
14
+ &[hidden] {
15
+ display: none;
16
+ }
17
+
14
18
  &:hover {
15
19
  @include nsw.nsw-hover;
16
20
  background-color: var(--nsw-hover-light);
@@ -19,6 +19,7 @@ class GlobalAlert {
19
19
  this.closeButton.addEventListener('click', () => {
20
20
  this.closeMessage()
21
21
  })
22
+ this.closeButton.hidden = false
22
23
  }
23
24
 
24
25
  closeMessage() {
@@ -96,7 +96,7 @@
96
96
  .nsw-material-icons {
97
97
  transform: rotate(90deg);
98
98
  margin-left: nsw.rem(6px);
99
- transition: transform nsw.$nsw-transition-duration, color nsw.$nsw-transition-duration;
99
+ transition: transform nsw.$nsw-transition-duration-smooth, color nsw.$nsw-transition-duration-smooth;
100
100
  }
101
101
 
102
102
  &.active {
@@ -111,6 +111,12 @@
111
111
  }
112
112
  }
113
113
 
114
+ @include nsw.prefers-reduced-motion() {
115
+ &__list > li > a .nsw-material-icons {
116
+ transition: none;
117
+ }
118
+ }
119
+
114
120
  &__sub-list {
115
121
  list-style: none;
116
122
  padding: 0;
@@ -160,6 +160,7 @@ class Navigation {
160
160
  buttonClickDesktop(event) {
161
161
  const isDesktop = this.breakpoint.matches
162
162
  if (!isDesktop || !event.target.closest('.nsw-main-nav__sub-nav')) {
163
+ this.ensureSingleDesktopSubNav(event.currentTarget)
163
164
  this.saveElements(event)
164
165
  this.toggleSubNavDesktop()
165
166
  event.preventDefault()
@@ -168,12 +169,30 @@ class Navigation {
168
169
 
169
170
  buttonKeydownDesktop(event) {
170
171
  if (event.key === ' ' || event.key === 'Enter' || event.key === 'Spacebar') {
172
+ this.ensureSingleDesktopSubNav(event.currentTarget)
171
173
  this.saveElements(event)
172
174
  this.toggleSubNavDesktop()
173
175
  event.preventDefault()
174
176
  }
175
177
  }
176
178
 
179
+ ensureSingleDesktopSubNav(currentTarget) {
180
+ if (!this.breakpoint.matches) return
181
+
182
+ while (this.openSubNavElements.length > 0) {
183
+ const { link } = this.whichSubNavLatest()
184
+ const isExpanded = link.getAttribute('aria-expanded') === 'true'
185
+
186
+ if (!isExpanded) {
187
+ this.openSubNavElements.pop()
188
+ } else if (link === currentTarget) {
189
+ return
190
+ } else {
191
+ this.closeSubNav()
192
+ }
193
+ }
194
+ }
195
+
177
196
  escapeClose(e) {
178
197
  if (e.key === 'Escape') {
179
198
  // removes handleOutsideClick functionality from docs site
@@ -197,6 +216,10 @@ class Navigation {
197
216
  linkParent: currentTarget.parentNode,
198
217
  }
199
218
 
219
+ if (this.breakpoint.matches) {
220
+ this.openSubNavElements = this.openSubNavElements.filter(({ link }) => link !== currentTarget)
221
+ }
222
+
200
223
  this.openSubNavElements.push(temp)
201
224
  }
202
225
 
@@ -57,7 +57,12 @@
57
57
  color: var(--nsw-brand-dark);
58
58
  font-weight: var(--nsw-font-bold);
59
59
  border-radius: var(--nsw-border-radius);
60
-
60
+ cursor: pointer;
61
+
62
+ &:disabled {
63
+ cursor: default;
64
+ }
65
+
61
66
  @include nsw.font-size('sm');
62
67
 
63
68
  &:hover {
@@ -74,11 +79,6 @@
74
79
  display: block;
75
80
  }
76
81
 
77
- @at-root {
78
- a#{&} {
79
- cursor: pointer;
80
- }
81
- }
82
82
 
83
83
  &--flex {
84
84
  display: flex;
@@ -236,6 +236,8 @@ h6,
236
236
  margin: nsw.rem(16px) 0 0 0;
237
237
 
238
238
  @include nsw.font-size('md');
239
+
240
+ line-height: var(--nsw-line-height);
239
241
  }
240
242
 
241
243