@megafon/ui-shared 8.0.5 → 8.1.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.
Files changed (33) hide show
  1. package/dist/es/components/Property/Property.d.ts +3 -42
  2. package/dist/es/components/Property/Property.js +6 -137
  3. package/dist/es/components/Stepper/Stepper.css +1 -0
  4. package/dist/es/components/Stepper/Stepper.d.ts +48 -0
  5. package/dist/es/components/Stepper/Stepper.js +140 -0
  6. package/dist/es/components/Stepper/StepperItem.css +1 -0
  7. package/dist/es/components/Stepper/StepperItem.d.ts +50 -0
  8. package/dist/es/components/Stepper/StepperItem.js +89 -0
  9. package/dist/es/index.d.ts +2 -1
  10. package/dist/es/index.js +2 -1
  11. package/dist/lib/components/Property/Property.d.ts +3 -42
  12. package/dist/lib/components/Property/Property.js +5 -136
  13. package/dist/lib/components/Stepper/Stepper.css +1 -0
  14. package/dist/lib/components/Stepper/Stepper.d.ts +48 -0
  15. package/dist/lib/components/Stepper/Stepper.js +149 -0
  16. package/dist/lib/components/Stepper/StepperItem.css +1 -0
  17. package/dist/lib/components/Stepper/StepperItem.d.ts +50 -0
  18. package/dist/lib/components/Stepper/StepperItem.js +98 -0
  19. package/dist/lib/index.d.ts +2 -1
  20. package/dist/lib/index.js +14 -7
  21. package/package.json +5 -5
  22. package/dist/es/components/Property/Property.css +0 -1
  23. package/dist/es/components/Property/PropertyDescription.css +0 -1
  24. package/dist/es/components/Property/PropertyDescription.d.ts +0 -6
  25. package/dist/es/components/Property/PropertyDescription.js +0 -43
  26. package/dist/es/components/Property/types.d.ts +0 -22
  27. package/dist/es/components/Property/types.js +0 -1
  28. package/dist/lib/components/Property/Property.css +0 -1
  29. package/dist/lib/components/Property/PropertyDescription.css +0 -1
  30. package/dist/lib/components/Property/PropertyDescription.d.ts +0 -6
  31. package/dist/lib/components/Property/PropertyDescription.js +0 -53
  32. package/dist/lib/components/Property/types.d.ts +0 -22
  33. package/dist/lib/components/Property/types.js +0 -5
@@ -1,44 +1,5 @@
1
1
  import * as React from 'react';
2
- import { PromoBadge } from '@megafon/ui-core';
3
- import './Property.scss';
4
- import { Item } from './types';
5
- export interface IProperty {
6
- /** Ссылка на корневой элемент */
7
- rootRef?: React.Ref<HTMLDivElement>;
8
- /** Массив с данными для строки */
9
- items: Item[];
10
- /** Дополнительный класс для основного контейнера */
11
- className?: string;
12
- /** Текст для бейджа */
13
- badge?: string;
14
- /** Тип бейджа */
15
- badgeType?: React.ComponentProps<typeof PromoBadge>['type'];
16
- /** Текст тултипа */
17
- tooltip?: string;
18
- /** Отключить верхнюю границу */
19
- disableBorderTop?: boolean;
20
- /** Наличие нижней границы */
21
- borderBottom?: boolean;
22
- /** Цвет верхней и нижней границ */
23
- borderColor?: 'default' | 'darker';
24
- /** Единое значение для всей строки */
25
- mergedValue?: string;
26
- /** Иконка для строки */
27
- icon?: React.ReactNode;
28
- /** Растягивание компонента на всю доступную ширину */
29
- fullWidth?: boolean;
30
- /** Дополнительные data атрибуты к внутренним элементам */
31
- dataAttrs?: {
32
- root?: Record<string, string>;
33
- moreLink?: Record<string, string>;
34
- };
35
- /** Дополнительные классы для внутренних элементов */
36
- classes?: {
37
- title?: string;
38
- openedDescription?: string;
39
- toggleDescription?: string;
40
- };
41
- }
42
- export declare const testIdPrefix = "Property";
43
- declare const Property: React.FC<IProperty>;
2
+ import { Parameter } from '@megafon/ui-core';
3
+ type PropertyProps = React.ComponentProps<typeof Parameter>;
4
+ declare const Property: React.FC<PropertyProps>;
44
5
  export default Property;
