import React from 'react'; import type { Menu, Location } from '../services/types.js'; import { type AsChildChildren } from '@wix/headless-utils/react'; import { MenusServiceConfig } from '../services/index.js'; export interface MenusRootProps { children: React.ReactNode; config: MenusServiceConfig; } export interface MenusProps { children: (props: { menus: Menu[]; }) => React.ReactNode; } export interface MenusRepeaterProps { children: React.ReactNode; } export declare function Root(props: MenusRootProps): import("react/jsx-runtime").JSX.Element; export interface MenuSelectorProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren<{ menus: Menu[]; selectedMenu: Menu | null; onMenuSelect: (menu: Menu) => void; }>; /** CSS classes to apply to the tabs root element */ className?: string; /** CSS classes to apply to the tabs list element */ listClassName?: string; /** CSS classes to apply to each tab trigger element */ triggerClassName?: string; /** Text for the "all" option */ allText?: string; /** Whether to show the "all" option */ showAll?: boolean; } /** * Menu selector component that provides menu selection functionality using tabs. * Uses the core MenuSelector component and wraps it with AsChildSlot for flexible rendering. * Only renders when there are more than 1 real menu available (excluding "All" option). * * @component * @example * ```tsx * // Default usage with custom styling (only shows if more than 1 real menu) * * * // Conditional rendering based on menu count * {menus.filter(menu => menu._id !== 'all').length > 1 && ( * * )} * * // asChild with custom tabs implementation * * {React.forwardRef(({menus, selectedMenu, onMenuSelect, ...props}, ref) => ( * { * const menu = menus.find(m => m._id === value); * if (menu) onMenuSelect(menu); * }}> * * {menus.map(menu => ( * * {menu.name} * * ))} * * * ))} * * * // Custom render function * * {({ menus, selectedMenu, onMenuSelect }) => ( * { * const menu = menus.find(m => m._id === value); * if (menu) onMenuSelect(menu); * }}> * * {menus.map(menu => ( * * {menu.name} * * ))} * * * )} * * ``` */ export declare const MenuSelector: React.ForwardRefExoticComponent>; export declare const MenusRepeater: React.ForwardRefExoticComponent>; export interface LoadingProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren<{ loading: boolean; }>; /** CSS classes to apply to the default element */ className?: string; /** Text to display when loading. If not provided, component renders nothing by default */ loadingText?: string; } export interface ErrorProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren<{ error: string | null; }>; /** CSS classes to apply to the default element */ className?: string; /** Prefix to prepend to error message. If not provided, only the error message is shown */ errorPrefix?: string; } /** * Displays loading state with customizable rendering following the documented API. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component * * {React.forwardRef(({loading, ...props}, ref) => ( * * {loading ? "Loading..." : null} * * ))} * * * // With custom loading text * * ``` */ export declare const Loading: React.ForwardRefExoticComponent>; /** * Displays error state with customizable rendering following the documented API. * * @component * @example * ```tsx * // Default usage * * * // asChild with primitive * * * * * // asChild with react component * * {React.forwardRef(({error, ...props}, ref) => ( * * {error ? `Error: ${error}` : null} * * ))} * * * // With custom error prefix * * * // Without prefix (only error message) * * ``` */ export declare const Error: React.ForwardRefExoticComponent>; export interface LocationSelectorProps { /** Whether to render as a child component */ asChild?: boolean; /** Custom render function when using asChild */ children?: AsChildChildren<{ locations: Location[]; selectedLocation: string | null; onLocationSelect: (location: string) => void; }>; /** CSS classes to apply to the root container element */ className?: string; /** CSS classes to apply to the select trigger element */ triggerClassName?: string; /** CSS classes to apply to the select content element */ contentClassName?: string; /** CSS classes to apply to the select viewport element */ viewportClassName?: string; /** CSS classes to apply to the option elements */ optionClassName?: string; /** CSS classes to apply to the scroll up button */ scrollUpButtonClassName?: string; /** CSS classes to apply to the scroll down button */ scrollDownButtonClassName?: string; /** Placeholder text for the select */ placeholder?: string; /** Text for the "all" option */ allText?: string; /** Whether to show the "all" option */ showAll?: boolean; } /** * Location selector component that provides location selection functionality using a dropdown. * Uses the core LocationSelector component and wraps it with AsChildSlot for flexible rendering. * Only renders when there are more than 1 real location available (excluding "All" option). * * @component * @example * ```tsx * // Default usage with custom styling (only shows if more than 1 real location) * * * // Conditional rendering based on location count * {locations.filter(location => location.id !== 'all').length > 1 && ( * * )} * * // asChild with custom Radix Select implementation * * {React.forwardRef(({locations, selectedLocation, onLocationSelect, ...props}, ref) => ( * * * * * * * * * {locations.map(location => ( * * {location.name} * * ))} * * * * * ))} * * * // Custom render function * * {({ locations, selectedLocation, onLocationSelect }) => ( * * * * * * * * * {locations.map(location => ( * * {location.name} * * ))} * * * * * )} * * ``` */ export declare const LocationSelector: React.ForwardRefExoticComponent>; /** * Menus namespace containing all menus components * following the compound component pattern: MenusComponent.Root, MenusComponent.MenusRepeater, MenusComponent.Loading, etc. */ export declare const MenusComponent: { /** Menus root component */ readonly Root: typeof Root; /** Menu selector component */ readonly MenuSelector: React.ForwardRefExoticComponent>; /** Location selector component */ readonly LocationSelector: React.ForwardRefExoticComponent>; /** Menus repeater component */ readonly MenusRepeater: React.ForwardRefExoticComponent>; /** Menus loading component */ readonly Loading: React.ForwardRefExoticComponent>; /** Menus error component */ readonly Error: React.ForwardRefExoticComponent>; };
* {loading ? "Loading..." : null} *
* {error ? `Error: ${error}` : null} *