@douyinfe/semi-ui 2.33.0 → 2.34.0-alpha.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.
Files changed (75) hide show
  1. package/dist/css/semi.css +493 -23
  2. package/dist/css/semi.min.css +1 -1
  3. package/dist/umd/semi-ui.js +3604 -3474
  4. package/dist/umd/semi-ui.js.map +1 -1
  5. package/dist/umd/semi-ui.min.js +1 -1
  6. package/dist/umd/semi-ui.min.js.map +1 -1
  7. package/lib/cjs/_utils/index.d.ts +1 -1
  8. package/lib/cjs/button/index.d.ts +1 -1
  9. package/lib/cjs/input/index.d.ts +1 -1
  10. package/lib/cjs/input/index.js +1 -1
  11. package/lib/cjs/navigation/Item.d.ts +4 -0
  12. package/lib/cjs/navigation/Item.js +29 -10
  13. package/lib/cjs/navigation/SubNav.d.ts +5 -0
  14. package/lib/cjs/navigation/SubNav.js +51 -26
  15. package/lib/cjs/skeleton/index.d.ts +1 -0
  16. package/lib/cjs/skeleton/index.js +1 -0
  17. package/lib/cjs/skeleton/item.d.ts +1 -0
  18. package/lib/cjs/skeleton/item.js +6 -1
  19. package/lib/cjs/steps/basicStep.d.ts +3 -0
  20. package/lib/cjs/steps/basicStep.js +8 -2
  21. package/lib/cjs/steps/basicSteps.js +2 -1
  22. package/lib/cjs/steps/fillStep.d.ts +2 -0
  23. package/lib/cjs/steps/fillStep.js +3 -1
  24. package/lib/cjs/steps/fillSteps.js +5 -8
  25. package/lib/cjs/steps/index.d.ts +63 -1
  26. package/lib/cjs/steps/index.js +9 -0
  27. package/lib/cjs/steps/navStep.d.ts +3 -0
  28. package/lib/cjs/steps/navStep.js +6 -2
  29. package/lib/cjs/steps/navSteps.js +2 -1
  30. package/lib/cjs/steps/step.d.ts +4 -1
  31. package/lib/cjs/steps/step.js +1 -0
  32. package/lib/cjs/table/Body/BaseRow.js +1 -1
  33. package/lib/cjs/timeline/context.d.ts +8 -0
  34. package/lib/cjs/timeline/context.js +15 -0
  35. package/lib/cjs/timeline/index.d.ts +2 -1
  36. package/lib/cjs/timeline/index.js +8 -2
  37. package/lib/cjs/timeline/item.d.ts +10 -0
  38. package/lib/cjs/timeline/item.js +42 -3
  39. package/lib/cjs/tooltip/index.d.ts +2 -0
  40. package/lib/cjs/tooltip/index.js +14 -0
  41. package/lib/es/_utils/index.d.ts +1 -1
  42. package/lib/es/button/index.d.ts +1 -1
  43. package/lib/es/input/index.d.ts +1 -1
  44. package/lib/es/input/index.js +1 -1
  45. package/lib/es/navigation/Item.d.ts +4 -0
  46. package/lib/es/navigation/Item.js +28 -10
  47. package/lib/es/navigation/SubNav.d.ts +5 -0
  48. package/lib/es/navigation/SubNav.js +52 -26
  49. package/lib/es/skeleton/index.d.ts +1 -0
  50. package/lib/es/skeleton/index.js +1 -0
  51. package/lib/es/skeleton/item.d.ts +1 -0
  52. package/lib/es/skeleton/item.js +6 -1
  53. package/lib/es/steps/basicStep.d.ts +3 -0
  54. package/lib/es/steps/basicStep.js +8 -2
  55. package/lib/es/steps/basicSteps.js +2 -1
  56. package/lib/es/steps/fillStep.d.ts +2 -0
  57. package/lib/es/steps/fillStep.js +3 -1
  58. package/lib/es/steps/fillSteps.js +6 -8
  59. package/lib/es/steps/index.d.ts +63 -1
  60. package/lib/es/steps/index.js +6 -0
  61. package/lib/es/steps/navStep.d.ts +3 -0
  62. package/lib/es/steps/navStep.js +6 -2
  63. package/lib/es/steps/navSteps.js +2 -1
  64. package/lib/es/steps/step.d.ts +4 -1
  65. package/lib/es/steps/step.js +1 -0
  66. package/lib/es/table/Body/BaseRow.js +1 -1
  67. package/lib/es/timeline/context.d.ts +8 -0
  68. package/lib/es/timeline/context.js +3 -0
  69. package/lib/es/timeline/index.d.ts +2 -1
  70. package/lib/es/timeline/index.js +7 -2
  71. package/lib/es/timeline/item.d.ts +10 -0
  72. package/lib/es/timeline/item.js +41 -3
  73. package/lib/es/tooltip/index.d.ts +2 -0
  74. package/lib/es/tooltip/index.js +14 -0
  75. package/package.json +8 -8
