/** * Location - Headless component for displaying service location information * Provides components for displaying location type, name, address, phone, email * * @module React/Location */ import React from 'react'; import * as CoreLocation from '../core/location/Location.js'; import { type AsChildChildren } from '@wix/headless-utils/react'; import { LocationType } from '../../services/location-list/location-list.def.js'; export { useLocationContext } from '../core/location/Location.js'; export declare const TestIds: { readonly locationRoot: "location-root"; readonly locationName: "location-name"; readonly locationType: "location-type"; readonly locationAddress: "location-address"; readonly locationPhone: "location-phone"; readonly locationEmail: "location-email"; readonly locationRaw: "location-raw"; readonly locationActionSelect: "location-action-select"; }; export type { AddressData, Location, LocationRenderProps, } from '../core/location/Location.js'; /** * Props for Location.Root component */ export interface RootProps { /** Location data */ location?: CoreLocation.Location; /** Use asChild pattern */ asChild?: boolean; /** Children - ReactNode or render function with all LocationRenderProps */ children?: React.ReactNode | AsChildChildren; /** CSS class name */ className?: string; /** Data attributes */ [key: `data-${string}`]: string | undefined; } /** * Root component that provides location context and handles location type detection * and address parsing. * * @component * @example * ```tsx * // With Service location * * * * * * * ``` * * @example * ```tsx * // With asChild to access all location data * * {({ name, isCustomerLocation, phone }) => ( *
* {isCustomerLocation ? "Client's Place" : name} * {phone && {phone}} *
* )} *
* ``` */ export declare const Root: React.ForwardRefExoticComponent>; /** * Props for Location.Name component */ export interface NameProps extends Omit, 'children'> { asChild?: boolean; children?: React.ReactNode | AsChildChildren<{ name: string; }>; } /** * Displays the location name. * The name is pre-computed with label fallbacks in CoreLocation.Root: * - BUSINESS: business.name * - CUSTOM: custom.address.addressLine, or customLocationLabel from service * - CUSTOMER: customerLocationLabel from service * * Labels can be customized via LocationList.Root's customLocationLabel and * customerLocationLabel props. * * @component * @example * ```tsx * * * // With asChild * * {({ name }) =>

{name}

} *
* ``` */ export declare const Name: React.ForwardRefExoticComponent>; /** * Props for Location.Type component */ export interface TypeProps extends Omit, 'children'> { asChild?: boolean; children?: React.ReactNode | AsChildChildren<{ locationType: LocationType; isCustomerLocation: boolean; isCustomLocation: boolean; }>; } /** * Displays the location type. * * @component * @example * ```tsx * * * // With asChild for custom rendering * * {({ isCustomerLocation, locationType }) => ( * * {isCustomerLocation ? 'At your place' : locationType} * * )} * * ``` */ export declare const Type: React.ForwardRefExoticComponent>; /** * Props for Location.Address component */ export interface AddressProps { asChild?: boolean; children?: React.ReactNode | AsChildChildren<{ address: CoreLocation.AddressData | null; }>; className?: string; } /** * Displays the location address. * Returns null for CUSTOMER locations (consumer provides label). * * @component * @example * ```tsx * * * // With asChild * * {({ address }) => ( * address ? ( * * * * ) : ( * Client's Place * ) * )} * * ``` */ export declare const LocationAddress: React.ForwardRefExoticComponent>; export { LocationAddress as Address }; /** * Props for Location.Phone component */ export interface PhoneProps { asChild?: boolean; children?: React.ReactNode | AsChildChildren<{ phone: string | undefined; }>; className?: string; } /** * Displays the location phone number. * Only renders for BUSINESS locations (phone only exists on BusinessLocationOptions). * * @component * @example * ```tsx * * * // With asChild * * {({ phone }) => phone && {phone}} * * ``` */ export declare const Phone: React.ForwardRefExoticComponent>; /** * Props for Location.Email component */ export interface EmailProps { asChild?: boolean; children?: React.ReactNode | AsChildChildren<{ email: string | undefined; }>; className?: string; } /** * Displays the location email address. * Only renders for BUSINESS locations (email only exists on BusinessLocationOptions). * * @component * @example * ```tsx * * * // With asChild * * {({ email }) => email && {email}} * * ``` */ export declare const Email: React.ForwardRefExoticComponent>; /** * Props for Location.Raw component */ export interface RawProps { children: (props: CoreLocation.LocationRenderProps) => React.ReactNode; } /** * Exposes all raw location data via render prop. * Use only when you need full access to location data. * * @component * @example * ```tsx * * {({ rawLocation, locationType, phone, email }) => ( *
{JSON.stringify(rawLocation, null, 2)}
* )} *
* ``` */ export declare const Raw: React.FC; /** * Props for Location.Actions.Select component */ export interface SelectProps extends Omit, 'children' | 'onClick'> { asChild?: boolean; children?: React.ReactNode | AsChildChildren<{ onClick: () => void; selected: boolean; location: CoreLocation.Location | null; }>; /** Label for the button */ label?: string; /** Called after selection with the selected location */ onClick?: (location: CoreLocation.Location) => void; } /** * Actions namespace for location-related actions */ export declare const Actions: { Select: React.ForwardRefExoticComponent>; };