UNPKG

baseui

Version:

A React Component library implementing the Base design language

32 lines (31 loc) 2.24 kB
import * as React from 'react'; import type { StyletronComponent } from 'styletron-react'; import type { StyleObject } from 'styletron-standard'; import type { Theme } from './types'; export type { StyletronComponent }; type StyleFn<DefaultTheme> = { <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>, P extends {}, Theme = DefaultTheme>(component: C, style: StyleObject | ((props: Omit<P, '$theme'> & { $theme: Theme; }) => StyleObject)): StyletronComponent<C, P>; <C extends keyof JSX.IntrinsicElements | React.ComponentType<any>>(component: C, style: StyleObject): StyletronComponent<C, {}>; }; type WithStyleFn<DefaultTheme> = { <C extends StyletronComponent<any, any>, P extends {}, Theme = DefaultTheme>(component: C, style: ((props: Omit<P, '$theme'> & { $theme: Theme; } & (C extends StyletronComponent<infer CC, infer PP> ? PP : never)) => StyleObject) | StyleObject): C extends StyletronComponent<infer CC, infer PP> ? StyletronComponent<CC, P & PP> : never; <C extends StyletronComponent<any, any>>(component: C, style: StyleObject): C; }; export declare function createThemedStyled<Theme>(): StyleFn<Theme>; export declare const styled: StyleFn<Theme>; export declare function createThemedWithStyle<Theme>(): WithStyleFn<Theme>; export declare const withStyle: WithStyleFn<Theme>; type UseStyletronFn<Theme> = () => [(a: StyleObject) => string, Theme]; export declare function createThemedUseStyletron<Theme>(): UseStyletronFn<Theme>; export declare const useStyletron: UseStyletronFn<Theme>; export declare function withWrapper<C extends StyletronComponent<any, any>, Props>(StyledElement: C, wrapperFn: (component: C) => (props: Props & (C extends StyletronComponent<any, infer CP> ? CP : never)) => React.ReactElement): C extends StyletronComponent<infer D, infer P> ? StyletronComponent<D, P & Props> : never; /** @deprecated use StyleFn instead. To be removed in future versions.*/ export type StyletronStyledFn<T> = StyleFn<T>; /** @deprecated use WithStyleFn instead. To be removed in future versions.*/ export type StyletronWithStyleFn<T> = WithStyleFn<T>; /** @deprecated use StyleFn instead. To be removed in future versions.*/ export type StyledFn<T> = StyleFn<T>;