@qhealth-design-system/core 1.16.5 → 1.17.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.
Files changed (45) hide show
  1. package/.storybook/assets/storybook.css +1 -1
  2. package/.storybook/globals.js +10 -0
  3. package/CHANGELOG.md +2 -0
  4. package/package.json +1 -1
  5. package/src/components/_global/css/cta_links/component.scss +107 -14
  6. package/src/components/_global/css/forms/control_inputs/component.scss +65 -77
  7. package/src/components/_global/css/link_columns/component.scss +2 -2
  8. package/src/components/_global/html/scripts.html +0 -2
  9. package/src/components/_global/js/cta_links/global.js +33 -0
  10. package/src/components/_global/js/global.js +175 -138
  11. package/src/components/_global/js/tabs/global.js +6 -2
  12. package/src/components/banner_advanced/html/component.hbs +1 -1
  13. package/src/components/breadcrumbs/js/global.js +17 -4
  14. package/src/components/card_feature/html/component.hbs +1 -1
  15. package/src/components/card_multi_action/html/component.hbs +1 -1
  16. package/src/components/card_single_action/css/component.scss +38 -47
  17. package/src/components/card_single_action/html/component.hbs +1 -1
  18. package/src/components/code/css/component.scss +72 -73
  19. package/src/components/code/html/component.hbs +62 -19
  20. package/src/components/code/js/global.js +102 -86
  21. package/src/components/footer/css/component.scss +2 -4
  22. package/src/components/footer/html/component.hbs +11 -8
  23. package/src/components/header/css/component.scss +11 -11
  24. package/src/components/header/html/component.hbs +3 -3
  25. package/src/components/header/js/global.js +58 -65
  26. package/src/components/in_page_navigation/js/global.js +34 -31
  27. package/src/components/internal_navigation/js/global.js +13 -3
  28. package/src/components/main_navigation/css/component.scss +79 -13
  29. package/src/components/main_navigation/html/component.hbs +5 -5
  30. package/src/components/main_navigation/js/global.js +94 -115
  31. package/src/components/mega_main_navigation/css/component.scss +27 -14
  32. package/src/components/mega_main_navigation/html/component.hbs +5 -5
  33. package/src/components/mega_main_navigation/js/global.js +50 -55
  34. package/src/components/page_alert/css/component.scss +141 -179
  35. package/src/data/site.json +3 -3
  36. package/src/html/component-card_feature.html +74 -487
  37. package/src/html/component-card_single_action.html +219 -1175
  38. package/src/html/component-forms.html +202 -67
  39. package/src/stories/Checkboxes/Checkboxes.js +41 -0
  40. package/src/stories/Checkboxes/Checkboxes.mdx +45 -0
  41. package/src/stories/Checkboxes/Checkboxes.stories.js +209 -0
  42. package/src/stories/RadioButtons/RadioButtons.js +41 -0
  43. package/src/stories/RadioButtons/RadioButtons.mdx +45 -0
  44. package/src/stories/RadioButtons/RadioButtons.stories.js +209 -0
  45. package/src/styles/imports/mixins.scss +5 -43
