UNPKG

1.41 kBTypeScriptView Raw
1import * as CSS from 'csstype';
2import { Breakpoints } from '@mui/system';
3
4export type NormalCssProperties = CSS.Properties<number | string>;
5export type Fontface = CSS.AtRule.FontFace & { fallbacks?: CSS.AtRule.FontFace[] };
6
7/**
8 * Allows the user to augment the properties available
9 */
10export interface BaseCSSProperties extends NormalCssProperties {
11 '@font-face'?: Fontface | Fontface[];
12}
13
14export interface CSSProperties extends BaseCSSProperties {
15 // Allow pseudo selectors and media queries
16 // `unknown` is used since TS does not allow assigning an interface without
17 // an index signature to one with an index signature. This is to allow type safe
18 // module augmentation.
19 // Technically we want any key not typed in `BaseCSSProperties` to be of type
20 // `CSSProperties` but this doesn't work. The index signature needs to cover
21 // BaseCSSProperties as well. Usually you would use `BaseCSSProperties[keyof BaseCSSProperties]`
22 // but this would not allow assigning React.CSSProperties to CSSProperties
23 [k: string]: unknown | CSSProperties;
24}
25
26export interface Mixins {
27 toolbar: CSSProperties;
28 // ... use interface declaration merging to add custom mixins
29}
30
31export interface MixinsOptions extends Partial<Mixins> {
32 // ... use interface declaration merging to add custom mixin options
33}
34
35export default function createMixins(breakpoints: Breakpoints, mixins: MixinsOptions): Mixins;