/** * Copyright Zendesk, Inc. * * Use of this source code is governed under the Apache License, Version 2.0 * found at http://www.apache.org/licenses/LICENSE-2.0. */ import { ARROW_POSITION as ArrowPosition, MENU_POSITION as MenuPosition } from '@zendeskgarden/react-theming'; import { GardenPlacement, IItemGroupProps, IItemProps } from '../../types'; import { Placement } from '@floating-ui/react-dom'; import { IMenuItemBase, MenuItem } from '@zendeskgarden/container-menu'; import { ReactNode } from 'react'; declare const FLOATING_PLACEMENT: readonly ["auto", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"]; type FloatingPlacement = (typeof FLOATING_PLACEMENT)[number]; /** * Convert Garden placement to a valid placement for Floating-UI. * * @param isRtl Determines if layout is right-to-left. * @param placement A Garden placement. * * @returns A Floating-UI placement. */ export declare const toFloatingPlacement: (isRtl: boolean, placement: GardenPlacement) => FloatingPlacement; /** * If `fallbackPlacements` are given, converts them to Floating-UI placements. * * Otherwise, builds a list of Floating-UI fallback placements given the * current `placement`. * * @param isRtl Determines if layout is right-to-left. * @param placement A Floating-UI placement. * @param fallbackPlacements Optional list of Garden placements * * @returns A list of Floating-UI fallback placements. */ export declare const getFallbackPlacements: (isRtl: boolean, placement: FloatingPlacement, fallbackPlacements?: GardenPlacement[]) => Placement[]; /** * Convert Floating-UI placement to a valid `menuStyles` position. * * @param placement A Floating-UI placement. * * @returns A `menuStyles` position. */ export declare const toMenuPosition: (placement?: FloatingPlacement) => MenuPosition; /** * Convert Floating-UI placement to a valid `arrowStyles` position. * * @param isRtl Determines if layout is right-to-left. * @param placement A Floating-UI placement. * * @returns An `arrowStyles` position. */ export declare const toArrowPosition: (isRtl: boolean, placement?: FloatingPlacement) => ArrowPosition; /** * Convert `Item` props to a valid object for `useMenu`. * * @param props `Item` props. * * @returns A valid `useMenu` item object. */ export declare const toItem: (props: IItemProps & { selectionType?: IItemGroupProps['type']; }) => IMenuItemBase; /** * Convert an array of `Item` and `ItemGroup` children to a valid `items` * data structure for `useMenu`. * * @param children The `children` prop from `Combobox`. * @param type The group type, if any. * * @returns A valid `IUseMenuProps['items']` data structure. */ export declare const toItems: (children: ReactNode, type?: 'radio' | 'checkbox') => MenuItem[]; export {};