UNPKG

@enact/ui

Version:

A collection of simplified unstyled cross-platform UI components for Enact

54 lines (48 loc) 1.87 kB
// Type definitions for ui/Placeholder type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>; type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N; export interface PlaceholderDecoratorConfig extends Object { /** * Configures the style of the placeholder element */ style?: object; /** * The component to use as a placeholder. */ placeholderComponent?: string; } export interface PlaceholderDecoratorProps {} export function PlaceholderDecorator<P>( config: PlaceholderDecoratorConfig, Component: React.ComponentType<P> | string, ): React.ComponentType<P & PlaceholderDecoratorProps>; export function PlaceholderDecorator<P>( Component: React.ComponentType<P> | string, ): React.ComponentType<P & PlaceholderDecoratorProps>; export interface PlaceholderControllerDecoratorConfig extends Object { /** * The bounds of the container represented by an object with `height` and `width` members. * * If the container is a static size, this can be specified at design-time to avoid calculating the bounds at run-time (the default behavior). */ bounds?: object; /** * Event callback which indicates that the viewport has scrolled and placeholders should be notified. */ notify?: string; /** * Multiplier used with the wrapped component's height and width to determine the threshold for replacing the placeholder component with the true component. */ thresholdFactor?: number; } export interface PlaceholderControllerDecoratorProps {} export function PlaceholderControllerDecorator<P>( config: PlaceholderControllerDecoratorConfig, Component: React.ComponentType<P> | string, ): React.ComponentType<P & PlaceholderControllerDecoratorProps>; export function PlaceholderControllerDecorator<P>( Component: React.ComponentType<P> | string, ): React.ComponentType<P & PlaceholderControllerDecoratorProps>;