nsw-design-system 2.14.2 → 3.0.3

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.
Files changed (92) hide show
  1. package/CHANGELOG.md +586 -350
  2. package/README.md +28 -34
  3. package/dist/css/core.css +2 -0
  4. package/dist/css/main.css +1 -1
  5. package/dist/js/main.js +65 -112
  6. package/package.json +4 -2
  7. package/src/components/_all.scss +9 -14
  8. package/src/components/accordion/_accordion.scss +23 -28
  9. package/src/components/accordion/accordion.js +4 -4
  10. package/src/components/breadcrumbs/_breadcrumbs.scss +35 -40
  11. package/src/components/button/_button.scss +167 -26
  12. package/src/components/callout/_callout.scss +2 -79
  13. package/src/components/card/_card.scss +139 -168
  14. package/src/components/content-block/_content-block.scss +8 -39
  15. package/src/components/filters/_filters.scss +11 -77
  16. package/src/components/filters/filters.js +0 -5
  17. package/src/components/footer/_footer.scss +77 -132
  18. package/src/components/{forms/_forms.scss → form/_form.scss} +71 -50
  19. package/src/components/global-alert/_global-alert.scss +68 -0
  20. package/src/components/{site-wide-message/site-wide-message.js → global-alert/global-alert.js} +3 -3
  21. package/src/components/header/_header.scss +140 -253
  22. package/src/components/hero-banner/_hero-banner.scss +150 -84
  23. package/src/components/hero-search/_hero-search.scss +23 -44
  24. package/src/components/in-page-alert/_in-page-alert.scss +66 -0
  25. package/src/components/in-page-nav/_in-page-nav.scss +22 -0
  26. package/src/components/link-list/_link-list.scss +26 -41
  27. package/src/components/list-item/_list-item.scss +28 -44
  28. package/src/components/main-nav/_main-nav.scss +272 -0
  29. package/src/components/{main-navigation/main-navigation.js → main-nav/main-nav.js} +40 -39
  30. package/src/components/masthead/_masthead.scss +9 -18
  31. package/src/components/media/_media.scss +0 -1
  32. package/src/components/pagination/_pagination.scss +35 -46
  33. package/src/components/progress-indicator/_progress-indicator.scss +11 -12
  34. package/src/components/results-bar/_results-bar.scss +0 -1
  35. package/src/components/side-nav/_side-nav.scss +73 -0
  36. package/src/components/table/_table.scss +56 -0
  37. package/src/components/tables/_tables.scss +0 -86
  38. package/src/components/tabs/_tabs.scss +79 -0
  39. package/src/components/{tab-navigation/tab-navigation.js → tabs/tabs.js} +6 -8
  40. package/src/components/tag/_tag.scss +60 -0
  41. package/src/{styles → core}/_all.scss +3 -0
  42. package/src/core/grid/_grid.scss +117 -0
  43. package/src/core/iconography/_icon.scss +83 -0
  44. package/src/core/layout/_layout.scss +42 -0
  45. package/src/{styles → core}/section/_section.scss +0 -40
  46. package/src/{styles → core}/spacing/_spacing.scss +0 -8
  47. package/src/core/typography/_typography.scss +324 -0
  48. package/src/global/scss/base/_all.scss +4 -0
  49. package/src/global/scss/base/_functions.scss +44 -0
  50. package/src/global/scss/{style/_base.scss → base/_global.scss} +0 -0
  51. package/src/global/scss/base/_mixins.scss +241 -0
  52. package/src/global/scss/{tools → base}/_print.scss +1 -1
  53. package/src/global/scss/helpers/_all.scss +3 -1
  54. package/src/global/scss/helpers/_colour.scss +2 -1
  55. package/src/global/scss/helpers/_list.scss +21 -0
  56. package/src/global/scss/helpers/_text.scss +9 -0
  57. package/src/global/scss/helpers/_visibility.scss +31 -0
  58. package/src/global/scss/settings/_palette.scss +2 -1
  59. package/src/global/scss/settings/_settings.scss +9 -317
  60. package/src/global/scss/settings/_theme.scss +5 -1
  61. package/src/main.js +8 -11
  62. package/src/main.scss +13 -21
  63. package/dist/assets/svg/sprite.svg +0 -1
  64. package/src/components/banner/_banner.scss +0 -205
  65. package/src/components/direction-links/_direction-links.scss +0 -63
  66. package/src/components/feature-tile/_feature-tile.scss +0 -170
  67. package/src/components/forms/_forms-prev.scss +0 -356
  68. package/src/components/in-page-navigation/_in-page-navigation.scss +0 -27
  69. package/src/components/main-navigation/_main-navigation.scss +0 -406
  70. package/src/components/notification/_notification.scss +0 -92
  71. package/src/components/side-navigation/_side-navigation.scss +0 -86
  72. package/src/components/site-wide-message/_site-wide-message.scss +0 -163
  73. package/src/components/social-bar/_social-bar.scss +0 -28
  74. package/src/components/social-bar/social-bar.js +0 -24
  75. package/src/components/tab-navigation/_tab-navigation.scss +0 -69
  76. package/src/components/tags/_tags.scss +0 -69
  77. package/src/global/scss/helpers/_sr-only.scss +0 -7
  78. package/src/global/scss/style/_all.scss +0 -3
  79. package/src/global/scss/style/_grid.scss +0 -171
  80. package/src/global/scss/style/_icons.scss +0 -44
  81. package/src/global/scss/tools/_all.scss +0 -10
  82. package/src/global/scss/tools/_breakpoint.scss +0 -16
  83. package/src/global/scss/tools/_buttons.scss +0 -36
  84. package/src/global/scss/tools/_focus.scss +0 -25
  85. package/src/global/scss/tools/_general.scss +0 -163
  86. package/src/global/scss/tools/_grid.scss +0 -129
  87. package/src/global/scss/tools/_links.scss +0 -33
  88. package/src/global/scss/tools/_spacing.scss +0 -37
  89. package/src/global/scss/tools/_sr-only.scss +0 -21
  90. package/src/global/scss/tools/_typography.scss +0 -71
  91. package/src/styles/layout/_layout.scss +0 -0
  92. package/src/styles/typography/_typography.scss +0 -325
