@qld-gov-au/qgds-bootstrap5 2.0.10 → 2.0.12

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 (113) hide show
  1. package/.storybook/main.mjs +2 -2
  2. package/.storybook/preview.js +5 -2
  3. package/dist/assets/components/bs5/banner/banner.hbs +3 -6
  4. package/dist/assets/components/bs5/card/card.hbs +2 -2
  5. package/dist/assets/components/bs5/dateinput/dateinput.hbs +27 -27
  6. package/dist/assets/components/bs5/formcheck/formcheck.hbs +10 -2
  7. package/dist/assets/components/bs5/head/head.hbs +1 -1
  8. package/dist/assets/components/bs5/searchInput/searchInput.hbs +31 -29
  9. package/dist/assets/components/bs5/select/select.hbs +19 -19
  10. package/dist/assets/components/bs5/tag/tag.hbs +1 -1
  11. package/dist/assets/components/bs5/textarea/textarea.hbs +17 -17
  12. package/dist/assets/components/bs5/textbox/textbox.hbs +17 -18
  13. package/dist/assets/css/qld.bootstrap.css +2 -2
  14. package/dist/assets/css/qld.bootstrap.css.map +3 -3
  15. package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
  16. package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
  17. package/dist/assets/js/handlebars.helpers.bundle.js +2 -2
  18. package/dist/assets/js/handlebars.helpers.bundle.js.map +2 -2
  19. package/dist/assets/js/handlebars.init.min.js +141 -135
  20. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  21. package/dist/assets/js/handlebars.partials.js +141 -135
  22. package/dist/assets/js/handlebars.partials.js.map +2 -2
  23. package/dist/assets/js/qld.bootstrap.min.js +9 -10
  24. package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
  25. package/dist/assets/node/handlebars.init.min.js +59 -11
  26. package/dist/assets/node/handlebars.init.min.js.map +2 -2
  27. package/dist/components/bs5/banner/banner.hbs +3 -6
  28. package/dist/components/bs5/card/card.hbs +2 -2
  29. package/dist/components/bs5/dateinput/dateinput.hbs +27 -27
  30. package/dist/components/bs5/formcheck/formcheck.hbs +10 -2
  31. package/dist/components/bs5/head/head.hbs +1 -1
  32. package/dist/components/bs5/searchInput/searchInput.hbs +31 -29
  33. package/dist/components/bs5/select/select.hbs +19 -19
  34. package/dist/components/bs5/tag/tag.hbs +1 -1
  35. package/dist/components/bs5/textarea/textarea.hbs +17 -17
  36. package/dist/components/bs5/textbox/textbox.hbs +17 -18
  37. package/dist/package.json +1 -1
  38. package/dist/sample-data/card/card.data.json +4 -1
  39. package/dist/sample-data/dateinput/dateinput.data.json +14 -12
  40. package/dist/sample-data/formcheck/stories/checkbox/checkbox.data.json +4 -5
  41. package/dist/sample-data/formcheck/stories/radio/radio.data.json +4 -4
  42. package/dist/sample-data/searchInput/searchInput.data.json +19 -10
  43. package/dist/sample-data/select/select.data.json +12 -10
  44. package/dist/sample-data/tag/tag.data.json +149 -143
  45. package/dist/sample-data/textarea/textarea.data.json +14 -11
  46. package/dist/sample-data/textbox/textbox.data.json +13 -10
  47. package/package.json +1 -1
  48. package/src/components/bs5/banner/banner.hbs +3 -6
  49. package/src/components/bs5/banner/banner.scss +10 -7
  50. package/src/components/bs5/banner/banner.stories.js +2 -5
  51. package/src/components/bs5/button/button.scss +4 -11
  52. package/src/components/bs5/button/button.stories.js +17 -15
  53. package/src/components/bs5/card/Card.js +31 -2
  54. package/src/components/bs5/card/Card.mdx +4 -0
  55. package/src/components/bs5/card/card--icon-list-footer.stories.js +2 -24
  56. package/src/components/bs5/card/card--multi-action.stories.js +9 -28
  57. package/src/components/bs5/card/card--no-action.stories.js +5 -27
  58. package/src/components/bs5/card/card--single-action.stories.js +4 -33
  59. package/src/components/bs5/card/card.data.json +4 -1
  60. package/src/components/bs5/card/card.hbs +2 -2
  61. package/src/components/bs5/dateinput/Dateinput.js +26 -11
  62. package/src/components/bs5/dateinput/dateinput.data.json +14 -12
  63. package/src/components/bs5/dateinput/dateinput.hbs +27 -27
  64. package/src/components/bs5/footer/footer_formio.scss +5 -5
  65. package/src/components/bs5/formcheck/Formcheck.js +57 -6
  66. package/src/components/bs5/formcheck/_form-variables.scss +131 -0
  67. package/src/components/bs5/formcheck/formcheck.hbs +10 -2
  68. package/src/components/bs5/formcheck/formcheck.scss +229 -66
  69. package/src/components/bs5/formcheck/stories/bootstrap-validation/bootstrap-validation.stories.js +304 -0
  70. package/src/components/bs5/formcheck/stories/checkbox/checkbox.data.json +4 -5
  71. package/src/components/bs5/formcheck/stories/checkbox/checkbox.stories.js +19 -111
  72. package/src/components/bs5/formcheck/stories/radio/radio.data.json +4 -4
  73. package/src/components/bs5/formcheck/stories/radio/radio.stories.js +30 -122
  74. package/src/components/bs5/inpageAlert/inpageAlert.scss +1 -1
  75. package/src/components/bs5/modal/modal.scss +106 -99
  76. package/src/components/bs5/navbar/navbar.functions.js +122 -19
  77. package/src/components/bs5/pageLayout/{ThemeShowcase.stories.js → PaletteShowcase.stories.js} +36 -35
  78. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +24 -28
  79. package/src/components/bs5/searchInput/search.functions.js +93 -76
  80. package/src/components/bs5/searchInput/searchInput.data.json +19 -10
  81. package/src/components/bs5/searchInput/searchInput.hbs +31 -29
  82. package/src/components/bs5/searchInput/searchInput.scss +140 -196
  83. package/src/components/bs5/searchInput/searchInput.stories.js +35 -13
  84. package/src/components/bs5/searchInput/searchInput.test.js +5 -1
  85. package/src/components/bs5/select/Select.js +13 -5
  86. package/src/components/bs5/select/Select.stories.js +27 -83
  87. package/src/components/bs5/select/select.data.json +12 -10
  88. package/src/components/bs5/select/select.hbs +19 -19
  89. package/src/components/bs5/tag/tag--status.stories.js +1 -0
  90. package/src/components/bs5/tag/tag.data.json +149 -143
  91. package/src/components/bs5/tag/tag.hbs +1 -1
  92. package/src/components/bs5/tag/tag.scss +2 -5
  93. package/src/components/bs5/tag/tag.stories.js +1 -0
  94. package/src/components/bs5/textarea/Textarea.js +13 -5
  95. package/src/components/bs5/textarea/Textarea.stories.js +29 -55
  96. package/src/components/bs5/textarea/textarea.data.json +14 -11
  97. package/src/components/bs5/textarea/textarea.hbs +17 -17
  98. package/src/components/bs5/textbox/Textbox.js +16 -5
  99. package/src/components/bs5/textbox/Textbox.stories.js +26 -51
  100. package/src/components/bs5/textbox/textInput.scss +12 -232
  101. package/src/components/bs5/textbox/textbox.data.json +13 -10
  102. package/src/components/bs5/textbox/textbox.hbs +17 -18
  103. package/src/components/bs5/typography/typography.stories.js +1 -1
  104. package/src/css/functions/_index.scss +2 -0
  105. package/src/css/functions/remify.scss +32 -0
  106. package/src/css/functions/snap-line-height.scss +7 -0
  107. package/src/css/main.scss +1 -1
  108. package/src/css/mixins/focusable.scss +4 -1
  109. package/src/css/mixins/make-icon.scss +1 -1
  110. package/src/css/{qld-theme.scss → qld-palettes.scss} +30 -23
  111. package/src/js/handlebars.helpers.js +9 -1
  112. package/src/js/utils.js +142 -0
  113. package/src/components/bs5/formcheck/_formcheck.stories.bak.js +0 -432
