@douyinfe/semi-ui 2.12.0-beta.0 → 2.12.0-beta.3

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.
@@ -31,12 +31,15 @@ const TooltipTransition = function () {
31
31
  const {
32
32
  children
33
33
  } = props;
34
- const motion = (0, _getMotionObjFromProps.default)(props);
34
+ const motion = (0, _getMotionObjFromProps.default)(props); // add fillMode forward to fix issue 715, tooltip close will flashing under react 18
35
+
35
36
  return /*#__PURE__*/_react.default.createElement(_semiAnimationReact.StyledTransition, (0, _assign.default)({}, props, {
36
37
  enter: enterCls,
37
38
  leave: leaveCls,
38
39
  duration: '100ms'
39
- }, motion), typeof children === 'function' ? _ref => {
40
+ }, motion, {
41
+ fillMode: 'forward'
42
+ }), typeof children === 'function' ? _ref => {
40
43
  let {
41
44
  animateCls,
42
45
  animateEvents,
@@ -15,12 +15,15 @@ const TooltipTransition = function () {
15
15
  const {
16
16
  children
17
17
  } = props;
18
- const motion = getMotionObjFromProps(props);
18
+ const motion = getMotionObjFromProps(props); // add fillMode forward to fix issue 715, tooltip close will flashing under react 18
19
+
19
20
  return /*#__PURE__*/React.createElement(StyledTransition, _Object$assign({}, props, {
20
21
  enter: enterCls,
21
22
  leave: leaveCls,
22
23
  duration: '100ms'
23
- }, motion), typeof children === 'function' ? _ref => {
24
+ }, motion, {
25
+ fillMode: 'forward'
26
+ }), typeof children === 'function' ? _ref => {
24
27
  let {
25
28
  animateCls,
26
29
  animateEvents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-ui",
3
- "version": "2.12.0-beta.0",
3
+ "version": "2.12.0-beta.3",
4
4
  "description": "",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es/index.js",
@@ -14,12 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/runtime-corejs3": "^7.15.4",
17
- "@douyinfe/semi-animation": "2.12.0-beta.0",
18
- "@douyinfe/semi-animation-react": "2.12.0-beta.0",
19
- "@douyinfe/semi-foundation": "2.12.0-beta.0",
20
- "@douyinfe/semi-icons": "2.12.0-beta.0",
21
- "@douyinfe/semi-illustrations": "2.12.0-beta.0",
22
- "@douyinfe/semi-theme-default": "2.12.0-beta.0",
17
+ "@douyinfe/semi-animation": "2.12.0-beta.3",
18
+ "@douyinfe/semi-animation-react": "2.12.0-beta.3",
19
+ "@douyinfe/semi-foundation": "2.12.0-beta.3",
20
+ "@douyinfe/semi-icons": "2.12.0-beta.3",
21
+ "@douyinfe/semi-illustrations": "2.12.0-beta.3",
22
+ "@douyinfe/semi-theme-default": "2.12.0-beta.3",
23
23
  "@types/react-window": "^1.8.2",
24
24
  "async-validator": "^3.5.0",
25
25
  "classnames": "^2.2.6",
@@ -69,13 +69,13 @@
69
69
  ],
70
70
  "author": "",
71
71
  "license": "MIT",
72
- "gitHead": "4bd8555c299b9e9b5984969d9477ab47b19f4bd1",
72
+ "gitHead": "7805b163ebe4eb859b6cd31946c58617356aab91",
73
73
  "devDependencies": {
74
74
  "@babel/plugin-proposal-decorators": "^7.15.8",
75
75
  "@babel/plugin-transform-runtime": "^7.15.8",
76
76
  "@babel/preset-env": "^7.15.8",
77
77
  "@babel/preset-react": "^7.14.5",
78
- "@douyinfe/semi-scss-compile": "2.12.0-beta.0",
78
+ "@douyinfe/semi-scss-compile": "2.12.0-beta.3",
79
79
  "@storybook/addon-knobs": "^6.3.1",
80
80
  "@types/lodash": "^4.14.176",
81
81
  "babel-loader": "^8.2.2",
@@ -18,8 +18,9 @@ const TooltipTransition: React.FC<TooltipTransitionProps> = (props = {}) => {
18
18
  const { children } = props;
19
19
  const motion = getMotionObjFromProps(props);
20
20
 
21
+ // add fillMode forward to fix issue 715, tooltip close will flashing under react 18
21
22
  return (
22
- <StyledTransition {...props} enter={enterCls} leave={leaveCls} duration={'100ms'} {...motion}>
23
+ <StyledTransition {...props} enter={enterCls} leave={leaveCls} duration={'100ms'} {...motion} fillMode='forward'>
23
24
  {typeof children === 'function' ?
24
25
  ({ animateCls, animateEvents, animateStyle }: any) => children({ animateCls, animateEvents, animateStyle }) :
25
26
  children}
@@ -24,6 +24,7 @@ import ArrowPointAtCenter from './ArrowPointAtCenter';
24
24
  import CustomContainer from './CustomContainer';
25
25
  import ContainerPosition from './ContainerPosition';
26
26
  import { IconList, IconSidebar, IconEdit } from '@douyinfe/semi-icons';
27
+ import TooltipTransition from '../TooltipStyledTransition';
27
28
 
28
29
  export default {
29
30
  title: 'Tooltip',
@@ -1007,3 +1008,92 @@ export const autoFocusContentDemo = () => {
1007
1008
  </div>
1008
1009
  );
1009
1010
  };
1011
+
1012
+
1013
+ export const FlashWithReact18 = () => {
1014
+ const [visible, setV] = useState(false);
1015
+
1016
+ const change = () => {
1017
+ setV(false);
1018
+ }
1019
+
1020
+ return (<>
1021
+ <Tooltip content='test work with react 18' position='bottom' trigger='custom' visible={visible}>
1022
+ <Button style={{ marginLeft: 10 }} onClick={() => setV(true)}>show, semi with react 18 motion=true, abnormal</Button>
1023
+ </Tooltip>
1024
+ <Button style={{ marginLeft: 10 }} onClick={() => change()}>hide</Button>
1025
+
1026
+ </>);
1027
+ }
1028
+
1029
+
1030
+
1031
+
1032
+ export const Transition = () => {
1033
+
1034
+ const [transitionState, setT] = useState('');
1035
+
1036
+ const [insert, setInsert] = useState(false);
1037
+
1038
+ const handleLeave = () => {
1039
+ console.log('set insert false')
1040
+ setInsert(false);
1041
+ }
1042
+
1043
+ const CommonDOM = () => {
1044
+ const enterCls = `semi-tooltip-bounceIn`;
1045
+ const leaveCls = `semi-tooltip-zoomOut`;
1046
+ const animateStyle = {
1047
+ animationDirection: 'normal',
1048
+ animationName: transitionState === 'enter' ? enterCls : leaveCls,
1049
+ animationDuration: '1000ms',
1050
+ }
1051
+
1052
+ const handleEnd = () => {
1053
+ if (transitionState === 'enter') {
1054
+ console.log('animation end of show');
1055
+ } else if (transitionState === 'leave') {
1056
+ console.log('animation end of hide');
1057
+ handleLeave();
1058
+ }
1059
+ }
1060
+
1061
+ return <div style={{ ...animateStyle }} onAnimationEnd={handleEnd}>test</div>
1062
+ };
1063
+
1064
+ const toggleShow = (insert) => {
1065
+ if (!transitionState) {
1066
+ setT('enter');
1067
+ setInsert(insert);
1068
+ } else if (transitionState === 'enter') {
1069
+ setT('leave');
1070
+ } else if (transitionState === 'leave') {
1071
+ setT('enter');
1072
+ setInsert(insert);
1073
+ }
1074
+ };
1075
+
1076
+ return (
1077
+ <>
1078
+ <div style={{ width: 200, height: 90, border: '1px solid var(--semi-color-text-1)' }}>
1079
+ {
1080
+ insert ? (
1081
+ <CommonDOM></CommonDOM>
1082
+ ): null
1083
+ }
1084
+ </div>
1085
+ <Button onClick={() => toggleShow(true)}>show</Button>
1086
+ <Button onClick={() => toggleShow(false)}>hide</Button>
1087
+ </>
1088
+ )
1089
+ }
1090
+
1091
+ export const TransitionDemo = () => {
1092
+ const [key, setKey] = useState(1);
1093
+ return (
1094
+ <>
1095
+ <Transition key={key} />
1096
+ <Button onClick={() => setKey(Math.random())}>reset Demo</Button>
1097
+ </>
1098
+ )
1099
+ }