import { default as React, ComponentType } from 'react'; import { UISchema, DataContext, EventAction } from '../../types'; import { PlatformType, ComponentRegistry } from '../../lib/component-registry'; /** * UI Event emitted by the LLM2UI component */ export interface LLM2UIEvent { /** Event type */ type: string; /** Component ID that triggered the event */ componentId: string; /** Event action payload */ action: EventAction; /** Original React synthetic event */ originalEvent?: React.SyntheticEvent; } /** * Event callback function type */ export type LLM2UIEventCallback = (event: LLM2UIEvent) => void; /** * Custom component definition for SDK registration * Simplified version of ComponentDefinition for external use */ export interface CustomComponentDefinition { /** Component name/type identifier */ name: string; /** The actual React component */ component: ComponentType>; /** Component description */ description?: string; /** Component category for organization */ category?: 'input' | 'layout' | 'display' | 'feedback' | 'navigation' | string; /** Props schema for validation */ propsSchema?: Record; /** Searchable tags */ tags?: string[]; /** Icon name */ icon?: string; } /** * LLM2UI Component Props */ export interface LLM2UIProps { /** The UISchema to render */ schema: UISchema; /** Additional data context to merge with schema.data */ data?: DataContext; /** Event callback handler */ onEvent?: LLM2UIEventCallback; /** Target platform for rendering */ platform?: PlatformType; /** Theme mode */ theme?: 'light' | 'dark'; /** Custom CSS class name */ className?: string; /** Inline styles */ style?: React.CSSProperties; /** Custom component registry */ registry?: ComponentRegistry; /** Custom components to register (simple format: name -> component) */ customComponents?: Record>>; /** Custom component definitions with full metadata */ customComponentDefinitions?: CustomComponentDefinition[]; /** Whether to show error boundaries for component errors */ showErrors?: boolean; /** Custom component for unknown types */ unknownComponent?: React.ComponentType<{ type: string; id: string; }>; /** Callback when rendering is complete */ onRender?: () => void; /** Callback when an error occurs */ onError?: (error: Error) => void; } /** * LLM2UI React Component * * A declarative React component for rendering UISchema. * Provides a simple interface similar to amis low-code framework. * * @example * ```tsx * // Basic usage * * * // With event handling * { * if (event.type === 'submit') { * handleSubmit(event.action); * } * }} * /> * * // With custom components * ( * * ) * }} * /> * ``` */ export declare const LLM2UI: React.FC; /** * Default export for convenience */ export default LLM2UI; //# sourceMappingURL=LLM2UI.d.ts.map