-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TypeScript] getCssVar autocomplete for Material UI (#33464)
- Loading branch information
1 parent
4e9f6cb
commit f427ef9
Showing
12 changed files
with
223 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/mui-joy/test/typescript/moduleAugmentation/themeGetCssVar.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { extendTheme } from '@mui/joy/styles'; | ||
|
||
declare module '@mui/joy/styles' { | ||
interface ThemeCssVarOverrides { | ||
'custom-color': true; | ||
} | ||
} | ||
|
||
const theme = extendTheme(); | ||
|
||
theme.getCssVar('custom-color'); |
4 changes: 4 additions & 0 deletions
4
packages/mui-joy/test/typescript/moduleAugmentation/themeGetCssVar.tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../../../../tsconfig", | ||
"files": ["themeGetCssVar.spec.tsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/mui-material/src/styles/experimental_extendTheme.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { experimental_extendTheme as extendTheme } from '@mui/material/styles'; | ||
|
||
const theme = extendTheme(); | ||
|
||
theme.getCssVar('palette-primary-main'); | ||
theme.getCssVar('palette-Alert-errorColor'); | ||
theme.getCssVar('opacity-inputPlaceholder'); | ||
theme.getCssVar('zIndex-appBar'); | ||
theme.getCssVar('shape-borderRadius'); | ||
theme.getCssVar('shadows-0'); | ||
theme.getCssVar('overlays-0'); | ||
|
||
// @ts-expect-error | ||
theme.getCssVar(); | ||
// @ts-expect-error | ||
theme.getCssVar(''); | ||
// @ts-expect-error | ||
theme.getCssVar('custom-color'); | ||
// @ts-expect-error | ||
theme.getCssVar('palette-primary-main', ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,5 @@ const theme = extendTheme({ | |
}, | ||
}, | ||
}); | ||
|
||
theme.getCssVar('palette-gradient-default'); |
12 changes: 12 additions & 0 deletions
12
packages/mui-material/test/typescript/moduleAugmentation/themeGetCssVar.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { experimental_extendTheme as extendTheme } from '@mui/material/styles'; | ||
import type {} from '@mui/material/themeCssVarsAugmentation'; | ||
|
||
declare module '@mui/material/styles' { | ||
interface ThemeCssVarOverrides { | ||
'custom-color': true; | ||
} | ||
} | ||
|
||
const theme = extendTheme(); | ||
|
||
theme.getCssVar('custom-color'); |
4 changes: 4 additions & 0 deletions
4
packages/mui-material/test/typescript/moduleAugmentation/themeGetCssVar.tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": "../../../../../tsconfig", | ||
"files": ["themeGetCssVar.spec.tsx"] | ||
} |