import * as React from 'react'; export interface IFillProps { name: Name; [key: string]: any; } export interface IFill extends React.Component { occurrence: number; children: React.ReactNode; } export type Name = string | Symbol; export interface ISlotProps { /** * The name of the component. Use a symbol if you want to be 100% sure the Slot * will only be filled by a component you create */ name: Name; /** * Props to be applied to the child Element of every fill which has the same name. * * If the value is a function, it must have the following signature: * (target: Fill, fills: Fill[]) => void; * * This allows you to access props on the fill which invoked the function * by using target.props.something() */ fillProps?: { [key: string]: any; }; /** * A an optional function which gets all of the current fills for this slot * Allows sorting, or filtering before rendering. An example use-case could * be to only show a limited amount of fills. * * By default Slot injects an unstyled `
` element. If you want greater * control over presentation use this function. * * @example * * {(items) => {items}} * */ children?: (fills: IFill[]) => JSX.Element; bubblesVirtually?: boolean; /** * `Slot` with `bubblesVirtually` set to true also accept an optional `className` to * add to the slot container. * * @type {string} * @memberof ISlotProps */ className?: string; } export interface ISlot extends React.Component { node: Element; } export interface IContext extends IProviderState { } declare const Consumer: React.Consumer; export interface IProviderState { registerFill: (a: Name, b: any) => void; unregisterFill: (a: Name, b: any) => void; unregisterSlot: (a: Name, b?: any) => void; registerSlot: (a: Name, b?: any) => void; getSlot: (a: Name) => ISlot; getFills: (a: Name, b?: any) => IFill[] | []; subscribe: (listener: any) => void; } declare class SlotFillProvider extends React.Component<{ children?: any; }, {}> { private slots; private fills; private listeners; private contextValue; constructor(props: any); registerSlot(name: any, slot: any): void; registerFill(name: any, instance: any): void; unregisterSlot(name: any, instance: any): void; unregisterFill(name: any, instance: IFill): void; getSlot(name: any): ISlot; getFills(name: any, slotInstance: any): IFill[]; private resetFillOccurrence; private forceUpdateSlot; private triggerListeners; subscribe(listener: any): () => void; render(): React.JSX.Element; } /** * React hook returning the active slot given a name. * * @param {string} name Slot name. * @return {Object} Slot object. */ export declare const useSlot: (name: any) => ISlot; export default SlotFillProvider; export { Consumer };