@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.
- package/.esbuild/plugins/qgds-plugin-generate-icon-assets.js +31 -24
- package/.storybook/preview.js +5 -2
- package/dist/assets/components/bs5/button/button.hbs +1 -1
- package/dist/assets/components/bs5/dateinput/dateinput.hbs +27 -27
- package/dist/assets/components/bs5/footer/customLinks.hbs +1 -1
- package/dist/assets/components/bs5/footer/followLinks.hbs +1 -1
- package/dist/assets/components/bs5/formcheck/formcheck.hbs +10 -2
- package/dist/assets/components/bs5/head/head.hbs +1 -1
- package/dist/assets/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
- package/dist/assets/components/bs5/searchInput/searchInput.hbs +35 -31
- package/dist/assets/components/bs5/select/select.hbs +19 -19
- package/dist/assets/components/bs5/textarea/textarea.hbs +17 -17
- package/dist/assets/components/bs5/textbox/textbox.hbs +17 -18
- package/dist/assets/css/qld.bootstrap.css +2 -2
- package/dist/assets/css/qld.bootstrap.css.map +3 -3
- package/dist/assets/css/qld.bootstrap.legacy.css +2 -2
- package/dist/assets/css/qld.bootstrap.legacy.css.map +3 -3
- package/dist/assets/img/icons-sprite.svg +24 -24
- package/dist/assets/js/handlebars.helpers.bundle.js +1 -1
- package/dist/assets/js/handlebars.init.min.js +159 -140
- package/dist/assets/js/handlebars.init.min.js.map +2 -2
- package/dist/assets/js/handlebars.partials.js +159 -140
- package/dist/assets/js/handlebars.partials.js.map +2 -2
- package/dist/assets/js/qld.bootstrap.min.js +9 -10
- package/dist/assets/js/qld.bootstrap.min.js.map +4 -4
- package/dist/assets/node/handlebars.init.min.js +57 -11
- package/dist/assets/node/handlebars.init.min.js.map +2 -2
- package/dist/components/bs5/button/button.hbs +1 -1
- package/dist/components/bs5/dateinput/dateinput.hbs +27 -27
- package/dist/components/bs5/footer/customLinks.hbs +1 -1
- package/dist/components/bs5/footer/followLinks.hbs +1 -1
- package/dist/components/bs5/formcheck/formcheck.hbs +10 -2
- package/dist/components/bs5/head/head.hbs +1 -1
- package/dist/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
- package/dist/components/bs5/searchInput/searchInput.hbs +35 -31
- package/dist/components/bs5/select/select.hbs +19 -19
- package/dist/components/bs5/textarea/textarea.hbs +17 -17
- package/dist/components/bs5/textbox/textbox.hbs +17 -18
- package/dist/package.json +1 -1
- package/dist/sample-data/dateinput/dateinput.data.json +14 -12
- package/dist/sample-data/footer/footer.data.json +3 -0
- package/dist/sample-data/formcheck/stories/checkbox/checkbox.data.json +4 -5
- package/dist/sample-data/formcheck/stories/radio/radio.data.json +4 -4
- package/dist/sample-data/inpageAlert/inpageAlert.data.json +1 -1
- package/dist/sample-data/searchInput/searchInput.data.json +20 -10
- package/dist/sample-data/select/select.data.json +12 -10
- package/dist/sample-data/textarea/textarea.data.json +14 -11
- package/dist/sample-data/textbox/textbox.data.json +13 -10
- package/package.json +1 -1
- package/src/components/bs5/breadcrumbs/breadcrumbs.scss +3 -4
- package/src/components/bs5/button/Button.js +32 -6
- package/src/components/bs5/button/button.hbs +1 -1
- package/src/components/bs5/button/button.scss +0 -5
- package/src/components/bs5/card/card.scss +2 -0
- package/src/components/bs5/dateinput/Dateinput.js +26 -11
- package/src/components/bs5/dateinput/dateinput.data.json +14 -12
- package/src/components/bs5/dateinput/dateinput.hbs +27 -27
- package/src/components/bs5/footer/customLinks.hbs +1 -1
- package/src/components/bs5/footer/followLinks.hbs +1 -1
- package/src/components/bs5/footer/footer.data.json +3 -0
- package/src/components/bs5/formcheck/Formcheck.js +57 -6
- package/src/components/bs5/formcheck/_form-variables.scss +167 -0
- package/src/components/bs5/formcheck/formcheck.hbs +10 -2
- package/src/components/bs5/formcheck/formcheck.scss +268 -65
- package/src/components/bs5/formcheck/stories/bootstrap-validation/bootstrap-validation.stories.js +304 -0
- package/src/components/bs5/formcheck/stories/checkbox/checkbox.data.json +4 -5
- package/src/components/bs5/formcheck/stories/checkbox/checkbox.stories.js +19 -111
- package/src/components/bs5/formcheck/stories/radio/radio.data.json +4 -4
- package/src/components/bs5/formcheck/stories/radio/radio.stories.js +30 -122
- package/src/components/bs5/header/header.scss +1 -2
- package/src/components/bs5/icons/_icons.list.js +7 -7
- package/src/components/bs5/icons/_icons.list.scss +113 -112
- package/src/components/bs5/icons/_icons.variables.scss +7 -6
- package/src/components/bs5/icons/icons.scss +2 -1
- package/src/components/bs5/inpageAlert/inpageAlert.data.json +1 -1
- package/src/components/bs5/inpageAlert/inpageAlert.hbs +10 -2
- package/src/components/bs5/inpageAlert/inpageAlert.scss +50 -52
- package/src/components/bs5/inpageAlert/inpageAlert.stories.js +54 -3
- package/src/components/bs5/pageLayout/{ThemeShowcase.stories.js → PaletteShowcase.stories.js} +40 -38
- package/src/components/bs5/searchInput/__snapshots__/searchInput.test.js.snap +25 -29
- package/src/components/bs5/searchInput/search.functions.js +120 -108
- package/src/components/bs5/searchInput/searchInput.data.json +20 -10
- package/src/components/bs5/searchInput/searchInput.hbs +35 -31
- package/src/components/bs5/searchInput/searchInput.scss +193 -196
- package/src/components/bs5/searchInput/searchInput.stories.js +35 -13
- package/src/components/bs5/searchInput/searchInput.test.js +96 -120
- package/src/components/bs5/select/Select.js +13 -5
- package/src/components/bs5/select/Select.stories.js +27 -83
- package/src/components/bs5/select/select.data.json +12 -10
- package/src/components/bs5/select/select.hbs +19 -19
- package/src/components/bs5/skiplinks/skipLinks.scss +12 -4
- package/src/components/bs5/textarea/Textarea.js +13 -5
- package/src/components/bs5/textarea/Textarea.stories.js +29 -55
- package/src/components/bs5/textarea/textarea.data.json +14 -11
- package/src/components/bs5/textarea/textarea.hbs +17 -17
- package/src/components/bs5/textbox/Textbox.js +16 -5
- package/src/components/bs5/textbox/Textbox.stories.js +26 -51
- package/src/components/bs5/textbox/textInput.scss +12 -232
- package/src/components/bs5/textbox/textbox.data.json +13 -10
- package/src/components/bs5/textbox/textbox.hbs +17 -18
- package/src/components/common/focus-styles/focusStyles.mdx +20 -0
- package/src/components/common/focus-styles/focusStyles.stories.js +58 -0
- package/src/css/functions/_index.scss +5 -0
- package/src/css/functions/color-icon.scss +31 -0
- package/src/css/functions/remify.scss +32 -0
- package/src/css/functions/snap-line-height.scss +7 -0
- package/src/css/functions/string-replace.scss +49 -0
- package/src/css/functions/svg-encode.scss +22 -0
- package/src/css/main.scss +1 -1
- package/src/css/mixins/focusable.scss +3 -0
- package/src/css/mixins/make-icon.scss +1 -1
- package/src/css/mixins/make-link.scss +13 -10
- package/src/css/{qld-theme.scss → qld-palettes.scss} +50 -35
- package/src/css/qld-type.scss +5 -1
- package/src/css/qld-utilities.scss +9 -1
- package/src/css/qld-variables.scss +1 -1
- package/src/img/icons-sprite.svg +24 -24
- package/src/js/qld.bootstrap.js +3 -55
- package/src/components/bs5/formcheck/_formcheck.stories.bak.js +0 -432
package/src/components/bs5/formcheck/stories/bootstrap-validation/bootstrap-validation.stories.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
// Bootstrap5Validation.stories.js
|
|
2
|
+
import { Formcheck, argTypes } from "../../Formcheck.js";
|
|
3
|
+
import { Textarea } from "../../../textarea/Textarea.js";
|
|
4
|
+
import { Textbox } from "../../../textbox/Textbox.js";
|
|
5
|
+
import { Select } from "../../../select/Select.js";
|
|
6
|
+
import { Dateinput } from "../../../dateinput/Dateinput.js";
|
|
7
|
+
import checkboxData from "../checkbox/checkbox.data.json";
|
|
8
|
+
import textAreaData from "../../../textarea/textarea.data.json";
|
|
9
|
+
import textInputData from "../../../textbox/textbox.data.json";
|
|
10
|
+
import dateInputData from "../../../dateinput/dateinput.data.json";
|
|
11
|
+
import selectData from "../../../select/select.data.json";
|
|
12
|
+
|
|
13
|
+
checkboxData.optionalLabel = null;
|
|
14
|
+
textAreaData.optionalLabel = null;
|
|
15
|
+
textInputData.optionalLabel = null;
|
|
16
|
+
selectData.optionalLabel = null;
|
|
17
|
+
dateInputData.optionalLabel = null;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This page tests and compares various validation styling methods.
|
|
21
|
+
*
|
|
22
|
+
* Server side validation:
|
|
23
|
+
* - via Bootstrap's `.is-valid`/`.is-invalid` classes.
|
|
24
|
+
* - also via legacy `.valid` and `.invalid` classes on the form element.
|
|
25
|
+
*
|
|
26
|
+
* Client side validation:
|
|
27
|
+
* - via `.was-validated` class on the `<form>` element targeting html5 `:valid` and `:invalid` input element pseudoclasses.
|
|
28
|
+
*
|
|
29
|
+
* #### Multiple input forms and validation feedback
|
|
30
|
+
* Because validation feedback (error or success messages) styles rely on sibling input selectors,
|
|
31
|
+
* it is important to wrap individual form components in a containing div when also providing validation feedback.
|
|
32
|
+
*/
|
|
33
|
+
export default {
|
|
34
|
+
tags: ["autodocs"],
|
|
35
|
+
title: "3. Components/Forms/Form Validation",
|
|
36
|
+
args: {
|
|
37
|
+
...checkboxData, // There is no shared form element abstract args, only use controls common to all inputs (isValid, successMessage, errorMessage)
|
|
38
|
+
_storyId: "default", // make it easier to create unique ids for each input.
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
render: (args) => `
|
|
42
|
+
<div class="mb-32">${new Formcheck({ ...args, listitems: [{ ...checkboxData.listitems[0], id: `${args._storyId}Checkbox1` }] }).html}</div>
|
|
43
|
+
<div class="mb-32">${
|
|
44
|
+
new Formcheck({
|
|
45
|
+
...checkboxData,
|
|
46
|
+
isValid: args.isValid,
|
|
47
|
+
type: "radio",
|
|
48
|
+
listitems: [
|
|
49
|
+
{ ...checkboxData.listitems[0], id: `${args._storyId}Radio1` },
|
|
50
|
+
{ ...checkboxData.listitems[1], id: `${args._storyId}Radio2` },
|
|
51
|
+
],
|
|
52
|
+
}).html
|
|
53
|
+
}</div>
|
|
54
|
+
<div class="mb-32">${new Textarea({ ...textAreaData, isValid: args.isValid, id: `${args._storyId}Textarea`, isRequired: true, successMessageText: args.successMessageText, errorMessageText: args.errorMessageText }).html}</div>
|
|
55
|
+
<div class="mb-32">${new Textbox({ ...textInputData, isValid: args.isValid, id: `${args._storyId}TextInput`, isRequired: true, successMessageText: args.successMessageText, errorMessageText: args.errorMessageText }).html}</div>
|
|
56
|
+
<div class="mb-32">${new Select({ ...selectData, isValid: args.isValid, id: `${args._storyId}SelectInvalid`, isRequired: true, successMessageText: args.successMessageText, errorMessageText: args.errorMessageText }).html}</div>
|
|
57
|
+
<div class="mb-32">${new Dateinput({ ...dateInputData, isValid: args.isValid, id: `${args._storyId}DateInvalid`, isRequired: true, successMessageText: args.successMessageText, errorMessageText: args.errorMessageText }).html}</div>
|
|
58
|
+
`,
|
|
59
|
+
|
|
60
|
+
argTypes,
|
|
61
|
+
parameters: {
|
|
62
|
+
controls: {
|
|
63
|
+
include: ["isValid", "successMessageText", "errorMessageText"],
|
|
64
|
+
},
|
|
65
|
+
backgrounds: { disable: false },
|
|
66
|
+
},
|
|
67
|
+
globals: { backgrounds: { value: "default" } },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Server side validation with `isValid: false`
|
|
72
|
+
*/
|
|
73
|
+
export const BootstrapIsInvalid = {
|
|
74
|
+
name: "Server side - invalid",
|
|
75
|
+
args: {
|
|
76
|
+
isValid: false,
|
|
77
|
+
_storyId: "BootstrapIsInvalid",
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Server side validation with `isValid: true`
|
|
83
|
+
*/
|
|
84
|
+
export const BootstrapIsValid = {
|
|
85
|
+
name: "Server side - valid",
|
|
86
|
+
args: {
|
|
87
|
+
isValid: true,
|
|
88
|
+
_storyId: "BootstrapIsValid",
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Client side validation offers the best user experience, however it not always suit your needs.
|
|
94
|
+
* For client side validation using HTML5 features, add the `novalidate` boolean attribute to your `<form>`.
|
|
95
|
+
* This disables the browser default feedback tooltips, but still provides access to the form validation APIs in JavaScript.
|
|
96
|
+
* Try to submit the form below; our JavaScript will intercept the submit button and relay feedback to you.
|
|
97
|
+
* Validation styles using built-in HTML5 validation require class `was-validated` to be added to the `<form>` and rely on the `:invalid` and `:valid` pseudoclasses.
|
|
98
|
+
* #### Multiple input forms and validation feedback
|
|
99
|
+
* Because validation feedback (error or success messages) styles rely on sibling input selectors,
|
|
100
|
+
* it is important to wrap individual form components in a containing div when also providing validation feedback.
|
|
101
|
+
*/
|
|
102
|
+
export const HTML5NeedsValidation = {
|
|
103
|
+
name: "Client side validation",
|
|
104
|
+
|
|
105
|
+
args: {
|
|
106
|
+
...checkboxData,
|
|
107
|
+
_storyId: "HTML5NeedsValidation",
|
|
108
|
+
listitems: [
|
|
109
|
+
{
|
|
110
|
+
...checkboxData.listitems[0],
|
|
111
|
+
id: "needs-validation-1",
|
|
112
|
+
label: "Required checkbox (unchecked will be invalid)",
|
|
113
|
+
isChecked: false,
|
|
114
|
+
isRequired: true,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
...checkboxData.listitems[1],
|
|
118
|
+
id: "needs-validation-2",
|
|
119
|
+
label: "Required checkbox (checked will be valid)",
|
|
120
|
+
isChecked: true,
|
|
121
|
+
isRequired: true,
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
render: (args) => {
|
|
126
|
+
return `
|
|
127
|
+
<form class="needs-validation" novalidate>
|
|
128
|
+
<div class="row">
|
|
129
|
+
<div class="col">
|
|
130
|
+
<div class="mb-32">${new Formcheck({ ...args, listitems: [{ ...checkboxData.listitems[0], id: `${args._storyId}CheckboxInvalid` }] }).html}</div>
|
|
131
|
+
<div class="mb-32">${new Textarea({ ...textAreaData, id: `${args._storyId}TextareaInvalid`, value: "", isRequired: true }).html}</div>
|
|
132
|
+
<div class="mb-32">${new Textbox({ ...textInputData, id: `${args._storyId}TextInputInvalid`, value: "", isRequired: true }).html}</div>
|
|
133
|
+
<div class="mb-32">${new Select({ ...selectData, id: `${args._storyId}SelectInvalid`, isRequired: true }).html}</div>
|
|
134
|
+
<div class="mb-32">${new Dateinput({ ...dateInputData, id: `${args._storyId}DateInvalid`, isRequired: true }).html}</div>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="col">
|
|
137
|
+
<div class="mb-32">${new Formcheck({ ...args, listitems: [{ ...checkboxData.listitems[1], id: `${args._storyId}CheckboxValid` }] }).html}</div>
|
|
138
|
+
<div class="mb-32">${new Textarea({ ...textAreaData, id: `${args._storyId}TextareaValid`, value: "I have value!", isRequired: true }).html}</div>
|
|
139
|
+
<div class="mb-32">${new Textbox({ ...textInputData, id: `${args._storyId}TextInputValid`, value: "I have value also!", isRequired: true }).html}</div>
|
|
140
|
+
<div class="mb-32">${new Select({ ...selectData, id: `${args._storyId}SelectValid`, isRequired: true }).html}</div>
|
|
141
|
+
<div class="mb-32">${new Dateinput({ ...dateInputData, id: `${args._storyId}DateValid`, isRequired: true }).html}</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<button class="btn btn-primary mt-3" type="submit" onclick="validateForm(event)">Validate</button>
|
|
146
|
+
</form>
|
|
147
|
+
<script>
|
|
148
|
+
function validateForm(event) {
|
|
149
|
+
event.preventDefault();
|
|
150
|
+
event.stopPropagation();
|
|
151
|
+
const form = event.target.closest('form');
|
|
152
|
+
|
|
153
|
+
form.elements["${args._storyId}CheckboxInvalid"].checked = false;
|
|
154
|
+
form.elements["${args._storyId}CheckboxValid"].checked = true;
|
|
155
|
+
|
|
156
|
+
form.elements["${args._storyId}TextareaInvalid"].value = "";
|
|
157
|
+
form.elements["${args._storyId}TextareaValid"].value = "I have value!";
|
|
158
|
+
|
|
159
|
+
form.elements["${args._storyId}TextInputInvalid"].value = "";
|
|
160
|
+
form.elements["${args._storyId}TextInputValid"].value = "I have value also!";
|
|
161
|
+
|
|
162
|
+
form.elements["${args._storyId}SelectInvalid"].value = null;
|
|
163
|
+
form.elements["${args._storyId}SelectValid"].value = "2";
|
|
164
|
+
|
|
165
|
+
form.elements["${args._storyId}DateInvalid-dayinput"].value = "";
|
|
166
|
+
|
|
167
|
+
form.elements["${args._storyId}DateValid-dayinput"].value = "2";
|
|
168
|
+
form.elements["${args._storyId}DateValid-monthinput"].value = "2";
|
|
169
|
+
form.elements["${args._storyId}DateValid-yearinput"].value = "2222";
|
|
170
|
+
|
|
171
|
+
form.classList.add('was-validated');
|
|
172
|
+
}
|
|
173
|
+
</script>`;
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export const BootstrapInvalidDark = {
|
|
178
|
+
name: "Dark Palette - Invalid",
|
|
179
|
+
args: {
|
|
180
|
+
isValid: false,
|
|
181
|
+
_storyId: "BootstrapInvalidDark",
|
|
182
|
+
},
|
|
183
|
+
parameters: {
|
|
184
|
+
docs: {
|
|
185
|
+
source: {
|
|
186
|
+
excludeDecorators: false,
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
globals: { backgrounds: { value: "dark" } },
|
|
191
|
+
decorators: [
|
|
192
|
+
(Story) => {
|
|
193
|
+
return `
|
|
194
|
+
<div class="dark">${Story()}</div>`;
|
|
195
|
+
},
|
|
196
|
+
],
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
export const BootstrapValidDark = {
|
|
200
|
+
name: "Dark Palette - Valid",
|
|
201
|
+
args: {
|
|
202
|
+
isValid: true,
|
|
203
|
+
_storyId: "BootstrapValidDark",
|
|
204
|
+
},
|
|
205
|
+
parameters: {
|
|
206
|
+
docs: {
|
|
207
|
+
source: {
|
|
208
|
+
excludeDecorators: false,
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
globals: { backgrounds: { value: "dark" } },
|
|
213
|
+
decorators: [
|
|
214
|
+
(Story) => {
|
|
215
|
+
return `
|
|
216
|
+
<div class="dark">${Story()}</div>`;
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* `.valid` and `.invalid` classes on the form or parent element.
|
|
223
|
+
*/
|
|
224
|
+
export const ValidationComparison = {
|
|
225
|
+
name: "Legacy Validation Comparison",
|
|
226
|
+
args: {
|
|
227
|
+
...checkboxData,
|
|
228
|
+
questionLabel: "Comparison of validation methods",
|
|
229
|
+
listitems: [
|
|
230
|
+
{
|
|
231
|
+
...checkboxData.listitems[0],
|
|
232
|
+
id: "compare-1",
|
|
233
|
+
label: "Legacy .valid",
|
|
234
|
+
isChecked: true,
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
...checkboxData.listitems[1],
|
|
238
|
+
id: "compare-2",
|
|
239
|
+
label: "Legacy .invalid",
|
|
240
|
+
isChecked: false,
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
...checkboxData.listitems[2],
|
|
244
|
+
id: "compare-3",
|
|
245
|
+
label: "Bootstrap .is-valid",
|
|
246
|
+
isChecked: true,
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
...checkboxData.listitems[3],
|
|
250
|
+
id: "compare-4",
|
|
251
|
+
label: "Bootstrap .is-invalid",
|
|
252
|
+
isChecked: false,
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
|
+
render: (args) => {
|
|
257
|
+
return `
|
|
258
|
+
<div class="row">
|
|
259
|
+
<div class="col">
|
|
260
|
+
<div class="valid">
|
|
261
|
+
${
|
|
262
|
+
new Formcheck({
|
|
263
|
+
...args,
|
|
264
|
+
questionLabel: "Legacy classes - .valid",
|
|
265
|
+
listitems: [args.listitems[0]],
|
|
266
|
+
}).html
|
|
267
|
+
}
|
|
268
|
+
</div>
|
|
269
|
+
<div class="invalid">
|
|
270
|
+
${
|
|
271
|
+
new Formcheck({
|
|
272
|
+
...args,
|
|
273
|
+
questionLabel: "Legacy classes - .invalid",
|
|
274
|
+
listitems: [args.listitems[1]],
|
|
275
|
+
}).html
|
|
276
|
+
}
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
<div class="col">
|
|
280
|
+
<div>
|
|
281
|
+
${
|
|
282
|
+
new Formcheck({
|
|
283
|
+
...args,
|
|
284
|
+
questionLabel: "Bootstrap classes - .is-valid",
|
|
285
|
+
isValid: true,
|
|
286
|
+
listitems: [args.listitems[2]],
|
|
287
|
+
}).html
|
|
288
|
+
}
|
|
289
|
+
</div>
|
|
290
|
+
<div>
|
|
291
|
+
${
|
|
292
|
+
new Formcheck({
|
|
293
|
+
...args,
|
|
294
|
+
questionLabel: "Bootstrap classes .is-invalid",
|
|
295
|
+
isValid: false,
|
|
296
|
+
listitems: [args.listitems[3]],
|
|
297
|
+
}).html
|
|
298
|
+
}
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
</div>
|
|
302
|
+
`;
|
|
303
|
+
},
|
|
304
|
+
};
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
"optionalLabel": "(Optional)",
|
|
4
4
|
"hintLabel": "Hint label",
|
|
5
5
|
"listClasses": "field-required",
|
|
6
|
+
"successMessageText": "Success message",
|
|
7
|
+
"errorMessageText": "Error message",
|
|
8
|
+
"isValid": null,
|
|
9
|
+
"type": "checkbox",
|
|
6
10
|
"listitems": [
|
|
7
11
|
{
|
|
8
|
-
"type": "checkbox",
|
|
9
12
|
"id": "checkboxItem1",
|
|
10
13
|
"name": "checkboxOption",
|
|
11
14
|
"label": "Option 1",
|
|
@@ -14,7 +17,6 @@
|
|
|
14
17
|
"isChecked": false
|
|
15
18
|
},
|
|
16
19
|
{
|
|
17
|
-
"type": "checkbox",
|
|
18
20
|
"id": "checkboxItem2",
|
|
19
21
|
"name": "checkboxOption",
|
|
20
22
|
"label": "Option 2",
|
|
@@ -23,7 +25,6 @@
|
|
|
23
25
|
"isChecked": false
|
|
24
26
|
},
|
|
25
27
|
{
|
|
26
|
-
"type": "checkbox",
|
|
27
28
|
"id": "checkboxItem3",
|
|
28
29
|
"name": "checkboxOption",
|
|
29
30
|
"label": "Option 3",
|
|
@@ -32,7 +33,6 @@
|
|
|
32
33
|
"isChecked": false
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
|
-
"type": "checkbox",
|
|
36
36
|
"id": "checkboxItem4",
|
|
37
37
|
"name": "checkboxOption",
|
|
38
38
|
"label": "Option 4",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"isChecked": true
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
"type": "checkbox",
|
|
45
44
|
"id": "checkboxItem5",
|
|
46
45
|
"name": "checkboxOption",
|
|
47
46
|
"label": "Disabled",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// FormcheckCheckbox.stories.js
|
|
2
|
-
import { Formcheck } from "../../Formcheck.js";
|
|
2
|
+
import { Formcheck, argTypes } from "../../Formcheck.js";
|
|
3
3
|
import defaultdata from "./checkbox.data.json";
|
|
4
4
|
|
|
5
5
|
export default {
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
globals: { backgrounds: { value: "default" } },
|
|
12
12
|
parameters: { backgrounds: { disable: false } },
|
|
13
13
|
//https://storybook.js.org/docs/api/arg-types
|
|
14
|
-
argTypes
|
|
14
|
+
argTypes,
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
export const Default = {
|
|
@@ -22,158 +22,66 @@ export const Default = {
|
|
|
22
22
|
export const CheckboxDark = {
|
|
23
23
|
args: { ...defaultdata },
|
|
24
24
|
globals: { backgrounds: { value: "dark" } },
|
|
25
|
-
|
|
26
|
-
(Story) => {
|
|
27
|
-
return `
|
|
28
|
-
<div class="dark">
|
|
29
|
-
${Story()}
|
|
30
|
-
</div>
|
|
31
|
-
`;
|
|
32
|
-
},
|
|
33
|
-
],
|
|
25
|
+
render: (args) => `<div class="dark">${new Formcheck(args).html}</div>`,
|
|
34
26
|
};
|
|
35
27
|
|
|
36
28
|
export const CheckboxSmall = {
|
|
37
29
|
args: { ...defaultdata, id: "checkboxSmall" },
|
|
38
|
-
|
|
39
|
-
(Story) => {
|
|
40
|
-
return `
|
|
41
|
-
<div class="small">
|
|
42
|
-
${Story()}
|
|
43
|
-
</div>
|
|
44
|
-
`;
|
|
45
|
-
},
|
|
46
|
-
],
|
|
30
|
+
render: (args) => `<div class="small">${new Formcheck(args).html}</div>`,
|
|
47
31
|
};
|
|
48
32
|
|
|
49
33
|
export const CheckboxSmallDark = {
|
|
50
34
|
args: { ...defaultdata, id: "checkboxSmallDark" },
|
|
51
35
|
globals: { backgrounds: { value: "dark" } },
|
|
52
|
-
|
|
53
|
-
(Story) => {
|
|
54
|
-
return `
|
|
55
|
-
<div class="dark">
|
|
56
|
-
<div class="small">
|
|
57
|
-
${Story()}
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
`;
|
|
61
|
-
},
|
|
62
|
-
],
|
|
36
|
+
render: (args) => `<div class="dark small">${new Formcheck(args).html}</div>`,
|
|
63
37
|
};
|
|
64
38
|
|
|
65
39
|
export const CheckboxValid = {
|
|
66
40
|
args: { ...defaultdata, id: "checkboxValid" },
|
|
67
|
-
render: (args) => {
|
|
68
|
-
return `
|
|
69
|
-
<div class="valid">${new Formcheck(args).html}</div>
|
|
70
|
-
`;
|
|
71
|
-
},
|
|
41
|
+
render: (args) => `${new Formcheck({ ...args, isValid: true }).html}`,
|
|
72
42
|
};
|
|
73
43
|
|
|
74
44
|
export const CheckboxValidSmall = {
|
|
75
45
|
args: { ...defaultdata, id: "checkboxValidSmall" },
|
|
76
|
-
render: (args) =>
|
|
77
|
-
|
|
78
|
-
<div class="small"><div class="valid">${new Formcheck(args).html}</div></div>
|
|
79
|
-
`;
|
|
80
|
-
},
|
|
46
|
+
render: (args) =>
|
|
47
|
+
`<div class="small">${new Formcheck({ ...args, isValid: true }).html}</div>`,
|
|
81
48
|
};
|
|
82
49
|
|
|
83
50
|
export const CheckboxValidDark = {
|
|
84
51
|
args: { ...defaultdata, id: "checkboxValidDark" },
|
|
85
|
-
render: (args) =>
|
|
86
|
-
|
|
87
|
-
<div class="dark">
|
|
88
|
-
<div class="valid">${new Formcheck(args).html}</div></div>
|
|
89
|
-
`;
|
|
90
|
-
},
|
|
52
|
+
render: (args) =>
|
|
53
|
+
`<div class="dark">${new Formcheck({ ...args, isValid: true }).html}</div>`,
|
|
91
54
|
globals: { backgrounds: { value: "dark" } },
|
|
92
|
-
decorators: [
|
|
93
|
-
(Story) => {
|
|
94
|
-
return `
|
|
95
|
-
<div class="dark"><div class="valid">
|
|
96
|
-
${Story()}
|
|
97
|
-
</div></div>
|
|
98
|
-
`;
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
55
|
};
|
|
102
56
|
|
|
103
57
|
export const CheckboxValidSmallDark = {
|
|
104
58
|
args: { ...defaultdata, id: "checkboxValidSmallDark" },
|
|
105
|
-
render: (args) =>
|
|
106
|
-
|
|
107
|
-
<div class="dark">
|
|
108
|
-
<div class="valid">${new Formcheck(args).html}</div></div>
|
|
109
|
-
`;
|
|
110
|
-
},
|
|
59
|
+
render: (args) =>
|
|
60
|
+
`<div class="dark small">${new Formcheck({ ...args, isValid: true }).html}</div>`,
|
|
111
61
|
globals: { backgrounds: { value: "dark" } },
|
|
112
|
-
decorators: [
|
|
113
|
-
(Story) => {
|
|
114
|
-
return `
|
|
115
|
-
<div class="dark"><div class="small"><div class="valid">
|
|
116
|
-
${Story()}
|
|
117
|
-
</div></div></div>
|
|
118
|
-
`;
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
62
|
};
|
|
122
63
|
|
|
123
64
|
export const CheckboxInvalid = {
|
|
124
65
|
args: { ...defaultdata, id: "checkboxInvalid" },
|
|
125
|
-
render: (args) => {
|
|
126
|
-
return `
|
|
127
|
-
<div class="invalid">${new Formcheck(args).html}</div>
|
|
128
|
-
`;
|
|
129
|
-
},
|
|
66
|
+
render: (args) => `${new Formcheck({ ...args, isValid: false }).html}`,
|
|
130
67
|
};
|
|
131
68
|
|
|
132
69
|
export const CheckboxInvalidSmall = {
|
|
133
70
|
args: { ...defaultdata, id: "checkboxInvalidSmall" },
|
|
134
|
-
render: (args) =>
|
|
135
|
-
|
|
136
|
-
<div class="small"><div class="invalid">${new Formcheck(args).html}</div></div>
|
|
137
|
-
`;
|
|
138
|
-
},
|
|
71
|
+
render: (args) =>
|
|
72
|
+
`<div class="small">${new Formcheck({ ...args, isValid: false }).html}</div>`,
|
|
139
73
|
};
|
|
140
74
|
|
|
141
75
|
export const CheckboxInvalidDark = {
|
|
142
76
|
args: { ...defaultdata, id: "checkboxInvalidDark" },
|
|
143
|
-
render: (args) =>
|
|
144
|
-
|
|
145
|
-
<div class="dark">
|
|
146
|
-
<div class="invalid">${new Formcheck(args).html}</div></div>
|
|
147
|
-
`;
|
|
148
|
-
},
|
|
77
|
+
render: (args) =>
|
|
78
|
+
`<div class="dark">${new Formcheck({ ...args, isValid: false }).html}</div>`,
|
|
149
79
|
globals: { backgrounds: { value: "dark" } },
|
|
150
|
-
decorators: [
|
|
151
|
-
(Story) => {
|
|
152
|
-
return `
|
|
153
|
-
<div class="dark"><div class="invalid">
|
|
154
|
-
${Story()}
|
|
155
|
-
</div></div>
|
|
156
|
-
`;
|
|
157
|
-
},
|
|
158
|
-
],
|
|
159
80
|
};
|
|
160
81
|
|
|
161
82
|
export const CheckboxInvalidSmallDark = {
|
|
162
83
|
args: { ...defaultdata, id: "checkboxInvalidSmallDark" },
|
|
163
|
-
render: (args) =>
|
|
164
|
-
|
|
165
|
-
<div class="dark">
|
|
166
|
-
<div class="invalid">${new Formcheck(args).html}</div></div>
|
|
167
|
-
`;
|
|
168
|
-
},
|
|
84
|
+
render: (args) =>
|
|
85
|
+
`<div class="dark small">${new Formcheck({ ...args, isValid: false }).html}</div>`,
|
|
169
86
|
globals: { backgrounds: { value: "dark" } },
|
|
170
|
-
decorators: [
|
|
171
|
-
(Story) => {
|
|
172
|
-
return `
|
|
173
|
-
<div class="dark"><div class="small"><div class="invalid">
|
|
174
|
-
${Story()}
|
|
175
|
-
</div></div></div>
|
|
176
|
-
`;
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
87
|
};
|
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
"optionalLabel": "(Optional)",
|
|
4
4
|
"hintLabel": "Hint label",
|
|
5
5
|
"listClasses": "field-required",
|
|
6
|
+
"successMessageText": "Success message",
|
|
7
|
+
"errorMessageText": "Error message",
|
|
8
|
+
"isValid": null,
|
|
9
|
+
"type": "radio",
|
|
6
10
|
"listitems": [
|
|
7
11
|
{
|
|
8
|
-
"type": "radio",
|
|
9
12
|
"id": "radioItem1",
|
|
10
13
|
"name": "radioOption",
|
|
11
14
|
"label": "Option 1",
|
|
@@ -14,7 +17,6 @@
|
|
|
14
17
|
"isChecked": false
|
|
15
18
|
},
|
|
16
19
|
{
|
|
17
|
-
"type": "radio",
|
|
18
20
|
"id": "radioItem2",
|
|
19
21
|
"name": "radioOption",
|
|
20
22
|
"label": "Option 2",
|
|
@@ -23,7 +25,6 @@
|
|
|
23
25
|
"isChecked": false
|
|
24
26
|
},
|
|
25
27
|
{
|
|
26
|
-
"type": "radio",
|
|
27
28
|
"id": "radioItem3",
|
|
28
29
|
"name": "radioOption",
|
|
29
30
|
"label": "Option 3",
|
|
@@ -32,7 +33,6 @@
|
|
|
32
33
|
"isChecked": true
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
|
-
"type": "radio",
|
|
36
36
|
"id": "radioItem4",
|
|
37
37
|
"name": "radioOption",
|
|
38
38
|
"label": "Option 4",
|