/** * BookingForm - High-level component for rendering booking forms * Provides components for displaying and managing booking form fields */ import React from 'react'; import { Form } from '@wix/forms/components'; import type { BookingFormRenderProps } from '../core/booking-form/BookingForm.js'; type FieldMap = Parameters[0]['fieldMap']; export declare const TestIds: { readonly bookingFormRoot: "booking-form-root"; readonly bookingFormFields: "booking-form-fields"; readonly bookingFormActionValidateFormSubmission: "booking-form-action-validate-form-submission"; }; /** * Props for BookingForm.Root component */ export interface RootProps { /** The form ID to load (required - standalone mode) */ formId?: string; /** Optional service IDs to pass to FormService (will be merged into additionalMetadata) */ serviceIds?: string[]; /** Optional additional metadata to pass to FormService */ additionalMetadata?: Record; /** Optional namespace override for the form. Defaults to the bookings namespace. */ namespace?: string; /** Field map to override default booking field components */ fieldMap: FieldMap; /** * Child components - can be: * - ReactNode for declarative usage * - Render prop function for programmatic access to form data and actions * - undefined to use default UI */ children?: React.ReactNode | ((data: BookingFormRenderProps) => React.ReactNode); /** Whether to render as a child component */ asChild?: boolean; /** CSS classes to apply to the root element */ className?: string; /** Row gap class name for Form.Fields when using default rendering */ rowGapClassname?: string; /** Column gap class name for Form.Fields when using default rendering */ columnGapClassname?: string; /** Custom fallback UI for load errors. Can be a ReactNode or a function that receives the error. */ loadErrorFallback?: React.ReactNode | ((error: Error) => React.ReactNode); } /** * Root component for booking form that wraps CoreBookingForm.Root. * Automatically loads form and handles submission in standalone mode. * Uses DEFAULT_BOOKING_FIELD_MAP for field rendering with optional user overrides. * * @order 1 * @component * @example * ```tsx * import { BookingForm } from '@wix/headless-bookings/react'; * * // Minimal usage - uses default field components * * * // With serviceIds * * * // With custom styling * * * // With custom field overrides * * * // With full control over form structure * * * * * * * * * // With render props for programmatic access * * {({ fields, formValues, validateFormSubmission, setFormSubmission, formRef }) => ( *
* * *
* )} *
* ``` */ export declare const Root: React.ForwardRefExoticComponent>; /** * Props for BookingForm.Fields component */ export interface FieldsProps { /** Optional override for row gap class name */ rowGapClassname?: string; /** Optional override for column gap class name */ columnGapClassname?: string; /** CSS classes to apply */ className?: string; } /** * Fields component that renders Form.Fields with the merged field map. * Must be used within BookingForm.Root. * * @component * @example * ```tsx * * * * * * ``` */ export declare const Fields: React.ForwardRefExoticComponent>; /** * Re-export LoadError component and utilities for error handling */ export { LoadError, isBookingFormConfigurationError, BookingFormConfigurationError, } from '../core/booking-form/BookingForm.js';