@megafon/ui-shared 8.4.0 → 8.6.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 (45) hide show
  1. package/dist/es/components/ChipsBox/ChipBox.d.ts +5 -0
  2. package/dist/es/components/ChipsBox/ChipBox.js +7 -0
  3. package/dist/es/components/ChipsBox/ChipsBox.css +1 -0
  4. package/dist/es/components/ChipsBox/ChipsBox.d.ts +16 -0
  5. package/dist/es/components/ChipsBox/ChipsBox.js +76 -0
  6. package/dist/es/components/Container/Container.css +1 -1
  7. package/dist/es/components/ImageBanner/ImageBanner.css +1 -1
  8. package/dist/es/components/ImageBanner/ImageBanner.d.ts +2 -0
  9. package/dist/es/components/ImageBanner/ImageBanner.js +3 -0
  10. package/dist/es/components/InfoCards/components/InfoCard/InfoCard.js +2 -2
  11. package/dist/es/components/PictureBox/PictureBox.css +1 -1
  12. package/dist/es/components/PictureBox/img/mac-book-1x.png +0 -0
  13. package/dist/es/components/PictureBox/img/mac-book-2x.png +0 -0
  14. package/dist/es/components/Stepper/Stepper.css +1 -1
  15. package/dist/es/components/Stepper/Stepper.d.ts +4 -0
  16. package/dist/es/components/Stepper/Stepper.js +38 -23
  17. package/dist/es/components/Stepper/StepperItem.css +1 -1
  18. package/dist/es/components/Stepper/StepperItem.d.ts +7 -0
  19. package/dist/es/components/Stepper/StepperItem.js +15 -5
  20. package/dist/es/components/Stepper/img/separator-mobile.png +0 -0
  21. package/dist/es/index.d.ts +2 -0
  22. package/dist/es/index.js +2 -0
  23. package/dist/lib/components/ChipsBox/ChipBox.d.ts +5 -0
  24. package/dist/lib/components/ChipsBox/ChipBox.js +17 -0
  25. package/dist/lib/components/ChipsBox/ChipsBox.css +1 -0
  26. package/dist/lib/components/ChipsBox/ChipsBox.d.ts +16 -0
  27. package/dist/lib/components/ChipsBox/ChipsBox.js +85 -0
  28. package/dist/lib/components/Container/Container.css +1 -1
  29. package/dist/lib/components/ImageBanner/ImageBanner.css +1 -1
  30. package/dist/lib/components/ImageBanner/ImageBanner.d.ts +2 -0
  31. package/dist/lib/components/ImageBanner/ImageBanner.js +3 -0
  32. package/dist/lib/components/InfoCards/components/InfoCard/InfoCard.js +1 -1
  33. package/dist/lib/components/PictureBox/PictureBox.css +1 -1
  34. package/dist/lib/components/PictureBox/img/mac-book-1x.png +0 -0
  35. package/dist/lib/components/PictureBox/img/mac-book-2x.png +0 -0
  36. package/dist/lib/components/Stepper/Stepper.css +1 -1
  37. package/dist/lib/components/Stepper/Stepper.d.ts +4 -0
  38. package/dist/lib/components/Stepper/Stepper.js +37 -22
  39. package/dist/lib/components/Stepper/StepperItem.css +1 -1
  40. package/dist/lib/components/Stepper/StepperItem.d.ts +7 -0
  41. package/dist/lib/components/Stepper/StepperItem.js +16 -6
  42. package/dist/lib/components/Stepper/img/separator-mobile.png +0 -0
  43. package/dist/lib/index.d.ts +2 -0
  44. package/dist/lib/index.js +14 -0
  45. package/package.json +4 -4
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import "core-js/modules/es.symbol.js";
3
3
  import "core-js/modules/es.symbol.description.js";
4
4
  import * as React from 'react';
5
- import { cnCreate, convert, filterDataAttrs } from '@megafon/ui-helpers';
5
+ import { cnCreate, convert, filterDataAttrs, textConvertConfig } from '@megafon/ui-helpers';
6
6
  import { setRelAttribute } from "../../../../helpers/setRelAttribute";
7
7
  import "./InfoCard.css";
