@douyinfe/semi-ui 2.16.0-beta.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/avatar/__test__/avatar.test.js +3 -3
- package/dist/css/semi.css +33 -12
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +39 -175
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/typography/base.js +3 -15
- package/lib/cjs/typography/text.js +1 -11
- package/lib/es/typography/base.js +3 -15
- package/lib/es/typography/text.js +1 -10
- package/package.json +11 -11
- package/select/_story/select.stories.tsx +1 -1
- package/typography/_story/typography.stories.js +3 -15
- package/typography/base.tsx +4 -9
- package/typography/text.tsx +1 -9
|
@@ -89,18 +89,12 @@ const wrapperDecorations = (props, content) => {
|
|
|
89
89
|
underline,
|
|
90
90
|
strong,
|
|
91
91
|
link,
|
|
92
|
-
disabled
|
|
93
|
-
icon
|
|
92
|
+
disabled
|
|
94
93
|
} = props;
|
|
95
94
|
let wrapped = content;
|
|
96
95
|
|
|
97
96
|
const wrap = (isNeeded, tag) => {
|
|
98
|
-
let wrapProps =
|
|
99
|
-
style: {
|
|
100
|
-
display: 'inline-flex',
|
|
101
|
-
alignItems: 'center'
|
|
102
|
-
}
|
|
103
|
-
} : {};
|
|
97
|
+
let wrapProps = {};
|
|
104
98
|
|
|
105
99
|
if (!isNeeded) {
|
|
106
100
|
return;
|
|
@@ -118,13 +112,7 @@ const wrapperDecorations = (props, content) => {
|
|
|
118
112
|
wrap(underline && !link, 'u');
|
|
119
113
|
wrap(strong, 'strong');
|
|
120
114
|
wrap(props.delete, 'del');
|
|
121
|
-
wrap(link, disabled ? 'span' : 'a');
|
|
122
|
-
// use span to wrap the content, so that the content in the span is vertically aligned
|
|
123
|
-
|
|
124
|
-
if (wrapped === content && icon) {
|
|
125
|
-
wrap(true, 'span');
|
|
126
|
-
}
|
|
127
|
-
|
|
115
|
+
wrap(link, disabled ? 'span' : 'a');
|
|
128
116
|
return wrapped;
|
|
129
117
|
};
|
|
130
118
|
|
|
@@ -24,25 +24,15 @@ var _constants = require("@douyinfe/semi-foundation/lib/cjs/typography/constants
|
|
|
24
24
|
|
|
25
25
|
var _base = _interopRequireDefault(require("./base"));
|
|
26
26
|
|
|
27
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
28
|
-
|
|
29
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
30
28
|
|
|
31
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
30
|
|
|
33
|
-
const prefixCls = _constants.cssClasses.PREFIX;
|
|
34
|
-
|
|
35
31
|
class Text extends _react.PureComponent {
|
|
36
32
|
render() {
|
|
37
|
-
const className = (0, _classnames.default)(this.props.className, {
|
|
38
|
-
["".concat(prefixCls, "-text")]: true,
|
|
39
|
-
["".concat(prefixCls, "-text-icon")]: this.props.icon
|
|
40
|
-
});
|
|
41
33
|
return /*#__PURE__*/_react.default.createElement(_base.default, (0, _assign.default)({
|
|
42
34
|
component: 'span'
|
|
43
|
-
}, this.props
|
|
44
|
-
className: className
|
|
45
|
-
}));
|
|
35
|
+
}, this.props));
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
}
|
|
@@ -45,18 +45,12 @@ const wrapperDecorations = (props, content) => {
|
|
|
45
45
|
underline,
|
|
46
46
|
strong,
|
|
47
47
|
link,
|
|
48
|
-
disabled
|
|
49
|
-
icon
|
|
48
|
+
disabled
|
|
50
49
|
} = props;
|
|
51
50
|
let wrapped = content;
|
|
52
51
|
|
|
53
52
|
const wrap = (isNeeded, tag) => {
|
|
54
|
-
let wrapProps =
|
|
55
|
-
style: {
|
|
56
|
-
display: 'inline-flex',
|
|
57
|
-
alignItems: 'center'
|
|
58
|
-
}
|
|
59
|
-
} : {};
|
|
53
|
+
let wrapProps = {};
|
|
60
54
|
|
|
61
55
|
if (!isNeeded) {
|
|
62
56
|
return;
|
|
@@ -74,13 +68,7 @@ const wrapperDecorations = (props, content) => {
|
|
|
74
68
|
wrap(underline && !link, 'u');
|
|
75
69
|
wrap(strong, 'strong');
|
|
76
70
|
wrap(props.delete, 'del');
|
|
77
|
-
wrap(link, disabled ? 'span' : 'a');
|
|
78
|
-
// use span to wrap the content, so that the content in the span is vertically aligned
|
|
79
|
-
|
|
80
|
-
if (wrapped === content && icon) {
|
|
81
|
-
wrap(true, 'span');
|
|
82
|
-
}
|
|
83
|
-
|
|
71
|
+
wrap(link, disabled ? 'span' : 'a');
|
|
84
72
|
return wrapped;
|
|
85
73
|
};
|
|
86
74
|
|
|
@@ -3,20 +3,11 @@ import React, { PureComponent } from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { strings } from '@douyinfe/semi-foundation/lib/es/typography/constants';
|
|
5
5
|
import Base from './base';
|
|
6
|
-
import cls from 'classnames';
|
|
7
|
-
import { cssClasses } from '@douyinfe/semi-foundation/lib/es/typography/constants';
|
|
8
|
-
const prefixCls = cssClasses.PREFIX;
|
|
9
6
|
export default class Text extends PureComponent {
|
|
10
7
|
render() {
|
|
11
|
-
const className = cls(this.props.className, {
|
|
12
|
-
["".concat(prefixCls, "-text")]: true,
|
|
13
|
-
["".concat(prefixCls, "-text-icon")]: this.props.icon
|
|
14
|
-
});
|
|
15
8
|
return /*#__PURE__*/React.createElement(Base, _Object$assign({
|
|
16
9
|
component: 'span'
|
|
17
|
-
}, this.props
|
|
18
|
-
className: className
|
|
19
|
-
}));
|
|
10
|
+
}, this.props));
|
|
20
11
|
}
|
|
21
12
|
|
|
22
13
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.16.0
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
17
|
"@douyinfe/semi-animation": "2.12.0",
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.16.0
|
|
19
|
-
"@douyinfe/semi-foundation": "2.16.0
|
|
20
|
-
"@douyinfe/semi-icons": "2.16.0
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.16.0",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.16.0",
|
|
20
|
+
"@douyinfe/semi-icons": "2.16.0",
|
|
21
21
|
"@douyinfe/semi-illustrations": "2.15.0",
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.16.0
|
|
23
|
-
"@types/react-window": "^1.8.2",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.16.0",
|
|
24
23
|
"async-validator": "^3.5.0",
|
|
25
24
|
"classnames": "^2.2.6",
|
|
26
25
|
"copy-text-to-clipboard": "^2.1.1",
|
|
27
26
|
"date-fns": "^2.9.0",
|
|
28
27
|
"date-fns-tz": "^1.0.10",
|
|
29
28
|
"lodash": "^4.17.21",
|
|
29
|
+
"prop-types": "^15.7.2",
|
|
30
30
|
"react-resizable": "^1.8.0",
|
|
31
31
|
"react-sortable-hoc": "^2.0.0",
|
|
32
32
|
"react-window": "^1.8.2",
|
|
@@ -35,9 +35,6 @@
|
|
|
35
35
|
"utility-types": "^3.10.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@types/react": ">=16.0.0",
|
|
39
|
-
"@types/react-dom": ">=16.0.0",
|
|
40
|
-
"prop-types": "15.7.2",
|
|
41
38
|
"react": ">=16.0.0",
|
|
42
39
|
"react-dom": ">=16.0.0"
|
|
43
40
|
},
|
|
@@ -69,15 +66,18 @@
|
|
|
69
66
|
],
|
|
70
67
|
"author": "",
|
|
71
68
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "71f3e6a9ae6f7794c993617dd3d94f565539ac49",
|
|
73
70
|
"devDependencies": {
|
|
74
71
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
72
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
76
73
|
"@babel/preset-env": "^7.15.8",
|
|
77
74
|
"@babel/preset-react": "^7.14.5",
|
|
78
|
-
"@douyinfe/semi-scss-compile": "2.16.0
|
|
75
|
+
"@douyinfe/semi-scss-compile": "2.16.0",
|
|
79
76
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
77
|
"@types/lodash": "^4.14.176",
|
|
78
|
+
"@types/react": ">=16.0.0",
|
|
79
|
+
"@types/react-dom": ">=16.0.0",
|
|
80
|
+
"@types/react-window": "^1.8.2",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
|
82
82
|
"babel-plugin-lodash": "^3.3.4",
|
|
83
83
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
@@ -81,7 +81,7 @@ function CustomRender(props) {
|
|
|
81
81
|
name: '夏可漫',
|
|
82
82
|
email: 'xiakeman@example.com',
|
|
83
83
|
avatar:
|
|
84
|
-
'https://
|
|
84
|
+
'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/root-web-sites/dy.png',
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
name: '申悦',
|
|
@@ -3,7 +3,7 @@ import withPropsCombinations from 'react-storybook-addon-props-combinations';
|
|
|
3
3
|
|
|
4
4
|
import Icon from '../../icons';
|
|
5
5
|
import Typography from '../index';
|
|
6
|
-
import { IconLink, IconTick
|
|
6
|
+
import { IconLink, IconTick } from '@douyinfe/semi-icons';
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
9
|
title: 'Typography'
|
|
@@ -51,22 +51,10 @@ export const _Text = () => (
|
|
|
51
51
|
<br />
|
|
52
52
|
<Text link={{ href: 'https://semi.design/' }}>打开网站</Text>
|
|
53
53
|
<br />
|
|
54
|
-
{/* 用户未通过icon API设置icon,而是通过children传入,则需要手动处理内容的对齐 */}
|
|
55
54
|
<Text link>
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
网页链接
|
|
59
|
-
</span>
|
|
55
|
+
<IconLink />
|
|
56
|
+
网页链接
|
|
60
57
|
</Text>
|
|
61
|
-
<br />
|
|
62
|
-
<Text link icon={<IconLink />} underline>带下划线的网页链接</Text>
|
|
63
|
-
<br />
|
|
64
|
-
<Text icon={<IconLink />} underline>带下划线的内容</Text>
|
|
65
|
-
<br />
|
|
66
|
-
<Text icon={<IconPlusCircle />} style={{ color: 'purple'}}>添加条件</Text>
|
|
67
|
-
<br />
|
|
68
|
-
<Text icon={<IconPlusCircle />} style={{ color: 'purple'}} size={'small'}>添加条件</Text>
|
|
69
|
-
<br />
|
|
70
58
|
</div>
|
|
71
59
|
);
|
|
72
60
|
|
package/typography/base.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Component
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
2
|
import ReactDOM from 'react-dom';
|
|
3
3
|
import cls from 'classnames';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -54,15 +54,15 @@ const prefixCls = cssClasses.PREFIX;
|
|
|
54
54
|
const ELLIPSIS_STR = '...';
|
|
55
55
|
|
|
56
56
|
const wrapperDecorations = (props: BaseTypographyProps, content: React.ReactNode) => {
|
|
57
|
-
const { mark, code, underline, strong, link, disabled
|
|
57
|
+
const { mark, code, underline, strong, link, disabled } = props;
|
|
58
58
|
let wrapped = content;
|
|
59
59
|
const wrap = (isNeeded: boolean | LinkType, tag: string) => {
|
|
60
|
-
let wrapProps =
|
|
60
|
+
let wrapProps = {};
|
|
61
61
|
if (!isNeeded) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
if (typeof isNeeded === 'object') {
|
|
65
|
-
wrapProps = { ...isNeeded }
|
|
65
|
+
wrapProps = { ...isNeeded };
|
|
66
66
|
}
|
|
67
67
|
wrapped = React.createElement(tag, wrapProps, wrapped);
|
|
68
68
|
};
|
|
@@ -72,11 +72,6 @@ const wrapperDecorations = (props: BaseTypographyProps, content: React.ReactNode
|
|
|
72
72
|
wrap(strong, 'strong');
|
|
73
73
|
wrap(props.delete, 'del');
|
|
74
74
|
wrap(link, disabled ? 'span' : 'a');
|
|
75
|
-
// When the content is not wrapped, and there is more than one element in the content (one of which is an icon),
|
|
76
|
-
// use span to wrap the content, so that the content in the span is vertically aligned
|
|
77
|
-
if (wrapped === content && icon) {
|
|
78
|
-
wrap(true, 'span');
|
|
79
|
-
}
|
|
80
75
|
return wrapped;
|
|
81
76
|
};
|
|
82
77
|
|
package/typography/text.tsx
CHANGED
|
@@ -4,13 +4,9 @@ import { strings } from '@douyinfe/semi-foundation/typography/constants';
|
|
|
4
4
|
import Base from './base';
|
|
5
5
|
import { Ellipsis, TypographyBaseSize, TypographyBaseType, OmitTypographyProps } from './interface';
|
|
6
6
|
import { CopyableConfig, LinkType } from './title';
|
|
7
|
-
import cls from 'classnames';
|
|
8
|
-
import { cssClasses } from '@douyinfe/semi-foundation/typography/constants';
|
|
9
7
|
|
|
10
8
|
type OmitTextProps = OmitTypographyProps;
|
|
11
9
|
|
|
12
|
-
const prefixCls = cssClasses.PREFIX;
|
|
13
|
-
|
|
14
10
|
export interface TextProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, OmitTextProps> {
|
|
15
11
|
children?: React.ReactNode;
|
|
16
12
|
className?: string;
|
|
@@ -67,10 +63,6 @@ export default class Text extends PureComponent<TextProps> {
|
|
|
67
63
|
};
|
|
68
64
|
|
|
69
65
|
render() {
|
|
70
|
-
|
|
71
|
-
[`${prefixCls}-text`]: true,
|
|
72
|
-
[`${prefixCls}-text-icon`]: this.props.icon,
|
|
73
|
-
});
|
|
74
|
-
return <Base component={'span'} {...this.props} className={className} />;
|
|
66
|
+
return <Base component={'span'} {...this.props} />;
|
|
75
67
|
}
|
|
76
68
|
}
|