@@ -1,141 +1,10 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import "core-js/modules/es.symbol.js";
3
- import "core-js/modules/es.symbol.description.js";
4
- import "core-js/modules/es.array.map.js";
5
1
  import * as React from 'react';
6
- import { Grid, GridColumn, PromoBadge, Caption, Tooltip } from '@megafon/ui-core';
7
- import { cnCreate, filterDataAttrs, convert } from '@megafon/ui-helpers';
8
- import "./Property.css";
9
- import { getColumnConfig } from "../../helpers/getColumnConfig";
10
- import PropertyDescription from "./PropertyDescription";
11
- var InfoIcon = function InfoIcon(props) {
12
- return /*#__PURE__*/React.createElement("svg", _extends({
13
- viewBox: "0 0 20 20"
14
- }, props), /*#__PURE__*/React.createElement("path", {
15
- d: "M10 2c4.4 0 8 3.6 8 8s-3.6 8-8 8-8-3.6-8-8 3.6-8 8-8zm0 5c.6 0 1-.4 1-1s-.4-1-1-1-1 .4-1 1 .4 1 1 1zm1 8V9H9v6h2z"
16
- }));
17
- };
18
- export var testIdPrefix = 'Property';
2
+ import { Parameter } from '@megafon/ui-core';
3
+ import { cnCreate } from '@megafon/ui-helpers';
19
4
  var cn = cnCreate('mfui-property');
