/** * TimeSlot - Headless components for displaying time slot information within TimeSlotList * Provides components for displaying start/end times, duration, and selection actions * * Note: These components must be used within TimeSlotList.TimeSlotRepeater which provides * the necessary context. There is no public TimeSlot.Root - context is managed internally. */ import React from 'react'; import { type DateData } from '@wix/headless-components/react'; import { AsChildChildren } from '@wix/headless-utils/react'; import type { TimeSlot as TimeSlotType } from '@wix/auto_sdk_bookings_availability-time-slots'; import * as CoreTimeSlot from '../core/time-slot-list/TimeSlot.js'; export type { StaffMemberData } from '../core/time-slot-list/TimeSlot.js'; /** * Props for TimeSlot.Root component */ export interface RootProps { children?: React.ReactNode; timeSlot: TimeSlotType; asChild?: boolean; className?: string; } /** * Root component that provides time slot context. * * @order 1 * @component * @example * ```tsx * * * * * ``` */ export declare const Root: React.ForwardRefExoticComponent>; export declare const TestIds: { readonly timeSlotStartDate: "time-slot-start-date"; readonly timeSlotEndDate: "time-slot-end-date"; readonly timeSlotDuration: "time-slot-duration"; readonly timeSlotActionSelect: "time-slot-action-select"; readonly timeSlotActionClearStaffSelection: "time-slot-action-clear-staff-selection"; readonly timeSlotLocationName: "time-slot-location-name"; readonly timeSlotStaffMembers: "time-slot-staff-members"; readonly timeSlotStaffMember: "time-slot-staff-member"; readonly timeSlotStaffMemberName: "time-slot-staff-member-name"; readonly timeSlotStaffMemberActionSelect: "time-slot-staff-member-action-select"; }; /** * Props for TimeSlot.StartDate component. * Inherits formatting options from DateData (dateTimeFormatOptions, locale). */ export interface StartDateProps extends Omit { asChild?: boolean; children?: AsChildChildren<{ startDate: Date; }>; className?: string; } /** * Displays the time slot start time. * Default formatting shows time as "10:00 AM" (hour:minute with AM/PM). * * @component * @example * ```tsx * // Default usage - displays "10:00 AM" * * * // With custom date format * * * // With custom formatting via asChild * * {({ startDate }) => ( * {formatTime(startDate)} * )} * * ``` */ export declare const StartDate: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.EndDate component. * Inherits formatting options from DateData (dateTimeFormatOptions, locale). */ export interface EndDateProps extends Omit { asChild?: boolean; children?: AsChildChildren<{ endDate: Date; }>; className?: string; } /** * Displays the time slot end time. * Default formatting shows time as "11:00 AM" (hour:minute with AM/PM). * * @component * @example * ```tsx * // Default usage - displays "11:00 AM" * * * // With custom date format * * * // With custom formatting via asChild * * {({ endDate }) => ( * {formatTime(endDate)} * )} * * ``` */ export declare const EndDate: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.Duration component */ export interface DurationProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ durationInMinutes: number; }>; } /** * Calculates and displays the duration between start and end times in minutes. * Returns null if start/end dates are not available. * * @component * @example * ```tsx * // Default usage - displays raw minutes number * * * // With custom formatting * * {({ durationInMinutes }) => ( * {durationInMinutes} min * )} * * ``` */ export declare const Duration: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.Actions.Select component */ export interface SelectProps extends Omit, 'children' | 'disabled' | 'onClick'> { asChild?: boolean; children?: React.ReactNode | ((props: { isSelected: boolean; bookable: boolean; onClick: () => void; timeSlot: TimeSlotType; }) => React.ReactNode); label?: string; /** Called after selection with the selected timeSlot */ onClick?: (timeSlot: TimeSlotType) => void; } /** * Button to select this time slot. * Default label is "Select". * * @component * @example * ```tsx * // Default button with "Select" label * * * // With custom label * * * // With asChild * * * * * // With onClick callback * router.push('/booking/confirm')} * /> * * // Using render prop pattern * * {({ isSelected, bookable, onClick }) => ( * * )} * * ``` */ export declare const Select: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.Actions.ClearStaffSelection component */ export interface ClearStaffSelectionProps extends Omit, 'children' | 'onClick'> { asChild?: boolean; children?: React.ReactNode | ((props: { onClick: () => void; }) => React.ReactNode); label?: string; /** Called after clearing with the timeSlot whose staff selection was cleared */ onClick?: (timeSlot: TimeSlotType) => void; } /** * Button to clear staff selection while keeping the slot selected. * Only renders when a staff member is selected and there are multiple staff options. * Default label is "Change". * * @component * @example * ```tsx * // Default button with "Change" label * * * // With custom label * * * // With asChild * * * * * // With onClick callback * console.log('Staff selection cleared')} * /> * * // Using render prop pattern * * {({ onClick }) => } * * ``` */ export declare const ClearStaffSelection: React.ForwardRefExoticComponent>; /** * Actions namespace for TimeSlot */ export declare const Actions: { Select: React.ForwardRefExoticComponent>; ClearStaffSelection: React.ForwardRefExoticComponent>; }; /** * Props for TimeSlot.Location.Name component */ export interface LocationNameProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ name: string; }>; } /** * Displays the location name. * * @component * @example * ```tsx * // Default usage * * * // With custom formatting * * {({ name }) => ( * {name || 'Unknown Location'} * )} * * ``` */ export declare const LocationName: React.ForwardRefExoticComponent>; /** * Location namespace containing components for displaying individual location data. */ export declare const Location: { Name: React.ForwardRefExoticComponent>; }; /** * Props for TimeSlot.StaffMembers component */ export interface StaffMembersProps extends Omit, 'children'> { children: React.ReactNode; } /** * Container for the staff members list within a time slot. * Uses GenericList.Root to manage the staff members list. * * @component * @example * ```tsx * * * * * * * ``` */ export declare const StaffMembers: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.StaffMemberRepeater component */ export interface StaffMemberRepeaterProps { children: React.ReactNode; } /** * Repeater component that renders each staff member. * Follows Repeater Level pattern and uses GenericList.Repeater for consistency. * Automatically provides StaffMember context to children. * * @component * @example * ```tsx * *
* * *
*
* ``` */ export declare const StaffMemberRepeater: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.StaffMember.Name component */ export interface StaffMemberNameProps extends Omit, 'children'> { asChild?: boolean; children?: AsChildChildren<{ name: string; }>; } /** * Displays the staff member name. * * @component * @example * ```tsx * // Default usage * * * // With custom formatting * * {({ name }) => ( * {name || 'Any Staff'} * )} * * ``` */ export declare const StaffMemberName: React.ForwardRefExoticComponent>; /** * Props for TimeSlot.StaffMember.Actions.Select component */ export interface SelectStaffMemberProps extends Omit, 'children' | 'onClick'> { asChild?: boolean; children?: React.ReactNode | ((props: { isSelected: boolean; onClick: () => void; staffMember: CoreTimeSlot.StaffMemberData; }) => React.ReactNode); label?: string; /** Called after selection with the selected staffMember */ onClick?: (staffMember: CoreTimeSlot.StaffMemberData) => void; } /** * Button to select this staff member. * Default label is "Select". * * @component * @example * ```tsx * // Default button with "Select" label * * * // With custom label * * * // With asChild * * * * * // With onClick callback * console.log('Staff selected')} * /> * * // Using render prop pattern * * {({ isSelected, onClick }) => ( * * )} * * ``` */ export declare const SelectStaffMember: React.ForwardRefExoticComponent>; /** * StaffMember namespace containing components for displaying individual staff member data. * These components must be used within TimeSlot.StaffMemberRepeater. * * @example * ```tsx * * * * * ``` */ export declare const StaffMember: { Name: React.ForwardRefExoticComponent>; Actions: { Select: React.ForwardRefExoticComponent>; }; };