Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tag):tag组件对齐vue-next-mobile #355

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/products/tdesign-mobile-react/src/tag/defaultProps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

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

export const tagDefaultProps: TdTagProps = {
closable: false,
disabled: false,
icon: undefined,
shape: 'square',
size: 'medium',
theme: 'default',
variant: 'dark',
};

export const checkTagDefaultProps: TdCheckTagProps = {
closable: false,
disabled: false,
shape: 'square',
size: 'medium',
variant: 'dark',
};
43 changes: 43 additions & 0 deletions packages/products/tdesign-mobile-react/src/tag/tag.en-US.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
:: 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 | - | \- | 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 \| array \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
defaultChecked | Boolean | - | \- | 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
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
43 changes: 43 additions & 0 deletions packages/products/tdesign-mobile-react/src/tag/tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
:: BASE_DOC ::

## API

### Tag Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
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
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
icon | TElement | undefined | 标签中的图标,可自定义图标呈现。TS 类型:`TNode`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | N
maxWidth | String / Number | - | 标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80 | N
shape | String | square | 标签类型,有三种:方形、圆角方形、标记型。可选项:square/round/mark | N
size | String | medium | 标签尺寸。可选项:small/medium/large/extra-large | N
theme | String | default | 组件风格,用于描述组件不同的应用场景。可选项:default/primary/warning/danger/success | N
variant | String | dark | 标签风格变体。可选项:dark/light/outline/light-outline | N
onClick | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>点击时触发 | N
onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>如果关闭按钮存在,点击关闭按钮时触发 | N


### CheckTag Props

名称 | 类型 | 默认值 | 描述 | 必传
-- | -- | -- | -- | --
className | String | - | 类名 | N
style | Object | - | 样式,TS 类型:`React.CSSProperties` | N
checked | Boolean | - | 标签选中的状态,默认风格(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
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
size | String | medium | 标签尺寸。可选项:small/medium/large。TS 类型:`SizeEnum`。[通用类型定义](https://github.com/Tencent/tdesign-mobile-react/blob/develop/src/common.ts) | 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
onClose | Function | | TS 类型:`(context: { e: MouseEvent }) => void`<br/>如果关闭按钮存在,点击关闭按钮时触发 | N
125 changes: 125 additions & 0 deletions packages/products/tdesign-mobile-react/src/tag/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
/* eslint-disable */

/**
* 该文件为脚本自动生成文件,请勿随意修改。如需修改请联系 PMC
* */

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

export interface TdTagProps {
/**
* 组件子元素,同`content`
*/
children?: TNode;
/**
* 标签是否可关闭
* @default false
*/
closable?: boolean;
/**
* 组件子元素
*/
content?: TNode;
/**
* 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态
* @default false
*/
disabled?: boolean;
/**
* 标签中的图标,可自定义图标呈现
*/
icon?: TElement;
/**
* 标签最大宽度,宽度超出后会出现省略号。示例:'50px' / 80
*/
maxWidth?: string | number;
/**
* 标签类型,有三种:方形、圆角方形、标记型
* @default square
*/
shape?: 'square' | 'round' | 'mark';
/**
* 标签尺寸
* @default medium
*/
size?: 'small' | 'medium' | 'large' | 'extra-large';
/**
* 组件风格,用于描述组件不同的应用场景
* @default default
*/
theme?: 'default' | 'primary' | 'warning' | 'danger' | 'success';
/**
* 标签风格变体
* @default dark
*/
variant?: 'dark' | 'light' | 'outline' | 'light-outline';
/**
* 点击时触发
*/
onClick?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
}

export interface TdCheckTagProps {
/**
* 标签选中的状态,默认风格(theme=default)才有选中态
*/
checked?: boolean;
/**
* 组件子元素
*/
children?: TNode;
/**
* 标签是否可关闭
* @default false
*/
closable?: boolean;
/**
* 组件子元素;传入数组时:[选中内容,非选中内容]
*/
content?: TNode;
/**
* 标签选中的状态,默认风格(theme=default)才有选中态。非受控属性
*/
defaultChecked?: boolean;
/**
* 标签禁用态,失效标签不能触发事件。默认风格(theme=default)才有禁用态
* @default false
*/
disabled?: boolean;
/**
* 标签中的图标,可自定义图标呈现
*/
icon?: TElement;
/**
* 标签类型,有三种:方形、圆角方形、标记型。
* @default square
*/
shape?: 'square' | 'round' | 'mark';
/**
* 标签尺寸
* @default medium
*/
size?: SizeEnum;
/**
* 标签风格变体
* @default dark
*/
variant?: 'dark' | 'light' | 'outline' | 'light-outline';
/**
* 状态切换时触发
*/
onChange?: (checked: boolean) => void;
/**
* 点击标签时触发
*/
onClick?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
/**
* 如果关闭按钮存在,点击关闭按钮时触发
*/
onClose?: (context: { e: MouseEvent<HTMLDivElement> }) => void;
}
Loading
Loading