@qld-gov-au/qgds-bootstrap5 2.0.11 → 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 (119) hide show
  1. package/.esbuild/plugins/qgds-plugin-generate-icon-assets.js +31 -24
  2. package/.storybook/preview.js +5 -2
  3. package/dist/assets/components/bs5/button/button.hbs +1 -1
  4. package/dist/assets/components/bs5/dateinput/dateinput.hbs +27 -27
  5. package/dist/assets/components/bs5/footer/customLinks.hbs +1 -1
  6. package/dist/assets/components/bs5/footer/followLinks.hbs +1 -1
  7. package/dist/assets/components/bs5/formcheck/formcheck.hbs +10 -2
  8. package/dist/assets/components/bs5/head/head.hbs +1 -1
  9. package/dist/assets/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
  10. package/dist/assets/components/bs5/searchInput/searchInput.hbs +35 -31
  11. package/dist/assets/components/bs5/select/select.hbs +19 -19
  12. package/dist/assets/components/bs5/textarea/textarea.hbs +17 -17
  13. package/dist/assets/components/bs5/textbox/textbox.hbs +17 -18
  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/img/icons-sprite.svg +24 -24
  19. package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
  20. package/dist/assets/js/handlebars.init.min.js +159 -140
  21. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  22. package/dist/assets/js/handlebars.partials.js +159 -140
  23. package/dist/assets/js/handlebars.partials.js.map +2 -2
  24. package/dist/assets/js/qld.bootstrap.min.js +9 -10
  25. package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
  26. package/dist/assets/node/handlebars.init.min.js +57 -11
  27. package/dist/assets/node/handlebars.init.min.js.map +2 -2
  28. package/dist/components/bs5/button/button.hbs +1 -1
  29. package/dist/components/bs5/dateinput/dateinput.hbs +27 -27
  30. package/dist/components/bs5/footer/customLinks.hbs +1 -1
  31. package/dist/components/bs5/footer/followLinks.hbs +1 -1
  32. package/dist/components/bs5/formcheck/formcheck.hbs +10 -2
  33. package/dist/components/bs5/head/head.hbs +1 -1
  34. package/dist/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
  35. package/dist/components/bs5/searchInput/searchInput.hbs +35 -31
  36. package/dist/components/bs5/select/select.hbs +19 -19
  37. package/dist/components/bs5/textarea/textarea.hbs +17 -17
  38. package/dist/components/bs5/textbox/textbox.hbs +17 -18
  39. package/dist/package.json +1 -1
  40. package/dist/sample-data/dateinput/dateinput.data.json +14 -12
  41. package/dist/sample-data/footer/footer.data.json +3 -0
  42. package/dist/sample-data/formcheck/stories/checkbox/checkbox.data.json +4 -5
  43. package/dist/sample-data/formcheck/stories/radio/radio.data.json +4 -4
  44. package/dist/sample-data/inpageAlert/inpageAlert.data.json +1 -1
  45. package/dist/sample-data/searchInput/searchInput.data.json +20 -10
  46. package/dist/sample-data/select/select.data.json +12 -10
  47. package/dist/sample-data/textarea/textarea.data.json +14 -11
  48. package/dist/sample-data/textbox/textbox.data.json +13 -10
  49. package/package.json +1 -1
  50. package/src/components/bs5/breadcrumbs/breadcrumbs.scss +3 -4
  51. package/src/components/bs5/button/Button.js +32 -6
  52. package/src/components/bs5/button/button.hbs +1 -1
  53. package/src/components/bs5/button/button.scss +0 -5
  54. package/src/components/bs5/card/card.scss +2 -0
  55. package/src/components/bs5/dateinput/Dateinput.js +26 -11
  56. package/src/components/bs5/dateinput/dateinput.data.json +14 -12
  57. package/src/components/bs5/dateinput/dateinput.hbs +27 -27
  58. package/src/components/bs5/footer/customLinks.hbs +1 -1
  59. package/src/components/bs5/footer/followLinks.hbs +1 -1
  60. package/src/components/bs5/footer/footer.data.json +3 -0
  61. package/src/components/bs5/formcheck/Formcheck.js +57 -6
  62. package/src/components/bs5/formcheck/_form-variables.scss +167 -0
  63. package/src/components/bs5/formcheck/formcheck.hbs +10 -2
  64. package/src/components/bs5/formcheck/formcheck.scss +268 -65
  65. package/src/components/bs5/formcheck/stories/bootstrap-validation/bootstrap-validation.stories.js +304 -0
  66. package/src/components/bs5/formcheck/stories/checkbox/checkbox.data.json +4 -5
  67. package/src/components/bs5/formcheck/stories/checkbox/checkbox.stories.js +19 -111
  68. package/src/components/bs5/formcheck/stories/radio/radio.data.json +4 -4
  69. package/src/components/bs5/formcheck/stories/radio/radio.stories.js +30 -122
  70. package/src/components/bs5/header/header.scss +1 -2
  71. package/src/components/bs5/icons/_icons.list.js +7 -7
  72. package/src/components/bs5/icons/_icons.list.scss +113 -112
  73. package/src/components/bs5/icons/_icons.variables.scss +7 -6
  74. package/src/components/bs5/icons/icons.scss +2 -1
  75. package/src/components/bs5/inpageAlert/inpageAlert.data.json +1 -1
  76. package/src/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
  77. package/src/components/bs5/inpageAlert/inpageAlert.scss +50 -52
  78. package/src/components/bs5/inpageAlert/inpageAlert.stories.js +54 -3
  79. package/src/components/bs5/pageLayout/{ThemeShowcase.stories.js → PaletteShowcase.stories.js} +40 -38
  80. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +25 -29
  81. package/src/components/bs5/searchInput/search.functions.js +120 -108
  82. package/src/components/bs5/searchInput/searchInput.data.json +20 -10
  83. package/src/components/bs5/searchInput/searchInput.hbs +35 -31
  84. package/src/components/bs5/searchInput/searchInput.scss +193 -196
  85. package/src/components/bs5/searchInput/searchInput.stories.js +35 -13
  86. package/src/components/bs5/searchInput/searchInput.test.js +96 -120
  87. package/src/components/bs5/select/Select.js +13 -5
  88. package/src/components/bs5/select/Select.stories.js +27 -83
  89. package/src/components/bs5/select/select.data.json +12 -10
  90. package/src/components/bs5/select/select.hbs +19 -19
  91. package/src/components/bs5/skiplinks/skipLinks.scss +12 -4
  92. package/src/components/bs5/textarea/Textarea.js +13 -5
  93. package/src/components/bs5/textarea/Textarea.stories.js +29 -55
  94. package/src/components/bs5/textarea/textarea.data.json +14 -11
  95. package/src/components/bs5/textarea/textarea.hbs +17 -17
  96. package/src/components/bs5/textbox/Textbox.js +16 -5
  97. package/src/components/bs5/textbox/Textbox.stories.js +26 -51
  98. package/src/components/bs5/textbox/textInput.scss +12 -232
  99. package/src/components/bs5/textbox/textbox.data.json +13 -10
  100. package/src/components/bs5/textbox/textbox.hbs +17 -18
  101. package/src/components/common/focus-styles/focusStyles.mdx +20 -0
  102. package/src/components/common/focus-styles/focusStyles.stories.js +58 -0
  103. package/src/css/functions/_index.scss +5 -0
  104. package/src/css/functions/color-icon.scss +31 -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/functions/string-replace.scss +49 -0
  108. package/src/css/functions/svg-encode.scss +22 -0
  109. package/src/css/main.scss +1 -1
  110. package/src/css/mixins/focusable.scss +3 -0
  111. package/src/css/mixins/make-icon.scss +1 -1
  112. package/src/css/mixins/make-link.scss +13 -10
  113. package/src/css/{qld-theme.scss → qld-palettes.scss} +50 -35
  114. package/src/css/qld-type.scss +5 -1
  115. package/src/css/qld-utilities.scss +9 -1
  116. package/src/css/qld-variables.scss +1 -1
  117. package/src/img/icons-sprite.svg +24 -24
  118. package/src/js/qld.bootstrap.js +3 -55
  119. package/src/components/bs5/formcheck/_formcheck.stories.bak.js +0 -432
