diff options
Diffstat (limited to 'packages/web-util/src/forms/forms.ts')
-rw-r--r-- | packages/web-util/src/forms/forms.ts | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/packages/web-util/src/forms/forms.ts b/packages/web-util/src/forms/forms.ts index 1c212fafa..3b8620bfb 100644 --- a/packages/web-util/src/forms/forms.ts +++ b/packages/web-util/src/forms/forms.ts @@ -1,34 +1,21 @@ -import { TranslatedString } from "@gnu-taler/taler-util"; -import { InputText } from "./InputText.js"; -import { InputAbsoluteTime } from "./InputAbsoluteTime.js"; -import { InputInteger } from "./InputInteger.js"; import { h as create, Fragment, VNode } from "preact"; -import { InputChoiceStacked } from "./InputChoiceStacked.js"; -import { InputArray } from "./InputArray.js"; -import { InputSelectMultiple } from "./InputSelectMultiple.js"; -import { InputTextArea } from "./InputTextArea.js"; -import { InputFile } from "./InputFile.js"; import { Caption } from "./Caption.js"; +import { FormProvider } from "./FormProvider.js"; import { Group } from "./Group.js"; -import { InputSelectOne } from "./InputSelectOne.js"; -import { FormProvider, FormState } from "./FormProvider.js"; -import { InputLine } from "./InputLine.js"; +import { InputAbsoluteTime } from "./InputAbsoluteTime.js"; import { InputAmount } from "./InputAmount.js"; +import { InputArray } from "./InputArray.js"; import { InputChoiceHorizontal } from "./InputChoiceHorizontal.js"; +import { InputChoiceStacked } from "./InputChoiceStacked.js"; +import { InputFile } from "./InputFile.js"; +import { InputInteger } from "./InputInteger.js"; +import { InputLine } from "./InputLine.js"; +import { InputSelectMultiple } from "./InputSelectMultiple.js"; +import { InputSelectOne } from "./InputSelectOne.js"; +import { InputText } from "./InputText.js"; +import { InputTextArea } from "./InputTextArea.js"; import { InputToggle } from "./InputToggle.js"; -export type DoubleColumnForm = Array<DoubleColumnFormSection | undefined>; - -export type DoubleColumnFormSection = { - title: TranslatedString; - description?: TranslatedString; - fields: UIFormField[]; -}; -export interface FlexibleForm<T extends object> { - design: DoubleColumnForm; - behavior?: (form: Partial<T>) => FormState<T>; -} - /** * Constrain the type with the ui props */ @@ -127,6 +114,12 @@ type FormSet<T extends object> = { InputLine: <K extends keyof T>() => typeof InputLine<T, K>; InputChoiceHorizontal: <K extends keyof T>() => typeof InputChoiceHorizontal<T, K>; }; + +/** + * Helper function that created a typed object. + * + * @returns + */ export function createNewForm<T extends object>() { const res: FormSet<T> = { Provider: FormProvider, |