From 519d9bcc88b7a08d6384abe26e74d0ed9acea0f9 Mon Sep 17 00:00:00 2001 From: Dmitry Semigradsky Date: Thu, 11 Nov 2021 11:23:50 +0300 Subject: [PATCH 1/3] Add typings for `@mui-material/styles/cssUtils` Fixed #29521 --- .../mui-material/src/styles/cssUtils.d.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packages/mui-material/src/styles/cssUtils.d.ts diff --git a/packages/mui-material/src/styles/cssUtils.d.ts b/packages/mui-material/src/styles/cssUtils.d.ts new file mode 100644 index 00000000000000..792ba47a274797 --- /dev/null +++ b/packages/mui-material/src/styles/cssUtils.d.ts @@ -0,0 +1,32 @@ +import { CSSProperties } from './createTypography'; + +export function isUnitless(value: string): boolean; + +export function getUnit(input: string): string; + +export function toUnitless(value: string): number; + +export function convertLength(baseFontSize: string): (length: string, toUnit: string) => string; + +interface AlignPropertyParams { + size: number; + grid: number; +} +export function alignProperty(params: AlignPropertyParams): number; + +interface FontGridParams { + lineHeight: number; + pixels: number; + htmlFontSize: number; +} +export function fontGrid(params: FontGridParams): number; + +interface ResponsivePropertyParams { + cssProperty: string; + min: number; + max: number; + unit?: string; + breakpoints?: number[]; + transform?: (value: number) => number; +} +export function responsiveProperty(params: ResponsivePropertyParams): CSSProperties; From 5abd979f952f013b6f55516dcd143e4f61e72c8e Mon Sep 17 00:00:00 2001 From: Dmitry Semigradsky Date: Thu, 11 Nov 2021 11:41:57 +0300 Subject: [PATCH 2/3] Fix `test_types` errors --- packages/mui-material/src/styles/cssUtils.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/mui-material/src/styles/cssUtils.d.ts b/packages/mui-material/src/styles/cssUtils.d.ts index 792ba47a274797..a40c2095da30d7 100644 --- a/packages/mui-material/src/styles/cssUtils.d.ts +++ b/packages/mui-material/src/styles/cssUtils.d.ts @@ -8,20 +8,20 @@ export function toUnitless(value: string): number; export function convertLength(baseFontSize: string): (length: string, toUnit: string) => string; -interface AlignPropertyParams { +export interface AlignPropertyParams { size: number; grid: number; } export function alignProperty(params: AlignPropertyParams): number; -interface FontGridParams { +export interface FontGridParams { lineHeight: number; pixels: number; htmlFontSize: number; } export function fontGrid(params: FontGridParams): number; -interface ResponsivePropertyParams { +export interface ResponsivePropertyParams { cssProperty: string; min: number; max: number; From 1fc88e3c68f99bafaf0d35dc4f8f7f436e064938 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 30 Nov 2021 23:29:34 +0000 Subject: [PATCH 3/3] Update index.d.ts --- packages/mui-material/src/styles/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/mui-material/src/styles/index.d.ts b/packages/mui-material/src/styles/index.d.ts index 0fc0daaad3f35b..7e715795ebc203 100644 --- a/packages/mui-material/src/styles/index.d.ts +++ b/packages/mui-material/src/styles/index.d.ts @@ -72,6 +72,7 @@ export { ComponentsProps, ComponentsPropsList } from './props'; export { ComponentsVariants } from './variants'; export { ComponentsOverrides, ComponentNameToClassKey } from './overrides'; export { Components } from './components'; +export { getUnit as unstable_getUnit, toUnitless as unstable_toUnitless } from './cssUtils'; export type ClassNameMap = Record;