@qld-gov-au/qgds-bootstrap5 2.0.11 → 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 (78) hide show
  1. package/.storybook/preview.js +5 -2
  2. package/dist/assets/components/bs5/dateinput/dateinput.hbs +27 -27
  3. package/dist/assets/components/bs5/formcheck/formcheck.hbs +10 -2
  4. package/dist/assets/components/bs5/head/head.hbs +1 -1
  5. package/dist/assets/components/bs5/searchInput/searchInput.hbs +31 -29
  6. package/dist/assets/components/bs5/select/select.hbs +19 -19
  7. package/dist/assets/components/bs5/textarea/textarea.hbs +17 -17
  8. package/dist/assets/components/bs5/textbox/textbox.hbs +17 -18
  9. package/dist/assets/css/qld.bootstrap.css +2 -2
  10. package/dist/assets/css/qld.bootstrap.css.map +3 -3
  11. package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
  12. package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
  13. package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
  14. package/dist/assets/js/handlebars.init.min.js +134 -125
  15. package/dist/assets/js/handlebars.init.min.js.map +2 -2
  16. package/dist/assets/js/handlebars.partials.js +134 -125
  17. package/dist/assets/js/handlebars.partials.js.map +2 -2
  18. package/dist/assets/js/qld.bootstrap.min.js +9 -10
  19. package/dist/assets/js/qld.bootstrap.min.js.map +3 -3
  20. package/dist/assets/node/handlebars.init.min.js +51 -7
  21. package/dist/assets/node/handlebars.init.min.js.map +2 -2
  22. package/dist/components/bs5/dateinput/dateinput.hbs +27 -27
  23. package/dist/components/bs5/formcheck/formcheck.hbs +10 -2
  24. package/dist/components/bs5/head/head.hbs +1 -1
  25. package/dist/components/bs5/searchInput/searchInput.hbs +31 -29
  26. package/dist/components/bs5/select/select.hbs +19 -19
  27. package/dist/components/bs5/textarea/textarea.hbs +17 -17
  28. package/dist/components/bs5/textbox/textbox.hbs +17 -18
  29. package/dist/package.json +1 -1
  30. package/dist/sample-data/dateinput/dateinput.data.json +14 -12
  31. package/dist/sample-data/formcheck/stories/checkbox/checkbox.data.json +4 -5
  32. package/dist/sample-data/formcheck/stories/radio/radio.data.json +4 -4
  33. package/dist/sample-data/searchInput/searchInput.data.json +19 -10
  34. package/dist/sample-data/select/select.data.json +12 -10
  35. package/dist/sample-data/textarea/textarea.data.json +14 -11
  36. package/dist/sample-data/textbox/textbox.data.json +13 -10
  37. package/package.json +1 -1
  38. package/src/components/bs5/dateinput/Dateinput.js +26 -11
  39. package/src/components/bs5/dateinput/dateinput.data.json +14 -12
  40. package/src/components/bs5/dateinput/dateinput.hbs +27 -27
  41. package/src/components/bs5/formcheck/Formcheck.js +57 -6
  42. package/src/components/bs5/formcheck/_form-variables.scss +131 -0
  43. package/src/components/bs5/formcheck/formcheck.hbs +10 -2
  44. package/src/components/bs5/formcheck/formcheck.scss +229 -66
  45. package/src/components/bs5/formcheck/stories/bootstrap-validation/bootstrap-validation.stories.js +304 -0
  46. package/src/components/bs5/formcheck/stories/checkbox/checkbox.data.json +4 -5
  47. package/src/components/bs5/formcheck/stories/checkbox/checkbox.stories.js +19 -111
  48. package/src/components/bs5/formcheck/stories/radio/radio.data.json +4 -4
  49. package/src/components/bs5/formcheck/stories/radio/radio.stories.js +30 -122
  50. package/src/components/bs5/inpageAlert/inpageAlert.scss +1 -1
  51. package/src/components/bs5/pageLayout/{ThemeShowcase.stories.js → PaletteShowcase.stories.js} +36 -35
  52. package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +24 -28
  53. package/src/components/bs5/searchInput/search.functions.js +93 -76
  54. package/src/components/bs5/searchInput/searchInput.data.json +19 -10
  55. package/src/components/bs5/searchInput/searchInput.hbs +31 -29
  56. package/src/components/bs5/searchInput/searchInput.scss +140 -196
  57. package/src/components/bs5/searchInput/searchInput.stories.js +35 -13
  58. package/src/components/bs5/searchInput/searchInput.test.js +5 -1
  59. package/src/components/bs5/select/Select.js +13 -5
  60. package/src/components/bs5/select/Select.stories.js +27 -83
  61. package/src/components/bs5/select/select.data.json +12 -10
  62. package/src/components/bs5/select/select.hbs +19 -19
  63. package/src/components/bs5/textarea/Textarea.js +13 -5
  64. package/src/components/bs5/textarea/Textarea.stories.js +29 -55
  65. package/src/components/bs5/textarea/textarea.data.json +14 -11
  66. package/src/components/bs5/textarea/textarea.hbs +17 -17
  67. package/src/components/bs5/textbox/Textbox.js +16 -5
  68. package/src/components/bs5/textbox/Textbox.stories.js +26 -51
  69. package/src/components/bs5/textbox/textInput.scss +12 -232
  70. package/src/components/bs5/textbox/textbox.data.json +13 -10
  71. package/src/components/bs5/textbox/textbox.hbs +17 -18
  72. package/src/css/functions/_index.scss +2 -0
  73. package/src/css/functions/remify.scss +32 -0
  74. package/src/css/functions/snap-line-height.scss +7 -0
  75. package/src/css/main.scss +1 -1
  76. package/src/css/mixins/focusable.scss +3 -0
  77. package/src/css/{qld-theme.scss → qld-palettes.scss} +30 -23
  78. package/src/components/bs5/formcheck/_formcheck.stories.bak.js +0 -432
