= props => {
className={classNames('usa-label', {
'usa-label--error': props.error,
})}
- id={`input-message-${props.inputId}`}
+ id={`input-message-${id}`}
>
{props.label}
{props.error && (
{props.error.message}
@@ -34,13 +37,13 @@ const TextInput: PatternComponent = props => {
className={classNames('usa-input', {
'usa-input--error': props.error,
})}
- id={`input-${props.inputId}`}
+ id={`input-${id}`}
defaultValue={props.value}
- {...register(props.inputId || Math.random().toString(), {
+ {...register(id || Math.random().toString(), {
//required: props.required,
})}
type="text"
- aria-describedby={`input-message-${props.inputId}`}
+ aria-describedby={`input-message-${id}`}
/>
diff --git a/packages/design/src/Form/components/index.tsx b/packages/design/src/Form/components/index.tsx
index 1dfb8adc..66e2aca0 100644
--- a/packages/design/src/Form/components/index.tsx
+++ b/packages/design/src/Form/components/index.tsx
@@ -13,6 +13,7 @@ import PageSet from './PageSet/index.js';
import Paragraph from './Paragraph/index.js';
import PhoneNumber from './PhoneNumber/index.js';
import RadioGroup from './RadioGroup/index.js';
+import Repeater from './Repeater/index.js';
import RichText from './RichText/index.js';
import Sequence from './Sequence/index.js';
import SelectDropdown from './SelectDropdown/index.js';
@@ -35,6 +36,7 @@ export const defaultPatternComponents: ComponentForPattern = {
paragraph: Paragraph as PatternComponent,
'phone-number': PhoneNumber as PatternComponent,
'radio-group': RadioGroup as PatternComponent,
+ repeater: Repeater as PatternComponent,
'rich-text': RichText as PatternComponent,
'select-dropdown': SelectDropdown as PatternComponent,
sequence: Sequence as PatternComponent,
diff --git a/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx b/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx
index d4104e29..856d787a 100644
--- a/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx
+++ b/packages/design/src/FormManager/FormEdit/AddPatternDropdown.tsx
@@ -1,9 +1,6 @@
import React, { useState, useRef, useEffect } from 'react';
-
import { defaultFormConfig, type PatternConfig } from '@atj/forms';
-
import { useFormManagerStore } from '../store.js';
-
import styles from './formEditStyles.module.css';
import attachmentIcon from './images/page-icon.svg';
import blockIcon from './images/block-icon.svg';
@@ -46,9 +43,14 @@ const getIconPath = (iconPath: string) => {
return Object.values(icons[iconPath])[0] as string;
};
+interface PatternMenuProps {
+ patternSelected: (patternType: string) => void;
+ title: string;
+}
+
export const AddPatternMenu = () => {
- const addPage = useFormManagerStore(state => state.addPage);
- const { addPattern } = useFormManagerStore(state => ({
+ const { addPage, addPattern } = useFormManagerStore(state => ({
+ addPage: state.addPage,
addPattern: state.addPattern,
}));
@@ -68,25 +70,11 @@ export const AddPatternMenu = () => {
/>
- {
- addPage();
- }}
- >
-
-
-
-
- Page
-
-
+
@@ -94,6 +82,34 @@ export const AddPatternMenu = () => {
);
};
+const MenuItemButton = ({
+ title,
+ onClick,
+ iconPath,
+}: {
+ title: string;
+ onClick: () => void;
+ iconPath: string;
+}) => (
+