@fluentui/react-northstar
Version:
A themable React component library.
38 lines (37 loc) • 2.05 kB
TypeScript
import { ShorthandConfig } from '@fluentui/react-bindings';
import * as React from 'react';
import { ShorthandFactory } from './utils/factories';
export declare type ResultOf<T> = T extends (...arg: any[]) => infer TResult ? TResult : never;
export declare type ObjectOf<T> = {
[key: string]: T;
};
export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export declare type FluentComponentStaticProps<P = {}> = {
handledProps: (keyof P)[];
create?: ShorthandFactory<P>;
shorthandConfig?: ShorthandConfig<P>;
};
export declare type Props<T = {}> = T & ObjectOf<any>;
export declare type ReactChildren = React.ReactNode[] | React.ReactNode;
export declare type ComponentEventHandler<TProps> = (event: React.SyntheticEvent<HTMLElement>, data?: TProps) => void;
export declare type ComponentKeyboardEventHandler<TProps> = (event: React.KeyboardEvent<any>, data?: TProps) => void;
export declare type InstanceOf<T> = T extends {
new (...args: any[]): infer TInstance;
} ? TInstance : never;
export declare type PropsOf<T> = T extends React.Component<infer TProps> ? TProps : T extends React.FunctionComponent<infer TProps> ? TProps : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : never;
export declare type ShorthandRenderFunction<P> = (Component: React.ElementType<P>, props: P) => React.ReactNode;
declare type ReactNode = React.ReactChild | React.ReactNode[] | React.ReactPortal | boolean | null | undefined;
export declare type ShorthandValue<P extends Props> = ReactNode | ObjectShorthandValue<P>;
declare type KindSelector<T> = {
[P in keyof T]: {
kind?: P;
} & T[P];
}[keyof T];
export declare type ShorthandCollection<Props, Kinds = Record<string, {}>> = ShorthandValue<Props | (KindSelector<Kinds> & Props)>[];
export declare type ObjectShorthandValue<P extends Props> = Props<P> & {
children?: P['children'] | ShorthandRenderFunction<P>;
};
export declare type ObjectShorthandCollection<P, K = never> = ObjectShorthandValue<P & {
kind?: K;
}>[];
export {};