Upgrade to Storybook 7 (#1386)

* Migrate

* Config updates

* Remove

* No require-from-string

* Update lock file

* Fix types

* Doesn't work

* Update to CSF3
This commit is contained in:
Nathan Bierema 2023-04-06 21:39:14 -04:00 committed by GitHub
parent 59be92a8af
commit c52cfbe469
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 2460 additions and 5276 deletions

View File

@ -43,12 +43,6 @@
"pnpm": { "pnpm": {
"overrides": { "overrides": {
"@babel/highlight>chalk": "Methuselah96/chalk#v2-without-process" "@babel/highlight>chalk": "Methuselah96/chalk#v2-without-process"
},
"peerDependencyRules": {
"allowedVersions": {
"react": "18",
"react-dom": "18"
}
} }
} }
} }

View File

@ -1,14 +0,0 @@
module.exports = {
core: {
builder: 'webpack5',
},
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
{
name: '@storybook/addon-essentials',
options: {
backgrounds: false,
},
},
],
};

View File

@ -0,0 +1,24 @@
import type { StorybookConfig } from '@storybook/react-webpack5';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
{
name: '@storybook/addon-essentials',
options: {
backgrounds: false,
},
},
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-webpack5',
options: {},
},
docs: {
autodocs: 'tag',
},
};
export default config;

View File

@ -1,12 +1,26 @@
import React from 'react'; import React from 'react';
import type { Preview } from '@storybook/react';
import { Container } from '../src'; import { Container } from '../src';
import { listSchemes, listThemes } from '../src/utils/theme'; import { listSchemes, listThemes } from '../src/utils/theme';
export const parameters = { const withThemeProvider = (Story, context) => (
actions: { argTypesRegex: '^on[A-Z].*' }, <Container
}; themeData={{
theme: context.globals.theme,
scheme: context.globals.scheme,
colorPreference: context.globals.color,
}}
>
<Story {...context} />
</Container>
);
export const globalTypes = { const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
},
globalTypes: {
theme: { theme: {
name: 'Theme', name: 'Theme',
description: 'Global theme for components', description: 'Global theme for components',
@ -34,17 +48,8 @@ export const globalTypes = {
showName: true, showName: true,
}, },
}, },
},
decorators: [withThemeProvider],
}; };
const withThemeProvider = (Story, context) => ( export default preview;
<Container
themeData={{
theme: context.globals.theme,
scheme: context.globals.scheme,
colorPreference: context.globals.color,
}}
>
<Story {...context} />
</Container>
);
export const decorators = [withThemeProvider];

View File

