@douyinfe/semi-ui 2.4.1 → 2.5.1
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/button/index.tsx +1 -1
- package/cascader/__test__/cascader.test.js +24 -0
- package/cascader/_story/cascader.stories.js +73 -0
- package/cascader/index.tsx +5 -2
- package/datePicker/_story/v2/FixInputRangeFocus.jsx +25 -0
- package/datePicker/_story/v2/index.js +2 -1
- package/datePicker/datePicker.tsx +3 -0
- package/dist/css/semi.css +56 -29
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +523 -227
- 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/form/__test__/formApi.test.js +182 -0
- package/form/_story/FormApi/arrayDemo.jsx +4 -7
- package/form/_story/Layout/slotDemo.jsx +2 -2
- package/form/_story/demo.jsx +18 -1
- package/form/_story/form.stories.js +6 -6
- package/form/baseForm.tsx +2 -2
- package/lib/cjs/autoComplete/index.d.ts +1 -1
- package/lib/cjs/button/Button.d.ts +4 -4
- package/lib/cjs/button/buttonGroup.d.ts +2 -2
- package/lib/cjs/button/index.d.ts +5 -6
- package/lib/cjs/cascader/index.js +6 -0
- package/lib/cjs/datePicker/datePicker.js +4 -0
- package/lib/cjs/dropdown/index.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/baseForm.js +2 -2
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/iconButton/index.d.ts +2 -2
- package/lib/cjs/select/index.d.ts +3 -3
- package/lib/cjs/select/index.js +32 -28
- package/lib/cjs/select/option.js +2 -2
- package/lib/cjs/select/virtualRow.js +2 -2
- package/lib/cjs/table/Table.d.ts +1 -1
- package/lib/cjs/table/Table.js +8 -2
- package/lib/cjs/table/interface.d.ts +1 -0
- package/lib/cjs/tabs/interface.d.ts +1 -1
- package/lib/cjs/tooltip/index.d.ts +1 -1
- package/lib/cjs/tooltip/index.js +12 -4
- package/lib/cjs/tree/index.d.ts +2 -0
- package/lib/cjs/tree/index.js +15 -8
- package/lib/cjs/treeSelect/index.d.ts +2 -0
- package/lib/cjs/treeSelect/index.js +64 -27
- package/lib/cjs/upload/fileCard.js +31 -22
- package/lib/cjs/upload/index.d.ts +6 -0
- package/lib/cjs/upload/index.js +15 -8
- package/lib/cjs/upload/interface.d.ts +8 -6
- package/lib/es/autoComplete/index.d.ts +1 -1
- package/lib/es/button/Button.d.ts +4 -4
- package/lib/es/button/buttonGroup.d.ts +2 -2
- package/lib/es/button/index.d.ts +5 -6
- package/lib/es/cascader/index.js +5 -0
- package/lib/es/datePicker/datePicker.js +4 -0
- package/lib/es/dropdown/index.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/baseForm.js +2 -2
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/iconButton/index.d.ts +2 -2
- package/lib/es/select/index.d.ts +3 -3
- package/lib/es/select/index.js +30 -26
- package/lib/es/select/option.js +2 -2
- package/lib/es/select/virtualRow.js +2 -2
- package/lib/es/table/Table.d.ts +1 -1
- package/lib/es/table/Table.js +10 -2
- package/lib/es/table/interface.d.ts +1 -0
- package/lib/es/tabs/interface.d.ts +1 -1
- package/lib/es/tooltip/index.d.ts +1 -1
- package/lib/es/tooltip/index.js +12 -4
- package/lib/es/tree/index.d.ts +2 -0
- package/lib/es/tree/index.js +15 -8
- package/lib/es/treeSelect/index.d.ts +2 -0
- package/lib/es/treeSelect/index.js +64 -27
- package/lib/es/upload/fileCard.js +31 -24
- package/lib/es/upload/index.d.ts +6 -0
- package/lib/es/upload/index.js +14 -8
- package/lib/es/upload/interface.d.ts +8 -6
- package/package.json +9 -9
- package/select/index.tsx +18 -19
- package/select/option.tsx +2 -2
- package/select/virtualRow.tsx +2 -2
- package/table/Table.tsx +7 -2
- package/table/_story/Perf/Virtualized/index.jsx +6 -0
- package/table/_story/table.stories.js +1 -2
- package/table/_story/v2/FixedHeaderMerge/index.jsx +98 -0
- package/table/_story/v2/FixedResizable/index.jsx +114 -0
- package/table/_story/v2/defaultFilteredValue.tsx +114 -0
- package/table/_story/v2/index.js +5 -0
- package/table/interface.ts +1 -0
- package/tabs/interface.ts +1 -1
- package/tooltip/__test__/tooltip.test.js +48 -4
- package/tooltip/_story/tooltip.stories.js +718 -559
- package/tooltip/index.tsx +6 -6
- package/tree/__test__/treeMultiple.test.js +94 -0
- package/tree/_story/tree.stories.js +169 -0
- package/tree/index.tsx +12 -5
- package/treeSelect/__test__/treeMultiple.test.js +94 -0
- package/treeSelect/_story/treeSelect.stories.js +242 -0
- package/treeSelect/index.tsx +72 -40
- package/upload/_story/upload.stories.js +22 -6
- package/upload/fileCard.tsx +23 -23
- package/upload/index.tsx +15 -6
- package/upload/interface.ts +7 -5
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import React, { useState, useMemo } from 'react';
|
|
2
2
|
import Tooltip from '../index';
|
|
3
3
|
import './story.scss';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Tag,
|
|
6
|
+
Icon,
|
|
7
|
+
IconButton,
|
|
8
|
+
Switch,
|
|
9
|
+
Checkbox,
|
|
10
|
+
Radio,
|
|
11
|
+
Button,
|
|
12
|
+
Select,
|
|
13
|
+
InputNumber,
|
|
14
|
+
Space,
|
|
15
|
+
Popover,
|
|
16
|
+
Input,
|
|
17
|
+
} from '@douyinfe/semi-ui';
|
|
5
18
|
|
|
6
19
|
import InTableDemo from './InTable';
|
|
7
20
|
import EdgeDemo from './Edge';
|
|
@@ -13,185 +26,185 @@ import ContainerPosition from './ContainerPosition';
|
|
|
13
26
|
import { IconList, IconSidebar, IconEdit } from '@douyinfe/semi-icons';
|
|
14
27
|
|
|
15
28
|
export default {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
title: 'Tooltip',
|
|
30
|
+
parameters: {
|
|
31
|
+
chromatic: { disableSnapshot: true },
|
|
32
|
+
},
|
|
20
33
|
};
|
|
21
34
|
|
|
22
35
|
function test(visible) {
|
|
23
|
-
|
|
36
|
+
console.log('visible Change:' + visible);
|
|
24
37
|
}
|
|
25
38
|
|
|
26
39
|
const ScrollDemo = function ScrollDemo(props = {}) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
40
|
+
const tops = [
|
|
41
|
+
['topLeft', 'TL'],
|
|
42
|
+
['top', 'Top'],
|
|
43
|
+
['topRight', 'TR'],
|
|
44
|
+
];
|
|
45
|
+
const lefts = [
|
|
46
|
+
['leftTop', 'LT'],
|
|
47
|
+
['left', 'Left'],
|
|
48
|
+
['leftBottom', 'LB'],
|
|
49
|
+
];
|
|
50
|
+
const rights = [
|
|
51
|
+
['rightTop', 'RT'],
|
|
52
|
+
['right', 'Right'],
|
|
53
|
+
['rightBottom', 'RB'],
|
|
54
|
+
];
|
|
55
|
+
const bottoms = [
|
|
56
|
+
['bottomLeft', 'BL'],
|
|
57
|
+
['bottom', 'Bottom'],
|
|
58
|
+
['bottomRight', 'BR'],
|
|
59
|
+
];
|
|
60
|
+
const { tagStyle, ...restProps } = props;
|
|
61
|
+
return (
|
|
62
|
+
<div
|
|
63
|
+
style={{
|
|
64
|
+
paddingLeft: 40,
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
style={{
|
|
69
|
+
marginLeft: 40,
|
|
70
|
+
whiteSpace: 'nowrap',
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{tops.map((pos, index) => (
|
|
74
|
+
<Tooltip
|
|
75
|
+
content={
|
|
76
|
+
<article>
|
|
77
|
+
<p>hi bytedance</p>
|
|
78
|
+
<p>hi bytedance</p>
|
|
79
|
+
</article>
|
|
80
|
+
}
|
|
81
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
82
|
+
key={index}
|
|
83
|
+
trigger={'click'}
|
|
84
|
+
{...restProps}
|
|
85
|
+
>
|
|
86
|
+
<Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
87
|
+
</Tooltip>
|
|
88
|
+
))}
|
|
89
|
+
</div>
|
|
90
|
+
<div
|
|
91
|
+
style={{
|
|
92
|
+
width: 40,
|
|
93
|
+
float: 'left',
|
|
94
|
+
}}
|
|
95
|
+
>
|
|
96
|
+
{lefts.map((pos, index) => (
|
|
97
|
+
<Tooltip
|
|
98
|
+
content={
|
|
99
|
+
<article>
|
|
100
|
+
<p>hi bytedance</p>
|
|
101
|
+
<p>hi bytedance</p>
|
|
102
|
+
</article>
|
|
103
|
+
}
|
|
104
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
105
|
+
key={index}
|
|
106
|
+
trigger={'click'}
|
|
107
|
+
{...restProps}
|
|
108
|
+
>
|
|
109
|
+
<Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
110
|
+
</Tooltip>
|
|
111
|
+
))}
|
|
112
|
+
</div>
|
|
113
|
+
<div
|
|
114
|
+
style={{
|
|
115
|
+
width: 40,
|
|
116
|
+
marginLeft: 180,
|
|
117
|
+
}}
|
|
118
|
+
>
|
|
119
|
+
{rights.map((pos, index) => (
|
|
120
|
+
<Tooltip
|
|
121
|
+
content={
|
|
122
|
+
<article>
|
|
123
|
+
<p>hi bytedance</p>
|
|
124
|
+
<p>hi bytedance</p>
|
|
125
|
+
</article>
|
|
126
|
+
}
|
|
127
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
128
|
+
key={index}
|
|
129
|
+
trigger={'click'}
|
|
130
|
+
{...restProps}
|
|
131
|
+
>
|
|
132
|
+
<Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
133
|
+
</Tooltip>
|
|
134
|
+
))}
|
|
135
|
+
</div>
|
|
136
|
+
<div
|
|
137
|
+
style={{
|
|
138
|
+
marginLeft: 40,
|
|
139
|
+
clear: 'both',
|
|
140
|
+
whiteSpace: 'nowrap',
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{bottoms.map((pos, index) => (
|
|
144
|
+
<Tooltip
|
|
145
|
+
content={
|
|
146
|
+
<article>
|
|
147
|
+
<p>hi bytedance</p>
|
|
148
|
+
<p>hi bytedance</p>
|
|
149
|
+
</article>
|
|
150
|
+
}
|
|
151
|
+
position={Array.isArray(pos) ? pos[0] : pos}
|
|
152
|
+
key={index}
|
|
153
|
+
trigger={'click'}
|
|
154
|
+
{...restProps}
|
|
155
|
+
>
|
|
156
|
+
<Tag style={tagStyle}>{Array.isArray(pos) ? pos[1] : pos}</Tag>
|
|
157
|
+
</Tooltip>
|
|
158
|
+
))}
|
|
159
|
+
</div>
|
|
160
|
+
</div>
|
|
161
|
+
);
|
|
149
162
|
};
|
|
150
163
|
|
|
151
164
|
export const TooltipOnVisibleChange = () => {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
165
|
+
const [visible, setVisible] = useState(true);
|
|
166
|
+
return (
|
|
167
|
+
<div className="demo">
|
|
168
|
+
<div>
|
|
169
|
+
<label>受控</label>
|
|
170
|
+
<Tooltip
|
|
171
|
+
content={
|
|
172
|
+
<article>
|
|
173
|
+
<p>hi bytedance</p>
|
|
174
|
+
<p>hi bytedance</p>
|
|
175
|
+
</article>
|
|
176
|
+
}
|
|
177
|
+
position="top"
|
|
178
|
+
onVisibleChange={setVisible}
|
|
179
|
+
trigger="click"
|
|
180
|
+
visible={visible}
|
|
181
|
+
>
|
|
182
|
+
<Tag>demo</Tag>
|
|
183
|
+
</Tooltip>
|
|
184
|
+
</div>
|
|
185
|
+
|
|
186
|
+
<br />
|
|
187
|
+
<br />
|
|
188
|
+
<div>
|
|
189
|
+
<label>非受控</label>
|
|
190
|
+
<Tooltip
|
|
191
|
+
content={
|
|
192
|
+
<article>
|
|
193
|
+
<p>hi bytedance</p>
|
|
194
|
+
<p>hi bytedance</p>
|
|
195
|
+
</article>
|
|
196
|
+
}
|
|
197
|
+
position="leftTop"
|
|
198
|
+
onVisibleChange={test}
|
|
199
|
+
trigger="click"
|
|
200
|
+
>
|
|
201
|
+
<Tag>demo</Tag>
|
|
202
|
+
</Tooltip>
|
|
203
|
+
</div>
|
|
204
|
+
<br />
|
|
205
|
+
<br />
|
|
206
|
+
|
|
207
|
+
{/* <Tooltip
|
|
195
208
|
content={
|
|
196
209
|
<article>
|
|
197
210
|
<p>hi bytedance</p>
|
|
@@ -235,504 +248,650 @@ export const TooltipOnVisibleChange = () => {
|
|
|
235
248
|
>
|
|
236
249
|
<Tag>click</Tag>
|
|
237
250
|
</Tooltip> */}
|
|
238
|
-
|
|
239
|
-
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
240
253
|
};
|
|
241
254
|
|
|
242
255
|
TooltipOnVisibleChange.story = {
|
|
243
|
-
|
|
256
|
+
name: 'tooltip onVisibleChange',
|
|
244
257
|
};
|
|
245
258
|
|
|
246
259
|
export const GetPopupContainerDemo = () => (
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
</div>
|
|
260
|
+
<div className="demo">
|
|
261
|
+
<div className="content-layer" />
|
|
262
|
+
<Tooltip
|
|
263
|
+
content={
|
|
264
|
+
<article>
|
|
265
|
+
<p>hi bytedance</p> <p>hi bytedance</p>
|
|
266
|
+
</article>
|
|
267
|
+
}
|
|
268
|
+
position="bottom"
|
|
269
|
+
visible
|
|
270
|
+
trigger="custom"
|
|
271
|
+
getPopupContainer={() => document.querySelector('.content-layer')}
|
|
272
|
+
>
|
|
273
|
+
<Tag>指定弹出层的容器</Tag>
|
|
274
|
+
{/* <div className='content'></div> */}
|
|
275
|
+
</Tooltip>
|
|
276
|
+
<div>
|
|
277
|
+
<label>给定容器为window,看是否报错</label>
|
|
278
|
+
<Tooltip content={'单选'} position="top" getPopupContainer={() => window}>
|
|
279
|
+
<Radio style={{ display: 'inline-flex' }}>单选</Radio>
|
|
280
|
+
</Tooltip>
|
|
269
281
|
</div>
|
|
282
|
+
</div>
|
|
270
283
|
);
|
|
271
284
|
|
|
272
285
|
GetPopupContainerDemo.story = {
|
|
273
|
-
|
|
286
|
+
name: 'tooltip指定弹出层的容器',
|
|
274
287
|
};
|
|
275
288
|
|
|
276
289
|
export const TooltipAll = () => (
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
</div>
|
|
290
|
+
<div className="demo">
|
|
291
|
+
<ScrollDemo />
|
|
292
|
+
<div
|
|
293
|
+
style={{
|
|
294
|
+
padding: 120,
|
|
295
|
+
}}
|
|
296
|
+
>
|
|
297
|
+
<ScrollDemo
|
|
298
|
+
showArrow
|
|
299
|
+
tagStyle={{
|
|
300
|
+
height: 80,
|
|
301
|
+
}}
|
|
302
|
+
/>
|
|
291
303
|
</div>
|
|
304
|
+
</div>
|
|
292
305
|
);
|
|
293
306
|
|
|
294
307
|
TooltipAll.story = {
|
|
295
|
-
|
|
308
|
+
name: 'tooltip All',
|
|
296
309
|
};
|
|
297
310
|
|
|
298
311
|
export const NoContent = () => (
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
</div>
|
|
307
|
-
<div
|
|
308
|
-
style={{
|
|
309
|
-
padding: 120,
|
|
310
|
-
}}
|
|
311
|
-
>
|
|
312
|
-
<ScrollDemo
|
|
313
|
-
showArrow
|
|
314
|
-
tagStyle={{
|
|
315
|
-
minHeight: 80,
|
|
316
|
-
minWidth: 120,
|
|
317
|
-
}}
|
|
318
|
-
content={''}
|
|
319
|
-
/>
|
|
320
|
-
</div>
|
|
312
|
+
<div className="demo">
|
|
313
|
+
<div
|
|
314
|
+
style={{
|
|
315
|
+
padding: 120,
|
|
316
|
+
}}
|
|
317
|
+
>
|
|
318
|
+
<ScrollDemo showArrow content={''} />
|
|
321
319
|
</div>
|
|
320
|
+
<div
|
|
321
|
+
style={{
|
|
322
|
+
padding: 120,
|
|
323
|
+
}}
|
|
324
|
+
>
|
|
325
|
+
<ScrollDemo
|
|
326
|
+
showArrow
|
|
327
|
+
tagStyle={{
|
|
328
|
+
minHeight: 80,
|
|
329
|
+
minWidth: 120,
|
|
330
|
+
}}
|
|
331
|
+
content={''}
|
|
332
|
+
/>
|
|
333
|
+
</div>
|
|
334
|
+
</div>
|
|
322
335
|
);
|
|
323
336
|
|
|
324
337
|
NoContent.story = {
|
|
325
|
-
|
|
338
|
+
name: 'no content',
|
|
326
339
|
};
|
|
327
340
|
|
|
328
341
|
export const AdjustPosition = () => (
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
342
|
+
<>
|
|
343
|
+
<div className="adjust">
|
|
344
|
+
<div className="wrapper">
|
|
345
|
+
第一个滚动区域
|
|
346
|
+
<Tooltip
|
|
347
|
+
content={
|
|
348
|
+
<article>
|
|
349
|
+
<p>hi bytedance</p>
|
|
350
|
+
<p>hi bytedance</p>
|
|
351
|
+
</article>
|
|
352
|
+
}
|
|
353
|
+
position="rightBottom"
|
|
354
|
+
trigger="click"
|
|
355
|
+
>
|
|
356
|
+
{/* <Tag className='topLeft'>topleft</Tag> */}
|
|
357
|
+
<div>test</div>
|
|
358
|
+
</Tooltip>
|
|
359
|
+
<Tooltip
|
|
360
|
+
content={
|
|
361
|
+
<article>
|
|
362
|
+
<p>hi bytedance</p>
|
|
363
|
+
<p>hi bytedance</p>
|
|
364
|
+
</article>
|
|
365
|
+
}
|
|
366
|
+
position="topRight"
|
|
367
|
+
trigger="click"
|
|
368
|
+
>
|
|
369
|
+
<Tag className="topRight">topRight</Tag>
|
|
370
|
+
</Tooltip>
|
|
371
|
+
<Tooltip
|
|
372
|
+
content={
|
|
373
|
+
<article>
|
|
374
|
+
<p>hi bytedance</p>
|
|
375
|
+
<p>hi bytedance</p>
|
|
376
|
+
</article>
|
|
377
|
+
}
|
|
378
|
+
position="bottomLeft"
|
|
379
|
+
trigger="click"
|
|
380
|
+
>
|
|
381
|
+
<Tag className="bottomLeft">bottomLeft</Tag>
|
|
382
|
+
</Tooltip>
|
|
383
|
+
<Tooltip
|
|
384
|
+
content={
|
|
385
|
+
<article>
|
|
386
|
+
<p>hi bytedance</p>
|
|
387
|
+
<p>hi bytedance</p>
|
|
388
|
+
</article>
|
|
389
|
+
}
|
|
390
|
+
position="bottomRight"
|
|
391
|
+
trigger="click"
|
|
392
|
+
>
|
|
393
|
+
<Tag className="bottomRight">bottomRight</Tag>
|
|
394
|
+
</Tooltip>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
<div className="adjust2">
|
|
398
|
+
<div className="wrapper2">第二个滚动区域</div>
|
|
399
|
+
</div>
|
|
400
|
+
</>
|
|
388
401
|
);
|
|
389
402
|
|
|
390
403
|
AdjustPosition.story = {
|
|
391
|
-
|
|
404
|
+
name: '自适应',
|
|
392
405
|
};
|
|
393
406
|
|
|
394
407
|
export const CompositeComponent = () => (
|
|
395
|
-
|
|
408
|
+
<div
|
|
409
|
+
style={{
|
|
410
|
+
padding: 50,
|
|
411
|
+
}}
|
|
412
|
+
>
|
|
413
|
+
<Tooltip
|
|
414
|
+
content={
|
|
415
|
+
<article>
|
|
416
|
+
<p>hi bytedance</p> <p>hi bytedance</p>
|
|
417
|
+
</article>
|
|
418
|
+
}
|
|
419
|
+
position="top"
|
|
420
|
+
>
|
|
421
|
+
<IconList />
|
|
422
|
+
</Tooltip>
|
|
423
|
+
<Tooltip content={'收起'} position="top">
|
|
424
|
+
<IconButton icon={<IconSidebar />} />
|
|
425
|
+
</Tooltip>
|
|
426
|
+
<Tooltip content={'开关'} position="top">
|
|
427
|
+
<Switch />
|
|
428
|
+
</Tooltip>
|
|
429
|
+
<Tooltip content={'选择框'} position="top">
|
|
430
|
+
<Checkbox
|
|
396
431
|
style={{
|
|
397
|
-
|
|
432
|
+
display: 'inline-flex',
|
|
398
433
|
}}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
<Tooltip content={'开关'} position="top">
|
|
414
|
-
<Switch />
|
|
415
|
-
</Tooltip>
|
|
416
|
-
<Tooltip content={'选择框'} position="top">
|
|
417
|
-
<Checkbox
|
|
418
|
-
style={{
|
|
419
|
-
display: 'inline-flex',
|
|
420
|
-
}}
|
|
421
|
-
>
|
|
422
|
-
选择框
|
|
423
|
-
</Checkbox>
|
|
424
|
-
</Tooltip>
|
|
425
|
-
<Tooltip content={'单选'} position="top">
|
|
426
|
-
<Radio
|
|
427
|
-
style={{
|
|
428
|
-
display: 'inline-flex',
|
|
429
|
-
}}
|
|
430
|
-
>
|
|
431
|
-
单选
|
|
432
|
-
</Radio>
|
|
433
|
-
</Tooltip>
|
|
434
|
-
</div>
|
|
434
|
+
>
|
|
435
|
+
选择框
|
|
436
|
+
</Checkbox>
|
|
437
|
+
</Tooltip>
|
|
438
|
+
<Tooltip content={'单选'} position="top">
|
|
439
|
+
<Radio
|
|
440
|
+
style={{
|
|
441
|
+
display: 'inline-flex',
|
|
442
|
+
}}
|
|
443
|
+
>
|
|
444
|
+
单选
|
|
445
|
+
</Radio>
|
|
446
|
+
</Tooltip>
|
|
447
|
+
</div>
|
|
435
448
|
);
|
|
436
449
|
|
|
437
450
|
CompositeComponent.story = {
|
|
438
|
-
|
|
451
|
+
name: '复合组件',
|
|
439
452
|
};
|
|
440
453
|
|
|
441
454
|
export const WrapDisabledElems = () => (
|
|
442
|
-
|
|
455
|
+
<div
|
|
456
|
+
style={{
|
|
457
|
+
padding: 50,
|
|
458
|
+
}}
|
|
459
|
+
>
|
|
460
|
+
<Tooltip content="disabled">
|
|
461
|
+
<IconButton disabled icon={<IconEdit />} />
|
|
462
|
+
</Tooltip>
|
|
463
|
+
<Tooltip content="disabled">
|
|
464
|
+
<IconButton disabled icon={<IconEdit />} block />
|
|
465
|
+
</Tooltip>
|
|
466
|
+
<Tooltip content="disabled">
|
|
467
|
+
<Button disabled block>
|
|
468
|
+
编辑
|
|
469
|
+
</Button>
|
|
470
|
+
</Tooltip>
|
|
471
|
+
<Tooltip content="disabled">
|
|
472
|
+
<Button
|
|
473
|
+
disabled
|
|
443
474
|
style={{
|
|
444
|
-
|
|
475
|
+
display: 'block',
|
|
445
476
|
}}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
<IconButton disabled icon={<IconEdit />} block />
|
|
452
|
-
</Tooltip>
|
|
453
|
-
<Tooltip content="disabled">
|
|
454
|
-
<Button disabled block>
|
|
455
|
-
编辑
|
|
456
|
-
</Button>
|
|
457
|
-
</Tooltip>
|
|
458
|
-
<Tooltip content="disabled">
|
|
459
|
-
<Button
|
|
460
|
-
disabled
|
|
461
|
-
style={{
|
|
462
|
-
display: 'block',
|
|
463
|
-
}}
|
|
464
|
-
>
|
|
465
|
-
编辑
|
|
466
|
-
</Button>
|
|
467
|
-
</Tooltip>
|
|
468
|
-
</div>
|
|
477
|
+
>
|
|
478
|
+
编辑
|
|
479
|
+
</Button>
|
|
480
|
+
</Tooltip>
|
|
481
|
+
</div>
|
|
469
482
|
);
|
|
470
483
|
|
|
471
484
|
WrapDisabledElems.story = {
|
|
472
|
-
|
|
485
|
+
name: 'wrap disabled elems',
|
|
473
486
|
};
|
|
474
487
|
|
|
475
488
|
export const InTable = () => (
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
489
|
+
<div
|
|
490
|
+
style={{
|
|
491
|
+
marginTop: 50,
|
|
492
|
+
}}
|
|
493
|
+
>
|
|
494
|
+
<InTableDemo />
|
|
495
|
+
</div>
|
|
483
496
|
);
|
|
484
497
|
|
|
485
498
|
InTable.story = {
|
|
486
|
-
|
|
499
|
+
name: 'in table',
|
|
487
500
|
};
|
|
488
501
|
|
|
489
502
|
export const _EdgeDemo = () => <EdgeDemo />;
|
|
490
503
|
|
|
491
504
|
_EdgeDemo.story = {
|
|
492
|
-
|
|
505
|
+
name: 'edge demo',
|
|
493
506
|
};
|
|
494
507
|
|
|
495
508
|
export const ScrollTooltipDemo = () => <ScrollTooltip />;
|
|
496
509
|
ScrollTooltipDemo.story = {
|
|
497
|
-
|
|
510
|
+
name: 'scroll demo and set popup container',
|
|
498
511
|
};
|
|
499
512
|
export const DangerousHtmlDemo = () => <DangerousHtml />;
|
|
500
513
|
DangerousHtmlDemo.story = {
|
|
501
|
-
|
|
514
|
+
name: 'in dangerous html',
|
|
502
515
|
};
|
|
503
516
|
export const ArrowPointAtCenterDemo = () => <ArrowPointAtCenter />;
|
|
504
517
|
ArrowPointAtCenterDemo.story = {
|
|
505
|
-
|
|
518
|
+
name: 'arrow point at center',
|
|
506
519
|
};
|
|
507
520
|
export const CustomContainerDemo = () => <CustomContainer />;
|
|
508
521
|
CustomContainerDemo.story = {
|
|
509
|
-
|
|
522
|
+
name: 'custom container',
|
|
510
523
|
};
|
|
511
524
|
export const ContainerPositionDemo = () => <ContainerPosition />;
|
|
512
525
|
ContainerPositionDemo.story = {
|
|
513
|
-
|
|
526
|
+
name: 'container observer',
|
|
514
527
|
};
|
|
515
528
|
|
|
516
529
|
export const QuickMoveMouse = () => {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
};
|
|
526
|
-
return (
|
|
527
|
-
<div className="demo">
|
|
528
|
-
<div>
|
|
529
|
-
<Tooltip content={'1'} {...props}>
|
|
530
|
-
aaaaaaaaaaa
|
|
531
|
-
</Tooltip>
|
|
532
|
-
</div>
|
|
533
|
-
<div>
|
|
534
|
-
<Tooltip content={'2'} {...props}>
|
|
535
|
-
bbbbbbbbbbb
|
|
536
|
-
</Tooltip>
|
|
537
|
-
</div>
|
|
538
|
-
<div>
|
|
539
|
-
<Tooltip content={'3'} {...props}>
|
|
540
|
-
ccccccccccc
|
|
541
|
-
</Tooltip>
|
|
542
|
-
</div>
|
|
543
|
-
<div>
|
|
544
|
-
<Tooltip content={'4'} {...props}>
|
|
545
|
-
aaaaaaaaaaa
|
|
546
|
-
</Tooltip>
|
|
547
|
-
</div>
|
|
548
|
-
<div>
|
|
549
|
-
<Tooltip content={'5'} {...props}>
|
|
550
|
-
bbbbbbbbbbb
|
|
551
|
-
</Tooltip>
|
|
552
|
-
</div>
|
|
553
|
-
<div>
|
|
554
|
-
<Tooltip content={'6'} {...props}>
|
|
555
|
-
ccccccccccc
|
|
556
|
-
</Tooltip>
|
|
557
|
-
</div>
|
|
558
|
-
<div>
|
|
559
|
-
<Tooltip content={'7'} {...props}>
|
|
560
|
-
aaaaaaaaaaa
|
|
561
|
-
</Tooltip>
|
|
562
|
-
</div>
|
|
563
|
-
<div>
|
|
564
|
-
<Tooltip content={'8'} {...props}>
|
|
565
|
-
bbbbbbbbbbb
|
|
566
|
-
</Tooltip>
|
|
567
|
-
</div>
|
|
568
|
-
<div>
|
|
569
|
-
<Tooltip content={'9'} {...props}>
|
|
570
|
-
ccccccccccc
|
|
571
|
-
</Tooltip>
|
|
572
|
-
</div>
|
|
573
|
-
</div>
|
|
574
|
-
);
|
|
530
|
+
/**
|
|
531
|
+
* mouseEnterDelay, mouseLeaveDelay 默认都为 50
|
|
532
|
+
* mouseEnterDelay, mouseLeaveDelay 都为 0,快速滑动可能出现两个 tooltip 出现
|
|
533
|
+
*/
|
|
534
|
+
const Demo = () => {
|
|
535
|
+
const props = {
|
|
536
|
+
mouseEnterDelay: 50,
|
|
537
|
+
mouseLeaveDelay: 0,
|
|
575
538
|
};
|
|
539
|
+
return (
|
|
540
|
+
<div className="demo">
|
|
541
|
+
<div>
|
|
542
|
+
<Tooltip content={'1'} {...props}>
|
|
543
|
+
aaaaaaaaaaa
|
|
544
|
+
</Tooltip>
|
|
545
|
+
</div>
|
|
546
|
+
<div>
|
|
547
|
+
<Tooltip content={'2'} {...props}>
|
|
548
|
+
bbbbbbbbbbb
|
|
549
|
+
</Tooltip>
|
|
550
|
+
</div>
|
|
551
|
+
<div>
|
|
552
|
+
<Tooltip content={'3'} {...props}>
|
|
553
|
+
ccccccccccc
|
|
554
|
+
</Tooltip>
|
|
555
|
+
</div>
|
|
556
|
+
<div>
|
|
557
|
+
<Tooltip content={'4'} {...props}>
|
|
558
|
+
aaaaaaaaaaa
|
|
559
|
+
</Tooltip>
|
|
560
|
+
</div>
|
|
561
|
+
<div>
|
|
562
|
+
<Tooltip content={'5'} {...props}>
|
|
563
|
+
bbbbbbbbbbb
|
|
564
|
+
</Tooltip>
|
|
565
|
+
</div>
|
|
566
|
+
<div>
|
|
567
|
+
<Tooltip content={'6'} {...props}>
|
|
568
|
+
ccccccccccc
|
|
569
|
+
</Tooltip>
|
|
570
|
+
</div>
|
|
571
|
+
<div>
|
|
572
|
+
<Tooltip content={'7'} {...props}>
|
|
573
|
+
aaaaaaaaaaa
|
|
574
|
+
</Tooltip>
|
|
575
|
+
</div>
|
|
576
|
+
<div>
|
|
577
|
+
<Tooltip content={'8'} {...props}>
|
|
578
|
+
bbbbbbbbbbb
|
|
579
|
+
</Tooltip>
|
|
580
|
+
</div>
|
|
581
|
+
<div>
|
|
582
|
+
<Tooltip content={'9'} {...props}>
|
|
583
|
+
ccccccccccc
|
|
584
|
+
</Tooltip>
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|
|
587
|
+
);
|
|
588
|
+
};
|
|
576
589
|
|
|
577
|
-
|
|
590
|
+
return <Demo />;
|
|
578
591
|
};
|
|
579
592
|
|
|
580
593
|
QuickMoveMouse.story = {
|
|
581
|
-
|
|
594
|
+
name: '快速移动鼠标可见性',
|
|
582
595
|
};
|
|
583
596
|
|
|
584
597
|
export const MotionFalseFix1402 = () => {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
598
|
+
function Demo() {
|
|
599
|
+
const Test = React.forwardRef((props, ref) => (
|
|
600
|
+
<span {...props} ref={ref}>
|
|
601
|
+
Test
|
|
602
|
+
</span>
|
|
603
|
+
));
|
|
604
|
+
return (
|
|
605
|
+
<div>
|
|
606
|
+
<Tooltip content={'hi bytedance'} motion={false}>
|
|
607
|
+
<Test />
|
|
608
|
+
</Tooltip>
|
|
609
|
+
<br />
|
|
610
|
+
<br />
|
|
611
|
+
<Tooltip content={'hi bytedance'}>
|
|
612
|
+
<Test />
|
|
613
|
+
</Tooltip>
|
|
614
|
+
</div>
|
|
615
|
+
);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
return <Demo />;
|
|
606
619
|
};
|
|
607
620
|
|
|
608
621
|
MotionFalseFix1402.story = {
|
|
609
|
-
|
|
622
|
+
name: 'motion=false fix #1402',
|
|
610
623
|
};
|
|
611
624
|
|
|
612
625
|
export const DisabledWrapperCls = () => (
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
626
|
+
<>
|
|
627
|
+
<Tooltip wrapperClassName="test" content={'hi bytedance'}>
|
|
628
|
+
<Button>按钮</Button>
|
|
629
|
+
</Tooltip>
|
|
630
|
+
<br />
|
|
631
|
+
<br />
|
|
632
|
+
<Tooltip wrapperClassName="test" content={'hi bytedance'}>
|
|
633
|
+
<Button disabled>禁用的单个按钮</Button>
|
|
634
|
+
</Tooltip>
|
|
635
|
+
<br />
|
|
636
|
+
<br />
|
|
637
|
+
<Tooltip wrapperClassName="test" content={'hi bytedance'}>
|
|
638
|
+
<Button>正常的多个按钮</Button>
|
|
639
|
+
<Button>正常的多个按钮</Button>
|
|
640
|
+
</Tooltip>
|
|
641
|
+
<br />
|
|
642
|
+
<br />
|
|
643
|
+
<Tooltip wrapperClassName="test" content={'hi bytedance'}>
|
|
644
|
+
<Select disabled placeholder="请选择业务线" style={{ width: 120 }}>
|
|
645
|
+
<Select.Option value="abc">抖音</Select.Option>
|
|
646
|
+
<Select.Option value="hotsoon">火山</Select.Option>
|
|
647
|
+
<Select.Option value="jianying" disabled>
|
|
648
|
+
剪映
|
|
649
|
+
</Select.Option>
|
|
650
|
+
<Select.Option value="xigua">西瓜视频</Select.Option>
|
|
651
|
+
</Select>
|
|
652
|
+
</Tooltip>
|
|
653
|
+
<br />
|
|
654
|
+
<br />
|
|
655
|
+
</>
|
|
643
656
|
);
|
|
644
657
|
|
|
645
658
|
DisabledWrapperCls.story = {
|
|
646
|
-
|
|
659
|
+
name: 'disabledWrapperCls',
|
|
647
660
|
};
|
|
648
661
|
|
|
649
662
|
export const ShowArrow = () => {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
663
|
+
function Demo() {
|
|
664
|
+
const Test = React.forwardRef((props, ref) => (
|
|
665
|
+
<Tag {...props} ref={ref}>
|
|
666
|
+
Test
|
|
667
|
+
</Tag>
|
|
668
|
+
));
|
|
669
|
+
return (
|
|
670
|
+
<div>
|
|
671
|
+
<h4>should show content and arrow when click</h4>
|
|
672
|
+
<Tooltip showArrow trigger="click" content={'hi bytedance'}>
|
|
673
|
+
<Test />
|
|
674
|
+
</Tooltip>
|
|
675
|
+
</div>
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
return <Demo />;
|
|
667
680
|
};
|
|
668
681
|
|
|
669
682
|
ShowArrow.story = {
|
|
670
|
-
|
|
683
|
+
name: 'showArrow',
|
|
671
684
|
};
|
|
672
685
|
|
|
673
686
|
export const OnClickOutSideDemo = () => {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
687
|
+
let [v, setV] = useState(false);
|
|
688
|
+
let clickOutSide = () => {
|
|
689
|
+
console.log('clickOutSide');
|
|
690
|
+
setV(false);
|
|
691
|
+
};
|
|
692
|
+
return (
|
|
693
|
+
<>
|
|
694
|
+
<Tooltip onClickOutSide={() => clickOutSide()} content={'hi bytedance'} visible={v} trigger="custom">
|
|
695
|
+
<Button onClick={() => setV(true)}>按钮</Button>
|
|
696
|
+
</Tooltip>
|
|
697
|
+
<br />
|
|
698
|
+
<br />
|
|
699
|
+
<Tooltip onClickOutSide={() => console.log('clickOutSide')} content={'hi bytedance'} trigger="click">
|
|
700
|
+
<Button>单个按钮</Button>
|
|
701
|
+
</Tooltip>
|
|
702
|
+
</>
|
|
703
|
+
);
|
|
691
704
|
};
|
|
692
705
|
OnClickOutSideDemo.story = {
|
|
693
706
|
name: 'OnClickOutSide',
|
|
694
707
|
};
|
|
695
708
|
|
|
696
709
|
export const AutoAdjustWithSpacing = () => {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
710
|
+
const [height, setHeight] = useState(84);
|
|
711
|
+
const [key, setKey] = useState(1);
|
|
712
|
+
const initSpacing = 8;
|
|
713
|
+
const [spacing, setSpacing] = useState(initSpacing);
|
|
714
|
+
|
|
715
|
+
const change = (height, hasSpace) => {
|
|
716
|
+
setHeight(height);
|
|
717
|
+
hasSpace ? setSpacing(initSpacing) : setSpacing(0);
|
|
718
|
+
setKey(Math.random());
|
|
719
|
+
};
|
|
720
|
+
|
|
721
|
+
return (
|
|
722
|
+
<div className="demo1">
|
|
723
|
+
<div>
|
|
724
|
+
<Tooltip
|
|
725
|
+
motion={false}
|
|
726
|
+
rePosKey={key}
|
|
727
|
+
// spacing={spacing}
|
|
728
|
+
content={
|
|
729
|
+
<article style={{ boxSizing: 'border-box', height: height }}>
|
|
730
|
+
<p>hi bytedance, + padding 20</p>
|
|
731
|
+
<p>hi bytedance</p>
|
|
732
|
+
</article>
|
|
733
|
+
}
|
|
734
|
+
position="top"
|
|
735
|
+
trigger="custom"
|
|
736
|
+
visible={true}
|
|
737
|
+
>
|
|
738
|
+
<Tag>demo</Tag>
|
|
739
|
+
</Tooltip>
|
|
740
|
+
</div>
|
|
741
|
+
<div style={{ marginTop: 200 }}>
|
|
742
|
+
<Switch
|
|
743
|
+
onChange={hasSpace => change(height, hasSpace)}
|
|
744
|
+
checked={spacing === initSpacing ? true : false}
|
|
745
|
+
></Switch>
|
|
746
|
+
<InputNumber onChange={height => change(Number(height))} value={height} style={{ width: 200 }} />
|
|
747
|
+
</div>
|
|
748
|
+
</div>
|
|
749
|
+
);
|
|
734
750
|
};
|
|
735
751
|
|
|
736
752
|
AutoAdjustWithSpacing.story = {
|
|
737
753
|
name: 'AutoAdjustWithSpacing',
|
|
738
754
|
};
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* Chromatic UI test
|
|
758
|
+
*/
|
|
759
|
+
export const leftTopOverDemo = () => {
|
|
760
|
+
const [visible, setVisible] = useState(true);
|
|
761
|
+
const content = <div style={{ height: 200, width: 200 }}>Semi Design</div>;
|
|
762
|
+
|
|
763
|
+
const commonProps = {
|
|
764
|
+
content,
|
|
765
|
+
trigger: 'click',
|
|
766
|
+
showArrow: false,
|
|
767
|
+
visible,
|
|
768
|
+
trigger: 'custom',
|
|
769
|
+
motion: false,
|
|
770
|
+
};
|
|
771
|
+
const buttonStyle = {
|
|
772
|
+
width: 200,
|
|
773
|
+
};
|
|
774
|
+
|
|
775
|
+
return (
|
|
776
|
+
<div data-cy="wrapper">
|
|
777
|
+
<Button onClick={() => setVisible(!visible)}>toggle visible</Button>
|
|
778
|
+
<div style={{ paddingTop: 200 }}>
|
|
779
|
+
<Space spacing={80}>
|
|
780
|
+
<Tooltip {...commonProps} position="leftTopOver">
|
|
781
|
+
<Button data-cy="leftTopOver" style={buttonStyle}>
|
|
782
|
+
leftTopOver
|
|
783
|
+
</Button>
|
|
784
|
+
</Tooltip>
|
|
785
|
+
<Tooltip {...commonProps} position="leftBottomOver">
|
|
786
|
+
<Button data-cy="leftBottomOver" style={buttonStyle}>
|
|
787
|
+
leftBottomOver
|
|
788
|
+
</Button>
|
|
789
|
+
</Tooltip>
|
|
790
|
+
<Tooltip {...commonProps} position="rightTopOver">
|
|
791
|
+
<Button data-cy="rightTopOver" style={buttonStyle}>
|
|
792
|
+
rightTopOver
|
|
793
|
+
</Button>
|
|
794
|
+
</Tooltip>
|
|
795
|
+
<Tooltip {...commonProps} position="rightBottomOver">
|
|
796
|
+
<Button data-cy="rightBottomOver" style={buttonStyle}>
|
|
797
|
+
rightBottomOver
|
|
798
|
+
</Button>
|
|
799
|
+
</Tooltip>
|
|
800
|
+
</Space>
|
|
801
|
+
</div>
|
|
802
|
+
</div>
|
|
803
|
+
);
|
|
804
|
+
};
|
|
805
|
+
leftTopOverDemo.storyName = `leftTopOver visible`;
|
|
806
|
+
leftTopOverDemo.parameters = {
|
|
807
|
+
chromatic: {
|
|
808
|
+
disableSnapshot: false,
|
|
809
|
+
delay: 3000,
|
|
810
|
+
viewports: [1200],
|
|
811
|
+
},
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
/**
|
|
815
|
+
* Cypress test
|
|
816
|
+
*/
|
|
817
|
+
export const leftTopOverAutoAdjustOverflow = () => {
|
|
818
|
+
const content = <div style={{ height: 200, width: 200 }}>Semi Design</div>;
|
|
819
|
+
|
|
820
|
+
const commonProps = {
|
|
821
|
+
content,
|
|
822
|
+
trigger: 'click',
|
|
823
|
+
showArrow: false,
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
return (
|
|
827
|
+
<div
|
|
828
|
+
data-cy="wrapper"
|
|
829
|
+
style={{ width: '200vw', height: '200vw', display: 'flex', alignItems: 'center', justifyContent: 'center' }}
|
|
830
|
+
>
|
|
831
|
+
<div>
|
|
832
|
+
<Tooltip {...commonProps} position="leftTopOver">
|
|
833
|
+
<Button data-cy="leftTopOver" style={{ width: 200 }}>
|
|
834
|
+
leftTopOver
|
|
835
|
+
</Button>
|
|
836
|
+
</Tooltip>
|
|
837
|
+
</div>
|
|
838
|
+
</div>
|
|
839
|
+
);
|
|
840
|
+
};
|
|
841
|
+
leftTopOverAutoAdjustOverflow.storyName = `leftTopOver autoAdjustOverflow`;
|
|
842
|
+
|
|
843
|
+
export const autoFocusContentDemo = () => {
|
|
844
|
+
const [controlMotionVisible, setControlMotionVisible] = React.useState(false);
|
|
845
|
+
const [controlNoMotionVisible, setControlNoMotionVisible] = React.useState(false);
|
|
846
|
+
|
|
847
|
+
const onMotionVisibleChange = React.useCallback(() => {
|
|
848
|
+
setControlMotionVisible(!controlMotionVisible);
|
|
849
|
+
}, [setControlMotionVisible, controlMotionVisible]);
|
|
850
|
+
|
|
851
|
+
const onNoMotionVisibleChange = React.useCallback(() => {
|
|
852
|
+
setControlNoMotionVisible(!controlNoMotionVisible);
|
|
853
|
+
}, [setControlNoMotionVisible, controlNoMotionVisible]);
|
|
854
|
+
|
|
855
|
+
return (
|
|
856
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 24 }}>
|
|
857
|
+
<div style={{ display: 'flex', gap: 18, flex: 1, alignItems: 'center' }}>
|
|
858
|
+
<span>Hover触发</span>
|
|
859
|
+
<Popover position="bottomLeft" content={<Input autofocus data-cy="hoverInput"/>}>
|
|
860
|
+
<Button data-cy="hover">motion</Button>
|
|
861
|
+
</Popover>
|
|
862
|
+
|
|
863
|
+
<Popover motion={false} position="bottomLeft" content={<Input autofocus data-cy="hoverNoMotionInput"/>}>
|
|
864
|
+
<Button data-cy="hoverNoMotion">no motion</Button>
|
|
865
|
+
</Popover>
|
|
866
|
+
</div>
|
|
867
|
+
<div style={{ display: 'flex', gap: 18, flex: 1, alignItems: 'center' }}>
|
|
868
|
+
<span>Click触发</span>
|
|
869
|
+
<Popover position="bottomLeft" content={<Input autofocus data-cy="clickInput"/>} trigger="click">
|
|
870
|
+
<Button data-cy="click">motion</Button>
|
|
871
|
+
</Popover>
|
|
872
|
+
|
|
873
|
+
<Popover motion={false} position="bottomLeft" content={<Input autofocus data-cy="clickNoMotionInput"/>} trigger="click">
|
|
874
|
+
<Button data-cy="clickNoMotion">no motion</Button>
|
|
875
|
+
</Popover>
|
|
876
|
+
</div>
|
|
877
|
+
<div style={{ display: 'flex', gap: 18, flex: 1, alignItems: 'center' }}>
|
|
878
|
+
<span>受控</span>
|
|
879
|
+
<Button onClick={onMotionVisibleChange} data-cy="controlled">motion状态切换</Button>
|
|
880
|
+
<Popover visible={controlMotionVisible} trigger="custom" position="bottomLeft" content={<Input autofocus data-cy="controlledInput"/>}>
|
|
881
|
+
<Button disabled data-cy="controlledDisableBtn">motion</Button>
|
|
882
|
+
</Popover>
|
|
883
|
+
|
|
884
|
+
<Button onClick={onNoMotionVisibleChange } data-cy="controlledNoMotion">no motion状态切换</Button>
|
|
885
|
+
<Popover
|
|
886
|
+
visible={controlNoMotionVisible}
|
|
887
|
+
trigger="custom"
|
|
888
|
+
motion={false}
|
|
889
|
+
position="bottomLeft"
|
|
890
|
+
content={<Input autofocus data-cy="controlledNoMotionInput"/>}
|
|
891
|
+
>
|
|
892
|
+
<Button disabled data-cy="controlledNoMotionDisableBtn">no motion</Button>
|
|
893
|
+
</Popover>
|
|
894
|
+
</div>
|
|
895
|
+
</div>
|
|
896
|
+
);
|
|
897
|
+
};
|