Skip to content

Commit d2b1dfa

Browse files
Storybook: Add repeater with table layout
1 parent 7d28786 commit d2b1dfa

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import type { Meta, StoryObj } from '@storybook/react-vite'
2+
3+
import { Field } from '../../../../index'
4+
5+
const fields = [
6+
{
7+
label: 'Text',
8+
type: 'text',
9+
name: 'text_name',
10+
},
11+
{
12+
label: 'Date field',
13+
type: 'date-picker',
14+
name: 'date_picker_name',
15+
},
16+
{
17+
label: 'Color',
18+
type: 'color-picker',
19+
name: 'color',
20+
},
21+
]
22+
23+
const meta = {
24+
title: 'Repeater (Legacy)/Table',
25+
component: Field,
26+
decorators: [
27+
Story => (
28+
<div style={{ minWidth: '600px' }}>
29+
<Story />
30+
</div>
31+
)
32+
],
33+
parameters: {
34+
layout: 'padded'
35+
},
36+
args: {
37+
type: 'repeater',
38+
label: 'Repeater field',
39+
layout: 'table',
40+
fields: fields,
41+
}
42+
} satisfies Meta<typeof Field>
43+
44+
export default meta
45+
46+
type Story = StoryObj<typeof meta>
47+
48+
export const Default: Story = {}
49+
50+
export const NonRepeatable: Story = {
51+
args: {
52+
repeatable: false,
53+
}
54+
}
55+
56+
export const MaxRows: Story = {
57+
args: {
58+
maxlength: 3,
59+
}
60+
}
61+
62+
/**
63+
* With bulk actions for batch operations on rows
64+
*/
65+
export const BulkActions: Story = {
66+
args: {
67+
useBulk: true,
68+
}
69+
}

0 commit comments

Comments
 (0)