import { type UseFormReturn } from 'react-hook-form'; import { type SectionSpacing } from '../components/Section.js'; import type { WorkflowVariables } from '../engine.js'; import { type FieldComponent } from './fieldRegistry.js'; import { type ServerError } from './validation.js'; interface FormMeta { labelPosition?: 'left' | 'top' | undefined; spaceCompact?: boolean | undefined; } /** Applies `$meta` overrides for `labelPosition` / `spaceCompact`. */ export declare function resolveMetaOverrides(options: { $meta?: FormMeta; } | Record | undefined, labelPosition: 'left' | 'top' | undefined, spaceCompact: boolean): { labelPosition: "left" | "top" | undefined; spaceCompact: boolean; }; /** Cheap signature of every list's length; gates the expensive collect walk. */ export declare function listLengthsSignature(options: Record, values?: Record, prefix?: string): string; /** Collects every field with a `default` for the form-level sync to track, named as the form store * names it: a row's fields by `list.0.field`. */ export declare function collectFieldsWithDefaults(options: Record, values?: Record, prefix?: string): Array<{ name: string; defaultValue: unknown; hasSecondary?: boolean; }>; export declare function defaultReferencesField(defaultValue: unknown, fieldPath: string): boolean; export declare function findSelfReferencingFieldNames(schema: Record, values?: Record): string[]; /** Resolves schema defaults into form values as dependencies change. Store-agnostic so the form and * hosts with their own store share one implementation. */ export declare function useDynamicDefaultsSync({ options, values, setValue, isTouched, }: { options: Record; values: Record; setValue: (name: string, value: unknown) => void; isTouched: (name: string) => boolean; }): void; export declare function DynamicDefaultsSync({ options }: { options: Record; }): null; export type FormValues = Record; /** Called by a field marked `one_must_be_true` in a list's row, so the list can keep one row on. */ type RowFlagChange = (fieldName: string, index: number, changeOtherValuesTo?: string | boolean, keepOneValueOf?: string | boolean, currentValue?: string | boolean) => void; /** Where fields that are part of another field, as an object's or a list row's, keep their values. */ export interface ParentInfo { computeOn?: boolean | undefined; fieldNamePrefix: string; arrayIndex?: number | undefined; onChange?: RowFlagChange | undefined; } /** A section's rule sits as far over its first row as the form's rows sit apart: tight with the * labels over the fields, and the regular gap, close to the 15px between side-labeled rows. */ export declare function sectionSpacing(labelPosition: 'left' | 'top' | undefined): SectionSpacing; /** Renders a schema's fields. Inside another field, `parentInfo` says where their values sit. */ export declare function FieldsFromOptions({ options, parentInfo, labelPosition, spaceCompact, }: { options: Record; parentInfo?: ParentInfo | undefined; labelPosition?: 'left' | 'top' | undefined; spaceCompact?: boolean; }): import("react").JSX.Element; export interface DynamicFormProps { /** * The form to render into, from the host's own `useForm()`, which then reads and drives it: * `formState.isDirty`, `getValues`, `reset`, `trigger`. Without one, the form keeps its own. */ form?: UseFormReturn; /** Enables validated layout-only CSS declarations on authored layout nodes. */ allowLayoutCSS?: boolean; formJSONs: Record; /** Loads `initialValues` again whenever they change, as Formik's `enableReinitialize` did. */ reinitialize?: boolean; initialValues: object; /** Every change to the form's values, as it happens. */ onValuesChange?: (values: FormValues) => void; labelPosition?: 'left' | 'top'; /** * Fields the server rejected, each shown under its field until the person changes it. They never * hold back Next or a submit, since the server checks again, and a wizard turns to the first page * holding one. `useFieldMessages` from the problem package gives them from a problem response. */ serverErrors?: readonly ServerError[] | undefined; spaceCompact?: boolean; organizationVariables?: WorkflowVariables | undefined; /** A remote workflow's repo/branch/yaml, so `${{ remote.* }}` resolves the same here as it does on the run. */ remoteVars?: Record | undefined; needsOrganizationVariables?: boolean; onSubmit?: ((values: FormValues) => void) | undefined; submitLabel?: string; className?: string; /** Prevents deletion of hidden+ignored field values (workflow forms filter at submit time). */ workflowForm?: boolean; /** Identifier for the load context (e.g. rerun slug, configuration name). When this * changes, DynamicDefaultsSync remounts so it re-evaluates its prev-default tracking * and saved-vs-default first-seen synthesis against the new context. */ contextKey?: string; /** Skip expression parsing on initial values (for edit forms where saved values may contain user-typed expressions like ${{ var.X }} that should stay literal). Schema-level expressions still resolve. */ skipValueParse?: boolean; /** Host-supplied field components, merged over the core registry by type. */ fields?: Record; } /** A form drawn from a workflow's schema. */ export declare function DynamicForm({ form, ...props }: DynamicFormProps): import("react").JSX.Element; export {};