@megafon/ui-core 3.5.3 → 3.8.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 +43 -0
- package/dist/es/components/Button/Button.css +40 -0
- package/dist/es/components/Button/Button.d.ts +1 -0
- package/dist/es/components/Button/Button.js +2 -1
- package/dist/es/components/Calendar/Calendar.js +18 -2
- package/dist/es/components/Calendar/components/Month/Month.js +4 -4
- package/dist/es/components/Logo/Logo.js +22 -6
- package/dist/es/components/Notification/Notification.d.ts +6 -0
- package/dist/es/components/Notification/Notification.js +13 -3
- package/dist/es/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/es/components/Tooltip/Tooltip.js +27 -1
- package/dist/lib/components/Button/Button.css +40 -0
- package/dist/lib/components/Button/Button.d.ts +1 -0
- package/dist/lib/components/Button/Button.js +2 -1
- package/dist/lib/components/Calendar/Calendar.js +17 -1
- package/dist/lib/components/Calendar/components/Month/Month.js +4 -4
- package/dist/lib/components/Logo/Logo.js +22 -6
- package/dist/lib/components/Notification/Notification.d.ts +6 -0
- package/dist/lib/components/Notification/Notification.js +13 -3
- package/dist/lib/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/lib/components/Tooltip/Tooltip.js +31 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
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
|
+
# [3.8.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.7.0...@megafon/ui-core@3.8.0) (2022-05-17)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **notification:** add props classes to notification component ([608a424](https://github.com/MegafonWebLab/megafon-ui/commit/608a4246eb99af354fb7cf8ab98c2ed513d87b66))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [3.7.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.6.0...@megafon/ui-core@3.7.0) (2022-05-05)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* **logo:** fix horizontal logo svg ([76655eb](https://github.com/MegafonWebLab/megafon-ui/commit/76655ebb82650cc2617750af0b2b2726d3ebcbf3))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* **button:** added extra small size ([a26da46](https://github.com/MegafonWebLab/megafon-ui/commit/a26da4601de7e7c81c40eabf9a87ccdbf18cb790))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [3.6.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3...@megafon/ui-core@3.6.0) (2022-04-25)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **calendar:** fix go to start day after user choice ([8bbce10](https://github.com/MegafonWebLab/megafon-ui/commit/8bbce102d204f7ea7706158f3e6540c86ed3aada))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* **tooltip:** added prop isPortal for tooltip ([e6f6d17](https://github.com/MegafonWebLab/megafon-ui/commit/e6f6d1749cd99f065c50bac4eb6a9b3592653f8d))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
## [3.5.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.2...@megafon/ui-core@3.5.3) (2022-04-18)
|
|
7
50
|
|
|
8
51
|
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
appearance: none;
|
|
22
22
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
23
23
|
}
|
|
24
|
+
.mfui-button_size-all_extra-small .mfui-button__inner {
|
|
25
|
+
min-width: 26px;
|
|
26
|
+
height: 26px;
|
|
27
|
+
}
|
|
24
28
|
.mfui-button_size-all_small .mfui-button__inner {
|
|
25
29
|
min-width: 32px;
|
|
26
30
|
height: 32px;
|
|
@@ -33,6 +37,10 @@
|
|
|
33
37
|
min-width: 60px;
|
|
34
38
|
height: 60px;
|
|
35
39
|
}
|
|
40
|
+
.mfui-button_size-all_extra-small .mfui-button__icon {
|
|
41
|
+
width: 18px;
|
|
42
|
+
height: 18px;
|
|
43
|
+
}
|
|
36
44
|
.mfui-button_size-all_small .mfui-button__icon {
|
|
37
45
|
width: 24px;
|
|
38
46
|
height: 24px;
|
|
@@ -46,6 +54,10 @@
|
|
|
46
54
|
height: 40px;
|
|
47
55
|
}
|
|
48
56
|
@media screen and (min-width: 1280px) {
|
|
57
|
+
.mfui-button_size-wide_extra-small .mfui-button__inner {
|
|
58
|
+
min-width: 26px;
|
|
59
|
+
height: 26px;
|
|
60
|
+
}
|
|
49
61
|
.mfui-button_size-wide_small .mfui-button__inner {
|
|
50
62
|
min-width: 32px;
|
|
51
63
|
height: 32px;
|
|
@@ -58,6 +70,10 @@
|
|
|
58
70
|
min-width: 60px;
|
|
59
71
|
height: 60px;
|
|
60
72
|
}
|
|
73
|
+
.mfui-button_size-wide_extra-small .mfui-button__icon {
|
|
74
|
+
width: 18px;
|
|
75
|
+
height: 18px;
|
|
76
|
+
}
|
|
61
77
|
.mfui-button_size-wide_small .mfui-button__icon {
|
|
62
78
|
width: 24px;
|
|
63
79
|
height: 24px;
|
|
@@ -72,6 +88,10 @@
|
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
@media screen and (min-width: 1024px) {
|
|
91
|
+
.mfui-button_size-desktop_extra-small .mfui-button__inner {
|
|
92
|
+
min-width: 26px;
|
|
93
|
+
height: 26px;
|
|
94
|
+
}
|
|
75
95
|
.mfui-button_size-desktop_small .mfui-button__inner {
|
|
76
96
|
min-width: 32px;
|
|
77
97
|
height: 32px;
|
|
@@ -84,6 +104,10 @@
|
|
|
84
104
|
min-width: 60px;
|
|
85
105
|
height: 60px;
|
|
86
106
|
}
|
|
107
|
+
.mfui-button_size-desktop_extra-small .mfui-button__icon {
|
|
108
|
+
width: 18px;
|
|
109
|
+
height: 18px;
|
|
110
|
+
}
|
|
87
111
|
.mfui-button_size-desktop_small .mfui-button__icon {
|
|
88
112
|
width: 24px;
|
|
89
113
|
height: 24px;
|
|
@@ -98,6 +122,10 @@
|
|
|
98
122
|
}
|
|
99
123
|
}
|
|
100
124
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
125
|
+
.mfui-button_size-tablet_extra-small .mfui-button__inner {
|
|
126
|
+
min-width: 26px;
|
|
127
|
+
height: 26px;
|
|
128
|
+
}
|
|
101
129
|
.mfui-button_size-tablet_small .mfui-button__inner {
|
|
102
130
|
min-width: 32px;
|
|
103
131
|
height: 32px;
|
|
@@ -110,6 +138,10 @@
|
|
|
110
138
|
min-width: 60px;
|
|
111
139
|
height: 60px;
|
|
112
140
|
}
|
|
141
|
+
.mfui-button_size-tablet_extra-small .mfui-button__icon {
|
|
142
|
+
width: 18px;
|
|
143
|
+
height: 18px;
|
|
144
|
+
}
|
|
113
145
|
.mfui-button_size-tablet_small .mfui-button__icon {
|
|
114
146
|
width: 24px;
|
|
115
147
|
height: 24px;
|
|
@@ -124,6 +156,10 @@
|
|
|
124
156
|
}
|
|
125
157
|
}
|
|
126
158
|
@media screen and (max-width: 767px) {
|
|
159
|
+
.mfui-button_size-mobile_extra-small .mfui-button__inner {
|
|
160
|
+
min-width: 26px;
|
|
161
|
+
height: 26px;
|
|
162
|
+
}
|
|
127
163
|
.mfui-button_size-mobile_small .mfui-button__inner {
|
|
128
164
|
min-width: 32px;
|
|
129
165
|
height: 32px;
|
|
@@ -136,6 +172,10 @@
|
|
|
136
172
|
min-width: 60px;
|
|
137
173
|
height: 60px;
|
|
138
174
|
}
|
|
175
|
+
.mfui-button_size-mobile_extra-small .mfui-button__icon {
|
|
176
|
+
width: 18px;
|
|
177
|
+
height: 18px;
|
|
178
|
+
}
|
|
139
179
|
.mfui-button_size-mobile_small .mfui-button__icon {
|
|
140
180
|
width: 24px;
|
|
141
181
|
height: 24px;
|
|
@@ -13,6 +13,7 @@ export declare const ButtonThemes: {
|
|
|
13
13
|
};
|
|
14
14
|
declare type ButtonThemesType = typeof ButtonThemes[keyof typeof ButtonThemes];
|
|
15
15
|
export declare const ButtonSizes: {
|
|
16
|
+
readonly EXTRA_SMALL: "extra-small";
|
|
16
17
|
readonly SMALL: "small";
|
|
17
18
|
readonly MEDIUM: "medium";
|
|
18
19
|
readonly LARGE: "large";
|
|
@@ -29,6 +29,7 @@ export var ButtonThemes = {
|
|
|
29
29
|
BLACK: 'black'
|
|
30
30
|
};
|
|
31
31
|
export var ButtonSizes = {
|
|
32
|
+
EXTRA_SMALL: 'extra-small',
|
|
32
33
|
SMALL: 'small',
|
|
33
34
|
MEDIUM: 'medium',
|
|
34
35
|
LARGE: 'large'
|
|
@@ -42,7 +43,7 @@ var Content;
|
|
|
42
43
|
})(Content || (Content = {}));
|
|
43
44
|
|
|
44
45
|
var getLoaderSize = function getLoaderSize(size) {
|
|
45
|
-
return size === ButtonSizes.SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
46
|
+
return size === ButtonSizes.SMALL || size === ButtonSizes.EXTRA_SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
var cn = cnCreate('mfui-button');
|
|
@@ -20,7 +20,7 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
import React, { useState, useEffect, useMemo } from 'react';
|
|
23
|
+
import React, { useState, useEffect, useMemo, useRef } from 'react';
|
|
24
24
|
import { START_DATE, END_DATE, useDatepicker, useMonth } from '@datepicker-react/hooks';
|
|
25
25
|
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
26
26
|
import differenceInDays from 'date-fns/differenceInDays';
|
|
@@ -53,6 +53,17 @@ var dayLabelFormat = function dayLabelFormat(date) {
|
|
|
53
53
|
var monthLabelFormat = function monthLabelFormat(date) {
|
|
54
54
|
return formatDate(date, 'LLLL');
|
|
55
55
|
};
|
|
56
|
+
/* List of cases to check on component change:
|
|
57
|
+
|
|
58
|
+
- Should correctly choose value and trigger callbacks with correct arguments on dates choose.
|
|
59
|
+
- Should set 1 day period if start and end date is equal
|
|
60
|
+
- Should correctly increase period if choose earlier start date
|
|
61
|
+
- Should correctly change start date of selected period if chosen date in period closer to current start date
|
|
62
|
+
- Should correctly change end date of selected period if chosen date in period closer to current end date
|
|
63
|
+
- Should correctly highlights period if start date chosen and hover on possible end date
|
|
64
|
+
|
|
65
|
+
*/
|
|
66
|
+
|
|
56
67
|
|
|
57
68
|
var cn = cnCreate('mfui-calendar');
|
|
58
69
|
|
|
@@ -91,6 +102,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
91
102
|
hoveredDate = _useState4[0],
|
|
92
103
|
setHoveredDate = _useState4[1];
|
|
93
104
|
|
|
105
|
+
var isUserChoice = useRef(false);
|
|
94
106
|
var stateStartDate = calendarState.startDate,
|
|
95
107
|
stateEndDate = calendarState.endDate,
|
|
96
108
|
stateFocusedInput = calendarState.focusedInput;
|
|
@@ -111,10 +123,13 @@ var Calendar = function Calendar(_ref) {
|
|
|
111
123
|
goToDate = _a.goToDate,
|
|
112
124
|
pickerProps = __rest(_a, ["firstDayOfWeek", "activeMonths", "goToPreviousMonths", "goToNextMonths", "goToDate"]);
|
|
113
125
|
|
|
126
|
+
useEffect(function () {
|
|
127
|
+
isUserChoice.current = false;
|
|
128
|
+
}, [startDate]);
|
|
114
129
|
useEffect(function () {
|
|
115
130
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
116
131
|
setCalendarState(calendarStateFromProps);
|
|
117
|
-
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
132
|
+
!isUserChoice.current && propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
118
133
|
}, [calendarStateFromProps]);
|
|
119
134
|
|
|
120
135
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -179,6 +194,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
179
194
|
var nextStartDate = nextState.startDate,
|
|
180
195
|
nextEndDate = nextState.endDate;
|
|
181
196
|
setCalendarState(nextState);
|
|
197
|
+
isUserChoice.current = true;
|
|
182
198
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
183
199
|
};
|
|
184
200
|
|
|
@@ -10,9 +10,9 @@ var ArrowLeft = function ArrowLeft(props) {
|
|
|
10
10
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
11
11
|
viewBox: "0 0 20 20"
|
|
12
12
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
13
|
+
d: "M12 6v8l-5-4z",
|
|
13
14
|
fillRule: "evenodd",
|
|
14
|
-
clipRule: "evenodd"
|
|
15
|
-
d: "M12 6v8l-5-4z"
|
|
15
|
+
clipRule: "evenodd"
|
|
16
16
|
}));
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -20,9 +20,9 @@ var ArrowRight = function ArrowRight(props) {
|
|
|
20
20
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
21
21
|
viewBox: "0 0 20 20"
|
|
22
22
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M8 14V6l5 4z",
|
|
23
24
|
fillRule: "evenodd",
|
|
24
|
-
clipRule: "evenodd"
|
|
25
|
-
d: "M8 14V6l5 4z"
|
|
25
|
+
clipRule: "evenodd"
|
|
26
26
|
}));
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -8,14 +8,30 @@ import "./Logo.css";
|
|
|
8
8
|
|
|
9
9
|
var greenHorizontalImg = function greenHorizontalImg(props) {
|
|
10
10
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
11
|
-
viewBox: "0 0
|
|
12
|
-
|
|
11
|
+
viewBox: "0 0 623 112",
|
|
12
|
+
fill: "none"
|
|
13
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
14
|
+
d: "M608.292 31.117V51.95h-27.978V31.117h-13.769v55.067h13.769V63.951h27.978v22.233h13.842V31.117h-13.842z",
|
|
13
15
|
fill: "#00B956"
|
|
14
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
15
|
-
d: "M30.3.7v27.8c0 1.3-1 2.2-2.2 2.2h-3.3c-.2 0-.3.2-.3.3v23.3c.8 0 1.6.2 2.5.2 14.9 0 27-12.1 27-27C54 13.8 43.7 2.3 30.3.7zm-.6 41.6c-1.9 0-3.3-1.6-3.3-3.3 0-1.9 1.6-3.3 3.3-3.3 1.9 0 3.3 1.6 3.3 3.3.2 1.8-1.4 3.3-3.3 3.3zm7.9 0c-1.9 0-3.3-1.6-3.3-3.3 0-1.9 1.6-3.3 3.3-3.3 1.9 0 3.3 1.6 3.3 3.3s-1.3 3.3-3.3 3.3zm8 0c-1.9 0-3.3-1.6-3.3-3.3 0-1.9 1.6-3.3 3.3-3.3 1.9 0 3.3 1.6 3.3 3.3s-1.4 3.3-3.3 3.3z"
|
|
16
16
|
}), /*#__PURE__*/React.createElement("path", {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
clipRule: "evenodd",
|
|
19
|
+
d: "M367.31 29.865c4.417 0 9.056 2.43 11.338 7.436l22.53 48.883h-14.652l-4.933-11.632h-28.567l-4.933 11.632h-14.652l22.53-48.883c2.282-5.007 6.921-7.436 11.339-7.436zm-1.105 13.693l-8.467 19.951h19.143l-8.467-19.95c-.221-.663-.736-.81-1.104-.81-.369 0-.81.22-1.105.81z",
|
|
20
|
+
fill: "#00B956"
|
|
21
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
22
|
+
d: "M214.533 21.178c-6.48 0-10.603 3.46-13.622 10.38l-17.965 41.374-17.965-41.374c-3.018-6.92-7.142-10.38-13.621-10.38-6.037 0-12.296 4.343-12.296 13.693v51.313h13.769v-49.84l18.112 41.08c2.43 5.742 6.332 9.349 12.001 9.349 5.67 0 9.572-3.607 12.002-9.35l18.112-41.08v49.841h13.768v-51.24c0-9.423-6.258-13.766-12.295-13.766zm36.445 53.227a1.163 1.163 0 01-1.178-1.178v-9.644h34.384V52.319H249.8v-8.393c0-.662.515-1.178 1.178-1.178h34.016V31.117h-40.79c-4.785 0-8.172 3.975-8.172 8.171v38.577c0 4.196 3.46 8.172 8.172 8.172h40.79V74.405h-34.016zm57.429 11.779V44c0-.663.516-1.178 1.179-1.178h34.015V31.19h-40.789c-4.786 0-8.173 3.976-8.173 8.172v46.822h13.768z",
|
|
23
|
+
fill: "#00B956"
|
|
24
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
clipRule: "evenodd",
|
|
27
|
+
d: "M528.259 30.307c20.837 0 29.157 8.981 29.157 28.27 0 18.994-8.468 28.122-29.304 28.122h-4.565c-20.837 0-29.304-9.128-29.304-28.122 0-19.289 8.246-28.27 29.157-28.27h4.859zm-4.638 44.981h4.417c11.412 0 15.977-5.153 15.977-16.711v-.074c0-11.19-4.27-16.712-15.977-16.712h-4.417c-12.075 0-15.978 5.522-15.978 16.712v.074c0 11.558 4.492 16.711 15.978 16.711zm-95.127-52.785h27.316c20.321 0 28.493 10.307 28.567 28.27 0 2.797-.221 5.374-.589 7.804-2.135 12.736-9.645 20.54-28.715 20.54h-5.963v7.067h-13.769v-7.067h-6.037c-19.07 0-26.58-7.804-28.715-20.54-.442-2.43-.589-5.006-.589-7.804 0-17.963 8.099-28.27 28.494-28.27zm6.774 44.982h-6.332c-9.351 0-12.664-3.46-14.726-8.908-.81-2.135-.81-4.786-.81-7.804 0-11.706 5.449-16.712 13.4-16.712h8.468v33.424zm34.825-8.908c-2.061 5.448-5.448 8.908-14.725 8.908h-6.332V34.06h8.467c7.952 0 13.4 4.933 13.4 16.712 0 3.018 0 5.669-.81 7.804zM62.86 58.135V1.227c27.242 3.313 48.373 26.577 48.447 54.7 0 30.478-24.74 55.214-55.22 55.214a58.32 58.32 0 01-5.081-.221V63.215a.58.58 0 01.589-.59h6.774c2.43 0 4.49-1.987 4.49-4.49zM61.682 86.11a6.913 6.913 0 01-6.921-6.92 6.913 6.913 0 016.92-6.92 6.913 6.913 0 016.922 6.92 6.913 6.913 0 01-6.921 6.92zm9.277-6.92a6.913 6.913 0 006.92 6.92 6.913 6.913 0 006.922-6.92 6.913 6.913 0 00-6.921-6.92 6.913 6.913 0 00-6.921 6.92zm16.198 0a6.913 6.913 0 006.92 6.92A6.913 6.913 0 00101 79.19a6.913 6.913 0 00-6.921-6.92 6.913 6.913 0 00-6.921 6.92z",
|
|
28
|
+
fill: "#00B956"
|
|
29
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
30
|
+
fillRule: "evenodd",
|
|
31
|
+
clipRule: "evenodd",
|
|
32
|
+
d: "M.792 56C.792 25.521 25.531.785 56.012.785h.148v54.626a.58.58 0 01-.59.589h-6.92c-2.356.074-4.27 2.061-4.344 4.417v49.546C19.42 104.589.792 82.503.792 56zm37.697-16.638a6.913 6.913 0 006.921 6.92 6.913 6.913 0 006.921-6.92 6.913 6.913 0 00-6.92-6.92 6.913 6.913 0 00-6.922 6.92z",
|
|
33
|
+
fill: "#00B956"
|
|
34
|
+
}));
|
|
19
35
|
};
|
|
20
36
|
|
|
21
37
|
var greenVerticalImg = function greenVerticalImg(props) {
|
|
@@ -17,6 +17,12 @@ declare type ShadowType = typeof ShadowTypes[keyof typeof ShadowTypes];
|
|
|
17
17
|
export interface INotificationProps {
|
|
18
18
|
/** Дополнительный класс корневого элемента */
|
|
19
19
|
className?: string;
|
|
20
|
+
/** Дополнительные классы для корневого и внутренних элементов */
|
|
21
|
+
classes?: {
|
|
22
|
+
root?: string;
|
|
23
|
+
container?: string;
|
|
24
|
+
content?: string;
|
|
25
|
+
};
|
|
20
26
|
/** Тип отображения */
|
|
21
27
|
type?: NotificationType;
|
|
22
28
|
/** Уровень тени */
|
|
@@ -77,6 +77,11 @@ var cn = cnCreate('mfui-notification');
|
|
|
77
77
|
|
|
78
78
|
var Notification = function Notification(_ref) {
|
|
79
79
|
var className = _ref.className,
|
|
80
|
+
_ref$classes = _ref.classes;
|
|
81
|
+
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
82
|
+
var rootClass = _ref$classes.root,
|
|
83
|
+
containerClass = _ref$classes.container,
|
|
84
|
+
contentClass = _ref$classes.content,
|
|
80
85
|
children = _ref.children,
|
|
81
86
|
_ref$type = _ref.type,
|
|
82
87
|
type = _ref$type === void 0 ? 'info' : _ref$type,
|
|
@@ -143,13 +148,13 @@ var Notification = function Notification(_ref) {
|
|
|
143
148
|
className: cn({
|
|
144
149
|
type: type,
|
|
145
150
|
colored: isColored
|
|
146
|
-
}, className)
|
|
151
|
+
}, [className, rootClass])
|
|
147
152
|
}, /*#__PURE__*/React.createElement("div", {
|
|
148
|
-
className: cn('container')
|
|
153
|
+
className: cn('container', [containerClass])
|
|
149
154
|
}, /*#__PURE__*/React.createElement("div", {
|
|
150
155
|
className: cn('icon-container')
|
|
151
156
|
}, renderIcon()), /*#__PURE__*/React.createElement("div", {
|
|
152
|
-
className: cn('content')
|
|
157
|
+
className: cn('content', [contentClass])
|
|
153
158
|
}, title && /*#__PURE__*/React.createElement(Header, {
|
|
154
159
|
dataAttrs: {
|
|
155
160
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
|
|
@@ -174,6 +179,11 @@ var Notification = function Notification(_ref) {
|
|
|
174
179
|
Notification.propTypes = {
|
|
175
180
|
type: PropTypes.oneOf(Object.values(NotificationTypes)),
|
|
176
181
|
className: PropTypes.string,
|
|
182
|
+
classes: PropTypes.shape({
|
|
183
|
+
root: PropTypes.string,
|
|
184
|
+
container: PropTypes.string,
|
|
185
|
+
content: PropTypes.string
|
|
186
|
+
}),
|
|
177
187
|
shadowLevel: PropTypes.oneOf(Object.values(ShadowTypes)),
|
|
178
188
|
isColored: PropTypes.bool,
|
|
179
189
|
hasCloseButton: PropTypes.bool,
|
|
@@ -37,6 +37,8 @@ export interface ITooltipProps {
|
|
|
37
37
|
targetElement?: React.RefObject<HTMLElement>;
|
|
38
38
|
/** Управление состоянием. Компонент поддерживает контроллируемое и неконтроллируемое состояние. */
|
|
39
39
|
isOpened?: boolean;
|
|
40
|
+
/** Отрендерить компонент в корневой элементе страницы body */
|
|
41
|
+
isPortal?: boolean;
|
|
40
42
|
/** Дополнительный класс корневого элемента */
|
|
41
43
|
className?: string;
|
|
42
44
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -6,6 +6,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
6
6
|
import React, { useState, useCallback, useEffect, useMemo } from 'react';
|
|
7
7
|
import { cnCreate, detectTouch, checkNativeEventIsClickOrEnterPress, filterDataAttrs } from '@megafon/ui-helpers';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
9
|
+
import ReactDOM from 'react-dom';
|
|
9
10
|
import { usePopper } from 'react-popper';
|
|
10
11
|
import Tile from "../Tile/Tile";
|
|
11
12
|
import "./Tooltip.css";
|
|
@@ -45,6 +46,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
45
46
|
targetElement = _ref.targetElement,
|
|
46
47
|
_ref$isOpened = _ref.isOpened,
|
|
47
48
|
isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
|
|
49
|
+
_ref$isPortal = _ref.isPortal,
|
|
50
|
+
isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal,
|
|
48
51
|
children = _ref.children,
|
|
49
52
|
_ref$classes = _ref.classes;
|
|
50
53
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
@@ -58,6 +61,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
58
61
|
var currentTrigger = triggerElement.current;
|
|
59
62
|
var currentTarget = (targetElement === null || targetElement === void 0 ? void 0 : targetElement.current) || currentTrigger;
|
|
60
63
|
var currentBoundary = boundaryElement === null || boundaryElement === void 0 ? void 0 : boundaryElement.current;
|
|
64
|
+
var portalElem = React.useRef(null);
|
|
61
65
|
|
|
62
66
|
var _useState = useState(null),
|
|
63
67
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -215,7 +219,16 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
215
219
|
|
|
216
220
|
return undefined;
|
|
217
221
|
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick, clickEvent]);
|
|
218
|
-
|
|
222
|
+
useEffect(function () {
|
|
223
|
+
return function () {
|
|
224
|
+
if (portalElem.current) {
|
|
225
|
+
document.body.removeChild(portalElem.current);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
portalElem.current = null;
|
|
229
|
+
};
|
|
230
|
+
}, []);
|
|
231
|
+
var template = /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
219
232
|
className: cn({
|
|
220
233
|
paddings: paddings,
|
|
221
234
|
open: isOpen
|
|
@@ -238,6 +251,18 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
238
251
|
shadowLevel: "high",
|
|
239
252
|
className: cn('content-shadow', [contentShadowClassName])
|
|
240
253
|
}));
|
|
254
|
+
/* Не в эффекте, чтобы не создавать лишний перерендер компонента. Из-за синхронности кода в return уже будет элемент */
|
|
255
|
+
|
|
256
|
+
if (isPortal && !portalElem.current && typeof window !== 'undefined') {
|
|
257
|
+
portalElem.current = document.createElement('div');
|
|
258
|
+
document.body.appendChild(portalElem.current);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (isPortal && portalElem.current) {
|
|
262
|
+
return portalElem.current ? ReactDOM.createPortal(template, portalElem.current) : null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return template;
|
|
241
266
|
};
|
|
242
267
|
|
|
243
268
|
Tooltip.propTypes = {
|
|
@@ -268,6 +293,7 @@ Tooltip.propTypes = {
|
|
|
268
293
|
current: PropTypes.elementType
|
|
269
294
|
}), PropTypes.any])]),
|
|
270
295
|
isOpened: PropTypes.bool,
|
|
296
|
+
isPortal: PropTypes.bool,
|
|
271
297
|
className: PropTypes.string,
|
|
272
298
|
classes: PropTypes.shape({
|
|
273
299
|
root: PropTypes.string,
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
appearance: none;
|
|
22
22
|
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
23
23
|
}
|
|
24
|
+
.mfui-button_size-all_extra-small .mfui-button__inner {
|
|
25
|
+
min-width: 26px;
|
|
26
|
+
height: 26px;
|
|
27
|
+
}
|
|
24
28
|
.mfui-button_size-all_small .mfui-button__inner {
|
|
25
29
|
min-width: 32px;
|
|
26
30
|
height: 32px;
|
|
@@ -33,6 +37,10 @@
|
|
|
33
37
|
min-width: 60px;
|
|
34
38
|
height: 60px;
|
|
35
39
|
}
|
|
40
|
+
.mfui-button_size-all_extra-small .mfui-button__icon {
|
|
41
|
+
width: 18px;
|
|
42
|
+
height: 18px;
|
|
43
|
+
}
|
|
36
44
|
.mfui-button_size-all_small .mfui-button__icon {
|
|
37
45
|
width: 24px;
|
|
38
46
|
height: 24px;
|
|
@@ -46,6 +54,10 @@
|
|
|
46
54
|
height: 40px;
|
|
47
55
|
}
|
|
48
56
|
@media screen and (min-width: 1280px) {
|
|
57
|
+
.mfui-button_size-wide_extra-small .mfui-button__inner {
|
|
58
|
+
min-width: 26px;
|
|
59
|
+
height: 26px;
|
|
60
|
+
}
|
|
49
61
|
.mfui-button_size-wide_small .mfui-button__inner {
|
|
50
62
|
min-width: 32px;
|
|
51
63
|
height: 32px;
|
|
@@ -58,6 +70,10 @@
|
|
|
58
70
|
min-width: 60px;
|
|
59
71
|
height: 60px;
|
|
60
72
|
}
|
|
73
|
+
.mfui-button_size-wide_extra-small .mfui-button__icon {
|
|
74
|
+
width: 18px;
|
|
75
|
+
height: 18px;
|
|
76
|
+
}
|
|
61
77
|
.mfui-button_size-wide_small .mfui-button__icon {
|
|
62
78
|
width: 24px;
|
|
63
79
|
height: 24px;
|
|
@@ -72,6 +88,10 @@
|
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
@media screen and (min-width: 1024px) {
|
|
91
|
+
.mfui-button_size-desktop_extra-small .mfui-button__inner {
|
|
92
|
+
min-width: 26px;
|
|
93
|
+
height: 26px;
|
|
94
|
+
}
|
|
75
95
|
.mfui-button_size-desktop_small .mfui-button__inner {
|
|
76
96
|
min-width: 32px;
|
|
77
97
|
height: 32px;
|
|
@@ -84,6 +104,10 @@
|
|
|
84
104
|
min-width: 60px;
|
|
85
105
|
height: 60px;
|
|
86
106
|
}
|
|
107
|
+
.mfui-button_size-desktop_extra-small .mfui-button__icon {
|
|
108
|
+
width: 18px;
|
|
109
|
+
height: 18px;
|
|
110
|
+
}
|
|
87
111
|
.mfui-button_size-desktop_small .mfui-button__icon {
|
|
88
112
|
width: 24px;
|
|
89
113
|
height: 24px;
|
|
@@ -98,6 +122,10 @@
|
|
|
98
122
|
}
|
|
99
123
|
}
|
|
100
124
|
@media screen and (min-width: 768px) and (max-width: 1023px) {
|
|
125
|
+
.mfui-button_size-tablet_extra-small .mfui-button__inner {
|
|
126
|
+
min-width: 26px;
|
|
127
|
+
height: 26px;
|
|
128
|
+
}
|
|
101
129
|
.mfui-button_size-tablet_small .mfui-button__inner {
|
|
102
130
|
min-width: 32px;
|
|
103
131
|
height: 32px;
|
|
@@ -110,6 +138,10 @@
|
|
|
110
138
|
min-width: 60px;
|
|
111
139
|
height: 60px;
|
|
112
140
|
}
|
|
141
|
+
.mfui-button_size-tablet_extra-small .mfui-button__icon {
|
|
142
|
+
width: 18px;
|
|
143
|
+
height: 18px;
|
|
144
|
+
}
|
|
113
145
|
.mfui-button_size-tablet_small .mfui-button__icon {
|
|
114
146
|
width: 24px;
|
|
115
147
|
height: 24px;
|
|
@@ -124,6 +156,10 @@
|
|
|
124
156
|
}
|
|
125
157
|
}
|
|
126
158
|
@media screen and (max-width: 767px) {
|
|
159
|
+
.mfui-button_size-mobile_extra-small .mfui-button__inner {
|
|
160
|
+
min-width: 26px;
|
|
161
|
+
height: 26px;
|
|
162
|
+
}
|
|
127
163
|
.mfui-button_size-mobile_small .mfui-button__inner {
|
|
128
164
|
min-width: 32px;
|
|
129
165
|
height: 32px;
|
|
@@ -136,6 +172,10 @@
|
|
|
136
172
|
min-width: 60px;
|
|
137
173
|
height: 60px;
|
|
138
174
|
}
|
|
175
|
+
.mfui-button_size-mobile_extra-small .mfui-button__icon {
|
|
176
|
+
width: 18px;
|
|
177
|
+
height: 18px;
|
|
178
|
+
}
|
|
139
179
|
.mfui-button_size-mobile_small .mfui-button__icon {
|
|
140
180
|
width: 24px;
|
|
141
181
|
height: 24px;
|
|
@@ -13,6 +13,7 @@ export declare const ButtonThemes: {
|
|
|
13
13
|
};
|
|
14
14
|
declare type ButtonThemesType = typeof ButtonThemes[keyof typeof ButtonThemes];
|
|
15
15
|
export declare const ButtonSizes: {
|
|
16
|
+
readonly EXTRA_SMALL: "extra-small";
|
|
16
17
|
readonly SMALL: "small";
|
|
17
18
|
readonly MEDIUM: "medium";
|
|
18
19
|
readonly LARGE: "large";
|
|
@@ -54,6 +54,7 @@ var ButtonThemes = {
|
|
|
54
54
|
};
|
|
55
55
|
exports.ButtonThemes = ButtonThemes;
|
|
56
56
|
var ButtonSizes = {
|
|
57
|
+
EXTRA_SMALL: 'extra-small',
|
|
57
58
|
SMALL: 'small',
|
|
58
59
|
MEDIUM: 'medium',
|
|
59
60
|
LARGE: 'large'
|
|
@@ -68,7 +69,7 @@ var Content;
|
|
|
68
69
|
})(Content || (Content = {}));
|
|
69
70
|
|
|
70
71
|
var getLoaderSize = function getLoaderSize(size) {
|
|
71
|
-
return size === ButtonSizes.SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
72
|
+
return size === ButtonSizes.SMALL || size === ButtonSizes.EXTRA_SMALL ? ButtonSizes.SMALL : ButtonSizes.MEDIUM;
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
var cn = (0, _uiHelpers.cnCreate)('mfui-button');
|
|
@@ -86,6 +86,17 @@ var dayLabelFormat = function dayLabelFormat(date) {
|
|
|
86
86
|
var monthLabelFormat = function monthLabelFormat(date) {
|
|
87
87
|
return formatDate(date, 'LLLL');
|
|
88
88
|
};
|
|
89
|
+
/* List of cases to check on component change:
|
|
90
|
+
|
|
91
|
+
- Should correctly choose value and trigger callbacks with correct arguments on dates choose.
|
|
92
|
+
- Should set 1 day period if start and end date is equal
|
|
93
|
+
- Should correctly increase period if choose earlier start date
|
|
94
|
+
- Should correctly change start date of selected period if chosen date in period closer to current start date
|
|
95
|
+
- Should correctly change end date of selected period if chosen date in period closer to current end date
|
|
96
|
+
- Should correctly highlights period if start date chosen and hover on possible end date
|
|
97
|
+
|
|
98
|
+
*/
|
|
99
|
+
|
|
89
100
|
|
|
90
101
|
var cn = (0, _uiHelpers.cnCreate)('mfui-calendar');
|
|
91
102
|
|
|
@@ -124,6 +135,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
124
135
|
hoveredDate = _useState4[0],
|
|
125
136
|
setHoveredDate = _useState4[1];
|
|
126
137
|
|
|
138
|
+
var isUserChoice = (0, _react.useRef)(false);
|
|
127
139
|
var stateStartDate = calendarState.startDate,
|
|
128
140
|
stateEndDate = calendarState.endDate,
|
|
129
141
|
stateFocusedInput = calendarState.focusedInput;
|
|
@@ -144,10 +156,13 @@ var Calendar = function Calendar(_ref) {
|
|
|
144
156
|
goToDate = _a.goToDate,
|
|
145
157
|
pickerProps = __rest(_a, ["firstDayOfWeek", "activeMonths", "goToPreviousMonths", "goToNextMonths", "goToDate"]);
|
|
146
158
|
|
|
159
|
+
(0, _react.useEffect)(function () {
|
|
160
|
+
isUserChoice.current = false;
|
|
161
|
+
}, [startDate]);
|
|
147
162
|
(0, _react.useEffect)(function () {
|
|
148
163
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
149
164
|
setCalendarState(calendarStateFromProps);
|
|
150
|
-
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
165
|
+
!isUserChoice.current && propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
151
166
|
}, [calendarStateFromProps]);
|
|
152
167
|
|
|
153
168
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -212,6 +227,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
212
227
|
var nextStartDate = nextState.startDate,
|
|
213
228
|
nextEndDate = nextState.endDate;
|
|
214
229
|
setCalendarState(nextState);
|
|
230
|
+
isUserChoice.current = true;
|
|
215
231
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
216
232
|
};
|
|
217
233
|
|
|
@@ -23,9 +23,9 @@ var ArrowLeft = function ArrowLeft(props) {
|
|
|
23
23
|
return /*#__PURE__*/_react["default"].createElement("svg", (0, _extends2["default"])({
|
|
24
24
|
viewBox: "0 0 20 20"
|
|
25
25
|
}, props), /*#__PURE__*/_react["default"].createElement("path", {
|
|
26
|
+
d: "M12 6v8l-5-4z",
|
|
26
27
|
fillRule: "evenodd",
|
|
27
|
-
clipRule: "evenodd"
|
|
28
|
-
d: "M12 6v8l-5-4z"
|
|
28
|
+
clipRule: "evenodd"
|
|
29
29
|
}));
|
|
30
30
|
};
|
|
31
31
|
|
|
@@ -33,9 +33,9 @@ var ArrowRight = function ArrowRight(props) {
|
|
|
33
33
|
return /*#__PURE__*/_react["default"].createElement("svg", (0, _extends2["default"])({
|
|
34
34
|
viewBox: "0 0 20 20"
|
|
35
35
|
}, props), /*#__PURE__*/_react["default"].createElement("path", {
|
|
36
|
+
d: "M8 14V6l5 4z",
|
|
36
37
|
fillRule: "evenodd",
|
|
37
|
-
clipRule: "evenodd"
|
|
38
|
-
d: "M8 14V6l5 4z"
|
|
38
|
+
clipRule: "evenodd"
|
|
39
39
|
}));
|
|
40
40
|
};
|
|
41
41
|
|
|
@@ -27,14 +27,30 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
27
27
|
|
|
28
28
|
var greenHorizontalImg = function greenHorizontalImg(props) {
|
|
29
29
|
return /*#__PURE__*/React.createElement("svg", (0, _extends2["default"])({
|
|
30
|
-
viewBox: "0 0
|
|
31
|
-
|
|
30
|
+
viewBox: "0 0 623 112",
|
|
31
|
+
fill: "none"
|
|
32
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
33
|
+
d: "M608.292 31.117V51.95h-27.978V31.117h-13.769v55.067h13.769V63.951h27.978v22.233h13.842V31.117h-13.842z",
|
|
32
34
|
fill: "#00B956"
|
|
33
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
34
|
-
d: "M30.3.7v27.8c0 1.3-1 2.2-2.2 2.2h-3.3c-.2 0-.3.2-.3.3v23.3c.8 0 1.6.2 2.5.2 14.9 0 27-12.1 27-27C54 13.8 43.7 2.3 30.3.7zm-.6 41.6c-1.9 0-3.3-1.6-3.3-3.3 0-1.9 1.6-3.3 3.3-3.3 1.9 0 3.3 1.6 3.3 3.3.2 1.8-1.4 3.3-3.3 3.3zm7.9 0c-1.9 0-3.3-1.6-3.3-3.3 0-1.9 1.6-3.3 3.3-3.3 1.9 0 3.3 1.6 3.3 3.3s-1.3 3.3-3.3 3.3zm8 0c-1.9 0-3.3-1.6-3.3-3.3 0-1.9 1.6-3.3 3.3-3.3 1.9 0 3.3 1.6 3.3 3.3s-1.4 3.3-3.3 3.3z"
|
|
35
35
|
}), /*#__PURE__*/React.createElement("path", {
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
fillRule: "evenodd",
|
|
37
|
+
clipRule: "evenodd",
|
|
38
|
+
d: "M367.31 29.865c4.417 0 9.056 2.43 11.338 7.436l22.53 48.883h-14.652l-4.933-11.632h-28.567l-4.933 11.632h-14.652l22.53-48.883c2.282-5.007 6.921-7.436 11.339-7.436zm-1.105 13.693l-8.467 19.951h19.143l-8.467-19.95c-.221-.663-.736-.81-1.104-.81-.369 0-.81.22-1.105.81z",
|
|
39
|
+
fill: "#00B956"
|
|
40
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
41
|
+
d: "M214.533 21.178c-6.48 0-10.603 3.46-13.622 10.38l-17.965 41.374-17.965-41.374c-3.018-6.92-7.142-10.38-13.621-10.38-6.037 0-12.296 4.343-12.296 13.693v51.313h13.769v-49.84l18.112 41.08c2.43 5.742 6.332 9.349 12.001 9.349 5.67 0 9.572-3.607 12.002-9.35l18.112-41.08v49.841h13.768v-51.24c0-9.423-6.258-13.766-12.295-13.766zm36.445 53.227a1.163 1.163 0 01-1.178-1.178v-9.644h34.384V52.319H249.8v-8.393c0-.662.515-1.178 1.178-1.178h34.016V31.117h-40.79c-4.785 0-8.172 3.975-8.172 8.171v38.577c0 4.196 3.46 8.172 8.172 8.172h40.79V74.405h-34.016zm57.429 11.779V44c0-.663.516-1.178 1.179-1.178h34.015V31.19h-40.789c-4.786 0-8.173 3.976-8.173 8.172v46.822h13.768z",
|
|
42
|
+
fill: "#00B956"
|
|
43
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
44
|
+
fillRule: "evenodd",
|
|
45
|
+
clipRule: "evenodd",
|
|
46
|
+
d: "M528.259 30.307c20.837 0 29.157 8.981 29.157 28.27 0 18.994-8.468 28.122-29.304 28.122h-4.565c-20.837 0-29.304-9.128-29.304-28.122 0-19.289 8.246-28.27 29.157-28.27h4.859zm-4.638 44.981h4.417c11.412 0 15.977-5.153 15.977-16.711v-.074c0-11.19-4.27-16.712-15.977-16.712h-4.417c-12.075 0-15.978 5.522-15.978 16.712v.074c0 11.558 4.492 16.711 15.978 16.711zm-95.127-52.785h27.316c20.321 0 28.493 10.307 28.567 28.27 0 2.797-.221 5.374-.589 7.804-2.135 12.736-9.645 20.54-28.715 20.54h-5.963v7.067h-13.769v-7.067h-6.037c-19.07 0-26.58-7.804-28.715-20.54-.442-2.43-.589-5.006-.589-7.804 0-17.963 8.099-28.27 28.494-28.27zm6.774 44.982h-6.332c-9.351 0-12.664-3.46-14.726-8.908-.81-2.135-.81-4.786-.81-7.804 0-11.706 5.449-16.712 13.4-16.712h8.468v33.424zm34.825-8.908c-2.061 5.448-5.448 8.908-14.725 8.908h-6.332V34.06h8.467c7.952 0 13.4 4.933 13.4 16.712 0 3.018 0 5.669-.81 7.804zM62.86 58.135V1.227c27.242 3.313 48.373 26.577 48.447 54.7 0 30.478-24.74 55.214-55.22 55.214a58.32 58.32 0 01-5.081-.221V63.215a.58.58 0 01.589-.59h6.774c2.43 0 4.49-1.987 4.49-4.49zM61.682 86.11a6.913 6.913 0 01-6.921-6.92 6.913 6.913 0 016.92-6.92 6.913 6.913 0 016.922 6.92 6.913 6.913 0 01-6.921 6.92zm9.277-6.92a6.913 6.913 0 006.92 6.92 6.913 6.913 0 006.922-6.92 6.913 6.913 0 00-6.921-6.92 6.913 6.913 0 00-6.921 6.92zm16.198 0a6.913 6.913 0 006.92 6.92A6.913 6.913 0 00101 79.19a6.913 6.913 0 00-6.921-6.92 6.913 6.913 0 00-6.921 6.92z",
|
|
47
|
+
fill: "#00B956"
|
|
48
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
49
|
+
fillRule: "evenodd",
|
|
50
|
+
clipRule: "evenodd",
|
|
51
|
+
d: "M.792 56C.792 25.521 25.531.785 56.012.785h.148v54.626a.58.58 0 01-.59.589h-6.92c-2.356.074-4.27 2.061-4.344 4.417v49.546C19.42 104.589.792 82.503.792 56zm37.697-16.638a6.913 6.913 0 006.921 6.92 6.913 6.913 0 006.921-6.92 6.913 6.913 0 00-6.92-6.92 6.913 6.913 0 00-6.922 6.92z",
|
|
52
|
+
fill: "#00B956"
|
|
53
|
+
}));
|
|
38
54
|
};
|
|
39
55
|
|
|
40
56
|
var greenVerticalImg = function greenVerticalImg(props) {
|
|
@@ -17,6 +17,12 @@ declare type ShadowType = typeof ShadowTypes[keyof typeof ShadowTypes];
|
|
|
17
17
|
export interface INotificationProps {
|
|
18
18
|
/** Дополнительный класс корневого элемента */
|
|
19
19
|
className?: string;
|
|
20
|
+
/** Дополнительные классы для корневого и внутренних элементов */
|
|
21
|
+
classes?: {
|
|
22
|
+
root?: string;
|
|
23
|
+
container?: string;
|
|
24
|
+
content?: string;
|
|
25
|
+
};
|
|
20
26
|
/** Тип отображения */
|
|
21
27
|
type?: NotificationType;
|
|
22
28
|
/** Уровень тени */
|
|
@@ -101,6 +101,11 @@ var cn = (0, _uiHelpers.cnCreate)('mfui-notification');
|
|
|
101
101
|
|
|
102
102
|
var Notification = function Notification(_ref) {
|
|
103
103
|
var className = _ref.className,
|
|
104
|
+
_ref$classes = _ref.classes;
|
|
105
|
+
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
106
|
+
var rootClass = _ref$classes.root,
|
|
107
|
+
containerClass = _ref$classes.container,
|
|
108
|
+
contentClass = _ref$classes.content,
|
|
104
109
|
children = _ref.children,
|
|
105
110
|
_ref$type = _ref.type,
|
|
106
111
|
type = _ref$type === void 0 ? 'info' : _ref$type,
|
|
@@ -167,13 +172,13 @@ var Notification = function Notification(_ref) {
|
|
|
167
172
|
className: cn({
|
|
168
173
|
type: type,
|
|
169
174
|
colored: isColored
|
|
170
|
-
}, className)
|
|
175
|
+
}, [className, rootClass])
|
|
171
176
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
|
-
className: cn('container')
|
|
177
|
+
className: cn('container', [containerClass])
|
|
173
178
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
174
179
|
className: cn('icon-container')
|
|
175
180
|
}, renderIcon()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
|
-
className: cn('content')
|
|
181
|
+
className: cn('content', [contentClass])
|
|
177
182
|
}, title && /*#__PURE__*/_react["default"].createElement(_Header["default"], {
|
|
178
183
|
dataAttrs: {
|
|
179
184
|
root: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title
|
|
@@ -198,6 +203,11 @@ var Notification = function Notification(_ref) {
|
|
|
198
203
|
Notification.propTypes = {
|
|
199
204
|
type: PropTypes.oneOf(Object.values(NotificationTypes)),
|
|
200
205
|
className: PropTypes.string,
|
|
206
|
+
classes: PropTypes.shape({
|
|
207
|
+
root: PropTypes.string,
|
|
208
|
+
container: PropTypes.string,
|
|
209
|
+
content: PropTypes.string
|
|
210
|
+
}),
|
|
201
211
|
shadowLevel: PropTypes.oneOf(Object.values(ShadowTypes)),
|
|
202
212
|
isColored: PropTypes.bool,
|
|
203
213
|
hasCloseButton: PropTypes.bool,
|
|
@@ -37,6 +37,8 @@ export interface ITooltipProps {
|
|
|
37
37
|
targetElement?: React.RefObject<HTMLElement>;
|
|
38
38
|
/** Управление состоянием. Компонент поддерживает контроллируемое и неконтроллируемое состояние. */
|
|
39
39
|
isOpened?: boolean;
|
|
40
|
+
/** Отрендерить компонент в корневой элементе страницы body */
|
|
41
|
+
isPortal?: boolean;
|
|
40
42
|
/** Дополнительный класс корневого элемента */
|
|
41
43
|
className?: string;
|
|
42
44
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -23,6 +23,8 @@ var _uiHelpers = require("@megafon/ui-helpers");
|
|
|
23
23
|
|
|
24
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
25
|
|
|
26
|
+
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
27
|
+
|
|
26
28
|
var _reactPopper = require("react-popper");
|
|
27
29
|
|
|
28
30
|
var _Tile = _interopRequireDefault(require("../Tile/Tile"));
|
|
@@ -72,6 +74,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
72
74
|
targetElement = _ref.targetElement,
|
|
73
75
|
_ref$isOpened = _ref.isOpened,
|
|
74
76
|
isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
|
|
77
|
+
_ref$isPortal = _ref.isPortal,
|
|
78
|
+
isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal,
|
|
75
79
|
children = _ref.children,
|
|
76
80
|
_ref$classes = _ref.classes;
|
|
77
81
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
@@ -86,6 +90,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
86
90
|
var currentTarget = (targetElement === null || targetElement === void 0 ? void 0 : targetElement.current) || currentTrigger;
|
|
87
91
|
var currentBoundary = boundaryElement === null || boundaryElement === void 0 ? void 0 : boundaryElement.current;
|
|
88
92
|
|
|
93
|
+
var portalElem = _react["default"].useRef(null);
|
|
94
|
+
|
|
89
95
|
var _useState = (0, _react.useState)(null),
|
|
90
96
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
91
97
|
popperElement = _useState2[0],
|
|
@@ -242,7 +248,17 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
242
248
|
|
|
243
249
|
return undefined;
|
|
244
250
|
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick, clickEvent]);
|
|
245
|
-
|
|
251
|
+
(0, _react.useEffect)(function () {
|
|
252
|
+
return function () {
|
|
253
|
+
if (portalElem.current) {
|
|
254
|
+
document.body.removeChild(portalElem.current);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
portalElem.current = null;
|
|
258
|
+
};
|
|
259
|
+
}, []);
|
|
260
|
+
|
|
261
|
+
var template = /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
246
262
|
className: cn({
|
|
247
263
|
paddings: paddings,
|
|
248
264
|
open: isOpen
|
|
@@ -265,6 +281,19 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
265
281
|
shadowLevel: "high",
|
|
266
282
|
className: cn('content-shadow', [contentShadowClassName])
|
|
267
283
|
}));
|
|
284
|
+
/* Не в эффекте, чтобы не создавать лишний перерендер компонента. Из-за синхронности кода в return уже будет элемент */
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
if (isPortal && !portalElem.current && typeof window !== 'undefined') {
|
|
288
|
+
portalElem.current = document.createElement('div');
|
|
289
|
+
document.body.appendChild(portalElem.current);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (isPortal && portalElem.current) {
|
|
293
|
+
return portalElem.current ? _reactDom["default"].createPortal(template, portalElem.current) : null;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return template;
|
|
268
297
|
};
|
|
269
298
|
|
|
270
299
|
Tooltip.propTypes = {
|
|
@@ -295,6 +324,7 @@ Tooltip.propTypes = {
|
|
|
295
324
|
current: _propTypes["default"].elementType
|
|
296
325
|
}), _propTypes["default"].any])]),
|
|
297
326
|
isOpened: _propTypes["default"].bool,
|
|
327
|
+
isPortal: _propTypes["default"].bool,
|
|
298
328
|
className: _propTypes["default"].string,
|
|
299
329
|
classes: _propTypes["default"].shape({
|
|
300
330
|
root: _propTypes["default"].string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@babel/preset-env": "^7.8.6",
|
|
55
55
|
"@babel/preset-react": "^7.8.3",
|
|
56
56
|
"@babel/preset-typescript": "^7.8.3",
|
|
57
|
-
"@megafon/ui-icons": "^1.2.
|
|
57
|
+
"@megafon/ui-icons": "^1.2.2",
|
|
58
58
|
"@svgr/core": "^2.4.1",
|
|
59
59
|
"@testing-library/react-hooks": "^7.0.1",
|
|
60
60
|
"@types/enzyme": "^3.10.5",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"react-popper": "^2.2.3",
|
|
98
98
|
"swiper": "^6.5.6"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "929d0fbafbdc4d2aa98f283f7c71dff21347542f"
|
|
101
101
|
}
|