-
Notifications
You must be signed in to change notification settings - Fork 2
/
Textfield.stories.ts
83 lines (72 loc) · 1.76 KB
/
Textfield.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
81
82
83
import type { Meta, StoryObj } from '@storybook/react';
import Textfield from '../renderer/components/papi-components/Textfield';
const meta: Meta<typeof Textfield> = {
title: 'MUI/Textfield',
component: Textfield,
tags: ['autodocs'],
argTypes: {
variant: {
options: [0, 1],
mapping: ['outlined', 'filled'],
control: {
type: 'select',
labels: ['Outlined', 'Filled'],
},
},
helperText: { control: 'text' },
label: { control: 'text' },
placeholder: { control: 'text' },
disabled: { control: 'boolean' },
error: { control: 'boolean' },
fullWidth: { control: 'boolean' },
required: { control: 'boolean' },
className: { control: 'text' },
},
};
export default meta;
type Story = StoryObj<typeof Textfield>;
export const Default: Story = {
args: {},
};
export const Disabled: Story = {
args: { disabled: true },
};
export const ErrorState: Story = {
args: { error: true, helperText: 'Something is wrong with your input' },
};
export const FullWidth: Story = {
args: { fullWidth: true },
};
export const HelperText: Story = {
args: { helperText: 'This is helper text' },
};
export const Placeholder: Story = {
args: {
placeholder: 'This is placeholder text',
},
};
export const Label: Story = {
args: { label: 'This is a label' },
};
export const Required: Story = {
args: {
label: 'This field is required',
required: true,
},
};
export const Events: Story = {
args: {
onChange() {
// eslint-disable-next-line no-console
console.log('Changed');
},
onBlur() {
// eslint-disable-next-line no-console
console.log('Lost focus');
},
onFocus() {
// eslint-disable-next-line no-console
console.log('Got focus');
},
},
};