@qhealth-design-system/core 1.7.5 → 1.8.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/CHANGELOG.md CHANGED
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 1.8.0 - 2024-08-13
11
+
10
12
  ## 1.7.5 - 2024-07-03
11
13
 
12
14
  ## 1.7.4 - 2024-06-26
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qhealth-design-system/core",
3
- "version": "1.7.5",
3
+ "version": "1.8.0",
4
4
  "description": "",
5
5
  "licence": "MIT",
6
6
  "main": "index.js",
@@ -302,23 +302,18 @@ form {
302
302
  }
303
303
  //-----END:Reduce padding top if the following section has the same background----
304
304
  }
305
- &.content {
306
- .qld__body--breadcrumb {
307
- @include QLD-space(padding-bottom, 3unit);
308
- }
309
-
310
- }
305
+
311
306
  .qld__body--breadcrumb {
312
307
  @include QLD-space(padding-top, 1unit);
313
- @include QLD-space(padding-bottom, 1.5unit);
308
+ @include QLD-space(padding-bottom, 1unit);
314
309
  @include QLD-media(md) {
315
- @include QLD-space(padding-top, 2.5unit);
310
+ @include QLD-space(padding-top, 1.5unit);
311
+ @include QLD-space(padding-bottom, 1.5unit);
316
312
  }
317
313
  @include QLD-media(lg) {
318
- @include QLD-space(padding-top, 3unit);
314
+ @include QLD-space(padding-top, 2unit);
319
315
  @include QLD-space(padding-bottom, 2unit);
320
316
  }
321
-
322
317
  }
323
318
  }
324
319
 
@@ -27,7 +27,7 @@ input[type='checkbox'],
27
27
  position: absolute;
28
28
  box-sizing: border-box;
29
29
  background-repeat: no-repeat;
30
- z-index: 100;
30
+ z-index: 9;
31
31
  @include QLD-space(left, 0unit);
32
32
  border: $QLD-border-width-default solid transparent;
33
33
  top: 0;
@@ -37,4 +37,47 @@ body {
37
37
  body {
38
38
  z-index: 3;
39
39
  }
40
- }
40
+ }
41
+
42
+
43
+ /*
44
+ Written to address squiz forms' error state issues
45
+ */
46
+
47
+ div.sq-form-question-tickbox-list.sq-form-question-error {
48
+ fieldset {
49
+ label::before {
50
+ box-shadow: 0 0 0 3px $QLD-color-status__error;
51
+ }
52
+ }
53
+ }
54
+
55
+ div.sq-form-question-option-list.sq-form-question-error {
56
+ fieldset {
57
+ label::before {
58
+ box-shadow: 0 0 0 3px $QLD-color-status__error;
59
+ }
60
+ }
61
+ }
62
+
63
+ div.sq-form-question-error {
64
+ input[type=text]:not(:focus),
65
+ input[type=email]:not(:focus),
66
+ input[type=date]:not(:focus),
67
+ textarea:not(:focus),
68
+ select:not(:focus) {
69
+ border-color: $QLD-color-status__error;
70
+ background-color: $QLD-color-status__error--lightest;
71
+ }
72
+ }
73
+
74
+ .qld__body--dark, .qld__body--dark-alt {
75
+ .sq-form-error {
76
+ color: $QLD-color-status__error--lightest;
77
+ }
78
+ }
79
+
80
+ .sq-form-error {
81
+ color: $QLD-color-status__error;
82
+ margin-top: 0.5rem !important;
83
+ }
@@ -200,7 +200,7 @@
200
200
  @include QLD-space(margin-top, 2unit);
201
201
 
202
202
  @include QLD-media(lg) {
203
- @include QLD-space(margin-top, 2.5unit);
203
+ @include QLD-space(margin-top, 3unit);
204
204
  }
205
205
  }
206
206
 
@@ -152,6 +152,11 @@
152
152
  &::after{
153
153
  background-color: var(--QLD-color-dark__action--secondary-hover);
154
154
  }
155
+
156
+ a{
157
+ @include QLD-underline('dark','noUnderline');
158
+ color: var(--QLD-color-dark__link);
159
+ }
155
160
  }
156
161
 
