Skip to content

Commit

Permalink
[open-formulieren/open-forms#3993] Added deriveAddress boolean to add…
Browse files Browse the repository at this point in the history
…ressNL component
  • Loading branch information
vaszig committed May 27, 2024
1 parent 2cd1818 commit beb6ceb
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/components/builder/derive-address.stories.tsx
Original file line number Diff line number Diff line change
@@ -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<typeof DeriveAddress>;

export const Default: StoryObj<typeof DeriveAddress> = {
render: () => <DeriveAddress />,
args: {},
};
25 changes: 25 additions & 0 deletions src/components/builder/derive-address.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<Checkbox
name="disabled"
label={
<FormattedMessage
description="Label for 'DeriveAddress' builder field"
defaultMessage="Derive address"
/>
}
tooltip={tooltip}
/>
);
};

export default DeriveAddress;
1 change: 1 addition & 0 deletions src/components/builder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 2 additions & 0 deletions src/registry/addressNL/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {useIntl} from 'react-intl';
import {
BuilderTabs,
ClearOnHide,
DeriveAddress,
Description,
Hidden,
IsSensitiveData,
Expand Down Expand Up @@ -61,6 +62,7 @@ const EditForm: EditFormDefinition<AddressNLComponentSchema> = () => {
<Description />
<Tooltip />
<PresentationConfig />
<DeriveAddress />
<Hidden />
<ClearOnHide />
<IsSensitiveData />
Expand Down

0 comments on commit beb6ceb

Please sign in to comment.