import * as CSS from 'csstype'; import { Classes as ClassesJSS, Styles as StylesJSS, StyleSheet as StyleSheetJSS, StyleSheetFactoryOptions as StyleSheetFactoryOptionsJSS } from 'jss'; import { Overrides } from './overrides'; export interface CSSProperties extends CSS.Properties { [k: string]: CSS.Properties[keyof CSS.Properties] | CSSProperties; } export declare type StyleSheetFactoryOptions = StyleSheetFactoryOptionsJSS; export declare type StyleSheet = StyleSheetJSS; export declare type Styles = StylesJSS; export declare type Classes = ClassesJSS; /** * Theme types */ /** * Breakpoints */ export declare type Breakpoint = string; export declare type BreakpointValues = { [key in Breakpoint]: number; }; export interface Breakpoints { between: (begin: Breakpoint | number, end: Breakpoint | number) => string; down: (key: Breakpoint | number) => string; keys: Breakpoint[]; only: (key: Breakpoint) => string; up: (key: Breakpoint | number) => string; values: BreakpointValues; width: (key: Breakpoint) => number; } export declare type BreakpointsOptions = Partial; /** * Direction */ export declare type Direction = 'ltr' | 'rtl'; /** * Palette */ export declare type ColorPartial = Partial; export interface TypeText { primary: string; secondary: string; disabled: string; hint: string; } export interface TypeAction { active: string; disabled: string; disabledBackground: string; hover: string; hoverOpacity: number; selected: string; selectedOpacity: number; } export interface TypeBackground { default: string; level1?: string; level2?: string; paper: string; } export declare type TypeDivider = string; export declare type PaletteColorOptions = SimplePaletteColorOptions | ColorPartial; export interface SimplePaletteColorOptions { light?: string; main: string; dark?: string; contrastText?: string; } export interface PaletteColor { light: string; main: string; dark: string; contrastText: string; } export declare type PaletteType = 'light' | 'dark'; export interface TypeObject { text: TypeText; action: TypeAction; divider: TypeDivider; background: TypeBackground; } export interface Palette { common: CommonColors; type: PaletteType; contrastThreshold: number; tonalOffset: number; primary: PaletteColor; secondary: PaletteColor; error: PaletteColor; getContrastText: (background: string) => string; grey: Color; text: TypeText; divider: TypeDivider; action: TypeAction; background: TypeBackground; } export declare type PartialTypeObject = { [P in keyof TypeObject]?: Partial; }; export interface PaletteOptions { action?: Partial; background?: Partial; common?: Partial; contrastThreshold?: number; divider?: string; error?: PaletteColorOptions; getContrastText?: (background: string) => string; grey?: ColorPartial; primary?: PaletteColorOptions; secondary?: PaletteColorOptions; text?: Partial; tonalOffset?: number; type?: PaletteType; } /** * Shape */ export interface Shape { borderRadius: number; } /** * Spacing */ export interface Spacing { unit: number; } /** * Transitions */ export interface Easing { easeInOut: string; easeOut: string; easeIn: string; sharp: string; } export interface Duration { shortest: number; shorter: number; short: number; standard: number; complex: number; enteringScreen: number; leavingScreen: number; } export interface Transitions { create: (props?: string | string[], options?: Partial<{ duration: number | string; easing: string; delay: number | string; }>) => string; duration: Duration; easing: Easing; getAutoHeightDuration: (height: number) => number; } export interface TransitionsOptions { easing?: Partial; duration?: Partial; create?: (props: string | string[], options?: Partial<{ duration: number | string; easing: string; delay: number | string; }>) => string; getAutoHeightDuration?: (height: number) => number; } /** * Typography */ export declare type TypographyVariants = 'body1' | 'body2' | 'button' | 'caption' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'inherit' | 'overline' | 'srOnly' | 'subtitle1' | 'subtitle2'; export interface FontStyle extends CSS.FontFace { fontSize?: CSSProperties['fontSize']; fontWeightBold?: CSSProperties['fontWeight']; fontWeightLight?: CSSProperties['fontWeight']; fontWeightMedium?: CSSProperties['fontWeight']; fontWeightRegular?: CSSProperties['fontWeight']; htmlFontSize?: CSSProperties['htmlFontSize']; letterSpacing?: CSSProperties['letterSpacing']; lineHeight?: CSSProperties['lineHeight']; monospace?: CSSProperties['fontFamily']; } export interface TypographyStyle extends FontStyle { fontWeight?: CSSProperties['fontWeight']; height?: CSSProperties['height']; overflow?: CSSProperties['overflow']; position?: CSSProperties['position']; textTransform?: CSSProperties['textTransform']; width?: CSSProperties['width']; } export interface Typography extends FontStyle { pxToRem: (size: number) => string; variants: Partial>; } export interface TypographyOptions extends FontStyle { pxToRem?: (size: number) => string; variants?: Partial>; } export interface ZIndex { appBar: number; drawer: number; modal: number; scrim: number; snackbar: number; tooltip: number; } export interface ZIndexOptions { appBar?: number; drawer?: number; modal?: number; scrim?: number; snackbar?: number; tooltip?: number; } /** * theme template from material-ui */ export interface Theme { breakpoints: Breakpoints; direction: Direction; initial: boolean; overrides: Overrides; palette: Palette; shadows: string[]; shape: Shape; spacing: Spacing; transitions: Transitions; typography: Typography; zIndex: ZIndex; } export interface ThemeOptions { breakpoints?: BreakpointsOptions; direction?: Direction; initial?: boolean; overrides?: Overrides; palette?: PaletteOptions; shadows?: string[]; shape?: Shape; spacing?: Spacing; transitions?: Transitions; typography?: TypographyOptions; zIndex?: ZIndexOptions; } export interface Color { 50: string; 100: string; 200: string; 300: string; 400: string; 500: string; 600: string; 700: string; 800: string; 900: string; A100: string; A200: string; A400: string; A700: string; } export interface CommonColors { black: string; white: string; } export interface ColorObject { type: string; values: Array; } /** * Store action types */ export declare const SET_THEME = "SET_THEME"; export declare const ADD_SHEET = "ADD_SHEET"; interface SetThemeAction { type: typeof SET_THEME; theme: Theme; } interface AddSheetAction { type: typeof ADD_SHEET; sheet: Sheet; } export declare type ActionTypes = SetThemeAction | AddSheetAction; export declare type Sheet = { [P in K]: StyleSheet; }; export interface State { theme: Theme; sheets: Sheet; } export {};