@qld-gov-au/qgds-bootstrap5 2.0.12 → 2.1.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 (73) hide show
  1. package/.esbuild/plugins/qgds-plugin-generate-icon-assets.js +31 -24
  2. package/dist/assets/components/bs5/button/button.hbs +1 -1
  3. package/dist/assets/components/bs5/footer/customLinks.hbs +1 -1
  4. package/dist/assets/components/bs5/footer/followLinks.hbs +1 -1
  5. package/dist/assets/components/bs5/head/head.hbs +1 -1
  6. package/dist/assets/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
  7. package/dist/assets/components/bs5/searchInput/searchInput.hbs +9 -7
  8. package/dist/assets/css/qld.bootstrap.css +2 -2
  9. package/dist/assets/css/qld.bootstrap.css.map +3 -3
  10. package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
  11. package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
  12. package/dist/assets/img/icons-sprite.svg +24 -24
  13. package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
  14. package/dist/assets/js/handlebars.init.min.js +33 -23
  15. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  16. package/dist/assets/js/handlebars.partials.js +33 -23
  17. package/dist/assets/js/handlebars.partials.js.map +2 -2
  18. package/dist/assets/js/qld.bootstrap.min.js +6 -6
  19. package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
  20. package/dist/assets/node/handlebars.init.min.js +14 -12
  21. package/dist/assets/node/handlebars.init.min.js.map +2 -2
  22. package/dist/components/bs5/button/button.hbs +1 -1
  23. package/dist/components/bs5/footer/customLinks.hbs +1 -1
  24. package/dist/components/bs5/footer/followLinks.hbs +1 -1
  25. package/dist/components/bs5/head/head.hbs +1 -1
  26. package/dist/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
  27. package/dist/components/bs5/searchInput/searchInput.hbs +9 -7
  28. package/dist/package.json +1 -1
  29. package/dist/sample-data/footer/footer.data.json +3 -0
  30. package/dist/sample-data/inpageAlert/inpageAlert.data.json +1 -1
  31. package/dist/sample-data/searchInput/searchInput.data.json +1 -0
  32. package/package.json +1 -1
  33. package/src/components/bs5/breadcrumbs/breadcrumbs.scss +3 -4
  34. package/src/components/bs5/button/Button.js +32 -6
  35. package/src/components/bs5/button/button.hbs +1 -1
  36. package/src/components/bs5/button/button.scss +0 -5
  37. package/src/components/bs5/card/card.scss +2 -0
  38. package/src/components/bs5/footer/customLinks.hbs +1 -1
  39. package/src/components/bs5/footer/followLinks.hbs +1 -1
  40. package/src/components/bs5/footer/footer.data.json +3 -0
  41. package/src/components/bs5/formcheck/_form-variables.scss +36 -0
  42. package/src/components/bs5/formcheck/formcheck.scss +54 -14
  43. package/src/components/bs5/header/header.scss +1 -2
  44. package/src/components/bs5/icons/_icons.list.js +7 -7
  45. package/src/components/bs5/icons/_icons.list.scss +113 -112
  46. package/src/components/bs5/icons/_icons.variables.scss +7 -6
  47. package/src/components/bs5/icons/icons.scss +2 -1
  48. package/src/components/bs5/inpageAlert/inpageAlert.data.json +1 -1
  49. package/src/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
  50. package/src/components/bs5/inpageAlert/inpageAlert.scss +49 -51
  51. package/src/components/bs5/inpageAlert/inpageAlert.stories.js +54 -3
  52. package/src/components/bs5/pageLayout/PaletteShowcase.stories.js +4 -3
  53. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +14 -14
  54. package/src/components/bs5/searchInput/search.functions.js +64 -69
  55. package/src/components/bs5/searchInput/searchInput.data.json +1 -0
  56. package/src/components/bs5/searchInput/searchInput.hbs +9 -7
  57. package/src/components/bs5/searchInput/searchInput.scss +91 -38
  58. package/src/components/bs5/searchInput/searchInput.test.js +91 -119
  59. package/src/components/bs5/skiplinks/skipLinks.scss +12 -4
  60. package/src/components/common/focus-styles/focusStyles.mdx +20 -0
  61. package/src/components/common/focus-styles/focusStyles.stories.js +58 -0
  62. package/src/css/functions/_index.scss +3 -0
  63. package/src/css/functions/color-icon.scss +31 -0
  64. package/src/css/functions/string-replace.scss +49 -0
  65. package/src/css/functions/svg-encode.scss +22 -0
  66. package/src/css/mixins/make-icon.scss +1 -1
  67. package/src/css/mixins/make-link.scss +13 -10
  68. package/src/css/qld-palettes.scss +20 -12
  69. package/src/css/qld-type.scss +5 -1
  70. package/src/css/qld-utilities.scss +9 -1
  71. package/src/css/qld-variables.scss +1 -1
  72. package/src/img/icons-sprite.svg +24 -24
  73. package/src/js/qld.bootstrap.js +3 -55
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "variantClass": "alert-success",
3
- "alertType": "",
3
+ "ariaLabel": "Success alert",
4
4
  "heading": "Alert heading",
5
5
  "headingTag": "h2",
6
6
  "content": "<p>This is an alert notice with some important information. <a href='#'>Find out more</a>.</p>"