@@ -67,4 +67,5 @@ Skeleton.propTypes = {
67
67
  loading: PropTypes.bool,
68
68
  children: PropTypes.node
69
69
  };
70
+ Skeleton.elementType = 'Skeleton';
70
71
  export default Skeleton;
@@ -21,6 +21,7 @@ export declare const Image: React.FC<BasicProps>;
21
21
  export declare const Title: React.FC<BasicProps>;
22
22
  export declare const Button: React.FC<BasicProps>;
23
23
  export declare class Paragraph extends PureComponent<ParagraphProps> {
24
+ static elementType: string;
24
25
  static propTypes: {
25
26
  rows: PropTypes.Requireable<number>;
26
27
  prefixCls: PropTypes.Requireable<string>;
@@ -63,6 +63,10 @@ export const Avatar = generator('avatar')(Generic);
63
63
  export const Image = generator('image')(Generic);
64
64
  export const Title = generator('title')(Generic);
65
65
  export const Button = generator('button')(Generic);
66
+ Avatar.elementType = 'Skeleton.Avatar';
67
+ Image.elementType = 'Skeleton.Image';
68
+ Title.elementType = 'Skeleton.Title';
69
+ Button.elementType = 'Skeleton.Button';
66
70
  export class Paragraph extends PureComponent {
67
71
  render() {
68
72
  const {
@@ -90,4 +94,5 @@ Paragraph.propTypes = {
90
94
  Paragraph.defaultProps = {
91
95
  prefixCls: cssClasses.PREFIX,
92
96
  rows: 4
93
- };
97
+ };
98
+ Paragraph.elementType = 'Skeleton.Paragraph';
@@ -19,6 +19,8 @@ export interface BasicStepProps {
19
19
  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
20
20
  "role"?: React.AriaRole;
21
21
  "aria-label"?: React.AriaAttributes["aria-label"];
22
+ usedInC2D?: string;
23
+ direction?: string;
22
24
  }
23
25
  export declare enum stepSizeMapIconSize {
24
26
  small = "large",
@@ -45,5 +47,6 @@ declare const BasicStep: {
45
47
  status: string;
46
48
  className: string;
47
49
  };
50
+ elementType: string;
48
51
  };
49
52
  export default BasicStep;
@@ -26,7 +26,9 @@ const BasicStep = props => {
26
26
  stepNumber,
27
27
  onClick,
28
28
  onChange,
29
- onKeyDown
29
+ onKeyDown,
30
+ usedInC2D,
31
+ direction: direction
30
32
  } = props;
31
33
 
32
34
  const renderIcon = () => {
@@ -87,7 +89,10 @@ const BasicStep = props => {
87
89
 
88
90
  const classString = classnames(prefixCls, `${prefixCls}-${status}`, {
89
91
  [`${prefixCls}-active`]: active,
90
- [`${prefixCls}-done`]: done
92
+ [`${prefixCls}-done`]: done,
93
+ [`${prefixCls}-basic`]: usedInC2D,
94
+ [`${prefixCls}-${direction}`]: direction,
95
+ [`${prefixCls}-small`]: size === 'small'
91
96
  }, className);
92
97
 
93
98
  const handleClick = e => {
@@ -151,4 +156,5 @@ BasicStep.defaultProps = {
151
156
  status: 'wait',
152
157
  className: ''
153
158
  };
159
+ BasicStep.elementType = 'Steps.BasicStep';
154
160
  export default BasicStep;
@@ -27,7 +27,8 @@ const Steps = props => {
27
27
  const stepNumber = initial + index;
28
28
  const childProps = Object.assign({
29
29
  stepNumber: `${stepNumber + 1}`,
30
- size
30
+ size,
31
+ direction
31
32
  }, child.props);
32
33
 
33
34
  if (status === 'error' && index === current - 1) {
@@ -15,6 +15,7 @@ export interface FillStepProps {
15
15
  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
16
16
  "role"?: React.AriaRole;
17
17
  "aria-label"?: React.AriaAttributes["aria-label"];
18
+ usedInC2D?: boolean;
18
19
  }
19
20
  declare const FillStep: {
20
21
  (props: FillStepProps): JSX.Element;
@@ -33,5 +34,6 @@ declare const FillStep: {
33
34
  status: string;
34
35
  className: string;
35
36
  };
37
+ elementType: string;
36
38
  };
37
39
  export default FillStep;
@@ -97,7 +97,8 @@ const FillStep = props => {
97
97
  className: classnames({
98
98
  [prefixCls]: true,
99
99
  [`${prefixCls}-${status}`]: Boolean(status),
100
- [`${prefixCls}-clickable`]: onClick
100
+ [`${prefixCls}-clickable`]: onClick,
101
+ [`${prefixCls}-fill`]: props.usedInC2D
101
102
  }, className),
102
103
  style: style,
103
104
  onClick: e => {
@@ -132,4 +133,5 @@ FillStep.defaultProps = {
132
133
  status: 'wait',
133
134
  className: ''
134
135
  };
136
+ FillStep.elementType = 'Steps.FillStep';
135
137
  export default FillStep;
@@ -17,10 +17,8 @@ const Steps = props => {
17
17
  onChange
18
18
  } = props;
19
19
  const inner = useMemo(() => {
20
- const filteredChildren = Children.toArray(children).filter(c => /*#__PURE__*/isValidElement(c));
21
- const colStyle = direction === 'vertical' ? null : {
22
- width: `${100 / filteredChildren.length}%`
23
- };
20
+ const filteredChildren = Children.toArray(children).filter(c => /*#__PURE__*/isValidElement(c)); // const colStyle = direction === 'vertical' ? null : { width: `${100 / filteredChildren.length }%` };
21
+
24
22
  const content = Children.map(filteredChildren, (child, index) => {
25
23
  if (!child) {
26
24
  return null;
@@ -50,11 +48,11 @@ const Steps = props => {
50
48
  if (index !== current) {
51
49
  onChange(index + initial);
52
50
  }
53
- };
51
+ }; // Whether colStyle is set has no effect
52
+ // return <Col style={colStyle}>{cloneElement(child, { ...childProps })}</Col>;
53
+
54
54
 
55
- return /*#__PURE__*/React.createElement(Col, {
56
- style: colStyle
57
- }, /*#__PURE__*/cloneElement(child, Object.assign({}, childProps)));
55
+ return /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/cloneElement(child, Object.assign({}, childProps)));
58
56
  });
59
57
  return content;
60
58
  }, [children, initial, prefixCls, direction, status, current, onChange]);
@@ -22,7 +22,69 @@ export interface NavStepsAllProps extends NavStepsProps {
22
22
  }
23
23
  export declare type StepsProps = FillStepsAllProps | BasicStepsAllProps | NavStepsAllProps;
24
24
  declare class Steps extends Component<StepsProps> {
25
- static Step: (props: import("./step").StepProps) => JSX.Element;
25
+ static Step: {
26
+ (props: import("./step").StepProps): JSX.Element;
27
+ elementType: string;
28
+ };
29
+ static FillStep: {
30
+ (props: import("./fillStep").FillStepProps): JSX.Element;
31
+ propTypes: {
32
+ prefixCls: PropTypes.Requireable<string>;
33
+ description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
34
+ icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
35
+ status: PropTypes.Requireable<string>;
36
+ title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
37
+ className: PropTypes.Requireable<string>;
38
+ style: PropTypes.Requireable<object>;
39
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
40
+ };
41
+ defaultProps: {
42
+ prefixCls: string;
43
+ status: string;
44
+ className: string;
45
+ };
46
+ elementType: string;
47
+ };
48
+ static BasicStep: {
49
+ (props: import("./basicStep").BasicStepProps): JSX.Element;
50
+ propTypes: {
51
+ prefixCls: PropTypes.Requireable<string>;
52
+ description: PropTypes.Requireable<PropTypes.ReactNodeLike>;
53
+ icon: PropTypes.Requireable<PropTypes.ReactNodeLike>;
54
+ status: PropTypes.Requireable<string>;
55
+ title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
56
+ className: PropTypes.Requireable<string>;
57
+ style: PropTypes.Requireable<object>;
58
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
59
+ active: PropTypes.Requireable<boolean>;
60
+ done: PropTypes.Requireable<boolean>;
61
+ };
62
+ defaultProps: {
63
+ prefixCls: string;
64
+ active: boolean;
65
+ done: boolean;
66
+ status: string;
67
+ className: string;
68
+ };
69
+ elementType: string;
70
+ };
71
+ static NavStep: {
72
+ (props: import("./navStep").NavStepProps): JSX.Element;
73
+ propTypes: {
74
+ prefixCls: PropTypes.Requireable<string>;
75
+ title: PropTypes.Requireable<PropTypes.ReactNodeLike>;
76
+ className: PropTypes.Requireable<string>;
77
+ style: PropTypes.Requireable<object>;
78
+ onClick: PropTypes.Requireable<(...args: any[]) => any>;
79
+ active: PropTypes.Requireable<boolean>;
80
+ };
81
+ defaultProps: {
82
+ prefixCls: string;
83
+ active: boolean;
84
+ className: string;
85
+ };
86
+ elementType: string;
87
+ };
26
88
  static propTypes: {
27
89
  onChange: PropTypes.Requireable<(...args: any[]) => any>;
28
90
  type: PropTypes.Requireable<string>;
@@ -18,6 +18,9 @@ import Step from './step';
18
18
  import FillSteps from './fillSteps';
19
19
  import BasicSteps from './basicSteps';
20
20
  import NavSteps from './navSteps';
21
+ import FillStep from './fillStep';
22
+ import BasicStep from './basicStep';
23
+ import NavStep from './navStep';
21
24
  import Context from './context';
22
25
 
23
26
  class Steps extends Component {
@@ -57,6 +60,9 @@ class Steps extends Component {
57
60
  }
58
61
 
59
62
  Steps.Step = Step;
63
+ Steps.FillStep = FillStep;
64
+ Steps.BasicStep = BasicStep;
65
+ Steps.NavStep = NavStep;
60
66
  Steps.propTypes = {
61
67
  onChange: PropTypes.func,
62
68
  type: PropTypes.oneOf(['fill', 'basic', 'nav']),
@@ -13,6 +13,8 @@ export interface NavStepProps {
13
13
  onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
14
14
  "role"?: React.AriaRole;
15
15
  "aria-label"?: React.AriaAttributes["aria-label"];
16
+ usedInC2D?: boolean;
17
+ size?: string;
16
18
  }
17
19
  declare const NavStep: {
18
20
  (props: NavStepProps): JSX.Element;
@@ -29,5 +31,6 @@ declare const NavStep: {
29
31
  active: boolean;
30
32
  className: string;
31
33
  };
34
+ elementType: string;
32
35
  };
33
36
  export default NavStep;
@@ -16,10 +16,13 @@ const NavStep = props => {
16
16
  total,
17
17
  onClick,
18
18
  onKeyDown,
19
- onChange
19
+ onChange,
20
+ size
20
21
  } = props;
21
22
  const classString = classnames(prefixCls, {
22
- [`${prefixCls}-active`]: active
23
+ [`${prefixCls}-active`]: active,
24
+ [`${prefixCls}-nav`]: props.usedInC2D,
25
+ [`${prefixCls}-small`]: size === 'small'
23
26
  }, className);
24
27
 
25
28
  const handleClick = e => {
@@ -75,4 +78,5 @@ NavStep.defaultProps = {
75
78
  active: false,
76
79
  className: ''
77
80
  };
81
+ NavStep.elementType = 'Steps.NavStep';
78
82
  export default NavStep;
@@ -24,7 +24,8 @@ const Steps = props => {
24
24
 
25
25
  const childProps = Object.assign({
26
26
  index,
27
- total
27
+ total,
28
+ size
28
29
  }, child.props);
29
30
  childProps.active = index === current;
30
31
 
@@ -9,5 +9,8 @@ export interface StepProps {
9
9
  style?: React.CSSProperties;
10
10
  onClick?: React.MouseEventHandler<HTMLDivElement>;
11
11
  }
12
- declare const Step: (props: StepProps) => JSX.Element;
12
+ declare const Step: {
13
+ (props: StepProps): JSX.Element;
14
+ elementType: string;
15
+ };
13
16
  export default Step;
@@ -28,4 +28,5 @@ const Step = props => {
28
28
  return renderStep();
29
29
  };
30
30
 
31
+ Step.elementType = 'Steps.Step';
31
32
  export default Step;
@@ -192,7 +192,7 @@ export default class TableRow extends BaseComponent {
192
192
  if (level != null && columnIndex === firstIndex) {
193
193
  expandableProps.indent = level;
194
194
 
195
- if (!expandableRow) {
195
+ if (!expandableRow && hideExpandedColumn) {
196
196
  expandableProps.indent = level + 1;
197
197
  }
198
198
  }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare type ModeType = 'left' | 'right' | 'center' | 'alternate';
3
+ export interface TimelineContextValue {
4
+ mode?: ModeType;
5
+ sum?: number;
6
+ }
7
+ declare const Context: React.Context<TimelineContextValue>;
8
+ export default Context;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ const Context = /*#__PURE__*/React.createContext(null);
3
+ export default Context;
@@ -2,12 +2,13 @@ import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
4
4
  import Item, { TimelineItemProps } from './item';
5
+ import { ModeType } from './context';
5
6
  export type { TimelineItemProps } from './item';
6
7
  export interface Data extends TimelineItemProps {
7
8
  content: React.ReactNode;
8
9
  }
9
10
  export interface TimelineProps extends Pick<React.AriaAttributes, 'aria-label'> {
10
- mode?: 'left' | 'right' | 'center' | 'alternate';
11
+ mode?: ModeType;
11
12
  className?: string;
12
13
  style?: React.CSSProperties;
13
14
  dataSource?: Data[];
@@ -5,6 +5,7 @@ import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
5
5
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/timeline/constants';
6
6
  import ConfigContext from '../configProvider/context';
7
7
  import Item from './item';
8
+ import Context from './context';
8
9
  const prefixCls = cssClasses.PREFIX;
9
10
 
10
11
  class Timeline extends PureComponent {
@@ -76,11 +77,15 @@ class Timeline extends PureComponent {
76
77
  }
77
78
 
78
79
  const items = childrenList || this.addClassName(children);
79
- return /*#__PURE__*/React.createElement("ul", {
80
+ return /*#__PURE__*/React.createElement(Context.Provider, {
81
+ value: {
82
+ mode
83
+ }
84
+ }, /*#__PURE__*/React.createElement("ul", {
80
85
  "aria-label": this.props['aria-label'],
81
86
  style: style,
82
87
  className: classString
83
- }, items);
88
+ }, items));
84
89
  }
85
90
 
86
91
  }
@@ -1,6 +1,7 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
4
+ import { ModeType, TimelineContextValue } from './context';
4
5
  export interface TimelineItemProps {
5
6
  color?: string;
6
7
  children?: React.ReactNode;
@@ -12,8 +13,13 @@ export interface TimelineItemProps {
12
13
  className?: string;
13
14
  style?: React.CSSProperties;
14
15
  onClick?: React.MouseEventHandler<HTMLLIElement>;
16
+ mode?: ModeType;
17
+ odd?: boolean;
18
+ usedInC2D?: boolean;
15
19
  }
16
20
  export default class Item extends PureComponent<TimelineItemProps> {
21
+ static contextType: React.Context<TimelineContextValue>;
22
+ static elementType: string;
17
23
  static propTypes: {
18
24
  color: PropTypes.Requireable<string>;
19
25
  time: PropTypes.Requireable<PropTypes.ReactNodeLike>;
@@ -24,11 +30,15 @@ export default class Item extends PureComponent<TimelineItemProps> {
24
30
  className: PropTypes.Requireable<string>;
25
31
  style: PropTypes.Requireable<object>;
26
32
  onClick: PropTypes.Requireable<(...args: any[]) => any>;
33
+ mode: PropTypes.Requireable<string>;
34
+ lastChild: PropTypes.Requireable<boolean>;
27
35
  };
36
+ context: TimelineContextValue;
28
37
  static defaultProps: {
29
38
  type: string;
30
39
  time: string;
31
40
  onClick: (...args: any[]) => void;
32
41
  };
42
+ getC2DCls: () => string;
33
43
  render(): JSX.Element;
34
44
  }
@@ -4,8 +4,42 @@ import cls from 'classnames';
4
4
  import PropTypes from 'prop-types';
5
5
  import { cssClasses, strings } from '@douyinfe/semi-foundation/lib/es/timeline/constants';
6
6
  import '@douyinfe/semi-foundation/lib/es/timeline/timeline.css';
7
+ import Context from './context';
7
8
  const prefixCls = cssClasses.ITEM;
8
9
  export default class Item extends PureComponent {
10
+ constructor() {
11
+ super(...arguments); // getC2DCls is used in C2D, it does not work in non-C2D scenes
12
+
13
+ this.getC2DCls = () => {
14
+ let c2dCls = '';
15
+ const {
16
+ mode,
17
+ odd,
18
+ usedInC2D
19
+ } = this.props;
20
+
21
+ if (usedInC2D) {
22
+ switch (mode) {
23
+ case 'center':
24
+ c2dCls = `${prefixCls}-center ${prefixCls}-left`;
25
+ break;
26
+
27
+ case 'alternate':
28
+ c2dCls = `${prefixCls}-alternate ${prefixCls}-${odd ? 'left' : 'right'}`;
29
+ break;
30
+
31
+ default:
32
+ c2dCls = `${prefixCls}-${mode} ${mode === 'right' ? `${prefixCls}-mode-right` : ''}`;
33
+ break;
34
+ }
35
+
36
+ c2dCls += ` ${prefixCls}-not-last-child`;
37
+ }
38
+
39
+ return c2dCls;
40
+ };
41
+ }
42
+
9
43
  render() {
10
44
  const {
11
45
  className,
@@ -18,7 +52,7 @@ export default class Item extends PureComponent {
18
52
  extra,
19
53
  onClick
20
54
  } = this.props;
21
- const itemCls = cls(prefixCls, className);
55
+ const itemCls = cls(prefixCls, className, this.getC2DCls());
22
56
  const dotCls = cls({
23
57
  [`${prefixCls}-head`]: true,
24
58
  [`${prefixCls}-head-custom`]: dot,
@@ -49,6 +83,7 @@ export default class Item extends PureComponent {
49
83
  }
50
84
 
51
85
  }
86
+ Item.contextType = Context;
52
87
  Item.propTypes = {
53
88
  color: PropTypes.string,
54
89
  time: PropTypes.node,
@@ -58,10 +93,13 @@ Item.propTypes = {
58
93
  position: PropTypes.oneOf(strings.ITEM_POS),
59
94
  className: PropTypes.string,
60
95
  style: PropTypes.object,
61
- onClick: PropTypes.func
96
+ onClick: PropTypes.func,
97
+ mode: PropTypes.string,
98
+ lastChild: PropTypes.bool
62
99
  };
63
100
  Item.defaultProps = {
64
101
  type: 'default',
65
102
  time: '',
66
103
  onClick: _noop
67
- };
104
+ };
105
+ Item.elementType = 'Timeline.Item';
@@ -188,6 +188,8 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
188
188
  renderIcon: () => any;
189
189
  handlePortalInnerClick: (e: React.MouseEvent) => void;
190
190
  handlePortalMouseDown: (e: React.MouseEvent) => void;
191
+ handlePortalFocus: (e: React.FocusEvent<HTMLElement>) => void;
192
+ handlePortalBlur: (e: React.FocusEvent<HTMLElement>) => void;
191
193
  handlePortalInnerKeyDown: (e: React.KeyboardEvent) => void;
192
194
  renderContentNode: (content: TooltipProps['content']) => React.ReactNode;
193
195
  renderPortal: () => JSX.Element;
@@ -143,6 +143,18 @@ export default class Tooltip extends BaseComponent {
143
143
  }
144
144
  };
145
145
 
146
+ this.handlePortalFocus = e => {
147
+ if (this.props.stopPropagation) {
148
+ stopPropagation(e);
149
+ }
150
+ };
151
+
152
+ this.handlePortalBlur = e => {
153
+ if (this.props.stopPropagation) {
154
+ stopPropagation(e);
155
+ }
156
+ };
157
+
146
158
  this.handlePortalInnerKeyDown = e => {
147
159
  this.foundation.handleContainerKeydown(e);
148
160
  };
@@ -240,6 +252,8 @@ export default class Tooltip extends BaseComponent {
240
252
  style: portalInnerStyle,
241
253
  ref: this.setContainerEl,
242
254
  onClick: this.handlePortalInnerClick,
255
+ onFocus: this.handlePortalFocus,
256
+ onBlur: this.handlePortalBlur,
243
257
  onMouseDown: this.handlePortalMouseDown,
244
258
  onKeyDown: this.handlePortalInnerKeyDown
245
259
  }, inner));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.33.0",
3
+ "version": "2.34.0-alpha.1",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -17,12 +17,12 @@
17
17
  "lib/*"
18
18
  ],
19
19
  "dependencies": {
20
- "@douyinfe/semi-animation": "2.33.0",
21
- "@douyinfe/semi-animation-react": "2.33.0",
22
- "@douyinfe/semi-foundation": "2.33.0",
23
- "@douyinfe/semi-icons": "2.33.0",
24
- "@douyinfe/semi-illustrations": "2.33.0",
25
- "@douyinfe/semi-theme-default": "2.33.0",
20
+ "@douyinfe/semi-animation": "2.34.0-alpha.1",
21
+ "@douyinfe/semi-animation-react": "2.34.0-alpha.1",
22
+ "@douyinfe/semi-foundation": "2.34.0-alpha.1",
23
+ "@douyinfe/semi-icons": "2.34.0-alpha.1",
24
+ "@douyinfe/semi-illustrations": "2.34.0-alpha.1",
25
+ "@douyinfe/semi-theme-default": "2.34.0-alpha.1",
26
26
  "async-validator": "^3.5.0",
27
27
  "classnames": "^2.2.6",
28
28
  "copy-text-to-clipboard": "^2.1.1",
@@ -69,7 +69,7 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "0fdea7209b852a6d18f2139013d2da13dc111244",
72
+ "gitHead": "8990c51afec33fcfc2f89234082597e484513756",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",