@megafon/ui-core 3.6.0 → 4.0.0-beta.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 -8
- package/dist/es/colors/Colors.css +4 -0
- package/dist/es/components/Badges/components/PriceBadge/PriceBadge.css +1 -1
- package/dist/es/components/Badges/components/PromoBadge/PromoBadge.css +1 -1
- package/dist/es/components/Badges/components/TimerBadge/TimerBadge.css +1 -1
- package/dist/es/components/Calendar/Calendar.js +2 -18
- package/dist/es/components/Calendar/components/Day/Day.css +1 -1
- package/dist/es/components/Calendar/components/Month/Month.css +1 -1
- package/dist/es/components/Caption/Caption.css +48 -0
- package/dist/es/components/Caption/Caption.d.ts +31 -0
- package/dist/es/components/Caption/Caption.js +51 -0
- package/dist/es/components/Paragraph/Paragraph.css +8 -5
- package/dist/es/components/Paragraph/Paragraph.d.ts +4 -3
- package/dist/es/components/Paragraph/Paragraph.js +6 -5
- package/dist/es/components/RadioButton/RadioButton.css +1 -1
- package/dist/es/components/Switcher/Switcher.css +1 -4
- package/dist/es/components/TextField/TextField.js +2 -3
- package/dist/es/components/Tooltip/Tooltip.d.ts +0 -2
- package/dist/es/components/Tooltip/Tooltip.js +1 -27
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/lib/colors/Colors.css +4 -0
- package/dist/lib/components/Badges/components/PriceBadge/PriceBadge.css +1 -1
- package/dist/lib/components/Badges/components/PromoBadge/PromoBadge.css +1 -1
- package/dist/lib/components/Badges/components/TimerBadge/TimerBadge.css +1 -1
- package/dist/lib/components/Calendar/Calendar.js +1 -17
- package/dist/lib/components/Calendar/components/Day/Day.css +1 -1
- package/dist/lib/components/Calendar/components/Month/Month.css +1 -1
- package/dist/lib/components/Caption/Caption.css +48 -0
- package/dist/lib/components/Caption/Caption.d.ts +31 -0
- package/dist/lib/components/Caption/Caption.js +71 -0
- package/dist/lib/components/Paragraph/Paragraph.css +8 -5
- package/dist/lib/components/Paragraph/Paragraph.d.ts +4 -3
- package/dist/lib/components/Paragraph/Paragraph.js +6 -5
- package/dist/lib/components/RadioButton/RadioButton.css +1 -1
- package/dist/lib/components/Switcher/Switcher.css +1 -4
- package/dist/lib/components/TextField/TextField.js +3 -4
- package/dist/lib/components/Tooltip/Tooltip.d.ts +0 -2
- package/dist/lib/components/Tooltip/Tooltip.js +1 -31
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +8 -0
- package/package.json +3 -3
- package/styles/base.less +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,28 +3,37 @@
|
|
|
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
|
-
# [
|
|
6
|
+
# [4.0.0-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3-beta.1...@megafon/ui-core@4.0.0-beta.0) (2022-05-24)
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Features
|
|
10
10
|
|
|
11
|
-
* **
|
|
11
|
+
* **caption:** add new Caption component; update .smallFont() less mixin ([603bed3](https://github.com/MegafonWebLab/megafon-ui/commit/603bed3ce782676b22381e3d4df5dae141fb015c))
|
|
12
|
+
* **paragraph:** remove prop size; add new prop; add 'pale' option to colors ([ef15841](https://github.com/MegafonWebLab/megafon-ui/commit/ef15841474473739d3ac88da7a8737e183ff288a))
|
|
12
13
|
|
|
13
14
|
|
|
14
|
-
###
|
|
15
|
+
### BREAKING CHANGES
|
|
15
16
|
|
|
16
|
-
* **
|
|
17
|
+
* **caption:** .smallFont() less mixin line-height rule now set to 18px instead of 16px
|
|
18
|
+
either accept new rules or manually add line-height: 16px in your components
|
|
19
|
+
* **paragraph:** prop 'size' is no longer exists.
|
|
20
|
+
use component Caption instead of Paragraph size="small"
|
|
17
21
|
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
|
|
21
25
|
|
|
22
|
-
## [3.5.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.
|
|
26
|
+
## [3.5.3-beta.1](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.3-beta.0...@megafon/ui-core@3.5.3-beta.1) (2022-05-06)
|
|
23
27
|
|
|
28
|
+
**Note:** Version bump only for package @megafon/ui-core
|
|
24
29
|
|
|
25
|
-
### Bug Fixes
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## [3.5.3-beta.0](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.5.2...@megafon/ui-core@3.5.3-beta.0) (2022-04-13)
|
|
35
|
+
|
|
36
|
+
**Note:** Version bump only for package @megafon/ui-core
|
|
28
37
|
|
|
29
38
|
|
|
30
39
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
margin: 0 -80px;
|
|
3
3
|
padding: 56px 80px 40px;
|
|
4
4
|
background-color: var(--spbSky0);
|
|
5
|
+
-webkit-transition: background-color 0.3s;
|
|
6
|
+
transition: background-color 0.3s;
|
|
5
7
|
}
|
|
6
8
|
@media screen and (max-width: 1120px) {
|
|
7
9
|
.colors__inner {
|
|
@@ -90,6 +92,8 @@
|
|
|
90
92
|
font-size: 12px;
|
|
91
93
|
line-height: 18px;
|
|
92
94
|
text-align: center;
|
|
95
|
+
-webkit-transition: color 0.3s;
|
|
96
|
+
transition: color 0.3s;
|
|
93
97
|
}
|
|
94
98
|
@media screen and (max-width: 1023px) {
|
|
95
99
|
.colors__description {
|
|
@@ -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
|
|
23
|
+
import React, { useState, useEffect, useMemo } 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,17 +53,6 @@ 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
|
-
|
|
67
56
|
|
|
68
57
|
var cn = cnCreate('mfui-calendar');
|
|
69
58
|
|
|
@@ -102,7 +91,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
102
91
|
hoveredDate = _useState4[0],
|
|
103
92
|
setHoveredDate = _useState4[1];
|
|
104
93
|
|
|
105
|
-
var isUserChoice = useRef(false);
|
|
106
94
|
var stateStartDate = calendarState.startDate,
|
|
107
95
|
stateEndDate = calendarState.endDate,
|
|
108
96
|
stateFocusedInput = calendarState.focusedInput;
|
|
@@ -123,13 +111,10 @@ var Calendar = function Calendar(_ref) {
|
|
|
123
111
|
goToDate = _a.goToDate,
|
|
124
112
|
pickerProps = __rest(_a, ["firstDayOfWeek", "activeMonths", "goToPreviousMonths", "goToNextMonths", "goToDate"]);
|
|
125
113
|
|
|
126
|
-
useEffect(function () {
|
|
127
|
-
isUserChoice.current = false;
|
|
128
|
-
}, [startDate]);
|
|
129
114
|
useEffect(function () {
|
|
130
115
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
131
116
|
setCalendarState(calendarStateFromProps);
|
|
132
|
-
|
|
117
|
+
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
133
118
|
}, [calendarStateFromProps]);
|
|
134
119
|
|
|
135
120
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -194,7 +179,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
194
179
|
var nextStartDate = nextState.startDate,
|
|
195
180
|
nextEndDate = nextState.endDate;
|
|
196
181
|
setCalendarState(nextState);
|
|
197
|
-
isUserChoice.current = true;
|
|
198
182
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
199
183
|
};
|
|
200
184
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.mfui-caption {
|
|
2
|
+
font-family: inherit;
|
|
3
|
+
font-size: 12px;
|
|
4
|
+
line-height: 18px;
|
|
5
|
+
margin: 0;
|
|
6
|
+
}
|
|
7
|
+
.mfui-caption_variant_normal {
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
}
|
|
10
|
+
.mfui-caption_variant_medium {
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
}
|
|
13
|
+
.mfui-caption_space_wide {
|
|
14
|
+
line-height: 18px;
|
|
15
|
+
}
|
|
16
|
+
.mfui-caption_space_tight {
|
|
17
|
+
line-height: 14px;
|
|
18
|
+
}
|
|
19
|
+
.mfui-caption_align_left {
|
|
20
|
+
text-align: left;
|
|
21
|
+
}
|
|
22
|
+
.mfui-caption_align_center {
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
25
|
+
.mfui-caption_align_right {
|
|
26
|
+
text-align: right;
|
|
27
|
+
}
|
|
28
|
+
.mfui-caption_has-margin {
|
|
29
|
+
margin: 0 0 16px;
|
|
30
|
+
}
|
|
31
|
+
.mfui-caption_color_inherit {
|
|
32
|
+
color: inherit;
|
|
33
|
+
}
|
|
34
|
+
.mfui-caption_color_default {
|
|
35
|
+
color: var(--content);
|
|
36
|
+
}
|
|
37
|
+
.mfui-caption_color_gray {
|
|
38
|
+
color: var(--spbSky3);
|
|
39
|
+
}
|
|
40
|
+
.mfui-caption_color_white {
|
|
41
|
+
color: var(--stcWhite);
|
|
42
|
+
}
|
|
43
|
+
.mfui-caption_color_green {
|
|
44
|
+
color: var(--brandGreen);
|
|
45
|
+
}
|
|
46
|
+
.mfui-caption_color_purple {
|
|
47
|
+
color: var(--brandPurple);
|
|
48
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './Caption.less';
|
|
3
|
+
declare const COLORS: {
|
|
4
|
+
readonly INHERIT: "inherit";
|
|
5
|
+
readonly DEFAULT: "default";
|
|
6
|
+
readonly GRAY: "gray";
|
|
7
|
+
readonly WHITE: "white";
|
|
8
|
+
readonly GREEN: "green";
|
|
9
|
+
readonly PURPLE: "purple";
|
|
10
|
+
};
|
|
11
|
+
declare type ColorType = typeof COLORS[keyof typeof COLORS];
|
|
12
|
+
export interface ICaptionProps {
|
|
13
|
+
/** Выравнивание по горизонтали */
|
|
14
|
+
align?: 'left' | 'center' | 'right';
|
|
15
|
+
/** Поведение текста при встраивании в широкий или узкий контейнер */
|
|
16
|
+
space?: 'wide' | 'tight';
|
|
17
|
+
/** Начертание шрифта: обычный или полужирный */
|
|
18
|
+
variant?: 'normal' | 'medium';
|
|
19
|
+
/** Вертикальный отступ */
|
|
20
|
+
hasMargin?: boolean;
|
|
21
|
+
/** Цвет текста */
|
|
22
|
+
color?: ColorType;
|
|
23
|
+
/** Дополнительный класс корневого элемента */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
26
|
+
dataAttrs?: {
|
|
27
|
+
root?: Record<string, string>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare const Caption: React.FC<ICaptionProps>;
|
|
31
|
+
export default Caption;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import "core-js/modules/es.object.values";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
5
|
+
import * as PropTypes from 'prop-types';
|
|
6
|
+
import "./Caption.css";
|
|
7
|
+
var COLORS = {
|
|
8
|
+
INHERIT: 'inherit',
|
|
9
|
+
DEFAULT: 'default',
|
|
10
|
+
GRAY: 'gray',
|
|
11
|
+
WHITE: 'white',
|
|
12
|
+
GREEN: 'green',
|
|
13
|
+
PURPLE: 'purple'
|
|
14
|
+
};
|
|
15
|
+
var cn = cnCreate('mfui-caption');
|
|
16
|
+
|
|
17
|
+
var Caption = function Caption(_ref) {
|
|
18
|
+
var align = _ref.align,
|
|
19
|
+
_ref$color = _ref.color,
|
|
20
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
21
|
+
_ref$space = _ref.space,
|
|
22
|
+
space = _ref$space === void 0 ? 'wide' : _ref$space,
|
|
23
|
+
_ref$variant = _ref.variant,
|
|
24
|
+
variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
|
|
25
|
+
className = _ref.className,
|
|
26
|
+
_ref$hasMargin = _ref.hasMargin,
|
|
27
|
+
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
28
|
+
dataAttrs = _ref.dataAttrs,
|
|
29
|
+
children = _ref.children;
|
|
30
|
+
return /*#__PURE__*/React.createElement("p", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
31
|
+
className: cn({
|
|
32
|
+
align: align,
|
|
33
|
+
color: color,
|
|
34
|
+
space: space,
|
|
35
|
+
variant: variant,
|
|
36
|
+
'has-margin': hasMargin
|
|
37
|
+
}, className)
|
|
38
|
+
}), children);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
Caption.propTypes = {
|
|
42
|
+
dataAttrs: PropTypes.shape({
|
|
43
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
44
|
+
}),
|
|
45
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
46
|
+
space: PropTypes.oneOf(['wide', 'tight']),
|
|
47
|
+
variant: PropTypes.oneOf(['normal', 'medium']),
|
|
48
|
+
hasMargin: PropTypes.bool,
|
|
49
|
+
color: PropTypes.oneOf(Object.values(COLORS))
|
|
50
|
+
};
|
|
51
|
+
export default Caption;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
.mfui-paragraph {
|
|
2
2
|
font-family: inherit;
|
|
3
|
+
font-size: 15px;
|
|
4
|
+
line-height: 24px;
|
|
3
5
|
margin: 0;
|
|
4
6
|
font-weight: 400;
|
|
5
7
|
}
|
|
@@ -12,13 +14,11 @@
|
|
|
12
14
|
.mfui-paragraph_align_right {
|
|
13
15
|
text-align: right;
|
|
14
16
|
}
|
|
15
|
-
.mfui-
|
|
16
|
-
font-size: 15px;
|
|
17
|
+
.mfui-paragraph_space_wide {
|
|
17
18
|
line-height: 24px;
|
|
18
19
|
}
|
|
19
|
-
.mfui-
|
|
20
|
-
|
|
21
|
-
line-height: 16px;
|
|
20
|
+
.mfui-paragraph_space_tight {
|
|
21
|
+
line-height: 18px;
|
|
22
22
|
}
|
|
23
23
|
.mfui-paragraph_has-margin {
|
|
24
24
|
margin: 0 0 16px;
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
.mfui-paragraph_color_default {
|
|
30
30
|
color: var(--content);
|
|
31
31
|
}
|
|
32
|
+
.mfui-paragraph_color_gray {
|
|
33
|
+
color: var(--spbSky3);
|
|
34
|
+
}
|
|
32
35
|
.mfui-paragraph_color_white {
|
|
33
36
|
color: var(--stcWhite);
|
|
34
37
|
}
|
|
@@ -3,6 +3,7 @@ import './Paragraph.less';
|
|
|
3
3
|
declare const COLORS: {
|
|
4
4
|
readonly INHERIT: "inherit";
|
|
5
5
|
readonly DEFAULT: "default";
|
|
6
|
+
readonly GRAY: "gray";
|
|
6
7
|
readonly WHITE: "white";
|
|
7
8
|
readonly GREEN: "green";
|
|
8
9
|
readonly PURPLE: "purple";
|
|
@@ -11,9 +12,9 @@ declare type ColorType = typeof COLORS[keyof typeof COLORS];
|
|
|
11
12
|
export interface IParagraphProps {
|
|
12
13
|
/** Выравнивание по горизонтали */
|
|
13
14
|
align?: 'left' | 'center' | 'right';
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/** Вертикальный отступ
|
|
15
|
+
/** Поведение текста при встраивании в широкий или узкий контейнер */
|
|
16
|
+
space?: 'wide' | 'tight';
|
|
17
|
+
/** Вертикальный отступ */
|
|
17
18
|
hasMargin?: boolean;
|
|
18
19
|
/** Цвет текста */
|
|
19
20
|
color?: ColorType;
|
|
@@ -7,6 +7,7 @@ import "./Paragraph.css";
|
|
|
7
7
|
var COLORS = {
|
|
8
8
|
INHERIT: 'inherit',
|
|
9
9
|
DEFAULT: 'default',
|
|
10
|
+
GRAY: 'gray',
|
|
10
11
|
WHITE: 'white',
|
|
11
12
|
GREEN: 'green',
|
|
12
13
|
PURPLE: 'purple'
|
|
@@ -14,11 +15,11 @@ var COLORS = {
|
|
|
14
15
|
var cn = cnCreate('mfui-paragraph');
|
|
15
16
|
|
|
16
17
|
var Paragraph = function Paragraph(_ref) {
|
|
17
|
-
var
|
|
18
|
-
size = _ref$size === void 0 ? 'regular' : _ref$size,
|
|
19
|
-
align = _ref.align,
|
|
18
|
+
var align = _ref.align,
|
|
20
19
|
_ref$color = _ref.color,
|
|
21
20
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
21
|
+
_ref$space = _ref.space,
|
|
22
|
+
space = _ref$space === void 0 ? 'wide' : _ref$space,
|
|
22
23
|
className = _ref.className,
|
|
23
24
|
_ref$hasMargin = _ref.hasMargin,
|
|
24
25
|
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
@@ -26,9 +27,9 @@ var Paragraph = function Paragraph(_ref) {
|
|
|
26
27
|
children = _ref.children;
|
|
27
28
|
return /*#__PURE__*/React.createElement("p", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
28
29
|
className: cn({
|
|
29
|
-
size: size,
|
|
30
30
|
align: align,
|
|
31
31
|
color: color,
|
|
32
|
+
space: space,
|
|
32
33
|
'has-margin': hasMargin
|
|
33
34
|
}, className)
|
|
34
35
|
}), children);
|
|
@@ -39,7 +40,7 @@ Paragraph.propTypes = {
|
|
|
39
40
|
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
40
41
|
}),
|
|
41
42
|
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
42
|
-
|
|
43
|
+
space: PropTypes.oneOf(['wide', 'tight']),
|
|
43
44
|
hasMargin: PropTypes.bool,
|
|
44
45
|
color: PropTypes.oneOf(Object.values(COLORS))
|
|
45
46
|
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
.mfui-switcher__content_size_small {
|
|
15
15
|
font-size: 12px;
|
|
16
|
-
line-height:
|
|
16
|
+
line-height: 18px;
|
|
17
17
|
}
|
|
18
18
|
.mfui-switcher__content_left {
|
|
19
19
|
margin-right: 12px;
|
|
@@ -84,9 +84,6 @@
|
|
|
84
84
|
border-radius: 15.5px;
|
|
85
85
|
overflow: hidden;
|
|
86
86
|
background-color: var(--spbSky1);
|
|
87
|
-
outline: none;
|
|
88
|
-
-webkit-transform: translateZ(0);
|
|
89
|
-
transform: translateZ(0);
|
|
90
87
|
cursor: pointer;
|
|
91
88
|
-webkit-transition: background-color 0.3s;
|
|
92
89
|
transition: background-color 0.3s;
|
|
@@ -8,8 +8,8 @@ import { useCallback, useEffect, useState, useRef, useMemo } from 'react';
|
|
|
8
8
|
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
9
9
|
import * as PropTypes from 'prop-types';
|
|
10
10
|
import InputMask from 'react-input-mask';
|
|
11
|
+
import Caption from "../Caption/Caption";
|
|
11
12
|
import InputLabel from "../InputLabel/InputLabel";
|
|
12
|
-
import Paragraph from "../Paragraph/Paragraph";
|
|
13
13
|
import "./TextField.css";
|
|
14
14
|
|
|
15
15
|
var Hide = function Hide(props) {
|
|
@@ -359,8 +359,7 @@ var TextField = function TextField(_ref) {
|
|
|
359
359
|
error: verification === Verification.ERROR,
|
|
360
360
|
success: verification === Verification.VALID
|
|
361
361
|
})
|
|
362
|
-
}), noticeText), symbolCounter && /*#__PURE__*/React.createElement(
|
|
363
|
-
size: "small",
|
|
362
|
+
}), noticeText), symbolCounter && /*#__PURE__*/React.createElement(Caption, {
|
|
364
363
|
hasMargin: false,
|
|
365
364
|
className: cn('counter', {
|
|
366
365
|
error: isMaxLimitExceeded
|
|
@@ -37,8 +37,6 @@ export interface ITooltipProps {
|
|
|
37
37
|
targetElement?: React.RefObject<HTMLElement>;
|
|
38
38
|
/** Управление состоянием. Компонент поддерживает контроллируемое и неконтроллируемое состояние. */
|
|
39
39
|
isOpened?: boolean;
|
|
40
|
-
/** Отрендерить компонент в корневой элементе страницы body */
|
|
41
|
-
isPortal?: boolean;
|
|
42
40
|
/** Дополнительный класс корневого элемента */
|
|
43
41
|
className?: string;
|
|
44
42
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -6,7 +6,6 @@ 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';
|
|
10
9
|
import { usePopper } from 'react-popper';
|
|
11
10
|
import Tile from "../Tile/Tile";
|
|
12
11
|
import "./Tooltip.css";
|
|
@@ -46,8 +45,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
46
45
|
targetElement = _ref.targetElement,
|
|
47
46
|
_ref$isOpened = _ref.isOpened,
|
|
48
47
|
isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
|
|
49
|
-
_ref$isPortal = _ref.isPortal,
|
|
50
|
-
isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal,
|
|
51
48
|
children = _ref.children,
|
|
52
49
|
_ref$classes = _ref.classes;
|
|
53
50
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
@@ -61,7 +58,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
61
58
|
var currentTrigger = triggerElement.current;
|
|
62
59
|
var currentTarget = (targetElement === null || targetElement === void 0 ? void 0 : targetElement.current) || currentTrigger;
|
|
63
60
|
var currentBoundary = boundaryElement === null || boundaryElement === void 0 ? void 0 : boundaryElement.current;
|
|
64
|
-
var portalElem = React.useRef(null);
|
|
65
61
|
|
|
66
62
|
var _useState = useState(null),
|
|
67
63
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -219,16 +215,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
219
215
|
|
|
220
216
|
return undefined;
|
|
221
217
|
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick, clickEvent]);
|
|
222
|
-
|
|
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), {
|
|
218
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
232
219
|
className: cn({
|
|
233
220
|
paddings: paddings,
|
|
234
221
|
open: isOpen
|
|
@@ -251,18 +238,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
251
238
|
shadowLevel: "high",
|
|
252
239
|
className: cn('content-shadow', [contentShadowClassName])
|
|
253
240
|
}));
|
|
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;
|
|
266
241
|
};
|
|
267
242
|
|
|
268
243
|
Tooltip.propTypes = {
|
|
@@ -293,7 +268,6 @@ Tooltip.propTypes = {
|
|
|
293
268
|
current: PropTypes.elementType
|
|
294
269
|
}), PropTypes.any])]),
|
|
295
270
|
isOpened: PropTypes.bool,
|
|
296
|
-
isPortal: PropTypes.bool,
|
|
297
271
|
className: PropTypes.string,
|
|
298
272
|
classes: PropTypes.shape({
|
|
299
273
|
root: PropTypes.string,
|
package/dist/es/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as Banner } from './components/Banner/Banner';
|
|
|
3
3
|
export { default as BannerDot } from './components/Banner/BannerDot';
|
|
4
4
|
export { default as Button } from './components/Button/Button';
|
|
5
5
|
export { default as Calendar } from './components/Calendar/Calendar';
|
|
6
|
+
export { default as Caption } from './components/Caption/Caption';
|
|
6
7
|
export { default as Carousel } from './components/Carousel/Carousel';
|
|
7
8
|
export { default as Checkbox } from './components/Checkbox/Checkbox';
|
|
8
9
|
export { default as checkBreakpointsPropTypes } from './components/Carousel/checkBreakpointsPropTypes';
|
package/dist/es/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { default as Banner } from "./components/Banner/Banner";
|
|
|
3
3
|
export { default as BannerDot } from "./components/Banner/BannerDot";
|
|
4
4
|
export { default as Button } from "./components/Button/Button";
|
|
5
5
|
export { default as Calendar } from "./components/Calendar/Calendar";
|
|
6
|
+
export { default as Caption } from "./components/Caption/Caption";
|
|
6
7
|
export { default as Carousel } from "./components/Carousel/Carousel";
|
|
7
8
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
8
9
|
export { default as checkBreakpointsPropTypes } from "./components/Carousel/checkBreakpointsPropTypes";
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
margin: 0 -80px;
|
|
3
3
|
padding: 56px 80px 40px;
|
|
4
4
|
background-color: var(--spbSky0);
|
|
5
|
+
-webkit-transition: background-color 0.3s;
|
|
6
|
+
transition: background-color 0.3s;
|
|
5
7
|
}
|
|
6
8
|
@media screen and (max-width: 1120px) {
|
|
7
9
|
.colors__inner {
|
|
@@ -90,6 +92,8 @@
|
|
|
90
92
|
font-size: 12px;
|
|
91
93
|
line-height: 18px;
|
|
92
94
|
text-align: center;
|
|
95
|
+
-webkit-transition: color 0.3s;
|
|
96
|
+
transition: color 0.3s;
|
|
93
97
|
}
|
|
94
98
|
@media screen and (max-width: 1023px) {
|
|
95
99
|
.colors__description {
|
|
@@ -86,17 +86,6 @@ 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
|
-
|
|
100
89
|
|
|
101
90
|
var cn = (0, _uiHelpers.cnCreate)('mfui-calendar');
|
|
102
91
|
|
|
@@ -135,7 +124,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
135
124
|
hoveredDate = _useState4[0],
|
|
136
125
|
setHoveredDate = _useState4[1];
|
|
137
126
|
|
|
138
|
-
var isUserChoice = (0, _react.useRef)(false);
|
|
139
127
|
var stateStartDate = calendarState.startDate,
|
|
140
128
|
stateEndDate = calendarState.endDate,
|
|
141
129
|
stateFocusedInput = calendarState.focusedInput;
|
|
@@ -156,13 +144,10 @@ var Calendar = function Calendar(_ref) {
|
|
|
156
144
|
goToDate = _a.goToDate,
|
|
157
145
|
pickerProps = __rest(_a, ["firstDayOfWeek", "activeMonths", "goToPreviousMonths", "goToNextMonths", "goToDate"]);
|
|
158
146
|
|
|
159
|
-
(0, _react.useEffect)(function () {
|
|
160
|
-
isUserChoice.current = false;
|
|
161
|
-
}, [startDate]);
|
|
162
147
|
(0, _react.useEffect)(function () {
|
|
163
148
|
var propsStartDate = calendarStateFromProps.startDate;
|
|
164
149
|
setCalendarState(calendarStateFromProps);
|
|
165
|
-
|
|
150
|
+
propsStartDate && goToDate(propsStartDate); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
166
151
|
}, [calendarStateFromProps]);
|
|
167
152
|
|
|
168
153
|
var getCalendarState = function getCalendarState(date) {
|
|
@@ -227,7 +212,6 @@ var Calendar = function Calendar(_ref) {
|
|
|
227
212
|
var nextStartDate = nextState.startDate,
|
|
228
213
|
nextEndDate = nextState.endDate;
|
|
229
214
|
setCalendarState(nextState);
|
|
230
|
-
isUserChoice.current = true;
|
|
231
215
|
onChange === null || onChange === void 0 ? void 0 : onChange(nextStartDate, nextEndDate);
|
|
232
216
|
};
|
|
233
217
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
.mfui-caption {
|
|
2
|
+
font-family: inherit;
|
|
3
|
+
font-size: 12px;
|
|
4
|
+
line-height: 18px;
|
|
5
|
+
margin: 0;
|
|
6
|
+
}
|
|
7
|
+
.mfui-caption_variant_normal {
|
|
8
|
+
font-weight: 400;
|
|
9
|
+
}
|
|
10
|
+
.mfui-caption_variant_medium {
|
|
11
|
+
font-weight: 600;
|
|
12
|
+
}
|
|
13
|
+
.mfui-caption_space_wide {
|
|
14
|
+
line-height: 18px;
|
|
15
|
+
}
|
|
16
|
+
.mfui-caption_space_tight {
|
|
17
|
+
line-height: 14px;
|
|
18
|
+
}
|
|
19
|
+
.mfui-caption_align_left {
|
|
20
|
+
text-align: left;
|
|
21
|
+
}
|
|
22
|
+
.mfui-caption_align_center {
|
|
23
|
+
text-align: center;
|
|
24
|
+
}
|
|
25
|
+
.mfui-caption_align_right {
|
|
26
|
+
text-align: right;
|
|
27
|
+
}
|
|
28
|
+
.mfui-caption_has-margin {
|
|
29
|
+
margin: 0 0 16px;
|
|
30
|
+
}
|
|
31
|
+
.mfui-caption_color_inherit {
|
|
32
|
+
color: inherit;
|
|
33
|
+
}
|
|
34
|
+
.mfui-caption_color_default {
|
|
35
|
+
color: var(--content);
|
|
36
|
+
}
|
|
37
|
+
.mfui-caption_color_gray {
|
|
38
|
+
color: var(--spbSky3);
|
|
39
|
+
}
|
|
40
|
+
.mfui-caption_color_white {
|
|
41
|
+
color: var(--stcWhite);
|
|
42
|
+
}
|
|
43
|
+
.mfui-caption_color_green {
|
|
44
|
+
color: var(--brandGreen);
|
|
45
|
+
}
|
|
46
|
+
.mfui-caption_color_purple {
|
|
47
|
+
color: var(--brandPurple);
|
|
48
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './Caption.less';
|
|
3
|
+
declare const COLORS: {
|
|
4
|
+
readonly INHERIT: "inherit";
|
|
5
|
+
readonly DEFAULT: "default";
|
|
6
|
+
readonly GRAY: "gray";
|
|
7
|
+
readonly WHITE: "white";
|
|
8
|
+
readonly GREEN: "green";
|
|
9
|
+
readonly PURPLE: "purple";
|
|
10
|
+
};
|
|
11
|
+
declare type ColorType = typeof COLORS[keyof typeof COLORS];
|
|
12
|
+
export interface ICaptionProps {
|
|
13
|
+
/** Выравнивание по горизонтали */
|
|
14
|
+
align?: 'left' | 'center' | 'right';
|
|
15
|
+
/** Поведение текста при встраивании в широкий или узкий контейнер */
|
|
16
|
+
space?: 'wide' | 'tight';
|
|
17
|
+
/** Начертание шрифта: обычный или полужирный */
|
|
18
|
+
variant?: 'normal' | 'medium';
|
|
19
|
+
/** Вертикальный отступ */
|
|
20
|
+
hasMargin?: boolean;
|
|
21
|
+
/** Цвет текста */
|
|
22
|
+
color?: ColorType;
|
|
23
|
+
/** Дополнительный класс корневого элемента */
|
|
24
|
+
className?: string;
|
|
25
|
+
/** Дополнительные data атрибуты к внутренним элементам */
|
|
26
|
+
dataAttrs?: {
|
|
27
|
+
root?: Record<string, string>;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare const Caption: React.FC<ICaptionProps>;
|
|
31
|
+
export default Caption;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.object.values");
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var React = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _uiHelpers = require("@megafon/ui-helpers");
|
|
17
|
+
|
|
18
|
+
var PropTypes = _interopRequireWildcard(require("prop-types"));
|
|
19
|
+
|
|
20
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
+
|
|
26
|
+
var COLORS = {
|
|
27
|
+
INHERIT: 'inherit',
|
|
28
|
+
DEFAULT: 'default',
|
|
29
|
+
GRAY: 'gray',
|
|
30
|
+
WHITE: 'white',
|
|
31
|
+
GREEN: 'green',
|
|
32
|
+
PURPLE: 'purple'
|
|
33
|
+
};
|
|
34
|
+
var cn = (0, _uiHelpers.cnCreate)('mfui-caption');
|
|
35
|
+
|
|
36
|
+
var Caption = function Caption(_ref) {
|
|
37
|
+
var align = _ref.align,
|
|
38
|
+
_ref$color = _ref.color,
|
|
39
|
+
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
40
|
+
_ref$space = _ref.space,
|
|
41
|
+
space = _ref$space === void 0 ? 'wide' : _ref$space,
|
|
42
|
+
_ref$variant = _ref.variant,
|
|
43
|
+
variant = _ref$variant === void 0 ? 'normal' : _ref$variant,
|
|
44
|
+
className = _ref.className,
|
|
45
|
+
_ref$hasMargin = _ref.hasMargin,
|
|
46
|
+
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
47
|
+
dataAttrs = _ref.dataAttrs,
|
|
48
|
+
children = _ref.children;
|
|
49
|
+
return /*#__PURE__*/React.createElement("p", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
50
|
+
className: cn({
|
|
51
|
+
align: align,
|
|
52
|
+
color: color,
|
|
53
|
+
space: space,
|
|
54
|
+
variant: variant,
|
|
55
|
+
'has-margin': hasMargin
|
|
56
|
+
}, className)
|
|
57
|
+
}), children);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
Caption.propTypes = {
|
|
61
|
+
dataAttrs: PropTypes.shape({
|
|
62
|
+
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
63
|
+
}),
|
|
64
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
65
|
+
space: PropTypes.oneOf(['wide', 'tight']),
|
|
66
|
+
variant: PropTypes.oneOf(['normal', 'medium']),
|
|
67
|
+
hasMargin: PropTypes.bool,
|
|
68
|
+
color: PropTypes.oneOf(Object.values(COLORS))
|
|
69
|
+
};
|
|
70
|
+
var _default = Caption;
|
|
71
|
+
exports["default"] = _default;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
.mfui-paragraph {
|
|
2
2
|
font-family: inherit;
|
|
3
|
+
font-size: 15px;
|
|
4
|
+
line-height: 24px;
|
|
3
5
|
margin: 0;
|
|
4
6
|
font-weight: 400;
|
|
5
7
|
}
|
|
@@ -12,13 +14,11 @@
|
|
|
12
14
|
.mfui-paragraph_align_right {
|
|
13
15
|
text-align: right;
|
|
14
16
|
}
|
|
15
|
-
.mfui-
|
|
16
|
-
font-size: 15px;
|
|
17
|
+
.mfui-paragraph_space_wide {
|
|
17
18
|
line-height: 24px;
|
|
18
19
|
}
|
|
19
|
-
.mfui-
|
|
20
|
-
|
|
21
|
-
line-height: 16px;
|
|
20
|
+
.mfui-paragraph_space_tight {
|
|
21
|
+
line-height: 18px;
|
|
22
22
|
}
|
|
23
23
|
.mfui-paragraph_has-margin {
|
|
24
24
|
margin: 0 0 16px;
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
.mfui-paragraph_color_default {
|
|
30
30
|
color: var(--content);
|
|
31
31
|
}
|
|
32
|
+
.mfui-paragraph_color_gray {
|
|
33
|
+
color: var(--spbSky3);
|
|
34
|
+
}
|
|
32
35
|
.mfui-paragraph_color_white {
|
|
33
36
|
color: var(--stcWhite);
|
|
34
37
|
}
|
|
@@ -3,6 +3,7 @@ import './Paragraph.less';
|
|
|
3
3
|
declare const COLORS: {
|
|
4
4
|
readonly INHERIT: "inherit";
|
|
5
5
|
readonly DEFAULT: "default";
|
|
6
|
+
readonly GRAY: "gray";
|
|
6
7
|
readonly WHITE: "white";
|
|
7
8
|
readonly GREEN: "green";
|
|
8
9
|
readonly PURPLE: "purple";
|
|
@@ -11,9 +12,9 @@ declare type ColorType = typeof COLORS[keyof typeof COLORS];
|
|
|
11
12
|
export interface IParagraphProps {
|
|
12
13
|
/** Выравнивание по горизонтали */
|
|
13
14
|
align?: 'left' | 'center' | 'right';
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/** Вертикальный отступ
|
|
15
|
+
/** Поведение текста при встраивании в широкий или узкий контейнер */
|
|
16
|
+
space?: 'wide' | 'tight';
|
|
17
|
+
/** Вертикальный отступ */
|
|
17
18
|
hasMargin?: boolean;
|
|
18
19
|
/** Цвет текста */
|
|
19
20
|
color?: ColorType;
|
|
@@ -26,6 +26,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
26
26
|
var COLORS = {
|
|
27
27
|
INHERIT: 'inherit',
|
|
28
28
|
DEFAULT: 'default',
|
|
29
|
+
GRAY: 'gray',
|
|
29
30
|
WHITE: 'white',
|
|
30
31
|
GREEN: 'green',
|
|
31
32
|
PURPLE: 'purple'
|
|
@@ -33,11 +34,11 @@ var COLORS = {
|
|
|
33
34
|
var cn = (0, _uiHelpers.cnCreate)('mfui-paragraph');
|
|
34
35
|
|
|
35
36
|
var Paragraph = function Paragraph(_ref) {
|
|
36
|
-
var
|
|
37
|
-
size = _ref$size === void 0 ? 'regular' : _ref$size,
|
|
38
|
-
align = _ref.align,
|
|
37
|
+
var align = _ref.align,
|
|
39
38
|
_ref$color = _ref.color,
|
|
40
39
|
color = _ref$color === void 0 ? 'default' : _ref$color,
|
|
40
|
+
_ref$space = _ref.space,
|
|
41
|
+
space = _ref$space === void 0 ? 'wide' : _ref$space,
|
|
41
42
|
className = _ref.className,
|
|
42
43
|
_ref$hasMargin = _ref.hasMargin,
|
|
43
44
|
hasMargin = _ref$hasMargin === void 0 ? true : _ref$hasMargin,
|
|
@@ -45,9 +46,9 @@ var Paragraph = function Paragraph(_ref) {
|
|
|
45
46
|
children = _ref.children;
|
|
46
47
|
return /*#__PURE__*/React.createElement("p", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
47
48
|
className: cn({
|
|
48
|
-
size: size,
|
|
49
49
|
align: align,
|
|
50
50
|
color: color,
|
|
51
|
+
space: space,
|
|
51
52
|
'has-margin': hasMargin
|
|
52
53
|
}, className)
|
|
53
54
|
}), children);
|
|
@@ -58,7 +59,7 @@ Paragraph.propTypes = {
|
|
|
58
59
|
root: PropTypes.objectOf(PropTypes.string.isRequired)
|
|
59
60
|
}),
|
|
60
61
|
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
61
|
-
|
|
62
|
+
space: PropTypes.oneOf(['wide', 'tight']),
|
|
62
63
|
hasMargin: PropTypes.bool,
|
|
63
64
|
color: PropTypes.oneOf(Object.values(COLORS))
|
|
64
65
|
};
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
.mfui-switcher__content_size_small {
|
|
15
15
|
font-size: 12px;
|
|
16
|
-
line-height:
|
|
16
|
+
line-height: 18px;
|
|
17
17
|
}
|
|
18
18
|
.mfui-switcher__content_left {
|
|
19
19
|
margin-right: 12px;
|
|
@@ -84,9 +84,6 @@
|
|
|
84
84
|
border-radius: 15.5px;
|
|
85
85
|
overflow: hidden;
|
|
86
86
|
background-color: var(--spbSky1);
|
|
87
|
-
outline: none;
|
|
88
|
-
-webkit-transform: translateZ(0);
|
|
89
|
-
transform: translateZ(0);
|
|
90
87
|
cursor: pointer;
|
|
91
88
|
-webkit-transition: background-color 0.3s;
|
|
92
89
|
transition: background-color 0.3s;
|
|
@@ -25,9 +25,9 @@ var PropTypes = _interopRequireWildcard(require("prop-types"));
|
|
|
25
25
|
|
|
26
26
|
var _reactInputMask = _interopRequireDefault(require("react-input-mask"));
|
|
27
27
|
|
|
28
|
-
var
|
|
28
|
+
var _Caption = _interopRequireDefault(require("../Caption/Caption"));
|
|
29
29
|
|
|
30
|
-
var
|
|
30
|
+
var _InputLabel = _interopRequireDefault(require("../InputLabel/InputLabel"));
|
|
31
31
|
|
|
32
32
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
33
33
|
|
|
@@ -380,8 +380,7 @@ var TextField = function TextField(_ref) {
|
|
|
380
380
|
error: verification === Verification.ERROR,
|
|
381
381
|
success: verification === Verification.VALID
|
|
382
382
|
})
|
|
383
|
-
}), noticeText), symbolCounter && /*#__PURE__*/React.createElement(
|
|
384
|
-
size: "small",
|
|
383
|
+
}), noticeText), symbolCounter && /*#__PURE__*/React.createElement(_Caption["default"], {
|
|
385
384
|
hasMargin: false,
|
|
386
385
|
className: cn('counter', {
|
|
387
386
|
error: isMaxLimitExceeded
|
|
@@ -37,8 +37,6 @@ export interface ITooltipProps {
|
|
|
37
37
|
targetElement?: React.RefObject<HTMLElement>;
|
|
38
38
|
/** Управление состоянием. Компонент поддерживает контроллируемое и неконтроллируемое состояние. */
|
|
39
39
|
isOpened?: boolean;
|
|
40
|
-
/** Отрендерить компонент в корневой элементе страницы body */
|
|
41
|
-
isPortal?: boolean;
|
|
42
40
|
/** Дополнительный класс корневого элемента */
|
|
43
41
|
className?: string;
|
|
44
42
|
/** Дополнительные классы для внутренних элементов */
|
|
@@ -23,8 +23,6 @@ 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
|
-
|
|
28
26
|
var _reactPopper = require("react-popper");
|
|
29
27
|
|
|
30
28
|
var _Tile = _interopRequireDefault(require("../Tile/Tile"));
|
|
@@ -74,8 +72,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
74
72
|
targetElement = _ref.targetElement,
|
|
75
73
|
_ref$isOpened = _ref.isOpened,
|
|
76
74
|
isOpened = _ref$isOpened === void 0 ? false : _ref$isOpened,
|
|
77
|
-
_ref$isPortal = _ref.isPortal,
|
|
78
|
-
isPortal = _ref$isPortal === void 0 ? false : _ref$isPortal,
|
|
79
75
|
children = _ref.children,
|
|
80
76
|
_ref$classes = _ref.classes;
|
|
81
77
|
_ref$classes = _ref$classes === void 0 ? {} : _ref$classes;
|
|
@@ -90,8 +86,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
90
86
|
var currentTarget = (targetElement === null || targetElement === void 0 ? void 0 : targetElement.current) || currentTrigger;
|
|
91
87
|
var currentBoundary = boundaryElement === null || boundaryElement === void 0 ? void 0 : boundaryElement.current;
|
|
92
88
|
|
|
93
|
-
var portalElem = _react["default"].useRef(null);
|
|
94
|
-
|
|
95
89
|
var _useState = (0, _react.useState)(null),
|
|
96
90
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
97
91
|
popperElement = _useState2[0],
|
|
@@ -248,17 +242,7 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
248
242
|
|
|
249
243
|
return undefined;
|
|
250
244
|
}, [triggerEventName, isOpen, currentTrigger, handleOutsideEvent, handleClick, clickEvent]);
|
|
251
|
-
(0,
|
|
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), {
|
|
245
|
+
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({}, (0, _uiHelpers.filterDataAttrs)(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
|
|
262
246
|
className: cn({
|
|
263
247
|
paddings: paddings,
|
|
264
248
|
open: isOpen
|
|
@@ -281,19 +265,6 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
281
265
|
shadowLevel: "high",
|
|
282
266
|
className: cn('content-shadow', [contentShadowClassName])
|
|
283
267
|
}));
|
|
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;
|
|
297
268
|
};
|
|
298
269
|
|
|
299
270
|
Tooltip.propTypes = {
|
|
@@ -324,7 +295,6 @@ Tooltip.propTypes = {
|
|
|
324
295
|
current: _propTypes["default"].elementType
|
|
325
296
|
}), _propTypes["default"].any])]),
|
|
326
297
|
isOpened: _propTypes["default"].bool,
|
|
327
|
-
isPortal: _propTypes["default"].bool,
|
|
328
298
|
className: _propTypes["default"].string,
|
|
329
299
|
classes: _propTypes["default"].shape({
|
|
330
300
|
root: _propTypes["default"].string,
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export { default as Banner } from './components/Banner/Banner';
|
|
|
3
3
|
export { default as BannerDot } from './components/Banner/BannerDot';
|
|
4
4
|
export { default as Button } from './components/Button/Button';
|
|
5
5
|
export { default as Calendar } from './components/Calendar/Calendar';
|
|
6
|
+
export { default as Caption } from './components/Caption/Caption';
|
|
6
7
|
export { default as Carousel } from './components/Carousel/Carousel';
|
|
7
8
|
export { default as Checkbox } from './components/Checkbox/Checkbox';
|
|
8
9
|
export { default as checkBreakpointsPropTypes } from './components/Carousel/checkBreakpointsPropTypes';
|
package/dist/lib/index.js
CHANGED
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "Calendar", {
|
|
|
33
33
|
return _Calendar["default"];
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "Caption", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function get() {
|
|
39
|
+
return _Caption["default"];
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "Carousel", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function get() {
|
|
@@ -290,6 +296,8 @@ var _Button = _interopRequireDefault(require("./components/Button/Button"));
|
|
|
290
296
|
|
|
291
297
|
var _Calendar = _interopRequireDefault(require("./components/Calendar/Calendar"));
|
|
292
298
|
|
|
299
|
+
var _Caption = _interopRequireDefault(require("./components/Caption/Caption"));
|
|
300
|
+
|
|
293
301
|
var _Carousel = _interopRequireDefault(require("./components/Carousel/Carousel"));
|
|
294
302
|
|
|
295
303
|
var _Checkbox = _interopRequireDefault(require("./components/Checkbox/Checkbox"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@megafon/ui-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.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": "^
|
|
57
|
+
"@megafon/ui-icons": "^2.0.0-beta.1",
|
|
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": "2c242a4715a634e9ff1bd635e05ddacb1ae33a4a"
|
|
101
101
|
}
|