From 09595b19b4f2f52b4c6847966bb35fa0a8b92d1f Mon Sep 17 00:00:00 2001 From: dengfuping Date: Tue, 12 Sep 2023 20:00:33 +0800 Subject: [PATCH 1/5] fix(design): TS type error for ButtonToken --- packages/design/src/button/style/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/design/src/button/style/index.ts b/packages/design/src/button/style/index.ts index 33c66e502..428a10a4b 100644 --- a/packages/design/src/button/style/index.ts +++ b/packages/design/src/button/style/index.ts @@ -23,7 +23,7 @@ export const genButtonStyle: GenerateStyle = (token: ButtonToken) = export default (prefixCls: string) => { const useStyle = genComponentStyleHook('Button', token => { - return [genButtonStyle(token)]; + return [genButtonStyle(token as ButtonToken)]; }); return useStyle(prefixCls); }; From 757989b57d8026af81f70fe3585553c2ebdece5b Mon Sep 17 00:00:00 2001 From: dengfuping Date: Tue, 12 Sep 2023 20:03:22 +0800 Subject: [PATCH 2/5] fix(design): TS type error for TableToken --- packages/design/src/table/style/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/design/src/table/style/index.ts b/packages/design/src/table/style/index.ts index cfb4fe696..9a8d16013 100644 --- a/packages/design/src/table/style/index.ts +++ b/packages/design/src/table/style/index.ts @@ -196,7 +196,7 @@ export const genTableStyle: GenerateStyle = (token: TableToken): CSS export default (prefixCls: string) => { const useStyle = genComponentStyleHook('Table', token => { - return [genTableStyle(token)]; + return [genTableStyle(token as TableToken)]; }); return useStyle(prefixCls); }; From caed65936d6dbdf262598d8b9bf1ce425bb31ce7 Mon Sep 17 00:00:00 2001 From: dengfuping Date: Tue, 12 Sep 2023 20:04:40 +0800 Subject: [PATCH 3/5] fix(ui): TS type error for BasicLayoutToken, PageContainerToken and TagSelectToken --- packages/ui/src/BasicLayout/style/index.ts | 2 +- packages/ui/src/PageContainer/style/index.ts | 2 +- packages/ui/src/TagSelect/style/index.ts | 242 ++++++++++--------- 3 files changed, 127 insertions(+), 119 deletions(-) diff --git a/packages/ui/src/BasicLayout/style/index.ts b/packages/ui/src/BasicLayout/style/index.ts index d021a902f..f8d8048da 100644 --- a/packages/ui/src/BasicLayout/style/index.ts +++ b/packages/ui/src/BasicLayout/style/index.ts @@ -23,7 +23,7 @@ export const genBasicLayoutStyle: GenerateStyle = ( export default (prefixCls: string) => { const useStyle = genComponentStyleHook('BasicLayout', token => { - return [genBasicLayoutStyle(token)]; + return [genBasicLayoutStyle(token as BasicLayoutToken)]; }); return useStyle(prefixCls); }; diff --git a/packages/ui/src/PageContainer/style/index.ts b/packages/ui/src/PageContainer/style/index.ts index 336b8349f..4140831b5 100644 --- a/packages/ui/src/PageContainer/style/index.ts +++ b/packages/ui/src/PageContainer/style/index.ts @@ -100,7 +100,7 @@ export const genPageContainerStyle: GenerateStyle = ( export default (prefixCls: string) => { const useStyle = genComponentStyleHook('PageContainer', token => { - return [genPageContainerStyle(token)]; + return [genPageContainerStyle(token as PageContainerToken)]; }); return useStyle(prefixCls); }; diff --git a/packages/ui/src/TagSelect/style/index.ts b/packages/ui/src/TagSelect/style/index.ts index 08f8b3764..7efde8fb5 100644 --- a/packages/ui/src/TagSelect/style/index.ts +++ b/packages/ui/src/TagSelect/style/index.ts @@ -1,135 +1,143 @@ import type { CSSObject } from '@ant-design/cssinjs'; import type { FullToken, GenerateStyle } from 'antd/lib/theme/internal'; -import {genComponentStyleHook} from '../../_util/genComponentStyleHook'; +import { genComponentStyleHook } from '../../_util/genComponentStyleHook'; export type TagSelectToken = FullToken; const genSizeStyle = (height: number, fontSize: number): CSSObject => { - return { - paddingTop: `${height}px`, - paddingBottom: `${height}px`, - fontSize - }; + return { + paddingTop: `${height}px`, + paddingBottom: `${height}px`, + fontSize, + }; }; -const genColoredStyle = (borderColor: string, backgroundColor: string, color: string): CSSObject => { - return { - borderColor, - backgroundColor, - color - }; -} +const genColoredStyle = ( + borderColor: string, + backgroundColor: string, + color: string +): CSSObject => { + return { + borderColor, + backgroundColor, + color, + }; +}; const genMultipleStyle = (color: string, token: TagSelectToken): CSSObject => { - return { - position: 'absolute', - top: '1px', - right: '1px', - borderTop: `12px solid ${color}`, - borderLeft: `12px solid transparent`, - borderTopRightRadius: token.borderRadiusSM - } -} + return { + position: 'absolute', + top: '1px', + right: '1px', + borderTop: `12px solid ${color}`, + borderLeft: `12px solid transparent`, + borderTopRightRadius: token.borderRadiusSM, + }; +}; const genImgCoverStyle = (width: string, height: string): CSSObject => { - return { - width, - height - }; -} + return { + width, + height, + }; +}; -export const genTagSelectStyle: GenerateStyle = (token: TagSelectToken): CSSObject => { - const { - componentCls, - } = token; +export const genTagSelectStyle: GenerateStyle = ( + token: TagSelectToken +): CSSObject => { + const { componentCls } = token; - return { - [`${componentCls}-title`]: { - fontSize: token.fontSize, - color: token.colorText, - margin: `${token.marginXXS}px 0` - }, - [`${componentCls}-wrapper`]: { - position: 'relative', - display: 'inline-block', - fontSize: token.fontSize, - color: token.colorTextLabel, - background: token.colorWhite, - border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`, - borderRadius: token.borderRadius, - marginRight: token.marginXS, - padding: `${token.paddingXXS}px ${token.paddingContentHorizontal}px`, - cursor: 'pointer', - [`${componentCls}-input`]: { - width: 0, - height: 0, - opacity: 0, - pointerEvents: 'none' - }, - '&:last-child': { - margin: 0 - }, - [`&:has(${componentCls}-cover)`]: { - padding: 0, - ...genImgCoverStyle('76px', '40px') - } - }, - [`${componentCls}-cover`]: { - display: 'inline-block', - width: '100%', - height: '100%', - img: { - height: 'calc(100% - 2px)', - width: 'calc(100% - 2px)', - borderRadius: token.borderRadius, - marginLeft: '1px', - marginTop: '1px' - } - }, - [`${componentCls}-large${componentCls}-img`]: { - ...genImgCoverStyle('228px', '120px'), - marginRight: '16px' - }, - [`${componentCls}-small${componentCls}-img`]: genImgCoverStyle('76px', '32px'), - [`${componentCls}-large`]: genSizeStyle(token.paddingContentVerticalSM, token.fontSize), - [`${componentCls}-small`]: genSizeStyle(0, token.fontSize), - [`${componentCls}-wrapper:not(${componentCls}-disabled):hover`]: { - color: token.colorPrimaryTextHover + return { + [`${componentCls}-title`]: { + fontSize: token.fontSize, + color: token.colorText, + margin: `${token.marginXXS}px 0`, + }, + [`${componentCls}-wrapper`]: { + position: 'relative', + display: 'inline-block', + fontSize: token.fontSize, + color: token.colorTextLabel, + background: token.colorWhite, + border: `${token.lineWidth}px ${token.lineType} ${token.colorBorder}`, + borderRadius: token.borderRadius, + marginRight: token.marginXS, + padding: `${token.paddingXXS}px ${token.paddingContentHorizontal}px`, + cursor: 'pointer', + [`${componentCls}-input`]: { + width: 0, + height: 0, + opacity: 0, + pointerEvents: 'none', + }, + '&:last-child': { + margin: 0, + }, + [`&:has(${componentCls}-cover)`]: { + padding: 0, + ...genImgCoverStyle('76px', '40px'), + }, + }, + [`${componentCls}-cover`]: { + display: 'inline-block', + width: '100%', + height: '100%', + img: { + height: 'calc(100% - 2px)', + width: 'calc(100% - 2px)', + borderRadius: token.borderRadius, + marginLeft: '1px', + marginTop: '1px', + }, + }, + [`${componentCls}-large${componentCls}-img`]: { + ...genImgCoverStyle('228px', '120px'), + marginRight: '16px', + }, + [`${componentCls}-small${componentCls}-img`]: genImgCoverStyle('76px', '32px'), + [`${componentCls}-large`]: genSizeStyle(token.paddingContentVerticalSM, token.fontSize), + [`${componentCls}-small`]: genSizeStyle(0, token.fontSize), + [`${componentCls}-wrapper:not(${componentCls}-disabled):hover`]: { + color: token.colorPrimaryTextHover, + }, + [`${componentCls}-checked`]: genColoredStyle( + token.blue, + token.colorPrimaryBg, + token.colorPrimaryText + ), + [`${componentCls}-wrapper${componentCls}-checked:not(${componentCls}-disabled):focus-within`]: { + boxShadow: `0 1px 3px 0px #000`, + borderColor: `${token.colorPrimary}`, + }, + [`${componentCls}-checked:not(${componentCls}-disabled)`]: { + '&:hover': { + ...genColoredStyle(token.colorInfoBorder, '#EBF1FF', token.colorInfoTextHover), + [`${componentCls}-inner`]: { + borderTopColor: `${token.colorPrimaryTextHover} !important`, }, - [`${componentCls}-checked`]: genColoredStyle(token.blue, token.colorPrimaryBg, token.colorPrimaryText), - [`${componentCls}-wrapper${componentCls}-checked:not(${componentCls}-disabled):focus-within`]: { - boxShadow: `0 1px 3px 0px #000`, - borderColor: `${token.colorPrimary}` - }, - [`${componentCls}-checked:not(${componentCls}-disabled)`]: { - '&:hover': { - ...genColoredStyle(token.colorInfoBorder, '#EBF1FF', token.colorInfoTextHover), - [`${componentCls}-inner`]: { - borderTopColor: `${token.colorPrimaryTextHover} !important` - } - } - }, - [`${componentCls}-disabled:not(${componentCls}-checked)`]: { - ...genColoredStyle(token.colorBorder, '#F6F8FE', '#CDD5E3'), - cursor: 'not-allowed' - }, - [`${componentCls}-disabled${componentCls}-checked`]: { - cursor: 'not-allowed', - ...genColoredStyle(token.colorBorder, '#E2E8F3', token.colorTextTertiary) - }, - [`${componentCls}-checked${componentCls}-disabled.multiple`]: { - [`${componentCls}-inner`]: genMultipleStyle('#CDD5E3', token) - }, - [`${componentCls}-checked:not(${componentCls}-disabled).multiple`]: { - [`${componentCls}-inner`]: genMultipleStyle(token.colorPrimary, token) - } - } -} + }, + }, + [`${componentCls}-disabled:not(${componentCls}-checked)`]: { + ...genColoredStyle(token.colorBorder, '#F6F8FE', '#CDD5E3'), + cursor: 'not-allowed', + }, + [`${componentCls}-disabled${componentCls}-checked`]: { + cursor: 'not-allowed', + ...genColoredStyle(token.colorBorder, '#E2E8F3', token.colorTextTertiary), + }, + [`${componentCls}-checked${componentCls}-disabled.multiple`]: { + [`${componentCls}-inner`]: genMultipleStyle('#CDD5E3', token), + }, + [`${componentCls}-checked:not(${componentCls}-disabled).multiple`]: { + [`${componentCls}-inner`]: genMultipleStyle(token.colorPrimary, token), + }, + }; +}; export default (prefixCls: string) => { - const useStyle = genComponentStyleHook('TagSelect', token => { - return [genTagSelectStyle(token)]; - }); + const useStyle = genComponentStyleHook('TagSelect', token => { + return [genTagSelectStyle(token as TagSelectToken)]; + }); - return useStyle(prefixCls); -} \ No newline at end of file + return useStyle(prefixCls); +}; From 73058a59fdae90d4f78a9e44ff2ecefb8b4df3db Mon Sep 17 00:00:00 2001 From: dengfuping Date: Tue, 12 Sep 2023 20:55:02 +0800 Subject: [PATCH 4/5] fix(design): TS type error for CardToken and DescriptionsToken --- packages/design/src/card/style/index.ts | 2 +- packages/design/src/descriptions/style/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/design/src/card/style/index.ts b/packages/design/src/card/style/index.ts index f952f45cf..9e3e0674e 100644 --- a/packages/design/src/card/style/index.ts +++ b/packages/design/src/card/style/index.ts @@ -31,7 +31,7 @@ export const genCardStyle: GenerateStyle = (token: CardToken): CSSObj ...token, componentCls: tabsComponentCls, prefixCls: tabsPrefixCls, - }), + } as CardToken), }, }; }; diff --git a/packages/design/src/descriptions/style/index.ts b/packages/design/src/descriptions/style/index.ts index 51a6b733d..c4fcc8795 100644 --- a/packages/design/src/descriptions/style/index.ts +++ b/packages/design/src/descriptions/style/index.ts @@ -36,7 +36,7 @@ export default (prefixCls: string, typographyPrefixCls: string) => { ...token, typographyPrefixCls, typographyComponentCls: `.${typographyPrefixCls}`, - }), + } as DescriptionsToken), ]; }); return useStyle(prefixCls); From 7109a89b9a984bf2f8252920879d38e68bd8a8b6 Mon Sep 17 00:00:00 2001 From: dengfuping Date: Wed, 13 Sep 2023 10:31:45 +0800 Subject: [PATCH 5/5] fix(test): Update snapshots --- .../__snapshots__/progress.test.tsx.snap | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/design/src/modal/__tests__/__snapshots__/progress.test.tsx.snap b/packages/design/src/modal/__tests__/__snapshots__/progress.test.tsx.snap index a0bd4f748..e8ef145b2 100644 --- a/packages/design/src/modal/__tests__/__snapshots__/progress.test.tsx.snap +++ b/packages/design/src/modal/__tests__/__snapshots__/progress.test.tsx.snap @@ -192,36 +192,36 @@ exports[`Modal.Progress render with progress.percent 1`] = `