diff --git a/src/components/builder/derive-address.stories.tsx b/src/components/builder/derive-address.stories.tsx new file mode 100644 index 00000000..45d46adb --- /dev/null +++ b/src/components/builder/derive-address.stories.tsx @@ -0,0 +1,27 @@ +import {Meta, StoryObj} from '@storybook/react'; + +import {withFormik} from '@/sb-decorators'; + +import DeriveAddress from './derive-address'; + +export default { + title: 'Formio/Builder/DeriveAddress', + component: DeriveAddress, + decorators: [withFormik], + parameters: { + controls: {hideNoControlsWarning: true}, + docs: { + source: { + type: 'dynamic', + excludeDecorators: true, + }, + }, + modal: {noModal: true}, + formik: {initialValues: {showCharCount: false}}, + }, +} as Meta; + +export const Default: StoryObj = { + render: () => , + args: {}, +}; diff --git a/src/components/builder/derive-address.tsx b/src/components/builder/derive-address.tsx new file mode 100644 index 00000000..407c5249 --- /dev/null +++ b/src/components/builder/derive-address.tsx @@ -0,0 +1,25 @@ +import {FormattedMessage, useIntl} from 'react-intl'; + +import {Checkbox} from '../formio'; + +const DeriveAddress = () => { + const intl = useIntl(); + const tooltip = intl.formatMessage({ + description: "Tooltip for 'DeriveAddress' builder field", + defaultMessage: 'Derive address.', + }); + return ( + + } + tooltip={tooltip} + /> + ); +}; + +export default DeriveAddress; diff --git a/src/components/builder/index.ts b/src/components/builder/index.ts index ae81440f..3a0aa986 100644 --- a/src/components/builder/index.ts +++ b/src/components/builder/index.ts @@ -15,6 +15,7 @@ export {default as Hidden} from './hidden'; export {default as ClearOnHide} from './clear-on-hide'; export {default as IsSensitiveData} from './is-sensitive-data'; export {default as ReadOnly} from './readonly'; +export {default as DeriveAddress} from './derive-address'; export {default as ShowCharCount} from './show-char-count'; export {default as PresentationConfig} from './presentation-config'; export {default as ComponentSelect} from './component-select'; diff --git a/src/registry/addressNL/edit.tsx b/src/registry/addressNL/edit.tsx index f1bdd2f1..c0a80564 100644 --- a/src/registry/addressNL/edit.tsx +++ b/src/registry/addressNL/edit.tsx @@ -4,6 +4,7 @@ import {useIntl} from 'react-intl'; import { BuilderTabs, ClearOnHide, + DeriveAddress, Description, Hidden, IsSensitiveData, @@ -61,6 +62,7 @@ const EditForm: EditFormDefinition = () => { +