@mui/material
Version:
Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.
41 lines • 2 kB
text/typescript
import type { Theme, ThemeOptions } from "./createTheme.mjs";
import type { CssVarsTheme } from "./createThemeWithVars.mjs";
export declare const DEFAULT_STEP_PX: {
xxSmall: number;
xSmall: number;
small: number;
medium: number;
large: number;
xLarge: number;
xxLarge: number;
};
export type DensityKey = keyof typeof DEFAULT_STEP_PX;
export declare const DENSITY_KEYS: DensityKey[];
export declare const DEFAULT_SIZING_PX: {
touchTarget: number;
iconSize: number;
};
export type DensitySizingKey = keyof typeof DEFAULT_SIZING_PX;
export declare const SIZING_KEYS: DensitySizingKey[];
/** The scale a theme ended up with, in px numbers, for code that needs the
* values in JS (MUI X derives row heights from `touchTarget + small`). Written
* to `theme.unstable_densityScale` by `enhanceDensity`. */
export type ResolvedDensityScale = Record<DensitySizingKey, number> & {
spacing: Record<DensityKey, number>;
};
/**
* What `enhanceDensity` accepts as its second argument. The steps nest under
* `spacing` because that is the surface they land on — `theme.spacing('small')`
* resolves them — while the sizing constants size a box and sit at the top
* level. Values are px; anything left out keeps its default.
*/
export type DensityScaleOverrides = Partial<Record<DensitySizingKey, number>> & {
spacing?: Partial<Record<DensityKey, number>> | undefined;
};
export type EnhanceableTheme = Theme & Partial<Pick<CssVarsTheme, 'rootSelector' | 'cssVarPrefix' | 'generateThemeVars' | 'generateStyleSheets'>> & Pick<ThemeOptions, 'modularCssLayers'>;
export type DensityEnhancedTheme<T extends EnhanceableTheme> = T & {
components: NonNullable<EnhanceableTheme['components']>;
vars?: Partial<Record<DensitySizingKey, string>> | undefined;
unstable_densityScale: ResolvedDensityScale;
} & Record<DensitySizingKey, string>;
export declare function applyDensity<T extends EnhanceableTheme>(themeInput: T, scaleOverrides?: DensityScaleOverrides): DensityEnhancedTheme<T>;