import * as React from 'react'; import { WithTheme } from '../styles/withTheme'; import { AnyComponent, ConsistentWith, Overwrite, Omit } from '..'; import { Theme } from './createMuiTheme'; import * as CSS from 'csstype'; import * as JSS from 'jss'; export interface CSSProperties extends CSS.Properties { // Allow pseudo selectors and media queries [k: string]: CSS.Properties[keyof CSS.Properties] | CSSProperties; } /** * This is basically the API of JSS. It defines a Map, * where * * - the `keys` are the class (names) that will be created * - the `values` are objects that represent CSS rules (`React.CSSProperties`). */ export type StyleRules = Record; export type StyleRulesCallback = ( theme: Theme, ) => StyleRules; export interface StylesCreator { create(theme: Theme, name: string): StyleRules; options: { index: number }; themingEnabled: boolean; } export interface WithStylesOptions extends JSS.CreateStyleSheetOptions { flip?: boolean; withTheme?: boolean; name?: string; } export type ClassNameMap = Record; export type WithStyles< T extends string | StyleRules | StyleRulesCallback = string, IncludeTheme extends boolean | undefined = undefined > = (IncludeTheme extends true ? WithTheme : Partial) & { classes: ClassNameMap< T extends string ? T : T extends StyleRulesCallback ? K : T extends StyleRules ? K : never >; }; export interface StyledComponentProps { classes?: Partial>; innerRef?: React.Ref | React.RefObject; } export default function withStyles< ClassKey extends string, Options extends WithStylesOptions >( style: StyleRulesCallback | StyleRules, options?: Options, ):

& Partial>>( component: AnyComponent

>, ) => React.ComponentType, StyledComponentProps>>;