8
8
  var ArrowRight16 = function ArrowRight16(props) {
@@ -76,7 +76,7 @@ var InfoCard = function InfoCard(_ref) {
76
76
  className: cn('title', [classes === null || classes === void 0 ? void 0 : classes.title])
77
77
  }), convert(title, {})), !!description && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.description), {
78
78
  className: cn('description')
79
- }), convert(description, {})), !!moreInfo && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreInfo), {
79
+ }), convert(description, textConvertConfig)), !!moreInfo && /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(dataAttrs === null || dataAttrs === void 0 ? void 0 : dataAttrs.moreInfo), {
80
80
  className: cn('more-info')
81
81
  }), /*#__PURE__*/React.createElement("span", {
82
82
  className: cn('more-info-text')
@@ -1 +1 @@
1
- h1,h2,h3,h4,h5{margin:0}.mfui-picture-box_mask_none .mfui-picture-box__image{border-radius:24px;vertical-align:top;width:100%}@media screen and (min-width:768px){.mfui-picture-box_mask_none .mfui-picture-box__image{height:414px;-o-object-fit:cover;object-fit:cover}}@media screen and (min-width:1280px){.mfui-picture-box_mask_none .mfui-picture-box__image{height:520px}}.mfui-picture-box_mask_mac-book .mfui-picture-box__image{border-top-left-radius:1.4% 2.2988505747%;border-top-right-radius:1.4% 2.2988505747%;height:87%;left:0;margin:0 auto;-o-object-fit:cover;object-fit:cover;position:absolute;right:0;top:2%;width:82%}.mfui-picture-box__content{-ms-flex-item-align:center;align-self:center;margin-top:32px}@media screen and (min-width:1024px){.mfui-picture-box__content{margin-top:0}}@media screen and (min-width:1024px) and (max-width:1279px){.mfui-picture-box_align_left .mfui-picture-box__content{margin-left:12px}}@media screen and (min-width:1280px){.mfui-picture-box_align_left .mfui-picture-box__content{margin-left:44px}}@media screen and (min-width:1024px) and (max-width:1279px){.mfui-picture-box_align_right .mfui-picture-box__content{margin-right:12px}}@media screen and (min-width:1280px){.mfui-picture-box_align_right .mfui-picture-box__content{margin-right:44px}}.mfui-picture-box__button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:20px;margin-top:32px}.mfui-picture-box_mask_mac-book .mfui-picture-box__mask{background-image:url(i/mac-book-1x.png);background-repeat:no-repeat;background-size:100% auto;padding-bottom:60.9%;position:relative}@media screen and (-webkit-min-device-pixel-ratio:2),screen and (min-device-pixel-ratio:2),screen and (min-resolution:192dpi),screen and (min-resolution:2dppx){.mfui-picture-box_mask_mac-book .mfui-picture-box__mask{background-image:url(i/mac-book-2x.png)}}
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-picture-box_mask_none .mfui-picture-box__image{border-radius:24px;vertical-align:top;width:100%}@media screen and (min-width:768px){.mfui-picture-box_mask_none .mfui-picture-box__image{height:414px;-o-object-fit:cover;object-fit:cover}}@media screen and (min-width:1280px){.mfui-picture-box_mask_none .mfui-picture-box__image{height:520px}}.mfui-picture-box_mask_mac-book .mfui-picture-box__image{border-top-left-radius:1.4% 2.2988505747%;border-top-right-radius:1.4% 2.2988505747%;height:87%;left:0;margin:0 auto;-o-object-fit:cover;object-fit:cover;position:absolute;right:0;top:2%;width:82%}.mfui-picture-box__content{-ms-flex-item-align:center;align-self:center;margin-top:32px}@media screen and (min-width:1024px){.mfui-picture-box__content{margin-top:0}}@media screen and (min-width:1024px) and (max-width:1279px){.mfui-picture-box_align_left .mfui-picture-box__content{margin-left:12px}}@media screen and (min-width:1280px){.mfui-picture-box_align_left .mfui-picture-box__content{margin-left:44px}}@media screen and (min-width:1024px) and (max-width:1279px){.mfui-picture-box_align_right .mfui-picture-box__content{margin-right:12px}}@media screen and (min-width:1280px){.mfui-picture-box_align_right .mfui-picture-box__content{margin-right:44px}}.mfui-picture-box__button-wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;gap:20px;margin-top:32px}.mfui-picture-box_mask_mac-book .mfui-picture-box__mask{background-image:url(img/mac-book-1x.png);background-repeat:no-repeat;background-size:100% auto;padding-bottom:60.9%;position:relative}@media screen and (-webkit-min-device-pixel-ratio:2),screen and (min-device-pixel-ratio:2),screen and (min-resolution:192dpi),screen and (min-resolution:2dppx){.mfui-picture-box_mask_mac-book .mfui-picture-box__mask{background-image:url(img/mac-book-2x.png)}}
@@ -1 +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}
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-stepper{gap:16px}.mfui-stepper,.mfui-stepper__items-wrap{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.mfui-stepper__items-wrap{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 .mfui-stepper__items-wrap{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}
@@ -8,6 +8,7 @@ export interface IStepperProps {
8
8
  /** Дополнительные классы элементов */
9
9
  classes?: {
10
10
  root?: string;
11
+ itemsWrap?: string;
11
12
  item?: string;
12
13
  itemIconButton?: string;
13
14
  itemTitle?: string;
@@ -30,11 +31,14 @@ export interface IStepperProps {
30
31
  isDisabled?: boolean;
31
32
  /** Все шаги пройдены */
32
33
  isAllChecked?: boolean;
34
+ /** Отображение контента только активного шага */
35
+ showActiveStepContent?: boolean;
33
36
  /** Выравнивание */
34
37
  align?: 'center' | 'left';
35
38
  /** Дополнительные data атрибуты к внутренним элементам */
36
39
  dataAttrs?: {
37
40
  root?: Record<string, string>;
41
+ itemsWrap?: Record<string, string>;
38
42
  item?: Record<string, string>;
39
43
  itemIconButton?: Record<string, string>;
40
44
  itemTitle?: Record<string, string>;
@@ -5,7 +5,7 @@ import "core-js/modules/es.array.map.js";
5
5
  import "core-js/modules/es.string.iterator.js";
6
6
  import * as React from 'react';
7
7
  import { cnCreate, filterDataAttrs } from '@megafon/ui-helpers';
8
- import StepperItem, { STEPPER_ITEM_THEME_ENUM } from "./StepperItem";
8
+ import StepperItem, { STEPPER_ITEM_THEME_ENUM, STEPPER_ITEM_VIEW_ENUM } from "./StepperItem";
9
9
  import "./Stepper.css";
10
10
  var CheckedIcon = function CheckedIcon(props) {
11
11
  return /*#__PURE__*/React.createElement("svg", _extends({
@@ -20,6 +20,7 @@ var Stepper = function Stepper(_ref) {
20
20
  _ref$classes = _ref.classes,
21
21
  _ref$classes2 = _ref$classes === void 0 ? {} : _ref$classes,
22
22
  rootClassName = _ref$classes2.root,
23
+ itemsWrapClassName = _ref$classes2.itemsWrap,
23
24
  itemClassName = _ref$classes2.item,
24
25
  itemIconButtonClassName = _ref$classes2.itemIconButton,
25
26
  itemTitleClassName = _ref$classes2.itemTitle,
@@ -37,11 +38,14 @@ var Stepper = function Stepper(_ref) {
37
38
  isNumeric = _ref.isNumeric,
38
39
  isDisabled = _ref.isDisabled,
39
40
  isAllChecked = _ref.isAllChecked,
41
+ _ref$showActiveStepCo = _ref.showActiveStepContent,
42
+ showActiveStepContent = _ref$showActiveStepCo === void 0 ? false : _ref$showActiveStepCo,
40
43
  _ref$align = _ref.align,
41
44
  align = _ref$align === void 0 ? 'center' : _ref$align,
42
45
  _ref$dataAttrs = _ref.dataAttrs,
43
46
  _ref$dataAttrs2 = _ref$dataAttrs === void 0 ? {} : _ref$dataAttrs,
44
47
  rootAttrs = _ref$dataAttrs2.root,
48
+ itemsWrapAttrs = _ref$dataAttrs2.itemsWrap,
45
49
  itemAttrs = _ref$dataAttrs2.item,
46
50
  itemIconButtonAttrs = _ref$dataAttrs2.itemIconButton,
47
51
  itemTitleAttrs = _ref$dataAttrs2.itemTitle,
@@ -56,6 +60,7 @@ var Stepper = function Stepper(_ref) {
56
60
  currentIndex = _React$useState2[0],
57
61
  setCurrentIndex = _React$useState2[1];
58
62
  var hasCustomItems = !!items.length;
63
+ var isHorizontalContent = isHorizontal || showActiveStepContent;
59
64
  var currentItems = hasCustomItems ? items : Array.from({
60
65
  length: stepCount
61
66
  });
@@ -98,43 +103,53 @@ var Stepper = function Stepper(_ref) {
98
103
  }
99
104
  return /*#__PURE__*/React.createElement(CheckedIcon, null);
100
105
  }, [isNumeric]);
106
+ var renderItem = React.useCallback(function (props) {
107
+ return /*#__PURE__*/React.createElement(StepperItem, _extends({}, props, {
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
+ }));
123
+ }, [itemAttrs, itemIconButtonAttrs, itemIconButtonClassName, itemClassName, itemLinkAttrs, itemLinkClassName, itemTextAttrs, itemTextClassname, itemTitleAttrs, itemTitleClassName]);
101
124
  var renderItems = React.useMemo(function () {
102
125
  return currentItems.map(function (elem, i) {
103
126
  var item = elem || {};
104
127
  var itemTheme = defineItemTheme(i);
105
128
  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,
129
+ return renderItem(_extends(_extends({}, item), {
123
130
  icon: itemIcon,
124
- hasSeparator: hasSeparator,
125
- isHorizontal: isHorizontal,
131
+ hasSeparator: i < currentItems.length - 1,
132
+ isHorizontal: isHorizontalContent,
126
133
  isDisabled: isDisabled,
127
134
  align: align,
128
135
  theme: itemTheme,
136
+ view: showActiveStepContent ? STEPPER_ITEM_VIEW_ENUM.ICON : STEPPER_ITEM_VIEW_ENUM.DEFAULT,
129
137
  onClick: handleClickItem(i)
130
138
  }));
131
139
  });
132
- }, [align, currentItems, isDisabled, isHorizontal, itemAttrs, itemIconButtonAttrs, itemIconButtonClassName, itemClassName, itemLinkAttrs, itemLinkClassName, itemTextAttrs, itemTextClassname, itemTitleAttrs, itemTitleClassName, defineItemTheme, handleClickItem, renderIcon]);
140
+ }, [align, currentItems, isDisabled, showActiveStepContent, isHorizontalContent, defineItemTheme, handleClickItem, renderIcon, renderItem]);
141
+ var renderSingleItem = renderItem(_extends(_extends({}, currentItems[currentIndex]), {
142
+ isDisabled: isDisabled,
143
+ align: align,
144
+ view: STEPPER_ITEM_VIEW_ENUM.CONTENT
145
+ }));
133
146
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(rootAttrs), {
134
147
  className: cn([className, rootClassName], {
135
- 'is-horizontal': isHorizontal
148
+ 'is-horizontal': isHorizontalContent
136
149
  }),
137
150
  ref: rootRef
138
- }), renderItems);
151
+ }), /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(itemsWrapAttrs), {
152
+ className: cn('items-wrap', [itemsWrapClassName])
153
+ }), renderItems), showActiveStepContent && renderSingleItem);
139
154
  };
140
155
  export default Stepper;
@@ -1 +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(img/separator.png) 2 repeat;border-image:url(img/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(img/separator-vertical.png) 2 repeat;border-image:url(img/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}
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(img/separator-mobile.png) 2 round;border-image:url(img/separator-mobile.png) 2 round;border-left:none;border-radius:100px;border-top:2px solid transparent;height:2px;left:calc(50% + 22px);min-height:2px;position:absolute;top:19px;width:calc(100% - 32px)}@media screen and (min-width:768px){.mfui-stepper-item_is-horizontal .mfui-stepper-item__separator{-o-border-image:url(img/separator.png) 2 repeat;border-image:url(img/separator.png) 2 repeat}}@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:42px;right:0}@media screen and (min-width:1024px){.mfui-stepper-item_align_left .mfui-stepper-item__separator{left:auto}}.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(img/separator-vertical.png) 2 repeat;border-image:url(img/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}
@@ -5,6 +5,11 @@ export declare enum STEPPER_ITEM_THEME_ENUM {
5
5
  ACTIVE = "active",
6
6
  DEFAULT = "default"
7
7
  }
