import "./index.css"; import type { CombineAriaPropsWithCustomProps } from "../../utilities/reactAriaProps"; import React, { type ReactElement, type ReactNode } from "react"; import type { Key, MenuItemProps, MenuSectionProps, PopoverProps } from "react-aria-components"; export type DropdownPlacement = NonNullable; export interface DropdownProps { /** * A `` followed by a `` containing the items. */ children: ReactNode; /** Fires when the menu closes. */ onClose?: () => void; /** Fires when the menu opens. Useful for analytics or lazy data prep. */ onOpen?: () => void; } export type DropdownElementProps = DropdownProps; /** * An action menu — a button that, when activated, reveals a list of actions or * navigation links. Composed of a `` wrapping a Tapestry * dropdown-trigger button (`DropdownButton`, `DropdownIconButton`, or * `PageHeaderActionsDropdownButton`) and a `` containing * ``, ``, ``, and * `` items. * * **Dropdown vs Select.** Use `Dropdown` to trigger an action ("Edit", * "Delete") or navigate ("Go to documentation"). Use `Select` to collect a * value that is bound to form data or component state. They look visually * similar but follow different ARIA patterns (Menu vs Combobox/Listbox) and * are not interchangeable. * * Built on React Aria's `MenuTrigger` primitive; popover positioning and menu * identity live on ``. * * @component * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menu/ | W3C APG Menu Pattern} */ export declare function Dropdown({ children, onClose, onOpen }: DropdownElementProps): React.JSX.Element; export interface DropdownMenuProps { /** * `` / `` / `` / * `` elements. */ children: ReactNode; /** Override for the underlying `` element id. */ id?: string; /** * Popover position relative to the trigger. Uses React Aria's * space-separated format (e.g., `"bottom start"`, `"top end"`, * `"left top"`). Defaults to `"bottom start"`. */ placement?: DropdownPlacement; } export type DropdownMenuElementProps = DropdownMenuProps; /** * The popover surface for a ``. Wraps React Aria's `` and * `` and contains the menu items. * * @component */ export declare function DropdownMenu({ children, id, placement, }: DropdownMenuElementProps): React.JSX.Element; export interface DropdownTriggerProps { /** * A single Tapestry dropdown-trigger button element (`DropdownButton`, * `DropdownIconButton`, or `PageHeaderActionsDropdownButton`). */ children: ReactElement; } export declare function DropdownTrigger({ children }: DropdownTriggerProps): React.JSX.Element; export interface DropdownItemBaseProps { /** Applies destructive styling. */ destructive?: boolean; /** Applies staff-only visual treatment. */ staffOnly?: boolean; } export interface DropdownActionProps extends DropdownItemBaseProps { /** * Disables the item. Renamed to React Aria's `isDisabled` inside the * wrapper. Disabled items are skipped by keyboard traversal and won't fire * `onAction`. */ disabled?: boolean; /** * Stable identifier — required by React Aria's collection model for keying * and focus tracking. */ id: Key; /** Callback fired when the item is activated. */ onAction: () => void; } type AriaActionPropsToOmit = "href" | "isDisabled" | "rel" | "routerOptions" | "target" | "value"; type AriaActionPropsToInclude = "textValue"; export type DropdownActionElementProps = CombineAriaPropsWithCustomProps, DropdownActionProps, AriaActionPropsToOmit, AriaActionPropsToInclude>; /** * A `` item that fires a callback when activated. Renders an RA * `` (`role="menuitem"`). Children are passed through and can use * the slot convention (`slot="label" | "prefix" | "suffix" | "description"`) * for structured content. * * @component */ export declare function DropdownAction({ className, destructive, disabled, staffOnly, ...restProps }: DropdownActionElementProps): React.JSX.Element; export interface DropdownLinkProps extends DropdownItemBaseProps { /** If `true`, sets `target="_blank"` and `rel="noreferrer noopener"`. */ external?: boolean; /** Destination URL. */ href: string; /** * Stable identifier — required by React Aria's collection model for keying * and focus tracking. */ id: Key; } type AriaLinkPropsToOmit = "isDisabled" | "onAction" | "rel" | "target" | "value"; type AriaLinkPropsToInclude = "href" | "routerOptions" | "textValue"; export type DropdownLinkElementProps = CombineAriaPropsWithCustomProps, DropdownLinkProps, AriaLinkPropsToOmit, AriaLinkPropsToInclude>; /** * A `` item that navigates to a URL. Renders an RA `` as * an anchor (``). Pass `external` to open in a * new tab with `rel="noreferrer noopener"`. * * `disabled` is intentionally not accepted — HTML has no native disabled state * for anchors, and a "disabled link" has no accessible analog. If a link * shouldn't be activatable, omit it. * * @component */ export declare function DropdownLink({ className, destructive, external, staffOnly, ...restProps }: DropdownLinkElementProps): React.JSX.Element; export interface DropdownSectionProps { /** The items rendered within the section. */ children: ReactNode; /** * Heading rendered above the section's items. Required — RA renders the * section as `role="group"` and the heading provides the group's * accessible name via `aria-labelledby`. */ title: string; } export type DropdownSectionElementProps = CombineAriaPropsWithCustomProps, DropdownSectionProps, "value", never>; /** * A grouped section within a ``. Renders an RA `` * (`role="group"`) with an optional `
` heading when `title` is set. * * @component */ export declare function DropdownSection({ children, className, title, ...restProps }: DropdownSectionElementProps): React.JSX.Element; export type DropdownSeparatorElementProps = Record; /** * A divider between items in a ``. Renders an RA `` * (`role="separator"`). * * @component */ export declare function DropdownSeparator(): React.JSX.Element; export {}; //# sourceMappingURL=Dropdown.d.ts.map