@megafon/ui-shared 6.10.0 → 6.11.1

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.
Files changed (43) hide show
  1. package/dist/es/components/ButtonsBox/ButtonsBox.css +34 -0
  2. package/dist/es/components/ButtonsBox/ButtonsBox.d.ts +48 -0
  3. package/dist/es/components/ButtonsBox/ButtonsBox.js +89 -0
  4. package/dist/es/components/Container/Container.css +526 -1
  5. package/dist/es/components/Container/Container.d.ts +9 -0
  6. package/dist/es/components/Container/Container.js +14 -3
  7. package/dist/es/components/InfoCards/InfoCards.d.ts +4 -1
  8. package/dist/es/components/InfoCards/InfoCards.js +14 -5
  9. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.css +30 -7
  10. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.d.ts +4 -0
  11. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.js +20 -10
  12. package/dist/es/components/InfoCards/types.d.ts +6 -1
  13. package/dist/es/components/PromoCards/PromoCards.d.ts +28 -0
  14. package/dist/es/components/PromoCards/PromoCards.js +90 -0
  15. package/dist/es/components/PromoCards/components/PromoCard/PromoCard.css +157 -0
  16. package/dist/es/components/PromoCards/components/PromoCard/PromoCard.d.ts +18 -0
  17. package/dist/es/components/PromoCards/components/PromoCard/PromoCard.js +74 -0
  18. package/dist/es/components/PromoCards/types.d.ts +29 -0
  19. package/dist/es/components/PromoCards/types.js +0 -0
  20. package/dist/es/index.d.ts +3 -0
  21. package/dist/es/index.js +3 -0
  22. package/dist/lib/components/ButtonsBox/ButtonsBox.css +34 -0
  23. package/dist/lib/components/ButtonsBox/ButtonsBox.d.ts +48 -0
  24. package/dist/lib/components/ButtonsBox/ButtonsBox.js +110 -0
  25. package/dist/lib/components/Container/Container.css +526 -1
  26. package/dist/lib/components/Container/Container.d.ts +9 -0
  27. package/dist/lib/components/Container/Container.js +14 -3
  28. package/dist/lib/components/InfoCards/InfoCards.d.ts +4 -1
  29. package/dist/lib/components/InfoCards/InfoCards.js +16 -13
  30. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.css +30 -7
  31. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.d.ts +4 -0
  32. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.js +19 -9
  33. package/dist/lib/components/InfoCards/types.d.ts +6 -1
  34. package/dist/lib/components/PromoCards/PromoCards.d.ts +28 -0
  35. package/dist/lib/components/PromoCards/PromoCards.js +113 -0
  36. package/dist/lib/components/PromoCards/components/PromoCard/PromoCard.css +157 -0
  37. package/dist/lib/components/PromoCards/components/PromoCard/PromoCard.d.ts +18 -0
  38. package/dist/lib/components/PromoCards/components/PromoCard/PromoCard.js +96 -0
  39. package/dist/lib/components/PromoCards/types.d.ts +29 -0
  40. package/dist/lib/components/PromoCards/types.js +1 -0
  41. package/dist/lib/index.d.ts +3 -0
  42. package/dist/lib/index.js +24 -0
  43. package/package.json +3 -3
