import { ComponentType, ReactNode, ReactElement } from "react"; type PropsOf = T extends ComponentType ? P : never; export interface AsChildProps { /** * When true, the component will be replaced by its children while preserving its props and behavior */ asChild?: boolean; } /** * A Higher-Order Component (HOC) that adds the ability to render the wrapped component's children * instead of the component itself, while preserving its props and behavior. * * This HOC is useful when you want to conditionally render a component or dynamically change its * children based on props or state. * * @param {IReactComponent} Component - The component to wrap. * @param {string} [displayName] - An optional custom display name for the wrapped component. * @returns {React.FC} - A functional component that renders the wrapped component * with the added `asChild` prop. * @example * const MyComponent = () =>
My component
; * const MyComponentWithAsChild = withAsChild(MyComponent); * *

This is the children of the component

*
; */ export declare function withAsChild>(Component: T, displayName?: string): (props: PropsOf & AsChildProps) => ReactElement; export interface SlotProps { children?: ReactNode; } /** * A functional component that serves as a slot for rendering child elements with merged props. * * This component takes props and children, validates the child element, and merges its * properties with the slot's properties. It provides flexibility in overriding or * extending the child's props, supporting functions, styles, and class names. * * Functions in both slot and child props are combined so both can be executed. * Styles and class names are merged using appropriate utilities. * * @template T - Extends SlotProps, representing the type of props the component can accept. * @param {T} props - The properties and children for the Slot component. * Includes the child element and any additional props to merge. * @returns {ReactElement|null} - Returns the cloned child element with merged props, */ export declare function Slot(props: T): ReactElement> | null; export declare namespace Slot { var displayName: string; } export {};