/** * Shared behavioral machinery for Popover and DropdownMenu. * @module react/components/ui/anchored-surface */ import * as React from "react"; import { type PolymorphicButtonAttributes } from "./slot.js"; import { type DisclosureOptions } from "./disclosure.js"; /** Context value shared between an anchored skin's Root and its parts. */ export interface AnchoredState { open: boolean; setOpen: (open: boolean) => void; anchorRef: React.RefObject; anchorElement: HTMLElement | null; setAnchorElement: React.Dispatch>; triggerRef: React.RefObject; defaultTriggerId: string; defaultContentId: string; triggerId: string; contentId: string; setTriggerId: React.Dispatch>; setContentId: React.Dispatch>; } /** * Backward-compatible public props for an anchored trigger. * * Keep this as a broad interface so existing wrapper interfaces, conditional * `asChild` values, and button-shaped prop spreads remain source-compatible. * Skin-level overloads add precise element refs for literal slotted calls. */ export interface AnchoredTriggerPublicProps extends React.ButtonHTMLAttributes { asChild?: boolean; ref?: React.Ref; } /** Slotted-element props for an anchored trigger. */ export type AnchoredSlottedTriggerProps = Omit, "children" | "ref" | "type"> & { asChild: true; children: React.ReactElement; /** Apply disabled semantics across native and non-native slotted controls. */ disabled?: boolean; /** Applied only when `children` is an intrinsic `