@trellixio/roaster-coffee
Version:
Beans' product component library
45 lines • 1.78 kB
TypeScript
/// <reference types="react" />
/**
* A type that extends a functional component with additional static properties.
*
* @typeParam Props - The type of the props passed to the functional component.
* @typeParam Static - The type of the static properties added to the functional component.
*
* @example
* ```tsx
* interface MyComponentProps {
* message: string;
* }
*
* interface MyComponentStatic {
* staticProp: string;
* }
*
* const MyComponent: ForwardRefWithStaticComponents<MyComponentProps, MyComponentStatic> = React.forwardRef((props, ref) => {
* return <div ref={ref}>{props.message}</div>;
* });
*
* MyComponent.displayName = 'MyComponent';
* MyComponent.staticProp = 'foo';
*```
*/
export declare type ForwardRefWithStaticComponents<Props extends Record<string, any>, Static extends Record<string, any>> = ((props: Props) => React.ReactElement) & Static & {
displayName: string;
};
declare type ComponentProp<C extends React.ElementType> = {
component?: C;
};
declare type PropsToOmit<C extends React.ElementType, P> = keyof (ComponentProp<C> & P);
export declare type PolymorphicComponentProp<C extends React.ElementType, Props = {}> = React.PropsWithChildren<Props & ComponentProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
export declare type PolymorphicComponentPropWithRef<C extends React.ElementType, Props = {}> = PolymorphicComponentProp<C, Props> & {
ref?: PolymorphicRef<C>;
};
export declare type PolymorphicRef<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref'];
/**
* Custom CSS properties interface for Progress level.
*/
export interface ProgressCSSProperties extends React.CSSProperties {
'--percent': string | number;
}
export {};
//# sourceMappingURL=types.d.ts.map