Skip to content

Commit 413af77

Browse files
committed
[theme] Add var for webkit autofill color
1 parent b2ace4b commit 413af77

File tree

6 files changed

+24
-2
lines changed

6 files changed

+24
-2
lines changed

packages/mui-material/src/FilledInput/FilledInput.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,14 @@ const FilledInputInput = styled(InputBaseInput, {
222222
borderTopLeftRadius: 'inherit',
223223
borderTopRightRadius: 'inherit',
224224
},
225+
[theme.getColorSchemeSelector('light')]: {
226+
'&:-webkit-autofill': {
227+
WebkitBoxShadow: theme.vars.palette.Input.autofillWebkitShadowBox,
228+
},
229+
},
225230
[theme.getColorSchemeSelector('dark')]: {
226231
'&:-webkit-autofill': {
227-
WebkitBoxShadow: '0 0 0 100px #266798 inset',
232+
WebkitBoxShadow: theme.vars.palette.Input.autofillWebkitShadowBox,
228233
WebkitTextFillColor: '#fff',
229234
caretColor: '#fff',
230235
},

packages/mui-material/src/OutlinedInput/OutlinedInput.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,14 @@ const OutlinedInputInput = styled(InputBaseInput, {
148148
'&:-webkit-autofill': {
149149
borderRadius: 'inherit',
150150
},
151+
[theme.getColorSchemeSelector('light')]: {
152+
'&:-webkit-autofill': {
153+
WebkitBoxShadow: theme.vars.palette.Input.autofillWebkitShadowBox,
154+
},
155+
},
151156
[theme.getColorSchemeSelector('dark')]: {
152157
'&:-webkit-autofill': {
153-
WebkitBoxShadow: '0 0 0 100px #266798 inset',
158+
WebkitBoxShadow: theme.vars.palette.Input.autofillWebkitShadowBox,
154159
WebkitTextFillColor: '#fff',
155160
caretColor: '#fff',
156161
},

packages/mui-material/src/styles/createThemeFoundation.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ export interface PaletteFilledInput {
155155
disabledBg: string;
156156
}
157157

158+
export interface PaletteInput {
159+
autofillWebkitShadowBox: string;
160+
}
161+
158162
export interface PaletteLinearProgress {
159163
primaryBg: string;
160164
secondaryBg: string;
@@ -236,6 +240,7 @@ export interface ColorSystemOptions {
236240
Button?: Partial<PaletteButton>;
237241
Chip?: Partial<PaletteChip>;
238242
FilledInput?: Partial<PaletteFilledInput>;
243+
Input?: Partial<PaletteInput>;
239244
LinearProgress?: Partial<PaletteLinearProgress>;
240245
Skeleton?: Partial<PaletteSkeleton>;
241246
Slider?: Partial<PaletteSlider>;
@@ -269,6 +274,7 @@ export interface CssVarsPalette {
269274
Button: PaletteButton;
270275
Chip: PaletteChip;
271276
FilledInput: PaletteFilledInput;
277+
Input: Partial<PaletteInput>;
272278
LinearProgress: PaletteLinearProgress;
273279
Skeleton: PaletteSkeleton;
274280
Slider: PaletteSlider;

packages/mui-material/src/styles/createThemeWithVars.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
PaletteButton,
1919
PaletteChip,
2020
PaletteFilledInput,
21+
PaletteInput,
2122
PaletteLinearProgress,
2223
PaletteSkeleton,
2324
PaletteSlider,
@@ -58,6 +59,7 @@ export type {
5859
PaletteButton,
5960
PaletteChip,
6061
PaletteFilledInput,
62+
PaletteInput,
6163
PaletteLinearProgress,
6264
PaletteSkeleton,
6365
PaletteSlider,

packages/mui-material/src/styles/createThemeWithVars.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export default function createThemeWithVars(options = {}, ...args) {
246246
'Button',
247247
'Chip',
248248
'FilledInput',
249+
'Input',
249250
'LinearProgress',
250251
'Skeleton',
251252
'Slider',
@@ -312,6 +313,7 @@ export default function createThemeWithVars(options = {}, ...args) {
312313
setColor(palette.FilledInput, 'bg', 'rgba(0, 0, 0, 0.06)');
313314
setColor(palette.FilledInput, 'hoverBg', 'rgba(0, 0, 0, 0.09)');
314315
setColor(palette.FilledInput, 'disabledBg', 'rgba(0, 0, 0, 0.12)');
316+
setColor(palette.Input, 'autofillWebkitShadowBox', 'unset');
315317
setColor(
316318
palette.LinearProgress,
317319
'primaryBg',
@@ -461,6 +463,7 @@ export default function createThemeWithVars(options = {}, ...args) {
461463
setColor(palette.FilledInput, 'bg', 'rgba(255, 255, 255, 0.09)');
462464
setColor(palette.FilledInput, 'hoverBg', 'rgba(255, 255, 255, 0.13)');
463465
setColor(palette.FilledInput, 'disabledBg', 'rgba(255, 255, 255, 0.12)');
466+
setColor(palette.Input, 'autofillWebkitShadowBox', '0 0 0 100px #266798 inset');
464467
setColor(
465468
palette.LinearProgress,
466469
'primaryBg',

packages/mui-material/src/styles/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ export type {
141141
PaletteColorChannel,
142142
PaletteCommonChannel,
143143
PaletteFilledInput,
144+
PaletteInput,
144145
PaletteLinearProgress,
145146
PaletteSkeleton,
146147
PaletteSlider,

0 commit comments

Comments
 (0)