/** * Web Component wrapper for AIClarificationCard (hand-crafted WC adapter). * Custom element: * * Wraps the React component with AIInteractionProvider so interaction events * are emitted as DOM CustomEvents outside of React chat surfaces. * * @generated by scripts/generate-wc-components.ts * DO NOT EDIT MANUALLY */ import React from 'react'; import { AIClarificationCard, type AIClarificationCardFile, type AIClarificationCardSchema, type AIClarificationCardValue, AIInteractionProvider, } from '../components'; import { BaseCompoundWC, camelToKebab, dispatchEvent, installPropAccessors, type PropDefs, portalNode, registerWC, } from './_shared'; const PROP_DEFS: PropDefs = { schema: 'json', value: 'json', disabled: 'boolean', }; class AIClarificationCardWC extends BaseCompoundWC { get propDefs(): PropDefs { return PROP_DEFS; } static get observedAttributes(): string[] { return Object.keys(PROP_DEFS).map(camelToKebab); } protected _renderReact(): React.ReactElement { const props = this._readAllProps(); const schema = props.schema as AIClarificationCardSchema | undefined; if (!schema || typeof schema !== 'object' || !schema.id) { return React.createElement(React.Fragment); } const slottedChildren = portalNode(this._defaultSlotContainer); return React.createElement( AIInteractionProvider, { onInteraction: (event: unknown) => dispatchEvent(this, 'interaction', event), }, React.createElement( AIClarificationCard, { schema, value: props.value as AIClarificationCardValue | undefined, disabled: Boolean(props.disabled), onValueChange: (value, meta) => dispatchEvent(this, 'value-change', { value, meta }), onSubmit: (value, meta) => dispatchEvent(this, 'submit', { value, meta }), onNext: (value, meta) => dispatchEvent(this, 'next', { value, meta }), onBack: (value, meta) => dispatchEvent(this, 'back', { value, meta }), onSkip: (meta) => dispatchEvent(this, 'skip', meta), onEdit: (meta) => dispatchEvent(this, 'edit', meta), onClose: (meta) => dispatchEvent(this, 'close', meta), onFilesSelected: (files, meta) => dispatchEvent(this, 'files-selected', { files, meta }), onFileCancel: (file: AIClarificationCardFile, meta) => dispatchEvent(this, 'file-cancel', { file, meta }), }, slottedChildren, ), ); } } installPropAccessors(AIClarificationCardWC, PROP_DEFS); registerWC('hf-ai-clarification-card', AIClarificationCardWC); export { AIClarificationCardWC }; export default AIClarificationCardWC;