Skip to content

Commit 5cebeb0

Browse files
committed
- Updates stories to cover all states
- Adds sass variables for the extra states on checkboxes & radios - All stories now include labels
1 parent 692dd5f commit 5cebeb0

File tree

14 files changed

+423
-397
lines changed

14 files changed

+423
-397
lines changed

scss/bitstyles/base/forms/Label.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
export default ({ children, htmlFor = null, ariaInvalid = false }) => {
1+
export default ({
2+
children,
3+
htmlFor = null,
4+
ariaInvalid = false,
5+
classnames = [],
6+
}) => {
27
const label = document.createElement('label');
38
children.forEach((child) => {
49
label.append(child);
510
});
611
if (ariaInvalid) label.setAttribute('aria-invalid', ariaInvalid);
712
if (htmlFor) label.setAttribute('for', htmlFor);
13+
classnames.forEach((classname) => label.classList.add(classname));
814
return label;
915
};

scss/bitstyles/base/forms/forms.stories.js

Lines changed: 0 additions & 258 deletions
This file was deleted.

scss/bitstyles/base/forms/forms.stories.mdx

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,49 @@ The exception is for radios & checkboxes (see below), which should always be a c
1515
This includes all standard `type="text"` inputs, plus all the text-based inputs such as `email`, `password`, `tel` — take a look at the other stories in the forms section for examples of the other input types.
1616

1717
<Canvas isColumn>
18-
<Story id="base-forms--text-input" />
19-
<Story id="base-forms--text-input-invalid" />
20-
<Story id="base-forms--text-input-disabled" />
18+
<Story id="base-forms-input-text--text-with-value" />
19+
<Story id="base-forms-input-text--text-with-value-invalid" />
20+
<Story id="base-forms-input-text--text-with-value-disabled" />
21+
<Story id="base-forms-input-text--text-empty" />
22+
<Story id="base-forms-input-text--text-empty-invalid" />
23+
<Story id="base-forms-input-text--text-empty-disabled" />
2124
</Canvas>
2225

2326
## Textareas
2427

2528
<Canvas isColumn>
26-
<Story id="base-forms--textarea-base" />
27-
<Story id="base-forms--textarea-invalid" />
28-
<Story id="base-forms--textarea-disabled" />
29+
<Story id="base-forms-textarea--with-value" />
30+
<Story id="base-forms-textarea--with-value-invalid" />
31+
<Story id="base-forms-textarea--with-value-disabled" />
32+
<Story id="base-forms-textarea--empty" />
33+
<Story id="base-forms-textarea--empty-invalid" />
34+
<Story id="base-forms-textarea--empty-disabled" />
2935
</Canvas>
3036

3137
## Checkboxes and Radios
3238

3339
<Canvas isColumn>
34-
<Story id="base-forms--checkbox-input" />
35-
<Story id="base-forms--checkbox-input-checked" />
36-
<Story id="base-forms--checkbox-input-invalid" />
37-
<Story id="base-forms--checkbox-input-disabled" />
40+
<Story id="base-forms-input-checkbox--base" />
41+
<Story id="base-forms-input-checkbox--invalid" />
42+
<Story id="base-forms-input-checkbox--disabled" />
43+
<Story id="base-forms-input-checkbox--checked" />
44+
<Story id="base-forms-input-checkbox--checked-invalid" />
45+
<Story id="base-forms-input-checkbox--checked-disabled" />
3846
</Canvas>
3947

4048
<Canvas isColumn>
41-
<Story id="base-forms--radio-input" />
42-
<Story id="base-forms--radio-input-checked" />
43-
<Story id="base-forms--radio-input-invalid" />
44-
<Story id="base-forms--radio-input-disabled" />
49+
<Story id="base-forms-input-radio--base" />
50+
<Story id="base-forms-input-radio--invalid" />
51+
<Story id="base-forms-input-radio--disabled" />
52+
<Story id="base-forms-input-radio--checked" />
53+
<Story id="base-forms-input-radio--checked-invalid" />
54+
<Story id="base-forms-input-radio--checked-disabled" />
4555
</Canvas>
4656

4757
## Selects
4858

4959
<Canvas isColumn>
50-
<Story id="base-forms--select-base" />
51-
<Story id="base-forms--select-invalid" />
52-
<Story id="base-forms--select-disabled" />
60+
<Story id="base-forms-select--base" />
61+
<Story id="base-forms-select--invalid" />
62+
<Story id="base-forms-select--disabled" />
5363
</Canvas>

0 commit comments

Comments
 (0)