import type * as React from "react"; /** A kit component's inline style: CSS, with `lineHeight` narrowed to a string, * because it is the one key whose MEANING differs between a native style * language and React DOM — px against a unitless RATIO. Prefer not to write one * at all: leading is a rung (`size`, `leading="tight"`). */ export type StyleValue = Omit & { lineHeight?: string; }; /** * THE STYLING SURFACE every kit component adds to its own props, and the whole * of it: TOKENS and PROPS, plus these three for PLACEMENT. The DOM, the class * names and the stylesheets are private, so a gap the props do not cover is * closed by a variant in the kit. `className` is a STRING, not the state * function Base UI's raw parts accept. */ export interface StyleProps { /** Appended LAST to the root's class list. */ className?: string; /** Merged LAST into the root's inline style. */ style?: StyleValue; /** A state of the CONSUMER's own, landing on the root beside the kit's. * `undefined` writes no attribute, per the DOM's own rule; every other value * is written verbatim. A key the component publishes itself wins. */ [dataAttr: `data-${string}`]: string | number | boolean | undefined; } /** * What an overlay hands the control it renders THROUGH — the toggle click, the * `aria-haspopup`/`aria-expanded` linkage, the popup's own state attributes. * * Base UI's composition contract: a `render` target forwards its `ref` and * spreads everything else on its DOM node, and one that does not renders exactly * as before while the overlay never opens. Every control that can BE a trigger * extends this and merges it (`mergeProps`, so a handler chains). */ export type TriggerProps = Omit, "className" | "style" | "children" | "dangerouslySetInnerHTML"> & { /** The state attributes an overlay — or a wrapper whose root this control IS — * writes on the element. React's `HTMLAttributes` carries none. */ [dataAttr: `data-${string}`]: string | number | boolean | undefined; }; /** A part's state, as the component computes it. */ export type PartState = Record; /** * Base UI's own escape hatch, for a state whose attribute name is not just the * lowercased key. Pass the SAME mapping to `styleParts` and `useRender`, or the * CSS matches one attribute while the root renders another and nothing fails. */ export type StateAttributesMapping = Record Record | null>; export interface PartAttrs { className?: string; style?: StyleValue; /** The kit's own state, plus whatever the consumer passed through `StyleProps` * — which is why the value is as wide as the prop that carried it. */ [dataAttr: `data-${string}`]: string | number | boolean | undefined; } /** What `styleParts` returns — named so a compound can thread it to a helper that * renders one of its parts. */ export type PartAccessor = (part: Part | "root", state?: PartState) => PartAttrs; /** Hands one node to one ref, in either of the two shapes a ref comes in. `T` is * the REF's element type rather than the node's, which a `RefObject` cannot * express, being invariant. */ export declare function assignRef(ref: React.Ref | undefined, node: T | null): void; /** Fans one element out to several refs — the caller's own, and whatever an * overlay composed onto the same prop. Both win. */ export declare function composeRefs(...refs: Array | undefined>): React.RefCallback; /** Joins class values, dropping every falsy one. Undefined when nothing survives. */ export declare function cn(...values: Array): string | undefined; /** * Assembles the class list, inline style and data attributes for one part. * * `rootPart` is what a component that is a MEMBER of a larger anatomy passes * (`styleParts("dialog", props, "title")`) — otherwise the * consumer's `className` lands on a `root` that is never rendered, with no * error. `Part` DEFAULTS TO NEVER, or every misspelled part name would compile * and paint nothing. */ export declare function styleParts(component: string, props: StyleProps, rootPart?: Part | "root", mapping?: StateAttributesMapping): PartAccessor;