@bitrise/bitkit 9.35.2-alpha-react18.1 → 9.35.2
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/README.md +12 -27
- package/package.json +39 -36
- package/src/Components/ButtonGroup/ButtonGroup.stories.tsx +1 -1
- package/src/Components/Menu/Menu.tsx +1 -1
- package/src/Components/Popover/PopoverTrigger.tsx +2 -1
- 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 +1 -0
- package/src/old.ts +4 -0
- package/src/tsconfig.tsbuildinfo +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @bitrise/bitkit
|
|
2
2
|
|
|
3
3
|
Library for React UI components and design patterns.
|
|
4
|
+
|
|
5
|
+
Based on [Chakra UI](https://chakra-ui.com/).
|
|
4
6
|
___
|
|
5
7
|
|
|
6
8
|
|
|
@@ -14,46 +16,29 @@ yarn install
|
|
|
14
16
|
|
|
15
17
|
### Technology
|
|
16
18
|
|
|
19
|
+
- [Chakra UI](https://chakra-ui.com/)
|
|
17
20
|
- [Typescript](https://www.typescriptlang.org/)
|
|
18
|
-
- [
|
|
19
|
-
- [React](https://reactjs.org/) (with [React Router](https://reacttraining.com/react-router/) for routing links)
|
|
20
|
-
- [PostCSS](https://postcss.org/) (with [postcss-preset-env](https://preset-env.cssdb.org/) for a little power)
|
|
21
|
+
- [React](https://reactjs.org/)
|
|
21
22
|
- [Jest](https://jestjs.io/) (for unit testing)
|
|
22
23
|
|
|
23
|
-
### Managing icons
|
|
24
|
-
|
|
25
|
-
If you would like to add a new or edit an existing icon:
|
|
26
|
-
1. Export the icon from [Figma](https://www.figma.com/file/grik9mTaJ5DfhydhWhXdP5/Bitkit-Foundations?node-id=213%3A82) as an SVG. Make sure that the exported file has the following viewBox: `0 0 24 24`, otherwise the icon can make smaller or bigger compared to the existing ones.
|
|
27
|
-
2. Rename the file using this convention: `icons-{iconName}.svg` (eg.: `icons-crown.svg`)
|
|
28
|
-
3. Add the file under the `./src/components/Icon/svg` folder.
|
|
29
|
-
4. If you are not running `yarn start`, run the `yarn build:icons` script to generate the React component from the SVG. You should commit both the `.svg` and the generated `.tsx` files.
|
|
30
|
-
5. Make sure to check the new/update icon on the Icons page.
|
|
31
24
|
### Scripts
|
|
32
25
|
|
|
33
|
-
#### `$ yarn
|
|
34
|
-
|
|
35
|
-
Builds the library and styleguide assets
|
|
26
|
+
#### `$ yarn storybook`
|
|
36
27
|
|
|
37
|
-
|
|
28
|
+
Runs Storybook server
|
|
38
29
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
#### `$ yarn clean`
|
|
30
|
+
#### `$ yarn start`
|
|
42
31
|
|
|
43
|
-
|
|
32
|
+
Runs `yarn storybook`
|
|
44
33
|
|
|
45
34
|
#### `$ yarn lint`
|
|
46
35
|
|
|
47
36
|
Runs Javascript linting
|
|
48
37
|
|
|
49
|
-
#### `$ yarn serve`
|
|
50
|
-
|
|
51
|
-
Serves up the static files built for the style guide
|
|
52
|
-
|
|
53
|
-
#### `$ yarn start`
|
|
54
|
-
|
|
55
|
-
Runs the developlement server for the style guide
|
|
56
|
-
|
|
57
38
|
#### `$ yarn test`
|
|
58
39
|
|
|
59
40
|
Runs the unit tests for the library components
|
|
41
|
+
|
|
42
|
+
### Contributing
|
|
43
|
+
|
|
44
|
+
Check [CONTRIBUTING.md](CONTRIBUTING.md)
|
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.35.2
|
|
4
|
+
"version": "9.35.2",
|
|
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>
|
|
@@ -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;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
1
2
|
import { PopoverTrigger as ChakraPopoverTrigger } from '@chakra-ui/react';
|
|
2
3
|
|
|
3
|
-
const PopoverTigger = (props
|
|
4
|
+
const PopoverTigger: FC = (props) => <ChakraPopoverTrigger {...props} />;
|
|
4
5
|
|
|
5
6
|
export default PopoverTigger;
|
|
@@ -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
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
|
|