@@ -6,6 +6,10 @@ import defaultdata from "./card.data.json";
6
6
 
7
7
  # Cards
8
8
 
9
+ ## Accessibility considerations - heading level
10
+
11
+ Use the field `headingTag` to apply the correct heading level of your card title (h1 should be followed by h2, then h3 etc) and keep the semantic structure of your page correct.
12
+
9
13
  <Canvas of={CardStories.Default} />
10
14
 
11
15
  ## Design resources
@@ -1,5 +1,5 @@
1
1
  // card--icon-list-footer.stories.js
2
- import { Card } from "./Card.js";
2
+ import { Card, argTypes } from "./Card.js";
3
3
  import { Link } from "../link/link.js";
4
4
  import defaultdata from "./card.data.json";
5
5
 
@@ -95,29 +95,7 @@ export default {
95
95
  description:
96
96
  "This card demonstrates the proper nesting of an Icon List component into the Card Footer following the Figma design pattern with 0.75rem gap spacing between links and 12px gap between icons and text.",
97
97
  },
98
- argTypes: {
99
- date: {
100
- control: "text",
101
- },
102
- variantClass: {
103
- control: "select",
104
- options: {
105
- Default: "default",
106
- Light: "light",
107
- Alternative: "alt",
108
- Dark: "dark",
109
- "Dark alternative": "dark-alt",
110
- },
111
- },
112
- action: {
113
- control: "select",
114
- options: {
115
- None: "no",
116
- Single: "single",
117
- Multi: "multi",
118
- },
119
- },
120
- },
98
+ argTypes,
121
99
  parameters: {
122
100
  docs: {
123
101
  description: {
@@ -1,6 +1,6 @@
1
1
  // card--multi-action.stories.js
2
- import { Card } from './Card.js';
3
- import defaultdata from './card.data.json';
2
+ import { Card, argTypes } from "./Card.js";
3
+ import defaultdata from "./card.data.json";
4
4
 
5
5
  // include tags for footer option
6
6
  import { Tag } from "../tag/Tag.js";
@@ -11,14 +11,17 @@ export default {
11
11
  tags: ["autodocs"],
12
12
  title: "3. Components/Card/Multi action",
13
13
  render: (args) => {
14
- const tags = new Tag(tagdata.action).html;
14
+ const tags = new Tag({
15
+ ...tagdata.action,
16
+ classes: "",
17
+ }).html;
15
18
  const cta = new CallToAction({ label: "View all", href: "#" }).html;
16
19
 
17
20
  return `
18
21
  <div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
19
22
  ${new Card(args).html}
20
23
  ${new Card({ ...args, iconClasses: "qld-icon-design", iconPosition: "icon-left", footer: "Footer content" }).html}
21
- ${new Card({ ...args, description: "Card body text lorem ipsum dolor sit amet.", footer: '' }).html}
24
+ ${new Card({ ...args, description: "Card body text lorem ipsum dolor sit amet.", footer: "" }).html}
22
25
  ${new Card({ ...args, footer: tags }).html}
23
26
  ${new Card({ ...args, description: "<ul><li><a href='javascript:void(0)'>Link text</a></li><li><a href='javascript:void(0)'>Link text</a></li><li><a href='javascript:void(0)'>Link text</a></li></ul>", footer: cta }).html}
24
27
  ${new Card({ ...args, iconClasses: "qld-icon-design", iconPosition: "icon-top", footer: "Footer content" }).html}
@@ -35,29 +38,7 @@ export default {
35
38
  `;
36
39
  },
37
40
  args: defaultdata.multiAction,
38
- argTypes: {
39
- date: {
40
- control: "text",
41
- },
42
- variantClass: {
43
- control: "select",
44
- options: {
45
- Default: "default",
46
- Light: "light",
47
- Alternative: "alt",
48
- Dark: "dark",
49
- "Dark alternative": "dark-alt",
50
- },
51
- },
52
- action: {
53
- control: "select",
54
- options: {
55
- None: "no",
56
- Single: "single",
57
- Multi: "multi",
58
- },
59
- },
60
- },
41
+ argTypes,
61
42
  parameters: {
62
43
  docs: {
63
44
  controls: {
@@ -67,7 +48,7 @@ export default {
67
48
  },
68
49
  };
69
50
 
70
- export const Default = { };
51
+ export const Default = {};
71
52
  export const Light = {
72
53
  name: "Light theme",
73
54
  args: {
@@ -1,6 +1,6 @@
1
1
  // card--no-action.stories.js
2
- import { Card } from './Card.js';
3
- import defaultdata from './card.data.json';
2
+ import { Card, argTypes } from "./Card.js";
3
+ import defaultdata from "./card.data.json";
4
4
 
5
5
  export default {
6
6
  tags: ["autodocs"],
@@ -15,7 +15,7 @@ export default {
15
15
  ${new Card({ ...args, iconClasses: "qld-icon-design", iconPosition: "icon-left", footer: "Footer content" }).html}
16
16
  <div class="col" id="placeholder"></div>
17
17
  ${new Card({ ...args, iconClasses: "qld-icon-design", iconPosition: "icon-top" }).html}
18
- ${new Card({ ...args, iconClasses: "qld-icon-design", iconPosition: "icon-top", footer: "Footer content"}).html}
18
+ ${new Card({ ...args, iconClasses: "qld-icon-design", iconPosition: "icon-top", footer: "Footer content" }).html}
19
19
  <div class="col" id="placeholder"></div>
20
20
  ${new Card({ ...args, image: "./assets/img/image-placeholder.png", imageAlt: "A grey placeholder image with an icon in the centre." }).html}
21
21
  ${new Card({ ...args, image: "./assets/img/image-placeholder.png", imageAlt: "A grey placeholder image with an icon in the centre.", footer: "Footer content" }).html}
@@ -23,32 +23,10 @@ export default {
23
23
  `;
24
24
  },
25
25
  args: defaultdata.noAction,
26
- argTypes: {
27
- date: {
28
- control: "text",
29
- },
30
- variantClass: {
31
- control: "select",
32
- options: {
33
- Default: "default",
34
- Light: "light",
35
- Alternative: "alt",
36
- Dark: "dark",
37
- "Dark alternative": "dark-alt",
38
- },
39
- },
40
- action: {
41
- control: "select",
42
- options: {
43
- None: "no",
44
- Single: "single",
45
- Multi: "multi",
46
- },
47
- },
48
- },
26
+ argTypes,
49
27
  };
50
28
 
51
- export const Default = { };
29
+ export const Default = {};
52
30
  export const Light = {
53
31
  name: "Light theme",
54
32
  args: {
@@ -1,6 +1,6 @@
1
1
  // card--single-action.stories.js
2
- import { Card } from './Card.js';
3
- import defaultdata from './card.data.json';
2
+ import { Card, argTypes } from "./Card.js";
3
+ import defaultdata from "./card.data.json";
4
4
 
5
5
  export default {
6
6
  tags: ["autodocs"],
@@ -20,39 +20,10 @@ export default {
20
20
  `;
21
21
  },
22
22
  args: defaultdata.singleAction,
23
- argTypes: {
24
- date: {
25
- control: "text",
26
- },
27
- variantClass: {
28
- control: "select",
29
- options: {
30
- Default: "default",
31
- Light: "light",
32
- Alternative: "alt",
33
- Dark: "dark",
34
- "Dark alternative": "dark-alt",
35
- },
36
- },
37
- action: {
38
- control: "select",
39
- options: {
40
- None: "no",
41
- Single: "single",
42
- Multi: "multi",
43
- },
44
- },
45
- },
46
- parameters: {
47
- docs: {
48
- controls: {
49
- exclude: ["link", "arrow", "iconPosition"],
50
- },
51
- },
52
- },
23
+ argTypes,
53
24
  };
54
25
 
55
- export const Default = { };
26
+ export const Default = {};
56
27
  export const Light = {
57
28
  name: "Light theme",
58
29
  args: {
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "noAction": {
3
3
  "title": "Card title",
4
+ "headingTag": "h3",
4
5
  "description": "Card body text",
5
6
  "date": "",
6
7
  "variantClass": "default",
@@ -20,6 +21,7 @@
20
21
  },
21
22
  "singleAction": {
22
23
  "title": "Card title",
24
+ "headingTag": "h3",
23
25
  "description": "Card body text",
24
26
  "date": "",
25
27
  "variantClass": "default",
@@ -39,6 +41,7 @@
39
41
  },
40
42
  "multiAction": {
41
43
  "title": "Card title",
44
+ "headingTag": "h3",
42
45
  "description": "Card body text <a href='javascript:void(0)'>lorem ipsum</a> dolor sit amet.",
43
46
  "date": "",
44
47
  "variantClass": "default",
@@ -56,4 +59,4 @@
56
59
  "footer": "<ul><li><a href='javascript:void(0)'>Link text</a></li><li><a href='javascript:void(0)'>Link text</a></li><li><a href='javascript:void(0)'>Link text</a></li></ul>",
57
60
  "equalHeight": false
58
61
  }
59
- }
62
+ }
@@ -35,13 +35,13 @@
35
35
  {{#if date}}
36
36
  <div class="card-date">{{date}}</div>
37
37
  {{/if}}
38
- <h3 class="card-title">
38
+ <{{isdefined headingTag 'h3'}} class="card-title">
39
39
  {{#if link}}
40
40
  <a href="{{link}}" {{#ifCond action '===' 'single'}}class="stretched-link"{{/ifCond}}>{{title}}</a>
41
41
  {{else}}
42
42
  {{ title }}
43
43
  {{/if }}
44
- </h3>
44
+ </{{isdefined headingTag 'h3'}}>
45
45
  {{#if description}}
46
46
  <div class="card-text">
47
47
  {{{description}}}
@@ -1,10 +1,9 @@
1
- import Component from '../../../js/QGDSComponent.js'
1
+ import Component from "../../../js/QGDSComponent.js";
2
2
  import template from "./dateinput.hbs?raw";
3
3
 
4
4
  export class Dateinput {
5
-
6
5
  // Use the global Component class to create a new instance of the Date input component.
7
- // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
6
+ // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
8
7
 
9
8
  constructor(data = {}) {
10
9
  var component = new Component(template, data);
@@ -13,26 +12,32 @@ export class Dateinput {
13
12
  }
14
13
 
15
14
  dateInputs() {
16
- let elements = document.querySelectorAll(".dayinput, .monthinput, .yearinput");
15
+ let elements = document.querySelectorAll(
16
+ ".dayinput, .monthinput, .yearinput",
17
+ );
17
18
 
18
19
  Array.from(elements).forEach(function (element) {
19
- element.addEventListener('keyup', function () {
20
+ element.addEventListener("keyup", function () {
20
21
  const input = event.currentTarget;
21
22
  let max = 0;
22
23
  if (input.value) {
23
- if (input.classList.contains('dayinput')) {
24
+ if (input.classList.contains("dayinput")) {
24
25
  max = 31;
25
- } else if (input.classList.contains('monthinput')) {
26
+ } else if (input.classList.contains("monthinput")) {
26
27
  max = 12;
27
- } if (input.classList.contains('yearinput')) {
28
+ }
29
+ if (input.classList.contains("yearinput")) {
28
30
  max = 2030;
29
31
  }
30
32
  if (!parseInt(input.value)) {
31
- input.classList.add('qld-input-error');
33
+ input.classList.add("qld-input-error");
32
34
  input.blur();
33
35
  } else {
34
- if ((parseInt(input.value)) > max && !input.classList.contains('qld-input-error')) {
35
- input.classList.add('qld-input-error');
36
+ if (
37
+ parseInt(input.value) > max &&
38
+ !input.classList.contains("qld-input-error")
39
+ ) {
40
+ input.classList.add("qld-input-error");
36
41
  input.blur();
37
42
  }
38
43
  }
@@ -41,3 +46,13 @@ export class Dateinput {
41
46
  });
42
47
  }
43
48
  }
49
+
50
+ export const argTypes = {
51
+ isValid: {
52
+ description:
53
+ "For server-side validation, set to true or false. Omit or set to null to to indicate the input is yet to be validated.",
54
+ control: "radio",
55
+ options: [true, false, null],
56
+ type: "boolean | null",
57
+ },
58
+ };
@@ -1,14 +1,16 @@
1
1
  {
2
- "isDisabled": false,
3
- "isRequired": true,
4
- "isFilled": false,
5
- "customClass": "",
6
- "label-text": "Date label",
7
- "day-placeholder": "DD",
8
- "month-placeholder": "MM",
9
- "year-placeholder": "YYYY",
10
- "optional-text": "optional",
11
- "hint-text": "(dd/mm/yyyy)",
12
- "successMessageText": "Success message",
13
- "errorMessageText": "Error message"
2
+ "id": "example-1",
3
+ "isDisabled": false,
4
+ "isRequired": true,
5
+ "isValid": null,
6
+ "isFilled": false,
7
+ "customClass": "",
8
+ "label-text": "Date label",
9
+ "day-placeholder": "DD",
10
+ "month-placeholder": "MM",
11
+ "year-placeholder": "YYYY",
12
+ "optional-text": "optional",
13
+ "hint-text": "(dd/mm/yyyy)",
14
+ "successMessageText": "Success message",
15
+ "errorMessageText": "Error message"
14
16
  }
@@ -1,64 +1,64 @@
1
1
  <!-- QGDS Component: Date input -->
2
2
 
3
- <!-- Label -->
4
- <label id="dategroup-label"
3
+ <label id="{{id}}-label"
5
4
  class="qld-text-input-label {{#if isRequired}}field-required{{/if}} {{#if isDisabled}}field-disabled{{/if}}"
6
- for="example-1">
5
+ for="{{id}}">
7
6
  {{label-text}}
8
7
  {{#if optional-text}}
9
8
  <span class="label-text-optional">({{optional-text}})</span>
10
9
  {{/if}}
11
10
  </label>
12
11
 
13
- <!-- Hint text -->
14
12
  {{#if hint-text}}
15
- <span class="qld-hint-text" id="example-1-hint">{{hint-text}}</span>
13
+ <span class="qld-hint-text" id="{{id}}-hint">{{hint-text}}</span>
16
14
  {{/if}}
17
15
 
18
- {{#contains "qld-input-success" customClass}}
19
- <span id="text-field-success" class="qld-input-success">
20
- {{successMessageText}}
21
- </span>
22
- {{/contains}}
16
+ {{#contains "qld-input-success" customClass}}{{! legacy support for feedback classes `qld-input-success`}}
17
+ <span class="qld-input-success">{{successMessageText}}</span>
18
+ {{else}}
19
+ {{#if successMessageText}}{{! updated bootstrap style classes - `valid-feedback`}}
20
+ <div class="valid-feedback">{{successMessageText}}</div>
21
+ {{/if}}{{/contains}}
23
22
 
24
- {{#contains "qld-input-error" customClass}}
25
- <span id="text-field-error" class="qld-input-error">
26
- {{errorMessageText}}
27
- </span>
28
- {{/contains}}
23
+ {{#contains "qld-input-error" customClass}}{{! legacy support for feedback classes `qld-input-error`}}
24
+ <span class="qld-input-error">{{errorMessageText}}</span>
25
+ {{else}}
26
+ {{#if errorMessageText}}{{! updated bootstrap style classes - `invalid-feedback`}}
27
+ <div class="invalid-feedback">{{errorMessageText}}</div>
28
+ {{/if}}{{/contains}}
29
29
 
30
- <div aria-labelledby="dategroup-label" role="group" class="row date-container {{customClass}}">
30
+ <div aria-labelledby="{{id}}-label" role="group" class="row date-container {{customClass}}">
31
31
  <!-- day group -->
32
32
  <div class="day-group">
33
- <label for="dayinput" class="date-label qld-text-input-label">Day</label>
33
+ <label id="{{id}}-dayinput-label" for="{{id}}-dayinput" class="date-label qld-text-input-label">Day</label>
34
34
  <div>
35
- <input aria-required="true" aria-labelledby="dategroup-label" placeholder="{{day-placeholder}}" type="text"
35
+ <input id="{{id}}-dayinput" aria-required="true" aria-labelledby="{{id}}-label {{id}}-dayinput-label" placeholder="{{day-placeholder}}" type="text"
36
36
  inputmode="numeric" maxlength="2"
37
- class="qld-text-input form-control dayinput {{customClass}} {{#if isFilled}}form-style-filled{{/if}}" id="dayinput" ref="day"
37
+ class="qld-text-input form-control dayinput {{customClass}} {{#if isFilled}}form-style-filled{{/if}} {{#if isValid}}is-valid{{else}}{{#ifCond isValid "===" false}}is-invalid{{/ifCond}}{{/if}}" ref="day"
38
38
  aria-invalid="false" {{#if isDisabled}}disabled{{/if}} {{#if isRequired}}required aria-required="true"
39
39
  {{/if}}>
40
40
  </div>
41
41
  </div>
42
42
  <!-- month group -->
43
43
  <div class="date-group">
44
- <label for="monthinput" class="date-label qld-text-input-label">Month</label>
44
+ <label id="{{id}}-monthinput-label" for="{{id}}-monthinput" class="date-label qld-text-input-label">Month</label>
45
45
  <div>
46
- <input aria-required="true" aria-labelledby="dategroup-label" placeholder="{{month-placeholder}}"
46
+ <input id="{{id}}-monthinput" aria-required="true" aria-labelledby="{{id}}-label {{id}}-monthinput-label" placeholder="{{month-placeholder}}"
47
47
  type="text" inputmode="numeric" maxlength="2"
48
- class="qld-text-input form-control monthinput {{customClass}} {{#if isFilled}}form-style-filled{{/if}}" id="monthinput" ref="month"
48
+ class="qld-text-input form-control monthinput {{customClass}} {{#if isFilled}}form-style-filled{{/if}} {{#if isValid}}is-valid{{else}}{{#ifCond isValid "===" false}}is-invalid{{/ifCond}}{{/if}}" ref="month"
49
49
  aria-invalid="false" {{#if isDisabled}}disabled{{/if}} {{#if isRequired}}required aria-required="true"
50
50
  {{/if}}>
51
51
  </div>
52
52
  </div>
53
53
  <!-- year group -->
54
54
  <div class="date-group">
55
- <label for="yearinput" class="date-label">Year</label>
55
+ <label id="{{id}}-yearinput-label" for="{{id}}-yearinput" class="date-label">Year</label>
56
56
  <div class="year-label">
57
- <input aria-required="true" aria-labelledby="dategroup-label qld-text-input-label"
57
+ <input id="{{id}}-yearinput" aria-required="true" aria-labelledby="{{id}}-label {{id}}-yearinput-label"
58
58
  placeholder="{{year-placeholder}}" type="text" inputmode="numeric" maxlength="4"
59
- class="qld-text-input form-control yearinput {{customClass}} {{#if isFilled}}form-style-filled{{/if}}"
60
- id="yearinput" ref="year" aria-invalid="false" {{#if isDisabled}}disabled{{/if}} {{#if
61
- isRequired}}required aria-required="true" {{/if}}>
59
+ class="qld-text-input form-control yearinput {{customClass}} {{#if isFilled}}form-style-filled{{/if}} {{#if isValid}}is-valid{{else}}{{#ifCond isValid "===" false}}is-invalid{{/ifCond}}{{/if}}"
60
+ ref="year" aria-invalid="false" {{#if isDisabled}}disabled{{/if}} {{#if
61
+ isRequired}}required{{/if}}>
62
62
  </div>
63
63
  </div>
64
64
  </div>
@@ -141,7 +141,7 @@
141
141
  border-color: $qld-textbox-border-color;
142
142
  }
143
143
  &:focus {
144
- outline: 3px solid var(--#{$prefix}light-blue);
144
+ outline: 3px solid var(--#{$prefix}focus-color);
145
145
  outline-offset: 2px;
146
146
  background-color: var(--#{$prefix}white);
147
147
  border: 2px solid var(--#{$prefix}light-grey);
@@ -157,7 +157,7 @@
157
157
  box-shadow: none; // Overrides Bootstrap5 styling for invalid input.
158
158
 
159
159
  &:focus {
160
- outline: 3px solid var(--#{$prefix}light-blue);
160
+ outline: 3px solid var(--#{$prefix}focus-color);
161
161
  }
162
162
  }
163
163
  }
@@ -255,7 +255,7 @@
255
255
  outline: none;
256
256
 
257
257
  &:focus {
258
- outline: 3px solid var(--#{$prefix}light-blue);
258
+ outline: 3px solid var(--#{$prefix}focus-color);
259
259
  outline-offset: 3px;
260
260
  }
261
261
  }
@@ -273,7 +273,7 @@
273
273
  border-color: $qld-textbox-border-color;
274
274
  }
275
275
  &:focus {
276
- outline: 3px solid var(--#{$prefix}light-blue);
276
+ outline: 3px solid var(--#{$prefix}focus-color);
277
277
  outline-offset: 2px;
278
278
  background-color: var(--#{$prefix}white);
279
279
  border: 2px solid var(--#{$prefix}light-grey);
@@ -289,7 +289,7 @@
289
289
  box-shadow: none; // Overrides Bootstrap5 styling for invalid input.
290
290
 
291
291
  &:focus {
292
- outline: 3px solid var(--#{$prefix}light-blue);
292
+ outline: 3px solid var(--#{$prefix}focus-color);
293
293
  }
294
294
  }
295
295
 
@@ -1,13 +1,64 @@
1
- import Component from '../../../js/QGDSComponent.js'
1
+ import Component from "../../../js/QGDSComponent.js";
2
2
  import template from "./formcheck.hbs?raw";
3
3
 
4
4
  export class Formcheck {
5
-
6
5
  // Use the global Component class to create a new instance of the Breadcrumbs component.
7
- // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
8
-
9
- constructor( data = {} ) {
6
+ // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
7
+
8
+ constructor(data = {}) {
10
9
  return new Component(template, data);
11
10
  }
12
-
13
11
  }
12
+
13
+ /**
14
+ * argTypes is used to render component parameters in storybook.
15
+ */
16
+ export const argTypes = {
17
+ questionLabel: {
18
+ type: "string",
19
+ description: `The heading label for the for the set of checks/radios.`,
20
+ },
21
+ optionalLabel: {
22
+ type: "string",
23
+ description: "Additional text used to denote an optional field.",
24
+ },
25
+ hintLabel: {
26
+ type: "string",
27
+ description:
28
+ "Extra informational text which can be used to give the input more context.",
29
+ },
30
+ listClasses: {
31
+ type: "string",
32
+ description: "CSS class names to be added to the topmost element.",
33
+ },
34
+ successMessageText: {
35
+ type: "string",
36
+ description:
37
+ "Informational text which appears when the input passes validation, or if `isValid` is true.",
38
+ },
39
+ errorMessageText: {
40
+ type: "string",
41
+ description:
42
+ "Informational text which appears when the input fails validation, or if `isValid` is false.",
43
+ },
44
+ type: {
45
+ type: "string",
46
+ options: ["checkbox", "radio"],
47
+ control: "radio",
48
+ description:
49
+ "The type of input. This will override any value of `type` set on the listItems themselves.",
50
+ table: {
51
+ defaultValue: { summary: "checkbox" },
52
+ },
53
+ },
54
+ isValid: {
55
+ options: [null, true, false],
56
+ type: "boolean | null",
57
+ control: "radio",
58
+ description:
59
+ "Should be set only when the input is to be validated server-side. Adds class `is-valid` or `is-invalid` to the form control. For client-side validation.",
60
+ },
61
+ listitems: {
62
+ description: "An array which represents the input set.",
63
+ },
64
+ };