diff --git a/packages/forms/stories/SchemaCore.stories.tsx b/packages/forms/stories/SchemaCore.stories.tsx index 01cd78708e1..f9ddc4b7ad6 100644 --- a/packages/forms/stories/SchemaCore.stories.tsx +++ b/packages/forms/stories/SchemaCore.stories.tsx @@ -7,11 +7,6 @@ export default { title: 'Forms/Schema/Core', component: UIForm, argTypes, - parameters: { - formStoryDisplayMode: { - category: 'concepts', - }, - }, } as Meta; export const ConditionalRender = { diff --git a/packages/forms/stories/SchemaState.stories.tsx b/packages/forms/stories/SchemaState.stories.tsx index 80845a5f1f6..7d285030bf3 100644 --- a/packages/forms/stories/SchemaState.stories.tsx +++ b/packages/forms/stories/SchemaState.stories.tsx @@ -14,9 +14,18 @@ import { customWidgetSchema } from './UIFormStoriesSchemas/customWidget.schema'; import { CustomArrayTemplate } from './CustomArrayTemplate.component'; import { argTypes } from './argTypes'; +function Template({ introduction, ...props }: any) { + return ( + <> + {introduction ? introduction : null} + + + ); +} + const meta: Meta = { title: 'Forms/Schema/State', - component: UIForm, + component: Template, argTypes: { ...argTypes, updating: { @@ -47,33 +56,28 @@ type Story = StoryObj; const updatingProps = updatingSchema.uiSchema.map(w => w.key); export const Updating: Story = { args: { + introduction: ( +
+

Updating status

+

+ Form can disable and add an animation feedback on the widgets. To do so, you need to pass + a UIForm "updating" prop which is an array of the schema keys where to apply +

+
+ ), data: updatingSchema, updating: updatingProps, }, - render: ({ onChange, onSubmit, updating, ...props }) => ( -
-

Updating status

-

- Form can disable and add an animation feedback on the widgets. To do so, you need to pass a - UIForm "updating" prop which is an array of the schema keys where to apply -

- -
- ), }; export const DisplayMode: Story = { args: { data: displayModeSchema, displayMode: 'text', - }, - render: ({ onChange, onSubmit, ...props }) => ( - <> + introduction: (

Form can be used to display data in read only

- - - - ), + ), + }, }; const errorsProps = errorsSchema.uiSchema.reduce( @@ -89,16 +93,6 @@ export const Errors: Story = { data: errorsSchema, errors: errorsProps, }, - render: ({ onChange, onSubmit, ...props }) => ( -
-

Updating status

-

- Form can disable and add an animation feedback on the widgets. To do so, you need to pass a - UIForm "updating" prop which is an array of the schema keys where to apply -

- -
- ), }; function UIFormWithOnSubmitHover(props: any) { @@ -112,41 +106,35 @@ function UIFormWithOnSubmitHover(props: any) { background: hover ? '#EFEFEF' : 'transparent', }} > - { - action('onSubmitEnter')(...args); - setHover(true); - }} - onSubmitLeave={(...args: any) => { - action('onSubmitLeave')(...args); - setHover(false); - }} - /> + ); } export const HoverSubmit: Story = { - render: props => ( -
-

Hover submit handler

-

- Submit can detect if mouse enters or leaves by using onSubmitEnter and{' '} - onSubmitLeave -

- -
- ), -}; -HoverSubmit.args = { - data: hoverSubmitSchema, + args: { + data: hoverSubmitSchema, + introduction: ( + <> +

Hover submit handler

+

+ Submit can detect if mouse enters or leaves by using onSubmitEnter and{' '} + onSubmitLeave +

+ + ), + onSubmitEnter: (...args: any) => { + action('onSubmitEnter')(...args); + }, + onSubmitLeave: (...args: any) => { + action('onSubmitLeave')(...args); + }, + }, }; export const CustomActions: Story = { args: { - schema: customActionsSchema, + data: customActionsSchema, actions: [ { title: 'Reset', @@ -180,29 +168,13 @@ export const CustomActions: Story = { }, ], }, - render: ({ schema, onSubmit, onReset, onTrigger, actions }) => ( -
- -
- ), }; export const CustomTemplate: Story = { args: { templates: { array: CustomArrayTemplate }, - schema: customTemplateSchema, + data: customTemplateSchema, }, - render: ({ templates, schema, onChange, onSubmit }) => ( -
- -
- ), }; function CustomWidgetComponent({ value }: { value: string }) { @@ -222,9 +194,6 @@ function CustomWidgetComponent({ value }: { value: string }) { export const CustomWidget: Story = { args: { widgets: { custom: CustomWidgetComponent }, - schema: customWidgetSchema, + data: customWidgetSchema, }, - render: ({ widgets, schema, onChange, onSubmit }) => ( - - ), };