@bitrise/bitkit 9.28.3-alpha-react18.1 → 9.30.0-alpha-chakra.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/package.json +39 -36
- package/src/Components/ButtonGroup/ButtonGroup.stories.tsx +1 -1
- package/src/Components/Dialog/Dialog.tsx +1 -2
- package/src/Components/Dot/Dot.stories.tsx +15 -0
- package/src/Components/Dot/Dot.tsx +14 -0
- package/src/Components/Menu/Menu.tsx +1 -1
- package/src/Components/Transitions/Fade.stories.tsx +26 -0
- package/src/Components/Transitions/Fade.tsx +12 -0
- package/src/Foundations/Breakpoints/Breakpoints.ts +3 -9
- package/src/Old/Appear/Appear.css +116 -0
- package/src/Old/Appear/Appear.tsx +74 -0
- package/src/Old/Placement/PlacementPopper.tsx +17 -2
- package/src/index.ts +5 -1
- package/src/old.ts +4 -3
- package/src/tsconfig.tsbuildinfo +1 -1
- package/src/Old/Dot/Dot.css +0 -3
- package/src/Old/Dot/Dot.tsx +0 -19
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitrise/bitkit",
|
|
3
3
|
"description": "Bitrise React component library",
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.30.0-alpha-chakra.1",
|
|
5
5
|
"repository": "git@github.com:bitrise-io/bitkit.git",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -33,28 +33,30 @@
|
|
|
33
33
|
"framer-motion": "./node_modules/framer-motion/dist/cjs"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@chakra-ui/react": "^
|
|
37
|
-
"@emotion/react": "^11.9.
|
|
38
|
-
"@emotion/styled": "^11.
|
|
36
|
+
"@chakra-ui/react": "^1.8.8",
|
|
37
|
+
"@emotion/react": "^11.9.0",
|
|
38
|
+
"@emotion/styled": "^11.8.1",
|
|
39
39
|
"@juggle/resize-observer": "^3.3.1",
|
|
40
40
|
"@popperjs/core": "^2.11.5",
|
|
41
|
+
"@types/react-transition-group": "^4.4.4",
|
|
41
42
|
"classnames": "^2.3.1",
|
|
42
43
|
"clipboard": "^2.0.11",
|
|
43
|
-
"framer-motion": "^6.3.
|
|
44
|
+
"framer-motion": "^6.3.4",
|
|
44
45
|
"luxon": "^2.4.0",
|
|
45
|
-
"react": "^
|
|
46
|
-
"react-dom": "^
|
|
47
|
-
"react-popper": "^2.3.0"
|
|
46
|
+
"react": "^17.0.2",
|
|
47
|
+
"react-dom": "^17.0.2",
|
|
48
|
+
"react-popper": "^2.3.0",
|
|
49
|
+
"react-transition-group": "^4.4.2"
|
|
48
50
|
},
|
|
49
51
|
"peerDependencies": {
|
|
50
|
-
"react": "^
|
|
51
|
-
"react-dom": "^
|
|
52
|
+
"react": "^17.0.2",
|
|
53
|
+
"react-dom": "^17.0.2"
|
|
52
54
|
},
|
|
53
55
|
"devDependencies": {
|
|
54
|
-
"@babel/core": "^7.18.
|
|
55
|
-
"@babel/parser": "^7.18.
|
|
56
|
-
"@bitrise/eslint-plugin": "
|
|
57
|
-
"@chakra-ui/cli": "^
|
|
56
|
+
"@babel/core": "^7.18.2",
|
|
57
|
+
"@babel/parser": "^7.18.2",
|
|
58
|
+
"@bitrise/eslint-plugin": "2.2.0",
|
|
59
|
+
"@chakra-ui/cli": "^1.9.0",
|
|
58
60
|
"@chakra-ui/storybook-addon": "^1.0.3",
|
|
59
61
|
"@commitlint/cli": "^16.3.0",
|
|
60
62
|
"@commitlint/config-conventional": "^16.2.4",
|
|
@@ -83,30 +85,31 @@
|
|
|
83
85
|
"@types/lodash.shuffle": "^4.2.7",
|
|
84
86
|
"@types/luxon": "^2.3.2",
|
|
85
87
|
"@types/prismjs": "^1.26.0",
|
|
86
|
-
"@types/react": "
|
|
87
|
-
"@types/react-dom": "^
|
|
88
|
+
"@types/react": "17.0.44",
|
|
89
|
+
"@types/react-dom": "^17.0.16",
|
|
88
90
|
"@types/react-router": "^5.1.18",
|
|
89
91
|
"@types/react-router-dom": "^5.3.3",
|
|
92
|
+
"@types/react-transition-group": "^4.4.4",
|
|
90
93
|
"@types/vfile-message": "^2.0.0",
|
|
91
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
92
|
-
"@typescript-eslint/parser": "^5.
|
|
94
|
+
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
|
95
|
+
"@typescript-eslint/parser": "^5.26.0",
|
|
93
96
|
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
|
|
94
97
|
"axios": "^0.27.2",
|
|
95
98
|
"babel-eslint": "^10.0.1",
|
|
96
99
|
"babel-loader": "^8.2.5",
|
|
97
100
|
"babel-plugin-polyfill-corejs2": "^0.3.1",
|
|
98
|
-
"concurrently": "^7.2.
|
|
101
|
+
"concurrently": "^7.2.1",
|
|
99
102
|
"enzyme": "^3.11.0",
|
|
100
103
|
"enzyme-to-json": "^3.6.2",
|
|
101
|
-
"esbuild": "^0.14.
|
|
102
|
-
"eslint": "^8.
|
|
104
|
+
"esbuild": "^0.14.43",
|
|
105
|
+
"eslint": "^8.16.0",
|
|
103
106
|
"eslint-plugin-import": "^2.26.0",
|
|
104
|
-
"eslint-plugin-jest": "^26.5
|
|
105
|
-
"eslint-plugin-jsx-a11y": "^6.
|
|
106
|
-
"eslint-plugin-prettier": "^4.
|
|
107
|
-
"eslint-plugin-react": "^7.30.
|
|
108
|
-
"eslint-plugin-react-hooks": "^4.
|
|
109
|
-
"eslint-plugin-storybook": "^0.5.
|
|
107
|
+
"eslint-plugin-jest": "^26.4.5",
|
|
108
|
+
"eslint-plugin-jsx-a11y": "^6.5.1",
|
|
109
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
110
|
+
"eslint-plugin-react": "^7.30.0",
|
|
111
|
+
"eslint-plugin-react-hooks": "^4.5.0",
|
|
112
|
+
"eslint-plugin-storybook": "^0.5.12",
|
|
110
113
|
"eslint-plugin-testing-library": "^5.5.1",
|
|
111
114
|
"fscreen": "^1.2.0",
|
|
112
115
|
"glob": "^8.0.3",
|
|
@@ -117,21 +120,21 @@
|
|
|
117
120
|
"lodash.sample": "^4.2.1",
|
|
118
121
|
"lodash.shuffle": "^4.2.0",
|
|
119
122
|
"node-watch": "^0.7.3",
|
|
120
|
-
"prettier": "^2.
|
|
123
|
+
"prettier": "^2.6.2",
|
|
121
124
|
"prismjs": "^1.28.0",
|
|
122
|
-
"react": "^
|
|
123
|
-
"react-docgen": "5.4.
|
|
124
|
-
"react-dom": "^
|
|
125
|
+
"react": "^17.0.2",
|
|
126
|
+
"react-docgen": "5.4.0",
|
|
127
|
+
"react-dom": "^17.0.2",
|
|
125
128
|
"react-router": "^5.3.1",
|
|
126
129
|
"react-router-dom": "^5.3.1",
|
|
127
130
|
"recast": "^0.21.1",
|
|
128
|
-
"semantic-release": "^19.0.
|
|
131
|
+
"semantic-release": "^19.0.2",
|
|
129
132
|
"superstatic": "^8.0.0",
|
|
130
133
|
"ts-jest": "^27.1.5",
|
|
131
|
-
"ts-node": "^10.8.
|
|
134
|
+
"ts-node": "^10.8.0",
|
|
132
135
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
133
|
-
"typescript": "^4.
|
|
134
|
-
"webpack": "^5.
|
|
136
|
+
"typescript": "^4.6.4",
|
|
137
|
+
"webpack": "^5.72.1"
|
|
135
138
|
},
|
|
136
139
|
"files": [
|
|
137
140
|
"src",
|
|
@@ -154,7 +157,7 @@
|
|
|
154
157
|
},
|
|
155
158
|
"resolutions": {
|
|
156
159
|
"**/ast-types": "npm:@gkz/ast-types",
|
|
157
|
-
"ts-node": "^10.8.
|
|
160
|
+
"ts-node": "^10.8.0",
|
|
158
161
|
"@types/react": "17.0.40"
|
|
159
162
|
}
|
|
160
163
|
}
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
} as ComponentMeta<typeof ButtonGroup>;
|
|
8
8
|
|
|
9
9
|
const Template: ComponentStory<typeof ButtonGroup> = (props) => (
|
|
10
|
-
<ButtonGroup {...props} width="900px" flexDirection="
|
|
10
|
+
<ButtonGroup {...props} width="900px" flexDirection="column">
|
|
11
11
|
<Button>Button 1</Button>
|
|
12
12
|
<Button>Button 2</Button>
|
|
13
13
|
<Button>Button 3</Button>
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
useBreakpointValue,
|
|
9
9
|
useDisclosure,
|
|
10
10
|
} from '@chakra-ui/react';
|
|
11
|
-
import { BREAKPOINTS } from '../../Foundations/Breakpoints/Breakpoints';
|
|
12
11
|
import Icon from '../Icon/Icon';
|
|
13
12
|
import Text from '../Text/Text';
|
|
14
13
|
|
|
@@ -35,7 +34,7 @@ export interface DialogProps {
|
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
const Dialog = ({ children, dataTestid, state, size, title }: DialogProps) => {
|
|
38
|
-
const dialogSize = useBreakpointValue({
|
|
37
|
+
const dialogSize = useBreakpointValue({ mobile: 'full', desktop: size });
|
|
39
38
|
return (
|
|
40
39
|
<Modal closeOnOverlayClick={false} isOpen={state.isOpen} onClose={state.onClose} size={dialogSize}>
|
|
41
40
|
<ModalOverlay />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import Dot from './Dot';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/Dot',
|
|
6
|
+
component: Dot,
|
|
7
|
+
} as ComponentMeta<typeof Dot>;
|
|
8
|
+
|
|
9
|
+
const Template: ComponentStory<typeof Dot> = ({ ...props }) => <Dot {...props} />;
|
|
10
|
+
|
|
11
|
+
export const WithProps = Template.bind({});
|
|
12
|
+
WithProps.args = {
|
|
13
|
+
size: 32,
|
|
14
|
+
backgroundColor: 'green.50',
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BoxProps, forwardRef } from '@chakra-ui/react';
|
|
2
|
+
import Box from '../Box/Box';
|
|
3
|
+
|
|
4
|
+
export interface DotProps extends BoxProps {
|
|
5
|
+
size: BoxProps['width'];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Dot = forwardRef<DotProps, 'div'>((props, ref) => {
|
|
9
|
+
const { size, ...rest } = props;
|
|
10
|
+
|
|
11
|
+
return <Box ref={ref} width={size} height={size} borderRadius="50%" aria-hidden {...rest} />;
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export default Dot;
|
|
@@ -2,6 +2,6 @@ import { Menu as ChakraMenu, MenuProps as ChakraMenuProps } from '@chakra-ui/rea
|
|
|
2
2
|
|
|
3
3
|
export type MenuProps = ChakraMenuProps;
|
|
4
4
|
|
|
5
|
-
const Menu = (props: MenuProps) => <ChakraMenu {...props} />;
|
|
5
|
+
const Menu = (props: MenuProps) => <ChakraMenu matchWidth {...props} />;
|
|
6
6
|
|
|
7
7
|
export default Menu;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
+
import { useDisclosure } from '@chakra-ui/react';
|
|
3
|
+
import Button from '../Button/Button';
|
|
4
|
+
import Box from '../Box/Box';
|
|
5
|
+
import Fade from './Fade';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Components/Fade',
|
|
9
|
+
component: Fade,
|
|
10
|
+
} as ComponentMeta<typeof Fade>;
|
|
11
|
+
|
|
12
|
+
export const WithProps: ComponentStory<typeof Fade> = (props) => {
|
|
13
|
+
const { isOpen, onToggle } = useDisclosure();
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<Box height="200">
|
|
17
|
+
<Button onClick={onToggle}>Toggle fade transition</Button>
|
|
18
|
+
|
|
19
|
+
<Fade in={isOpen} {...props}>
|
|
20
|
+
<Box p="32" color="neutral.10" mt="4" bg="neutral.90">
|
|
21
|
+
Fade
|
|
22
|
+
</Box>
|
|
23
|
+
</Fade>
|
|
24
|
+
</Box>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fade as ChakraFade, FadeProps, forwardRef } from '@chakra-ui/react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Fade is a transition component
|
|
5
|
+
*/
|
|
6
|
+
const Fade = forwardRef<FadeProps, 'div'>((props, ref) => {
|
|
7
|
+
return <ChakraFade {...props} ref={ref} />;
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export type { FadeProps };
|
|
11
|
+
|
|
12
|
+
export default Fade;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
export const BREAKPOINTS = {
|
|
2
|
-
MOBILE: 'base',
|
|
3
|
-
DESKTOP: 'desktop',
|
|
4
|
-
WIDE: 'wide',
|
|
5
|
-
};
|
|
6
|
-
|
|
7
1
|
const breakpoints = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
mobile: '0rem',
|
|
3
|
+
desktop: '53rem', // 848px
|
|
4
|
+
wide: '101rem', // 1616px
|
|
11
5
|
};
|
|
12
6
|
|
|
13
7
|
export default breakpoints;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
.Appear {
|
|
2
|
+
animation-timing-function: var(--transition-timing-function);
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.Appear--fast {
|
|
6
|
+
transition-duration: var(--transition-duration--fast);
|
|
7
|
+
animation-duration: var(--transition-duration--fast);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.Appear--base {
|
|
11
|
+
transition-duration: var(--transition-duration--base);
|
|
12
|
+
animation-duration: var(--transition-duration--base);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.Appear--slow {
|
|
16
|
+
transition-duration: var(--transition-duration--slow);
|
|
17
|
+
animation-duration: var(--transition-duration--slow);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.Appear--Fade {
|
|
21
|
+
opacity: 0;
|
|
22
|
+
transition-property: opacity;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.Appear--Fade-appear-active,
|
|
26
|
+
.Appear--Fade-appear-done,
|
|
27
|
+
.Appear--Fade-enter-active,
|
|
28
|
+
.Appear--Fade-enter-done,
|
|
29
|
+
.Appear--Fade-exit {
|
|
30
|
+
opacity: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.Appear--Fade-appear,
|
|
34
|
+
.Appear--Fade-enter,
|
|
35
|
+
.Appear--Fade-exit-active,
|
|
36
|
+
.Appear--Fade-exit-done {
|
|
37
|
+
opacity: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.Appear--FadeSlideDown,
|
|
41
|
+
.Appear--FadeSlideUp {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
transition-property: transform, opacity;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.Appear--FadeSlideUp { transform: translateY(var(--size--x4)); }
|
|
47
|
+
.Appear--FadeSlideDown { transform: translateY(calc(var(--size--x4) * -1)); }
|
|
48
|
+
|
|
49
|
+
.Appear--FadeSlideDown-appear-active,
|
|
50
|
+
.Appear--FadeSlideDown-appear-done,
|
|
51
|
+
.Appear--FadeSlideDown-enter-active,
|
|
52
|
+
.Appear--FadeSlideDown-enter-done,
|
|
53
|
+
.Appear--FadeSlideDown-exit,
|
|
54
|
+
.Appear--FadeSlideUp-appear-active,
|
|
55
|
+
.Appear--FadeSlideUp-appear-done,
|
|
56
|
+
.Appear--FadeSlideUp-enter-active,
|
|
57
|
+
.Appear--FadeSlideUp-enter-done,
|
|
58
|
+
.Appear--FadeSlideUp-exit {
|
|
59
|
+
transform: translateY(0);
|
|
60
|
+
opacity: 1;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.Appear--FadeSlideDown-appear,
|
|
64
|
+
.Appear--FadeSlideDown-enter,
|
|
65
|
+
.Appear--FadeSlideDown-exit-active,
|
|
66
|
+
.Appear--FadeSlideDown-exit-done {
|
|
67
|
+
transform: translateY(calc(var(--size--x4) * -1));
|
|
68
|
+
opacity: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.Appear--FadeSlideUp-appear,
|
|
72
|
+
.Appear--FadeSlideUp-enter,
|
|
73
|
+
.Appear--FadeSlideUp-exit-active,
|
|
74
|
+
.Appear--FadeSlideUp-exit-done {
|
|
75
|
+
transform: translateY(var(--size--x4));
|
|
76
|
+
opacity: 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.Appear--FadeSlideRight,
|
|
80
|
+
.Appear--FadeSlideLeft {
|
|
81
|
+
opacity: 0;
|
|
82
|
+
transition-property: transform, opacity;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.Appear--FadeSlideRight { transform: translateX(calc(var(--size--x4) * -1)); }
|
|
86
|
+
.Appear--FadeSlideLeft { transform: translateX(var(--size--x4)); }
|
|
87
|
+
|
|
88
|
+
.Appear--FadeSlideRight-appear-active,
|
|
89
|
+
.Appear--FadeSlideRight-appear-done,
|
|
90
|
+
.Appear--FadeSlideRight-enter-active,
|
|
91
|
+
.Appear--FadeSlideRight-enter-done,
|
|
92
|
+
.Appear--FadeSlideRight-exit,
|
|
93
|
+
.Appear--FadeSlideLeft-appear-active,
|
|
94
|
+
.Appear--FadeSlideLeft-appear-done,
|
|
95
|
+
.Appear--FadeSlideLeft-enter-active,
|
|
96
|
+
.Appear--FadeSlideLeft-enter-done,
|
|
97
|
+
.Appear--FadeSlideLeft-exit {
|
|
98
|
+
transform: translateX(0);
|
|
99
|
+
opacity: 1;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.Appear--FadeSlideRight-appear,
|
|
103
|
+
.Appear--FadeSlideRight-enter,
|
|
104
|
+
.Appear--FadeSlideRight-exit-active,
|
|
105
|
+
.Appear--FadeSlideRight-exit-done {
|
|
106
|
+
transform: translateX(calc(var(--size--x4) * -1));
|
|
107
|
+
opacity: 0;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.Appear--FadeSlideLeft-appear,
|
|
111
|
+
.Appear--FadeSlideLeft-enter,
|
|
112
|
+
.Appear--FadeSlideLeft-exit-active,
|
|
113
|
+
.Appear--FadeSlideLeft-exit-done {
|
|
114
|
+
transform: translateX(var(--size--x4));
|
|
115
|
+
opacity: 0;
|
|
116
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CSSTransition } from 'react-transition-group';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { transitionDurationFast, transitionDurationBase, transitionDurationSlow } from '../variables';
|
|
5
|
+
import Base, { Props as BaseProps } from '../Base/Base';
|
|
6
|
+
import './Appear.css';
|
|
7
|
+
|
|
8
|
+
const isClient = typeof window !== 'undefined';
|
|
9
|
+
|
|
10
|
+
const durations = {
|
|
11
|
+
fast: transitionDurationFast,
|
|
12
|
+
base: transitionDurationBase,
|
|
13
|
+
slow: transitionDurationSlow,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type TypeAppearAnimationName = 'Fade' | 'FadeSlideUp' | 'FadeSlideRight' | 'FadeSlideDown' | 'FadeSlideLeft';
|
|
17
|
+
|
|
18
|
+
export interface Props extends BaseProps {
|
|
19
|
+
/** Type of enter and exit animation */
|
|
20
|
+
animation: TypeAppearAnimationName;
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Entrance delay time */
|
|
23
|
+
delay?: number;
|
|
24
|
+
/** Entrance duration */
|
|
25
|
+
duration?: 'slow' | 'base' | 'fast';
|
|
26
|
+
style?: React.CSSProperties;
|
|
27
|
+
/** Flag if the element is visible or not */
|
|
28
|
+
visible?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Enter and exit components into view with a bit of bedazzle */
|
|
32
|
+
const Appear: React.FunctionComponent<Props> = (props: Props) => {
|
|
33
|
+
const { animation, className, delay, duration = 'fast', style, visible, ...rest } = props;
|
|
34
|
+
|
|
35
|
+
const classes = classnames(className, 'Appear', `Appear--${animation}`, `Appear--${duration}`, {
|
|
36
|
+
[`Appear--${animation}-appear`]: !isClient && visible,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const transition = {
|
|
40
|
+
appear: `Appear--${animation}-appear`,
|
|
41
|
+
appearActive: `Appear--${animation}-appear-active`,
|
|
42
|
+
enter: `Appear--${animation}-enter`,
|
|
43
|
+
enterActive: `Appear--${animation}-enter-active`,
|
|
44
|
+
enterDone: `Appear--${animation}-enter-done`,
|
|
45
|
+
exit: `Appear--${animation}-exit`,
|
|
46
|
+
exitActive: `Appear--${animation}-exit-active`,
|
|
47
|
+
exitDone: `Appear--${animation}-exit-done`,
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const newStyle = {
|
|
51
|
+
...style,
|
|
52
|
+
animationDelay: `${delay}ms`,
|
|
53
|
+
transitionDelay: `${delay}ms`,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<CSSTransition
|
|
58
|
+
appear={isClient && visible}
|
|
59
|
+
classNames={transition}
|
|
60
|
+
in={isClient && visible}
|
|
61
|
+
timeout={durations[duration]}
|
|
62
|
+
>
|
|
63
|
+
<Base {...rest} className={classes} style={newStyle} />
|
|
64
|
+
</CSSTransition>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
Appear.defaultProps = {
|
|
69
|
+
delay: 0,
|
|
70
|
+
duration: 'fast',
|
|
71
|
+
visible: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Appear;
|
|
@@ -3,8 +3,10 @@ import * as React from 'react';
|
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { Placement as TypePlacement, VirtualElement } from '@popperjs/core';
|
|
5
5
|
import { Popper, PopperProps } from 'react-popper';
|
|
6
|
+
import { CSSTransition } from 'react-transition-group';
|
|
6
7
|
import classnames from 'classnames';
|
|
7
8
|
import { useEventListener } from '../hooks';
|
|
9
|
+
import { transitionDurationFast } from '../variables';
|
|
8
10
|
import Base, { Props as BaseProps } from '../Base/Base';
|
|
9
11
|
import { PlacementArrowPropsContext } from './PlacementArrowPropsContext';
|
|
10
12
|
import { PlacementManagerContext } from './PlacementManagerContext';
|
|
@@ -12,6 +14,18 @@ import './Placement.css';
|
|
|
12
14
|
|
|
13
15
|
const { useEffect, useRef, useState } = React;
|
|
14
16
|
|
|
17
|
+
const transitionClasses = {
|
|
18
|
+
appear: 'Placement__content-appear',
|
|
19
|
+
appearActive: 'Placement__content-appear-active',
|
|
20
|
+
appearDone: 'Placement__content-appear-done',
|
|
21
|
+
enter: 'Placement__content-enter',
|
|
22
|
+
enterActive: 'Placement__content-enter-active',
|
|
23
|
+
enterDone: 'Placement__content-enter-done',
|
|
24
|
+
exit: 'Placement__content-exit',
|
|
25
|
+
exitActive: 'Placement__content-exit-active',
|
|
26
|
+
exitDone: 'Placement__content-exit-done',
|
|
27
|
+
};
|
|
28
|
+
|
|
15
29
|
export interface Props extends BaseProps {
|
|
16
30
|
animatePosition?: boolean;
|
|
17
31
|
children: (props: { update: () => void; width?: number }) => React.ReactNode;
|
|
@@ -40,6 +54,7 @@ const PlacementPopper: React.FunctionComponent<Props> = (props: Props) => {
|
|
|
40
54
|
referenceElement,
|
|
41
55
|
sameWidth,
|
|
42
56
|
visible,
|
|
57
|
+
timeout = transitionDurationFast,
|
|
43
58
|
...rest
|
|
44
59
|
} = props;
|
|
45
60
|
|
|
@@ -142,7 +157,7 @@ const PlacementPopper: React.FunctionComponent<Props> = (props: Props) => {
|
|
|
142
157
|
ref={ref}
|
|
143
158
|
style={style}
|
|
144
159
|
>
|
|
145
|
-
{visible
|
|
160
|
+
<CSSTransition appear={visible} classNames={transitionClasses} in={visible} timeout={timeout}>
|
|
146
161
|
<div className="Placement__content">
|
|
147
162
|
<Base {...rest} backgroundColor={backgroundColor} className="Placement__shadow">
|
|
148
163
|
<PlacementManagerContext.Consumer>
|
|
@@ -155,7 +170,7 @@ const PlacementPopper: React.FunctionComponent<Props> = (props: Props) => {
|
|
|
155
170
|
</PlacementManagerContext.Consumer>
|
|
156
171
|
</Base>
|
|
157
172
|
</div>
|
|
158
|
-
|
|
173
|
+
</CSSTransition>
|
|
159
174
|
</div>
|
|
160
175
|
</PlacementArrowPropsContext.Provider>
|
|
161
176
|
);
|
package/src/index.ts
CHANGED
|
@@ -81,6 +81,9 @@ export { default as MenuItem } from './Components/Menu/MenuItem';
|
|
|
81
81
|
export type { MenuListProps } from './Components/Menu/MenuList';
|
|
82
82
|
export { default as MenuList } from './Components/Menu/MenuList';
|
|
83
83
|
|
|
84
|
+
export type { DotProps } from './Components/Dot/Dot';
|
|
85
|
+
export { default as Dot } from './Components/Dot/Dot';
|
|
86
|
+
|
|
84
87
|
export { default as useToast } from './Components/Toast/Toast';
|
|
85
88
|
|
|
86
89
|
export type { EmptyStateProps } from './Components/EmptyState/EmptyState';
|
|
@@ -96,4 +99,5 @@ export { default as DialogBody } from './Components/Dialog/DialogBody';
|
|
|
96
99
|
export type { DialogFooterProps } from './Components/Dialog/DialogFooter';
|
|
97
100
|
export { default as DialogFooter } from './Components/Dialog/DialogFooter';
|
|
98
101
|
|
|
99
|
-
export {
|
|
102
|
+
export type { FadeProps } from './Components/Transitions/Fade';
|
|
103
|
+
export { default as Fade } from './Components/Transitions/Fade';
|
package/src/old.ts
CHANGED
|
@@ -15,6 +15,10 @@ export { default as AddonBeamLink } from './Old/AddonBeam/AddonBeamLink';
|
|
|
15
15
|
export type { Props as AddonFooterProps } from './Old/AddonFooter/AddonFooter';
|
|
16
16
|
export { default as AddonFooter } from './Old/AddonFooter/AddonFooter';
|
|
17
17
|
|
|
18
|
+
export type { Props as AppearProps } from './Old/Appear/Appear';
|
|
19
|
+
export type { TypeAppearAnimationName } from './Old/Appear/Appear';
|
|
20
|
+
export { default as Appear } from './Old/Appear/Appear';
|
|
21
|
+
|
|
18
22
|
export type { Props as AppLayoutProps } from './Old/AppLayout/AppLayout';
|
|
19
23
|
export { default as AppLayout } from './Old/AppLayout/AppLayout';
|
|
20
24
|
|
|
@@ -48,9 +52,6 @@ export { default as Checkbox } from './Old/Checkbox/Checkbox';
|
|
|
48
52
|
export type { Props as DatePickerProps } from './Old/DatePicker/DatePicker';
|
|
49
53
|
export { default as DatePicker } from './Old/DatePicker/DatePicker';
|
|
50
54
|
|
|
51
|
-
export type { Props as DotProps } from './Old/Dot/Dot';
|
|
52
|
-
export { default as Dot } from './Old/Dot/Dot';
|
|
53
|
-
|
|
54
55
|
export type { Props as DropdownProps } from './Old/Dropdown/Dropdown';
|
|
55
56
|
export { default as Dropdown } from './Old/Dropdown/Dropdown';
|
|
56
57
|
|