@mui/material
Version:
React components that implement Google's Material Design.
118 lines (107 loc) • 3.38 kB
TypeScript
/* eslint-disable @typescript-eslint/naming-convention */
import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme } from '@mui/system';
import { OverridableStringUnion } from '@mui/types';
import { Mixins, MixinsOptions } from './createMixins';
import { Palette, PaletteOptions } from './createPalette';
import { Typography, TypographyOptions } from './createTypography';
import { Shadows } from './shadows';
import { Transitions, TransitionsOptions } from './createTransitions';
import { ZIndex, ZIndexOptions } from './zIndex';
import { Components } from './components';
/**
* default MD color-schemes
*/
export type DefaultColorScheme = 'light' | 'dark';
/**
* The application can add more color-scheme by extending this interface via module augmentation
*
* Ex.
* declare module @mui/material/styles {
* interface ColorSchemeOverrides {
* foo: true;
* }
* }
*
* // SupportedColorScheme = 'light' | 'dark' | 'foo';
*/
export interface ColorSchemeOverrides {}
export type ExtendedColorScheme = OverridableStringUnion<never, ColorSchemeOverrides>;
/**
* All color-schemes that the application has
*/
export type SupportedColorScheme = DefaultColorScheme | ExtendedColorScheme;
export interface Opacity {
placeholder: number;
inputTouchBottomLine: number;
}
export type Overlays = [
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
string | undefined,
];
export interface ThemeOptions extends Omit<SystemThemeOptions, 'zIndex'> {
mixins?: MixinsOptions;
components?: Components<BaseTheme>;
colorSchemes?: Record<
SupportedColorScheme,
{
palette?: PaletteOptions;
opacity?: Partial<Opacity>;
overlays?: Overlays;
}
>;
shadows?: Shadows;
transitions?: TransitionsOptions;
typography?: TypographyOptions | ((palette: Palette) => TypographyOptions);
zIndex?: ZIndexOptions;
unstable_strictMode?: boolean;
}
interface BaseTheme extends SystemTheme {
mixins: Mixins;
palette: Palette;
opacity: Opacity;
overlays: Overlays;
shadows: Shadows;
transitions: Transitions;
typography: Typography;
zIndex: ZIndex;
unstable_strictMode?: boolean;
colorSchemes: Record<string, { palette: Palette }>;
}
// shut off automatic exporting for the `BaseTheme` above
export {};
/**
* Our [TypeScript guide on theme customization](https://mui.com/material-ui/guides/typescript/#customization-of-theme) explains in detail how you would add custom properties.
*/
export interface Theme extends BaseTheme {
components?: Components<BaseTheme>;
}
/**
* Generate a theme base on the options received.
* @param options Takes an incomplete theme object and adds the missing parts.
* @param args Deep merge the arguments with the about to be returned theme.
* @returns A complete, ready-to-use theme object.
*/
export default function experimental_extendTheme(options?: ThemeOptions, ...args: object[]): Theme;