/** * Web Component wrapper for AIForm (hand-crafted WC adapter). * Custom element: * * Wraps the React component with AIInteractionProvider so the * useAIInteraction() hook has context outside of AIMessage. * * @generated by scripts/generate-wc-components.ts * DO NOT EDIT MANUALLY */ import React from 'react'; import { AIForm, AIInteractionProvider } from '../components'; import { BaseCompoundWC, camelToKebab, dispatchEvent, installPropAccessors, type PropDefs, registerWC, } from './_shared'; const PROP_DEFS: PropDefs = { schema: 'json', }; class AIFormWC extends BaseCompoundWC { get propDefs() { return PROP_DEFS; } static get observedAttributes() { return Object.keys(PROP_DEFS).map(camelToKebab); } protected _renderReact(): React.ReactElement { const props = this._readAllProps(); const schema = props.schema as Record | undefined; // Null guard: return empty fragment until schema is provided if (!schema || typeof schema !== 'object' || !schema.id) { return React.createElement(React.Fragment); } return React.createElement( AIInteractionProvider, { onInteraction: (event: unknown) => dispatchEvent(this, 'interaction', event), }, React.createElement(AIForm, { schema: schema as import('../components/AIForm').FormBlockSchema, }), ); } } installPropAccessors(AIFormWC, PROP_DEFS); registerWC('hf-ai-form', AIFormWC); export { AIFormWC }; export default AIFormWC;