-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscl-checkbox.stories.ts
80 lines (72 loc) · 1.63 KB
/
scl-checkbox.stories.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { html, TemplateResult } from 'lit';
import './scl-checkbox.js';
export default {
title: 'scl-checkbox',
component: 'scl-checkbox',
};
interface Story<T> {
(args: T): TemplateResult;
args?: Partial<T>;
argTypes?: Record<string, unknown>;
}
interface ArgTypes {
value: 'true' | 'false' | null;
disabled: boolean;
label: string;
defaultValue: 'true' | 'false';
supportingText: string;
nullable: boolean;
}
const CheckboxTemplate: Story<ArgTypes> = ({
value = 'false',
disabled = false,
label = 'label',
defaultValue = 'true',
supportingText = 'supportingText',
}) =>
html`
<scl-checkbox
.value="${value}"
?disabled=${disabled}
label="${label}"
defaultValue="${defaultValue}"
supportingText="${supportingText}"
>
</scl-checkbox>
`;
export const PlainCheckbox = CheckboxTemplate.bind({});
PlainCheckbox.args = {
value: null,
disabled: false,
label: 'label',
defaultValue: 'true',
supportingText: 'supportingText',
nullable: false,
};
const NulledCheckboxTemplate: Story<ArgTypes> = ({
value = null,
disabled = false,
label = 'label',
defaultValue = 'false',
supportingText = 'supportingText',
}) =>
html`
<scl-checkbox
.value="${value}"
?disabled=${disabled}
label="${label}"
defaultValue="${defaultValue}"
supportingText="${supportingText}"
?nullable=${true}
>
</scl-checkbox>
`;
export const NulledCheckbox = NulledCheckboxTemplate.bind({});
NulledCheckbox.args = {
value: null,
disabled: false,
label: 'label',
defaultValue: 'true',
supportingText: 'supportingText',
nullable: true,
};