package/dist/js/main.js CHANGED
@@ -178,11 +178,6 @@
178
178
  var prefixValue = prefix === undefined ? 'nsw' : prefix;
179
179
  return "".concat(prefixValue, "-").concat(Math.random().toString(36).substr(2, 16));
180
180
  };
181
- var popupWindow = function popupWindow(url, width, height) {
182
- var y = window.top.outerHeight / 2 + window.top.screenY - height / 2;
183
- var x = window.top.outerWidth / 2 + window.top.screenX - width / 2;
184
- window.open(url, '', "toolbar=no,location=no,directories=no, status=no,\n menubar=no, scrollbars=no, resizable=no, copyhistory=no,\n width=".concat(width, ", height=").concat(height, ", top=").concat(y, ", left=").concat(x));
185
- };
186
181
 
187
182
  var Navigation = /*#__PURE__*/function () {
188
183
  function Navigation() {
@@ -190,11 +185,11 @@
190
185
 
191
186
  _classCallCheck(this, Navigation);
192
187
 
193
- this.openNavButton = document.querySelector('.js-open-navigation');
194
- this.closeNavButtons = document.querySelectorAll('.js-close-navigation');
195
- this.openSubnavButtons = document.querySelectorAll('.js-open-subnav');
196
- this.closeSubnavButtons = document.querySelectorAll('.js-close-subnav');
197
- this.mainNavElement = document.getElementById('main-navigation');
188
+ this.openNavButton = document.querySelector('.js-open-nav');
189
+ this.closeNavButtons = document.querySelectorAll('.js-close-nav');
190
+ this.openSubNavButtons = document.querySelectorAll('.js-open-sub-nav');
191
+ this.closeSubNavButtons = document.querySelectorAll('.js-close-sub-nav');
192
+ this.mainNavElement = document.getElementById('main-nav');
198
193
  this.isMegaMenuElement = !!document.querySelector('.js-mega-menu');
199
194
  this.transitionEvent = whichTransitionEvent();
200
195
 
@@ -202,8 +197,8 @@
202
197
  return _this.mobileToggleMainNav(e);
203
198
  };
204
199
 
205
- this.mobileToggleSubnavEvent = function () {
206
- return _this.closeSubnav();
200
+ this.mobileToggleSubNavEvent = function () {
201
+ return _this.closeSubNav();
207
202
  };
208
203
 
209
204
  this.mobileShowMainTransitionEndEvent = function (e) {
@@ -266,8 +261,8 @@
266
261
  var megaMenuListItems = [];
267
262
 
268
263
  if (e.matches) {
269
- megaMenuListItems = [].slice.call(this.mainNavElement.querySelectorAll('.nsw-navigation__list > li'));
270
- this.body.classList.remove('navigation-open');
264
+ megaMenuListItems = [].slice.call(this.mainNavElement.querySelectorAll('ul > li'));
265
+ this.body.classList.remove('main-nav-active');
271
266
  } else {
272
267
  megaMenuListItems = [].slice.call(this.mainNavElement.querySelectorAll('li'));
273
268
  }
@@ -283,7 +278,7 @@
283
278
  if (this.isMegaMenuElement) {
284
279
  var listItems = [].slice.call(this.mainNavElement.querySelectorAll('li'));
285
280
  listItems.forEach(function (item) {
286
- var submenu = item.querySelector('[id^=subnav-]');
281
+ var submenu = item.querySelector('[id^=sub-nav-]');
287
282
  var link = item.querySelector('a');
288
283
 
289
284
  if (submenu) {
@@ -305,8 +300,8 @@
305
300
  this.closeNavButtons.forEach(function (element) {
306
301
  element.addEventListener('click', _this4.mobileToggleMainNavEvent, false);
307
302
  });
308
- this.closeSubnavButtons.forEach(function (element) {
309
- element.addEventListener('click', _this4.mobileToggleSubnavEvent, false);
303
+ this.closeSubNavButtons.forEach(function (element) {
304
+ element.addEventListener('click', _this4.mobileToggleSubNavEvent, false);
310
305
  });
311
306
  }
312
307
  }, {
@@ -322,7 +317,7 @@
322
317
 
323
318
  if (this.isMegaMenuElement) {
324
319
  listItems.forEach(function (item) {
325
- var submenu = item.querySelector('[id^=subnav-]');
320
+ var submenu = item.querySelector('[id^=sub-nav-]');
326
321
  var link = item.querySelector('a');
327
322
 
328
323
  if (submenu) {
@@ -342,8 +337,8 @@
342
337
  var propertyName = _ref.propertyName;
343
338
  if (!propertyName === 'transform') return;
344
339
  getFocusableElementBySelector(this.mainNavElement.id, ['> div button', '> ul > li > a']).all[1].focus();
345
- this.mainNavElement.classList.add('is-open');
346
- this.mainNavElement.classList.remove('is-opening');
340
+ this.mainNavElement.classList.add('active');
341
+ this.mainNavElement.classList.remove('activating');
347
342
  this.mainNavElement.removeEventListener(this.transitionEvent, this.mobileShowMainTransitionEndEvent, false);
348
343
  this.mainNavElement.addEventListener('keydown', this.mobileTrapTabKeyEvent, false);
349
344
  }
@@ -352,16 +347,16 @@
352
347
  value: function mobileHideMainNav(_ref2) {
353
348
  var propertyName = _ref2.propertyName;
354
349
  if (!propertyName === 'transform') return;
355
- this.mainNavElement.classList.remove('is-open');
356
- this.mainNavElement.classList.remove('is-closing');
350
+ this.mainNavElement.classList.remove('active');
351
+ this.mainNavElement.classList.remove('closing');
357
352
 
358
353
  while (this.openSubNavElements.length > 0) {
359
354
  var _this$whichSubNavLate = this.whichSubNavLatest(),
360
355
  submenu = _this$whichSubNavLate.submenu;
361
356
 
362
357
  submenu.removeEventListener('keydown', this.mobileSubNavTrapTabKeyEvent, false);
363
- submenu.classList.remove('is-open');
364
- submenu.classList.remove('is-closing');
358
+ submenu.classList.remove('active');
359
+ submenu.classList.remove('closing');
365
360
  this.openSubNavElements.pop();
366
361
  }
367
362
 
@@ -375,13 +370,13 @@
375
370
  var isExpanded = currentTarget.getAttribute('aria-expanded') === 'true';
376
371
 
377
372
  if (isExpanded) {
378
- this.body.classList.remove('navigation-open');
373
+ this.body.classList.remove('main-nav-active');
379
374
  this.openNavButton.focus();
380
- this.mainNavElement.classList.add('is-closing');
375
+ this.mainNavElement.classList.add('closing');
381
376
  this.mainNavElement.addEventListener(this.transitionEvent, this.mobileHideMainTransitionEndEvent, false);
382
377
  } else {
383
- this.body.classList.add('navigation-open');
384
- this.mainNavElement.classList.add('is-opening');
378
+ this.body.classList.add('main-nav-active');
379
+ this.mainNavElement.classList.add('activating');
385
380
  this.mainNavElement.addEventListener(this.transitionEvent, this.mobileShowMainTransitionEndEvent, false);
386
381
  }
387
382
  }
@@ -389,7 +384,7 @@
389
384
  key: "buttonClickDesktop",
390
385
  value: function buttonClickDesktop(e) {
391
386
  this.saveElements(e);
392
- this.toggleSubnavDesktop();
387
+ this.toggleSubNavDesktop();
393
388
  e.preventDefault();
394
389
  }
395
390
  }, {
@@ -397,7 +392,7 @@
397
392
  value: function buttonKeydownDesktop(e) {
398
393
  if (e.key === ' ' || e.key === 'Enter' || e.key === 'Spacebar') {
399
394
  this.saveElements(e);
400
- this.toggleSubnavDesktop();
395
+ this.toggleSubNavDesktop();
401
396
  e.preventDefault();
402
397
  }
403
398
  }
@@ -411,7 +406,7 @@
411
406
  var isExpanded = link.getAttribute('aria-expanded') === 'true';
412
407
 
413
408
  if (isExpanded) {
414
- this.toggleSubnavDesktop(true);
409
+ this.toggleSubNavDesktop(true);
415
410
  e.preventDefault();
416
411
  link.focus();
417
412
  }
@@ -437,62 +432,62 @@
437
432
  submenu = _this$whichSubNavLate3.submenu;
438
433
 
439
434
  if (!propertyName === 'transform') return;
440
- getFocusableElementBySelector(submenu.id, ['> div button', '> h2 a', '> ul > li > a']).all[2].focus();
435
+ getFocusableElementBySelector(submenu.id, ['> div button', '> .nsw-main-nav__title a', '> ul > li > a']).all[2].focus();
441
436
  submenu.removeEventListener(this.transitionEvent, this.showSubNavTransitionEndEvent, false);
442
437
  }
443
438
  }, {
444
- key: "closeSubnav",
445
- value: function closeSubnav() {
439
+ key: "closeSubNav",
440
+ value: function closeSubNav() {
446
441
  var _this$whichSubNavLate4 = this.whichSubNavLatest(),
447
442
  submenu = _this$whichSubNavLate4.submenu,
448
443
  link = _this$whichSubNavLate4.link;
449
444
 
450
445
  if (this.breakpoint.matches) {
451
446
  link.setAttribute('aria-expanded', false);
452
- link.classList.remove('is-open');
447
+ link.classList.remove('active');
453
448
  this.mainNavElement.removeEventListener('focus', this.checkFocusEvent, true); // fix: workaround for safari because it doesn't support focus event
454
449
 
455
- this.mainNavElement.removeEventListener('mousedown', this.checkFocusEvent, true);
450
+ this.mainNavElement.removeEventListener('click', this.checkFocusEvent, true);
456
451
  } else {
457
452
  link.focus();
458
453
  submenu.removeEventListener('keydown', this.mobileSubNavTrapTabKeyEvent, false);
459
454
  }
460
455
 
461
- submenu.classList.remove('is-open');
456
+ submenu.classList.remove('active');
462
457
  this.openSubNavElements.pop();
463
458
  }
464
459
  }, {
465
- key: "opensubnav",
466
- value: function opensubnav() {
460
+ key: "openSubNav",
461
+ value: function openSubNav() {
467
462
  var _this$whichSubNavLate5 = this.whichSubNavLatest(),
468
463
  submenu = _this$whichSubNavLate5.submenu,
469
464
  link = _this$whichSubNavLate5.link;
470
465
 
471
466
  if (this.breakpoint.matches) {
472
467
  link.setAttribute('aria-expanded', true);
473
- link.classList.add('is-open');
468
+ link.classList.add('active');
474
469
  this.mainNavElement.addEventListener('focus', this.checkFocusEvent, true); // fix: workaround for safari because it doesn't support focus event
475
470
 
476
- this.mainNavElement.addEventListener('mousedown', this.checkFocusEvent, true);
471
+ this.mainNavElement.addEventListener('click', this.checkFocusEvent, true);
477
472
  } else {
478
473
  submenu.addEventListener('keydown', this.mobileSubNavTrapTabKeyEvent, false);
479
474
  submenu.addEventListener(this.transitionEvent, this.showSubNavTransitionEndEvent, false);
480
475
  }
481
476
 
482
- submenu.classList.add('is-open');
477
+ submenu.classList.add('active');
483
478
  }
484
479
  }, {
485
- key: "toggleSubnavDesktop",
486
- value: function toggleSubnavDesktop() {
480
+ key: "toggleSubNavDesktop",
481
+ value: function toggleSubNavDesktop() {
487
482
  var _this$whichSubNavLate6 = this.whichSubNavLatest(),
488
483
  link = _this$whichSubNavLate6.link;
489
484
 
490
485
  var isExpanded = link.getAttribute('aria-expanded') === 'true';
491
486
 
492
487
  if (isExpanded) {
493
- this.closeSubnav();
488
+ this.closeSubNav();
494
489
  } else {
495
- this.opensubnav();
490
+ this.openSubNav();
496
491
  }
497
492
  }
498
493
  }, {
@@ -502,9 +497,10 @@
502
497
  linkParent = _this$whichSubNavLate7.linkParent;
503
498
 
504
499
  var focusWithin = linkParent.contains(e.target);
500
+ var isButton = e.target.getAttribute('role');
505
501
 
506
- if (!focusWithin) {
507
- this.toggleSubnavDesktop();
502
+ if (!focusWithin && isButton) {
503
+ this.toggleSubNavDesktop();
508
504
  }
509
505
  }
510
506
  }, {
@@ -537,7 +533,7 @@
537
533
  button.setAttribute('aria-expanded', 'false');
538
534
  button.setAttribute('aria-controls', uID);
539
535
  button.classList.add('nsw-accordion__button');
540
- button.insertAdjacentHTML('beforeend', "\n <i class=\"material-icons nsw-material-icons nsw-accordion__icon\" focusable=\"false\" aria-hidden=\"true\">keyboard_arrow_right</i>\n ");
536
+ button.insertAdjacentHTML('beforeend', "\n <span class=\"material-icons nsw-material-icons\" focusable=\"false\" aria-hidden=\"true\">keyboard_arrow_down</span>\n ");
541
537
  fragment.appendChild(button);
542
538
  return fragment;
543
539
  }
@@ -585,7 +581,7 @@
585
581
  value: function setUpDom() {
586
582
  var _this2 = this;
587
583
 
588
- this.accordion.classList.add('is-ready');
584
+ this.accordion.classList.add('ready');
589
585
 
590
586
  if (this.collapseAllBtn) {
591
587
  this.collapseAllBtn.disabled = true;
@@ -632,11 +628,11 @@
632
628
  var targetContent = this.getTargetContent(element);
633
629
 
634
630
  if (state === 'open') {
635
- element.classList.add('is-open');
631
+ element.classList.add('active');
636
632
  element.setAttribute('aria-expanded', 'true');
637
633
  targetContent.hidden = false;
638
634
  } else if (state === 'close') {
639
- element.classList.remove('is-open');
635
+ element.classList.remove('active');
640
636
  element.setAttribute('aria-expanded', 'false');
641
637
  targetContent.hidden = true;
642
638
  }
@@ -721,14 +717,8 @@
721
717
  _createClass(Filters, [{
722
718
  key: "init",
723
719
  value: function init() {
724
- this.setUpDom();
725
720
  this.controls();
726
721
  }
727
- }, {
728
- key: "setUpDom",
729
- value: function setUpDom() {
730
- this.filters.classList.add('is-ready');
731
- }
732
722
  }, {
733
723
  key: "controls",
734
724
  value: function controls() {
@@ -772,38 +762,6 @@
772
762
  return Filters;
773
763
  }();
774
764
 
775
- var ShareThis = /*#__PURE__*/function () {
776
- function ShareThis() {
777
- _classCallCheck(this, ShareThis);
778
-
779
- this.sharelinks = document.querySelectorAll('.js-share-this');
780
- }
781
-
782
- _createClass(ShareThis, [{
783
- key: "init",
784
- value: function init() {
785
- this.controls();
786
- }
787
- }, {
788
- key: "controls",
789
- value: function controls() {
790
- var _this = this;
791
-
792
- this.sharelinks.forEach(function (element) {
793
- element.addEventListener('click', _this.popup, false);
794
- });
795
- }
796
- }, {
797
- key: "popup",
798
- value: function popup(e) {
799
- e.preventDefault();
800
- popupWindow(this.href, 600, 600);
801
- }
802
- }]);
803
-
804
- return ShareThis;
805
- }();
806
-
807
765
  var Tabs = /*#__PURE__*/function () {
808
766
  function Tabs(element, showTab) {
809
767
  var _this = this;
@@ -811,8 +769,8 @@
811
769
  _classCallCheck(this, Tabs);
812
770
 
813
771
  this.tablistClass = '.nsw-tabs__list';
814
- this.tablistItemClass = '.nsw-tabs__list-item';
815
- this.tablistLinkClass = '.nsw-tabs__link';
772
+ this.tablistItemClass = 'li';
773
+ this.tablistLinkClass = 'a';
816
774
  this.tab = element;
817
775
  this.showTab = showTab;
818
776
  this.tabList = element.querySelector(this.tablistClass);
@@ -847,7 +805,6 @@
847
805
  tabListWrapper.classList.add('nsw-tabs__list-wrapper');
848
806
  this.tab.prepend(tabListWrapper);
849
807
  tabListWrapper.prepend(this.tabList);
850
- this.tab.classList.add('is-ready');
851
808
  this.tabList.setAttribute('role', 'tablist');
852
809
  this.tabItems.forEach(function (item) {
853
810
  var itemElem = item;
@@ -886,13 +843,12 @@
886
843
  }, {
887
844
  key: "setInitalTab",
888
845
  value: function setInitalTab() {
889
- var tabItems = this.tabItems,
890
- tabLinks = this.tabLinks,
846
+ var tabLinks = this.tabLinks,
891
847
  tabPanel = this.tabPanel,
892
848
  showTab = this.showTab;
893
849
  var index = showTab === undefined ? 0 : showTab;
894
850
  var selectedLink = tabLinks[index];
895
- tabItems[index].classList.add('is-selected');
851
+ selectedLink.classList.add('active');
896
852
  selectedLink.removeAttribute('tabindex');
897
853
  selectedLink.setAttribute('aria-selected', true);
898
854
  tabPanel[index].hidden = false;
@@ -913,12 +869,12 @@
913
869
  clickedTab.focus();
914
870
  clickedTab.removeAttribute('tabindex');
915
871
  clickedTab.setAttribute('aria-selected', true);
872
+ clickedTab.classList.add('active');
916
873
  this.selectedTab.setAttribute('aria-selected', false);
917
874
  this.selectedTab.setAttribute('tabindex', '-1');
875
+ this.selectedTab.classList.remove('active');
918
876
  var clickedTabIndex = this.tabLinks.indexOf(clickedTab);
919
877
  var selectedTabIndex = this.tabLinks.indexOf(this.selectedTab);
920
- this.tabItems[clickedTabIndex].classList.add('is-selected');
921
- this.tabItems[selectedTabIndex].classList.remove('is-selected');
922
878
  this.tabPanel[clickedTabIndex].hidden = false;
923
879
  this.tabPanel[selectedTabIndex].hidden = true;
924
880
  this.selectedTab = clickedTab;
@@ -983,21 +939,21 @@
983
939
  return Tabs;
984
940
  }();
985
941
 
986
- var SitewideMessage = /*#__PURE__*/function () {
987
- function SitewideMessage(element) {
942
+ var GlobalAlert = /*#__PURE__*/function () {
943
+ function GlobalAlert(element) {
988
944
  var _this = this;
989
945
 
990
- _classCallCheck(this, SitewideMessage);
946
+ _classCallCheck(this, GlobalAlert);
991
947
 
992
948
  this.messageElement = element;
993
- this.closeButton = element.querySelector('.nsw-sitewide-message__close');
949
+ this.closeButton = element.querySelector('.js-close-alert');
994
950
 
995
951
  this.closeMessageEvent = function (e) {
996
952
  return _this.closeMessage(e);
997
953
  };
998
954
  }
999
955
 
1000
- _createClass(SitewideMessage, [{
956
+ _createClass(GlobalAlert, [{
1001
957
  key: "init",
1002
958
  value: function init() {
1003
959
  this.controls();
@@ -1014,7 +970,7 @@
1014
970
  }
1015
971
  }]);
1016
972
 
1017
- return SitewideMessage;
973
+ return GlobalAlert;
1018
974
  }();
1019
975
 
1020
976
  if (window.NodeList && !NodeList.prototype.forEach) {
@@ -1047,7 +1003,7 @@
1047
1003
  var accordions = document.querySelectorAll('.js-accordion');
1048
1004
  var filters = document.querySelectorAll('.js-filters');
1049
1005
  var tabs = document.querySelectorAll('.js-tabs');
1050
- var siteMessages = document.querySelectorAll('.js-sitewide-message');
1006
+ var globalAlert = document.querySelectorAll('.js-global-alert');
1051
1007
  openSearchButton.forEach(function (element) {
1052
1008
  new SiteSearch(element).init();
1053
1009
  });
@@ -1072,20 +1028,17 @@
1072
1028
  });
1073
1029
  }
1074
1030
 
1075
- new ShareThis().init();
1076
-
1077
- if (siteMessages) {
1078
- siteMessages.forEach(function (element) {
1079
- new SitewideMessage(element).init();
1031
+ if (globalAlert) {
1032
+ globalAlert.forEach(function (element) {
1033
+ new GlobalAlert(element).init();
1080
1034
  });
1081
1035
  }
1082
1036
  }
1083
1037
 
1084
1038
  exports.Accordion = Accordion;
1039
+ exports.GlobalAlert = GlobalAlert;
1085
1040
  exports.Navigation = Navigation;
1086
- exports.ShareThis = ShareThis;
1087
1041
  exports.SiteSearch = SiteSearch;
1088
- exports.SitewideMessage = SitewideMessage;
1089
1042
  exports.Tabs = Tabs;
1090
1043
  exports.initSite = initSite;
1091
1044
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "nsw-design-system",
3
- "version": "2.14.2",
3
+ "version": "3.0.3",
4
4
  "description": "Design system for Digital NSW",
5
5
  "main": "dist/main.js",
6
6
  "style": "dist/main.css",
7
7
  "files": [
8
8
  "dist/{css,js,assets/svg}/*.{css,js,svg}",
9
- "src/{components,patterns,styles}/**/*.{scss,js}",
9
+ "src/{components,patterns,styles,core}/**/*.{scss,js}",
10
10
  "src/global/{scripts,scss}/**/*.{scss,js}",
11
11
  "src/main.{scss,js}"
12
12
  ],
@@ -21,6 +21,7 @@
21
21
  "scripts": {
22
22
  "dev": "gulp",
23
23
  "starterkit:build": "gulp build",
24
+ "prod:build": "gulp buildprod",
24
25
  "surge": "gulp surge",
25
26
  "add": "node add-component.js",
26
27
  "git-tag": "git tag v$npm_package_version && git push origin v$npm_package_version",
@@ -63,6 +64,7 @@
63
64
  "gulp-replace": "^1.0.0",
64
65
  "gulp-sass": "^4.0.2",
65
66
  "gulp-sass-glob": "^1.1.0",
67
+ "gulp-sitemap": "^8.0.0",
66
68
  "gulp-sourcemaps": "^2.6.5",
67
69
  "gulp-stylelint": "^13.0.0",
68
70
  "gulp-surge": "^0.1.4",
@@ -1,32 +1,27 @@
1
1
  @import 'accordion/accordion';
2
- @import 'banner/banner';
3
2
  @import 'breadcrumbs/breadcrumbs';
4
3
  @import 'button/button';
5
4
  @import 'callout/callout';
6
5
  @import 'card/card';
7
6
  @import 'content-block/content-block';
8
- @import 'direction-links/direction-links';
9
- @import 'feature-tile/feature-tile';
10
7
  @import 'filters/filters';
11
8
  @import 'footer/footer';
12
- @import 'forms/forms';
13
- @import 'forms/forms-prev';
9
+ @import 'form/form';
10
+ @import 'global-alert/global-alert';
14
11
  @import 'header/header';
15
12
  @import 'hero-banner/hero-banner';
16
13
  @import 'hero-search/hero-search';
17
- @import 'in-page-navigation/in-page-navigation';
14
+ @import 'in-page-alert/in-page-alert';
15
+ @import 'in-page-nav/in-page-nav';
18
16
  @import 'link-list/link-list';
19
17
  @import 'list-item/list-item';
20
- @import 'main-navigation/main-navigation';
18
+ @import 'main-nav/main-nav';
21
19
  @import 'masthead/masthead';
22
20
  @import 'media/media';
23
- @import 'notification/notification';
24
21
  @import 'pagination/pagination';
25
22
  @import 'progress-indicator/progress-indicator';
26
23
  @import 'results-bar/results-bar';
27
- @import 'side-navigation/side-navigation';
28
- @import 'site-wide-message/site-wide-message';
29
- @import 'social-bar/social-bar';
30
- @import 'tab-navigation/tab-navigation';
31
- @import 'tables/tables';
32
- @import 'tags/tags';
24
+ @import 'side-nav/side-nav';
25
+ @import 'table/table';
26
+ @import 'tabs/tabs';
27
+ @import 'tag/tag';
@@ -1,21 +1,20 @@
1
1
  .nsw-accordion {
2
2
  @include component-spacing();
3
- font-family: var(--nsw-font-family);
4
3
 
5
4
  &__title,
6
5
  &__button {
7
6
  @include font-size('md');
8
- @include nsw-spacing(margin, xs none none);
9
- @include nsw-spacing(padding, md xxl md md);
10
7
  font-weight: var(--nsw-font-bold);
8
+ padding: rem(16px) rem(48px) rem(16px) rem(16px);
9
+ margin-top: rem(8px);
11
10
  background-color: var(--nsw-off-white);
12
11
  display: block;
13
12
  width: 100%;
14
13
  text-align: left;
15
14
  position: relative;
16
- transition: background $transition-duration, color $transition-duration;
15
+ transition: background $nsw-transition-duration, color $nsw-transition-duration;
17
16
 
18
- .is-open,
17
+ .active,
19
18
  &:hover & {
20
19
  background-color: var(--nsw-brand-dark);
21
20
  color: var(--nsw-text-light);
@@ -27,9 +26,9 @@
27
26
  }
28
27
 
29
28
  &__toggle {
30
- @include nsw-spacing(margin, none none md none);
31
29
  display: flex;
32
30
  justify-content: flex-end;
31
+ margin-bottom: rem(16px);
33
32
 
34
33
  button {
35
34
  @include font-size('sm');
@@ -51,26 +50,34 @@
51
50
  }
52
51
 
53
52
  &:first-child {
54
- @include nsw-spacing(margin, none lg none none);
53
+ margin-right: rem(24px);
55
54
  }
56
55
 
57
56
  &:disabled {
58
- opacity: 0.38;
57
+ opacity: 0.4;
59
58
  cursor: not-allowed;
60
59
  }
61
60
  }
62
61
  }
63
62
 
64
63
  &__title {
65
- .is-ready & {
66
- border-left: 0;
64
+ .ready & {
67
65
  padding: 0;
68
66
  margin-top: 0;
69
67
  }
68
+
69
+ .nsw-material-icons {
70
+ font-size: rem(map-get($nsw-icon-sizes, 30));
71
+ color: var(--nsw-brand-dark);
72
+ transform: translateY(-50%);
73
+ position: absolute;
74
+ top: 50%;
75
+ right: rem(8px);
76
+ transition: transform $nsw-transition-duration, color $nsw-transition-duration;
77
+ }
70
78
  }
71
79
 
72
80
  &__button {
73
- font-family: var(--nsw-font-family);
74
81
  border: 0;
75
82
  color: var(--nsw-text-dark);
76
83
 
@@ -79,27 +86,15 @@
79
86
  @include z-index;
80
87
  position: relative;
81
88
  }
82
- }
83
-
84
- &__icon {
85
- transform: translateY(-50%) rotate(90deg);
86
- position: absolute;
87
- top: 50%;
88
- right: rem(9px);
89
- transition: transform $transition-duration, color $transition-duration;
90
89
 
91
- .is-open & {
92
- transform: translateY(-50%) rotate(270deg);
93
- }
94
-
95
- &.nsw-icon {
96
- height: rem(16px);
97
- width: rem(16px);
98
- right: rem(16px);
90
+ &.active {
91
+ .nsw-material-icons {
92
+ transform: translateY(-50%) rotate(180deg);
93
+ }
99
94
  }
100
95
  }
101
96
 
102
97
  &__content {
103
- @include nsw-spacing(padding, md);
98
+ padding: rem(16px);
104
99
  }
105
100
  }
@@ -10,7 +10,7 @@ function createButtons({ textContent }) {
10
10
  button.setAttribute('aria-controls', uID)
11
11
  button.classList.add('nsw-accordion__button')
12
12
  button.insertAdjacentHTML('beforeend', `
13
- <i class="material-icons nsw-material-icons nsw-accordion__icon" focusable="false" aria-hidden="true">keyboard_arrow_right</i>
13
+ <span class="material-icons nsw-material-icons" focusable="false" aria-hidden="true">keyboard_arrow_down</span>
14
14
  `)
15
15
 
16
16
  fragment.appendChild(button)
@@ -39,7 +39,7 @@ class Accordion {
39
39
  }
40
40
 
41
41
  setUpDom() {
42
- this.accordion.classList.add('is-ready')
42
+ this.accordion.classList.add('ready')
43
43
  if (this.collapseAllBtn) {
44
44
  this.collapseAllBtn.disabled = true
45
45
  }
@@ -79,11 +79,11 @@ class Accordion {
79
79
  const targetContent = this.getTargetContent(element)
80
80
 
81
81
  if (state === 'open') {
82
- element.classList.add('is-open')
82
+ element.classList.add('active')
83
83
  element.setAttribute('aria-expanded', 'true')
84
84
  targetContent.hidden = false
85
85
  } else if (state === 'close') {
86
- element.classList.remove('is-open')
86
+ element.classList.remove('active')
87
87
  element.setAttribute('aria-expanded', 'false')
88
88
  targetContent.hidden = true
89
89
  }