@canlooks/can-ui 0.0.169 → 0.0.171
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/dist/cjs/components/transfer/transfer.style.d.ts +1 -1
- package/dist/cjs/components/transitionBase/transitionBase.js +7 -5
- package/dist/cjs/components/transitionBase/transitionBase.style.js +5 -13
- package/dist/esm/components/transfer/transfer.style.d.ts +1 -1
- package/dist/esm/components/transitionBase/transitionBase.js +9 -7
- package/dist/esm/components/transitionBase/transitionBase.style.js +5 -13
- package/package.json +1 -1
|
@@ -25,10 +25,12 @@ exports.TransitionBase = (({ ref, component: Component = 'div', orientation = 'v
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
const innerRef = (0, react_1.useRef)(null);
|
|
28
|
-
const
|
|
29
|
-
(0,
|
|
30
|
-
|
|
28
|
+
const firstOpenChanged = (0, react_1.useRef)(false);
|
|
29
|
+
(0, utils_1.useUpdateEffect)(() => {
|
|
30
|
+
firstOpenChanged.current = true;
|
|
31
31
|
}, [props.in]);
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
33
|
+
!firstOpenChanged.current && !props.in && innerRef.current?.classList.add('exit-done');
|
|
34
|
+
}, [props.in]);
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(react_transition_group_1.CSSTransition, { ...props, css: cssArr, className: (0, utils_1.clsx)(transitionBase_style_1.classes.root, props.className), nodeRef: innerRef, timeout: timeout, appear: appear, children: (0, jsx_runtime_1.jsx)(Component, { ref: (0, utils_1.cloneRef)(ref, innerRef), children: props.children }) }));
|
|
34
36
|
});
|
|
@@ -30,6 +30,9 @@ function useTransitionBaseStyle({ timeout }) {
|
|
|
30
30
|
}
|
|
31
31
|
exports.fadeStyle = (0, utils_1.defineCss)(({ easing }) => (0, react_1.css) `
|
|
32
32
|
@layer reset {
|
|
33
|
+
transition-property: opacity, transform, width, height;
|
|
34
|
+
transition-timing-function: ${easing.easeOut}, ${easing.bounce}, ${easing.bounce}, ${easing.bounce};
|
|
35
|
+
|
|
33
36
|
&.appear,
|
|
34
37
|
&.exit,
|
|
35
38
|
&.exit-done {
|
|
@@ -42,10 +45,7 @@ exports.fadeStyle = (0, utils_1.defineCss)(({ easing }) => (0, react_1.css) `
|
|
|
42
45
|
opacity: 1;
|
|
43
46
|
}
|
|
44
47
|
|
|
45
|
-
&.
|
|
46
|
-
&.enter-active,
|
|
47
|
-
&.exit-active {
|
|
48
|
-
transition-property: opacity;
|
|
48
|
+
&.exit {
|
|
49
49
|
transition-timing-function: ${easing.easeOut};
|
|
50
50
|
}
|
|
51
51
|
}
|
|
@@ -76,12 +76,10 @@ function useGrowAndCollapseStyle({ orientation, _mode }) {
|
|
|
76
76
|
: orientation === 'vertical'
|
|
77
77
|
? 'scaleY'
|
|
78
78
|
: 'scaleX';
|
|
79
|
-
return (0, utils_1.useCss)(() => (0, react_1.css) `
|
|
79
|
+
return (0, utils_1.useCss)(({ easing }) => (0, react_1.css) `
|
|
80
80
|
@layer reset {
|
|
81
81
|
${_mode === 'collapse' ? `transform-origin: ${orientation === 'vertical' ? 'top' : 'left'};` : ''}
|
|
82
82
|
|
|
83
|
-
transition-property: opacity, transform;
|
|
84
|
-
|
|
85
83
|
&.appear,
|
|
86
84
|
&.exit,
|
|
87
85
|
&.exit-done {
|
|
@@ -93,12 +91,6 @@ function useGrowAndCollapseStyle({ orientation, _mode }) {
|
|
|
93
91
|
&.enter-done {
|
|
94
92
|
transform: scale(1);
|
|
95
93
|
}
|
|
96
|
-
|
|
97
|
-
&.appear-active,
|
|
98
|
-
&.enter-active,
|
|
99
|
-
&.exit-active {
|
|
100
|
-
transition-property: opacity, transform;
|
|
101
|
-
}
|
|
102
94
|
}
|
|
103
95
|
`, [orientation, _mode]);
|
|
104
96
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useLayoutEffect, 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,12 @@ export const TransitionBase = (({ ref, component: Component = 'div', orientation
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
const innerRef = useRef(null);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const firstOpenChanged = useRef(false);
|
|
26
|
+
useUpdateEffect(() => {
|
|
27
|
+
firstOpenChanged.current = true;
|
|
28
28
|
}, [props.in]);
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
useLayoutEffect(() => {
|
|
30
|
+
!firstOpenChanged.current && !props.in && innerRef.current?.classList.add('exit-done');
|
|
31
|
+
}, [props.in]);
|
|
32
|
+
return (_jsx(CSSTransition, { ...props, css: cssArr, className: clsx(classes.root, props.className), nodeRef: innerRef, timeout: timeout, appear: appear, children: _jsx(Component, { ref: cloneRef(ref, innerRef), children: props.children }) }));
|
|
31
33
|
});
|
|
@@ -23,6 +23,9 @@ export function useTransitionBaseStyle({ timeout }) {
|
|
|
23
23
|
}
|
|
24
24
|
export const fadeStyle = defineCss(({ easing }) => css `
|
|
25
25
|
@layer reset {
|
|
26
|
+
transition-property: opacity, transform, width, height;
|
|
27
|
+
transition-timing-function: ${easing.easeOut}, ${easing.bounce}, ${easing.bounce}, ${easing.bounce};
|
|
28
|
+
|
|
26
29
|
&.appear,
|
|
27
30
|
&.exit,
|
|
28
31
|
&.exit-done {
|
|
@@ -35,10 +38,7 @@ export const fadeStyle = defineCss(({ easing }) => css `
|
|
|
35
38
|
opacity: 1;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
&.
|
|
39
|
-
&.enter-active,
|
|
40
|
-
&.exit-active {
|
|
41
|
-
transition-property: opacity;
|
|
41
|
+
&.exit {
|
|
42
42
|
transition-timing-function: ${easing.easeOut};
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -69,12 +69,10 @@ export function useGrowAndCollapseStyle({ orientation, _mode }) {
|
|
|
69
69
|
: orientation === 'vertical'
|
|
70
70
|
? 'scaleY'
|
|
71
71
|
: 'scaleX';
|
|
72
|
-
return useCss(() => css `
|
|
72
|
+
return useCss(({ easing }) => css `
|
|
73
73
|
@layer reset {
|
|
74
74
|
${_mode === 'collapse' ? `transform-origin: ${orientation === 'vertical' ? 'top' : 'left'};` : ''}
|
|
75
75
|
|
|
76
|
-
transition-property: opacity, transform;
|
|
77
|
-
|
|
78
76
|
&.appear,
|
|
79
77
|
&.exit,
|
|
80
78
|
&.exit-done {
|
|
@@ -86,12 +84,6 @@ export function useGrowAndCollapseStyle({ orientation, _mode }) {
|
|
|
86
84
|
&.enter-done {
|
|
87
85
|
transform: scale(1);
|
|
88
86
|
}
|
|
89
|
-
|
|
90
|
-
&.appear-active,
|
|
91
|
-
&.enter-active,
|
|
92
|
-
&.exit-active {
|
|
93
|
-
transition-property: opacity, transform;
|
|
94
|
-
}
|
|
95
87
|
}
|
|
96
88
|
`, [orientation, _mode]);
|
|
97
89
|
}
|