Skip to content

Commit

Permalink
docs: sync api
Browse files Browse the repository at this point in the history
  • Loading branch information
liweijie0812 committed Aug 14, 2024
1 parent 1f1c85e commit a63c281
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/tag/defaultProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TdCheckTagProps, TdTagProps } from './type';
import { TdTagProps, TdCheckTagProps } from './type';

export const tagDefaultProps: TdTagProps = {
closable: false,
Expand All @@ -15,6 +15,7 @@ export const tagDefaultProps: TdTagProps = {
};

export const checkTagDefaultProps: TdCheckTagProps = {
defaultChecked: undefined,
closable: false,
disabled: false,
shape: 'square',
Expand Down
44 changes: 44 additions & 0 deletions src/tag/tag.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
:: BASE_DOC ::

## API

### Tag Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closable | Boolean | false | \- | N
content | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | \- | N
icon | TElement | undefined | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
maxWidth | String / Number | - | \- | N
shape | String | square | options: square/round/mark | N
size | String | medium | options: small/medium/large/extra-large | N
theme | String | default | options: default/primary/warning/danger/success | N
variant | String | dark | options: dark/light/outline/light-outline | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onClose | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N


### CheckTag Props

name | type | default | description | required
-- | -- | -- | -- | --
className | String | - | className of component | N
style | Object | - | CSS(Cascading Style Sheets),Typescript:`React.CSSProperties` | N
checked | Boolean | undefined | \- | N
defaultChecked | Boolean | undefined | uncontrolled property | N
children | TNode | - | Typescript:`string \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closable | Boolean | false | \- | N
content | TNode | - | Typescript:`string \| number \| string[] \| TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | \- | N
icon | TElement | - | Typescript:`TNode`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
shape | String | square | options: square/round/mark | N
size | String | medium | options: small/medium/large。Typescript:`SizeEnum`[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
uncheckedProps | Object | - | used to set unchecked tag props。Typescript:`TdTagProps` | N
variant | String | dark | options: dark/light/outline/light-outline | N
onChange | Function | | Typescript:`(checked: boolean) => void`<br/> | N
onClick | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
onClose | Function | | Typescript:`(context: { e: MouseEvent }) => void`<br/> | N
11 changes: 6 additions & 5 deletions src/tag/tag.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
children | TNode | - | 组件子元素,同`content`。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
children | TNode | - | 组件子元素,同 `content`。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closable | Boolean | false | 标签是否可关闭 | N
content | TNode | - | 组件子元素。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
Expand All @@ -28,15 +28,16 @@ onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
checked | Boolean | - | 标签选中的状态,默认风格(theme=default)才有选中态 | N
checked | Boolean | undefined | 标签选中的状态,默认风格(theme=default)才有选中态 | N
defaultChecked | Boolean | undefined | 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性 | N
children | TNode | - | 组件子元素。TS 类型:`string \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
closable | Boolean | false | 标签是否可关闭 | N
content | TNode | - | 组件子元素;传入数组时:[选中内容,非选中内容]。TS 类型:`string \| number \| array \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
defaultChecked | Boolean | - | 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性 | N
content | TNode | - | 组件子元素;传入数组时:[选中内容,非选中内容]。TS 类型:`string \| number \| string[] \| TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
disabled | Boolean | false | 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态 | N
icon | TElement | - | 标签中的图标,可自定义图标呈现。TS 类型:`TNode`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
uncheckedProps | Object | - | 透传标签未选态属性。TS 类型:`TdTagProps` | N
variant | String | dark | 标签风格变体。可选项:dark/light/outline/light-outline | N
onChange | Function | | TS 类型:`(checked: boolean) => void`<br/>状态切换时触发 | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击标签时触发 | N
Expand Down
28 changes: 16 additions & 12 deletions src/tag/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

import { TNode, TElement, SizeEnum } from '../common';
import { MouseEvent } from 'react';
import { SizeEnum, TElement, TNode } from '../common';

export interface TdTagProps {
/**
* 组件子元素,同`content`
* 组件子元素,同 `content`
*/
children?: TNode;
/**
Expand Down Expand Up @@ -57,18 +57,22 @@ export interface TdTagProps {
/**
* 点击时触发
*/
onClick?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
onClick?: (context: { e: MouseEvent<HTMLSpanElement> }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
onClose?: (context: { e: MouseEvent<SVGSVGElement> }) => void;
}

export interface TdCheckTagProps {
/**
* 标签选中的状态,默认风格(theme=default)才有选中态
*/
checked?: boolean;
/**
* 标签选中的状态,默认风格(theme=default)才有选中态,非受控属性
*/
defaultChecked?: boolean;
/**
* 组件子元素
*/
Expand All @@ -81,11 +85,7 @@ export interface TdCheckTagProps {
/**
* 组件子元素;传入数组时:[选中内容,非选中内容]
*/
content?: TNode;
/**
* 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性
*/
defaultChecked?: boolean;
content?: [] | TNode;
/**
* 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态
* @default false
Expand All @@ -96,7 +96,7 @@ export interface TdCheckTagProps {
*/
icon?: TElement;
/**
* 标签类型,有三种:方形、圆角方形、标记型
* 标签类型,有三种:方形、圆角方形、标记型
* @default square
*/
shape?: 'square' | 'round' | 'mark';
Expand All @@ -105,6 +105,10 @@ export interface TdCheckTagProps {
* @default medium
*/
size?: SizeEnum;
/**
* 透传标签未选态属性
*/
uncheckedProps?: TdTagProps;
/**
* 标签风格变体
* @default dark
Expand All @@ -117,9 +121,9 @@ export interface TdCheckTagProps {
/**
* 点击标签时触发
*/
onClick?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
onClick?: (context: { e: MouseEvent<HTMLSpanElement> }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
onClose?: (context: { e: MouseEvent<HTMLSpanElement> }) => void;
}

0 comments on commit a63c281

Please sign in to comment.