@megafon/ui-core 3.0.0-beta.2 → 3.0.0-beta.6
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 +70 -0
- package/dist/es/colors/Colors.js +13 -0
- package/dist/es/components/Accordion/Accordion.d.ts +1 -1
- package/dist/es/components/Accordion/Accordion.js +10 -5
- package/dist/es/components/Calendar/components/Month/Month.js +21 -5
- package/dist/es/components/Checkbox/Checkbox.d.ts +3 -25
- package/dist/es/components/Checkbox/Checkbox.js +71 -89
- package/dist/es/components/ContentArea/ContentArea.css +8 -59
- package/dist/es/components/ContentArea/ContentArea.d.ts +2 -6
- package/dist/es/components/ContentArea/ContentArea.js +5 -38
- package/dist/es/components/Counter/Counter.css +0 -47
- package/dist/es/components/Grid/Grid.css +0 -47
- package/dist/es/components/Header/Header.d.ts +1 -18
- package/dist/es/components/Header/Header.js +28 -66
- package/dist/es/components/Notification/Notification.css +0 -47
- package/dist/es/components/Pagination/components/PaginationButton/PaginationButton.css +0 -47
- package/dist/es/components/Pagination/components/PaginationNavigation/PaginationNavigation.css +0 -47
- package/dist/es/components/Paragraph/Paragraph.css +9 -11
- package/dist/es/components/Paragraph/Paragraph.d.ts +8 -12
- package/dist/es/components/Paragraph/Paragraph.js +6 -33
- package/dist/es/components/RadioButton/RadioButton.d.ts +1 -26
- package/dist/es/components/RadioButton/RadioButton.js +44 -83
- package/dist/es/components/Select/Select.d.ts +1 -1
- package/dist/es/components/TextLink/TextLink.js +1 -1
- package/dist/es/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/es/components/Tooltip/Tooltip.js +2 -9
- package/dist/lib/colors/Colors.js +10 -0
- package/dist/lib/components/Accordion/Accordion.d.ts +1 -1
- package/dist/lib/components/Accordion/Accordion.js +9 -4
- package/dist/lib/components/Calendar/components/Month/Month.js +20 -4
- package/dist/lib/components/Checkbox/Checkbox.d.ts +3 -25
- package/dist/lib/components/Checkbox/Checkbox.js +76 -124
- package/dist/lib/components/ContentArea/ContentArea.css +8 -59
- package/dist/lib/components/ContentArea/ContentArea.d.ts +2 -6
- package/dist/lib/components/ContentArea/ContentArea.js +5 -41
- package/dist/lib/components/Counter/Counter.css +0 -47
- package/dist/lib/components/Grid/Grid.css +0 -47
- package/dist/lib/components/Header/Header.d.ts +1 -18
- package/dist/lib/components/Header/Header.js +28 -97
- package/dist/lib/components/Notification/Notification.css +0 -47
- package/dist/lib/components/Pagination/components/PaginationButton/PaginationButton.css +0 -47
- package/dist/lib/components/Pagination/components/PaginationNavigation/PaginationNavigation.css +0 -47
- package/dist/lib/components/Paragraph/Paragraph.css +9 -11
- package/dist/lib/components/Paragraph/Paragraph.d.ts +8 -12
- package/dist/lib/components/Paragraph/Paragraph.js +6 -36
- package/dist/lib/components/RadioButton/RadioButton.d.ts +1 -26
- package/dist/lib/components/RadioButton/RadioButton.js +45 -115
- package/dist/lib/components/Select/Select.d.ts +1 -1
- package/dist/lib/components/TextLink/TextLink.js +1 -1
- package/dist/lib/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/lib/components/Tooltip/Tooltip.js +1 -8
- package/package.json +5 -4
- package/styles/base.less +1 -60
- package/styles/colors.css +60 -0
- package/styles/colorsDark.css +62 -0
- package/styles/base.css +0 -54
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,76 @@
|
|
|
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.0.0-beta.6](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.5...@megafon/ui-core@3.0.0-beta.6) (2022-02-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* color props values changes ([b279f2b](https://github.com/MegafonWebLab/megafon-ui/commit/b279f2b5af0edae92fe9825bbfa90a207cb8009a))
|
|
12
|
+
* remove deprecated props values ([add76f3](https://github.com/MegafonWebLab/megafon-ui/commit/add76f38a9ebad8b5b6504dfe6aae862746f0dfc))
|
|
13
|
+
* **colors:** rename green and purple to brandGreen and brandPurple ([2266734](https://github.com/MegafonWebLab/megafon-ui/commit/2266734336be1a0faa5f1736fdf39070442837b3))
|
|
14
|
+
* **core:** fix build ui-core ([458c824](https://github.com/MegafonWebLab/megafon-ui/commit/458c824aab639e4802db261d0416b3cee58ac274))
|
|
15
|
+
* **core:** separated colors.css file ([f0a4d72](https://github.com/MegafonWebLab/megafon-ui/commit/f0a4d728e0b30c5caeae5c8d9607e624fb4ea288))
|
|
16
|
+
* **textlink:** fix color prop type ([6edcea0](https://github.com/MegafonWebLab/megafon-ui/commit/6edcea06ce26d137611aaf022d3ee6f7da295366))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### BREAKING CHANGES
|
|
20
|
+
|
|
21
|
+
* ContentArea: prop color change values from 'base' to 'white' and from 'content' to 'default';
|
|
22
|
+
remove depreacted value 'freshAsphalt'
|
|
23
|
+
Paragraph: prop color change values from 'base' to 'white' and from 'contend' to 'default';
|
|
24
|
+
remove deprecared values 'freshAsphalt' and 'clearWhite'
|
|
25
|
+
StoreBanner: prop theme change value from 'black' to 'default'; remove deprecated value 'clearWhite'
|
|
26
|
+
* ContentArea, Paragraph, StoreBanner and Breadcrumbs components from no don't have
|
|
27
|
+
freshAsphalt and clearWhite as values for colorize props
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# [3.0.0-beta.5](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.4...@megafon/ui-core@3.0.0-beta.5) (2022-01-28)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **header:** made header as a functional component ([81701ad](https://github.com/MegafonWebLab/megafon-ui/commit/81701ad87b6e9df2fe630bf4e183383264c0bb01))
|
|
39
|
+
* **radiobutton:** made radiobutton as a functional component ([65406af](https://github.com/MegafonWebLab/megafon-ui/commit/65406afc90fd82f7eb0fdcbbe78569fc98164e78))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
# [3.0.0-beta.4](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.3...@megafon/ui-core@3.0.0-beta.4) (2022-01-27)
|
|
46
|
+
|
|
47
|
+
**Note:** Version bump only for package @megafon/ui-core
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
# [3.0.0-beta.3](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.2...@megafon/ui-core@3.0.0-beta.3) (2022-01-24)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* **accordion:** add focus on arrow after tab press, add open/close accordion after enter press ([9bfa0ac](https://github.com/MegafonWebLab/megafon-ui/commit/9bfa0ac5348ac25c0e37a4df51e26e2dabde02ba))
|
|
59
|
+
* **accordion:** change type of onClickAccordion prop ([9a150c5](https://github.com/MegafonWebLab/megafon-ui/commit/9a150c5de309547763a714b0eb630dfb386a8107))
|
|
60
|
+
* **calendar/month:** add focus on month arrows, add enter press handlers ([63f1e47](https://github.com/MegafonWebLab/megafon-ui/commit/63f1e4761e57ed6d56464b632dce9fd5e77655e1))
|
|
61
|
+
* **checkbox:** add focus on custom checkbox, add enter press handler ([83d111d](https://github.com/MegafonWebLab/megafon-ui/commit/83d111d0e4b41d3915bdd079bed4a7f9715ce7a5))
|
|
62
|
+
* **checkbox:** add isChecked state, change type of onChange prop ([f535caf](https://github.com/MegafonWebLab/megafon-ui/commit/f535caf39a02ab6793d3c63b654a1f1f3e9b2b93))
|
|
63
|
+
* **tooltip:** add check event function from ui-helpers ([a784ab4](https://github.com/MegafonWebLab/megafon-ui/commit/a784ab4f288124eb941fe8f52e46b2efc9aa2f82))
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### BREAKING CHANGES
|
|
67
|
+
|
|
68
|
+
* **checkbox:** change type of onChange prop on (checked: boolean) => void
|
|
69
|
+
* **accordion:** remove parameter 'title' in onClickAccordion prop
|
|
70
|
+
* **tooltip:** change onOpen, onClose types; AccessibilityEventTypeNative from @megafon/ui-helpers
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
6
76
|
# [3.0.0-beta.2](https://github.com/MegafonWebLab/megafon-ui/compare/@megafon/ui-core@3.0.0-beta.1...@megafon/ui-core@3.0.0-beta.2) (2022-01-21)
|
|
7
77
|
|
|
8
78
|
**Note:** Version bump only for package @megafon/ui-core
|
package/dist/es/colors/Colors.js
CHANGED
|
@@ -128,6 +128,19 @@ var Colors = function Colors() {
|
|
|
128
128
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
129
129
|
setCurrentTheme = _React$useState2[1];
|
|
130
130
|
|
|
131
|
+
var _React$useState3 = React.useState(false),
|
|
132
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
133
|
+
setLoad = _React$useState4[1];
|
|
134
|
+
|
|
135
|
+
React.useEffect(function () {
|
|
136
|
+
function load() {
|
|
137
|
+
setLoad(true);
|
|
138
|
+
document.removeEventListener('css-var-load', load);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
document.addEventListener('css-var-load', load);
|
|
142
|
+
}, []);
|
|
143
|
+
|
|
131
144
|
var getCurrentColorValue = function getCurrentColorValue(code) {
|
|
132
145
|
return typeof document !== 'undefined' ? document.documentElement.style.getPropertyValue("--".concat(code)) : '';
|
|
133
146
|
};
|
|
@@ -20,7 +20,7 @@ export interface IAccordionProps extends IFilterDataAttrs {
|
|
|
20
20
|
titleWrap?: string;
|
|
21
21
|
};
|
|
22
22
|
/** Обработчик клика */
|
|
23
|
-
onClickAccordion?: (isOpened: boolean
|
|
23
|
+
onClickAccordion?: (isOpened: boolean) => void;
|
|
24
24
|
}
|
|
25
25
|
declare const Accordion: React.FC<IAccordionProps>;
|
|
26
26
|
export default Accordion;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
|
+
import { cnCreate, filterDataAttrs, checkEventIsClickOrEnterPress } from '@megafon/ui-helpers';
|
|
5
5
|
import * as PropTypes from 'prop-types';
|
|
6
6
|
import Collapse from "../Collapse/Collapse";
|
|
7
7
|
import Header from "../Header/Header";
|
|
@@ -52,9 +52,11 @@ var Accordion = function Accordion(_ref) {
|
|
|
52
52
|
setIsOpenedState(isOpened);
|
|
53
53
|
}, [isOpened]);
|
|
54
54
|
|
|
55
|
-
var handleClickTitle = function handleClickTitle() {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
var handleClickTitle = function handleClickTitle(e) {
|
|
56
|
+
if (checkEventIsClickOrEnterPress(e)) {
|
|
57
|
+
onClickAccordion && onClickAccordion(!isOpenedState);
|
|
58
|
+
setIsOpenedState(!isOpenedState);
|
|
59
|
+
}
|
|
58
60
|
};
|
|
59
61
|
|
|
60
62
|
var openedClassName = isOpenedState ? openedClass : undefined;
|
|
@@ -65,10 +67,13 @@ var Accordion = function Accordion(_ref) {
|
|
|
65
67
|
}, [className, rootPropsClasses, openedClassName])
|
|
66
68
|
}), /*#__PURE__*/React.createElement("div", {
|
|
67
69
|
className: cn('title-wrap', [titleWrapPropsClasses]),
|
|
68
|
-
onClick: handleClickTitle
|
|
70
|
+
onClick: handleClickTitle,
|
|
71
|
+
onKeyDown: handleClickTitle
|
|
69
72
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
70
73
|
as: "h5"
|
|
71
74
|
}, title), /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
tabIndex: 0,
|
|
76
|
+
role: "button",
|
|
72
77
|
className: cn('icon-box', {
|
|
73
78
|
open: isOpenedState
|
|
74
79
|
})
|
|
@@ -2,7 +2,7 @@ import "core-js/modules/es.array.concat";
|
|
|
2
2
|
import "core-js/modules/es.array.map";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { cnCreate } from '@megafon/ui-helpers';
|
|
5
|
+
import { checkEventIsClickOrEnterPress, cnCreate } from '@megafon/ui-helpers';
|
|
6
6
|
import "./Month.css";
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
|
|
@@ -38,12 +38,22 @@ var Month = function Month(_ref) {
|
|
|
38
38
|
goToNextMonth = _ref.goToNextMonth,
|
|
39
39
|
children = _ref.children;
|
|
40
40
|
|
|
41
|
-
var handleArrowLeftClick = function handleArrowLeftClick() {
|
|
42
|
-
|
|
41
|
+
var handleArrowLeftClick = function handleArrowLeftClick(e) {
|
|
42
|
+
if (checkEventIsClickOrEnterPress(e)) {
|
|
43
|
+
!isPrevMonthDisabled && goToPreviousMonth();
|
|
44
|
+
}
|
|
43
45
|
};
|
|
44
46
|
|
|
45
|
-
var handleArrowRightClick = function handleArrowRightClick() {
|
|
46
|
-
|
|
47
|
+
var handleArrowRightClick = function handleArrowRightClick(e) {
|
|
48
|
+
if (checkEventIsClickOrEnterPress(e)) {
|
|
49
|
+
!isNextMonthDisabled && goToNextMonth();
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
var getTabIndex = function getTabIndex(hasFocus) {
|
|
54
|
+
var tabIndexWithFocus = 0;
|
|
55
|
+
var tabIndexWithoutFocus = -1;
|
|
56
|
+
return hasFocus ? tabIndexWithFocus : tabIndexWithoutFocus;
|
|
47
57
|
};
|
|
48
58
|
|
|
49
59
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -51,16 +61,22 @@ var Month = function Month(_ref) {
|
|
|
51
61
|
}, /*#__PURE__*/React.createElement("div", {
|
|
52
62
|
className: cn('header')
|
|
53
63
|
}, /*#__PURE__*/React.createElement(ArrowLeft, {
|
|
64
|
+
role: "button",
|
|
65
|
+
tabIndex: getTabIndex(!isPrevMonthDisabled),
|
|
54
66
|
className: cn('arrow', {
|
|
55
67
|
disabled: isPrevMonthDisabled
|
|
56
68
|
}),
|
|
69
|
+
onKeyDown: handleArrowLeftClick,
|
|
57
70
|
onClick: handleArrowLeftClick
|
|
58
71
|
}), /*#__PURE__*/React.createElement("span", {
|
|
59
72
|
className: cn('title')
|
|
60
73
|
}, "".concat(monthLabel, " ").concat(year)), /*#__PURE__*/React.createElement(ArrowRight, {
|
|
74
|
+
role: "button",
|
|
75
|
+
tabIndex: getTabIndex(!isNextMonthDisabled),
|
|
61
76
|
className: cn('arrow', {
|
|
62
77
|
disabled: isNextMonthDisabled
|
|
63
78
|
}),
|
|
79
|
+
onKeyDown: handleArrowRightClick,
|
|
64
80
|
onClick: handleArrowRightClick
|
|
65
81
|
})), /*#__PURE__*/React.createElement("div", {
|
|
66
82
|
className: cn('weekday-labels')
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IFilterDataAttrs } from '@megafon/ui-helpers';
|
|
3
|
-
import * as PropTypes from 'prop-types';
|
|
4
3
|
import './Checkbox.less';
|
|
5
4
|
export interface ICheckboxProps extends IFilterDataAttrs {
|
|
6
5
|
/** Цвет чекбокса */
|
|
@@ -28,28 +27,7 @@ export interface ICheckboxProps extends IFilterDataAttrs {
|
|
|
28
27
|
extraContent?: JSX.Element[] | Element[] | JSX.Element | Element | string;
|
|
29
28
|
children: JSX.Element[] | Element[] | JSX.Element | Element | string;
|
|
30
29
|
/** Обработчик изменения значения */
|
|
31
|
-
onChange?: (
|
|
32
|
-
}
|
|
33
|
-
declare class Checkbox extends React.Component<ICheckboxProps, {}> {
|
|
34
|
-
static propTypes: {
|
|
35
|
-
className: PropTypes.Requireable<string>;
|
|
36
|
-
fontSize: PropTypes.Requireable<string>;
|
|
37
|
-
color: PropTypes.Requireable<string>;
|
|
38
|
-
name: PropTypes.Requireable<string>;
|
|
39
|
-
value: PropTypes.Requireable<string>;
|
|
40
|
-
checked: PropTypes.Requireable<boolean>;
|
|
41
|
-
disabled: PropTypes.Requireable<boolean>;
|
|
42
|
-
error: PropTypes.Requireable<boolean>;
|
|
43
|
-
children: PropTypes.Requireable<string | PropTypes.ReactElementLike | (PropTypes.ReactElementLike | null | undefined)[]>;
|
|
44
|
-
extraContent: PropTypes.Requireable<string | PropTypes.ReactElementLike | (PropTypes.ReactElementLike | null | undefined)[]>;
|
|
45
|
-
dataAttrs: PropTypes.Requireable<{
|
|
46
|
-
[x: string]: string;
|
|
47
|
-
}>;
|
|
48
|
-
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
49
|
-
};
|
|
50
|
-
static defaultProps: Partial<ICheckboxProps>;
|
|
51
|
-
isTouch: boolean;
|
|
52
|
-
handleChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
53
|
-
render(): JSX.Element;
|
|
30
|
+
onChange?: (checked: boolean) => void;
|
|
54
31
|
}
|
|
32
|
+
declare const Checkbox: React.FC<ICheckboxProps>;
|
|
55
33
|
export default Checkbox;
|
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
import "core-js/modules/es.date.to-string";
|
|
2
1
|
import "core-js/modules/es.function.name";
|
|
3
|
-
import "
|
|
4
|
-
import "core-js/modules/es.reflect.construct";
|
|
5
|
-
import "core-js/modules/es.regexp.to-string";
|
|
6
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
7
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
8
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
9
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
10
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
11
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
-
|
|
17
|
-
import * as React from 'react';
|
|
18
|
-
import { cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
4
|
+
import React, { useState, useEffect } from 'react';
|
|
5
|
+
import { checkEventIsClickOrEnterPress, cnCreate, detectTouch, filterDataAttrs } from '@megafon/ui-helpers';
|
|
19
6
|
import * as PropTypes from 'prop-types';
|
|
20
7
|
import "./Checkbox.css";
|
|
21
8
|
|
|
@@ -27,79 +14,79 @@ var CheckedIcon = function CheckedIcon(props) {
|
|
|
27
14
|
}));
|
|
28
15
|
};
|
|
29
16
|
|
|
17
|
+
var CHANGE_KEY = 'change';
|
|
30
18
|
var cn = cnCreate('mfui-checkbox');
|
|
31
19
|
|
|
32
|
-
var Checkbox =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
var Checkbox = function Checkbox(_ref) {
|
|
21
|
+
var className = _ref.className,
|
|
22
|
+
_ref$fontSize = _ref.fontSize,
|
|
23
|
+
fontSize = _ref$fontSize === void 0 ? 'regular' : _ref$fontSize,
|
|
24
|
+
name = _ref.name,
|
|
25
|
+
_ref$color = _ref.color,
|
|
26
|
+
color = _ref$color === void 0 ? 'dark' : _ref$color,
|
|
27
|
+
value = _ref.value,
|
|
28
|
+
_ref$checked = _ref.checked,
|
|
29
|
+
checked = _ref$checked === void 0 ? false : _ref$checked,
|
|
30
|
+
disabled = _ref.disabled,
|
|
31
|
+
error = _ref.error,
|
|
32
|
+
children = _ref.children,
|
|
33
|
+
extraContent = _ref.extraContent,
|
|
34
|
+
dataAttrs = _ref.dataAttrs,
|
|
35
|
+
classes = _ref.classes,
|
|
36
|
+
onChange = _ref.onChange;
|
|
37
|
+
var isTouch = detectTouch();
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
var _useState = useState(checked),
|
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
41
|
+
isChecked = _useState2[0],
|
|
42
|
+
setIsChecked = _useState2[1];
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
useEffect(function () {
|
|
45
|
+
setIsChecked(checked);
|
|
46
|
+
}, [checked]);
|
|
44
47
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return _this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
_createClass(Checkbox, [{
|
|
54
|
-
key: "render",
|
|
55
|
-
value: function render() {
|
|
56
|
-
var _this$props = this.props,
|
|
57
|
-
className = _this$props.className,
|
|
58
|
-
fontSize = _this$props.fontSize,
|
|
59
|
-
name = _this$props.name,
|
|
60
|
-
color = _this$props.color,
|
|
61
|
-
value = _this$props.value,
|
|
62
|
-
checked = _this$props.checked,
|
|
63
|
-
disabled = _this$props.disabled,
|
|
64
|
-
error = _this$props.error,
|
|
65
|
-
children = _this$props.children,
|
|
66
|
-
extraContent = _this$props.extraContent,
|
|
67
|
-
dataAttrs = _this$props.dataAttrs,
|
|
68
|
-
classes = _this$props.classes;
|
|
69
|
-
return /*#__PURE__*/React.createElement("div", _extends({
|
|
70
|
-
className: cn('', {
|
|
71
|
-
'font-size': fontSize,
|
|
72
|
-
color: color,
|
|
73
|
-
checked: checked,
|
|
74
|
-
disabled: disabled,
|
|
75
|
-
error: error
|
|
76
|
-
}, className)
|
|
77
|
-
}, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("div", {
|
|
78
|
-
className: cn('inner', [classes === null || classes === void 0 ? void 0 : classes.inner])
|
|
79
|
-
}, /*#__PURE__*/React.createElement("label", {
|
|
80
|
-
className: cn('label', {
|
|
81
|
-
'no-touch': !this.isTouch
|
|
82
|
-
})
|
|
83
|
-
}, /*#__PURE__*/React.createElement("input", {
|
|
84
|
-
className: cn('input'),
|
|
85
|
-
type: "checkbox",
|
|
86
|
-
name: name,
|
|
87
|
-
value: value,
|
|
88
|
-
checked: checked,
|
|
89
|
-
onChange: this.handleChange,
|
|
90
|
-
disabled: disabled
|
|
91
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
92
|
-
className: cn('custom-input', [classes === null || classes === void 0 ? void 0 : classes.icon])
|
|
93
|
-
}, /*#__PURE__*/React.createElement(CheckedIcon, {
|
|
94
|
-
className: cn('icon')
|
|
95
|
-
})), children), extraContent && /*#__PURE__*/React.createElement("span", {
|
|
96
|
-
className: cn('extra-content')
|
|
97
|
-
}, extraContent)));
|
|
48
|
+
var handleChange = function handleChange(e) {
|
|
49
|
+
if (checkEventIsClickOrEnterPress(e) || e.type === CHANGE_KEY) {
|
|
50
|
+
setIsChecked(!isChecked);
|
|
51
|
+
onChange && onChange(!isChecked);
|
|
98
52
|
}
|
|
99
|
-
}
|
|
53
|
+
};
|
|
100
54
|
|
|
101
|
-
return
|
|
102
|
-
|
|
55
|
+
return /*#__PURE__*/React.createElement("div", _extends({
|
|
56
|
+
className: cn('', {
|
|
57
|
+
'font-size': fontSize,
|
|
58
|
+
color: color,
|
|
59
|
+
checked: isChecked,
|
|
60
|
+
disabled: disabled,
|
|
61
|
+
error: error
|
|
62
|
+
}, className)
|
|
63
|
+
}, filterDataAttrs(dataAttrs)), /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: cn('inner', [classes === null || classes === void 0 ? void 0 : classes.inner])
|
|
65
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
66
|
+
className: cn('label', {
|
|
67
|
+
'no-touch': !isTouch
|
|
68
|
+
})
|
|
69
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
70
|
+
className: cn('input'),
|
|
71
|
+
type: "checkbox",
|
|
72
|
+
tabIndex: -1,
|
|
73
|
+
name: name,
|
|
74
|
+
value: value,
|
|
75
|
+
checked: isChecked,
|
|
76
|
+
onChange: handleChange,
|
|
77
|
+
disabled: disabled
|
|
78
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
79
|
+
tabIndex: 0,
|
|
80
|
+
role: "checkbox",
|
|
81
|
+
"aria-checked": isChecked,
|
|
82
|
+
className: cn('custom-input', [classes === null || classes === void 0 ? void 0 : classes.icon]),
|
|
83
|
+
onKeyDown: handleChange
|
|
84
|
+
}, /*#__PURE__*/React.createElement(CheckedIcon, {
|
|
85
|
+
className: cn('icon')
|
|
86
|
+
})), children), extraContent && /*#__PURE__*/React.createElement("span", {
|
|
87
|
+
className: cn('extra-content')
|
|
88
|
+
}, extraContent)));
|
|
89
|
+
};
|
|
103
90
|
|
|
104
91
|
Checkbox.propTypes = {
|
|
105
92
|
className: PropTypes.string,
|
|
@@ -110,14 +97,9 @@ Checkbox.propTypes = {
|
|
|
110
97
|
checked: PropTypes.bool,
|
|
111
98
|
disabled: PropTypes.bool,
|
|
112
99
|
error: PropTypes.bool,
|
|
113
|
-
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string]),
|
|
114
|
-
extraContent: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element), PropTypes.element, PropTypes.string]),
|
|
100
|
+
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]).isRequired,
|
|
101
|
+
extraContent: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.element.isRequired), PropTypes.element, PropTypes.string]),
|
|
115
102
|
dataAttrs: PropTypes.objectOf(PropTypes.string.isRequired),
|
|
116
103
|
onChange: PropTypes.func
|
|
117
104
|
};
|
|
118
|
-
Checkbox.defaultProps = {
|
|
119
|
-
color: 'dark',
|
|
120
|
-
fontSize: 'regular',
|
|
121
|
-
checked: false
|
|
122
|
-
};
|
|
123
105
|
export default Checkbox;
|
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--green: #00B956;
|
|
3
|
-
--purple: #731982;
|
|
4
|
-
--base: #FFFFFF;
|
|
5
|
-
--content: #333333;
|
|
6
|
-
--spbSky0: #F6F6F6;
|
|
7
|
-
--spbSky1: #EDEDED;
|
|
8
|
-
--spbSky2: #D8D8D8;
|
|
9
|
-
--spbSky3: #999999;
|
|
10
|
-
--warmRedC: #EB5A40;
|
|
11
|
-
--137C: #FFA717;
|
|
12
|
-
--311C: #5BD9E5;
|
|
13
|
-
--reflexBlue: #444189;
|
|
14
|
-
--fury: #F62434;
|
|
15
|
-
--systemBlue: #34AAF2;
|
|
16
|
-
--background: #FFFFFF;
|
|
17
|
-
--buttonHoverGreen: #10E272;
|
|
18
|
-
--buttonhoverPurple: #534455;
|
|
19
|
-
--buttonDown: #404D46;
|
|
20
|
-
--gradientBasic: linear-gradient(90deg, #01873F 0%, #00B956 74%, #14CD6A 100%);
|
|
21
|
-
--gradientVIP: linear-gradient(90deg, #5B1168 0%, #731982 74%, #821E93 100%);
|
|
22
|
-
--gradientExclusive: linear-gradient(90deg, #2A2674 0%, #444189 74%, #504D93 100%);
|
|
23
|
-
--STCWhite: #FFFFFF;
|
|
24
|
-
--STCBlack: #333333;
|
|
25
|
-
--STCWhite5: #FFFFFF0D;
|
|
26
|
-
--STCWhite10: #FFFFFF1A;
|
|
27
|
-
--STCWhite20: #FFFFFF33;
|
|
28
|
-
--STCWhite50: #FFFFFF80;
|
|
29
|
-
--STCBlack5: #3333330D;
|
|
30
|
-
--STCBlack10: #3333331A;
|
|
31
|
-
--STCBlack20: #33333333;
|
|
32
|
-
--STCBlack50: #33333380;
|
|
33
|
-
--green80: #0CDC78;
|
|
34
|
-
--green20: #DDFFEC;
|
|
35
|
-
--purple80: #AA67C1;
|
|
36
|
-
--purple20: #FFEEFF;
|
|
37
|
-
--warmRedC80: #FF765D;
|
|
38
|
-
--warmRedC20: #FFCFC7;
|
|
39
|
-
--137C80: #FFB945;
|
|
40
|
-
--137C20: #FFEDD1;
|
|
41
|
-
--311C80: #62E3FF;
|
|
42
|
-
--311C20: #E1FAFF;
|
|
43
|
-
--reflexBlue80: #554FC9;
|
|
44
|
-
--reflexBlue20: #EBEAFF;
|
|
45
|
-
--fury80: #F8505D;
|
|
46
|
-
--fury20: #FFC5C9;
|
|
47
|
-
}
|
|
48
1
|
h1,
|
|
49
2
|
h2,
|
|
50
3
|
h3,
|
|
@@ -52,9 +5,11 @@ h4,
|
|
|
52
5
|
h5 {
|
|
53
6
|
margin: 0;
|
|
54
7
|
}
|
|
55
|
-
.mfui-content-
|
|
8
|
+
.mfui-content-area_color_default {
|
|
9
|
+
background-color: var(--content);
|
|
10
|
+
}
|
|
56
11
|
.mfui-content-area_color_white {
|
|
57
|
-
background-color: var(--
|
|
12
|
+
background-color: var(--stcWhite);
|
|
58
13
|
}
|
|
59
14
|
.mfui-content-area_color_transparent {
|
|
60
15
|
background-color: transparent;
|
|
@@ -74,10 +29,6 @@ h5 {
|
|
|
74
29
|
.mfui-content-area_color_spbSky2 {
|
|
75
30
|
background-color: var(--spbSky2);
|
|
76
31
|
}
|
|
77
|
-
.mfui-content-area_color_content,
|
|
78
|
-
.mfui-content-area_color_freshAsphalt {
|
|
79
|
-
background-color: var(--content);
|
|
80
|
-
}
|
|
81
32
|
.mfui-content-area__inner {
|
|
82
33
|
-webkit-box-sizing: content-box;
|
|
83
34
|
box-sizing: content-box;
|
|
@@ -126,9 +77,11 @@ h5 {
|
|
|
126
77
|
padding-right: 0;
|
|
127
78
|
padding-left: 0;
|
|
128
79
|
}
|
|
129
|
-
.mfui-content-
|
|
80
|
+
.mfui-content-area__inner_color_default {
|
|
81
|
+
background-color: var(--content);
|
|
82
|
+
}
|
|
130
83
|
.mfui-content-area__inner_color_white {
|
|
131
|
-
background-color: var(--
|
|
84
|
+
background-color: var(--stcWhite);
|
|
132
85
|
}
|
|
133
86
|
.mfui-content-area__inner_color_transparent {
|
|
134
87
|
background-color: transparent;
|
|
@@ -148,7 +101,3 @@ h5 {
|
|
|
148
101
|
.mfui-content-area__inner_color_spbSky2 {
|
|
149
102
|
background-color: var(--spbSky2);
|
|
150
103
|
}
|
|
151
|
-
.mfui-content-area__inner_color_content,
|
|
152
|
-
.mfui-content-area__inner_color_freshAsphalt {
|
|
153
|
-
background-color: var(--content);
|
|
154
|
-
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import './ContentArea.less';
|
|
3
3
|
declare const BACKGROUND_COLORS: {
|
|
4
|
-
readonly
|
|
4
|
+
readonly DEFAULT: "default";
|
|
5
|
+
readonly WHITE: "white";
|
|
5
6
|
readonly TRANSPARENT: "transparent";
|
|
6
7
|
readonly GREEN: "green";
|
|
7
8
|
readonly PURPLE: "purple";
|
|
8
9
|
readonly SPB_SKY_0: "spbSky0";
|
|
9
10
|
readonly SPB_SKY_1: "spbSky1";
|
|
10
11
|
readonly SPB_SKY_2: "spbSky2";
|
|
11
|
-
readonly CONTENT: "content";
|
|
12
|
-
/** @deprecated */
|
|
13
|
-
readonly WHITE: "white";
|
|
14
|
-
/** @deprecated */
|
|
15
|
-
readonly FRESH_ASPHALT: "freshAsphalt";
|
|
16
12
|
};
|
|
17
13
|
export declare type BackgroundColorType = typeof BACKGROUND_COLORS[keyof typeof BACKGROUND_COLORS];
|
|
18
14
|
declare const DisableIndents: {
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import "core-js/modules/es.array.concat";
|
|
2
|
-
import "core-js/modules/es.array.includes";
|
|
3
1
|
import "core-js/modules/es.object.values";
|
|
4
|
-
import "core-js/modules/es.string.includes";
|
|
5
2
|
import * as React from 'react';
|
|
6
3
|
import { cnCreate } from '@megafon/ui-helpers';
|
|
7
4
|
import * as PropTypes from 'prop-types';
|
|
8
5
|
import "./ContentArea.css";
|
|
9
6
|
var BACKGROUND_COLORS = {
|
|
10
|
-
|
|
7
|
+
DEFAULT: 'default',
|
|
8
|
+
WHITE: 'white',
|
|
11
9
|
TRANSPARENT: 'transparent',
|
|
12
10
|
GREEN: 'green',
|
|
13
11
|
PURPLE: 'purple',
|
|
14
12
|
SPB_SKY_0: 'spbSky0',
|
|
15
13
|
SPB_SKY_1: 'spbSky1',
|
|
16
|
-
SPB_SKY_2: 'spbSky2'
|
|
17
|
-
CONTENT: 'content',
|
|
18
|
-
|
|
19
|
-
/** @deprecated */
|
|
20
|
-
WHITE: 'white',
|
|
21
|
-
|
|
22
|
-
/** @deprecated */
|
|
23
|
-
FRESH_ASPHALT: 'freshAsphalt'
|
|
14
|
+
SPB_SKY_2: 'spbSky2'
|
|
24
15
|
};
|
|
25
16
|
var DisableIndents = {
|
|
26
17
|
MOBILE: 'mobile',
|
|
@@ -49,26 +40,6 @@ var ContentArea = function ContentArea(_ref) {
|
|
|
49
40
|
}, children));
|
|
50
41
|
};
|
|
51
42
|
|
|
52
|
-
var colorsCustomPropTypes = function colorsCustomPropTypes(props, propName, componentName) {
|
|
53
|
-
var deprecatedBlackValue = BACKGROUND_COLORS.FRESH_ASPHALT;
|
|
54
|
-
var deprecatedWhiteValue = BACKGROUND_COLORS.WHITE;
|
|
55
|
-
var propValue = props[propName];
|
|
56
|
-
|
|
57
|
-
if (propValue && !Object.values(BACKGROUND_COLORS).includes(propValue)) {
|
|
58
|
-
return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n expected one of [").concat(Object.values(BACKGROUND_COLORS), "]"));
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (propValue && propValue === deprecatedBlackValue) {
|
|
62
|
-
return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n value '").concat(deprecatedBlackValue, "' is deprecated, please use value '").concat(BACKGROUND_COLORS.CONTENT, "'"));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (propValue && propValue === deprecatedWhiteValue) {
|
|
66
|
-
return new Error("Failed prop type: Invalid prop '".concat(propName, "' of value '").concat(propValue, "' supplied to '").concat(componentName, "',\n value '").concat(deprecatedWhiteValue, "' is deprecated, please use value '").concat(BACKGROUND_COLORS.BASE, "'"));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return null;
|
|
70
|
-
};
|
|
71
|
-
|
|
72
43
|
ContentArea.propTypes = {
|
|
73
44
|
disableIndents: PropTypes.oneOf(Object.values(DisableIndents)),
|
|
74
45
|
className: PropTypes.string,
|
|
@@ -76,12 +47,8 @@ ContentArea.propTypes = {
|
|
|
76
47
|
root: PropTypes.string,
|
|
77
48
|
inner: PropTypes.string
|
|
78
49
|
}),
|
|
79
|
-
outerBackgroundColor:
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
innerBackgroundColor: function innerBackgroundColor(props, propName, componentName) {
|
|
83
|
-
return colorsCustomPropTypes(props, propName, componentName);
|
|
84
|
-
}
|
|
50
|
+
outerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS)),
|
|
51
|
+
innerBackgroundColor: PropTypes.oneOf(Object.values(BACKGROUND_COLORS))
|
|
85
52
|
};
|
|
86
53
|
ContentArea.defaultProps = {
|
|
87
54
|
outerBackgroundColor: 'transparent',
|
|
@@ -1,50 +1,3 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
--green: #00B956;
|
|
3
|
-
--purple: #731982;
|
|
4
|
-
--base: #FFFFFF;
|
|
5
|
-
--content: #333333;
|
|
6
|
-
--spbSky0: #F6F6F6;
|
|
7
|
-
--spbSky1: #EDEDED;
|
|
8
|
-
--spbSky2: #D8D8D8;
|
|
9
|
-
--spbSky3: #999999;
|
|
10
|
-
--warmRedC: #EB5A40;
|
|
11
|
-
--137C: #FFA717;
|
|
12
|
-
--311C: #5BD9E5;
|
|
13
|
-
--reflexBlue: #444189;
|
|
14
|
-
--fury: #F62434;
|
|
15
|
-
--systemBlue: #34AAF2;
|
|
16
|
-
--background: #FFFFFF;
|
|
17
|
-
--buttonHoverGreen: #10E272;
|
|
18
|
-
--buttonhoverPurple: #534455;
|
|
19
|
-
--buttonDown: #404D46;
|
|
20
|
-
--gradientBasic: linear-gradient(90deg, #01873F 0%, #00B956 74%, #14CD6A 100%);
|
|
21
|
-
--gradientVIP: linear-gradient(90deg, #5B1168 0%, #731982 74%, #821E93 100%);
|
|
22
|
-
--gradientExclusive: linear-gradient(90deg, #2A2674 0%, #444189 74%, #504D93 100%);
|
|
23
|
-
--STCWhite: #FFFFFF;
|
|
24
|
-
--STCBlack: #333333;
|
|
25
|
-
--STCWhite5: #FFFFFF0D;
|
|
26
|
-
--STCWhite10: #FFFFFF1A;
|
|
27
|
-
--STCWhite20: #FFFFFF33;
|
|
28
|
-
--STCWhite50: #FFFFFF80;
|
|
29
|
-
--STCBlack5: #3333330D;
|
|
30
|
-
--STCBlack10: #3333331A;
|
|
31
|
-
--STCBlack20: #33333333;
|
|
32
|
-
--STCBlack50: #33333380;
|
|
33
|
-
--green80: #0CDC78;
|
|
34
|
-
--green20: #DDFFEC;
|
|
35
|
-
--purple80: #AA67C1;
|
|
36
|
-
--purple20: #FFEEFF;
|
|
37
|
-
--warmRedC80: #FF765D;
|
|
38
|
-
--warmRedC20: #FFCFC7;
|
|
39
|
-
--137C80: #FFB945;
|
|
40
|
-
--137C20: #FFEDD1;
|
|
41
|
-
--311C80: #62E3FF;
|
|
42
|
-
--311C20: #E1FAFF;
|
|
43
|
-
--reflexBlue80: #554FC9;
|
|
44
|
-
--reflexBlue20: #EBEAFF;
|
|
45
|
-
--fury80: #F8505D;
|
|
46
|
-
--fury20: #FFC5C9;
|
|
47
|
-
}
|
|
48
1
|
h1,
|
|
49
2
|
h2,
|
|
50
3
|
h3,
|