Skip to content

Commit 932fe88

Browse files
committed
feat(icon): add tdesign-icons-web-components 🎉
增加icon组件 re TDesignOteam#73
1 parent 37e64f0 commit 932fe88

File tree

13 files changed

+110
-13
lines changed

13 files changed

+110
-13
lines changed

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"omi": "7.6.7",
6767
"omi-transition": "^0.1.8",
6868
"tailwind-merge": "^2.2.1",
69-
"tdesign-icons-web-components": "^0.0.1-alpha.1"
69+
"tdesign-icons-web-components": "^0.0.1-alpha.3"
7070
},
7171
"devDependencies": {
7272
"@babel/core": "^7.24.7",

site/sidebar.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default [
4747
component: () => import('tdesign-web-components/button/README.md'),
4848
},
4949
{
50-
title: 'Icon 图表',
50+
title: 'Icon 图标',
5151
name: 'icon',
5252
path: '/components/icon',
5353
component: () => import('tdesign-web-components/icon/README.md'),

src/button/_example/base.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@ import 'tdesign-web-components/space';
44
import { Component } from 'omi';
55

66
export default class Button extends Component {
7+
btnClick = () => {
8+
console.log('btn click');
9+
};
10+
711
render() {
812
return (
913
<t-space>
10-
<t-button theme="default" variant="base">
14+
<t-button theme="default" variant="base" onClick={this.btnClick}>
1115
填充按钮
1216
</t-button>
1317
<t-button theme="default" variant="outline">

src/button/button.tsx

+18
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,24 @@ export interface ButtonProps extends TdButtonProps, StyledProps {}
1313
export default class Button extends Component<ButtonProps> {
1414
static css = [];
1515

16+
static propTypes = {
17+
theme: String,
18+
type: String,
19+
variant: String,
20+
size: String,
21+
shape: String,
22+
icon: Object,
23+
loading: Boolean,
24+
ghost: Boolean,
25+
block: Boolean,
26+
disabled: Boolean,
27+
href: String,
28+
tag: String,
29+
content: [String, Object],
30+
onClick: Function,
31+
ignoreAttributes: Array,
32+
};
33+
1634
static defaultProps = {
1735
tag: 'button',
1836
variant: 'base',

src/common/fake-arrow.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ export interface FakeArrowProps {
1818
export default class FakeArrow extends Component<FakeArrowProps> {
1919
componentName = `${classPrefix}-fake-arrow`;
2020

21+
static propTypes = {
22+
isActive: Boolean,
23+
disabled: Boolean,
24+
};
25+
2126
static css = `
22-
.t-fake-arrow.t-is-disabled {
27+
.${classPrefix}-fake-arrow.${classPrefix}-is-disabled {
2328
cursor: not-allowed;
2429
color: var(--td-text-color-disabled, var(--td-font-gray-4));
2530
}

src/common/portal.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export function getAttach(attach: PortalProps['attach'], triggerNode?: HTMLEleme
4040
export default class Portal extends Component<PortalProps> {
4141
static css = [];
4242

43+
static propTypes = {
44+
attach: [Object, Function, String, Boolean],
45+
triggerNode: Object,
46+
};
47+
4348
static defaultProps = {
4449
attach: false,
4550
};

src/icon/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ spline: base
3232
您也可以以 IconFont 的形式使用图标,通过如下来使用图标。
3333

3434
```js
35-
import 'tdesign-icons-web-components/esm/iconfont/index.css';// 极少的字体定义代码`
35+
import 'tdesign-icons-web-components/esm/iconfont/index.css';// 极少的字体定义代码
3636

3737
import 'tdesign-icons-web-components/esm/iconfont';
3838
```

src/loading/loading.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ const loadingDefaultProps: TdLoadingProps = {
2525
export default class Loading extends Component<LoadingProps> {
2626
static defaultProps = loadingDefaultProps;
2727

28+
static propTypes = {
29+
delay: Number,
30+
fullscreen: Boolean,
31+
indicator: Object,
32+
inheritColor: Boolean,
33+
loading: Boolean,
34+
preventScrollThrough: Boolean,
35+
showOverlay: Boolean,
36+
size: String,
37+
zIndex: Number,
38+
};
39+
2840
showLoading = false;
2941

3042
showLoadingFlag = false;

src/menu/_example/closable-side.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'tdesign-web-components/button';
2-
import 'tdesign-web-components/icon';
2+
import 'tdesign-icons-web-components';
33
import 'tdesign-web-components/menu';
44

55
import { Component, signal } from 'omi';

src/popup/popup.tsx

+30
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,34 @@ export interface PopupProps extends TdPopupProps, StyledProps {
1515
updateScrollTop?: (content: HTMLElement) => void;
1616
}
1717

18+
export const PopupTypes = {
19+
attach: [String, Function],
20+
content: [String, Number, Object, Function],
21+
delay: [Number, Array],
22+
destroyOnClose: Boolean,
23+
disabled: Boolean,
24+
hideEmptyPopup: Boolean,
25+
overlayClassName: String,
26+
overlayInnerClassName: String,
27+
overlayInnerStyle: [Object, Function],
28+
overlayStyle: [Object, Function],
29+
arrowStyle: [Object, Function],
30+
placement: String,
31+
popperOptions: Object,
32+
showArrow: Boolean,
33+
trigger: String,
34+
triggerElement: [String, Number, Object, Function],
35+
visible: Boolean,
36+
defaultVisible: Boolean,
37+
zIndex: Number,
38+
onScroll: Function,
39+
onScrollToBottom: Function,
40+
onVisibleChange: Function,
41+
strategy: String,
42+
expandAnimation: Boolean,
43+
updateScrollTop: Function,
44+
};
45+
1846
@tag('t-popup')
1947
export default class Popup extends Component<PopupProps> {
2048
static css = `
@@ -26,6 +54,8 @@ export default class Popup extends Component<PopupProps> {
2654
}
2755
`;
2856

57+
static propTypes = PopupTypes;
58+
2959
static defaultProps = {
3060
attach: 'body',
3161
destroyOnClose: false,

src/switch/switch.tsx

+11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ export interface SwitchProps<T extends SwitchValue = SwitchValue> extends TdSwit
1414

1515
@tag('t-switch')
1616
export default class Switch extends Component<SwitchProps> {
17+
static propTypes = {
18+
value: [String, Number, Boolean],
19+
defaultValue: [String, Number, Boolean],
20+
label: [Array, Function],
21+
disabled: Boolean,
22+
loading: Boolean,
23+
size: String,
24+
customValue: Array,
25+
onChange: Function,
26+
};
27+
1728
constructor() {
1829
super();
1930
this.props = {

src/tooltip/tooltip.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Component, createRef, OmiProps, tag } from 'omi';
44

55
import classname, { getClassPrefix } from '../_util/classname';
66
import { type PopupVisibleChangeContext } from '../popup';
7+
import { PopupTypes } from '../popup/popup';
78
import { TdTooltipProps } from './type';
89

910
export type TooltipProps = TdTooltipProps;
@@ -20,6 +21,17 @@ export const tooltipDefaultProps: TooltipProps = {
2021
export default class Tooltip extends Component<TooltipProps> {
2122
static defaultProps = tooltipDefaultProps;
2223

24+
static propTypes = {
25+
...PopupTypes,
26+
delay: Number,
27+
destroyOnClose: Boolean,
28+
duration: Number,
29+
placement: String,
30+
showArrow: Boolean,
31+
theme: String,
32+
ignoreAttributes: Array,
33+
};
34+
2335
popupRef = createRef();
2436

2537
timerRef = createRef();

0 commit comments

Comments
 (0)