feat: v5 radio disabled dot size (#37469)

This commit is contained in:
MadCcc 2022-09-08 16:05:26 +08:00 committed by GitHub
parent 6c06792bfd
commit 42953246f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@ interface RadioToken extends FullToken<'Radio'> {
radioSize: number; radioSize: number;
radioTop: number; radioTop: number;
radioDotSize: number; radioDotSize: number;
radioDotDisabledSize: number;
radioDotColor: string; radioDotColor: string;
radioDotDisabledColor: string; radioDotDisabledColor: string;
radioSolidCheckedColor: string; radioSolidCheckedColor: string;
@ -83,6 +84,7 @@ const getRadioBasicStyle: GenerateStyle<RadioToken> = token => {
paddingXS, paddingXS,
radioDotDisabledColor, radioDotDisabledColor,
controlLineType, controlLineType,
radioDotDisabledSize,
} = token; } = token;
const radioInnerPrefixCls = `${componentCls}-inner`; const radioInnerPrefixCls = `${componentCls}-inner`;
@ -232,6 +234,14 @@ const getRadioBasicStyle: GenerateStyle<RadioToken> = token => {
color: colorTextDisabled, color: colorTextDisabled,
cursor: 'not-allowed', cursor: 'not-allowed',
}, },
[`&${componentCls}-checked`]: {
[radioInnerPrefixCls]: {
'&::after': {
transform: `scale(${radioDotDisabledSize / radioSize})`,
},
},
},
}, },
[`span${componentCls} + *`]: { [`span${componentCls} + *`]: {
@ -504,6 +514,7 @@ export default genComponentStyleHook('Radio', token => {
const radioSize = fontSizeLG; const radioSize = fontSizeLG;
const radioTop = (Math.round(fontSize * lineHeight) - radioSize) / 2; const radioTop = (Math.round(fontSize * lineHeight) - radioSize) / 2;
const radioDotSize = radioSize - (paddingXXS + controlLineWidth) * 2; const radioDotSize = radioSize - (paddingXXS + controlLineWidth) * 2;
const radioDotDisabledSize = radioSize - paddingXXS * 2;
const radioDotColor = colorPrimary; const radioDotColor = colorPrimary;
// Radio buttons // Radio buttons
@ -520,6 +531,7 @@ export default genComponentStyleHook('Radio', token => {
radioSize, radioSize,
radioTop, radioTop,
radioDotSize, radioDotSize,
radioDotDisabledSize,
radioDotColor, radioDotColor,
radioDotDisabledColor: colorTextDisabled, radioDotDisabledColor: colorTextDisabled,
radioSolidCheckedColor: colorBgContainer, radioSolidCheckedColor: colorBgContainer,