diff --git a/src/components/list-field/Docs.mdx b/src/components/list-field/Docs.mdx index 3e58fb3..9e07fcb 100644 --- a/src/components/list-field/Docs.mdx +++ b/src/components/list-field/Docs.mdx @@ -90,16 +90,6 @@ const Example = () => ( - ✅ Handles adding and removal of array items. - ✅ Supports deeply nested arrays in arrays. -## Usage - -```ts -import { ListField } from "@form-atoms/field"; -``` - -### Props - - - ## Examples ### Flat diff --git a/src/components/list-field/ListField.stories.tsx b/src/components/list-field/ListField.stories.tsx index 4a8ad48..01b6eeb 100644 --- a/src/components/list-field/ListField.stories.tsx +++ b/src/components/list-field/ListField.stories.tsx @@ -31,6 +31,7 @@ export const Primary = formStory({ }, }, args: { + resettable: false, fields: { envVars: envVarsBuilder([ { variable: "GITHUB_TOKEN", value: "ff52d09a" }, @@ -92,6 +93,7 @@ export const Flat = formStory({ }, }, args: { + resettable: false, fields: { benefits: typescriptBenefits(["safe function calls", "it's fast"]), }, @@ -138,6 +140,7 @@ export const Prepend = formStory({ }, }, args: { + resettable: false, fields: { hobbies: [fieldAtom({ value: "gardening" })], }, @@ -179,6 +182,7 @@ export const Ordering = formStory({ }, }, args: { + resettable: false, fields: { hobbies: [fieldAtom({ value: "gardening" })], }, @@ -215,6 +219,7 @@ export const Ordering = formStory({ export const Nested = formStory({ args: { + resettable: false, fields: { people: [ { @@ -296,6 +301,7 @@ export const Nested = formStory({ export const WithRadioControl = formStory({ args: { + resettable: false, fields: { phones: [ { diff --git a/src/scenarios/StoryForm.tsx b/src/scenarios/StoryForm.tsx index 6c54e99..e75f74d 100644 --- a/src/scenarios/StoryForm.tsx +++ b/src/scenarios/StoryForm.tsx @@ -6,6 +6,7 @@ import { RenderProp } from "react-render-prop-type"; type Props = { fields: Fields; + resettable?: boolean; required?: boolean; } & RenderProp<{ form: FormAtom; @@ -14,6 +15,7 @@ type Props = { }>; export const StoryForm = ({ + resettable = true, fields, children, required = true, @@ -25,9 +27,11 @@ export const StoryForm = ({
{children({ fields, required, form })} - + {resettable && ( + + )}
); };