@@ -1,12 +1,14 @@
1
1
  {
2
- "isDisabled": false,
3
- "isRequired": true,
4
- "isFilled": false,
5
- "customClass": "",
6
- "label-text": "Label",
7
- "placeholder": "Please select",
8
- "optional-text": "optional",
9
- "hint-text": "Hint",
10
- "successMessageText": "Success message",
11
- "errorMessageText": "Error message"
2
+ "id": "example-1",
3
+ "isDisabled": false,
4
+ "isRequired": true,
5
+ "isFilled": false,
6
+ "isValid": null,
7
+ "customClass": "",
8
+ "label-text": "Label",
9
+ "placeholder": "Please select",
10
+ "optional-text": "optional",
11
+ "hint-text": "Hint",
12
+ "successMessageText": "Success message",
13
+ "errorMessageText": "Error message"
12
14
  }
@@ -1,13 +1,16 @@
1
1
  {
2
- "isDisabled": false,
3
- "isRequired": true,
4
- "isFilled": false,
5
- "customClass": "",
6
- "rows": 3,
7
- "label-text": "Label",
8
- "placeholder": "Leave a comment here",
9
- "optional-text": "optional",
10
- "hint-text": "Hint",
11
- "successMessageText": "Success message",
12
- "errorMessageText": "Error message"
2
+ "id": "example-1",
3
+ "value": "",
4
+ "isDisabled": false,
5
+ "isRequired": true,
6
+ "isValid": null,
7
+ "isFilled": false,
8
+ "customClass": "",
9
+ "rows": 3,
10
+ "label-text": "Label",
11
+ "placeholder": "",
12
+ "optional-text": "optional",
13
+ "hint-text": "Hint",
14
+ "successMessageText": "Success message",
15
+ "errorMessageText": "Error message"
13
16
  }