20
- var Property = function Property(_ref) {
21
- var rootRef = _ref.rootRef,
22
- items = _ref.items,
23
- className = _ref.className,
24
- _ref$badge = _ref.badge,
25
- badge = _ref$badge === void 0 ? '' : _ref$badge,
26
- _ref$badgeType = _ref.badgeType,
27
- badgeType = _ref$badgeType === void 0 ? 'popular' : _ref$badgeType,
28
- tooltip = _ref.tooltip,
29
- icon = _ref.icon,
30
- _ref$disableBorderTop = _ref.disableBorderTop,
31
- disableBorderTop = _ref$disableBorderTop === void 0 ? false : _ref$disableBorderTop,
32
- _ref$borderBottom = _ref.borderBottom,
33
- borderBottom = _ref$borderBottom === void 0 ? false : _ref$borderBottom,
34
- _ref$borderColor = _ref.borderColor,
35
- borderColor = _ref$borderColor === void 0 ? 'default' : _ref$borderColor,
36
- _ref$mergedValue = _ref.mergedValue,
37
- mergedValue = _ref$mergedValue === void 0 ? '' : _ref$mergedValue,
38
- _ref$fullWidth = _ref.fullWidth,
39
- fullWidth = _ref$fullWidth === void 0 ? false : _ref$fullWidth,
40
- _ref$classes = _ref.classes,
41
- classes = _ref$classes === void 0 ? {} : _ref$classes,
42
- dataAttrs = _ref.dataAttrs;
43
- var tooltipRef = React.useRef(null);
44
- var renderTitle = function renderTitle(titles, titleSize, isFirstItem) {
45
- return titles === null || titles === void 0 ? void 0 : titles.map(function (titleItem, i) {
46
- var isFirstTitle = i === 0;
47
- return /*#__PURE__*/React.createElement("div", {
48
- key: i,
49
- className: cn('title-item', {
50
- size: titleSize
51
- }, [classes.title]),
52
- "data-testid": "".concat(testIdPrefix, "-title-item")
53
- }, icon && isFirstTitle && /*#__PURE__*/React.createElement("div", {
54
- className: cn('icon')
55
- }, icon), titleItem, tooltip && isFirstItem && isFirstTitle && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
56
- className: cn('tooltip'),
57
- ref: tooltipRef
58
- }, /*#__PURE__*/React.createElement(InfoIcon, null)), /*#__PURE__*/React.createElement(Tooltip, {
59
- className: cn('tooltip-inner'),
60
- triggerElement: tooltipRef
61
- }, tooltip)));
62
- });
63
- };
64
- var renderDescription = function renderDescription(description) {
65
- return description === null || description === void 0 ? void 0 : description.map(function (_ref2, j) {
66
- var value = _ref2.value,
67
- isCollapsible = _ref2.isCollapsible;
68
- return /*#__PURE__*/React.createElement("div", {
69
- className: cn('desc', {
70
- collapsible: isCollapsible
71
- }),
72
- key: j
73
- }, /*#__PURE__*/React.createElement(PropertyDescription, {
74
- value: value,
75
- isCollapsible: isCollapsible,
76
- dataAttrs: {
77
- moreLink: dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreLink
78
- },
79
- classes: {
80
- open: classes.openedDescription,
81
- toggle: classes.toggleDescription
82
- }
83
- }));
84
- });
85
- };
86
- var renderValue = function renderValue(valueFrameColor, value, valueUnit) {
87
- return /*#__PURE__*/React.createElement("div", {
88
- className: cn('value-wrapper', {
89
- frame: valueFrameColor
90
- }),
91
- "data-testid": "".concat(testIdPrefix, "-value")
92
- }, /*#__PURE__*/React.createElement("div", {
93
- className: cn('value')
94
- }, typeof value === 'string' ? convert(value, {}) : value), valueUnit && /*#__PURE__*/React.createElement(Caption, {
95
- className: cn('value-unit'),
96
- hasMargin: false
97
- }, convert(valueUnit, {})));
98
- };
99
- return /*#__PURE__*/React.createElement("div", _extends({
100
- className: cn({
101
- 'border-top': !disableBorderTop,
102
- 'border-bottom': borderBottom,
103
- 'border-color': borderColor
104
- }, [className]),
105
- ref: rootRef
106
- }, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.root)), /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(GridColumn, _extends({}, getColumnConfig(fullWidth), {
107
- dataAttrs: {
108
- root: {
109
- 'data-testid': "".concat(testIdPrefix, "-gridColumn")
110
- }
111
- }
112
- }), /*#__PURE__*/React.createElement("div", {
113
- className: cn('wrapper')
114
- }, items.map(function (_ref3, i) {
115
- var title = _ref3.title,
116
- value = _ref3.value,
117
- description = _ref3.description,
118
- _ref3$valueUnit = _ref3.valueUnit,
119
- valueUnit = _ref3$valueUnit === void 0 ? '' : _ref3$valueUnit,
120
- _ref3$titleSize = _ref3.titleSize,
121
- titleSize = _ref3$titleSize === void 0 ? 'default' : _ref3$titleSize,
122
- _ref3$valueFrameColor = _ref3.valueFrameColor,
123
- valueFrameColor = _ref3$valueFrameColor === void 0 ? 'none' : _ref3$valueFrameColor;
124
- var isFirstItem = i === 0;
125
- var isRenderBadge = isFirstItem && !!badge;
126
- return /*#__PURE__*/React.createElement(React.Fragment, {
127
- key: i
128
- }, /*#__PURE__*/React.createElement("div", {
129
- className: cn('main', {
130
- 'with-badge': isRenderBadge,
131
- 'with-out-title': !title
132
- })
133
- }, /*#__PURE__*/React.createElement("div", {
134
- className: cn('title')
135
- }, isRenderBadge && /*#__PURE__*/React.createElement(PromoBadge, {
136
- className: cn('badge'),
137
- type: badgeType
138
- }, badge), title ? renderTitle(title, titleSize, isFirstItem) : renderDescription(description)), mergedValue && isFirstItem && renderValue(valueFrameColor, mergedValue, valueUnit), !mergedValue && value && renderValue(valueFrameColor, value, valueUnit)), title && renderDescription(description));
139
- })))));
5
+ var Property = function Property(props) {
6
+ return /*#__PURE__*/React.createElement("div", {
7
+ className: cn()
8
+ }, /*#__PURE__*/React.createElement(Parameter, props));
140
9
  };
141
10
  export default Property;
