goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
34 lines • 1.28 kB
TypeScript
import { default as React, ReactNode } from 'react';
import { FieldKind } from './schema';
import { DropdownOption } from '../Field/Dropdown/Regular';
/**
* Per-field render context handed to a custom `render` function. Lets callers
* override the component for specific kinds while keeping the binding-by-name
* contract.
*/
export interface AutoFieldRenderContext {
name: string;
label: string;
kind: FieldKind;
/** The field's zod schema, for callers that want to introspect further. */
fieldSchema: unknown;
}
export interface AutoFieldsProps {
/** When set, render ONLY these field keys (in this order). */
only?: string[];
/** When set, skip these field keys. */
omit?: string[];
/**
* Per-field option lists for `enum` kinds (and any field a caller wants to
* render as a dropdown). Keyed by field name.
*/
optionsMap?: Record<string, DropdownOption[]>;
/**
* Full override hook — return a node to render that field yourself, or
* `undefined`/`null` to fall back to the default component for its kind.
*/
render?: (context: AutoFieldRenderContext) => ReactNode;
}
declare const AutoFields: React.FC<AutoFieldsProps>;
export default AutoFields;
//# sourceMappingURL=AutoFields.d.ts.map