157
162
  &::after{
@@ -183,6 +188,11 @@
183
188
  &::after{
184
189
  background-color: var(--QLD-color-dark__action--secondary-hover);
185
190
  }
191
+
192
+ a{
193
+ @include QLD-underline('dark','noUnderline');
194
+ color: var(--QLD-color-dark__link);
195
+ }
186
196
  }
187
197
 
188
198
  &::after{
@@ -197,6 +197,19 @@
197
197
  if (typeof callbacks.afterOpen === "function") {
198
198
  callbacks.afterOpen();
199
199
  }
200
+
201
+ if(target.classList.contains('qld__overflow_menu')) {
202
+
203
+ var overFlowLinks = [];
204
+ overFlowLinks = target.querySelectorAll('a.qld__overflow_menu_list-item-link');
205
+
206
+ if(overFlowLinks[0]) {
207
+ setTimeout(function() {
208
+ overFlowLinks[0].focus();
209
+ }, 10);
210
+ }
211
+
212
+ }
200
213
  }
201
214
 
202
215
  toggleClasses(target, state);
@@ -217,7 +230,7 @@
217
230
 
218
231
  if (state === "open" || state === "opening") {
219
232
  //if it is a mega nav add an event listener to close it when document is clicked
220
- if (this.element.classList.contains("qld__main-nav__menu-sub")) {
233
+ if (this.element.classList.contains("qld__main-nav__menu-sub") || this.element.classList.contains("qld__overflow_menu")) {
221
234
  document.addEventListener(
222
235
  "click",
223
236
  toggleNavOnDocumentClick,
@@ -225,7 +238,7 @@
225
238
  )
226
239
  }
227
240
  } else {
228
- if (this.element.classList.contains("qld__main-nav__menu-sub")) {
241
+ if (this.element.classList.contains("qld__main-nav__menu-sub") || this.element.classList.contains("qld__overflow_menu")) {
229
242
  document.removeEventListener(
230
243
  "click",
231
244
  toggleNavOnDocumentClick,
@@ -419,21 +432,31 @@
419
432
  *
420
433
  * @memberof module:accordion
421
434
  */
422
- accordion.init = function() {
435
+ accordion.init = function(element) {
423
436
 
424
- var accordionButtons = document.querySelectorAll('.qld__accordion__title');
425
- accordionButtons.forEach(function (button) {
426
- button.addEventListener('click', function () {
427
- accordion.Toggle(button)
437
+ if(element == 'overflow') {
438
+ var overflowMenuButtons = document.querySelectorAll('.qld__overflow_menu__btn');
439
+ overflowMenuButtons.forEach(function (button) {
440
+ button.addEventListener('click', function () {
441
+ accordion.Toggle(button)
442
+ });
428
443
  });
429
- });
430
-
431
- var accordionAllButtton = document.querySelectorAll('.qld__accordion__toggle-btn');
432
- accordionAllButtton.forEach(function (button) {
433
- button.addEventListener('click', function () {
434
- accordion.ToggleAll(button)
444
+ } else {
445
+ var accordionButtons = document.querySelectorAll('.qld__accordion__title');
446
+ accordionButtons.forEach(function (button) {
447
+ button.addEventListener('click', function () {
448
+ accordion.Toggle(button)
449
+ });
450
+ });
451
+
452
+ var accordionAllButtton = document.querySelectorAll('.qld__accordion__toggle-btn');
453
+ accordionAllButtton.forEach(function (button) {
454
+ button.addEventListener('click', function () {
455
+ accordion.ToggleAll(button)
456
+ });
435
457
  });
436
- });
458
+ }
459
+
437
460
  }
438
461
 
439
462
  // Make accordion public
@@ -10,12 +10,18 @@
10
10
  }
11
11
 
12
12
  @include QLD-media(sm) {
13
- display: inline-block;
13
+ display: flex;
14
+ flex-direction: row;
15
+ flex-wrap: wrap;
16
+ align-items: center;
14
17
  }
15
18
  & &__list--desktop{
16
19
  display: none;
17
20
  @include QLD-media(md) {
18
- display: inline-block;
21
+ display: flex;
22
+ flex-direction: row;
23
+ flex-wrap: wrap;
24
+ align-items: center;
19
25
  }
20
26
  }
21
27
  & &__list--mobile{
@@ -23,7 +29,17 @@
23
29
  display: none;
24
30
  }
25
31
  }
26
-
32
+ .qld__link-list.qld__link-list--inline:not(.qld__breadcrumbs .qld__breadcrumbs__list--mobile, .qld__banner__breadcrumbs--mobile ul) {
33
+ display: none;
34
+ @include QLD-media(md) {
35
+ display: flex;
36
+ flex-direction: row;
37
+ flex-wrap: nowrap;
38
+ align-items: center;
39
+ align-content: center;
40
+ }
41
+ }
42
+
27
43
  > .qld__link-list {
28
44
  margin: 0;
29
45
  padding: 0;
@@ -33,6 +49,15 @@
33
49
  @include QLD-media(lg) {
34
50
  @include QLD-fontgrid(sm);
35
51
  }
52
+
53
+ .qld__overflow_menu--breadcrumbs {
54
+ display: flex;
55
+ align-items: center;
56
+ padding: none;
57
+ }
58
+ .qld__overflow_menu_wrapper {
59
+ display: inline;
60
+ }
36
61
 
37
62
  > li {
38
63
  margin: 0; //Intentionally flush with the container, as breadcrumbs are designed to sit on a full viewport width bg.
@@ -66,9 +91,27 @@
66
91
  background-color: var(--QLD-color-light__action--secondary);
67
92
  }
68
93
 
69
- &:last-child:after {
70
- display: none;
94
+ &:last-child {
95
+ display: flex;
96
+ flex-grow: 1;
97
+ overflow: hidden;
98
+ white-space: wrap;
99
+ text-overflow: ellipsis;
100
+ flex: 1 1 auto;
101
+ flex-shrink: 3;
102
+
103
+ &:after {
104
+ display: none;
105
+ }
106
+
107
+ @include QLD-media(md) {
108
+
109
+ white-space: nowrap;
110
+ }
111
+
71
112
  }
113
+
114
+
72
115
 
73
116
  .ie8 &,
74
117
  .lt-ie8 & {
@@ -146,6 +189,8 @@
146
189
  display: inline-block;
147
190
 
148
191
  > .qld__link-list > li {
192
+
193
+ flex: 0 0 auto;
149
194
 
150
195
  // Hide current page
151
196
  &:last-child {
@@ -0,0 +1,234 @@
1
+ (function () {
2
+ "use strict";
3
+
4
+ /**
5
+ * @module breadcrumb
6
+ */
7
+
8
+ var breadcrumb = {};
9
+ var originalBreadCrumbUl = null;
10
+
11
+ function getTheElements(resized = false) {
12
+ // const banner =
13
+ // document.querySelector(".qld__banner--breadcrumbs") ||
14
+ // document.querySelector(".qld__body--breadcrumb");
15
+
16
+ // if (document) {
17
+ const bannerBreadCrumbsAll = document.querySelectorAll(
18
+ "nav.qld__banner__breadcrumbs--desktop"
19
+ );
20
+
21
+ const bodyBreadCrumbsAll = document.querySelectorAll(
22
+ 'section.qld__body--breadcrumb nav.qld__breadcrumbs'
23
+ );
24
+
25
+ const bannerBreadCrumbArray = [...bannerBreadCrumbsAll, ...bodyBreadCrumbsAll];
26
+ const bannerBreadCrumb = bannerBreadCrumbArray.find(
27
+ (breadcrumb) => {
28
+ return breadcrumb.offsetWidth > 0;
29
+ }
30
+ );
31
+
32
+ if(bannerBreadCrumb) {
33
+ const containerFluid = bannerBreadCrumb.closest('.container-fluid');
34
+
35
+ const containerFluidStyle = window.getComputedStyle(containerFluid);
36
+
37
+ const paddings = parseFloat(containerFluidStyle.getPropertyValue('padding-right').replace(/\D/g, '')) + parseFloat(containerFluidStyle.getPropertyValue('padding-left').replace(/\D/g, ''));
38
+ bannerBreadCrumb.style.maxWidth = (containerFluid.offsetWidth - paddings) + 'px';
39
+
40
+ // console.log('here is the containerFluid.offsetWidth ', paddings , ' here is the containerFluid.offsetWidth ', bannerBreadCrumb)
41
+
42
+ if(!originalBreadCrumbUl) {
43
+ originalBreadCrumbUl = bannerBreadCrumb.querySelector("ul.qld__link-list").cloneNode(true);
44
+ }
45
+
46
+ if(resized) {
47
+ bannerBreadCrumb.querySelector("ul.qld__link-list").innerHTML = originalBreadCrumbUl.innerHTML;
48
+ }
49
+
50
+ const breadCrumbsUl = bannerBreadCrumb.querySelector("ul.qld__link-list");
51
+
52
+ return {
53
+ bannerBreadCrumb,
54
+ breadCrumbsUl,
55
+ };
56
+ }
57
+
58
+
59
+ // }
60
+
61
+ // return null;
62
+ }
63
+
64
+ function createOverFlow() {
65
+ //create the over flow menu here:
66
+
67
+ //start wrapper
68
+ const overFlowWrapper = document.createElement("div");
69
+ overFlowWrapper.className = "qld__overflow_menu_wrapper";
70
+ //end wrapper
71
+
72
+ //start overflow button
73
+ const button = document.createElement("button");
74
+ button.className =
75
+ "qld__btn qld__btn--toggle qld__overflow_menu__btn qld__accordion--closed";
76
+ button.setAttribute("href", "#");
77
+ button.setAttribute("aria-controls", "overflow-menu--");
78
+ button.setAttribute("aria-expanded", "false");
79
+
80
+ const svg = document.createElementNS(
81
+ "http://www.w3.org/2000/svg",
82
+ "svg"
83
+ );
84
+ svg.classList.add("qld__icon");
85
+ svg.classList.add("qld__icon--lg");
86
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
87
+ svg.setAttribute("viewBox", "0 0 448 512");
88
+ svg.setAttribute("aria-hidden", "true");
89
+ svg.setAttribute("focusable", "false");
90
+ svg.setAttribute("width", "24");
91
+ svg.setAttribute("height", "32");
92
+ svg.setAttribute("role", "img");
93
+
94
+ const path = document.createElementNS(
95
+ "http://www.w3.org/2000/svg",
96
+ "path"
97
+ );
98
+ path.setAttribute("fill", "currentColor");
99
+ path.setAttribute(
100
+ "d",
101
+ "M352 256C352 238.3 366.3 224 384 224C401.7 224 416 238.3 416 256C416 273.7 401.7 288 384 288C366.3 288 352 273.7 352 256zM192 256C192 238.3 206.3 224 224 224C241.7 224 256 238.3 256 256C256 273.7 241.7 288 224 288C206.3 288 192 273.7 192 256zM96 256C96 273.7 81.67 288 64 288C46.33 288 32 273.7 32 256C32 238.3 46.33 224 64 224C81.67 224 96 238.3 96 256z"
102
+ );
103
+
104
+ svg.appendChild(path);
105
+ button.appendChild(svg);
106
+ //end overflow button
107
+
108
+ overFlowWrapper.appendChild(button);
109
+
110
+ // Start menu element
111
+ const div = document.createElement("div");
112
+ div.className = "qld__overflow_menu qld__accordion--closed";
113
+ div.setAttribute("id", "overflow-menu--");
114
+
115
+ const ul = document.createElement("ul");
116
+ ul.className = "qld__overflow_menu_list";
117
+ ul.setAttribute("aria-label", "qld__overflow_menu qld__link-columns");
118
+
119
+ div.appendChild(ul);
120
+ //end menu
121
+
122
+ overFlowWrapper.appendChild(div);
123
+
124
+ //This menu does not have the uls , uls are going to be created in insertfunction
125
+
126
+ return overFlowWrapper;
127
+ }
128
+
129
+ function insertOverFlowButton(overFlowWrapper, element) {
130
+ const newElement = document.createElement("div");
131
+ newElement.className = "qld__overflow_menu_list-item";
132
+
133
+ const link = element.querySelector("a");
134
+ link.classList.add("qld__overflow_menu_list-item-link");
135
+ link.setAttribute("tabindex", "0");
136
+
137
+ newElement.appendChild(link);
138
+
139
+ const ul = overFlowWrapper.querySelector("ul");
140
+
141
+ ul.appendChild(newElement);
142
+
143
+ return overFlowWrapper;
144
+ }
145
+
146
+ function appendOverflow( breadCrumbsUlLis, overflowMenu) {
147
+ breadCrumbsUlLis[1].innerHTML = "";
148
+ breadCrumbsUlLis[1].className = "qld__overflow_menu--breadcrumbs";
149
+ breadCrumbsUlLis[1].appendChild(overflowMenu);
150
+ breadCrumbsUlLis[1].style.display = "flex";
151
+ }
152
+
153
+ breadcrumb.init = function () {
154
+ if (getTheElements()) {
155
+ const { breadCrumbsUl } = getTheElements();
156
+
157
+ const breadCrumbsUlLis = breadCrumbsUl.querySelectorAll("li");
158
+ // if (breadCrumbsUl.offsetHeight > breadCrumbsUlLis[0].offsetHeight && breadCrumbsUlLis.length > 2 && breadCrumbsUlLis[0].offsetHeight > 0) {
159
+ if (breadCrumbsUlLis.length > 2 && breadCrumbsUlLis[0].offsetHeight > 0) {
160
+ const overflowMenu = createOverFlow();
161
+ let breadcrumbLisLength = breadCrumbsUlLis.length;
162
+ let i = 1;
163
+
164
+
165
+ let totalLisOffsetWidth = 0;
166
+
167
+ for (let i = 0; i < breadCrumbsUlLis.length; i++) {
168
+ totalLisOffsetWidth += breadCrumbsUlLis[i].offsetWidth;
169
+ }
170
+
171
+ if(breadCrumbsUlLis.length > 5) {
172
+
173
+ insertOverFlowButton(overflowMenu, breadCrumbsUlLis[1]);
174
+ breadCrumbsUlLis[1].style.display = "none";
175
+ appendOverflow(breadCrumbsUlLis, overflowMenu);
176
+ i = 2;
177
+
178
+ while(i < breadCrumbsUlLis.length - 2) {
179
+ insertOverFlowButton(overflowMenu, breadCrumbsUlLis[i]);
180
+ breadCrumbsUlLis[i].style.display = "none";
181
+ i++;
182
+ }
183
+
184
+ } else if((breadCrumbsUl.offsetHeight > (breadCrumbsUlLis[0].offsetHeight * 1.9))) {
185
+
186
+ insertOverFlowButton(overflowMenu, breadCrumbsUlLis[1]);
187
+ breadCrumbsUlLis[1].style.display = "none";
188
+ appendOverflow(breadCrumbsUlLis, overflowMenu);
189
+ i = 2;
190
+
191
+ while ((breadCrumbsUl.offsetHeight > (breadCrumbsUlLis[0].offsetHeight * 1.9)) &&
192
+ (i < breadcrumbLisLength - 2)
193
+ ) {
194
+
195
+ insertOverFlowButton(overflowMenu, breadCrumbsUlLis[i]);
196
+ breadCrumbsUlLis[i].style.display = "none";
197
+
198
+ i++;
199
+ }
200
+ } else if(breadCrumbsUl.offsetWidth < totalLisOffsetWidth) {
201
+
202
+ insertOverFlowButton(overflowMenu, breadCrumbsUlLis[1]);
203
+ breadCrumbsUlLis[1].style.display = "none";
204
+ appendOverflow(breadCrumbsUlLis, overflowMenu);
205
+ i = 2;
206
+
207
+ while ((breadCrumbsUl.offsetWidth < totalLisOffsetWidth) &&
208
+ (i < breadcrumbLisLength - 2)
209
+ ) {
210
+
211
+ insertOverFlowButton(overflowMenu, breadCrumbsUlLis[i]);
212
+ breadCrumbsUlLis[i].style.display = "none";
213
+
214
+ i++;
215
+ }
216
+ }
217
+ }
218
+ }
219
+ };
220
+
221
+ QLD.breadcrumb = breadcrumb;
222
+
223
+ window.addEventListener("DOMContentLoaded", function () {
224
+ QLD.breadcrumb.init();
225
+ QLD.accordion.init('overflow');
226
+ });
227
+
228
+ window.addEventListener('resize' , function() {
229
+ getTheElements(true);
230
+ QLD.breadcrumb.init();
231
+ QLD.accordion.init('overflow');
232
+ });
233
+
234
+ })();
@@ -348,6 +348,20 @@
348
348
  }
349
349
  }
350
350
  }
351
+
352
+ * + .qld__footer__logo {
353
+ img {
354
+ @include QLD-space(margin-top, map-get( $QLD-space-map, $QLD-margin__text-element--mobile ) + px);
355
+ }
356
+ }
357
+
358
+ @include QLD-media(md) {
359
+ * + .qld__footer__logo {
360
+ img {
361
+ @include QLD-space(margin-top, map-get( $QLD-space-map, $QLD-margin__text-element--desktop ) + px);
362
+ }
363
+ }
364
+ }
351
365
 
352
366
  &.qld__footer--dark,
353
367
  &.qld__footer--dark-alt{
@@ -414,7 +428,11 @@
414
428
  a.qld__footer__copyright-link {
415
429
  display: block;
416
430
  font-weight: 900;
417
- @include QLD-space(margin-top, 1.5unit);
431
+ @include QLD-space(margin-top, 1.25unit);
432
+
433
+ @include QLD-media(md) {
434
+ @include QLD-space(margin-top, 1.5unit);
435
+ }
418
436
  }
419
437
 
420
438
  .qld__footer__logo {
@@ -135,17 +135,12 @@
135
135
 
136
136
  <div class="col-xs-12 qld__footer__column">
137
137
  <div class="">
138
- {{#with (jsonParse footerMetaMetadata.value)}}
139
- {{#if footerLogo}}
140
- <a class="qld__footer__logo" href="https://www.qld.gov.au/">
141
- <img
142
- class="qld__footer__logo-image"
143
- alt="Queensland Government"
144
- src="{{urldecode (lookup footerLogo 'asset_url^urlencode')}}"
145
- />
146
- </a>
138
+
139
+ {{#if footerAcknowledgementsHeading.value}}
140
+ <h3 class="qld__footer__heading">
141
+ {{footerAcknowledgementsHeading.value}}
142
+ </h3>
147
143
  {{/if}}
148
- {{/with}}
149
144
 
150
145
  {{#if footerAcknowledgements.value}}
151
146
  <p class="qld__footer__acknowledgements">
@@ -153,6 +148,39 @@
153
148
  </p>
154
149
  {{/if}}
155
150
 
151
+ {{#with (jsonParse footerMetaMetadata.value)}}
152
+ {{#if footerLogo}}
153
+ {{#if footerCopyrightLink}}
154
+ {{#ifCond footerCopyrightLink.asset_type_code '==' 'page_redirect'}}
155
+ <a class="qld__footer__logo" href="{{urldecode (lookup footerCopyrightLink 'redirect_url^urlencode')}}">
156
+ <img
157
+ class="qld__footer__logo-image"
158
+ alt="Queensland Government"
159
+ src="{{urldecode (lookup footerLogo 'asset_url^urlencode')}}"
160
+ />
161
+ </a>
162
+ {{else}}
163
+ <a class="qld__footer__logo" href="{{urldecode (lookup footerCopyrightLink 'asset_url^urlencode')}}">
164
+ <img
165
+ class="qld__footer__logo-image"
166
+ alt="Queensland Government"
167
+ src="{{urldecode (lookup footerLogo 'asset_url^urlencode')}}"
168
+ />
169
+ </a>
170
+ {{/ifCond}}
171
+ {{else}}
172
+ <a class="qld__footer__logo" href="https://www.qld.gov.au/">
173
+ <img
174
+ class="qld__footer__logo-image"
175
+ alt="Queensland Government"
176
+ src="{{urldecode (lookup footerLogo 'asset_url^urlencode')}}"
177
+ />
178
+ </a>
179
+ {{/if}}
180
+
181
+ {{/if}}
182
+ {{/with}}
183
+
156
184
  {{#if footerCopyrightMessage.value}}
157
185
  <p class="qld__footer__copyrightMessage">
158
186
  {{footerCopyrightMessage.value}}