@@ -0,0 +1 @@
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-stepper{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px;overflow-x:auto}.mfui-stepper::-webkit-scrollbar{height:8px}.mfui-stepper::-webkit-scrollbar-thumb{background-color:var(--spbSky2);border-radius:8px}.mfui-stepper_is-horizontal{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}
@@ -0,0 +1,48 @@
1
+ import * as React from 'react';
2
+ import type { IStepperItemProps } from './StepperItem';
3
+ import './Stepper.scss';
4
+ export type StepperItemType = Pick<IStepperItemProps, 'title' | 'text' | 'icon' | 'linkText' | 'linkUrl'>;
5
+ export interface IStepperProps {
6
+ /** Дополнительный класс корневого элемента */
7
+ className?: string;
8
+ /** Дополнительные классы элементов */
9
+ classes?: {
10
+ root?: string;
11
+ item?: string;
12
+ itemIconButton?: string;
13
+ itemTitle?: string;
14
+ itemText?: string;
15
+ itemLink?: string;
16
+ };
17
+ /** Ссылка на корневой элемент */
18
+ rootRef?: React.Ref<HTMLDivElement>;
19
+ /** Индекс активного шага */
20
+ activeStep?: number;
21
+ /** Количество шагов */
22
+ stepCount?: number;
23
+ /** Шаги */
24
+ items?: StepperItemType[];
25
+ /** Направление */
26
+ isHorizontal?: boolean;
27
+ /** Цифры вместо галочек */
28
+ isNumeric?: boolean;
29
+ /** Отключение кнопок */
30
+ isDisabled?: boolean;
31
+ /** Все шаги пройдены */
32
+ isAllChecked?: boolean;
33
+ /** Выравнивание */
34
+ align?: 'center' | 'left';
35
+ /** Дополнительные data атрибуты к внутренним элементам */
36
+ dataAttrs?: {
37
+ root?: Record<string, string>;
38
+ item?: Record<string, string>;
39
+ itemIconButton?: Record<string, string>;
40
+ itemTitle?: Record<string, string>;
41
+ itemText?: Record<string, string>;
42
+ itemLink?: Record<string, string>;
43
+ };
44
+ /** Обработчик события смены шага */
45
+ onChange?: (index: number) => void;
46
+ }
47
+ declare const Stepper: React.FC<IStepperProps>;
48
+ export default Stepper;
@@ -0,0 +1,140 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import "core-js/modules/es.array.from.js";
4
+ import "core-js/modules/es.array.map.js";
5
+ import "core-js/modules/es.string.iterator.js";
6
+ import * as React from 'react';
7
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
8
+ import StepperItem, { STEPPER_ITEM_THEME_ENUM } from "./StepperItem";
9
+ import "./Stepper.css";
10
+ var CheckedIcon = function CheckedIcon(props) {
11
+ return /*#__PURE__*/React.createElement("svg", _extends({
12
+ viewBox: "0 0 20 20"
13
+ }, props), /*#__PURE__*/React.createElement("path", {
14
+ d: "M8.832 11.547L6.619 9.335l-1.414 1.413 2.462 2.462 1.445 1.446 5.932-8.486-1.638-1.148-4.574 6.525z"
15
+ }));
16
+ };
17
+ var cn = cnCreate('mfui-stepper');
18
+ var Stepper = function Stepper(_ref) {
19
+ var className = _ref.className,
20
+ _ref$classes = _ref.classes,
21
+ _ref$classes2 = _ref$classes === void 0 ? {} : _ref$classes,
22
+ rootClassName = _ref$classes2.root,
23
+ itemClassName = _ref$classes2.item,
24
+ itemIconButtonClassName = _ref$classes2.itemIconButton,
25
+ itemTitleClassName = _ref$classes2.itemTitle,
26
+ itemTextClassname = _ref$classes2.itemText,
27
+ itemLinkClassName = _ref$classes2.itemLink,
28
+ rootRef = _ref.rootRef,
29
+ _ref$activeStep = _ref.activeStep,
30
+ activeStep = _ref$activeStep === void 0 ? 0 : _ref$activeStep,
31
+ _ref$stepCount = _ref.stepCount,
32
+ stepCount = _ref$stepCount === void 0 ? 2 : _ref$stepCount,
33
+ _ref$items = _ref.items,
34
+ items = _ref$items === void 0 ? [] : _ref$items,
35
+ _ref$isHorizontal = _ref.isHorizontal,
36
+ isHorizontal = _ref$isHorizontal === void 0 ? true : _ref$isHorizontal,
37
+ isNumeric = _ref.isNumeric,
38
+ isDisabled = _ref.isDisabled,
39
+ isAllChecked = _ref.isAllChecked,
40
+ _ref$align = _ref.align,
41
+ align = _ref$align === void 0 ? 'center' : _ref$align,
42
+ _ref$dataAttrs = _ref.dataAttrs,
43
+ _ref$dataAttrs2 = _ref$dataAttrs === void 0 ? {} : _ref$dataAttrs,
44
+ rootAttrs = _ref$dataAttrs2.root,
45
+ itemAttrs = _ref$dataAttrs2.item,
46
+ itemIconButtonAttrs = _ref$dataAttrs2.itemIconButton,
47
+ itemTitleAttrs = _ref$dataAttrs2.itemTitle,
48
+ itemTextAttrs = _ref$dataAttrs2.itemText,
49
+ itemLinkAttrs = _ref$dataAttrs2.itemLink,
50
+ _ref$onChange = _ref.onChange,
51
+ onChange = _ref$onChange === void 0 ? function () {
52
+ return null;
53
+ } : _ref$onChange;
54
+ var _React$useState = React.useState(activeStep),
55
+ _React$useState2 = _slicedToArray(_React$useState, 2),
56
+ currentIndex = _React$useState2[0],
57
+ setCurrentIndex = _React$useState2[1];
58
+ var hasCustomItems = !!items.length;
59
+ var currentItems = hasCustomItems ? items : Array.from({
60
+ length: stepCount
61
+ });
62
+ var defineItemTheme = React.useCallback(function (index) {
63
+ switch (true) {
64
+ case isAllChecked:
65
+ case index < currentIndex:
66
+ {
67
+ return STEPPER_ITEM_THEME_ENUM.CHECKED;
68
+ }
69
+ case index === currentIndex:
70
+ {
71
+ return STEPPER_ITEM_THEME_ENUM.ACTIVE;
72
+ }
73
+ default:
74
+ {
75
+ return STEPPER_ITEM_THEME_ENUM.DEFAULT;
76
+ }
77
+ }
78
+ }, [currentIndex, isAllChecked]);
79
+ var handleClickItem = React.useCallback(function (index) {
80
+ return function () {
81
+ if (isAllChecked || isDisabled) {
82
+ return;
83
+ }
84
+ setCurrentIndex(index);
85
+ onChange(index);
86
+ };
87
+ }, [isAllChecked, isDisabled, onChange]);
88
+ React.useEffect(function () {
89
+ if (activeStep === undefined) {
90
+ return;
91
+ }
92
+ setCurrentIndex(activeStep);
93
+ }, [activeStep]);
94
+ var renderIcon = React.useCallback(function (index, theme) {
95
+ var isChecked = theme === STEPPER_ITEM_THEME_ENUM.CHECKED;
96
+ if (isNumeric || !isChecked) {
97
+ return index + 1;
98
+ }
99
+ return /*#__PURE__*/React.createElement(CheckedIcon, null);
100
+ }, [isNumeric]);
101
+ var renderItems = React.useMemo(function () {
102
+ return currentItems.map(function (elem, i) {
103
+ var item = elem || {};
104
+ var itemTheme = defineItemTheme(i);
105
+ var itemIcon = item.icon || renderIcon(i, itemTheme);
106
+ var hasSeparator = i < currentItems.length - 1;
107
+ return /*#__PURE__*/React.createElement(StepperItem, _extends({}, item, {
108
+ className: itemClassName,
109
+ classes: {
110
+ iconButton: itemIconButtonClassName,
111
+ title: itemTitleClassName,
112
+ text: itemTextClassname,
113
+ link: itemLinkClassName
114
+ },
115
+ dataAttrs: {
116
+ root: itemAttrs,
117
+ iconButton: itemIconButtonAttrs,
118
+ title: itemTitleAttrs,
119
+ text: itemTextAttrs,
120
+ link: itemLinkAttrs
121
+ },
122
+ key: i,
123
+ icon: itemIcon,
124
+ hasSeparator: hasSeparator,
125
+ isHorizontal: isHorizontal,
126
+ isDisabled: isDisabled,
127
+ align: align,
128
+ theme: itemTheme,
129
+ onClick: handleClickItem(i)
130
+ }));
131
+ });
132
+ }, [align, currentItems, isDisabled, isHorizontal, itemAttrs, itemIconButtonAttrs, itemIconButtonClassName, itemClassName, itemLinkAttrs, itemLinkClassName, itemTextAttrs, itemTextClassname, itemTitleAttrs, itemTitleClassName, defineItemTheme, handleClickItem, renderIcon]);
133
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(rootAttrs), {
134
+ className: cn([className, rootClassName], {
135
+ 'is-horizontal': isHorizontal
136
+ }),
137
+ ref: rootRef
138
+ }), renderItems);
139
+ };
140
+ export default Stepper;
@@ -0,0 +1 @@
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-stepper-item{display:-webkit-box;display:-ms-flexbox;display:flex;position:relative;-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;gap:16px}.mfui-stepper-item_is-horizontal{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.mfui-stepper-item_is-horizontal .mfui-stepper-item__separator{-o-border-image:url(i/separator.png) 2 repeat;border-image:url(i/separator.png) 2 repeat;border-left:none;border-radius:100px;border-top:2px solid transparent;height:2px;left:calc(50% + 24px);min-height:2px;position:absolute;top:19px;width:calc(100% - 36px)}@media screen and (min-width:1024px){.mfui-stepper-item_is-horizontal .mfui-stepper-item__separator{left:calc(50% + 32px);width:calc(100% - 52px)}}.mfui-stepper-item_theme_active .mfui-stepper-item__icon-button{background-color:var(--night20)}.mfui-stepper-item_theme_active .mfui-stepper-item__icon{background-color:var(--night)}.mfui-stepper-item_theme_checked .mfui-stepper-item__icon-button{background-color:var(--brandGreen20)}.mfui-stepper-item_theme_checked .mfui-stepper-item__icon{background-color:var(--brandGreen)}.mfui-stepper-item_theme_checked .mfui-stepper-item__separator{border-color:var(--brandGreen);-o-border-image:none;border-image:none}.mfui-stepper-item_align_left{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.mfui-stepper-item_align_left .mfui-stepper-item__separator{left:auto;right:0}.mfui-stepper-item_align_left .mfui-stepper-item__content,.mfui-stepper-item_align_left .mfui-stepper-item__icon-button-area{-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start}.mfui-stepper-item__icon-button-area{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:12px;-ms-flex-align:center;-ms-flex-item-align:stretch;align-self:stretch}.mfui-stepper-item__icon-button,.mfui-stepper-item__icon-button-area{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;align-items:center}.mfui-stepper-item__icon-button{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;-ms-flex-align:center;-webkit-box-pack:center;-ms-flex-pack:center;background-color:var(--spbSky0);border-radius:100%;height:40px;justify-content:center;-webkit-transition:background-color .25s ease-out;transition:background-color .25s ease-out;width:40px}.mfui-stepper-item__icon-button:disabled{cursor:default}.mfui-stepper-item__icon{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;background-color:var(--spbSky2);border-radius:100%;color:var(--stcWhite);font-weight:500;height:24px;justify-content:center;-webkit-transition:background-color .25s ease-out;transition:background-color .25s ease-out;width:24px}.mfui-stepper-item__icon svg{width:20px;fill:var(--stcWhite)}.mfui-stepper-item__separator{-o-border-image:url(i/separator-vertical.png) 2 repeat;border-image:url(i/separator-vertical.png) 2 repeat;border-left:2px solid transparent;border-top:none;height:100%;min-height:20px;position:static;-webkit-transition:border-color .25s ease-out;transition:border-color .25s ease-out;width:2px}.mfui-stepper-item__content{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;gap:4px;-webkit-box-align:center;-ms-flex-align:center;align-items:center;min-width:160px;padding-bottom:20px}.mfui-stepper-item__link{margin-top:13px}
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+ import './StepperItem.scss';
3
+ export declare enum STEPPER_ITEM_THEME_ENUM {
4
+ CHECKED = "checked",
5
+ ACTIVE = "active",
6
+ DEFAULT = "default"
7
+ }
8
+ export interface IStepperItemProps {
9
+ /** Дополнительный класс корневого элемента */
10
+ className?: string;
11
+ /** Дополнительные классы элементов */
12
+ classes?: {
13
+ iconButton?: string;
14
+ title?: string;
15
+ text?: string;
16
+ link?: string;
17
+ };
18
+ /** Тема */
19
+ theme?: STEPPER_ITEM_THEME_ENUM;
20
+ /** Заголовок */
21
+ title?: string;
22
+ /** Текст */
23
+ text?: string;
24
+ /** Текст ссылки */
25
+ linkText?: string;
26
+ /** Адрес ссылки */
27
+ linkUrl?: string;
28
+ /** Иконка */
29
+ icon?: string | number | JSX.Element;
30
+ /** Наличие разделителя */
31
+ hasSeparator?: boolean;
32
+ /** Направление */
33
+ isHorizontal?: boolean;
34
+ /** Отключение */
35
+ isDisabled?: boolean;
36
+ /** Выравнивание */
37
+ align?: 'center' | 'left';
38
+ /** Дополнительные data атрибуты к внутренним элементам */
39
+ dataAttrs?: {
40
+ root?: Record<string, string>;
41
+ iconButton?: Record<string, string>;
42
+ title?: Record<string, string>;
43
+ text?: Record<string, string>;
44
+ link?: Record<string, string>;
45
+ };
46
+ /** Обработчик события клика */
47
+ onClick?: () => void;
48
+ }
49
+ declare const StepperItem: React.FC<IStepperItemProps>;
50
+ export default StepperItem;
@@ -0,0 +1,89 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import "core-js/modules/es.string.link.js";
3
+ import * as React from 'react';
4
+ import { Button, Header, Paragraph } from '@megafon/ui-core';
5
+ import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
6
+ import "./StepperItem.css";
7
+ export var STEPPER_ITEM_THEME_ENUM;
8
+ (function (STEPPER_ITEM_THEME_ENUM) {
9
+ STEPPER_ITEM_THEME_ENUM["CHECKED"] = "checked";
10
+ STEPPER_ITEM_THEME_ENUM["ACTIVE"] = "active";
11
+ STEPPER_ITEM_THEME_ENUM["DEFAULT"] = "default";
12
+ })(STEPPER_ITEM_THEME_ENUM || (STEPPER_ITEM_THEME_ENUM = {}));
13
+ var cn = cnCreate('mfui-stepper-item');
14
+ var StepperItem = function StepperItem(_ref) {
15
+ var className = _ref.className,
16
+ _ref$classes = _ref.classes,
17
+ _ref$classes2 = _ref$classes === void 0 ? {} : _ref$classes,
18
+ iconButtonClassName = _ref$classes2.iconButton,
19
+ titleClassName = _ref$classes2.title,
20
+ textClassName = _ref$classes2.text,
21
+ linkClassName = _ref$classes2.link,
22
+ _ref$theme = _ref.theme,
23
+ theme = _ref$theme === void 0 ? 'default' : _ref$theme,
24
+ title = _ref.title,
25
+ text = _ref.text,
26
+ linkText = _ref.linkText,
27
+ linkUrl = _ref.linkUrl,
28
+ icon = _ref.icon,
29
+ hasSeparator = _ref.hasSeparator,
30
+ _ref$isHorizontal = _ref.isHorizontal,
31
+ isHorizontal = _ref$isHorizontal === void 0 ? true : _ref$isHorizontal,
32
+ isDisabled = _ref.isDisabled,
33
+ _ref$align = _ref.align,
34
+ align = _ref$align === void 0 ? 'center' : _ref$align,
35
+ _ref$dataAttrs = _ref.dataAttrs,
36
+ _ref$dataAttrs2 = _ref$dataAttrs === void 0 ? {} : _ref$dataAttrs,
37
+ rootAttrs = _ref$dataAttrs2.root,
38
+ iconButtonAttrs = _ref$dataAttrs2.iconButton,
39
+ titleAttrs = _ref$dataAttrs2.title,
40
+ textAttrs = _ref$dataAttrs2.text,
41
+ linkAttrs = _ref$dataAttrs2.link,
42
+ onClick = _ref.onClick;
43
+ var hasLink = !!linkText && !!linkUrl;
44
+ var hasContent = !!title || !!text || hasLink;
45
+ var renderContent = /*#__PURE__*/React.createElement("div", {
46
+ className: cn('content')
47
+ }, title && /*#__PURE__*/React.createElement(Header, {
48
+ className: cn([titleClassName]),
49
+ dataAttrs: {
50
+ root: titleAttrs
51
+ },
52
+ as: "h5",
53
+ align: align
54
+ }, title), text && /*#__PURE__*/React.createElement(Paragraph, {
55
+ className: cn([textClassName]),
56
+ dataAttrs: {
57
+ root: textAttrs
58
+ },
59
+ hasMargin: false,
60
+ align: align
61
+ }, text), hasLink && /*#__PURE__*/React.createElement(Button, {
62
+ className: cn('link', [linkClassName]),
63
+ dataAttrs: {
64
+ root: linkAttrs
65
+ },
66
+ href: linkUrl,
67
+ type: "text",
68
+ sizeAll: "extra-small"
69
+ }, linkText));
70
+ return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(rootAttrs), {
71
+ className: cn([className], {
72
+ 'is-horizontal': isHorizontal,
73
+ theme: theme,
74
+ align: align
75
+ })
76
+ }), /*#__PURE__*/React.createElement("div", {
77
+ className: cn('icon-button-area')
78
+ }, /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(iconButtonAttrs), {
79
+ className: cn('icon-button', [iconButtonClassName]),
80
+ type: "button",
81
+ disabled: isDisabled,
82
+ onClick: onClick
83
+ }), /*#__PURE__*/React.createElement("span", {
84
+ className: cn('icon')
85
+ }, icon)), hasSeparator && /*#__PURE__*/React.createElement("span", {
86
+ className: cn('separator')
87
+ })), hasContent && renderContent);
88
+ };
89
+ export default StepperItem;
@@ -34,11 +34,12 @@ export { default as PictureWithDescription } from './components/PictureWithDescr
34
34
  export { default as PromoCard } from './components/PromoCards/components/PromoCard/PromoCard';