@@ -1,5 +1,13 @@
1
- <div class="alert {{variantClass}} {{customClass}}" role="alert"
2
- {{#if alertType}}aria-label="{{alertType}}"{{/if}}>
1
+ <div class="alert {{variantClass}} {{customClass}}" role="alert"
2
+ {{#if ariaLabel}}
3
+ aria-label="{{ ariaLabel }}"
4
+ {{else}}
5
+ {{#ifCond variantClass "==" "alert-info"}}aria-label="Information alert"{{/ifCond}}
6
+ {{#ifCond variantClass "==" "alert-success"}}aria-label="Success alert"{{/ifCond}}
7
+ {{#ifCond variantClass "==" "alert-error"}}aria-label="Error alert"{{/ifCond}}
8
+ {{#ifCond variantClass "==" "alert-warning"}}aria-label="Warning alert"{{/ifCond}}
9
+ {{/if}}
10
+ >
3
11
  {{#if heading}}
4
12
  {{#if headingTag}}
5
13
  <{{headingTag}} class="alert-heading">{{{ heading }}}</{{headingTag}}>
@@ -1,5 +1,6 @@
1
1
  // QLD Desing System Bootstrap 5 library
2
2
  // Extends: https://getbootstrap.com/docs/5.3/components/alerts/#variables
3
+ @use "../../../css/mixins" as m;
3
4
 
4
5
  //All alerts have the same text and background color, even on darker themes
5
6
  //To account for this, we redefine the global vars at the .alert scope
@@ -12,6 +13,7 @@
12
13
  }
13
14
 
14
15
  .alert {
16
+ position: relative;
15
17
  padding-left: 4rem;
16
18
  overflow-wrap: break-word;
17
19
 
@@ -45,79 +47,75 @@
45
47
  no-repeat center center;
46
48
  }
47
49
 
48
- //Alert sidebar color and icon
49
- //Colors and icons defined below
50
- &:before,
51
- &:after {
52
- content: "";
53
- width: 3rem;
54
- position: absolute;
55
- left: 0;
56
- top: 0;
57
- bottom: 0;
58
- }
59
-
60
- &:after {
61
- color: #fff;
62
- background-repeat: no-repeat;
63
- background-position: center center;
64
- }
65
-
66
- //alerts color map
67
- $alert-colors-map: (
50
+ //alerts color map with icons
51
+ $alert-icons-map: (
68
52
  "success": (
69
- color: var(--#{$prefix}success),
70
- icon:
71
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_5702_82645' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='0' width='20' height='20'%3E%3Cpath d='M9.2207 12.6953C8.99805 12.918 8.58984 12.918 8.36719 12.6953L5.99219 10.3203C5.76953 10.0977 5.76953 9.68945 5.99219 9.4668C6.21484 9.24414 6.62305 9.24414 6.8457 9.4668L8.8125 11.4336L13.1172 7.0918C13.3398 6.86914 13.748 6.86914 13.9707 7.0918C14.1934 7.31445 14.1934 7.72266 13.9707 7.94531L9.2207 12.6953ZM19.5 9.875C19.5 15.1445 15.2324 19.375 10 19.375C4.73047 19.375 0.5 15.1445 0.5 9.875C0.5 4.64258 4.73047 0.375 10 0.375C15.2324 0.375 19.5 4.64258 19.5 9.875ZM10 1.5625C5.39844 1.5625 1.6875 5.31055 1.6875 9.875C1.6875 14.4766 5.39844 18.1875 10 18.1875C14.5645 18.1875 18.3125 14.4766 18.3125 9.875C18.3125 5.31055 14.5645 1.5625 10 1.5625Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_5702_82645)'%3E%3Crect width='20' height='20' fill='%23FFFFFF'/%3E%3C/g%3E%3C/svg%3E%0A",
53
+ "color": var(--#{$prefix}success),
54
+ "icon": "alert-success",
72
55
  ),
73
56
  "info": (
74
- color: var(--#{$prefix}info),
75
- icon:
76
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_5702_82508' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='1' y='1' width='18' height='18'%3E%3Cpath d='M10 7.20312C9.48047 7.20312 9.10938 6.83203 9.10938 6.3125C9.10938 5.83008 9.48047 5.42188 10 5.42188C10.4824 5.42188 10.8906 5.83008 10.8906 6.3125C10.8906 6.83203 10.4824 7.20312 10 7.20312ZM15.9375 1.5625C17.2363 1.5625 18.3125 2.63867 18.3125 3.9375V15.8125C18.3125 17.1484 17.2363 18.1875 15.9375 18.1875H4.0625C2.72656 18.1875 1.6875 17.1484 1.6875 15.8125V3.9375C1.6875 2.63867 2.72656 1.5625 4.0625 1.5625H15.9375ZM17.125 15.8125V3.9375C17.125 3.30664 16.5684 2.75 15.9375 2.75H4.0625C3.39453 2.75 2.875 3.30664 2.875 3.9375V15.8125C2.875 16.4805 3.39453 17 4.0625 17H15.9375C16.5684 17 17.125 16.4805 17.125 15.8125ZM11.7812 13.4375C12.0781 13.4375 12.375 13.7344 12.375 14.0312C12.375 14.3652 12.0781 14.625 11.7812 14.625H8.21875C7.88477 14.625 7.625 14.3652 7.625 14.0312C7.625 13.7344 7.88477 13.4375 8.21875 13.4375H9.40625V9.875H8.8125C8.47852 9.875 8.21875 9.61523 8.21875 9.28125C8.21875 8.98438 8.47852 8.6875 8.8125 8.6875H10C10.2969 8.6875 10.5938 8.98438 10.5938 9.28125V13.4375H11.7812Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_5702_82508)'%3E%3Crect width='20' height='20' fill='%23FFFFFF'/%3E%3C/g%3E%3C/svg%3E%0A",
57
+ "color": var(--#{$prefix}info),
58
+ "icon": "alert-information",
77
59
  ),
78
60
  "warning": (
79
- color: var(--#{$prefix}warning),
80
- icon:
81
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_5702_80802' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='0' y='2' width='20' height='17'%3E%3Cpath d='M10 13.9062C10.457 13.9062 10.8438 14.293 10.8086 14.75C10.8086 15.2422 10.457 15.5938 10 15.5938C9.54297 15.5938 9.15625 15.2422 9.15625 14.75C9.15625 14.293 9.50781 13.9062 10 13.9062ZM10 12.5C9.68359 12.5 9.4375 12.2539 9.4375 11.9375V6.875C9.4375 6.59375 9.71875 6.3125 10 6.3125C10.2461 6.3125 10.5273 6.59375 10.5273 6.875V11.9375C10.5273 12.2539 10.2812 12.5 10 12.5ZM18.7188 15.2422C19.0703 15.8398 19.0703 16.543 18.7188 17.1406C18.3672 17.7734 17.7344 18.125 17.0312 18.125H2.96875C2.23047 18.125 1.59766 17.7734 1.24609 17.1406C0.894531 16.543 0.894531 15.8398 1.24609 15.2422L8.27734 3.35938C8.62891 2.76172 9.26172 2.375 10 2.375C10.7031 2.41016 11.3359 2.76172 11.6875 3.35938L18.7188 15.2422ZM17.7344 16.5781C17.9102 16.332 17.875 16.0508 17.7344 15.8047L10.7031 3.92188C10.5625 3.67578 10.2812 3.53516 10 3.5C9.96484 3.5 10 3.5 10 3.5C9.68359 3.5 9.40234 3.67578 9.26172 3.92188L2.23047 15.8047C2.08984 16.0508 2.05469 16.332 2.23047 16.5781C2.37109 16.8594 2.65234 17 2.96875 17H16.9961C17.3125 17 17.5938 16.8594 17.7344 16.5781Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_5702_80802)'%3E%3Crect width='20' height='20' fill='%231D1D1D'/%3E%3C/g%3E%3C/svg%3E%0A",
61
+ "color": var(--#{$prefix}warning),
62
+ "icon": "alert-warning",
82
63
  ),
83
64
  "danger": (
84
- color: var(--#{$prefix}danger),
85
- icon:
86
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_34619_4370' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='4' y='4' width='12' height='12'%3E%3Cpath d='M14.8438 14.875C14.6562 15.0625 14.3125 15.0625 14.125 14.875L10 10.7188L5.84375 14.875C5.65625 15.0625 5.3125 15.0625 5.125 14.875C4.9375 14.6875 4.9375 14.3438 5.125 14.1562L9.28125 10L5.125 5.875C4.9375 5.6875 4.9375 5.34375 5.125 5.15625C5.3125 4.96875 5.65625 4.96875 5.84375 5.15625L10 9.3125L14.125 5.15625C14.3125 4.96875 14.6562 4.96875 14.8438 5.15625C15.0312 5.34375 15.0312 5.6875 14.8438 5.875L10.6875 10L14.8438 14.1562C15.0312 14.3438 15.0312 14.6875 14.8438 14.875Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_34619_4370)'%3E%3Crect width='20' height='20' fill='white'/%3E%3C/g%3E%3Ccircle cx='10' cy='10' r='9.5' stroke='white'/%3E%3C/svg%3E%0A",
65
+ "color": var(--#{$prefix}danger),
66
+ "icon": "alert-danger",
87
67
  ),
88
- //.alert-error can be a clone of .alert-danger
89
68
  "error": (
90
- color: var(--#{$prefix}danger),
91
- icon:
92
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_34619_4370' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='4' y='4' width='12' height='12'%3E%3Cpath d='M14.8438 14.875C14.6562 15.0625 14.3125 15.0625 14.125 14.875L10 10.7188L5.84375 14.875C5.65625 15.0625 5.3125 15.0625 5.125 14.875C4.9375 14.6875 4.9375 14.3438 5.125 14.1562L9.28125 10L5.125 5.875C4.9375 5.6875 4.9375 5.34375 5.125 5.15625C5.3125 4.96875 5.65625 4.96875 5.84375 5.15625L10 9.3125L14.125 5.15625C14.3125 4.96875 14.6562 4.96875 14.8438 5.15625C15.0312 5.34375 15.0312 5.6875 14.8438 5.875L10.6875 10L14.8438 14.1562C15.0312 14.3438 15.0312 14.6875 14.8438 14.875Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_34619_4370)'%3E%3Crect width='20' height='20' fill='white'/%3E%3C/g%3E%3Ccircle cx='10' cy='10' r='9.5' stroke='white'/%3E%3C/svg%3E%0A",
93
- ),
69
+ "color": var(--#{$prefix}danger),
70
+ "icon": "alert-danger",
71
+ ),
94
72
  "light": (
95
- color: var(--#{$prefix}light-grey),
96
- icon:
97
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_5702_82508' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='1' y='1' width='18' height='18'%3E%3Cpath d='M10 7.20312C9.48047 7.20312 9.10938 6.83203 9.10938 6.3125C9.10938 5.83008 9.48047 5.42188 10 5.42188C10.4824 5.42188 10.8906 5.83008 10.8906 6.3125C10.8906 6.83203 10.4824 7.20312 10 7.20312ZM15.9375 1.5625C17.2363 1.5625 18.3125 2.63867 18.3125 3.9375V15.8125C18.3125 17.1484 17.2363 18.1875 15.9375 18.1875H4.0625C2.72656 18.1875 1.6875 17.1484 1.6875 15.8125V3.9375C1.6875 2.63867 2.72656 1.5625 4.0625 1.5625H15.9375ZM17.125 15.8125V3.9375C17.125 3.30664 16.5684 2.75 15.9375 2.75H4.0625C3.39453 2.75 2.875 3.30664 2.875 3.9375V15.8125C2.875 16.4805 3.39453 17 4.0625 17H15.9375C16.5684 17 17.125 16.4805 17.125 15.8125ZM11.7812 13.4375C12.0781 13.4375 12.375 13.7344 12.375 14.0312C12.375 14.3652 12.0781 14.625 11.7812 14.625H8.21875C7.88477 14.625 7.625 14.3652 7.625 14.0312C7.625 13.7344 7.88477 13.4375 8.21875 13.4375H9.40625V9.875H8.8125C8.47852 9.875 8.21875 9.61523 8.21875 9.28125C8.21875 8.98438 8.47852 8.6875 8.8125 8.6875H10C10.2969 8.6875 10.5938 8.98438 10.5938 9.28125V13.4375H11.7812Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_5702_82508)'%3E%3Crect width='20' height='20' fill='%23595959'/%3E%3C/g%3E%3C/svg%3E%0A",
73
+ "color": var(--#{$prefix}light-grey),
74
+ "icon": null,
98
75
  ),
99
76
  "dark": (
100
- color: var(--#{$prefix}dark-grey),
101
- icon:
102
- "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='mask0_5702_82508' style='mask-type:alpha' maskUnits='userSpaceOnUse' x='1' y='1' width='18' height='18'%3E%3Cpath d='M10 7.20312C9.48047 7.20312 9.10938 6.83203 9.10938 6.3125C9.10938 5.83008 9.48047 5.42188 10 5.42188C10.4824 5.42188 10.8906 5.83008 10.8906 6.3125C10.8906 6.83203 10.4824 7.20312 10 7.20312ZM15.9375 1.5625C17.2363 1.5625 18.3125 2.63867 18.3125 3.9375V15.8125C18.3125 17.1484 17.2363 18.1875 15.9375 18.1875H4.0625C2.72656 18.1875 1.6875 17.1484 1.6875 15.8125V3.9375C1.6875 2.63867 2.72656 1.5625 4.0625 1.5625H15.9375ZM17.125 15.8125V3.9375C17.125 3.30664 16.5684 2.75 15.9375 2.75H4.0625C3.39453 2.75 2.875 3.30664 2.875 3.9375V15.8125C2.875 16.4805 3.39453 17 4.0625 17H15.9375C16.5684 17 17.125 16.4805 17.125 15.8125ZM11.7812 13.4375C12.0781 13.4375 12.375 13.7344 12.375 14.0312C12.375 14.3652 12.0781 14.625 11.7812 14.625H8.21875C7.88477 14.625 7.625 14.3652 7.625 14.0312C7.625 13.7344 7.88477 13.4375 8.21875 13.4375H9.40625V9.875H8.8125C8.47852 9.875 8.21875 9.61523 8.21875 9.28125C8.21875 8.98438 8.47852 8.6875 8.8125 8.6875H10C10.2969 8.6875 10.5938 8.98438 10.5938 9.28125V13.4375H11.7812Z' fill='%2303213F'/%3E%3C/mask%3E%3Cg mask='url(%23mask0_5702_82508)'%3E%3Crect width='20' height='20' fill='%23FFFFFF'/%3E%3C/g%3E%3C/svg%3E%0A",
77
+ "color": var(--#{$prefix}dark-grey),
78
+ "icon": null,
103
79
  ),
104
80
  );
105
81
 
106
- //Sets colors (border and icon-background) and icons for each alert type
107
- @each $key, $properties in $alert-colors-map {
108
- $color: map-get($properties, color);
109
- $icon: map-get($properties, icon);
82
+ &:before,
83
+ &:after {
84
+ content: "";
85
+ position: absolute;
86
+ left: 0;
87
+ top: 0;
88
+ bottom: 0;
89
+ color: #fff;
90
+ }
91
+
92
+ &:before {
93
+ width: 3rem;
94
+ }
110
95
 
96
+ //Sets border color and icon for each alert type
97
+ @each $key, $values in $alert-icons-map {
111
98
  &-#{$key} {
112
- border-color: $color;
99
+ border-color: map-get($values, "color");
113
100
  border-width: 2px;
114
101
 
115
102
  &:before {
116
- background-color: $color;
103
+ background-color: map-get($values, "color");
117
104
  }
118
105
 
119
- &:after {
120
- background-image: url($icon);
106
+ @if map-get($values, "icon") {
107
+ @include m.make-icon(
108
+ $name: map-get($values, "icon"),
109
+ $size: "md",
110
+ $pseudo: "after"
111
+ ) {
112
+ height: 100%;
113
+ display: flex;
114
+ align-items: center;
115
+ justify-content: center;
116
+ color: #fff;
117
+ margin: 0 0.75rem;
118
+ }
121
119
  }
122
120
  }
123
121
  }
@@ -49,9 +49,9 @@ export default {
49
49
  },
50
50
  options: ["alert-success", "alert-info", "alert-warning", "alert-error"],
51
51
  },
52
- alertType: {
53
- name: "Alert Type",
54
- description: `Type of the alert. i.g "Success", "Information", "Warning", "Error".`,
52
+ ariaLabel: {
53
+ name: "ARIA Label",
54
+ description: `Accessible label for the alert announced to screen readers. e.g "Success alert", "Information alert", "Warning alert", "Error alert".`,
55
55
  },
56
56
  headingTag: {
57
57
  name: "Heading Tag",
@@ -88,3 +88,54 @@ export const Dark = {
88
88
  },
89
89
  ],
90
90
  };
91
+
92
+ /**
93
+ * All alert variants with proper accessibility.
94
+ * Each alert includes CSS-based icons and a visually-hidden span for screen readers.
95
+ */
96
+ export const AllVariants = {
97
+ name: "All Alert Types (Accessibility)",
98
+ render: () => {
99
+ const alerts = [
100
+ {
101
+ variantClass: "alert-success",
102
+ ariaLabel: "Success alert",
103
+ heading: "Success Alert",
104
+ content: "<p>This action was completed successfully.</p>",
105
+ },
106
+ {
107
+ variantClass: "alert-info",
108
+ ariaLabel: "Information alert",
109
+ heading: "Information Alert",
110
+ content: "<p>Here is some important information for you to know.</p>",
111
+ },
112
+ {
113
+ variantClass: "alert-warning",
114
+ ariaLabel: "Warning alert",
115
+ heading: "Warning Alert",
116
+ content: "<p>Please be aware of this potential issue.</p>",
117
+ },
118
+ {
119
+ variantClass: "alert-error",
120
+ ariaLabel: "Error alert",
121
+ heading: "Error Alert",
122
+ content: "<p>An error occurred. Please try again.</p>",
123
+ },
124
+ ];
125
+
126
+ return alerts
127
+ .map(
128
+ (alertData) => `
129
+ <div class="mb-4">
130
+ ${new InpageAlert(alertData).html}
131
+ </div>
132
+ `
133
+ )
134
+ .join("");
135
+ },
136
+ parameters: {
137
+ controls: {
138
+ disable: true,
139
+ },
140
+ },
141
+ };
@@ -231,9 +231,6 @@ export const PaletteComparison = {
231
231
  <div class="col-md-3">
232
232
  <div class="bg-dark p-2 text-center rounded text-white">.bg-dark</div>
233
233
  </div>
234
- <div class="col-md-3">
235
- <div class="bg-dark-alt p-2 text-center rounded text-white">.bg-dark-alt</div>
236
- </div>
237
234
  <div class="col-md-3">
238
235
  <div class="bg-default-shade p-2 text-center rounded">.bg-default-shade</div>
239
236
  </div>
@@ -243,6 +240,10 @@ export const PaletteComparison = {
243
240
  <div class="col-md-3">
244
241
  <div class="bg-light-alt-shade p-2 text-center rounded">.bg-light-alt-shade</div>
245
242
  </div>
243
+ <div class="col-md-3">
244
+ <div class="bg-dark-alt p-2 text-center rounded text-white">.bg-dark-alt</div>
245
+ </div>
246
+
246
247
  </div>
247
248
  </div>
248
249
  `,
@@ -1,4 +1,4 @@
1
- // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
2
 
3
3
  exports[`SearchInput > Renders as expected 1`] = `
4
4
  "<!--
@@ -6,32 +6,32 @@ exports[`SearchInput > Renders as expected 1`] = `
6
6
  -->
7
7
  <div class="qld-search-input ">
8
8
  <input id="search" name="query" class="form-control" type="text" autocomplete="off"
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" />
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
10
  <button class="btn btn-primary" type="submit" id="search-button">
11
11
  <span class="btn-icon"></span>
12
12
  <span class="btn-label">Search</span>
13
13
  </button>
14
- <div class="suggestions suggestions__group d-none default">
14
+
15
+ <div class="suggestions suggestions__group default">
15
16
  <div class="default-suggestions">
16
17
  <div class="suggestions-category">
17
18
  <strong class="suggestions-category-label d-block">Popular</strong>
18
19
  <ul>
19
- <li><a href="https://www.forgov.qld.gov.au/pay-benefits-and-policy/leave/submit-a-leave-application">Apply for leave now</a></li>
20
- <li><a href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/starting-a-new-job/apply-for-higher-duties-or-relieving-at-level">Apply for higher duties or relieving at level</a></li>
21
- <li><a href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/recruitment/extending-my-job/extend-a-temporary-or-casual-employee">Extend a temporary or casual employee</a></li>
22
- <li><a href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/recruitment">Hire a staff member (recruitment)</a></li>
23
- <li><a href="/queenslanders" class="view-more">View more</a></li>
20
+ <li><a tabindex="0" href="https://www.forgov.qld.gov.au/pay-benefits-and-policy/leave/submit-a-leave-application">Apply for leave now</a></li>
21
+ <li><a tabindex="0" href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/starting-a-new-job/apply-for-higher-duties-or-relieving-at-level">Apply for higher duties or relieving at level</a></li>
22
+ <li><a tabindex="0" href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/recruitment/extending-my-job/extend-a-temporary-or-casual-employee">Extend a temporary or casual employee</a></li>
23
+ <li><a tabindex="0" href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/recruitment">Hire a staff member (recruitment)</a></li>
24
+ <li><a tabindex="0" href="/queenslanders" class="view-more">View more</a></li>
24
25
  </ul>
25
26
  </div>
26
-
27
27
  <div class="suggestions-category">
28
28
  <strong class="suggestions-category-label d-block">Collection</strong>
29
29
  <ul>
30
- <li><a href="https://www.forgov.qld.gov.au/pay-benefits-and-policy/directives-policies-circulars-and-guidelines">Search for directives, policies, circulars, and guidelines</a></li>
31
- <li><a href="https://www.forgov.qld.gov.au/pay-benefits-and-policy/benefits/employee-pay-and-benefits">Employee pay and benefits</a></li>
32
- <li><a href="https://www.forgov.qld.gov.au/sandbox/archive/queensland-shared-services">Queensland Shared Services</a></li>
33
- <li><a href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/career-development">Career development</a></li>
34
- <li><a href="/queenslanders" class="view-more">View all</a></li>
30
+ <li><a tabindex="0"href="https://www.forgov.qld.gov.au/pay-benefits-and-policy/directives-policies-circulars-and-guidelines">Search for directives, policies, circulars, and guidelines</a></li>
31
+ <li><a tabindex="0"href="https://www.forgov.qld.gov.au/pay-benefits-and-policy/benefits/employee-pay-and-benefits">Employee pay and benefits</a></li>
32
+ <li><a tabindex="0"href="https://www.forgov.qld.gov.au/sandbox/archive/queensland-shared-services">Queensland Shared Services</a></li>
33
+ <li><a tabindex="0"href="https://www.forgov.qld.gov.au/recruitment-performance-and-career/career-development">Career development</a></li>
34
+ <li><a tabindex="0" href="/queenslanders" class="view-more">View all</a></li>
35
35
  </ul>
36
36
  </div>
37
37
  </div>
@@ -1,5 +1,3 @@
1
- import { createPopper } from "@popperjs/core";
2
-
3
1
  /**
4
2
  * Fetches data from the provided URL.
5
3
  *
@@ -28,31 +26,26 @@ async function fetchData(url, type) {
28
26
  * @param {HTMLFormElement} form - The form element.
29
27
  * @returns {void}
30
28
  */
31
- export function selectSuggestion(value, form) {
29
+ export function selectDynamicSuggestion(value, form) {
32
30
  const searchInput = form.querySelector(".qld-search-input input");
33
31
  const suggestions = form.querySelector(".suggestions");
34
32
 
35
33
  if (searchInput && suggestions) {
36
34
  searchInput.value = value.trim();
37
- // suggestions.classList.add("d-none");
38
-
39
- // Retrieve additional params
40
- const collection =
41
- searchInput.getAttribute("data-collection") || "qgov~sp-search";
42
- const profile = searchInput.getAttribute("data-profile") || "qld";
43
- const numRanks = searchInput.getAttribute("data-numranks") || "10";
44
- const tiers = searchInput.getAttribute("data-tiers") || "off";
45
35
 
46
36
  // Form action
47
37
  const actionUrl = form.getAttribute("action");
48
38
 
39
+ //data-* attributes on search input field
40
+ const atts = searchInput ? searchInput.dataset : null;
41
+
49
42
  // Construct the URL with proper parameters
50
43
  const params = new URLSearchParams({
51
44
  query: value.trim(),
52
- collection: collection,
53
- profile: profile,
54
- num_ranks: numRanks,
55
- tiers: tiers,
45
+ collection: atts.collection || "qgov~sp-search",
46
+ profile: atts.profile || "qld",
47
+ num_ranks: atts.numRanks || "10",
48
+ tiers: atts.tiers || "off",
56
49
  });
57
50
 
58
51
  const searchUrl = `${actionUrl}?${params.toString()}`;
@@ -81,11 +74,10 @@ export async function showSuggestions(value = "", isDefault = false, form) {
81
74
  );
82
75
 
83
76
  if (!suggestions || !searchInput) {
84
- console.warn("Required suggestions elements not found.");
85
77
  return;
86
78
  }
87
79
 
88
- // Hide/show default suggestions
80
+ // Hide/show default suggestions, and return early
89
81
  if (isDefault) {
90
82
  if (defaultSuggestionsContainer) {
91
83
  defaultSuggestionsContainer.classList.remove("d-none");
@@ -94,13 +86,10 @@ export async function showSuggestions(value = "", isDefault = false, form) {
94
86
  dynamicSuggestionsContainer.innerHTML = "";
95
87
  dynamicSuggestionsContainer.classList.add("d-none");
96
88
  }
97
- createPopper(searchInput, suggestions, {
98
- placement: "bottom-start",
99
- });
100
- suggestions.classList.remove("d-none");
101
89
  return;
102
90
  }
103
91
 
92
+ // If input is empty, hide dynamic suggestions and return early
104
93
  if (dynamicSuggestionsContainer) {
105
94
  if (value.length === 0) {
106
95
  dynamicSuggestionsContainer.innerHTML = "";
@@ -109,22 +98,27 @@ export async function showSuggestions(value = "", isDefault = false, form) {
109
98
  }
110
99
  }
111
100
 
112
- if (defaultSuggestionsContainer) {
113
- defaultSuggestionsContainer.classList.add("d-none");
114
- }
101
+ // Script continues...dynamic suggestions is true and value.length > 0
102
+ defaultSuggestionsContainer?.classList.add("d-none");
103
+
104
+ //data-* attributes on search input field
105
+ const atts = searchInput ? searchInput.dataset : null;
115
106
 
116
107
  // Fetch dynamic suggestions if available
117
108
  if (dynamicSuggestionsContainer) {
118
- const suggestUrl = searchInput.getAttribute("data-suggestions");
109
+ const suggestUrl = atts.suggestions;
110
+
119
111
  if (suggestUrl) {
120
- const collection =
121
- searchInput.getAttribute("data-collection") || "qgov~sp-search";
122
- const profile = searchInput.getAttribute("data-profile") || "qld";
112
+ const collection = atts.collection || "qgov~sp-search";
113
+ const profile = atts.profile || "qld";
114
+
115
+ //Fetch data from suggestions API
123
116
  const fetchedSuggestions = await fetchData(
124
117
  `${suggestUrl}?collection=${collection}&profile=${profile}&fmt=json&alpha=0.5&partial_query=${encodeURIComponent(value)}`,
125
118
  "suggestions",
126
119
  );
127
120
 
121
+ //Rended a suggestions list
128
122
  if (fetchedSuggestions.length > 0) {
129
123
  dynamicSuggestionsContainer.innerHTML = `
130
124
  <div class="suggestions-category">
@@ -135,34 +129,35 @@ export async function showSuggestions(value = "", isDefault = false, form) {
135
129
  new RegExp(`(${value})`, "gi"),
136
130
  "<strong>$1</strong>",
137
131
  );
138
- return `<li><a href="#">${highlightedText}</a></li>`;
132
+ return `<li><a tabindex="0" href="#">${highlightedText}</a></li>`;
139
133
  })
140
134
  .join("")}</ul>
141
135
  </div>`;
136
+
142
137
  dynamicSuggestionsContainer.classList.remove("d-none");
143
- createPopper(searchInput, suggestions, {
144
- placement: "bottom-start",
145
- });
146
- suggestions.classList.remove("d-none");
147
-
148
- // Attach click event listeners to each suggestion item
149
- form.querySelectorAll(".suggestions li").forEach((item) => {
150
- item.addEventListener("click", () =>
151
- selectSuggestion(item.innerText, form),
152
- );
153
- });
138
+
139
+ // Bind an event listener to suggestions container
140
+ form
141
+ .querySelector(".suggestions .dynamic-suggestions")
142
+ .addEventListener("click", (event) => {
143
+ let linkItem = event.target.closest("a");
144
+ if (linkItem) {
145
+ event.preventDefault();
146
+ selectDynamicSuggestion(linkItem.innerText, form);
147
+ }
148
+ });
154
149
  } else {
155
150
  dynamicSuggestionsContainer.innerHTML = "";
156
151
  dynamicSuggestionsContainer.classList.add("d-none");
157
- suggestions.classList.add("d-none");
158
152
  }
159
153
  }
160
154
 
161
- const resultsUrl = searchInput.getAttribute("data-results-url");
155
+ const resultsUrl = atts.resultsUrl; //data-results-url;
162
156
  if (resultsUrl) {
163
- const collection =
164
- searchInput.getAttribute("data-collection") || "qgov~sp-search";
165
- const profile = searchInput.getAttribute("data-profile") || "qld";
157
+ const collection = atts.collection || "qgov~sp-search";
158
+ const profile = atts.profile || "qld";
159
+
160
+ // Fetch related services from services API
166
161
  const fetchedServices = await fetchData(
167
162
  `${resultsUrl}?collection=${collection}&profile=${profile}&smeta_sfinder_sand=yes&query=${encodeURIComponent(value)}`,
168
163
  "services",
@@ -178,11 +173,14 @@ export async function showSuggestions(value = "", isDefault = false, form) {
178
173
  // Build the services HTML safely
179
174
  const servicesItems = fetchedServices.response.resultPacket.results
180
175
  .slice(0, 4)
181
- .map((item) => `<li><a href="${item.liveUrl}">${item.title}</a></li>`)
176
+ .map(
177
+ (item) =>
178
+ `<li><a tabindex="0" href="${item.liveUrl}">${item.title}</a></li>`,
179
+ )
182
180
  .join("");
183
181
 
184
182
  const viewMoreItem = viewMoreUrl
185
- ? `<li><a href="${viewMoreUrl}" class="view-more">View more</a></li>`
183
+ ? `<li><a tabindex="0" href="${viewMoreUrl}" class="view-more">View more</a></li>`
186
184
  : "";
187
185
 
188
186
  dynamicSuggestionsContainer.innerHTML += `
@@ -190,18 +188,19 @@ export async function showSuggestions(value = "", isDefault = false, form) {
190
188
  <strong class="suggestions-category-label d-block">Related services</strong>
191
189
  <ul>${servicesItems}${viewMoreItem}</ul>
192
190
  </div>`;
191
+
193
192
  dynamicSuggestionsContainer.classList.remove("d-none");
194
- createPopper(searchInput, suggestions, {
195
- placement: "bottom-start",
196
- });
197
- suggestions.classList.remove("d-none");
198
-
199
- // Attach click event listeners to each suggestion item
200
- form.querySelectorAll(".suggestions li").forEach((item) => {
201
- item.addEventListener("click", () =>
202
- selectSuggestion(item.innerText, form),
203
- );
204
- });
193
+
194
+ // Attach click event listeners to each SERVICE item in list
195
+ form
196
+ .querySelector(".suggestions .dynamic-suggestions")
197
+ .addEventListener("click", (event) => {
198
+ let linkItem = event.target.closest("a");
199
+ if (linkItem) {
200
+ event.preventDefault();
201
+ selectDynamicSuggestion(linkItem.innerText, form);
202
+ }
203
+ });
205
204
  }
206
205
  }
207
206
  }
@@ -216,19 +215,14 @@ export async function showSuggestions(value = "", isDefault = false, form) {
216
215
  */
217
216
  export function submitSearchForm(query = "", form) {
218
217
  const searchInput = form.querySelector(".qld-search-input input");
219
-
220
- const collection =
221
- searchInput.getAttribute("data-collection") || "qgov~sp-search";
222
- const profile = searchInput.getAttribute("data-profile") || "qld";
223
- const numRanks = searchInput.getAttribute("data-numranks") || "10";
224
- const tiers = searchInput.getAttribute("data-tiers") || "off";
218
+ const atts = searchInput ? searchInput.dataset : null;
225
219
 
226
220
  const params = new URLSearchParams({
227
221
  query: query.trim(),
228
- collection: collection,
229
- profile: profile,
230
- num_ranks: numRanks,
231
- tiers: tiers,
222
+ collection: atts.collection || "qgov~sp-search",
223
+ profile: atts.profile || "qld",
224
+ num_ranks: atts.numRanks || "10",
225
+ tiers: atts.tiers || "off",
232
226
  });
233
227
 
234
228
  const searchUrl = `${form.getAttribute("action")}?${params.toString()}`;
@@ -236,4 +230,5 @@ export function submitSearchForm(query = "", form) {
236
230
  }
237
231
 
238
232
  // Attach the function to the window object to make it globally accessible
239
- window.selectSuggestion = (value, form) => selectSuggestion(value, form);
233
+ window.selectDynamicSuggestion = (value, form) =>
234
+ selectDynamicSuggestion(value, form);
@@ -6,6 +6,7 @@
6
6
  "buttonType": "submit",
7
7
  "buttonLabel": "Search",
8
8
  "ariaLabel": "Search website",
9
+ "placeholder": "",
9
10
  "tags": {
10
11
  "collection": "qgov~sp-search",
11
12
  "profile": "qld",
@@ -3,38 +3,40 @@
3
3
  -->
4
4
  <div class="qld-search-input {{customClass}}">
5
5
  <input id="{{ inputID }}" name="{{ inputName }}" class="form-control" type="text" autocomplete="off"
6
- aria-label="{{ ariaLabel }}" {{#each tags}} data-{{@key}}="{{this}}" {{/each}} />
6
+ aria-label="{{ ariaLabel }}" {{#each tags}} data-{{@key}}="{{this}}" {{/each}} placeholder="{{placeholder}}" />
7
7
  <button class="btn btn-primary" type="{{ buttonType }}" id="{{ buttonID }}">
8
8
  <span class="btn-icon"></span>
9
9
  <span class="btn-label">{{ buttonLabel }}</span>
10
10
  </button>
11
11
  {{#ifCond hasDynamicSuggestions '||' hasDefaultSuggestions}}
12
- <div class="suggestions suggestions__group d-none default">
12
+
13
+ <div class="suggestions suggestions__group default">
13
14
  {{#if hasDefaultSuggestions}}
14
15
  <div class="default-suggestions">
15
16
  <div class="suggestions-category">
16
17
  <strong class="suggestions-category-label d-block">{{defaultSuggestions.popularServicesTitle}}</strong>
17
18
  <ul>
18
19
  {{#each defaultSuggestions.popularServices}}
19
- <li><a href="{{link}}">{{title}}</a></li>
20
+ <li><a tabindex="0" href="{{link}}">{{title}}</a></li>
20
21
  {{/each}}
21
22
  {{#if defaultSuggestions.popularServicesLink}}
22
- <li><a href="{{defaultSuggestions.popularServicesLink.href}}" class="view-more">{{#if defaultSuggestions.popularServicesLink.label}}{{defaultSuggestions.popularServicesLink.label}}{{else}}View More{{/if}}</a></li>
23
+ <li><a tabindex="0" href="{{defaultSuggestions.popularServicesLink.href}}" class="view-more">{{#if defaultSuggestions.popularServicesLink.label}}{{defaultSuggestions.popularServicesLink.label}}{{else}}View More{{/if}}</a></li>
23
24
  {{/if}}
24
25
  </ul>
25
26
  </div>
26
-
27
+ {{#if defaultSuggestions.categories}}
27
28
  <div class="suggestions-category">
28
29
  <strong class="suggestions-category-label d-block">{{defaultSuggestions.categoriesTitle}}</strong>
29
30
  <ul>
30
31
  {{#each defaultSuggestions.categories}}
31
- <li><a href="{{link}}">{{title}}</a></li>
32
+ <li><a tabindex="0"href="{{link}}">{{title}}</a></li>
32
33
  {{/each}}
33
34
  {{#if defaultSuggestions.categoriesLink}}
34
- <li><a href="{{defaultSuggestions.categoriesLink.href}}" class="view-more">{{#if defaultSuggestions.categoriesLink.label}}{{defaultSuggestions.categoriesLink.label}}{{else}}View More{{/if}}</a></li>
35
+ <li><a tabindex="0" href="{{defaultSuggestions.categoriesLink.href}}" class="view-more">{{#if defaultSuggestions.categoriesLink.label}}{{defaultSuggestions.categoriesLink.label}}{{else}}View More{{/if}}</a></li>
35
36
  {{/if}}
36
37
  </ul>
37
38
  </div>
39
+ {{/if}}
38
40
  </div>
39
41
  {{/if}}
40
42
  {{#if hasDynamicSuggestions}}