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