35
35
  export { default as PromoCards } from './components/PromoCards/PromoCards';
36
36
  export { default as Property } from './components/Property/Property';
37
- export { default as PropertyDescription } from './components/Property/PropertyDescription';
38
37
  export { default as ServiceCard } from './components/ServiceCards/components/ServiceCard/ServiceCard';
39
38
  export { default as ServiceCards } from './components/ServiceCards/ServiceCards';
40
39
  export { default as SidePictureCard } from './components/SidePictureCards/components/SidePictureCard';
41
40
  export { default as SidePictureCards } from './components/SidePictureCards/SidePictureCards';
41
+ export { default as Stepper } from './components/Stepper/Stepper';
42
+ export { default as StepperItem } from './components/Stepper/StepperItem';
42
43
  export { default as Steps } from './components/Steps/Steps';
43
44
  export { default as StepsItem } from './components/Steps/StepsItem';
44
45
  export { default as StoreBanner } from './components/StoreBanner/StoreBanner';
package/dist/es/index.js CHANGED
@@ -34,11 +34,12 @@ export { default as PictureWithDescription } from "./components/PictureWithDescr
34
34
  export { default as PromoCard } from "./components/PromoCards/components/PromoCard/PromoCard";
35
35
  export { default as PromoCards } from "./components/PromoCards/PromoCards";