@ -25,8 +25,8 @@
}, },
"scripts": { "scripts": {
"start": "pnpm run storybook", "start": "pnpm run storybook",
"storybook": "start-storybook --port 6006 --static-dir ./fonts", "storybook": "storybook dev --port 6006 --static-dir ./fonts",
"build:storybook": "build-storybook --static-dir ./fonts --quiet", "build:storybook": "storybook build --static-dir ./fonts --quiet",
"build": "pnpm run build:lib && pnpm run build:storybook", "build": "pnpm run build:lib && pnpm run build:storybook",
"build:lib": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types && pnpm run build:css", "build:lib": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types && pnpm run build:css",
"build:cjs": "babel src --extensions \".ts,.tsx\" --out-dir lib/cjs", "build:cjs": "babel src --extensions \".ts,.tsx\" --out-dir lib/cjs",
@ -67,10 +67,11 @@
"@babel/preset-env": "^7.20.2", "@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6", "@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.0", "@babel/preset-typescript": "^7.21.0",
"@storybook/addon-essentials": "^6.5.16", "@storybook/addon-essentials": "^7.0.2",
"@storybook/builder-webpack5": "^6.5.16", "@storybook/addon-interactions": "^7.0.2",
"@storybook/manager-webpack5": "^6.5.16", "@storybook/addon-links": "^7.0.2",
"@storybook/react": "^6.5.16", "@storybook/react": "^7.0.2",
"@storybook/react-webpack5": "^7.0.2",
"@testing-library/dom": "^9.2.0", "@testing-library/dom": "^9.2.0",
"@testing-library/react": "^14.0.0", "@testing-library/react": "^14.0.0",
"@testing-library/user-event": "^14.4.3", "@testing-library/user-event": "^14.4.3",
@ -93,8 +94,8 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-is": "^18.2.0", "react-is": "^18.2.0",
"require-from-string": "^2.0.2",
"rimraf": "^4.4.1", "rimraf": "^4.4.1",
"storybook": "^7.0.2",
"styled-components": "^5.3.9", "styled-components": "^5.3.9",
"stylelint": "^15.3.0", "stylelint": "^15.3.0",
"stylelint-config-prettier": "^9.0.5", "stylelint-config-prettier": "^9.0.5",

View File

@ -1,15 +1,16 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { MdFiberManualRecord } from 'react-icons/md'; import { MdFiberManualRecord } from 'react-icons/md';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Button from './'; import Button from './';
import { ButtonProps } from './Button';
export default { const meta: Meta = {
title: 'Button', title: 'Button',
component: Button, component: Button,
}; };
export default meta;
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
height: 100%; height: 100%;
@ -18,41 +19,45 @@ const Container = styled.div`
align-items: center; align-items: center;
`; `;
const Template: Story<ButtonProps> = (args) => ( type Story = StoryObj<typeof Button>;
export const Default: Story = {
render: (args) => (
<Container> <Container>
<Button {...args} /> <Button {...args} />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
title: 'Hello Tooltip! \\a And from new line hello!', title: 'Hello Tooltip! \\a And from new line hello!',
tooltipPosition: 'top', tooltipPosition: 'top',
primary: true, primary: true,
size: 'normal', size: 'normal',
disabled: false, disabled: false,
children: 'Hello Button', children: 'Hello Button',
}; },
Default.argTypes = { argTypes: {
onClick: { control: { disable: true } }, onClick: { control: { disable: true } },
type: { control: { disable: true } }, type: { control: { disable: true } },
mark: { control: { disable: true } }, mark: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };
export const Mark = Template.bind({}); export const Mark: Story = {
Mark.args = { render: Default.render,
args: {
mark: 'base08', mark: 'base08',
title: 'Hello Tooltip', title: 'Hello Tooltip',
tooltipPosition: 'top', tooltipPosition: 'top',
size: 'normal', size: 'normal',
disabled: false, disabled: false,
children: <MdFiberManualRecord />, children: <MdFiberManualRecord />,
}; },
Mark.argTypes = { argTypes: {
children: { control: { disable: true } }, children: { control: { disable: true } },
onClick: { control: { disable: true } }, onClick: { control: { disable: true } },
type: { control: { disable: true } }, type: { control: { disable: true } },
primary: { control: { disable: true } }, primary: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };

View File

@ -1,15 +1,16 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import ContextMenu from './'; import ContextMenu from './';
import { items } from './data'; import { items } from './data';
import { ContextMenuProps } from './ContextMenu';
export default { const meta: Meta = {
title: 'ContextMenu', title: 'ContextMenu',
component: ContextMenu, component: ContextMenu,
}; };
export default meta;
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
height: 100%; height: 100%;
@ -18,21 +19,23 @@ const Container = styled.div`
align-items: center; align-items: center;
`; `;
const Template: Story<ContextMenuProps> = (args) => ( type Story = StoryObj<typeof ContextMenu>;
export const Default: Story = {
render: (args) => (
<Container> <Container>
<ContextMenu {...args} /> <ContextMenu {...args} />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
visible: true, visible: true,
x: 100, x: 100,
y: 100, y: 100,
items, items,
}; },
Default.argTypes = { argTypes: {
visible: { control: { disable: true } }, visible: { control: { disable: true } },
items: { control: { disable: true } }, items: { control: { disable: true } },
onClick: { control: { disable: true } }, onClick: { control: { disable: true } },
},
}; };

View File

@ -1,21 +1,19 @@
import React from 'react'; import React from 'react';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Dialog from './'; import Dialog from './';
import { schema, uiSchema, formData } from '../Form/schema'; import { schema, uiSchema, formData } from '../Form/schema';
import { DialogProps } from './Dialog';
import { Props as FormProps } from '../Form/Form';
export default { const meta: Meta = {
title: 'Dialog', title: 'Dialog',
component: Dialog, component: Dialog,
}; };
const Template: Story<DialogProps | (DialogProps & FormProps<unknown>)> = ( export default meta;
args
) => <Dialog {...args} />;
export const Default = Template.bind({}); type Story = StoryObj<typeof Dialog>;
Default.args = {
export const Default: Story = {
args: {
title: 'Dialog Title', title: 'Dialog Title',
submitText: 'Submit!', submitText: 'Submit!',
open: true, open: true,
@ -24,16 +22,17 @@ Default.args = {
modal: false, modal: false,
fullWidth: false, fullWidth: false,
children: 'Hello Dialog!', children: 'Hello Dialog!',
}; },
Default.argTypes = { argTypes: {
actions: { control: { disable: true } }, actions: { control: { disable: true } },
onDismiss: { control: { disable: true } }, onDismiss: { control: { disable: true } },
onSubmit: { control: { disable: true } }, onSubmit: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };
export const WithForm = Template.bind({}); export const WithForm: Story = {
WithForm.args = { args: {
open: true, open: true,
noHeader: false, noHeader: false,
noFooter: false, noFooter: false,
@ -42,8 +41,8 @@ WithForm.args = {
formData, formData,
schema, schema,
uiSchema, uiSchema,
}; },
WithForm.argTypes = { argTypes: {
title: { control: { disable: true } }, title: { control: { disable: true } },
children: { control: { disable: true } }, children: { control: { disable: true } },
actions: { control: { disable: true } }, actions: { control: { disable: true } },
@ -51,4 +50,5 @@ WithForm.argTypes = {
onDismiss: { control: { disable: true } }, onDismiss: { control: { disable: true } },
onSubmit: { control: { disable: true } }, onSubmit: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };

View File

@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Editor from './'; import Editor from './';
import { default as WithTabsComponent, WithTabsProps } from './WithTabs'; import { default as WithTabsComponent, WithTabsProps } from './WithTabs';
import { EditorProps } from './Editor';
const value = ` const value = `
var themes = []; var themes = [];
@ -12,39 +11,39 @@ function getThemes() {
} }
`; `;
export default { const meta: Meta = {
title: 'Editor', title: 'Editor',
component: Editor, component: Editor,
}; };
const Template: Story<EditorProps> = (args) => <Editor {...args} />; export default meta;
export const Default = Template.bind({}); type Story = StoryObj<typeof Editor>;
Default.args = {
export const Default: Story = {
args: {
value, value,
lineNumbers: true, lineNumbers: true,
lineWrapping: false, lineWrapping: false,
foldGutter: true, foldGutter: true,
readOnly: false, readOnly: false,
autofocus: true, autofocus: true,
}; },
Default.argTypes = { argTypes: {
autofocus: { control: { disable: true } }, autofocus: { control: { disable: true } },
mode: { control: { disable: true } }, mode: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
onChange: { control: { disable: true } }, onChange: { control: { disable: true } },
},
}; };
const WithTabsTemplate: Story<WithTabsProps> = (args) => ( export const WithTabs: StoryObj<WithTabsProps> = {
<WithTabsComponent {...args} /> render: (args) => <WithTabsComponent {...args} />,
); args: {
export const WithTabs = WithTabsTemplate.bind({});
WithTabs.args = {
lineNumbers: true, lineNumbers: true,
position: 'left', position: 'left',
}; },
WithTabs.argTypes = { argTypes: {
value: { control: { disable: true } }, value: { control: { disable: true } },
mode: { control: { disable: true } }, mode: { control: { disable: true } },
lineWrapping: { control: { disable: true } }, lineWrapping: { control: { disable: true } },
@ -53,4 +52,5 @@ WithTabs.argTypes = {
foldGutter: { control: { disable: true } }, foldGutter: { control: { disable: true } },
autofocus: { control: { disable: true } }, autofocus: { control: { disable: true } },
onChange: { control: { disable: true } }, onChange: { control: { disable: true } },
} as any; } as any,
};

View File

@ -1,26 +1,28 @@
import React from 'react'; import React from 'react';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Form from './'; import Form from './';
import { schema, uiSchema, formData } from './schema'; import { schema, uiSchema, formData } from './schema';
import { Props as FormProps } from './Form';
export default { const meta: Meta = {
title: 'Form', title: 'Form',
component: Form, component: Form,
}; };
const Template: Story<FormProps<unknown>> = (args) => <Form {...args} />; export default meta;
export const Default = Template.bind({}); type Story = StoryObj<typeof Form>;
Default.args = {
export const Default: Story = {
args: {
formData, formData,
schema, schema,
uiSchema, uiSchema,
submitText: 'Submit', submitText: 'Submit',
}; },
Default.argTypes = { argTypes: {
children: { control: { disable: true } }, children: { control: { disable: true } },
primaryButton: { control: { disable: true } }, primaryButton: { control: { disable: true } },
noSubmit: { control: { disable: true } }, noSubmit: { control: { disable: true } },
widgets: { control: { disable: true } }, widgets: { control: { disable: true } },
},
}; };

View File

@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Notification from './'; import Notification from './';
import { NotificationProps } from './Notification';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
@ -12,23 +11,27 @@ const Container = styled.div`
align-items: center; align-items: center;
`; `;
export default { const meta: Meta = {
title: 'Notification', title: 'Notification',
component: Notification, component: Notification,
}; };
const Template: Story<NotificationProps> = (args) => ( export default meta;
type Story = StoryObj<typeof Notification>;
export const Default: Story = {
render: (args) => (
<Container> <Container>
<Notification {...args} /> <Notification {...args} />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
type: 'warning', type: 'warning',
children: 'Hello Notification', children: 'Hello Notification',
}; },
Default.argTypes = { argTypes: {
onClose: { control: { disable: true } }, onClose: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };

View File

@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import SegmentedControl from './'; import SegmentedControl from './';
import { SegmentedControlProps } from './SegmentedControl';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
@ -12,25 +11,28 @@ const Container = styled.div`
align-items: center; align-items: center;
`; `;
export default { const meta: Meta = {
title: 'SegmentedControl', title: 'SegmentedControl',
component: SegmentedControl, component: SegmentedControl,
}; };
// eslint-disable-next-line react/prop-types export default meta;
const Template: Story<SegmentedControlProps> = ({ values, ...args }) => (
type Story = StoryObj<typeof SegmentedControl>;
export const Default: Story = {
render: ({ values, ...args }) => (
<Container> <Container>
<SegmentedControl values={['Button1', 'Button2', 'Button3']} {...args} /> <SegmentedControl values={['Button1', 'Button2', 'Button3']} {...args} />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
selected: 'Button1', selected: 'Button1',
disabled: false, disabled: false,
}; },
Default.argTypes = { argTypes: {
values: { control: { disable: true } }, values: { control: { disable: true } },
onClick: { control: { disable: true } }, onClick: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };

View File

@ -2,8 +2,7 @@ import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import Select from './'; import Select from './';
import { options } from './options'; import { options } from './options';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import { SelectProps } from './Select';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
@ -17,18 +16,17 @@ const Container = styled.div`
} }
`; `;
export default { const meta: Meta = {
title: 'Select', title: 'Select',
component: Select, component: Select,
}; };
type TemplateArgs = Omit< export default meta;
SelectProps<{ value: string; label: string }, boolean>,
'value'
> & { value: string };
// eslint-disable-next-line react/prop-types type Story = StoryObj<typeof Select>;
const Template: Story<TemplateArgs> = ({ value, ...args }) => (
export const Default: Story = {
render: ({ value, ...args }) => (
<Container> <Container>
<Select <Select
options={options} options={options}
@ -36,10 +34,8 @@ const Template: Story<TemplateArgs> = ({ value, ...args }) => (
{...args} {...args}
/> />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
value: 'one', value: 'one',
maxMenuHeight: 300, maxMenuHeight: 300,
isClearable: false, isClearable: false,
@ -48,9 +44,10 @@ Default.args = {
isMulti: false, isMulti: false,
isSearchable: true, isSearchable: true,
menuPlacement: 'bottom', menuPlacement: 'bottom',
}; },
Default.argTypes = { argTypes: {
onChange: { onChange: {
action: 'selected', action: 'selected',
}, },
},
}; };

View File

@ -1,8 +1,7 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Slider from './'; import Slider from './';
import { SliderProps } from './Slider';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
@ -12,19 +11,22 @@ const Container = styled.div`
align-items: center; align-items: center;
`; `;
export default { const meta: Meta = {
title: 'Slider', title: 'Slider',
component: Slider, component: Slider,
}; };
const Template: Story<SliderProps> = (args) => ( export default meta;
type Story = StoryObj<typeof Slider>;
export const Default: Story = {
render: (args) => (
<Container> <Container>
<Slider {...args} /> <Slider {...args} />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
value: 0, value: 0,
min: 0, min: 0,
max: 100, max: 100,
@ -32,8 +34,9 @@ Default.args = {
sublabel: '(sublabel}', sublabel: '(sublabel}',
withValue: false, withValue: false,
disabled: false, disabled: false,
}; },
Default.argTypes = { argTypes: {
onChange: { control: { disable: true } }, onChange: { control: { disable: true } },
theme: { control: { disable: true } }, theme: { control: { disable: true } },
},
}; };

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import Tabs from './'; import Tabs from './';
import { tabs, simple10Tabs } from './data'; import { tabs, simple10Tabs } from './data';
import { TabsProps } from './Tabs'; import { TabsProps } from './Tabs';
@ -13,41 +13,49 @@ const Container = styled.div`
align-items: center; align-items: center;
`; `;
export default { const meta: Meta = {
title: 'Tabs', title: 'Tabs',
component: Tabs, component: Tabs,
}; };
const Template: Story<TabsProps<object>> = (args) => ( export default meta;
type Story = StoryObj<typeof Tabs>;
export const Default: Story = {
render: (args) => (
<Container> <Container>
<Tabs {...args} /> <Tabs {...args} />
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
tabs: simple10Tabs, tabs: simple10Tabs,
selected: '2', selected: '2',
main: true, main: true,
collapsible: true, collapsible: true,
position: 'left', position: 'left',
}; },
Default.argTypes = { argTypes: {
tabs: { control: { disable: true } }, tabs: { control: { disable: true } },
onClick: { control: { disable: true } }, onClick: { control: { disable: true } },
},
}; };
export const WithContent = ( export const WithContext: StoryObj<TabsProps<{ selected: string }>> = {
Template as Story<TabsProps<{ selected: string }>> render: (args) => (
).bind({}); <Container>
WithContent.args = { <Tabs {...args} />
</Container>
),
args: {
tabs, tabs,
selected: 'Tab2', selected: 'Tab2',
main: false, main: false,
collapsible: false, collapsible: false,
position: 'left', position: 'left',
}; },
WithContent.argTypes = { argTypes: {
tabs: { control: { disable: true } }, tabs: { control: { disable: true } },
onClick: { control: { disable: true } }, onClick: { control: { disable: true } },
},
}; };

View File

@ -1,6 +1,6 @@
import React, { ReactNode } from 'react'; import React, { ReactNode } from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { Story } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import { MdPlayArrow } from 'react-icons/md'; import { MdPlayArrow } from 'react-icons/md';
import { MdFiberManualRecord } from 'react-icons/md'; import { MdFiberManualRecord } from 'react-icons/md';
import { MdKeyboardArrowLeft } from 'react-icons/md'; import { MdKeyboardArrowLeft } from 'react-icons/md';
@ -34,11 +34,13 @@ const SliderContainer = styled.div`
height: 80px; height: 80px;
`; `;
export default { const meta: Meta = {
title: 'Toolbar', title: 'Toolbar',
component: Toolbar, component: Toolbar,
}; };
export default meta;
interface TemplateArgs { interface TemplateArgs {
borderPosition: BorderPosition; borderPosition: BorderPosition;
title?: string; title?: string;
@ -48,7 +50,8 @@ interface TemplateArgs {
label: ReactNode; label: ReactNode;
} }
const Template: Story<TemplateArgs> = ({ export const Default: StoryObj<TemplateArgs> = {
render: ({
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
borderPosition, borderPosition,
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
@ -86,17 +89,15 @@ const Template: Story<TemplateArgs> = ({
<Select options={options} /> <Select options={options} />
</Toolbar> </Toolbar>
</Container> </Container>
); ),
args: {
export const Default = Template.bind({});
Default.args = {
borderPosition: 'top', borderPosition: 'top',
title: 'Hello Tooltip', title: 'Hello Tooltip',
tooltipPosition: 'top', tooltipPosition: 'top',
disabled: false, disabled: false,
label: 'Hello Button', label: 'Hello Button',
}; },
Default.argTypes = { argTypes: {
borderPosition: { borderPosition: {
control: { control: {
type: 'select', type: 'select',
@ -121,6 +122,7 @@ Default.argTypes = {
onClick: { onClick: {
action: 'button clicked', action: 'button clicked',
}, },
},
}; };
interface TabsTemplateArgs { interface TabsTemplateArgs {
@ -136,7 +138,8 @@ interface TabsTemplateArgs {
position: Position; position: Position;
} }
const TabsTemplate: Story<TabsTemplateArgs> = ({ export const Tabs: StoryObj<TabsTemplateArgs> = {
render: ({
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
title, title,
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
@ -187,10 +190,8 @@ const TabsTemplate: Story<TabsTemplateArgs> = ({
</Button> </Button>
</Toolbar> </Toolbar>
</Container> </Container>
); ),
args: {
export const Tabs = TabsTemplate.bind({});
Tabs.args = {
title: 'Hello Tooltip', title: 'Hello Tooltip',
tooltipPosition: 'top', tooltipPosition: 'top',
disabled: false, disabled: false,
@ -199,8 +200,8 @@ Tabs.args = {
main: true, main: true,
collapsible: true, collapsible: true,
position: 'center', position: 'center',
}; },
Tabs.argTypes = { argTypes: {
tooltipPosition: { tooltipPosition: {
control: { control: {
type: 'select', type: 'select',
@ -228,6 +229,7 @@ Tabs.argTypes = {
options: ['left', 'right', 'center'], options: ['left', 'right', 'center'],
}, },
}, },
},
}; };
interface WithSliderTemplateArgs { interface WithSliderTemplateArgs {
@ -246,7 +248,8 @@ interface WithSliderTemplateArgs {
segmentedControlOnClick: (value: string) => void; segmentedControlOnClick: (value: string) => void;
} }
const WithSliderTemplate: Story<WithSliderTemplateArgs> = ({ export const WithSlider: StoryObj<WithSliderTemplateArgs> = {
render: ({
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
title, title,
// eslint-disable-next-line react/prop-types // eslint-disable-next-line react/prop-types
@ -315,10 +318,8 @@ const WithSliderTemplate: Story<WithSliderTemplateArgs> = ({
</Toolbar> </Toolbar>
</SliderContainer> </SliderContainer>
</Container> </Container>
); ),
args: {
export const WithSlider = WithSliderTemplate.bind({});
WithSlider.args = {
title: 'Play', title: 'Play',
tooltipPosition: 'top', tooltipPosition: 'top',
value: 80, value: 80,
@ -327,8 +328,8 @@ WithSlider.args = {
label: 'Slider label', label: 'Slider label',
withValue: false, withValue: false,
selected: 'live', selected: 'live',
}; },
WithSlider.argTypes = { argTypes: {
tooltipPosition: { tooltipPosition: {
control: { control: {
type: 'select', type: 'select',
@ -365,4 +366,5 @@ WithSlider.argTypes = {
segmentedControlOnClick: { segmentedControlOnClick: {
action: 'button selected', action: 'button selected',
}, },
},
}; };

File diff suppressed because it is too large Load Diff