@megafon/ui-core 6.4.1 → 6.4.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/dist/es/components/Collapse/Collapse.js +8 -22
- package/dist/lib/components/Collapse/Collapse.js +8 -22
- package/package.json +101 -101
- package/CHANGELOG.md +0 -4098
|
@@ -33,7 +33,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
33
33
|
var duration = animation ? animationDuration : 0;
|
|
34
34
|
var animationStart = React.useRef(null);
|
|
35
35
|
var animationId = React.useRef(null);
|
|
36
|
-
var
|
|
36
|
+
var isBeforeOpened = React.useRef(false);
|
|
37
37
|
var rootNode = React.useRef(null);
|
|
38
38
|
useEffect(function () {
|
|
39
39
|
animationId.current && window.cancelAnimationFrame(animationId.current);
|
|
@@ -76,28 +76,14 @@ var Collapse = function Collapse(_ref) {
|
|
|
76
76
|
var _rootNode$current$scr = rootNode.current.scrollHeight,
|
|
77
77
|
scrollHeight = _rootNode$current$scr === void 0 ? 0 : _rootNode$current$scr;
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
break;
|
|
87
|
-
|
|
88
|
-
case isOpened:
|
|
89
|
-
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
90
|
-
return animateSlide(scrollHeight, duration, timePassed, true);
|
|
91
|
-
});
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
|
-
default:
|
|
95
|
-
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
96
|
-
return animateSlide(scrollHeight, duration, timePassed);
|
|
97
|
-
});
|
|
79
|
+
if (isBeforeOpened.current === isOpened) {
|
|
80
|
+
rootNode.current.style.height = isOpened ? 'auto' : '0px';
|
|
81
|
+
} else {
|
|
82
|
+
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
83
|
+
return animateSlide(scrollHeight, duration, timePassed, isOpened);
|
|
84
|
+
});
|
|
85
|
+
isBeforeOpened.current = isOpened;
|
|
98
86
|
}
|
|
99
|
-
|
|
100
|
-
canUpdate.current = true;
|
|
101
87
|
}, [isOpened, duration, animateSlide]);
|
|
102
88
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
103
89
|
className: cn([className]),
|
|
@@ -50,7 +50,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
50
50
|
var duration = animation ? animationDuration : 0;
|
|
51
51
|
var animationStart = React.useRef(null);
|
|
52
52
|
var animationId = React.useRef(null);
|
|
53
|
-
var
|
|
53
|
+
var isBeforeOpened = React.useRef(false);
|
|
54
54
|
var rootNode = React.useRef(null);
|
|
55
55
|
(0, React.useEffect)(function () {
|
|
56
56
|
animationId.current && window.cancelAnimationFrame(animationId.current);
|
|
@@ -93,28 +93,14 @@ var Collapse = function Collapse(_ref) {
|
|
|
93
93
|
var _rootNode$current$scr = rootNode.current.scrollHeight,
|
|
94
94
|
scrollHeight = _rootNode$current$scr === void 0 ? 0 : _rootNode$current$scr;
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
break;
|
|
104
|
-
|
|
105
|
-
case isOpened:
|
|
106
|
-
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
107
|
-
return animateSlide(scrollHeight, duration, timePassed, true);
|
|
108
|
-
});
|
|
109
|
-
break;
|
|
110
|
-
|
|
111
|
-
default:
|
|
112
|
-
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
113
|
-
return animateSlide(scrollHeight, duration, timePassed);
|
|
114
|
-
});
|
|
96
|
+
if (isBeforeOpened.current === isOpened) {
|
|
97
|
+
rootNode.current.style.height = isOpened ? 'auto' : '0px';
|
|
98
|
+
} else {
|
|
99
|
+
animationId.current = window.requestAnimationFrame(function (timePassed) {
|
|
100
|
+
return animateSlide(scrollHeight, duration, timePassed, isOpened);
|
|
101
|
+
});
|
|
102
|
+
isBeforeOpened.current = isOpened;
|
|
115
103
|
}
|
|
116
|
-
|
|
117
|
-
canUpdate.current = true;
|
|
118
104
|
}, [isOpened, duration, animateSlide]);
|
|
119
105
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
120
106
|
className: cn([className]),
|
package/package.json
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
2
|
+
"name": "@megafon/ui-core",
|
|
3
|
+
"version": "6.4.2",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist",
|
|
6
|
+
"styles"
|
|
7
|
+
],
|
|
8
|
+
"main": "dist/lib/index.js",
|
|
9
|
+
"module": "dist/es/index.js",
|
|
10
|
+
"typings": "dist/lib/index.d.ts",
|
|
11
|
+
"sideEffects": [
|
|
12
|
+
"*.css",
|
|
13
|
+
"*.less"
|
|
14
|
+
],
|
|
15
|
+
"author": "MegaFon",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "gulp build",
|
|
19
|
+
"cleanDist": "rm -rf dist styles",
|
|
20
|
+
"coverage": "yarn coverage:unit",
|
|
21
|
+
"coverage:unit": "jest --coverage",
|
|
22
|
+
"typecheck": "tsc --noEmit -p .",
|
|
23
|
+
"prettier:check": "prettier --list-different \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
24
|
+
"prettier:fix": "prettier --write \"src/**/*.{js,jsx,ts,tsx}\"",
|
|
25
|
+
"lint": "yarn lint:ts && yarn lint:less",
|
|
26
|
+
"lint:ts": "eslint --ext .js,.jsx,.ts,.tsx src --max-warnings=0",
|
|
27
|
+
"lint:less": "stylelint --syntax less src/**/*.less src/**/**/*.less",
|
|
28
|
+
"lint:less:fix": "yarn lint:less --fix",
|
|
29
|
+
"test": "yarn test:unit",
|
|
30
|
+
"test:unit": "jest",
|
|
31
|
+
"test:update": "jest --updateSnapshot"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"lint-staged": {
|
|
37
|
+
"src/**/**/*.(js|jsx|ts|tsx)": [
|
|
38
|
+
"eslint --max-warnings=0 --config ../../.eslintrc.json"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@megafon/ui-icons": "^2.0.0",
|
|
43
|
+
"react": ">=16.13.0",
|
|
44
|
+
"react-dom": ">=16.13.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@babel/core": "^7.8.6",
|
|
48
|
+
"@babel/plugin-transform-object-assign": "^7.8.3",
|
|
49
|
+
"@babel/plugin-transform-runtime": "^7.8.3",
|
|
50
|
+
"@babel/preset-env": "^7.8.6",
|
|
51
|
+
"@babel/preset-react": "^7.8.3",
|
|
52
|
+
"@babel/preset-typescript": "^7.8.3",
|
|
53
|
+
"@megafon/ui-icons": "^2.30.0",
|
|
54
|
+
"@svgr/core": "^2.4.1",
|
|
55
|
+
"@testing-library/jest-dom": "5.16.2",
|
|
56
|
+
"@testing-library/react": "12.1.2",
|
|
57
|
+
"@testing-library/react-hooks": "^7.0.1",
|
|
58
|
+
"@testing-library/user-event": "13.5.0",
|
|
59
|
+
"@types/enzyme": "^3.10.5",
|
|
60
|
+
"@types/enzyme-adapter-react-16": "^1.0.6",
|
|
61
|
+
"@types/jest": "^25.1.3",
|
|
62
|
+
"@types/node": "^13.9.1",
|
|
63
|
+
"@types/prop-types": "^15.7.3",
|
|
64
|
+
"@types/react": "^16.9.23",
|
|
65
|
+
"@types/react-dom": "^16.9.5",
|
|
66
|
+
"babel-plugin-module-resolver": "^3.2.0",
|
|
67
|
+
"del": "^3.0.0",
|
|
68
|
+
"enzyme": "^3.11.0",
|
|
69
|
+
"enzyme-adapter-react-16": "^1.15.2",
|
|
70
|
+
"enzyme-to-json": "^3.4.4",
|
|
71
|
+
"glob": "^7.1.6",
|
|
72
|
+
"gulp": "^4.0.2",
|
|
73
|
+
"gulp-babel": "^8.0.0-beta.2",
|
|
74
|
+
"gulp-imagemin": "^7.1.0",
|
|
75
|
+
"gulp-less": "^4.0.1",
|
|
76
|
+
"gulp-typescript": "^5.0.1",
|
|
77
|
+
"jest": "^25.1.0",
|
|
78
|
+
"less-plugin-autoprefix": "^2.0.0",
|
|
79
|
+
"merge2": "^1.3.0",
|
|
80
|
+
"react": "^16.13.0",
|
|
81
|
+
"react-dom": "^16.13.0",
|
|
82
|
+
"stylelint": "^9.10.1",
|
|
83
|
+
"through2": "^2.0.5",
|
|
84
|
+
"typescript": "^3.8.3"
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"@babel/runtime": "^7.8.4",
|
|
88
|
+
"@datepicker-react/hooks": "^2.7.0",
|
|
89
|
+
"@dnd-kit/core": "^6.1.0",
|
|
90
|
+
"@dnd-kit/sortable": "^8.0.0",
|
|
91
|
+
"@megafon/ui-helpers": "^2.6.0",
|
|
92
|
+
"@popperjs/core": "^2.5.3",
|
|
93
|
+
"core-js": "^3.6.4",
|
|
94
|
+
"date-fns": "^2.16.1",
|
|
95
|
+
"lodash.debounce": "^4.0.8",
|
|
96
|
+
"lodash.throttle": "^4.1.1",
|
|
97
|
+
"prop-types": "^15.7.2",
|
|
98
|
+
"react-input-mask": "^2.0.4",
|
|
99
|
+
"react-popper": "^2.2.3",
|
|
100
|
+
"swiper": "^6.5.6"
|
|
101
|
+
},
|
|
102
|
+
"gitHead": "fea7e711b2427c835cd6ec8016df37d7996ef4de"
|
|
103
103
|
}
|