@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.
Files changed (94) hide show
  1. package/.storybook/preview.js +15 -6
  2. package/dist/assets/components/bs5/button/button.hbs +2 -1
  3. package/dist/assets/components/bs5/callToAction/callToAction.hbs +3 -3
  4. package/dist/assets/components/bs5/dateinput/dateinput.hbs +21 -27
  5. package/dist/assets/components/bs5/formcheck/formcheck.hbs +1 -1
  6. package/dist/assets/components/bs5/globalAlert/globalAlert.hbs +8 -1
  7. package/dist/assets/components/bs5/head/head.hbs +1 -1
  8. package/dist/assets/components/bs5/pagination/pagination.hbs +7 -2
  9. package/dist/assets/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
  10. package/dist/assets/components/bs5/searchInput/searchInput.hbs +2 -2
  11. package/dist/assets/components/bs5/select/select.hbs +1 -1
  12. package/dist/assets/components/bs5/textarea/textarea.hbs +1 -1
  13. package/dist/assets/components/bs5/textbox/textbox.hbs +1 -1
  14. package/dist/assets/css/qld.bootstrap.css +2 -2
  15. package/dist/assets/css/qld.bootstrap.css.map +3 -3
  16. package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
  17. package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
  18. package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
  19. package/dist/assets/js/handlebars.init.min.js +56 -49
  20. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  21. package/dist/assets/js/handlebars.partials.js +56 -49
  22. package/dist/assets/js/handlebars.partials.js.map +2 -2
  23. package/dist/assets/js/qld.bootstrap.min.js +6 -6
  24. package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
  25. package/dist/assets/node/handlebars.init.min.js +21 -13
  26. package/dist/assets/node/handlebars.init.min.js.map +2 -2
  27. package/dist/components/bs5/button/button.hbs +2 -1
  28. package/dist/components/bs5/callToAction/callToAction.hbs +3 -3
  29. package/dist/components/bs5/dateinput/dateinput.hbs +21 -27
  30. package/dist/components/bs5/formcheck/formcheck.hbs +1 -1
  31. package/dist/components/bs5/globalAlert/globalAlert.hbs +8 -1
  32. package/dist/components/bs5/head/head.hbs +1 -1
  33. package/dist/components/bs5/pagination/pagination.hbs +7 -2
  34. package/dist/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
  35. package/dist/components/bs5/searchInput/searchInput.hbs +2 -2
  36. package/dist/components/bs5/select/select.hbs +1 -1
  37. package/dist/components/bs5/textarea/textarea.hbs +1 -1
  38. package/dist/components/bs5/textbox/textbox.hbs +1 -1
  39. package/dist/package.json +33 -32
  40. package/dist/sample-data/callToAction/callToAction.data.json +2 -1
  41. package/dist/sample-data/dateinput/dateinput.data.json +3 -1
  42. package/dist/sample-data/pagination/pagination.data.json +4 -4
  43. package/dist/sample-data/promotionalPanel/promotionalPanel.data.json +45 -47
  44. package/package.json +33 -32
  45. package/src/components/bs5/breadcrumbs/breadcrumbs.scss +1 -0
  46. package/src/components/bs5/button/button.hbs +2 -1
  47. package/src/components/bs5/button/button.scss +1 -0
  48. package/src/components/bs5/button/button.stories.js +16 -4
  49. package/src/components/bs5/callToAction/callToAction.data.json +2 -1
  50. package/src/components/bs5/callToAction/callToAction.hbs +3 -3
  51. package/src/components/bs5/callToAction/callToAction.stories.js +2 -2
  52. package/src/components/bs5/card/card.scss +2 -2
  53. package/src/components/bs5/dateinput/Dateinput.js +1 -38
  54. package/src/components/bs5/dateinput/Dateinput.mdx +27 -0
  55. package/src/components/bs5/dateinput/Dateinput.stories.js +48 -4
  56. package/src/components/bs5/dateinput/dateinput.data.json +3 -1
  57. package/src/components/bs5/dateinput/dateinput.functions.js +91 -0
  58. package/src/components/bs5/dateinput/dateinput.hbs +21 -27
  59. package/src/components/bs5/formcheck/formcheck.hbs +1 -1
  60. package/src/components/bs5/formcheck/formcheck.scss +5 -0
  61. package/src/components/bs5/globalAlert/globalAlert.hbs +8 -1
  62. package/src/components/bs5/globalAlert/globalAlert.scss +14 -19
  63. package/src/components/bs5/globalAlert/globalAlert.stories.js +1 -0
  64. package/src/components/bs5/globalAlert/globalAlert.test.js +10 -5
  65. package/src/components/bs5/inpageAlert/inpageAlert.scss +3 -4
  66. package/src/components/bs5/inpagenav/inpagenav.scss +9 -1
  67. package/src/components/bs5/modal/modal.scss +1 -1
  68. package/src/components/bs5/navbar/navbar.functions.js +39 -28
  69. package/src/components/bs5/navbar/navbar.scss +43 -28
  70. package/src/components/bs5/navbar/navbar.stories.js +4 -3
  71. package/src/components/bs5/pageLayout/pageLayout.stories.js +2 -0
  72. package/src/components/bs5/pagination/pagination.data.json +4 -4
  73. package/src/components/bs5/pagination/pagination.hbs +7 -2
  74. package/src/components/bs5/pagination/pagination.scss +1 -1
  75. package/src/components/bs5/promotionalPanel/promotionalPanel.data.json +45 -47
  76. package/src/components/bs5/promotionalPanel/promotionalPanel.hbs +1 -1
  77. package/src/components/bs5/quickexit/quickexit.scss +1 -1
  78. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +2 -2
  79. package/src/components/bs5/searchInput/search.functions.js +9 -5
  80. package/src/components/bs5/searchInput/searchInput.hbs +2 -2
  81. package/src/components/bs5/searchInput/searchInput.scss +1 -0
  82. package/src/components/bs5/select/select.hbs +1 -1
  83. package/src/components/bs5/sidenav/sidenav.scss +17 -19
  84. package/src/components/bs5/table/table.scss +93 -83
  85. package/src/components/bs5/textarea/textarea.hbs +1 -1
  86. package/src/components/bs5/textbox/textbox.hbs +1 -1
  87. package/src/css/main.scss +3 -0
  88. package/src/css/mixins/focusable.scss +1 -1
  89. package/src/css/qld-reduced-motion.scss +51 -0
  90. package/src/css/qld-tokens.scss +3 -3
  91. package/src/css/qld-type.scss +7 -13
  92. package/src/js/constants.js +10 -0
  93. package/src/js/qld.bootstrap.js +99 -99
  94. 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-color) solid 3px;
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 navbarCollapse = document.getElementById("main-nav");
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
- if (navbarCollapse?.classList.contains("show")) {
31
- navbarCollapse.classList.remove("show");
32
- overlay?.classList.remove("show");
33
- document.body.style.overflow = "";
34
- setAriaHidden(false);
35
-
36
- // Deactivate and destroy mobile focus trap
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 && navbarCollapse) {
47
- mobileFocusTrap = createFocusTrap(navbarCollapse, {
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 = navbarCollapse?.querySelectorAll(
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 < 992;
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 (navbarCollapse) {
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 < 992;
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
- navbarCollapse?.addEventListener("shown.bs.collapse", () => {
163
+ navbar?.addEventListener("shown.bs.collapse", () => {
148
164
  // Check if navbar is opening
149
165
  setTimeout(() => {
150
- if (navbarCollapse?.classList.contains("show")) {
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 < 992;
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,h3,h4,h5,h6 {
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) * -1);
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
- &::before {
230
- border-inline-start: 0.25rem solid var(--link-border-color-hover);
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, &.dark-alt {
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 var(--link-border-color);
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 var(--link-border-color);
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 var(--dropdown-bg-color);
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 var(--link-border-color-hover);
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 var(--background-color);
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 var(--link-border-color-hover);
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(--link-color);
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(var(--horizontal-bar-border-width) - var(--border-width));
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: 10;
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
- body:has(.navbar.show) {
826
- overflow: hidden;
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: 992px) {
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 <= 992px) {
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 >= 992px) {
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
- {{! Page button }}
27
- <a class="page-link" href="{{href}}" aria-label="{{arialabel}}">{{ linktext }}</a>
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
 
@@ -148,7 +148,7 @@ $pagination-icon-more-dark-hover-color: var(--#{$prefix}dark-action-secondary);
148
148
  .next {
149
149
  margin-left: 0.25rem;
150
150
  }
151
- .active a {
151
+ .active .page-link {
152
152
  font-weight: 700;
153
153
  }
154
154
 
@@ -1,48 +1,46 @@
1
1
  {
2
- "type": "indent-text",
3
- "variantClass": "light",
4
- "promoImage": "./assets/img/banner-example-3-to-2.jpg",
5
- "contentAlignment": "content-left",
6
- "icon": "icon-dot-grid",
7
- "title": "Title goes here and has a maximum of 65 character limit",
8
- "abstract": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tortor, leo vulputate ut odio mattis.",
9
- "body": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tortor, leo vulputate ut odio mattis. Vel suspendisse mi quisque consequat aliquet egestas.",
10
- "cta": {
11
- "items": [
12
- {
13
- "url": "#",
14
- "id": "https://www.wired.com",
15
- "value": "Label",
16
- "target": "_blank",
17
- "class": [
18
- {"small": false},
19
- {"view-all": false}
20
- ]
21
- }
22
- ]
23
- },
24
- "btn": {
25
- "items": [
26
- {
27
- "variantClass": "btn-primary",
28
- "islink": true,
29
- "isdisabled": false,
30
- "iconClass": "",
31
- "iconPosition": "",
32
- "label": "Primary",
33
- "href": "https://google.com",
34
- "target": "_self"
35
- },
36
- {
37
- "variantClass": "btn-secondary",
38
- "islink": true,
39
- "isdisabled": false,
40
- "iconClass": "",
41
- "iconPosition": "",
42
- "label": "Secondary",
43
- "href": "https://google.com",
44
- "target": "_self"
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 Image">
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}}
@@ -166,7 +166,7 @@
166
166
  position: -webkit-sticky;
167
167
  position: sticky;
168
168
  inset-block-start: 0;
169
- z-index: 999;
169
+ z-index: 500;
170
170
  padding-block: 20px;
171
171
  padding-inline: 40px;
172
172
  .container {
@@ -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
- searchInput.value = value.trim();
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: value.trim(),
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.innerText, form);
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.innerText, form);
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: query.trim(),
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}}
@@ -58,6 +58,7 @@
58
58
  .suggestions {
59
59
  display: block; // !important to override bootstrap d-none
60
60
  opacity: 1;
61
+ z-index: 9999; // Added z-index to ensure suggestions appear above other elements
61
62
  transition:
62
63
  opacity 0.5s,
63
64
  display 0.5s;