import React, { useState } from 'react'; import { Banner } from '../src/lib/components/banner/Banner.component'; import { Button } from '../src/lib/components/buttonv2/Buttonv2.component'; import { Form, FormGroup, FormSection, } from '../src/lib/components/form/Form.component'; import { Icon } from '../src/lib/components/icon/Icon.component'; import { Input } from '../src/lib/components/inputv2/inputv2'; import { Select } from '../src/lib/components/selectv2/Selectv2.component'; import { Text } from '../src/lib/components/text/Text.component'; import { Toggle } from '../src/lib/components/toggle/Toggle.component'; import { Stack } from '../src/lib/spacing'; import { iconArgType } from './controls'; import { Accordion } from '../src/lib/next'; export default { title: 'Templates/Form', component: Form, args: { kind: 'page', title: 'My Form', subTitle: 'Some Subtitle', }, argTypes: { layout: { control: false, description: 'Control the layout of the form, it is an object containing "kind", "title", "subTitle" and "icon", if the kind is "page" the title and subTitle are required', table: { type: { summary: 'Object{kind: "page" | "tab", title: string, subTitle: string, icon: Element}', }, }, }, kind: { options: ['page', 'tab'], control: { type: 'radio' }, }, icon: { if: { arg: 'kind', eq: 'page' }, ...iconArgType, }, title: { control: 'text', if: { arg: 'kind', eq: 'page' }, }, subTitle: { control: 'text', if: { arg: 'kind', eq: 'page' }, }, }, }; export const PageForm = { render: ({ kind, title, subTitle, icon, requireMode }) => { const layout = { kind, title, subTitle, icon, }; const [toggle, setToggle] = useState(true); return (