aesthetic-react
Version:
React hooks, composers, and more for styling components with Aesthetic.
69 lines • 3.11 kB
TypeScript
import React from 'react';
import { ClassNameTransformer, CompiledStyleSheet, Direction, StyleName, StyleSheetFactory, ThemeName } from 'aesthetic';
export interface DirectionProviderProps {
children: NonNullable<React.ReactNode>;
dir?: Exclude<Direction, 'neutral'>;
inline?: boolean;
value?: string;
}
export interface ThemeProviderProps {
children: NonNullable<React.ReactNode>;
name?: ThemeName;
propagate?: boolean;
}
export interface ThemeProviderState {
themeName: ThemeName;
}
export interface UseStylesOptions {
/** Custom name for the component being styled. */
styleName?: string;
}
export interface WithThemeWrapperProps {
/** Gain a reference to the wrapped component. Provided by `withTheme`. */
wrappedRef?: React.Ref<any>;
}
export interface WithThemeWrappedProps<Theme> {
/** The ref passed by the `wrappedRef` prop. Provided by `withTheme`. */
ref?: React.Ref<any>;
/** The theme object. Provided by `withTheme`. */
theme: Theme;
}
export interface WithThemeOptions {
/** Name of the prop in which to pass the theme object to the wrapped component. Provided by `withTheme`. */
themePropName?: string;
}
export interface WithStylesWrapperProps {
/** Gain a reference to the wrapped component. Provided by `withStyles`. */
wrappedRef?: React.Ref<any>;
}
export interface WithStylesWrappedProps<Theme> {
/** Utility function to transform parsed styles into CSS class names. Provided by `withStyles`. */
cx: ClassNameTransformer;
/** The ref passed by the `wrappedRef` prop. Provided by `withStyles`. */
ref?: React.Ref<any>;
/** The parsed component style sheet in which rulesets can be transformed to class names. Provided by `withStyles`. */
styles: CompiledStyleSheet;
/** The theme object when `passThemeProp` is true. Provided by `withStyles`. */
theme?: Theme;
}
export interface WithStylesOptions {
/** Name of the prop in which to pass the CSS class name transformer function. Provided by `withStyles`. */
cxPropName?: string;
/** Can this component's styles be extended to create a new component. Provided by `withStyles`. */
extendable?: boolean;
/** The parent component ID in which to extend styles from. This is usually defined automatically. Provided by `withStyles`. */
extendFrom?: string;
/** Pass the theme object prop to the wrapped component. Provided by `withStyles`. */
passThemeProp?: boolean;
/** Name of the prop in which to pass styles to the wrapped component. Provided by `withStyles`. */
stylesPropName?: string;
/** Name of the prop in which to pass the theme object to the wrapped component. Provided by `withStyles`. */
themePropName?: string;
}
export interface StyledComponent<Props> extends React.NamedExoticComponent<Props> {
displayName: string;
styleName: StyleName;
WrappedComponent: React.ComponentType<any>;
extendStyles<T>(styleSheet: StyleSheetFactory<any, T>, extendOptions?: Omit<WithStylesOptions, 'extendFrom'>): StyledComponent<Props>;
}
//# sourceMappingURL=types.d.ts.map