@megafon/ui-core 4.13.0 → 4.14.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.14.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.13.0...@megafon/ui-core@4.14.0) (2023-03-07)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **button:** disable delay for loader ([a19c599](https://github.com/MegafonWebLab/megafon-ui/commit/a19c599f884d5dc9d485c56c6c7914e76d1c3fb6))
12
+
13
+
14
+ ### Features
15
+
16
+ * **carousel:** fix z-index of naw arrow ([b6b1ae1](https://github.com/MegafonWebLab/megafon-ui/commit/b6b1ae18e8641d8168bc97598df62a1ce0eac1f4))
17
+ * **preloader:** add new prop hasDelay ([356305d](https://github.com/MegafonWebLab/megafon-ui/commit/356305d70451d38e91e638970eb9b597cac86ea7))
18
+
19
+
20
+
21
+
22
+
6
23
  # [4.13.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@4.12.0...@megafon/ui-core@4.13.0) (2023-02-22)
7
24
 
8
25
 
@@ -157,6 +157,7 @@ var Button = function Button(_ref) {
157
157
  }, [icon, children]);
158
158
  var renderedLoader = React.useMemo(function () {
159
159
  return /*#__PURE__*/React.createElement(Preloader, {
160
+ delay: false,
160
161
  className: cn('preloader'),
161
162
  dataAttrs: {
162
163
  root: filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader)
@@ -116,7 +116,7 @@
116
116
  .mfui-carousel__arrow {
117
117
  position: absolute;
118
118
  top: 50%;
119
- z-index: 2;
119
+ z-index: 6;
120
120
  -webkit-transform: translateY(calc(-50% - 40px / 2));
121
121
  transform: translateY(calc(-50% - 40px / 2));
122
122
  }
@@ -12,6 +12,8 @@ export declare const PreloaderSizes: {
12
12
  };
13
13
  export declare type PreloaderSizesType = typeof PreloaderSizes[keyof typeof PreloaderSizes];
14
14
  export interface IPreloaderProps {
15
+ /** Задержка отрисовки */
16
+ delay?: boolean;
15
17
  /** Цветовая тема */
16
18
  color?: PreloaderColorsType;
17
19
  /** Размер на всех разрешениях экрана */
@@ -22,6 +22,8 @@ var Preloader = function Preloader(_ref) {
22
22
  color = _ref$color === void 0 ? 'default' : _ref$color,
23
23
  _ref$sizeAll = _ref.sizeAll,
24
24
  sizeAll = _ref$sizeAll === void 0 ? 'medium' : _ref$sizeAll,
25
+ _ref$delay = _ref.delay,
26
+ delay = _ref$delay === void 0 ? true : _ref$delay,
25
27
  sizeWide = _ref.sizeWide,
26
28
  sizeDesktop = _ref.sizeDesktop,
27
29
  sizeTablet = _ref.sizeTablet,
@@ -29,19 +31,23 @@ var Preloader = function Preloader(_ref) {
29
31
  className = _ref.className,
30
32
  dataAttrs = _ref.dataAttrs;
31
33
 
32
- var _React$useState = React.useState(false),
34
+ var _React$useState = React.useState(!delay),
33
35
  _React$useState2 = _slicedToArray(_React$useState, 2),
34
36
  isShowed = _React$useState2[0],
35
37
  setIsShowed = _React$useState2[1];
36
38
 
37
39
  React.useEffect(function () {
40
+ if (isShowed) {
41
+ return undefined;
42
+ }
43
+
38
44
  var timerId = setTimeout(function () {
39
45
  setIsShowed(true);
40
46
  }, 250);
41
47
  return function () {
42
48
  clearTimeout(timerId);
43
49
  };
44
- }, []);
50
+ }, [isShowed]);
45
51
  return isShowed ? /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
46
52
  className: cn({
47
53
  color: color,
@@ -190,6 +190,7 @@ var Button = function Button(_ref) {
190
190
 
191
191
  var renderedLoader = _react["default"].useMemo(function () {
192
192
  return /*#__PURE__*/_react["default"].createElement(_Preloader["default"], {
193
+ delay: false,
193
194
  className: cn('preloader'),
194
195
  dataAttrs: {
195
196
  root: (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.loader)
@@ -116,7 +116,7 @@
116
116
  .mfui-carousel__arrow {
117
117
  position: absolute;
118
118
  top: 50%;
119
- z-index: 2;
119
+ z-index: 6;
120
120
  -webkit-transform: translateY(calc(-50% - 40px / 2));
121
121
  transform: translateY(calc(-50% - 40px / 2));
122
122
  }
@@ -12,6 +12,8 @@ export declare const PreloaderSizes: {
12
12
  };
13
13
  export declare type PreloaderSizesType = typeof PreloaderSizes[keyof typeof PreloaderSizes];
14
14
  export interface IPreloaderProps {
15
+ /** Задержка отрисовки */
16
+ delay?: boolean;
15
17
  /** Цветовая тема */
16
18
  color?: PreloaderColorsType;
17
19
  /** Размер на всех разрешениях экрана */
@@ -45,6 +45,8 @@ var Preloader = function Preloader(_ref) {
45
45
  color = _ref$color === void 0 ? 'default' : _ref$color,
46
46
  _ref$sizeAll = _ref.sizeAll,
47
47
  sizeAll = _ref$sizeAll === void 0 ? 'medium' : _ref$sizeAll,
48
+ _ref$delay = _ref.delay,
49
+ delay = _ref$delay === void 0 ? true : _ref$delay,
48
50
  sizeWide = _ref.sizeWide,
49
51
  sizeDesktop = _ref.sizeDesktop,
50
52
  sizeTablet = _ref.sizeTablet,
@@ -52,19 +54,23 @@ var Preloader = function Preloader(_ref) {
52
54
  className = _ref.className,
53
55
  dataAttrs = _ref.dataAttrs;
54
56
 
55
- var _React$useState = React.useState(false),
57
+ var _React$useState = React.useState(!delay),
56
58
  _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
57
59
  isShowed = _React$useState2[0],
58
60
  setIsShowed = _React$useState2[1];
59
61
 
60
62
  React.useEffect(function () {
63
+ if (isShowed) {
64
+ return undefined;
65
+ }
66
+
61
67
  var timerId = setTimeout(function () {
62
68
  setIsShowed(true);
63
69
  }, 250);
64
70
  return function () {
65
71
  clearTimeout(timerId);
66
72
  };
67
- }, []);
73
+ }, [isShowed]);
68
74
  return isShowed ? /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
69
75
  className: cn({
70
76
  color: color,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@megafon/ui-core",
3
- "version": "4.13.0",
3
+ "version": "4.14.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "styles"
@@ -100,5 +100,5 @@
100
100
  "react-popper": "^2.2.3",
101
101
  "swiper": "^6.5.6"
102
102
  },
103
- "gitHead": "c6b6ee9a988f9563c4b630bd0fad47c432172e65"
103
+ "gitHead": "b9b0a048d2faba323bebaddbf302aed8e0894506"
104
104
  }