@@ -1,131 +1,75 @@
1
1
  // ComponentExample.stories.js
2
- import { Select } from "./Select.js";
2
+ import { Select, argTypes } from "./Select.js";
3
3
  import defaultdata from "./select.data.json";
4
4
 
5
5
  export default {
6
6
  tags: ["autodocs"],
7
7
  title: "3. Components/Forms/Select",
8
8
  render: (args) => {
9
-
10
- //Storybook produces a comma delimited string when using the check control type (table-striped, table-bordered) etc.
9
+ //Storybook produces a comma delimited string when using the check control type (table-striped, table-bordered) etc.
11
10
  //We can't use commas on our class="..." attribute, so we need to replace the commas with spaces.
12
11
 
13
- if( typeof(args.customClass) === 'string' ) {
14
- args.customClass = args.customClass.replaceAll(","," ");
15
- } else if ( typeof(args.customClass) === 'object' ) {
12
+ if (typeof args.customClass === "string") {
13
+ args.customClass = args.customClass.replaceAll(",", " ");
14
+ } else if (typeof args.customClass === "object") {
16
15
  args.customClass = args.customClass.join(" ");
17
16
  }
18
-
17
+
19
18
  return new Select(args).html;
20
-
21
19
  },
20
+ parameters: { backgrounds: { disable: false } },
21
+ globals: { backgrounds: { value: "default" } },
22
22
 
23
23
  //https://storybook.js.org/docs/api/arg-types
24
- argTypes: {
25
- /*customClass: {
26
- name: "Classes",
27
- description: 'Settable classes for the component',
28
- control: {
29
- type: "check",
30
- labels: {
31
- "form-style-filled": "Filled",
32
- },
33
- },
34
- options: [
35
- "form-style-filled",
36
- ],
37
- },
38
- states: {
39
- name: "States",
40
- description: `Valid/Invalid states`,
41
- control: {
42
- type: "radio",
43
- labels: {
44
- "default": "Default",
45
- "qld-input-success": "Success",
46
- "qld-input-error": "Error",
47
- },
48
- },
49
- options: [
50
- "default",
51
- "qld-input-success",
52
- "qld-input-error",
53
- ],
54
- },*/
55
- },
24
+ argTypes,
56
25
  };
57
26
 
58
27
  /**
59
- * Default textbox
28
+ * Default palette context
60
29
  */
61
30
  export const Default = {
62
31
  args: defaultdata,
63
32
  };
64
33
 
65
34
  /**
66
- * Dark themed textbox
35
+ * Dark pallete context
67
36
  */
68
37
  export const Dark = {
69
- args: {
70
- ...defaultdata,
71
- ...{isDisabled: false},
72
- },
73
- parameters: {
74
- backgrounds: {
75
- default: 'Dark',
76
- values: [
77
- { name: 'Dark', value: 'var(--qld-brand-primary)' },
78
- ],
79
- },
38
+ args: {
39
+ ...defaultdata,
40
+ isDisabled: false,
80
41
  },
81
- decorators: [
82
- (Story) => {
83
- return `
84
- <div class="dark">
85
- ${Story()}
86
- </div>
87
- `;
88
- },
89
- ],
42
+ globals: { backgrounds: { value: "dark" } },
43
+ render: (args) => `<div class="dark">${new Select(args).html}</div>`,
90
44
  };
91
45
 
92
46
  /**
93
- * Filled style select
47
+ * Add custom class `form-style-filled`
94
48
  */
95
49
  export const Filled = {
96
- args: {
97
- ...defaultdata,
98
- ...{customClass: "form-style-filled"},
50
+ args: {
51
+ ...defaultdata,
52
+ isFilled: "true",
99
53
  },
100
54
  };
101
55
 
102
-
103
- /**
104
- * Disabled select
105
- */
106
56
  export const Disabled = {
107
- args: {
108
- ...defaultdata,
109
- ...{isDisabled: true},
57
+ args: {
58
+ ...defaultdata,
59
+ isDisabled: true,
110
60
  },
111
61
  };
112
62
 
113
- /**
114
- * Valid select
115
- */
116
63
  export const Valid = {
117
64
  args: {
118
- ...defaultdata,
119
- ...{customClass: "qld-input-success"},
65
+ ...defaultdata,
66
+ isValid: true,
120
67
  },
121
68
  };
122
69
 
123
- /**
124
- * Invalid select
125
- */
126
70
  export const Invalid = {
127
71
  args: {
128
- ...defaultdata,
129
- ...{customClass: "qld-input-error"},
72
+ ...defaultdata,
73
+ isValid: false,
130
74
  },
131
75
  };
@@ -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,33 +1,33 @@
1
1
  <!-- QGDS Component: Select -->
2
2
 
3
- <!-- Label for the first input field -->
4
- <label class="qld-text-input-label {{#if isRequired}}field-required{{/if}} {{#if isDisabled}}field-disabled{{/if}}" for="example-1">
3
+ <label class="qld-text-input-label {{#if isRequired}}field-required{{/if}} {{#if isDisabled}}field-disabled{{/if}}" for="{{id}}">
5
4
  {{label-text}}
6
5
  {{#if optional-text}}
7
- <span class="label-text-optional">({{optional-text}})</span></label>
6
+ <span class="label-text-optional">({{optional-text}})</span>
8
7
  {{/if}}
8
+ </label>
9
9
 
10
- <!-- Hint text for the first input field -->
11
10
  {{#if hint-text}}
12
- <span class="qld-hint-text" id="example-1-hint">{{hint-text}}</span>
11
+ <span class="qld-hint-text" id="{{id}}-hint">{{hint-text}}</span>
13
12
  {{/if}}
14
13
 
15
- {{#contains "qld-input-success" customClass}}
16
- <span id="text-field-success" class="qld-input-success">
17
- {{successMessageText}}
18
- </span>
19
- {{/contains}}
14
+ {{#contains "qld-input-success" customClass}}{{! legacy support for feedback classes `qld-input-success`}}
15
+ <span class="qld-input-success">{{successMessageText}}</span>
16
+ {{else}}{{! updated bootstrap style classes - `valid-feedback`}}
17
+ {{#if successMessageText}}
18
+ <div class="valid-feedback">{{successMessageText}}</div>
19
+ {{/if}}{{/contains}}
20
20
 
21
- {{#contains "qld-input-error" customClass}}
22
- <span id="text-field-error" class="qld-input-error">
23
- {{errorMessageText}}
24
- </span>
25
- {{/contains}}
21
+ {{#contains "qld-input-error" customClass}}{{! legacy support for feedback classes `qld-input-error`}}
22
+ <span class="qld-input-error">{{errorMessageText}}</span>
23
+ {{else}}{{! updated bootstrap style classes - `invalid-feedback`}}
24
+ {{#if errorMessageText}}
25
+ <div class="invalid-feedback">{{errorMessageText}}</div>
26
+ {{/if}}{{/contains}}
26
27
 
27
- <!-- First text input field, described by the hint text above -->
28
- <select class="qld-text-input form-select qld-select qld-field-width-1-quarter {{customClass}}"
29
- aria-label="Default select example" {{#if isDisabled}}disabled{{/if}} {{#if isRequired}}required aria-required="true"{{/if}}>
30
- <option selected>{{placeholder}}</option>
28
+ <select id={{id}} class="form-select {{#if isFilled}}is-filled{{/if}} {{#if isValid}}is-valid{{else}}{{#ifCond isValid "===" false}}is-invalid{{/ifCond}}{{/if}} {{customClass}}"
29
+ {{#if hint-text}}aria-describedby="{{id}}-hint"{{/if}} {{#if isDisabled}}disabled{{/if}} {{#if isRequired}}required{{/if}} >
30
+ <option selected value="">{{placeholder}}</option>
31
31
  <option value="1">Option 1</option>
32
32
  <option value="2">Option 2</option>
33
33
  <option value="3">Option 3</option>
@@ -1,13 +1,21 @@
1
- import Component from '../../../js/QGDSComponent.js'
1
+ import Component from "../../../js/QGDSComponent.js";
2
2
  import template from "./textarea.hbs?raw";
3
3
 
4
4
  export class Textarea {
5
-
6
5
  // Use the global Component class to create a new instance of the Textarea 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
- constructor( data = {} ) {
8
+ constructor(data = {}) {
10
9
  return new Component(template, data);
11
10
  }
12
-
13
11
  }
12
+
13
+ export const argTypes = {
14
+ isValid: {
15
+ description:
16
+ "For server-side validation, set to true or false. Omit or set to null to to indicate the input is yet to be validated.",
17
+ control: "radio",
18
+ options: [true, false, null],
19
+ type: "boolean | null",
20
+ },
21
+ };
@@ -1,101 +1,75 @@
1
1
  // ComponentExample.stories.js
2
- import { Textarea } from "./Textarea.js";
2
+ import { Textarea, argTypes } from "./Textarea.js";
3
3
  import defaultdata from "./textarea.data.json";
4
4
 
5
5
  export default {
6
6
  tags: ["autodocs"],
7
- title: "3. Components/Forms/Textarea",
7
+ title: "3. Components/Forms/Text Area",
8
8
  render: (args) => {
9
-
10
- //Storybook produces a comma delimited string when using the check control type (table-striped, table-bordered) etc.
9
+ //Storybook produces a comma delimited string when using the check control type (table-striped, table-bordered) etc.
11
10
  //We can't use commas on our class="..." attribute, so we need to replace the commas with spaces.
12
11
 
13
- if( typeof(args.customClass) === 'string' ) {
14
- args.customClass = args.customClass.replaceAll(","," ");
15
- } else if ( typeof(args.customClass) === 'object' ) {
12
+ if (typeof args.customClass === "string") {
13
+ args.customClass = args.customClass.replaceAll(",", " ");
14
+ } else if (typeof args.customClass === "object") {
16
15
  args.customClass = args.customClass.join(" ");
17
16
  }
18
-
17
+
19
18
  return new Textarea(args).html;
20
-
21
19
  },
22
-
20
+ parameters: { backgrounds: { disable: false } },
21
+ globals: { backgrounds: { value: "default" } },
23
22
  //https://storybook.js.org/docs/api/arg-types
24
- argTypes: {
25
- },
23
+ argTypes,
26
24
  };
27
25
 
28
26
  /**
29
- * Default textarea
27
+ * Default palette
30
28
  */
31
29
  export const Default = {
32
30
  args: defaultdata,
33
31
  };
34
32
 
35
33
  /**
36
- * Dark themed textarea
34
+ * Dark palette
37
35
  */
38
36
  export const Dark = {
39
- args: {
40
- ...defaultdata,
41
- ...{isDisabled: false},
42
- },
43
- parameters: {
44
- backgrounds: {
45
- default: 'Dark',
46
- values: [
47
- { name: 'Dark', value: 'var(--qld-brand-primary)' },
48
- ],
49
- },
37
+ args: {
38
+ ...defaultdata,
39
+ isDisabled: false,
50
40
  },
51
- decorators: [
52
- (Story) => {
53
- return `
54
- <div class="dark">
55
- ${Story()}
56
- </div>
57
- `;
58
- },
59
- ],
41
+ globals: { backgrounds: { value: "dark" } },
42
+ render: (args) => `<div class="dark">${new Textarea(args).html}</div>`,
60
43
  };
61
44
 
62
45
  /**
63
- * Filled style textarea
46
+ * Add `customClass: "form-style-filled"`
64
47
  */
65
48
  export const Filled = {
66
- args: {
67
- ...defaultdata,
68
- ...{customClass: "form-style-filled"},
49
+ args: {
50
+ ...defaultdata,
51
+ isFilled: true,
69
52
  },
70
53
  };
71
54
 
72
-
73
- /**
74
- * Disabled textarea
75
- */
76
55
  export const Disabled = {
77
- args: {
78
- ...defaultdata,
79
- ...{isDisabled: true, isRequired: false},
56
+ args: {
57
+ ...defaultdata,
58
+ isDisabled: true,
59
+ isRequired: false,
80
60
  },
81
61
  };
82
62
 
83
- /**
84
- * Valid textbox
85
- */
86
63
  export const Valid = {
87
64
  args: {
88
- ...defaultdata,
89
- ...{customClass: "qld-input-success"},
65
+ ...defaultdata,
66
+ isValid: true,
90
67
  },
91
68
  };
92
69
 
93
- /**
94
- * Invalid textbox
95
- */
96
70
  export const Invalid = {
97
71
  args: {
98
- ...defaultdata,
99
- ...{customClass: "qld-input-error"},
72
+ ...defaultdata,
73
+ isValid: false,
100
74
  },
101
75
  };
@@ -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,32 +1,32 @@
1
1
  <!-- QGDS Component: Textarea -->
2
2
 
3
- <!-- Label for the first input field -->
4
3
  <label class="qld-text-input-label {{#if isRequired}}field-required{{/if}} {{#if isDisabled}}field-disabled{{/if}}"
5
- for="example-1">
4
+ for="{{id}}">
6
5
  {{label-text}}
7
6
  {{#if optional-text}}
8
7
  <span class="label-text-optional">({{optional-text}})</span>
9
8
  {{/if}}
10
9
  </label>
11
10
 
12
- <!-- Hint text for the first input field -->
13
11
  {{#if hint-text}}
14
- <span class="qld-hint-text" id="example-1-hint">{{hint-text}}</span>
12
+ <span class="qld-hint-text" id="{{id}}-hint">{{hint-text}}</span>
15
13
  {{/if}}
16
14
 
17
- {{#contains "qld-input-success" customClass}}
18
- <span id="text-field-success" class="qld-input-success">
19
- {{successMessageText}}
20
- </span>
21
- {{/contains}}
15
+ {{#contains "qld-input-success" customClass}}{{! legacy support for feedback classes `qld-input-success`}}
16
+ <span class="qld-input-success">{{successMessageText}}</span>
17
+ {{else}}
18
+ {{#if successMessageText}}{{! updated bootstrap style classes - `valid-feedback`}}
19
+ <div class="valid-feedback">{{successMessageText}}</div>
20
+ {{/if}}{{/contains}}
22
21
 
23
- {{#contains "qld-input-error" customClass}}
24
- <span id="text-field-error" class="qld-input-error">
25
- {{errorMessageText}}
26
- </span>
27
- {{/contains}}
22
+ {{#contains "qld-input-error" customClass}}{{! legacy support for feedback classes `qld-input-error`}}
23
+ <span class="qld-input-error">{{errorMessageText}}</span>
24
+ {{else}}
25
+ {{#if errorMessageText}}{{! updated bootstrap style classes - `invalid-feedback`}}
26
+ <div class="invalid-feedback">{{errorMessageText}}</div>
27
+ {{/if}}{{/contains}}
28
28
 
29
29
  <!-- First text input field, described by the hint text above -->
30
- <textarea id="example-1" class="qld-text-input form-control {{customClass}} {{#if isFilled}}form-style-filled{{/if}}"
31
- placeholder="{{placeholder}}" rows="{{rows}}" {{#if isDisabled}}disabled{{/if}} {{#if isRequired}}required
32
- aria-required="true" {{/if}}></textarea>
30
+ <textarea id="{{id}}" class="form-control {{customClass}} {{#if isFilled}}is-filled{{/if}} {{#if isValid}}is-valid{{else}}{{#ifCond isValid "===" false}}is-invalid{{/ifCond}}{{/if}}"
31
+ placeholder="{{placeholder}}" rows="{{rows}}" {{#if isDisabled}}disabled{{/if}} {{#if isRequired}}required{{/if}}
32
+ {{#if hint-text}}aria-describedby="{{id}}-hint"{{/if}}>{{value}}</textarea>
@@ -1,13 +1,24 @@
1
- import Component from '../../../js/QGDSComponent.js'
1
+ import Component from "../../../js/QGDSComponent.js";
2
2
  import template from "./textbox.hbs?raw";
3
3
 
4
+ /**
5
+ * Named `Text input` in Design system.
6
+ */
4
7
  export class Textbox {
5
-
6
8
  // Use the global Component class to create a new instance of the Textbox component.
7
- // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
9
+ // A data object, containing the Handlebars placeholder replacement strings, should be provided as an argument.
8
10
 
9
- constructor( data = {} ) {
11
+ constructor(data = {}) {
10
12
  return new Component(template, data);
11
13
  }
12
-
13
14
  }
15
+
16
+ export const argTypes = {
17
+ isValid: {
18
+ description:
19
+ "For server-side validation, set to true or false. Omit or set to null to to indicate the input is yet to be validated.",
20
+ control: "radio",
21
+ options: [true, false, null],
22
+ type: "boolean | null",
23
+ },
24
+ };
@@ -1,45 +1,26 @@
1
1
  // ComponentExample.stories.js
2
- import { Textbox } from "./Textbox.js";
2
+ import { Textbox, argTypes } from "./Textbox.js";
3
3
  import defaultdata from "./textbox.data.json";
4
4
 
5
5
  export default {
6
6
  tags: ["autodocs"],
7
- title: "3. Components/Forms/Textbox",
7
+ title: "3. Components/Forms/Text input",
8
8
  render: (args) => {
9
-
10
- //Storybook produces a comma delimited string when using the check control type (table-striped, table-bordered) etc.
9
+ //Storybook produces a comma delimited string when using the check control type (table-striped, table-bordered) etc.
11
10
  //We can't use commas on our class="..." attribute, so we need to replace the commas with spaces.
12
11
 
13
- if( typeof(args.customClass) === 'string' ) {
14
- args.customClass = args.customClass.replaceAll(","," ");
15
- } else if ( typeof(args.customClass) === 'object' ) {
12
+ if (typeof args.customClass === "string") {
13
+ args.customClass = args.customClass.replaceAll(",", " ");
14
+ } else if (typeof args.customClass === "object") {
16
15
  args.customClass = args.customClass.join(" ");
17
16
  }
18
-
17
+
19
18
  return new Textbox(args).html;
20
-
21
19
  },
22
-
20
+ parameters: { backgrounds: { disable: false } },
21
+ globals: { backgrounds: { value: "default" } },
23
22
  //https://storybook.js.org/docs/api/arg-types
24
- argTypes: {
25
- states: {
26
- name: "States",
27
- description: `Valid/Invalid states`,
28
- control: {
29
- type: "radio",
30
- labels: {
31
- "default": "Default",
32
- "qld-input-success": "Success",
33
- "qld-input-error": "Error",
34
- },
35
- },
36
- options: [
37
- "default",
38
- "qld-input-success",
39
- "qld-input-error",
40
- ],
41
- },
42
- },
23
+ argTypes,
43
24
  };
44
25
 
45
26
  /**
@@ -53,18 +34,11 @@ export const Default = {
53
34
  * Dark themed textbox
54
35
  */
55
36
  export const Dark = {
56
- args: {
57
- ...defaultdata,
58
- ...{isDisabled: false},
59
- },
60
- parameters: {
61
- backgrounds: {
62
- default: 'Dark',
63
- values: [
64
- { name: 'Dark', value: 'var(--qld-brand-primary)' },
65
- ],
66
- },
37
+ args: {
38
+ ...defaultdata,
39
+ ...{ isDisabled: false },
67
40
  },
41
+ globals: { backgrounds: { value: "dark" } },
68
42
  decorators: [
69
43
  (Story) => {
70
44
  return `
@@ -80,20 +54,19 @@ export const Dark = {
80
54
  * Filled style textbox
81
55
  */
82
56
  export const Filled = {
83
- args: {
84
- ...defaultdata,
85
- ...{customClass: "form-style-filled"},
57
+ args: {
58
+ ...defaultdata,
59
+ customClass: "form-style-filled",
86
60
  },
87
61
  };
88
62
 
89
-
90
63
  /**
91
64
  * Disabled textbox
92
65
  */
93
66
  export const Disabled = {
94
- args: {
95
- ...defaultdata,
96
- ...{isDisabled: true},
67
+ args: {
68
+ ...defaultdata,
69
+ isDisabled: true,
97
70
  },
98
71
  };
99
72
 
@@ -102,8 +75,9 @@ export const Disabled = {
102
75
  */
103
76
  export const Valid = {
104
77
  args: {
105
- ...defaultdata,
106
- ...{customClass: "qld-input-success"},
78
+ ...defaultdata,
79
+ isValid: true,
80
+ // ...{ customClass: "qld-input-success" },
107
81
  },
108
82
  };
109
83
 
@@ -112,7 +86,8 @@ export const Valid = {
112
86
  */
113
87
  export const Invalid = {
114
88
  args: {
115
- ...defaultdata,
116
- ...{customClass: "qld-input-error"},
89
+ ...defaultdata,
90
+ isValid: false,
91
+ // ...{ customClass: "qld-input-error" },
117
92
  },
118
93
  };