diff --git a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Form/Isolation/Examples.tsx b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Form/Isolation/Examples.tsx index e6fddeb0594..568b1856cb6 100644 --- a/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Form/Isolation/Examples.tsx +++ b/packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Form/Isolation/Examples.tsx @@ -1,6 +1,7 @@ import ComponentBox from '../../../../../../shared/tags/ComponentBox' -import { Flex } from '@dnb/eufemia/src' -import { Field, Form } from '@dnb/eufemia/src/extensions/forms' +import { Card, Flex, Section } from '@dnb/eufemia/src' +import { Field, Form, Iterate } from '@dnb/eufemia/src/extensions/forms' +import React from 'react' export const UsingCommitButton = () => { return ( @@ -39,3 +40,105 @@ export const UsingCommitButton = () => { ) } + +export const CommitHandleRef = () => { + return ( + + {() => { + const MyForm = () => { + const commitHandleRef = React.useRef(null) + + return ( + + + Ny hovedkontaktperson + + + + + + + + + + + + ) + } + + const Log = () => { + const { data } = Form.useData() + return ( +
+
{JSON.stringify(data)}
+
+ ) + } + + return + }} +
+ ) +} + +export const TransformCommitData = () => { + return ( + + + + Legg til ny hovedkontaktperson + + + + + + Annen person + + + + Ny hovedkontaktperson + { + return { + ...outerData, + persons: [ + ...outerData.persons, + isolatedData.newPerson, + ], + } + }} + > + + + + + + + + + + + + + + + + ) +}