import * as React from 'react'; export type EventHandlers = Record>; export type GenericHTMLProps = React.HTMLAttributes & { ref?: React.Ref | undefined; }; export type BaseUIEvent> = E & { preventBaseUIHandler: () => void; }; type WithPreventBaseUIHandler = T extends (event: infer E) => any ? E extends React.SyntheticEvent ? (event: BaseUIEvent) => ReturnType : T : T extends undefined ? undefined : T; /** * Adds a `preventBaseUIHandler` method to all event handlers. */ export type WithBaseUIEvent = { [K in keyof T]: WithPreventBaseUIHandler; }; /** * Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element. * * @template Props Props to be spread on the rendered element. * @template State Component's internal state. */ export type ComponentRenderFn = (props: Props, state: State) => React.ReactElement; /** * Props shared by all Base UI components. * Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering). */ export type BaseUIComponentProps> = Omit>, 'className'> & { /** * Class names applied to the element or a function that returns them based on the component's state. */ className?: string | ((state: OwnerState) => string); /** * A function to customize rendering of the component. */ render?: ComponentRenderFn | React.ReactElement>; }; export {};