8
+ export declare enum STEPPER_ITEM_VIEW_ENUM {
9
+ ICON = "icon",
10
+ CONTENT = "content",
11
+ DEFAULT = "default"
12
+ }
8
13
  export interface IStepperItemProps {
9
14
  /** Дополнительный класс корневого элемента */
10
15
  className?: string;
@@ -35,6 +40,8 @@ export interface IStepperItemProps {
35
40
  isDisabled?: boolean;
36
41
  /** Выравнивание */
37
42
  align?: 'center' | 'left';
43
+ /** Варианты отображения */
44
+ view?: STEPPER_ITEM_VIEW_ENUM;
38
45
  /** Дополнительные data атрибуты к внутренним элементам */
39
46
  dataAttrs?: {
40
47
  root?: Record<string, string>;
@@ -10,6 +10,12 @@ export var STEPPER_ITEM_THEME_ENUM;
10
10
  STEPPER_ITEM_THEME_ENUM["ACTIVE"] = "active";
11
11
  STEPPER_ITEM_THEME_ENUM["DEFAULT"] = "default";
12
12
  })(STEPPER_ITEM_THEME_ENUM || (STEPPER_ITEM_THEME_ENUM = {}));
13
+ export var STEPPER_ITEM_VIEW_ENUM;
14
+ (function (STEPPER_ITEM_VIEW_ENUM) {
15
+ STEPPER_ITEM_VIEW_ENUM["ICON"] = "icon";
16
+ STEPPER_ITEM_VIEW_ENUM["CONTENT"] = "content";
17
+ STEPPER_ITEM_VIEW_ENUM["DEFAULT"] = "default";
18
+ })(STEPPER_ITEM_VIEW_ENUM || (STEPPER_ITEM_VIEW_ENUM = {}));
13
19
  var cn = cnCreate('mfui-stepper-item');
14
20
  var StepperItem = function StepperItem(_ref) {
15
21
  var className = _ref.className,
@@ -20,7 +26,7 @@ var StepperItem = function StepperItem(_ref) {
20
26
  textClassName = _ref$classes2.text,
21
27
  linkClassName = _ref$classes2.link,
22
28
  _ref$theme = _ref.theme,
23
- theme = _ref$theme === void 0 ? 'default' : _ref$theme,
29
+ theme = _ref$theme === void 0 ? STEPPER_ITEM_THEME_ENUM.DEFAULT : _ref$theme,
24
30
  title = _ref.title,
25
31
  text = _ref.text,
26
32
  linkText = _ref.linkText,
@@ -32,6 +38,8 @@ var StepperItem = function StepperItem(_ref) {
32
38
  isDisabled = _ref.isDisabled,
33
39
  _ref$align = _ref.align,
34
40
  align = _ref$align === void 0 ? 'center' : _ref$align,
41
+ _ref$view = _ref.view,
42
+ view = _ref$view === void 0 ? STEPPER_ITEM_VIEW_ENUM.DEFAULT : _ref$view,
35
43
  _ref$dataAttrs = _ref.dataAttrs,
36
44
  _ref$dataAttrs2 = _ref$dataAttrs === void 0 ? {} : _ref$dataAttrs,
37
45
  rootAttrs = _ref$dataAttrs2.root,
@@ -42,6 +50,8 @@ var StepperItem = function StepperItem(_ref) {
42
50
  onClick = _ref.onClick;
43
51
  var hasLink = !!linkText && !!linkUrl;
44
52
  var hasContent = !!title || !!text || hasLink;
53
+ var showContent = view !== STEPPER_ITEM_VIEW_ENUM.ICON && hasContent;
54
+ var showIcon = view !== STEPPER_ITEM_VIEW_ENUM.CONTENT;
45
55
  var renderContent = /*#__PURE__*/React.createElement("div", {
46
56
  className: cn('content')
47
57
  }, title && /*#__PURE__*/React.createElement(Header, {
@@ -69,11 +79,11 @@ var StepperItem = function StepperItem(_ref) {
69
79
  }, linkText));
70
80
  return /*#__PURE__*/React.createElement("div", _extends({}, filterDataAttrs(rootAttrs), {
71
81
  className: cn([className], {
72
- 'is-horizontal': isHorizontal,
73
82
  theme: theme,
74
- align: align
83
+ align: align,
84
+ 'is-horizontal': isHorizontal
75
85
  })
76
- }), /*#__PURE__*/React.createElement("div", {
86
+ }), showIcon && /*#__PURE__*/React.createElement("div", {
77
87
  className: cn('icon-button-area')
78
88
  }, /*#__PURE__*/React.createElement("button", _extends({}, filterDataAttrs(iconButtonAttrs), {
79
89
  className: cn('icon-button', [iconButtonClassName]),
@@ -84,6 +94,6 @@ var StepperItem = function StepperItem(_ref) {
84
94
  className: cn('icon')
85
95
  }, icon)), hasSeparator && /*#__PURE__*/React.createElement("span", {
86
96
  className: cn('separator')
87
- })), hasContent && renderContent);
97
+ })), showContent && renderContent);
88
98
  };
89
99
  export default StepperItem;
@@ -17,6 +17,8 @@ export { default as ButtonsBox } from './components/ButtonsBox/ButtonsBox';
17
17
  export { default as Card } from './components/Card/Card';
18
18
  export { default as CardsBox } from './components/CardsBox/CardsBox';
19
19
  export { default as CarouselBox } from './components/CarouselBox/CarouselBox';
20
+ export { default as ChipBox } from './components/ChipsBox/ChipBox';
21
+ export { default as ChipsBox } from './components/ChipsBox/ChipsBox';
20
22
  export { default as Container } from './components/Container/Container';
21
23
  export { default as DarkGradientCard } from './components/DarkGradientCards/components/DarkGradientCard';
22
24
  export { default as DarkGradientCards } from './components/DarkGradientCards/DarkGradientCards';
package/dist/es/index.js CHANGED
@@ -17,6 +17,8 @@ export { default as ButtonsBox } from "./components/ButtonsBox/ButtonsBox";
17
17
  export { default as Card } from "./components/Card/Card";
18
18
  export { default as CardsBox } from "./components/CardsBox/CardsBox";
19
19
  export { default as CarouselBox } from "./components/CarouselBox/CarouselBox";
20
+ export { default as ChipBox } from "./components/ChipsBox/ChipBox";
21
+ export { default as ChipsBox } from "./components/ChipsBox/ChipsBox";
20
22
  export { default as Container } from "./components/Container/Container";
21
23
  export { default as DarkGradientCard } from "./components/DarkGradientCards/components/DarkGradientCard";
22
24
  export { default as DarkGradientCards } from "./components/DarkGradientCards/DarkGradientCards";
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ import { Chip } from '@megafon/ui-core';
3
+ export type ChipBoxPropsType = Omit<React.ComponentProps<typeof Chip>, 'color' | 'checked'>;
4
+ declare const ChipBox: React.FC<ChipBoxPropsType>;
5
+ export default ChipBox;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var React = _interopRequireWildcard(require("react"));
9
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
11
+ /* eslint-disable react/no-unused-prop-types */
12
+
13
+ var ChipBox = function ChipBox(_ref) {
14
+ var children = _ref.children;
15
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
16
+ };
17
+ var _default = exports["default"] = ChipBox;
@@ -0,0 +1 @@
1
+ h1,h2,h3,h4,h5{margin:0}.mfui-chips-box__wrapper{display:-webkit-box;display:-ms-flexbox;display:flex;width:100%}.mfui-chips-box__panel{display:none}.mfui-chips-box__panel_current{display:block}
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { Chips } from '@megafon/ui-core';
3
+ import { ChipBoxPropsType } from './ChipBox';
4
+ import './ChipsBox.scss';
5
+ export type ChipsItemsPropsType = React.ComponentProps<typeof Chips>['items'];
6
+ export type ChipBoxChildrenType = Array<React.ReactElement<ChipBoxPropsType>>;
7
+ export type ChipsBoxPropsType = Omit<React.ComponentProps<typeof Chips>, 'items'> & {
8
+ /** Рендер содержимого только для текущего варианта */
9
+ renderOnlyCurrentPanel?: boolean;
10
+ /** Дочерние элементы */
11
+ children: ChipBoxChildrenType;
12
+ /** Ссылка на корневой элемент */
13
+ rootRef?: React.Ref<HTMLDivElement>;
14
+ };
15
+ declare const ChipsBox: React.FC<ChipsBoxPropsType>;
16
+ export default ChipsBox;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports["default"] = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ require("core-js/modules/es.symbol.js");
11
+ require("core-js/modules/es.array.filter.js");
12
+ require("core-js/modules/es.array.index-of.js");
13
+ require("core-js/modules/es.array.map.js");
14
+ require("core-js/modules/es.object.to-string.js");
15
+ require("core-js/modules/es.promise.js");
16
+ var React = _interopRequireWildcard(require("react"));
17
+ var _uiCore = require("@megafon/ui-core");
18
+ var _uiHelpers = require("@megafon/ui-helpers");
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
22
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
23
+ var t = {};
24
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
25
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
27
+ }
28
+ return t;
29
+ };
30
+ var cn = (0, _uiHelpers.cnCreate)('mfui-chips-box');
31
+ var ChipsBox = function ChipsBox(_a) {
32
+ var _b;
33
+ var _a$renderOnlyCurrentP = _a.renderOnlyCurrentPanel,
34
+ renderOnlyCurrentPanel = _a$renderOnlyCurrentP === void 0 ? false : _a$renderOnlyCurrentP,
35
+ _a$isScrollable = _a.isScrollable,
36
+ isScrollable = _a$isScrollable === void 0 ? true : _a$isScrollable,
37
+ rootRef = _a.rootRef,
38
+ children = _a.children,
39
+ value = _a.value,
40
+ onChange = _a.onChange,
41
+ chipsProps = __rest(_a, ["renderOnlyCurrentPanel", "isScrollable", "rootRef", "children", "value", "onChange"]);
42
+ var childArray = React.Children.toArray(children).filter(function (child) {
43
+ return /*#__PURE__*/React.isValidElement(child);
44
+ });
45
+ var chipsItems = childArray.map(function (child) {
46
+ return (0, _extends2["default"])((0, _extends2["default"])({}, child.props), {
47
+ children: null
48
+ });
49
+ });
50
+ var _React$useState = React.useState(value || ((_b = chipsItems[0]) === null || _b === void 0 ? void 0 : _b.id)),
51
+ _React$useState2 = (0, _slicedToArray2["default"])(_React$useState, 2),
52
+ currentId = _React$useState2[0],
53
+ setCurrentId = _React$useState2[1];
54
+ var panels = childArray.map(function (child) {
55
+ var props = child.props;
56
+ var id = props.id,
57
+ panel = props.children;
58
+ var isCurrentPanel = currentId === id;
59
+ if (!panel || renderOnlyCurrentPanel && !isCurrentPanel) {
60
+ return null;
61
+ }
62
+ return /*#__PURE__*/React.createElement("div", {
63
+ key: id,
64
+ className: cn('panel', {
65
+ current: isCurrentPanel
66
+ })
67
+ }, panel);
68
+ });
69
+ var handleChange = React.useCallback(function (id) {
70
+ setCurrentId(id);
71
+ onChange === null || onChange === void 0 ? void 0 : onChange(id);
72
+ }, [onChange]);
73
+ return /*#__PURE__*/React.createElement("div", {
74
+ ref: rootRef,
75
+ className: cn()
76
+ }, /*#__PURE__*/React.createElement("div", {
77
+ className: cn('wrapper')
78
+ }, /*#__PURE__*/React.createElement(_uiCore.Chips, (0, _extends2["default"])({}, chipsProps, {
79
+ value: currentId,
80
+ items: chipsItems,
81
+ isScrollable: isScrollable,
82
+ onChange: handleChange
83
+ }))), panels);
84
+ };
85
+ var _default = exports["default"] = ChipsBox;