@qld-gov-au/qgds-bootstrap5 2.1.0 → 2.1.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/.storybook/preview.js +15 -6
- package/dist/assets/components/bs5/button/button.hbs +2 -1
- package/dist/assets/components/bs5/callToAction/callToAction.hbs +3 -3
- package/dist/assets/components/bs5/dateinput/dateinput.hbs +21 -27
- package/dist/assets/components/bs5/formcheck/formcheck.hbs +1 -1
- package/dist/assets/components/bs5/globalAlert/globalAlert.hbs +8 -1
- package/dist/assets/components/bs5/head/head.hbs +1 -1
- package/dist/assets/components/bs5/pagination/pagination.hbs +7 -2
- package/dist/assets/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
- package/dist/assets/components/bs5/searchInput/searchInput.hbs +2 -2
- package/dist/assets/components/bs5/select/select.hbs +1 -1
- package/dist/assets/components/bs5/textarea/textarea.hbs +1 -1
- package/dist/assets/components/bs5/textbox/textbox.hbs +1 -1
- package/dist/assets/css/qld.bootstrap.css +2 -2
- package/dist/assets/css/qld.bootstrap.css.map +3 -3
- package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
- package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
- package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
- package/dist/assets/js/handlebars.init.min.js +56 -49
- package/dist/assets/js/handlebars.init.min.js.map +2 -2
- package/dist/assets/js/handlebars.partials.js +56 -49
- package/dist/assets/js/handlebars.partials.js.map +2 -2
- package/dist/assets/js/qld.bootstrap.min.js +6 -6
- package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
- package/dist/assets/node/handlebars.init.min.js +21 -13
- package/dist/assets/node/handlebars.init.min.js.map +2 -2
- package/dist/components/bs5/button/button.hbs +2 -1
- package/dist/components/bs5/callToAction/callToAction.hbs +3 -3
- package/dist/components/bs5/dateinput/dateinput.hbs +21 -27
- package/dist/components/bs5/formcheck/formcheck.hbs +1 -1
- package/dist/components/bs5/globalAlert/globalAlert.hbs +8 -1
- package/dist/components/bs5/head/head.hbs +1 -1
- package/dist/components/bs5/pagination/pagination.hbs +7 -2
- package/dist/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
- package/dist/components/bs5/searchInput/searchInput.hbs +2 -2
- package/dist/components/bs5/select/select.hbs +1 -1
- package/dist/components/bs5/textarea/textarea.hbs +1 -1
- package/dist/components/bs5/textbox/textbox.hbs +1 -1
- package/dist/package.json +33 -32
- package/dist/sample-data/callToAction/callToAction.data.json +2 -1
- package/dist/sample-data/dateinput/dateinput.data.json +3 -1
- package/dist/sample-data/pagination/pagination.data.json +4 -4
- package/dist/sample-data/promotionalPanel/promotionalPanel.data.json +45 -47
- package/package.json +33 -32
- package/src/components/bs5/breadcrumbs/breadcrumbs.scss +1 -0
- package/src/components/bs5/button/button.hbs +2 -1
- package/src/components/bs5/button/button.scss +1 -0
- package/src/components/bs5/button/button.stories.js +16 -4
- package/src/components/bs5/callToAction/callToAction.data.json +2 -1
- package/src/components/bs5/callToAction/callToAction.hbs +3 -3
- package/src/components/bs5/callToAction/callToAction.stories.js +2 -2
- package/src/components/bs5/card/card.scss +2 -2
- package/src/components/bs5/dateinput/Dateinput.js +1 -38
- package/src/components/bs5/dateinput/Dateinput.mdx +27 -0
- package/src/components/bs5/dateinput/Dateinput.stories.js +48 -4
- package/src/components/bs5/dateinput/dateinput.data.json +3 -1
- package/src/components/bs5/dateinput/dateinput.functions.js +91 -0
- package/src/components/bs5/dateinput/dateinput.hbs +21 -27
- package/src/components/bs5/formcheck/formcheck.hbs +1 -1
- package/src/components/bs5/formcheck/formcheck.scss +5 -0
- package/src/components/bs5/globalAlert/globalAlert.hbs +8 -1
- package/src/components/bs5/globalAlert/globalAlert.scss +14 -19
- package/src/components/bs5/globalAlert/globalAlert.stories.js +1 -0
- package/src/components/bs5/globalAlert/globalAlert.test.js +10 -5
- package/src/components/bs5/inpageAlert/inpageAlert.scss +3 -4
- package/src/components/bs5/inpagenav/inpagenav.scss +9 -1
- package/src/components/bs5/modal/modal.scss +1 -1
- package/src/components/bs5/navbar/navbar.functions.js +39 -28
- package/src/components/bs5/navbar/navbar.scss +43 -28
- package/src/components/bs5/navbar/navbar.stories.js +4 -3
- package/src/components/bs5/pageLayout/pageLayout.stories.js +2 -0
- package/src/components/bs5/pagination/pagination.data.json +4 -4
- package/src/components/bs5/pagination/pagination.hbs +7 -2
- package/src/components/bs5/pagination/pagination.scss +1 -1
- package/src/components/bs5/promotionalPanel/promotionalPanel.data.json +45 -47
- package/src/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
- package/src/components/bs5/quickexit/quickexit.scss +1 -1
- package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +2 -2
- package/src/components/bs5/searchInput/search.functions.js +9 -5
- package/src/components/bs5/searchInput/searchInput.hbs +2 -2
- package/src/components/bs5/searchInput/searchInput.scss +1 -0
- package/src/components/bs5/select/select.hbs +1 -1
- package/src/components/bs5/sidenav/sidenav.scss +17 -19
- package/src/components/bs5/table/table.scss +93 -83
- package/src/components/bs5/textarea/textarea.hbs +1 -1
- package/src/components/bs5/textbox/textbox.hbs +1 -1
- package/src/css/main.scss +3 -0
- package/src/css/mixins/focusable.scss +1 -1
- package/src/css/qld-reduced-motion.scss +51 -0
- package/src/css/qld-tokens.scss +3 -3
- package/src/css/qld-type.scss +7 -13
- package/src/js/constants.js +10 -0
- package/src/js/qld.bootstrap.js +99 -99
- package/src/js/utils.js +3 -1
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
--#{$prefix}color-default-color-light-text-heading
|
|
52
52
|
);
|
|
53
53
|
--#{$prefix}btn-close-focus-shadow: none;
|
|
54
|
-
--#{$prefix}btn-close-focus-border: var(--#{$prefix}focus-
|
|
54
|
+
--#{$prefix}btn-close-focus-border: var(--#{$prefix}color-default-color-light-focus-default) solid 3px;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createFocusTrap } from "../../../js/utils.js";
|
|
2
|
+
import { breakpoints } from "../../../js/constants.js";
|
|
2
3
|
|
|
3
4
|
export function initializeNavbar() {
|
|
4
|
-
const
|
|
5
|
+
const navbar = document.getElementById("main-nav");
|
|
5
6
|
const overlay = document.getElementById("overlay");
|
|
6
7
|
const burgerBtn = document.getElementById("burgerBtn");
|
|
7
8
|
const burgerCloseBtn = document.getElementById("burgerCloseBtn");
|
|
@@ -25,26 +26,21 @@ export function initializeNavbar() {
|
|
|
25
26
|
let mobileFocusTrap = null;
|
|
26
27
|
const dropdownFocusTraps = new Map();
|
|
27
28
|
|
|
28
|
-
// Helper function to close navbar
|
|
29
29
|
function closeNavbar() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (mobileFocusTrap) {
|
|
38
|
-
mobileFocusTrap.deactivate();
|
|
39
|
-
mobileFocusTrap = null;
|
|
40
|
-
}
|
|
30
|
+
// Do not call static method bootstrap.Collapse.getInstance(navbar).hide()
|
|
31
|
+
// because storybook has a problem with referencing global bootstrap object in production build.
|
|
32
|
+
// Instead simulate the close button click - same thing.
|
|
33
|
+
// Do not put side effects of closing menu here (eg clearing menu focus trap), instead use "hidden.bs.collapse" or "hide.bs.collapse" event handlers declared below.
|
|
34
|
+
// Need to check if menu is actually set to show, otherwise cick will open instead.
|
|
35
|
+
if (navbar?.classList.contains("show")) {
|
|
36
|
+
burgerCloseBtn?.click();
|
|
41
37
|
}
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
// Create mobile focus trap on-demand (when mobile menu opens)
|
|
45
41
|
function createMobileFocusTrap() {
|
|
46
|
-
if (!mobileFocusTrap &&
|
|
47
|
-
mobileFocusTrap = createFocusTrap(
|
|
42
|
+
if (!mobileFocusTrap && navbar) {
|
|
43
|
+
mobileFocusTrap = createFocusTrap(navbar, {
|
|
48
44
|
returnFocusElement: burgerBtn,
|
|
49
45
|
onEscape: () => {
|
|
50
46
|
closeNavbar();
|
|
@@ -75,7 +71,7 @@ export function initializeNavbar() {
|
|
|
75
71
|
// Setup dropdown event listeners
|
|
76
72
|
function setupDropdownListeners() {
|
|
77
73
|
// Find all dropdown toggles (elements with data-bs-toggle="dropdown")
|
|
78
|
-
const dropdownToggles =
|
|
74
|
+
const dropdownToggles = navbar?.querySelectorAll(
|
|
79
75
|
'[data-bs-toggle="dropdown"]',
|
|
80
76
|
);
|
|
81
77
|
|
|
@@ -90,7 +86,7 @@ export function initializeNavbar() {
|
|
|
90
86
|
|
|
91
87
|
// Listen for dropdown show event (desktop only)
|
|
92
88
|
toggle.addEventListener("shown.bs.dropdown", () => {
|
|
93
|
-
const isMobile = window.innerWidth <
|
|
89
|
+
const isMobile = window.innerWidth < breakpoints.lg;
|
|
94
90
|
if (!isMobile) {
|
|
95
91
|
// Create and activate focus trap on-demand
|
|
96
92
|
const dropdownTrap = getOrCreateDropdownFocusTrap(dropdown, toggle);
|
|
@@ -101,7 +97,7 @@ export function initializeNavbar() {
|
|
|
101
97
|
// Listen for dropdown hide event
|
|
102
98
|
toggle.addEventListener("hidden.bs.dropdown", () => {
|
|
103
99
|
const dropdownTrap = dropdownFocusTraps.get(dropdown);
|
|
104
|
-
if (dropdownTrap && dropdownTrap.isActive
|
|
100
|
+
if (dropdownTrap && dropdownTrap.isActive) {
|
|
105
101
|
dropdownTrap.deactivate();
|
|
106
102
|
}
|
|
107
103
|
});
|
|
@@ -109,7 +105,7 @@ export function initializeNavbar() {
|
|
|
109
105
|
}
|
|
110
106
|
|
|
111
107
|
// Setup dropdown listeners on load
|
|
112
|
-
if (
|
|
108
|
+
if (navbar) {
|
|
113
109
|
setupDropdownListeners();
|
|
114
110
|
}
|
|
115
111
|
|
|
@@ -119,7 +115,7 @@ export function initializeNavbar() {
|
|
|
119
115
|
});
|
|
120
116
|
|
|
121
117
|
const resetNavbarState = () => {
|
|
122
|
-
const isMobile = window.innerWidth <
|
|
118
|
+
const isMobile = window.innerWidth < breakpoints.lg;
|
|
123
119
|
const dropdownToggles = document.querySelectorAll(
|
|
124
120
|
".navbar a.dropdown-toggle, .navbar a.no-dropdown-toggle",
|
|
125
121
|
);
|
|
@@ -138,20 +134,40 @@ export function initializeNavbar() {
|
|
|
138
134
|
toggle.setAttribute("data-bs-toggle", "dropdown");
|
|
139
135
|
}
|
|
140
136
|
});
|
|
137
|
+
|
|
138
|
+
if (!isMobile) {
|
|
139
|
+
closeNavbar();
|
|
140
|
+
}
|
|
141
141
|
};
|
|
142
142
|
|
|
143
143
|
window.addEventListener("resize", resetNavbarState);
|
|
144
144
|
resetNavbarState();
|
|
145
145
|
|
|
146
|
+
//All associated side effects of navbar collapse beginning belong here
|
|
147
|
+
navbar?.addEventListener("hide.bs.collapse", () => {
|
|
148
|
+
overlay?.classList.remove("show");
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// All associated side effects of navbar collapse completion belong here.
|
|
152
|
+
navbar?.addEventListener("hidden.bs.collapse", () => {
|
|
153
|
+
setAriaHidden(false);
|
|
154
|
+
|
|
155
|
+
// Deactivate and destroy mobile focus trap
|
|
156
|
+
if (mobileFocusTrap) {
|
|
157
|
+
mobileFocusTrap.deactivate();
|
|
158
|
+
mobileFocusTrap = null;
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
|
|
146
162
|
// Burger buttons - handle open (mobile only)
|
|
147
|
-
|
|
163
|
+
navbar?.addEventListener("shown.bs.collapse", () => {
|
|
148
164
|
// Check if navbar is opening
|
|
149
165
|
setTimeout(() => {
|
|
150
|
-
if (
|
|
166
|
+
if (navbar?.classList.contains("show")) {
|
|
151
167
|
setAriaHidden(true);
|
|
152
168
|
|
|
153
169
|
// Create and activate focus trap when navbar opens (mobile only - whole navbar)
|
|
154
|
-
const isMobile = window.innerWidth <
|
|
170
|
+
const isMobile = window.innerWidth < breakpoints.lg;
|
|
155
171
|
if (isMobile) {
|
|
156
172
|
const trap = createMobileFocusTrap();
|
|
157
173
|
trap.activate();
|
|
@@ -159,9 +175,4 @@ export function initializeNavbar() {
|
|
|
159
175
|
}
|
|
160
176
|
}, 0);
|
|
161
177
|
});
|
|
162
|
-
|
|
163
|
-
// Close button
|
|
164
|
-
burgerCloseBtn?.addEventListener("click", () => {
|
|
165
|
-
closeNavbar();
|
|
166
|
-
});
|
|
167
178
|
}
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
& > a {
|
|
54
54
|
width: calc(100% - 3rem);
|
|
55
|
-
border-start-end-radius: 1rem;
|
|
55
|
+
border-start-end-radius: 1rem;
|
|
56
56
|
}
|
|
57
57
|
&:has(.show) {
|
|
58
58
|
background-color: var(--background-color-hover);
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
.nav-link {
|
|
67
|
-
|
|
68
67
|
background-color: var(--dropdown-show-bg);
|
|
69
68
|
border-inline-start-color: var(--dropdown-show-bg);
|
|
70
69
|
}
|
|
@@ -152,7 +151,11 @@
|
|
|
152
151
|
position: absolute;
|
|
153
152
|
left: -9999px;
|
|
154
153
|
}
|
|
155
|
-
h2,
|
|
154
|
+
h2,
|
|
155
|
+
h3,
|
|
156
|
+
h4,
|
|
157
|
+
h5,
|
|
158
|
+
h6 {
|
|
156
159
|
color: var(--text-color);
|
|
157
160
|
}
|
|
158
161
|
div {
|
|
@@ -197,7 +200,7 @@
|
|
|
197
200
|
border-inline-start: 0.25rem solid var(--link-border-color-hover);
|
|
198
201
|
text-decoration: underline;
|
|
199
202
|
text-underline-offset: 0.3rem;
|
|
200
|
-
text-decoration-thickness: 0.125rem;
|
|
203
|
+
text-decoration-thickness: 0.125rem;
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
a.dropdown-item {
|
|
@@ -217,7 +220,7 @@
|
|
|
217
220
|
border-inline-start: 5px solid var(--link-border-color);
|
|
218
221
|
left: -5px;
|
|
219
222
|
top: 0;
|
|
220
|
-
bottom: calc(var(--border-width) *
|
|
223
|
+
bottom: calc(var(--border-width) * -1);
|
|
221
224
|
}
|
|
222
225
|
&:hover,
|
|
223
226
|
&.active {
|
|
@@ -226,15 +229,15 @@
|
|
|
226
229
|
margin-block-end: 0;
|
|
227
230
|
border-block-end: 0;
|
|
228
231
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
+
&::before {
|
|
233
|
+
border-inline-start: 0.25rem solid var(--link-border-color-hover);
|
|
234
|
+
}
|
|
232
235
|
}
|
|
233
236
|
&:hover {
|
|
234
237
|
.qld-icon {
|
|
235
238
|
background-color: var(--link-border-color-hover);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
238
241
|
&.dropdown-toggle {
|
|
239
242
|
&::after {
|
|
240
243
|
display: none;
|
|
@@ -312,7 +315,8 @@
|
|
|
312
315
|
height: 2rem;
|
|
313
316
|
}
|
|
314
317
|
/* colours */
|
|
315
|
-
&.dark,
|
|
318
|
+
&.dark,
|
|
319
|
+
&.dark-alt {
|
|
316
320
|
--vert-background-color: var(--#{$prefix}default-background);
|
|
317
321
|
--background-color: var(--#{$prefix}dark-background-shade);
|
|
318
322
|
--background-color-hover: var(--#{$prefix}dark-alt-background);
|
|
@@ -345,7 +349,7 @@
|
|
|
345
349
|
--header-color: var(--#{$prefix}light-text-heading);
|
|
346
350
|
--action-icon-color: var(--#{$prefix}alt-button-hover);
|
|
347
351
|
--dropdown-show-btn-bg: var(--#{$prefix}default-background);
|
|
348
|
-
--dropdown-show-btn-icon-color: var(--#{$prefix}alt-button-hover);
|
|
352
|
+
--dropdown-show-btn-icon-color: var(--#{$prefix}alt-button-hover);
|
|
349
353
|
--nav-header-color: var(--#{$prefix}dark-text-text);
|
|
350
354
|
--nav-header-border-color: var(--#{$prefix}dark-border);
|
|
351
355
|
--nav-header-icon-color: var(--#{$prefix}brand-accent);
|
|
@@ -388,7 +392,7 @@
|
|
|
388
392
|
--nav-header-icon-color: var(--#{$prefix}alt-button-hover);
|
|
389
393
|
--navbar-collapse-bg: var(--#{$prefix}default-background-shade);
|
|
390
394
|
--action-icon-color_active: var(--text-color);
|
|
391
|
-
|
|
395
|
+
|
|
392
396
|
.alt {
|
|
393
397
|
--vert-background-color: var(--#{$prefix}dark-background);
|
|
394
398
|
--background-color: var(--#{$prefix}default-background);
|
|
@@ -441,7 +445,8 @@
|
|
|
441
445
|
}
|
|
442
446
|
}
|
|
443
447
|
background-color: var(--background-color);
|
|
444
|
-
border-block-end: var(--horizontal-bar-border-width) solid
|
|
448
|
+
border-block-end: var(--horizontal-bar-border-width) solid
|
|
449
|
+
var(--link-border-color);
|
|
445
450
|
padding-block: 0;
|
|
446
451
|
button.dropdown-toggle,
|
|
447
452
|
.nav-header {
|
|
@@ -463,28 +468,33 @@
|
|
|
463
468
|
}
|
|
464
469
|
.navbar-nav a.nav-link {
|
|
465
470
|
background-color: var(--background-color);
|
|
466
|
-
border-block-end: var(--horizontal-bar-border-width) solid
|
|
471
|
+
border-block-end: var(--horizontal-bar-border-width) solid
|
|
472
|
+
var(--link-border-color);
|
|
467
473
|
margin-block-end: calc(var(--horizontal-bar-border-width) * -1);
|
|
468
474
|
&.show {
|
|
469
475
|
color: var(--link-color);
|
|
470
476
|
background-color: var(--dropdown-bg-color);
|
|
471
|
-
border-block-end: var(--horizontal-bar-border-width) solid
|
|
477
|
+
border-block-end: var(--horizontal-bar-border-width) solid
|
|
478
|
+
var(--dropdown-bg-color);
|
|
472
479
|
font-weight: 600;
|
|
473
480
|
z-index: 20;
|
|
474
481
|
&:hover {
|
|
475
482
|
background-color: var(--dropdown-bg-color);
|
|
476
|
-
border-block-end: var(--horizontal-bar-border-width) solid
|
|
483
|
+
border-block-end: var(--horizontal-bar-border-width) solid
|
|
484
|
+
var(--link-border-color-hover);
|
|
477
485
|
}
|
|
478
486
|
}
|
|
479
487
|
&.active {
|
|
480
488
|
color: var(--link-color);
|
|
481
489
|
background-color: var(--background-color);
|
|
482
|
-
border-block-end: var(--horizontal-bar-border-width) solid
|
|
490
|
+
border-block-end: var(--horizontal-bar-border-width) solid
|
|
491
|
+
var(--background-color);
|
|
483
492
|
}
|
|
484
493
|
&:hover,
|
|
485
494
|
&.active:hover {
|
|
486
495
|
background-color: var(--background-color-hover);
|
|
487
|
-
border-block-end: var(--horizontal-bar-border-width) solid
|
|
496
|
+
border-block-end: var(--horizontal-bar-border-width) solid
|
|
497
|
+
var(--link-border-color-hover);
|
|
488
498
|
}
|
|
489
499
|
.qld-icon {
|
|
490
500
|
background-color: var(--action-icon-color);
|
|
@@ -492,7 +502,7 @@
|
|
|
492
502
|
}
|
|
493
503
|
.navbar-nav a.nav-link,
|
|
494
504
|
a.dropdown-item {
|
|
495
|
-
color: var(--
|
|
505
|
+
color: var(--text-color);
|
|
496
506
|
padding-block: var(--nav-link-padding-block);
|
|
497
507
|
padding-inline: 0.75rem;
|
|
498
508
|
display: flex;
|
|
@@ -500,6 +510,7 @@
|
|
|
500
510
|
gap: 0.5rem;
|
|
501
511
|
align-items: center;
|
|
502
512
|
&:hover {
|
|
513
|
+
color: var(--link-color);
|
|
503
514
|
text-decoration: underline;
|
|
504
515
|
text-underline-offset: 0.3rem;
|
|
505
516
|
text-decoration-thickness: 0.125rem;
|
|
@@ -535,7 +546,9 @@
|
|
|
535
546
|
}
|
|
536
547
|
}
|
|
537
548
|
.dropdown-menu.show {
|
|
538
|
-
margin-block-start: calc(
|
|
549
|
+
margin-block-start: calc(
|
|
550
|
+
var(--horizontal-bar-border-width) - var(--border-width)
|
|
551
|
+
);
|
|
539
552
|
inset-inline: 0;
|
|
540
553
|
background-color: var(--dropdown-bg-color);
|
|
541
554
|
padding: 4rem;
|
|
@@ -548,7 +561,7 @@
|
|
|
548
561
|
grid-template-columns: repeat(3, 1fr);
|
|
549
562
|
column-gap: 2rem;
|
|
550
563
|
row-gap: 0;
|
|
551
|
-
z-index:
|
|
564
|
+
z-index: 999;
|
|
552
565
|
border-width: 0;
|
|
553
566
|
@include media-breakpoint-up(xl) {
|
|
554
567
|
column-gap: 4rem;
|
|
@@ -732,9 +745,9 @@
|
|
|
732
745
|
transition: max-width var(--animation-time) ease-in;
|
|
733
746
|
.navbar-collapse {
|
|
734
747
|
background-color: var(--navbar-collapse-bg);
|
|
735
|
-
}
|
|
748
|
+
}
|
|
736
749
|
a.dropdown-item {
|
|
737
|
-
font-size: .875rem;
|
|
750
|
+
font-size: 0.875rem;
|
|
738
751
|
}
|
|
739
752
|
@include repeatedVerticalStyles;
|
|
740
753
|
.nav-header .navbar-brand {
|
|
@@ -783,7 +796,7 @@
|
|
|
783
796
|
}
|
|
784
797
|
.nav-header {
|
|
785
798
|
display: flex;
|
|
786
|
-
}
|
|
799
|
+
}
|
|
787
800
|
&.collapse > .container {
|
|
788
801
|
animation-name: slideToRight;
|
|
789
802
|
animation-duration: var(--animation-time);
|
|
@@ -821,8 +834,10 @@
|
|
|
821
834
|
}
|
|
822
835
|
}
|
|
823
836
|
}
|
|
837
|
+
|
|
824
838
|
//Prevent double scrollbar when navabr is open
|
|
825
|
-
|
|
826
|
-
|
|
839
|
+
@include media-breakpoint-down("lg") {
|
|
840
|
+
body:has(.navbar.show) {
|
|
841
|
+
overflow: hidden;
|
|
842
|
+
}
|
|
827
843
|
}
|
|
828
|
-
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Navbar } from "./Navbar.js";
|
|
2
2
|
import defaultdata from "./navbar.data.json";
|
|
3
|
+
import { breakpoints } from "../../../js/constants.js";
|
|
3
4
|
|
|
4
5
|
//Default story
|
|
5
6
|
export default {
|
|
@@ -164,7 +165,7 @@ export default {
|
|
|
164
165
|
}
|
|
165
166
|
|
|
166
167
|
/* Mobile-only items - hide on desktop with unique class names */
|
|
167
|
-
@media (min-width:
|
|
168
|
+
@media (min-width: ${breakpoints.lg}px) {
|
|
168
169
|
.qgds-mobile-only,
|
|
169
170
|
.qgds-hide-desktop,
|
|
170
171
|
.navbar-nav .qgds-mobile-only,
|
|
@@ -504,7 +505,7 @@ export const Default = {
|
|
|
504
505
|
justify-content: flex-end;
|
|
505
506
|
align-items: center;
|
|
506
507
|
}
|
|
507
|
-
@media (width <=
|
|
508
|
+
@media (width <= ${breakpoints.lg}px) {
|
|
508
509
|
|
|
509
510
|
#burgerBtn {
|
|
510
511
|
--nav-header-icon-color: #ffe500;
|
|
@@ -533,7 +534,7 @@ export const Default = {
|
|
|
533
534
|
background-color: var(--nav-header-icon-color, #ffe500);
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
|
-
@media (width >=
|
|
537
|
+
@media (width >= ${breakpoints.lg}px) {
|
|
537
538
|
#burgerBtn, #storybook-only-header {
|
|
538
539
|
display: none !important;
|
|
539
540
|
}
|
|
@@ -381,12 +381,14 @@ export const ContentPageWithSingleForm = {
|
|
|
381
381
|
variantClass: "btn-primary",
|
|
382
382
|
label: "Submit",
|
|
383
383
|
type: "submit",
|
|
384
|
+
islink: false,
|
|
384
385
|
},
|
|
385
386
|
{
|
|
386
387
|
...buttonData,
|
|
387
388
|
variantClass: "btn-secondary",
|
|
388
389
|
label: "Reset",
|
|
389
390
|
type: "reset",
|
|
391
|
+
islink: false,
|
|
390
392
|
},
|
|
391
393
|
],
|
|
392
394
|
},
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
|
|
14
14
|
"pages": [
|
|
15
|
-
{ "href": "#", "linktext": "1", "customClasses": "" },
|
|
16
|
-
{ "href": "#", "linktext": "2", "customClasses": "active" },
|
|
17
|
-
{ "href": "#", "linktext": "3", "customClasses": "" },
|
|
15
|
+
{ "href": "#", "linktext": "1", "arialabel": "Page 1", "customClasses": "" },
|
|
16
|
+
{ "href": "#", "linktext": "2", "arialabel": "Page 2, current page", "customClasses": "active" },
|
|
17
|
+
{ "href": "#", "linktext": "3", "arialabel": "Page 3", "customClasses": "" },
|
|
18
18
|
{ "href": "#", "linktext": "", "customClasses": "more", "more": true },
|
|
19
|
-
{ "href": "#", "linktext": "7", "customClasses": "" }
|
|
19
|
+
{ "href": "#", "linktext": "7", "arialabel": "Page 7", "customClasses": "" }
|
|
20
20
|
]
|
|
21
21
|
}
|
|
@@ -23,8 +23,13 @@ Reference: https://getbootstrap.com/docs/5.0/components/pagination/
|
|
|
23
23
|
{{! More button }}
|
|
24
24
|
<span></span>
|
|
25
25
|
{{else}}
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
{{#ifCond "active" "in" customClasses}}
|
|
27
|
+
{{! Active page - not a link }}
|
|
28
|
+
<span class="page-link" aria-current="page" aria-label="{{#if arialabel}}{{arialabel}}{{else}}Page {{linktext}}, current page{{/if}}">{{ linktext }}</span>
|
|
29
|
+
{{else}}
|
|
30
|
+
{{! Page button }}
|
|
31
|
+
<a class="page-link" href="{{href}}" aria-label="{{#if arialabel}}{{arialabel}}{{else}}Page {{linktext}}{{/if}}">{{ linktext }}</a>
|
|
32
|
+
{{/ifCond}}
|
|
28
33
|
{{/if}}
|
|
29
34
|
</li>
|
|
30
35
|
|
|
@@ -1,48 +1,46 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}
|
|
2
|
+
"type": "indent-text",
|
|
3
|
+
"variantClass": "light",
|
|
4
|
+
"promoImage": "./assets/img/banner-example-3-to-2.jpg",
|
|
5
|
+
"promoImageDescription": "Promotional image",
|
|
6
|
+
"contentAlignment": "content-left",
|
|
7
|
+
"icon": "icon-dot-grid",
|
|
8
|
+
"title": "Title goes here and has a maximum of 65 character limit",
|
|
9
|
+
"abstract": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tortor, leo vulputate ut odio mattis.",
|
|
10
|
+
"body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tortor, leo vulputate ut odio mattis. Vel suspendisse mi quisque consequat aliquet egestas.",
|
|
11
|
+
"cta": {
|
|
12
|
+
"items": [
|
|
13
|
+
{
|
|
14
|
+
"url": "#",
|
|
15
|
+
"id": "https://www.wired.com",
|
|
16
|
+
"value": "Label",
|
|
17
|
+
"target": "_blank",
|
|
18
|
+
"class": [{ "small": false }, { "view-all": false }]
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
"btn": {
|
|
23
|
+
"items": [
|
|
24
|
+
{
|
|
25
|
+
"variantClass": "btn-primary",
|
|
26
|
+
"islink": true,
|
|
27
|
+
"isdisabled": false,
|
|
28
|
+
"iconClass": "",
|
|
29
|
+
"iconPosition": "",
|
|
30
|
+
"label": "Primary",
|
|
31
|
+
"href": "https://google.com",
|
|
32
|
+
"target": "_self"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"variantClass": "btn-secondary",
|
|
36
|
+
"islink": true,
|
|
37
|
+
"isdisabled": false,
|
|
38
|
+
"iconClass": "",
|
|
39
|
+
"iconPosition": "",
|
|
40
|
+
"label": "Secondary",
|
|
41
|
+
"href": "https://google.com",
|
|
42
|
+
"target": "_self"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
{{/ifCond}}>
|
|
6
6
|
<div class="image-panel">
|
|
7
7
|
{{#ifCond type '!=' 'promo'}}
|
|
8
|
-
<img class="promo-panel-image" src="{{promoImage}}" alt="Promotional
|
|
8
|
+
<img class="promo-panel-image" src="{{promoImage}}" alt="{{isdefined promoImageDescription "Promotional image"}}">
|
|
9
9
|
{{else}}
|
|
10
10
|
<div class="promo-panel-image"></div>
|
|
11
11
|
{{/ifCond}}
|
|
@@ -7,8 +7,8 @@ exports[`SearchInput > Renders as expected 1`] = `
|
|
|
7
7
|
<div class="qld-search-input ">
|
|
8
8
|
<input id="search" name="query" class="form-control" type="text" autocomplete="off"
|
|
9
9
|
aria-label="Search website" data-collection="qgov~sp-search" data-profile="qld" data-numranks="10" data-tiers="off" data-suggestions="https://discover.search.qld.gov.au/s/suggest.json" data-results-url="https://discover.search.qld.gov.au/s/search.json" placeholder="" />
|
|
10
|
-
<button class="btn btn-primary" type="submit" id="search-button">
|
|
11
|
-
<span class="btn-icon"></span>
|
|
10
|
+
<button class="btn btn-primary" type="submit" id="search-button" aria-label="Search">
|
|
11
|
+
<span class="btn-icon" aria-hidden="true"></span>
|
|
12
12
|
<span class="btn-label">Search</span>
|
|
13
13
|
</button>
|
|
14
14
|
|
|
@@ -31,7 +31,9 @@ export function selectDynamicSuggestion(value, form) {
|
|
|
31
31
|
const suggestions = form.querySelector(".suggestions");
|
|
32
32
|
|
|
33
33
|
if (searchInput && suggestions) {
|
|
34
|
-
|
|
34
|
+
// Assign queryValue, and cleanup string before submission
|
|
35
|
+
let queryValue = value.replace(/\s+/g, " ").trim();
|
|
36
|
+
searchInput.value = queryValue;
|
|
35
37
|
|
|
36
38
|
// Form action
|
|
37
39
|
const actionUrl = form.getAttribute("action");
|
|
@@ -41,7 +43,7 @@ export function selectDynamicSuggestion(value, form) {
|
|
|
41
43
|
|
|
42
44
|
// Construct the URL with proper parameters
|
|
43
45
|
const params = new URLSearchParams({
|
|
44
|
-
query:
|
|
46
|
+
query: queryValue,
|
|
45
47
|
collection: atts.collection || "qgov~sp-search",
|
|
46
48
|
profile: atts.profile || "qld",
|
|
47
49
|
num_ranks: atts.numRanks || "10",
|
|
@@ -143,7 +145,7 @@ export async function showSuggestions(value = "", isDefault = false, form) {
|
|
|
143
145
|
let linkItem = event.target.closest("a");
|
|
144
146
|
if (linkItem) {
|
|
145
147
|
event.preventDefault();
|
|
146
|
-
selectDynamicSuggestion(linkItem.
|
|
148
|
+
selectDynamicSuggestion(linkItem.textContent, form);
|
|
147
149
|
}
|
|
148
150
|
});
|
|
149
151
|
} else {
|
|
@@ -198,7 +200,7 @@ export async function showSuggestions(value = "", isDefault = false, form) {
|
|
|
198
200
|
let linkItem = event.target.closest("a");
|
|
199
201
|
if (linkItem) {
|
|
200
202
|
event.preventDefault();
|
|
201
|
-
selectDynamicSuggestion(linkItem.
|
|
203
|
+
selectDynamicSuggestion(linkItem.textContent, form);
|
|
202
204
|
}
|
|
203
205
|
});
|
|
204
206
|
}
|
|
@@ -217,8 +219,10 @@ export function submitSearchForm(query = "", form) {
|
|
|
217
219
|
const searchInput = form.querySelector(".qld-search-input input");
|
|
218
220
|
const atts = searchInput ? searchInput.dataset : null;
|
|
219
221
|
|
|
222
|
+
const queryValue = query.trim().replace(/\s+/g, " ");
|
|
223
|
+
|
|
220
224
|
const params = new URLSearchParams({
|
|
221
|
-
query:
|
|
225
|
+
query: queryValue,
|
|
222
226
|
collection: atts.collection || "qgov~sp-search",
|
|
223
227
|
profile: atts.profile || "qld",
|
|
224
228
|
num_ranks: atts.numRanks || "10",
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<div class="qld-search-input {{customClass}}">
|
|
5
5
|
<input id="{{ inputID }}" name="{{ inputName }}" class="form-control" type="text" autocomplete="off"
|
|
6
6
|
aria-label="{{ ariaLabel }}" {{#each tags}} data-{{@key}}="{{this}}" {{/each}} placeholder="{{placeholder}}" />
|
|
7
|
-
<button class="btn btn-primary" type="{{ buttonType }}" id="{{ buttonID }}">
|
|
8
|
-
<span class="btn-icon"></span>
|
|
7
|
+
<button class="btn btn-primary" type="{{ buttonType }}" id="{{ buttonID }}" aria-label="{{ buttonLabel }}">
|
|
8
|
+
<span class="btn-icon" aria-hidden="true"></span>
|
|
9
9
|
<span class="btn-label">{{ buttonLabel }}</span>
|
|
10
10
|
</button>
|
|
11
11
|
{{#ifCond hasDynamicSuggestions '||' hasDefaultSuggestions}}
|