-
Notifications
You must be signed in to change notification settings - Fork 247
Expand file tree
/
Copy pathMultiSelect.stories.tsx
More file actions
78 lines (66 loc) · 1.88 KB
/
MultiSelect.stories.tsx
File metadata and controls
78 lines (66 loc) · 1.88 KB
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
import type { StoryFn, Meta } from '@storybook/react-webpack5';
import { action } from 'storybook/actions';
import type { SelectOption } from '../Select';
import MultiSelect from './MultiSelect';
import MultiSelectFiltered from './MultiSelectFiltered';
export default {
title: 'Inputs/MultiSelect',
component: MultiSelect,
subcomponents: {
MultiSelectFiltered,
},
} satisfies Meta<typeof MultiSelect>;
const options: SelectOption[] = [
['1', 'a teste 1'],
['2', 'b teste 2', true],
['3', 'c teste 3'],
['4', 'd teste 4'],
['5', 'd teste 5'],
['6', 'd teste 6'],
['7', 'd teste 7'],
['8', 'd teste 8'],
['9', 'd teste 9'],
['10', 'd teste 10'],
];
const Template: StoryFn<typeof MultiSelect> = (args) => (
<MultiSelect aria-label='MultiSelect' {...args} />
);
export const Default: StoryFn<typeof MultiSelect> = Template.bind({});
Default.args = {
placeholder: 'Placeholder here...',
options,
};
export const WithValue: StoryFn<typeof MultiSelect> = Template.bind({});
WithValue.args = {
placeholder: 'Placeholder here...',
options,
value: ['1', '2'],
};
export const Error: StoryFn<typeof MultiSelect> = Template.bind({});
Error.args = {
error: 'Error',
placeholder: 'Placeholder here...',
options,
};
export const Disabled: StoryFn<typeof MultiSelect> = Template.bind({});
Disabled.args = {
disabled: true,
placeholder: 'Placeholder here...',
options,
};
export const CustomEmpty: StoryFn<typeof MultiSelect> = Template.bind({});
CustomEmpty.args = {
customEmpty: 'Custom Empty Placeholder',
placeholder: 'Placeholder here...',
options: [],
};
const FilteredTemplate: StoryFn<typeof MultiSelectFiltered> = (args) => (
<MultiSelectFiltered {...args} />
);
export const WithFilter: StoryFn<typeof MultiSelectFiltered> =
FilteredTemplate.bind({});
WithFilter.args = {
placeholder: 'Placeholder here...',
onChange: action('change'),
options,
};