@@ -0,0 +1,34 @@
1
+ h1,
2
+ h2,
3
+ h3,
4
+ h4,
5
+ h5 {
6
+ margin: 0;
7
+ }
8
+ .mfui-v6-buttons-box {
9
+ display: -webkit-box;
10
+ display: -ms-flexbox;
11
+ display: flex;
12
+ }
13
+ .mfui-v6-buttons-box__buttons_equal-width {
14
+ display: grid;
15
+ gap: 20px;
16
+ max-width: -webkit-max-content;
17
+ max-width: -moz-max-content;
18
+ max-width: max-content;
19
+ }
20
+ @media screen and (max-width: 767px) {
21
+ .mfui-v6-buttons-box__buttons_equal-width {
22
+ grid-template-rows: repeat(2, 1fr);
23
+ }
24
+ }
25
+ @media screen and (min-width: 768px) {
26
+ .mfui-v6-buttons-box__buttons_equal-width {
27
+ grid-template-columns: repeat(2, 1fr);
28
+ }
29
+ }
30
+ .mfui-v6-buttons-box_h-align_center {
31
+ -webkit-box-pack: center;
32
+ -ms-flex-pack: center;
33
+ justify-content: center;
34
+ }
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ import './ButtonsBox.less';
3
+ export declare type ButtonType = {
4
+ /** Тип */
5
+ type?: 'primary' | 'outline';
6
+ /** Иконка */
7
+ icon?: JSX.Element;
8
+ /** Название */
9
+ title?: string;
10
+ /** Ссылка */
11
+ href?: string;
12
+ /** Target свойство кнопки */
13
+ target?: '_self' | '_blank' | '_parent' | '_top';
14
+ /** Rel - атрибут тега <a> */
15
+ rel?: string;
16
+ /** Задает атрибут download для тега <a> */
17
+ download?: boolean;
18
+ /** Показать стелку */
19
+ showArrow?: boolean;
20
+ /** Обработчик клика */
21
+ onClick?: (e: React.SyntheticEvent<EventTarget>) => void;
22
+ };
23
+ export interface IButtonsBox {
24
+ /** Дополнительные data атрибуты к внутренним элементам */
25
+ dataAttrs?: {
26
+ root?: Record<string, string>;
27
+ button?: Record<string, string>;
28
+ extraButton?: Record<string, string>;
29
+ };
30
+ /** Дополнительный класс корневого элемента */
31
+ className?: string;
32
+ /** Дополнительные классы для внутренних элементов */
33
+ classes?: {
34
+ root?: string;
35
+ button?: string;
36
+ extraButton?: string;
37
+ };
38
+ /** Кнопка */
39
+ button: ButtonType;
40
+ /** Дополнительная кнопка */
41
+ extraButton?: ButtonType;
42
+ /** Горизонтальное выравнивание */
43
+ align?: 'center' | 'left';
44
+ /** Ссылка на корневой элемент */
45
+ rootRef?: React.Ref<HTMLDivElement>;
46
+ }
47
+ declare const ButtonsBox: React.FC<IButtonsBox>;
48
+ export default ButtonsBox;
@@ -0,0 +1,89 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React from 'react';
3
+ import { Button } from '@megafon/ui-core';
4
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
5
+ import * as PropTypes from 'prop-types';
6
+ import { setRelAttribute } from "../../helpers/setRelAttribute";
7
+ import "./ButtonsBox.css";
8
+ var cn = cnCreate('mfui-v6-buttons-box');
9
+
10
+ var ButtonsBox = function ButtonsBox(_ref) {
11
+ var className = _ref.className,
12
+ _ref$classes = _ref.classes,
13
+ classes = _ref$classes === void 0 ? {} : _ref$classes,
14
+ dataAttrs = _ref.dataAttrs,
15
+ button = _ref.button,
16
+ extraButton = _ref.extraButton,
17
+ align = _ref.align,
18
+ rootRef = _ref.rootRef;
19
+ var showTwoButtons = !!button && !!extraButton;
20
+
21
+ var renderButton = function renderButton(btnProps, btnClassName, dataAttr) {
22
+ return /*#__PURE__*/React.createElement(Button, {
23
+ dataAttrs: {
24
+ root: dataAttr
25
+ },
26
+ className: btnClassName,
27
+ fullWidth: showTwoButtons,
28
+ type: btnProps.type,
29
+ theme: "green",
30
+ icon: btnProps.icon,
31
+ href: btnProps.href,
32
+ target: btnProps.target,
33
+ download: btnProps.download,
34
+ showArrow: btnProps.showArrow,
35
+ rel: setRelAttribute(btnProps.rel, btnProps.target),
36
+ onClick: btnProps.onClick
37
+ }, btnProps.title);
38
+ };
39
+
40
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root), {
41
+ className: cn({
42
+ 'h-align': align
43
+ }, [className, classes.root]),
44
+ ref: rootRef
45
+ }), /*#__PURE__*/React.createElement("div", {
46
+ className: cn('buttons', {
47
+ 'equal-width': showTwoButtons
48
+ })
49
+ }, !!button && renderButton(button, classes.button, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.button), !!extraButton && renderButton(extraButton, classes.extraButton, dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.extraButton)));
50
+ };
51
+
52
+ ButtonsBox.propTypes = {
53
+ dataAttrs: PropTypes.shape({
54
+ root: PropTypes.objectOf(PropTypes.string.isRequired),
55
+ link: PropTypes.objectOf(PropTypes.string.isRequired),
56
+ button: PropTypes.objectOf(PropTypes.string.isRequired)
57
+ }),
58
+ className: PropTypes.string,
59
+ classes: PropTypes.shape({
60
+ root: PropTypes.string,
61
+ button: PropTypes.string,
62
+ link: PropTypes.string
63
+ }),
64
+ rootRef: PropTypes.oneOfType([PropTypes.func, PropTypes.oneOfType([PropTypes.shape({
65
+ current: PropTypes.elementType
66
+ }), PropTypes.any])]),
67
+ align: PropTypes.oneOf(['center', 'left']),
68
+ button: PropTypes.shape({
69
+ type: PropTypes.oneOf(['primary', 'outline']),
70
+ icon: PropTypes.element,
71
+ title: PropTypes.string,
72
+ href: PropTypes.string,
73
+ target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
74
+ rel: PropTypes.string,
75
+ download: PropTypes.bool,
76
+ onClick: PropTypes.func
77
+ }).isRequired,
78
+ extraButton: PropTypes.shape({
79
+ type: PropTypes.oneOf(['primary', 'outline']),
80
+ icon: PropTypes.element,
81
+ title: PropTypes.string,
82
+ href: PropTypes.string,
83
+ target: PropTypes.oneOf(['_self', '_blank', '_parent', '_top']),
84
+ rel: PropTypes.string,
85
+ download: PropTypes.bool,
86
+ onClick: PropTypes.func
87
+ })
88
+ };
89
+ export default ButtonsBox;