@@ -1,46 +1,41 @@
1
1
  (function () {
2
-
3
2
  /**
4
3
  * The mega menu module
5
- *
4
+ *
6
5
  * @module megaMenu
7
6
  */
8
7
  var megaMenu = {
9
-
10
8
  /**
11
9
  * Initialise the mega menu listeners for keyboard navigation
12
- *
10
+ *
13
11
  * @memberof module:megaMenu
14
12
  */
15
- 'init': function () {
16
-
13
+ init: function () {
17
14
  // Top level items
18
- var topNavItems = document.querySelectorAll('.qld__main-nav__item-title > a');
15
+ var topNavItems = document.querySelectorAll(".qld__main-nav__item-title > a");
19
16
  topNavItems.forEach(function (item) {
20
- item.addEventListener('keydown', handleTopNavKeydown);
21
- item.addEventListener('focusin', toggleMenu);
22
- item.addEventListener('focusout', handleTopNavFocusout);
17
+ item.addEventListener("keydown", handleTopNavKeydown);
18
+ item.addEventListener("focusin", toggleMenu);
19
+ item.addEventListener("focusout", handleTopNavFocusout);
23
20
  });
24
21
 
25
22
  // Mega menu items
26
- var menuItems = document.querySelectorAll('.qld__main-nav__menu-sub a');
23
+ var menuItems = document.querySelectorAll(".qld__main-nav__menu-sub a");
27
24
  menuItems.forEach(function (item) {
28
- item.addEventListener('keydown', handleMenuKeypress);
25
+ item.addEventListener("keydown", handleMenuKeypress);
29
26
  });
30
-
31
27
  },
32
-
33
28
  };
34
29
 
35
30
  /**
36
31
  * Handle keydown on top level nav item to close the menu
37
32
  * if ESCAPE or UP key are pressed
38
- *
33
+ *
39
34
  * @memberof module:megaMenu
40
35
  * @instance
41
36
  * @private
42
- *
43
- * @param {Document.event} e
37
+ *
38
+ * @param {Document.event} e
44
39
  */
45
40
  function handleTopNavKeydown(e) {
46
41
  var key = e.keyCode;
@@ -54,23 +49,26 @@
54
49
  /**
55
50
  * Handle focusout of top level nav items.
56
51
  * Close the menu, unless we have tabbed within
57
- *
52
+ *
58
53
  * @memberof module:megaMenu
59
54
  * @instance
60
55
  * @private
61
- *
62
- * @param {Document.event} e
56
+ *
57
+ * @param {Document.event} e
63
58
  */
64
59
  function handleTopNavFocusout(e) {
65
60
  var link = e.target;
66
- var navItem = link.closest('.qld__main-nav__item');
67
- var expanded = navItem.classList.contains('expanded') ? true : false;
68
- var menu = navItem.querySelector('.qld__main-nav__menu-sub');
69
-
61
+ var navItem = link.closest(".qld__main-nav__item");
62
+ var expanded = navItem.classList.contains("expanded") ? true : false;
63
+ var menu = navItem.querySelector(".qld__main-nav__menu-sub");
64
+
70
65
  // Short delay to ensure we are on the new active element
71
66
  // Close the menu, unless we have tabbed within
72
- setTimeout(function() {
73
- var menuHasFocus = menu.contains(document.activeElement) ? true : false;
67
+ setTimeout(function () {
68
+ let menuHasFocus;
69
+ if (menu) {
70
+ menuHasFocus = menu.contains(document.activeElement) ? true : false;
71
+ }
74
72
  if (!menuHasFocus && expanded) {
75
73
  toggleMenu(e);
76
74
  }
@@ -79,52 +77,51 @@
79
77
 
80
78
  /**
81
79
  * Toggle the mega menu open/closed
82
- *
80
+ *
83
81
  * @memberof module:megaMenu
84
82
  * @instance
85
83
  * @private
86
- *
87
- * @param {Document.event} e
84
+ *
85
+ * @param {Document.event} e
88
86
  */
89
87
  function toggleMenu(e) {
90
88
  var link = e.target;
91
- var navItem = link.closest('.qld__main-nav__item');
92
- var expanded = navItem.classList.contains('expanded') ? true : false;
89
+ var navItem = link.closest(".qld__main-nav__item");
90
+ var expanded = navItem.classList.contains("expanded") ? true : false;
93
91
 
94
92
  if (!expanded) {
95
- navItem.classList.add('expanded');
96
- setTimeout(function() {
97
- document.addEventListener('click', handleBackgroundClick);
93
+ navItem.classList.add("expanded");
94
+ setTimeout(function () {
95
+ document.addEventListener("click", handleBackgroundClick);
98
96
  }, 30);
99
97
  } else {
100
- navItem.classList.remove('expanded');
101
- document.removeEventListener('click', handleBackgroundClick);
98
+ navItem.classList.remove("expanded");
99
+ document.removeEventListener("click", handleBackgroundClick);
102
100
  }
103
101
  }
104
102
 
105
103
  /**
106
104
  * Close the mega menu if the user clicks outside of it while opened
107
- *
105
+ *
108
106
  * @memberof module:megaMenu
109
107
  * @instance
110
108
  * @private
111
- *
112
- * @param {Document.event} e
109
+ *
110
+ * @param {Document.event} e
113
111
  */
114
112
  function handleBackgroundClick(e) {
115
113
  var target = e.target;
116
- var nav = document.querySelector('.qld__main-nav__menu-inner');
114
+ var nav = document.querySelector(".qld__main-nav__menu-inner");
117
115
 
118
116
  // If clicked outside nav
119
117
  if (!nav.contains(target)) {
120
-
121
118
  // Close any expanded menu(s)
122
- document.querySelectorAll('.qld__main-nav__item.expanded').forEach(function(item) {
123
- item.classList.remove('expanded');
119
+ document.querySelectorAll(".qld__main-nav__item.expanded").forEach(function (item) {
120
+ item.classList.remove("expanded");
124
121
  });
125
122
 
126
123
  // Remove listener
127
- document.removeEventListener('click', handleBackgroundClick);
124
+ document.removeEventListener("click", handleBackgroundClick);
128
125
  }
129
126
  }
130
127
 
@@ -133,38 +130,36 @@
133
130
  * Close the menu on press of ESCAPE or UP
134
131
  * After TAB press, check if focus is still within menu,
135
132
  * and close if it's not
136
- *
133
+ *
137
134
  * @memberof module:megaMenu
138
135
  * @instance
139
136
  * @private
140
- *
141
- * @param {Document.event} e
137
+ *
138
+ * @param {Document.event} e
142
139
  */
143
140
  function handleMenuKeypress(e) {
144
141
  var link = e.target;
145
142
  var key = e.keyCode;
146
- var navItem = link.closest('.qld__main-nav__item');
147
- var menu = link.closest('.qld__main-nav__menu-sub');
143
+ var navItem = link.closest(".qld__main-nav__item");
144
+ var menu = link.closest(".qld__main-nav__menu-sub");
148
145
 
149
146
  // ESC or UP ARROW
150
147
  if (key === 27 || key == 38) {
151
- navItem.querySelector('.qld__main-nav__item-title > a').focus();
148
+ navItem.querySelector(".qld__main-nav__item-title > a").focus();
152
149
  }
153
150
 
154
151
  // If TAB key is pressed only (not SHIFT + TAB)
155
152
  if (key === 9 && !e.shiftKey) {
156
- setTimeout(function() {
153
+ setTimeout(function () {
157
154
  var menuHasFocus = menu.contains(document.activeElement) ? true : false;
158
155
  if (!menuHasFocus) {
159
156
  toggleMenu(e);
160
157
  }
161
158
  }, 20);
162
159
  }
163
-
164
160
  }
165
161
 
166
- window.addEventListener('DOMContentLoaded', function () {
162
+ window.addEventListener("DOMContentLoaded", function () {
167
163
  megaMenu.init();
168
164
  });
169
-
170
- }());
165
+ })();
@@ -2,230 +2,192 @@
2
2
  // Page alerts
3
3
  //--------------------------------------------------------------------------------------------------------------------------------------------------------------
4
4
  .qld__page-alerts {
5
- @include QLD-space( padding, 1unit );
6
- @include QLD-fontgrid( sm );
7
- position: relative;
8
- border: solid $QLD-border-width-default $QLD-color-status__info;
9
- @include QLD-space( border-left-width, 3unit );
10
- border-radius: $QLD-border-radius-xs;
11
- word-wrap: break-word;
12
- background-color: $QLD-color-neutral--white;
13
- max-width: 48rem;
14
-
15
- &.qld__page-alerts--svg {
16
- .qld__page-alerts--heading {
17
- @include QLD-space( margin-top, 0unit );
18
- }
19
- .qld__page-alerts__icon {
20
- position: absolute;
21
- @include QLD-space( left, -1.5unit );
22
- top: 50%;
23
- transform: translate(-50%, -50%);
24
- vertical-align: text-top;
25
- }
26
-
27
- .qld__icon {
28
- color: $QLD-color-neutral--white;
29
- }
30
-
31
- /**
5
+ @include QLD-space(padding, 1unit);
6
+ @include QLD-fontgrid(sm);
7
+ position: relative;
8
+ border: solid $QLD-border-width-default $QLD-color-status__info;
9
+ @include QLD-space(border-left-width, 3unit);
10
+ border-radius: $QLD-border-radius-xs;
11
+ word-wrap: break-word;
12
+ background-color: $QLD-color-neutral--white;
13
+ max-width: 48rem;
14
+
15
+ &.qld__page-alerts--svg {
16
+ .qld__page-alerts--heading {
17
+ @include QLD-space(margin-top, 0unit);
18
+ }
19
+ .qld__page-alerts__icon {
20
+ position: absolute;
21
+ @include QLD-space(left, -1.5unit);
22
+ top: 50%;
23
+ transform: translate(-50%, -50%);
24
+ vertical-align: text-top;
25
+ }
26
+
27
+ .qld__icon {
28
+ color: $QLD-color-neutral--white;
29
+ }
30
+
31
+ /**
32
32
  * Page alert success
33
33
  */
34
- &.qld__page-alerts--success {
35
- border-color: $QLD-color-status__success;
34
+ &.qld__page-alerts--success {
35
+ border-color: $QLD-color-status__success;
36
36
 
37
- .qld__icon {
38
- color: $QLD-color-neutral--white;
39
- }
40
- }
37
+ .qld__icon {
38
+ color: $QLD-color-neutral--white;
39
+ }
40
+ }
41
41
 
42
- /**
42
+ /**
43
43
  * Page alert warning.
44
44
  */
45
- &.qld__page-alerts--warning {
46
- border-color: $QLD-color-status__caution;
45
+ &.qld__page-alerts--warning {
46
+ border-color: $QLD-color-status__caution;
47
47
 
48
- .qld__icon {
49
- color: $QLD-color-neutral--black;
50
- }
51
- }
48
+ .qld__icon {
49
+ color: $QLD-color-neutral--black;
50
+ }
51
+ }
52
52
 
53
- /**
53
+ /**
54
54
  * Page alert error.
55
55
  */
56
- &.qld__page-alerts--error {
57
- border-color: $QLD-color-status__error;
58
-
59
- .qld__icon {
60
- color: $QLD-color-neutral--white;
61
- }
62
- }
63
- }
64
-
65
- & .qld__page-alerts--heading.qld__display-lg {
66
- color: var(--QLD-color-light__heading);
67
- @include QLD-space(margin-bottom, 1unit);
68
- line-height: 2.25rem;
69
- }
70
-
71
- & a{
72
- color: var(--QLD-color-light__link);
73
- @include QLD-underline('light');
74
- }
75
-
76
-
77
-
78
- /**
56
+ &.qld__page-alerts--error {
57
+ border-color: $QLD-color-status__error;
58
+
59
+ .qld__icon {
60
+ color: $QLD-color-neutral--white;
61
+ }
62
+ }
63
+ }
64
+
65
+ & .qld__page-alerts--heading.qld__display-lg {
66
+ color: var(--QLD-color-light__heading);
67
+ @include QLD-space(margin-bottom, 1unit);
68
+ line-height: 2.25rem;
69
+ }
70
+
71
+ & a {
72
+ color: var(--QLD-color-light__link);
73
+ @include QLD-underline("light");
74
+ }
75
+
76
+ /**
79
77
  * Page alert warning.
80
78
  */
81
- &.qld__page-alerts--warning {
82
- border-color: $QLD-color-status__caution;
79
+ &.qld__page-alerts--warning {
80
+ border-color: $QLD-color-status__caution;
81
+ }
83
82
 
84
- &::before{
85
- background-color: $QLD-color-neutral--black;
86
- mask-image: QLD-svguri($QLD-icon-warning);
87
- }
88
- }
89
-
90
- /**
83
+ /**
91
84
  * Page alert error.
92
85
  */
93
- &.qld__page-alerts--error {
94
- border-color: $QLD-color-status__error;
95
-
96
- &::before{
97
- background-color: $QLD-color-neutral--white;
98
- mask-image: QLD-svguri($QLD-icon-error);
99
- }
100
- }
101
-
102
- // // dark and dark alt
103
- .qld__body--dark &,
104
- .qld__body--dark-alt &{
105
- color: var(--QLD-color-light__text);
106
-
107
- h3{
108
- color: var(--QLD-color-light__heading);
109
- }
110
-
111
- & a{
112
- color: var(--QLD-color-light__link);
113
- @include QLD-underline('light');
114
- &:hover{
115
- color: var(--QLD-color-light__link);
116
- }
117
- }
118
- }
86
+ &.qld__page-alerts--error {
87
+ border-color: $QLD-color-status__error;
88
+ }
89
+
90
+ // dark and dark alt
91
+ .qld__body--dark &,
92
+ .qld__body--dark-alt & {
93
+ color: var(--QLD-color-light__text);
94
+
95
+ h3 {
96
+ color: var(--QLD-color-light__heading);
97
+ }
98
+
99
+ & a {
100
+ color: var(--QLD-color-light__link);
101
+ @include QLD-underline("light");
102
+ &:hover {
103
+ color: var(--QLD-color-light__link);
104
+ }
105
+ }
106
+ }
119
107
  }
120
108
 
121
109
  /**
122
110
  * This section can be removed in the future once all WYSIWYG codes are updated to use SVG instead of pseudo.
123
111
  */
124
112
  .qld__page-alerts:not(.qld__page-alerts--svg) {
125
- &::before{
126
- content: ' ';
127
- @include QLD-space( width, 1.25unit );
128
- @include QLD-space( height, 1.25unit );
129
- display: inline-block;
130
- vertical-align: text-top;
131
- mask-image: QLD-svguri($QLD-icon-info);
132
- mask-repeat: no-repeat;
133
- mask-position: center;
134
- background-color: $QLD-color-neutral--white;
135
- position: absolute;
136
- @include QLD-space( left, -1.5unit );
137
- top: 50%;
138
- transform: translate(-50%, -50%);
139
- }
140
-
141
- /**
113
+ &::before {
114
+ content: " ";
115
+ @include QLD-space(width, 1.25unit);
116
+ @include QLD-space(height, 1.25unit);
117
+ display: inline-block;
118
+ vertical-align: text-top;
119
+ mask-image: QLD-svguri($QLD-icon-info);
120
+ mask-repeat: no-repeat;
121
+ mask-position: center;
122
+ background-color: $QLD-color-neutral--white;
123
+ position: absolute;
124
+ @include QLD-space(left, -1.5unit);
125
+ top: 50%;
126
+ transform: translate(-50%, -50%);
127
+ }
128
+
129
+ /**
142
130
  * Page alert success
143
131
  */
144
- &.qld__page-alerts--success {
145
- border-color: $QLD-color-status__success;
132
+ &.qld__page-alerts--success {
133
+ border-color: $QLD-color-status__success;
146
134
 
147
- &::before{
148
- background-color: $QLD-color-neutral--white;
149
- mask-image: QLD-svguri($QLD-icon-success);
150
- }
151
- }
135
+ &::before {
136
+ background-color: $QLD-color-neutral--white;
137
+ mask-image: QLD-svguri($QLD-icon-success);
138
+ }
139
+ }
152
140
 
153
- /**
141
+ /**
154
142
  * Page alert warning.
155
143
  */
156
- &.qld__page-alerts--warning {
157
- border-color: $QLD-color-status__caution;
144
+ &.qld__page-alerts--warning {
145
+ border-color: $QLD-color-status__caution;
158
146
 
159
- &::before{
160
- background-color: $QLD-color-neutral--black;
161
- mask-image: QLD-svguri($QLD-icon-warning);
162
- }
163
- }
147
+ &::before {
148
+ background-color: $QLD-color-neutral--black;
149
+ mask-image: QLD-svguri($QLD-icon-warning);
150
+ }
151
+ }
164
152
 
165
- /**
153
+ /**
166
154
  * Page alert error.
167
155
  */
168
- &.qld__page-alerts--error {
169
- border-color: $QLD-color-status__error;
170
-
171
- &::before{
172
- background-color: $QLD-color-neutral--white;
173
- mask-image: QLD-svguri($QLD-icon-error);
174
- }
175
- }
156
+ &.qld__page-alerts--error {
157
+ border-color: $QLD-color-status__error;
158
+
159
+ &::before {
160
+ background-color: $QLD-color-neutral--white;
161
+ mask-image: QLD-svguri($QLD-icon-error);
162
+ }
163
+ }
176
164
  }
177
165
 
178
166
  /**
179
167
  * Remove up to here
180
168
  */
181
169
 
182
-
183
- .qld__body #content > * + .qld__page-alerts {
184
- @include QLD-space( margin-top, 2unit );
170
+ .qld__body #content > * + .qld__page-alerts {
171
+ @include QLD-space(margin-top, 2unit);
185
172
  }
186
173
 
187
-
188
174
  /**
189
175
  * Screen-reader only class for interlinking error messages and corresponding form elements.
190
176
  */
191
177
  .qld__page-alerts__sronly {
192
- @include QLD-sronly;
178
+ @include QLD-sronly;
193
179
  }
194
180
 
195
-
196
181
  // Print styles
197
182
  @media print {
198
- .qld__page-alerts {
199
- border-color: #000 !important;
200
- background-color: #fff !important;
201
- border-left: 2px solid #000 !important;
202
- padding-top: 3em !important;
203
-
204
- &:after {
205
- background: none !important;
206
- content: 'info' !important;
207
- top: 1em !important;
208
- left: 0 !important;
209
- font-size: 12px !important;
210
- border-right: 1px solid #000 !important;
211
- border-bottom: 1px solid #000 !important;
212
- padding: 0.5em !important;
213
- width: auto !important;
214
- }
215
- }
216
-
217
- .qld__page-alerts--success:after {
218
- content: 'success' !important;
219
- }
220
-
221
- .qld__page-alerts--warning:after {
222
- content: 'warning' !important;
223
- }
224
-
225
- .qld__page-alerts--error:after {
226
- content: 'error' !important;
227
- }
228
- .qld__page-alerts__icon {
229
- display: none;
230
- }
183
+ .qld__page-alerts {
184
+ border-color: #000 !important;
185
+ background-color: #fff !important;
186
+ border-left: 2px solid #000 !important;
187
+ padding-top: 3em !important;
188
+ }
189
+
190
+ .qld__page-alerts__icon {
191
+ display: none;
192
+ }
231
193
  }
@@ -619,7 +619,7 @@
619
619
  "use_default": true
620
620
  },
621
621
  "mainNavCtaOneIcon": {
622
- "value": "fa-light fa-atom",
622
+ "value": "extended_health_alert",
623
623
  "fieldid": "72410",
624
624
  "type": "metadata_field_text",
625
625
  "is_contextable": true,
@@ -643,7 +643,7 @@
643
643
  "use_default": true
644
644
  },
645
645
  "mainNavCtaTwoIcon": {
646
- "value": "fa-light fa-avocado",
646
+ "value": "speech",
647
647
  "fieldid": "72410",
648
648
  "type": "metadata_field_text",
649
649
  "is_contextable": true,
@@ -755,7 +755,7 @@
755
755
  "use_default": true
756
756
  },
757
757
  "footerCTAContactIcon": {
758
- "value": "",
758
+ "value": "email",
759
759
  "fieldid": "72414",
760
760
  "type": "metadata_field_text",
761
761
  "is_contextable": true,