import * as React from 'react'; import { type AIClarificationCardInteractionValue, type AIInteractionEvent } from '../_shared/interaction-context.js'; export type AIClarificationCardVariant = 'single-select' | 'multi-select' | 'visual-options' | 'slider' | 'free-text' | 'file-upload' | 'yes-no' | 'chips' | 'sequence' | 'loading' | 'completed' | 'custom'; export interface AIClarificationCardOption { /** Stable option id used for React keys and selection state */ id: string; /** Value returned to callbacks. Defaults to id. */ value?: string; /** Primary option label */ label: string; /** Supporting option text */ description?: string; /** Small metadata label shown at the row end */ meta?: string; /** Optional badge shown inside option cards */ badge?: string; /** Disables this option */ disabled?: boolean; /** Image used by visual-option cards */ imageSrc?: string; /** Accessible image alt text. Defaults to label. */ imageAlt?: string; } export interface AIClarificationCardFile { id: string; name: string; size?: number; type?: string; progress?: number; status?: 'attached' | 'uploading' | 'complete' | 'error'; error?: string; } export interface AIClarificationCardSummaryItem { id: string; label: string; value: React.ReactNode; badge?: string; } export interface AIClarificationCardProgressItem { id: string; label?: string; value: number; } export interface AIClarificationCardStep { current: number; total: number; label?: string; } export interface AIClarificationCardActions { primaryLabel?: string; primaryAction?: 'submit' | 'next' | 'start'; secondaryLabel?: string; secondaryAction?: 'skip' | 'back' | 'edit'; showFooter?: boolean; } export interface AIClarificationCardOtherValue { kind: 'other'; value: string; label?: string; } export type AIClarificationCardValue = string | string[] | number | boolean | AIClarificationCardOtherValue | AIClarificationCardFile[] | Record | null; interface AIClarificationCardSchemaBase { /** Unique identifier for the component instance */ id: string; /** Figma variant rendered by the card */ type: AIClarificationCardVariant; /** Header title */ title: string; /** Header description */ description?: string; /** Whether the component must have a value before submit */ required?: boolean; /** Show close button in the card header */ showClose?: boolean; /** Header step state, e.g. 2 of 3 */ step?: AIClarificationCardStep; /** Segment/progress indicators displayed above the body */ progress?: AIClarificationCardProgressItem[]; /** Footer and primary/secondary action configuration */ actions?: AIClarificationCardActions; } export interface AIClarificationCardChoiceSchema extends AIClarificationCardSchemaBase { type: 'single-select' | 'multi-select' | 'visual-options' | 'chips'; options: AIClarificationCardOption[]; allowOther?: boolean; otherLabel?: string; otherPlaceholder?: string; otherHelpText?: string; minSelections?: number; maxSelections?: number; selectionLabel?: string; } export interface AIClarificationCardSliderSchema extends AIClarificationCardSchemaBase { type: 'slider'; min?: number; max?: number; increment?: number; minLabel?: string; maxLabel?: string; valueFormat?: (value: number) => string; } export interface AIClarificationCardFreeTextSchema extends AIClarificationCardSchemaBase { type: 'free-text'; placeholder?: string; rows?: number; minLength?: number; maxLength?: number; } export interface AIClarificationCardFileUploadSchema extends AIClarificationCardSchemaBase { type: 'file-upload'; accept?: string; multiple?: boolean; maxFiles?: number; uploadLabel?: string; uploadDescription?: string; } export interface AIClarificationCardYesNoSchema extends AIClarificationCardSchemaBase { type: 'yes-no'; yesLabel?: string; noLabel?: string; } export interface AIClarificationCardSequenceSchema extends AIClarificationCardSchemaBase { type: 'sequence'; items: AIClarificationCardOption[]; helperText?: string; } export interface AIClarificationCardLoadingSchema extends AIClarificationCardSchemaBase { type: 'loading'; statusLabel?: string; skeletonLines?: number; } export interface AIClarificationCardCompletedSchema extends AIClarificationCardSchemaBase { type: 'completed'; summary: AIClarificationCardSummaryItem[]; } export interface AIClarificationCardCustomSchema extends AIClarificationCardSchemaBase { type: 'custom'; } export type AIClarificationCardSchema = AIClarificationCardChoiceSchema | AIClarificationCardSliderSchema | AIClarificationCardFreeTextSchema | AIClarificationCardFileUploadSchema | AIClarificationCardYesNoSchema | AIClarificationCardSequenceSchema | AIClarificationCardLoadingSchema | AIClarificationCardCompletedSchema | AIClarificationCardCustomSchema; export interface AIClarificationCardActionMeta { schema: AIClarificationCardSchema; action: string; } export interface AIClarificationCardChangeMeta extends AIClarificationCardActionMeta { option?: AIClarificationCardOption; } export interface AIClarificationCardCustomRendererProps { schema: AIClarificationCardCustomSchema; value: AIClarificationCardValue; setValue: (value: AIClarificationCardValue) => void; emit: (action: string, value?: AIClarificationCardInteractionValue) => void; disabled?: boolean; } export interface AIClarificationCardProps { /** Schema describing the rendered AI clarification/control card */ schema: AIClarificationCardSchema; /** Controlled value */ value?: AIClarificationCardValue; /** Initial uncontrolled value */ defaultValue?: AIClarificationCardValue; /** Called whenever the card value changes */ onValueChange?: (value: AIClarificationCardValue, meta: AIClarificationCardChangeMeta) => void; /** Called by the primary action when it submits/starts */ onSubmit?: (value: AIClarificationCardValue, meta: AIClarificationCardActionMeta) => void; /** Called by next navigation actions */ onNext?: (value: AIClarificationCardValue, meta: AIClarificationCardActionMeta) => void; /** Called by back navigation actions */ onBack?: (value: AIClarificationCardValue, meta: AIClarificationCardActionMeta) => void; /** Called by skip actions */ onSkip?: (meta: AIClarificationCardActionMeta) => void; /** Called by edit actions in completed cards */ onEdit?: (meta: AIClarificationCardActionMeta) => void; /** Called by header close button */ onClose?: (meta: AIClarificationCardActionMeta) => void; /** Called when a native file input returns files */ onFilesSelected?: (files: File[], meta: AIClarificationCardActionMeta) => void; /** Called when a file card cancel/remove button is pressed */ onFileCancel?: (file: AIClarificationCardFile, meta: AIClarificationCardActionMeta) => void; /** Direct interaction event callback, in addition to AIInteractionProvider */ onInteraction?: (event: AIInteractionEvent) => void; /** React-only custom renderer for custom embedded components */ renderCustom?: (props: AIClarificationCardCustomRendererProps) => React.ReactNode; /** React-only fallback content for custom cards */ children?: React.ReactNode; disabled?: boolean; className?: string; } export declare function AIClarificationCard({ schema, value, defaultValue, onValueChange, onSubmit, onNext, onBack, onSkip, onEdit, onClose, onFilesSelected, onFileCancel, onInteraction, renderCustom, children, disabled, className, }: AIClarificationCardProps): React.ReactElement; export declare namespace AIClarificationCard { var displayName: string; } export default AIClarificationCard;