@canlooks/can-ui 0.0.169 → 0.0.170

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.
@@ -25,10 +25,10 @@ exports.TransitionBase = (({ ref, component: Component = 'div', orientation = 'v
25
25
  }
26
26
  }
27
27
  const innerRef = (0, react_1.useRef)(null);
28
- const initialized = (0, react_1.useRef)(false);
29
- (0, react_1.useEffect)(() => {
30
- initialized.current = true;
28
+ const firstOpenChanged = (0, react_1.useRef)(false);
29
+ (0, utils_1.useUpdateEffect)(() => {
30
+ firstOpenChanged.current = true;
31
31
  }, [props.in]);
32
- const unInitClass = !initialized.current && !props.in && 'exit-done';
32
+ const unInitClass = !firstOpenChanged.current && !props.in && 'exit-done';
33
33
  return ((0, jsx_runtime_1.jsx)(react_transition_group_1.CSSTransition, { ...props, css: cssArr, nodeRef: innerRef, className: (0, utils_1.clsx)(transitionBase_style_1.classes.root, props.className, unInitClass), timeout: timeout, appear: appear, children: (0, jsx_runtime_1.jsx)(Component, { ref: (0, utils_1.cloneRef)(ref, innerRef), children: props.children }) }));
34
34
  });
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
- import { useEffect, useRef } from 'react';
2
+ import { useRef } from 'react';
3
3
  import { CSSTransition } from 'react-transition-group';
4
4
  import { classes, fadeStyle, useGrowAndCollapseStyle, useSlideStyle, useSweepingStyle, useTransitionBaseStyle } from './transitionBase.style.js';
5
- import { clsx, cloneRef } from '../../utils/index.js';
5
+ import { clsx, cloneRef, useUpdateEffect } from '../../utils/index.js';
6
6
  export const TransitionBase = (({ ref, component: Component = 'div', orientation = 'vertical', direction = 'down', offset = '100%', timeout = 300, appear = true, _mode, ...props }) => {
7
7
  const cssArr = [
8
8
  useTransitionBaseStyle({ timeout })
@@ -22,10 +22,10 @@ export const TransitionBase = (({ ref, component: Component = 'div', orientation
22
22
  }
23
23
  }
24
24
  const innerRef = useRef(null);
25
- const initialized = useRef(false);
26
- useEffect(() => {
27
- initialized.current = true;
25
+ const firstOpenChanged = useRef(false);
26
+ useUpdateEffect(() => {
27
+ firstOpenChanged.current = true;
28
28
  }, [props.in]);
29
- const unInitClass = !initialized.current && !props.in && 'exit-done';
29
+ const unInitClass = !firstOpenChanged.current && !props.in && 'exit-done';
30
30
  return (_jsx(CSSTransition, { ...props, css: cssArr, nodeRef: innerRef, className: clsx(classes.root, props.className, unInitClass), timeout: timeout, appear: appear, children: _jsx(Component, { ref: cloneRef(ref, innerRef), children: props.children }) }));
31
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.169",
3
+ "version": "0.0.170",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",