@@ -1,12 +1,15 @@
1
1
  {
2
- "isDisabled": false,
3
- "isRequired": true,
4
- "isFilled": false,
5
- "customClass": "",
6
- "label-text": "Label",
7
- "placeholder": "Hello World",
8
- "optional-text": "optional",
9
- "hint-text": "Hint",
10
- "successMessageText": "Success message",
11
- "errorMessageText": "Error message"
2
+ "id": "example-1",
3
+ "value": "",
4
+ "isDisabled": false,
5
+ "isRequired": true,
6
+ "isValid": null,
7
+ "isFilled": false,
8
+ "customClass": "",
9
+ "label-text": "Label",
10
+ "placeholder": "",
11
+ "optional-text": "optional",
12
+ "hint-text": "Hint",
13
+ "successMessageText": "Success message",
14
+ "errorMessageText": "Error message"
12
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qld-gov-au/qgds-bootstrap5",
3
- "version": "2.0.11",
3
+ "version": "2.1.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -85,10 +85,9 @@ $expander-icon-color: $qld-light-link;
85
85
  );
86
86
  background-color: $core-default-color-neutral-lighter;
87
87
  }
88
- @include m.focusable($offsetOutline: 3px);
89
- &:focus {
90
- outline-offset: -3px;
91
- }
88
+
89
+ --qld-focus-color: var(--qld-light-focus);
90
+ @include m.focusable($offsetOutline: -6px);
92
91
  }
93
92
  }
