@megafon/ui-core 3.8.0 → 3.9.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 +17 -0
- package/dist/es/components/Select/Select.js +1 -1
- package/dist/es/components/Switcher/Switcher.d.ts +1 -0
- package/dist/es/components/Switcher/Switcher.js +4 -3
- package/dist/es/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/es/components/Tooltip/Tooltip.js +8 -3
- package/dist/lib/components/Select/Select.js +1 -1
- package/dist/lib/components/Switcher/Switcher.d.ts +1 -0
- package/dist/lib/components/Switcher/Switcher.js +4 -3
- package/dist/lib/components/Tooltip/Tooltip.d.ts +2 -0
- package/dist/lib/components/Tooltip/Tooltip.js +8 -3
- package/package.json +2 -2
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
|
+
# [3.9.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.8.0...@megafon/ui-core@3.9.0) (2022-05-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **select:** fix selected item color when value is zero ([9847095](https://github.com/MegafonWebLab/megafon-ui/commit/98470955ef813504d4bfa4cd4d3aba77b5458446))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **switcher:** add data-attribute for inner element ([793a022](https://github.com/MegafonWebLab/megafon-ui/commit/793a0224ab957b938e67dd1b4d16c2389a9fb6f8))
|
|
17
|
+
* **tooltip:** add portal selector props ([6188832](https://github.com/MegafonWebLab/megafon-ui/commit/6188832e9ba212e7a8182333aba06d77c3e979d6))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
# [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
24
|
|
|
8
25
|
|
|
@@ -337,7 +337,7 @@ var Select = function Select(_ref) {
|
|
|
337
337
|
|
|
338
338
|
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title), {
|
|
339
339
|
className: cn('title', {
|
|
340
|
-
placeholder: !!placeholder &&
|
|
340
|
+
placeholder: !!placeholder && currentValue === undefined
|
|
341
341
|
}, [classes === null || classes === void 0 ? void 0 : classes.title]),
|
|
342
342
|
role: "button",
|
|
343
343
|
tabIndex: 0,
|
|
@@ -40,7 +40,7 @@ var Switcher = function Switcher(_ref) {
|
|
|
40
40
|
size: textSize,
|
|
41
41
|
left: true
|
|
42
42
|
})
|
|
43
|
-
}, children), /*#__PURE__*/React.createElement("div", {
|
|
43
|
+
}, children), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
44
44
|
className: cn('input', {
|
|
45
45
|
checked: checked,
|
|
46
46
|
disabled: disabled,
|
|
@@ -50,7 +50,7 @@ var Switcher = function Switcher(_ref) {
|
|
|
50
50
|
onClick: handleChange,
|
|
51
51
|
onKeyDown: handleChange,
|
|
52
52
|
tabIndex: isInteractiveDisabled ? undefined : 0
|
|
53
|
-
}, showLoader && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
53
|
+
}), showLoader && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
54
54
|
className: cn('loader')
|
|
55
55
|
}), /*#__PURE__*/React.createElement("div", {
|
|
56
56
|
className: cn('pointer')
|
|
@@ -63,7 +63,8 @@ var Switcher = function Switcher(_ref) {
|
|
|
63
63
|
|
|
64
64
|
Switcher.propTypes = {
|
|
65
65
|
dataAttrs: PropTypes.shape({
|
|
66
|
-
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
66
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
67
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
67
68
|
}),
|
|
68
69
|
className: PropTypes.string,
|
|
69
70
|
textSize: PropTypes.oneOf(['small', 'medium']),
|
|
@@ -39,6 +39,8 @@ export interface ITooltipProps {
|
|
|
39
39
|
isOpened?: boolean;
|
|
40
40
|
/** Отрендерить компонент в корневой элементе страницы body */
|
|
41
41
|
isPortal?: boolean;
|
|
42
|
+
/** Рендеринг компонента в указанном селекторе */
|
|
43
|
+
portalSelector?: string;
|
|
42
44
|
/** Дополнительный класс корневого элемента */
|
|
43
45
|
className?: string;
|
|
44
46
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -48,6 +48,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
48
48
|
isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
|
|
49
49
|
_ref$isPortal = _ref.isPortal,
|
|
50
50
|
isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal,
|
|
51
|
+
portalSelector = _ref.portalSelector,
|
|
51
52
|
children = _ref.children,
|
|
52
53
|
_ref$classes = _ref.classes;
|
|
53
54
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
@@ -222,12 +223,14 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
222
223
|
useEffect(function () {
|
|
223
224
|
return function () {
|
|
224
225
|
if (portalElem.current) {
|
|
225
|
-
document.
|
|
226
|
+
var parent = portalSelector ? document.querySelector(portalSelector) : document.body;
|
|
227
|
+
parent === null || parent === void 0 ? void 0 : parent.removeChild(portalElem.current);
|
|
226
228
|
}
|
|
227
229
|
|
|
228
230
|
portalElem.current = null;
|
|
229
231
|
};
|
|
230
|
-
},
|
|
232
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
233
|
+
[]);
|
|
231
234
|
var template = /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
232
235
|
className: cn({
|
|
233
236
|
paddings: paddings,
|
|
@@ -255,7 +258,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
255
258
|
|
|
256
259
|
if (isPortal && !portalElem.current && typeof window !== 'undefined') {
|
|
257
260
|
portalElem.current = document.createElement('div');
|
|
258
|
-
document.
|
|
261
|
+
var parent = portalSelector ? document.querySelector(portalSelector) : document.body;
|
|
262
|
+
parent === null || parent === void 0 ? void 0 : parent.appendChild(portalElem.current);
|
|
259
263
|
}
|
|
260
264
|
|
|
261
265
|
if (isPortal && portalElem.current) {
|
|
@@ -294,6 +298,7 @@ Tooltip.propTypes = {
|
|
|
294
298
|
}), PropTypes.any])]),
|
|
295
299
|
isOpened: PropTypes.bool,
|
|
296
300
|
isPortal: PropTypes.bool,
|
|
301
|
+
portalSelector: PropTypes.string,
|
|
297
302
|
className: PropTypes.string,
|
|
298
303
|
classes: PropTypes.shape({
|
|
299
304
|
root: PropTypes.string,
|
|
@@ -372,7 +372,7 @@ var Select = function Select(_ref) {
|
|
|
372
372
|
|
|
373
373
|
return /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.title), {
|
|
374
374
|
className: cn('title', {
|
|
375
|
-
placeholder: !!placeholder &&
|
|
375
|
+
placeholder: !!placeholder && currentValue === undefined
|
|
376
376
|
}, [classes === null || classes === void 0 ? void 0 : classes.title]),
|
|
377
377
|
role: "button",
|
|
378
378
|
tabIndex: 0,
|
|
@@ -58,7 +58,7 @@ var Switcher = function Switcher(_ref) {
|
|
|
58
58
|
size: textSize,
|
|
59
59
|
left: true
|
|
60
60
|
})
|
|
61
|
-
}, children), /*#__PURE__*/React.createElement("div", {
|
|
61
|
+
}, children), /*#__PURE__*/React.createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.input), {
|
|
62
62
|
className: cn('input', {
|
|
63
63
|
checked: checked,
|
|
64
64
|
disabled: disabled,
|
|
@@ -68,7 +68,7 @@ var Switcher = function Switcher(_ref) {
|
|
|
68
68
|
onClick: handleChange,
|
|
69
69
|
onKeyDown: handleChange,
|
|
70
70
|
tabIndex: isInteractiveDisabled ? undefined : 0
|
|
71
|
-
}, showLoader && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
71
|
+
}), showLoader && !disabled && /*#__PURE__*/React.createElement("div", {
|
|
72
72
|
className: cn('loader')
|
|
73
73
|
}), /*#__PURE__*/React.createElement("div", {
|
|
74
74
|
className: cn('pointer')
|
|
@@ -81,7 +81,8 @@ var Switcher = function Switcher(_ref) {
|
|
|
81
81
|
|
|
82
82
|
Switcher.propTypes = {
|
|
83
83
|
dataAttrs: PropTypes.shape({
|
|
84
|
-
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
84
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
85
|
+
input: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
85
86
|
}),
|
|
86
87
|
className: PropTypes.string,
|
|
87
88
|
textSize: PropTypes.oneOf(['small', 'medium']),
|
|
@@ -39,6 +39,8 @@ export interface ITooltipProps {
|
|
|
39
39
|
isOpened?: boolean;
|
|
40
40
|
/** Отрендерить компонент в корневой элементе страницы body */
|
|
41
41
|
isPortal?: boolean;
|
|
42
|
+
/** Рендеринг компонента в указанном селекторе */
|
|
43
|
+
portalSelector?: string;
|
|
42
44
|
/** Дополнительный класс корневого элемента */
|
|
43
45
|
className?: string;
|
|
44
46
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -76,6 +76,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
76
76
|
isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
|
|
77
77
|
_ref$isPortal = _ref.isPortal,
|
|
78
78
|
isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal,
|
|
79
|
+
portalSelector = _ref.portalSelector,
|
|
79
80
|
children = _ref.children,
|
|
80
81
|
_ref$classes = _ref.classes;
|
|
81
82
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
@@ -251,12 +252,14 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
251
252
|
(0, _react.useEffect)(function () {
|
|
252
253
|
return function () {
|
|
253
254
|
if (portalElem.current) {
|
|
254
|
-
document.
|
|
255
|
+
var parent = portalSelector ? document.querySelector(portalSelector) : document.body;
|
|
256
|
+
parent === null || parent === void 0 ? void 0 : parent.removeChild(portalElem.current);
|
|
255
257
|
}
|
|
256
258
|
|
|
257
259
|
portalElem.current = null;
|
|
258
260
|
};
|
|
259
|
-
},
|
|
261
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
262
|
+
[]);
|
|
260
263
|
|
|
261
264
|
var template = /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
262
265
|
className: cn({
|
|
@@ -286,7 +289,8 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
286
289
|
|
|
287
290
|
if (isPortal && !portalElem.current && typeof window !== 'undefined') {
|
|
288
291
|
portalElem.current = document.createElement('div');
|
|
289
|
-
document.
|
|
292
|
+
var parent = portalSelector ? document.querySelector(portalSelector) : document.body;
|
|
293
|
+
parent === null || parent === void 0 ? void 0 : parent.appendChild(portalElem.current);
|
|
290
294
|
}
|
|
291
295
|
|
|
292
296
|
if (isPortal && portalElem.current) {
|
|
@@ -325,6 +329,7 @@ Tooltip.propTypes = {
|
|
|
325
329
|
}), _propTypes["default"].any])]),
|
|
326
330
|
isOpened: _propTypes["default"].bool,
|
|
327
331
|
isPortal: _propTypes["default"].bool,
|
|
332
|
+
portalSelector: _propTypes["default"].string,
|
|
328
333
|
className: _propTypes["default"].string,
|
|
329
334
|
classes: _propTypes["default"].shape({
|
|
330
335
|
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.9.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"styles"
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"react-popper": "^2.2.3",
|
|
98
98
|
"swiper": "^6.5.6"
|
|
99
99
|
},
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "d73d4c12fe5847d60e6274f16e7b7b6af4d861fd"
|
|
101
101
|
}
|