import { type AsChildChildren } from '@wix/headless-utils/react'; import React from 'react'; import type { CommentWithResolvedFields } from '../services/comments-service.js'; export interface RootProps { asChild?: boolean; className?: string; maxLength?: number; onCommentAdded?: () => void; children?: AsChildChildren<{ createComment: (content: string) => Promise; isLoading: boolean; error: string | null; commentText: string; setCommentText: (text: string) => void; handleSubmit: (e: React.FormEvent) => Promise; handleCancel: () => void; }> | React.ReactNode; } /** * Form component for creating comments. * Provides context for sub-components to share form state. * Must contain composable sub-components as children. * * @component * @example * ```tsx * // Composable form with sub-components * * * * * * * // Custom rendering with asChild * * {({ createComment, isLoading, error, commentText, setCommentText, handleSubmit, handleCancel }) => ( * * )} * * ``` */ export declare const Root: React.ForwardRefExoticComponent>; export interface LabelProps { asChild?: boolean; className?: string; children?: AsChildChildren<{ htmlFor: string; labelText: string; }> | React.ReactNode; } /** * Label component for comment form input. * * @component * @example * ```tsx * // Default label * * * // Custom styling * * * // Custom rendering with asChild * * {({ htmlFor, labelText }) => ( * * )} * * ``` */ export declare const Label: React.ForwardRefExoticComponent>; export interface InputProps { asChild?: boolean; className?: string; placeholder?: string; rows?: number; children?: AsChildChildren<{ value: string; onChange: (e: React.ChangeEvent) => void; disabled: boolean; placeholder?: string; maxLength: number; id: string; }> | React.ReactNode; } /** * Input component for form textarea. * * @component * @example * ```tsx * // Default textarea * * * // Custom styling * * * // Custom rendering with asChild * * {({ value, onChange, disabled, placeholder, maxLength, id }) => ( * * )} * * ``` */ export declare const Input: React.ForwardRefExoticComponent>; export interface MessageProps { asChild?: boolean; className?: string; children?: AsChildChildren<{ error: string; hasError: boolean; }> | React.ReactNode; } /** * Error message display component for comment form. * * @component * @example * ```tsx * // Default error display * * * // Custom styling * * * // Custom rendering with asChild * * {({ error, hasError }) => ( * hasError && * )} * * ``` */ export declare const Message: React.ForwardRefExoticComponent>; export interface CancelButtonProps { asChild?: boolean; className?: string; children?: AsChildChildren<{ isDisabled: boolean; isLoading: boolean; handleCancel: () => void; }> | React.ReactNode; } /** * Cancel button for the comment form. * Clears the form input when clicked. * * @component * @example * ```tsx * // Default rendering * * * // Custom rendering with asChild * * {({ handleCancel }) => ( * * )} * * ``` */ export declare const CancelButton: React.ForwardRefExoticComponent>; export interface SubmitButtonProps { asChild?: boolean; className?: string; loadingState?: React.ReactNode; children?: AsChildChildren<{ isDisabled: boolean; isLoading: boolean; onClick: (e: React.FormEvent) => Promise; }> | React.ReactNode; } /** * Submit button for the comment form. * Automatically disabled when the form is empty or submitting. * * @component * @example * ```tsx * // Default rendering * * * // Custom rendering with asChild * * * * ``` */ export declare const SubmitButton: React.ForwardRefExoticComponent>;