94
93
  .breadcrumb-collapse-wrapper {
@@ -1,13 +1,39 @@
1
- import Component from '../../../js/QGDSComponent.js'
1
+ import Component from "../../../js/QGDSComponent.js";
2
2
  import template from "./button.hbs?raw";
3
+ import data from "./button.data.json";
3
4
 
4
- export class Button {
5
+ /**
6
+ * @typedef {Object} ButtonArgs
7
+ * @prop {"btn-primary" | "btn-secondary" | "btn-tertiary" } variantClass
8
+ * @prop {string} label The label description
9
+ * @prop {string} [onclick]
10
+ * @prop {boolean} [islink]
11
+ * @prop {boolean} [isdisabled]
12
+ * @prop {boolean} [isProgress]
13
+ * @prop {string} [progressLabel]
14
+ * @prop {string} [iconClass]
15
+ * @prop {"leading" | "trailing"} [iconPosition]
16
+ * @prop {string} [href]
17
+ * @prop {"_blank" | "_self" | "_parent" | "_top" | "_unfencedTop" } [target]
18
+ */
19
+
20
+ /** @type {ButtonArgs}*/
21
+ export const defaultArgs = {
22
+ ...data,
23
+ onclick: "() => false",
24
+ islink: false,
25
+ href: "#",
26
+ target: null,
27
+ };
5
28
 
29
+ export class Button {
6
30
  // Use the global Component class to create a new instance of the Button component.
7
- // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
8
-
9
- constructor( data = {} ) {
31
+ // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
32
+ /**
33
+ *
34
+ * @param {ButtonArgs} data
35
+ */
36
+ constructor(data = defaultArgs) {
10
37
  return new Component(template, data);
11
38
  }
12
-
13
39
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  {{#unless islink}}
12
12
 
13
- <button class="btn {{variantClass}} {{#if isprogress}}btn-progress{{/if}} {{label}}" onclick="{{{onclick}}}" {{#if isdisabled}}disabled{{/if}} {{#if isprogress}}disabled aria-live="polite"{{/if}} {{#if arialabel}}aria-label="{{arialabel}}"{{/if}} {{{dataatts}}} {{#if progressLabel}}data-progress-label="{{progressLabel}}"{{/if}}>
13
+ <button class="btn {{variantClass}} {{#if isprogress}}btn-progress{{/if}}" onclick="{{{onclick}}}" {{#if isdisabled}}disabled{{/if}} {{#if isprogress}}disabled aria-live="polite"{{/if}} {{#if arialabel}}aria-label="{{arialabel}}"{{/if}} {{{dataatts}}} {{#if progressLabel}}data-progress-label="{{progressLabel}}"{{/if}}>
14
14
  {{#if isprogress}}
15
15
  {{~>progressSpinner~}}
16
16
  {{else}}
@@ -340,11 +340,6 @@ a.btn,
340
340
  }
341
341
  }
342
342
 
343
- &:focus {
344
- outline: var(--#{$prefix}dark-focus) solid 3px;
345
- outline-offset: 2px;
346
- }
347
-
348
343
  // Progress state focus for dark mode
349
344
  &.btn-progress:focus {
350
345
  outline: var(--#{$prefix}dark-focus) solid 3px;
@@ -303,6 +303,8 @@
303
303
  a {
304
304
  color: var(--#{$prefix}card-link-color);
305
305
  text-decoration-color: var(--#{$prefix}card-link-color);
306
+ outline-style: none;
307
+
306
308
  &:visited,
307
309
  &:hover,
308
310
  &:visited:hover {
@@ -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>
@@ -1,5 +1,5 @@
1
1
  {{#if customLinks }}
2
- <ul class="nav footer-link-list footer-link-list--custom flex-column">
2
+ <ul class="nav footer-link-list footer-link-list--custom flex-column">
3
3
  {{#each customLinks }}
4
4
  <li><a class="nav-link" href="{{ link }}" {{#if target }} target="_blank" {{/if}}>{{ label }}</a></li>
5
5
  {{/each }}
@@ -6,7 +6,7 @@
6
6
  <span class="qld-icon qld-icon-md qld-icon-{{icon}} d-lg-none" aria-hidden="true"></span>
7
7
  <span class="qld-icon qld-icon-sm qld-icon-{{icon}} d-none d-lg-block" aria-hidden="true"></span>
8
8
  <span class="nav-link-label d-none d-lg-block">{{ label }}</span>
9
- <span class="sr-only">{{ label }}</span>
9
+ <span class="sr-only">{{isdefined accessibleLabel label}}</span>
10
10
  </a>
11
11
  </li>
12
12
  {{/each }}
@@ -61,18 +61,21 @@
61
61
  "followLinks": [
62
62
  {
63
63
  "label": "Facebook",
64
+ "accessibleLabel": "Facebook page",
64
65
  "link": "#",
65
66
  "icon": "facebook",
66
67
  "target": "_blank"
67
68
  },
68
69
  {
69
70
  "label": "LinkedIn",
71
+ "accessibleLabel": "LinkedIn page",
70
72
  "link": "#",
71
73
  "icon": "linkedin",
72
74
  "target": "_blank"
73
75
  },
74
76
  {
75
77
  "label": "X (Twitter)",
78
+ "accessibleLabel": "X page",
76
79
  "link": "#",
77
80
  "icon": "x",
78
81
  "target": "_blank"
@@ -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
+ };
@@ -0,0 +1,167 @@
1
+ // Expand this file with all themable shared form variables
2
+ // @extend %form-variables in all input and form components.
3
+ @use "../../../css/functions" as f;
4
+
5
+ /// Custom colored icons for dropdown chevron in all states.
6
+ /// Select input cannot use ::before or ::after so need a svg cbackground image via url(data);
7
+ @function _dropdown-icon($color) {
8
+ @return url(f.svg-encode(f.color-icon("chevron-down", $color)));
9
+ }
10
+
11
+ %form-control-variables {
12
+ &,
13
+ .default &,
14
+ .light &,
15
+ .alt & {
16
+ // colors
17
+ --#{$prefix}bg: #{$core-default-color-neutral-white};
18
+ --#{$prefix}bg-hover: #{$core-default-color-neutral-lightest};
19
+ --#{$prefix}bg-focus: #{$core-default-color-neutral-white};
20
+ --#{$prefix}border-color: #{$color-default-color-light-border-alt};
21
+ --#{$prefix}border-color-hover: #{$qld-light-action-primary-hover};
22
+ --#{$prefix}border-color-focus: #{$core-default-color-neutral-lighter};
23
+ --#{$prefix}color: #{$color-default-color-light-text-default};
24
+ --#{$prefix}color-hover: var(--#{$prefix}color);
25
+ --#{$prefix}color-focus: var(--#{$prefix}color);
26
+ --#{$prefix}placeholder-color: #{$color-default-color-light-text-lighter};
27
+ --#{$prefix}placeholder-color-hover: var(--#{$prefix}placeholder-color);
28
+ --#{$prefix}placeholder-color-focus: var(--#{$prefix}placeholder-color);
29
+
30
+ // other properties
31
+ --#{$prefix}border-top-width: 0.125rem;
32
+ --#{$prefix}border-right-width: 0.125rem;
33
+ --#{$prefix}border-bottom-width: 0.125rem;
34
+ --#{$prefix}border-left-width: 0.125rem;
35
+ --#{$prefix}border-width: var(--#{$prefix}border-top-width)
36
+ var(--#{$prefix}border-right-width) var(--#{$prefix}border-bottom-width)
37
+ var(--#{$prefix}border-left-width);
38
+ --#{$prefix}border-radius: 0.25rem;
39
+
40
+ // .form-style-filled legacy class
41
+ &.is-filled,
42
+ &.form-style-filled {
43
+ --#{$prefix}bg: #{$core-default-color-neutral-lightest};
44
+ --#{$prefix}border-radius: 0.25rem 0.25rem 0 0;
45
+ --#{$prefix}border-top-width: 0px; // px unit required for use in calc()
46
+ --#{$prefix}border-right-width: 0px; // px unit required for use in calc()
47
+ --#{$prefix}border-left-width: 0px; // px unit required for use in calc()
48
+
49
+ &:focus {
50
+ --#{$prefix}border-top-width: 0.125rem;
51
+ --#{$prefix}border-right-width: 0.125rem;
52
+ --#{$prefix}border-left-width: 0.125rem;
53
+ --#{$prefix}border-radius: 0.25rem;
54
+ }
55
+ }
56
+
57
+ // .qld-input-success legacy class
58
+ &.is-valid,
59
+ &.qld-input-success,
60
+ .was-validated &:valid {
61
+ --#{$prefix}bg: #{$core-default-color-status-success-lightest};
62
+ --#{$prefix}bg-hover: #{$core-default-color-status-success-lighter};
63
+ --#{$prefix}border-color: #{$core-default-color-status-success-default};
64
+ --#{$prefix}border-color-hover: var(--#{$prefix}border-color);
65
+ }
66
+
67
+ // .qld-input-error legacy class
68
+ &.is-invalid,
69
+ &.qld-input-error,
70
+ .was-validated &:invalid {
71
+ --#{$prefix}bg: #{$qld-color-error-light};
72
+ --#{$prefix}bg-hover: #{$core-default-color-status-error-lighter};
73
+ --#{$prefix}border-color: #{$qld-notify-warning};
74
+ --#{$prefix}border-color-hover: var(--#{$prefix}border-color);
75
+ }
76
+ }
77
+
78
+ .dark &,
79
+ .dark-alt & {
80
+ --#{$prefix}bg: #{$qld-color-dark-background};
81
+ --#{$prefix}bg-hover: #{$qld-color-dark-background--shade};
82
+ --#{$prefix}border-color: #{$color-default-color-dark-border-alt};
83
+ --#{$prefix}border-color-hover: #{$color-default-color-dark-action-primary-hover};
84
+ --#{$prefix}border-color-focus: #{$core-default-color-neutral-lighter};
85
+ --#{$prefix}color: #{$color-default-color-dark-text-default};
86
+ --#{$prefix}color-focus: #{$color-default-color-light-text-lighter};
87
+ --#{$prefix}placeholder-color: #{$color-default-color-dark-text-lighter};
88
+ --#{$prefix}placeholder-color-focus: #{$color-default-color-light-text-lighter};
89
+
90
+ &.is-filled,
91
+ &.form-style-filled {
92
+ --#{$prefix}bg: #{$qld-color-dark-background--shade};
93
+ }
94
+
95
+ &.is-valid,
96
+ &.qld-input-success,
97
+ .was-validated &:valid {
98
+ --#{$prefix}bg: #{$core-default-color-status-success-lightest};
99
+ --#{$prefix}bg-hover: #{$core-default-color-status-success-lighter};
100
+ --#{$prefix}border-color: #{$core-default-color-status-success-default};
101
+ --#{$prefix}border-color-hover: #{$core-default-color-status-success-default};
102
+ --#{$prefix}color: #{$color-default-color-light-text-default};
103
+ --#{$prefix}placeholder-color: #{$color-default-color-light-text-lighter};
104
+ }
105
+
106
+ &.is-invalid,
107
+ &.qld-input-error,
108
+ .was-validated &:invalid {
109
+ --#{$prefix}bg: #{$qld-color-error-light};
110
+ --#{$prefix}bg-hover: #{$core-default-color-status-error-lighter};
111
+ --#{$prefix}border-color: #{$qld-notify-warning};
112
+ --#{$prefix}border-color-hover: #{$qld-notify-warning};
113
+ --#{$prefix}color: #{$color-default-color-light-text-default};
114
+ --#{$prefix}placeholder-color: #{$color-default-color-light-text-lighter};
115
+ }
116
+ }
117
+ }
118
+
119
+ %form-select-variables {
120
+ &,
121
+ .default &,
122
+ .light &,
123
+ .alt & {
124
+ --#{$prefix}icon-url: #{_dropdown-icon($qld-light-action-secondary)};
125
+ --#{$prefix}icon-hover-url: #{_dropdown-icon(
126
+ $qld-light-action-secondary-hover
127
+ )};
128
+ --#{$prefix}icon-disabled-url: #{_dropdown-icon(
129
+ $color-default-color-light-text-lighter
130
+ )};
131
+ --#{$prefix}icon-error-url: #{_dropdown-icon($qld-notify-warning)};
132
+ --#{$prefix}icon-success-url: #{_dropdown-icon($qld-notify-success)};
133
+ --#{$prefix}icon-focus-url: #{_dropdown-icon($qld-light-action-secondary)};
134
+ }
135
+
136
+ .dark &,
137
+ .dark-alt & {
138
+ --#{$prefix}icon-url: #{_dropdown-icon($qld-dark-action-secondary)};
139
+ --#{$prefix}icon-hover-url: #{_dropdown-icon($qld-dark-action-secondary)};
140
+ --#{$prefix}icon-disabled-url: #{_dropdown-icon(
141
+ $color-default-color-dark-text-lighter
142
+ )};
143
+ --#{$prefix}icon-focus-url: #{_dropdown-icon($qld-light-action-secondary)};
144
+ }
145
+ }
146
+
147
+ %form-valid-feedback-variables {
148
+ &,
149
+ :is(.default, .light, .alt) & {
150
+ --color-text: #{$color-default-color-light-text-default};
151
+ }
152
+
153
+ :is(.dark, .dark-alt) & {
154
+ --color-text: #{$color-default-color-dark-text-default};
155
+ }
156
+ }
157
+
158
+ %form-invalid-feedback-variables {
159
+ &,
160
+ :is(.default, .light, .alt) & {
161
+ --color-text: #{$core-default-color-status-error-default};
162
+ }
163
+
164
+ :is(.dark, .dark-alt) & {
165
+ --color-text: #{$core-default-color-status-error-lighter};
166
+ }
167
+ }