docs: more token info (#41421)

This commit is contained in:
二货爱吃白萝卜 2023-03-23 17:17:28 +08:00 committed by GitHub
parent bf8a36be8f
commit 67a94febee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 53 additions and 10 deletions

View File

@ -40,20 +40,35 @@ function SubTokenTable({ defaultOpen, tokens, title }: SubTokenTableProps) {
return null;
}
const data = tokens.map((name) => {
const meta = tokenMeta[name];
const data = tokens
.sort((token1, token2) => {
const hasColor1 = token1.toLowerCase().includes('color');
const hasColor2 = token2.toLowerCase().includes('color');
return {
name,
desc: lang === 'cn' ? meta.desc : meta.descEn,
type: meta.type,
value: (defaultToken as any)[name],
};
});
if (hasColor1 && !hasColor2) {
return -1;
}
if (!hasColor1 && hasColor2) {
return 1;
}
return token1 < token2 ? -1 : 1;
})
.map((name) => {
const meta = tokenMeta[name];
return {
name,
desc: lang === 'cn' ? meta.desc : meta.descEn,
type: meta.type,
value: (defaultToken as any)[name],
};
});
return (
// Reuse `.markdown` style
<details className="markdown" open={defaultOpen}>
<details className="markdown" open={defaultOpen || process.env.NODE_ENV !== 'production'}>
<summary>
<h3 style={{ display: 'inline' }}>{title}</h3>
</summary>

View File

@ -116,6 +116,10 @@ Supports all props of `Input`.
| blur | Remove focus | - | |
| focus | Get focus | (option?: { preventScroll?: boolean, cursor?: 'start' \| 'end' \| 'all' }) | option - 4.10.0 |
## Design Token
<ComponentTokenTable component="Input"></ComponentTokenTable>
## FAQ
### Why Input lose focus when change `prefix/suffix/showCount`

View File

@ -117,6 +117,10 @@ Input 的其他属性和 React 自带的 [input](https://reactjs.org/docs/dom-el
| blur | 取消焦点 | - | |
| focus | 获取焦点 | (option?: { preventScroll?: boolean, cursor?: 'start' \| 'end' \| 'all' }) | option - 4.10.0 |
## Design Token
<ComponentTokenTable component="Input"></ComponentTokenTable>
## FAQ
### 为什么我动态改变 `prefix/suffix/showCount`Input 会失去焦点?

View File

@ -137,6 +137,10 @@ Select component to select value from options.
| key | Group key | string | - | |
| label | Group label | string \| React.Element | - | |
## Design Token
<ComponentTokenTable component="Select"></ComponentTokenTable>
## FAQ
### Why sometime search will show 2 same option when in `tags` mode?

View File

@ -138,6 +138,10 @@ demo:
| key | Key | string | - | |
| label | 组名 | string \| React.Element | - | |
## Design Token
<ComponentTokenTable component="Select"></ComponentTokenTable>
## FAQ
### `mode="tags"` 模式下为何搜索有时会出现两个相同选项?

View File

@ -21,18 +21,21 @@ export interface ColorNeutralMapToken {
/**
* @nameZH
* @desc Label Menu
* @descEN The second level of text color is generally used in scenarios where text color is not emphasized, such as label text, menu text selection state, etc.
*/
colorTextSecondary: string;
/**
* @nameZH
* @desc
* @descEN The third level of text color is generally used for descriptive text, such as form supplementary explanation text, list descriptive text, etc.
*/
colorTextTertiary: string;
/**
* @nameZH
* @desc
* @descEN The fourth level of text color is the lightest text color, such as form input prompt text, disabled color text, etc.
*/
colorTextQuaternary: string;
@ -59,24 +62,28 @@ export interface ColorNeutralMapToken {
/**
* @nameZH
* @desc Slider hover
* @descEN The darkest fill color is used to distinguish between the second and third level of fill color, and is currently only used in the hover effect of Slider.
*/
colorFill: string;
/**
* @nameZH
* @desc RateSkeleton Hover Table
* @descEN The second level of fill color can outline the shape of the element more clearly, such as Rate, Skeleton, etc. It can also be used as the Hover state of the third level of fill color, such as Table, etc.
*/
colorFillSecondary: string;
/**
* @nameZH
* @desc SliderSegmented 使
* @descEN The third level of fill color is used to outline the shape of the element, such as Slider, Segmented, etc. If there is no emphasis requirement, it is recommended to use the third level of fill color as the default fill color.
*/
colorFillTertiary: string;
/**
* @nameZH
* @desc
* @descEN The weakest level of fill color is suitable for color blocks that are not easy to attract attention, such as zebra stripes, color blocks that distinguish boundaries, etc.
*/
colorFillQuaternary: string;
@ -85,6 +92,7 @@ export interface ColorNeutralMapToken {
/**
* @nameZH
* @desc B1 使 token
* @descEN This color is used for the background color of the overall layout of the page. This token will only be used when it is necessary to be at the B1 visual level in the page. Other usages are wrong.
*/
colorBgLayout: string;
@ -98,12 +106,14 @@ export interface ColorNeutralMapToken {
/**
* @nameZH
* @desc token `colorBgContainer`
* @descEN Container background color of the popup layer, in dark mode the color value of this token will be a little brighter than `colorBgContainer`. E.g: modal, pop-up, menu, etc.
*/
colorBgElevated: string;
/**
* @nameZH
* @desc Tooltip
* @descEN This color is used to draw the user's strong attention to the background color, and is currently only used in the background color of Tooltip.
*/
colorBgSpotlight: string;
}

View File

@ -69,6 +69,7 @@ export interface SeedToken extends PresetColorType {
* @nameZH
* @nameEN Font family for default text
* @desc Ant Design 使
* @descEN The font family of Ant Design prioritizes the default interface font of the system, and provides a set of alternative font libraries that are suitable for screen display to maintain the readability and readability of the font under different platforms and browsers, reflecting the friendly, stable and professional characteristics.
*/
fontFamily: string;
@ -76,6 +77,7 @@ export interface SeedToken extends PresetColorType {
* @nameZH
* @nameEN Font family for code text
* @desc Typography codepre kbd
* @descEN Code font, used for code, pre and kbd elements in Typography
*/
fontFamilyCode: string;