36
36
  export { default as Property } from "./components/Property/Property";
37
- export { default as PropertyDescription } from "./components/Property/PropertyDescription";
38
37
  export { default as ServiceCard } from "./components/ServiceCards/components/ServiceCard/ServiceCard";
39
38
  export { default as ServiceCards } from "./components/ServiceCards/ServiceCards";
40
39
  export { default as SidePictureCard } from "./components/SidePictureCards/components/SidePictureCard";
41
40
  export { default as SidePictureCards } from "./components/SidePictureCards/SidePictureCards";
41
+ export { default as Stepper } from "./components/Stepper/Stepper";
42
+ export { default as StepperItem } from "./components/Stepper/StepperItem";
42
43
  export { default as Steps } from "./components/Steps/Steps";
43
44
  export { default as StepsItem } from "./components/Steps/StepsItem";
44
45
  export { default as StoreBanner } from "./components/StoreBanner/StoreBanner";
@@ -1,44 +1,5 @@
1
1
  import * as React from 'react';
2
- import { PromoBadge } from '@megafon/ui-core';
3
- import './Property.scss';
4
- import { Item } from './types';
5
- export interface IProperty {
6
- /** Ссылка на корневой элемент */
7
- rootRef?: React.Ref<HTMLDivElement>;
8
- /** Массив с данными для строки */
9
- items: Item[];
10
- /** Дополнительный класс для основного контейнера */
11
- className?: string;
12
- /** Текст для бейджа */
13
- badge?: string;
14
- /** Тип бейджа */
15
- badgeType?: React.ComponentProps<typeof PromoBadge>['type'];
16
- /** Текст тултипа */
17
- tooltip?: string;
18
- /** Отключить верхнюю границу */
19
- disableBorderTop?: boolean;
20
- /** Наличие нижней границы */
21
- borderBottom?: boolean;
22
- /** Цвет верхней и нижней границ */
23
- borderColor?: 'default' | 'darker';
24
- /** Единое значение для всей строки */
25
- mergedValue?: string;
26
- /** Иконка для строки */
27
- icon?: React.ReactNode;
28
- /** Растягивание компонента на всю доступную ширину */
29
- fullWidth?: boolean;
30
- /** Дополнительные data атрибуты к внутренним элементам */
31
- dataAttrs?: {
32
- root?: Record<string, string>;
33
- moreLink?: Record<string, string>;
34
- };
35
- /** Дополнительные классы для внутренних элементов */
36
- classes?: {
37
- title?: string;
38
- openedDescription?: string;
39
- toggleDescription?: string;
40
- };
41
- }
42
- export declare const testIdPrefix = "Property";
43
- declare const Property: React.FC<IProperty>;
2
+ import { Parameter } from '@megafon/ui-core';
3
+ type PropertyProps = React.ComponentProps<typeof Parameter>;
4
+ declare const Property: React.FC<PropertyProps>;
44
5
  export default Property;