@salutejs/plasma-new-hope 0.158.0-dev.0 → 0.159.0-canary.1443.11138999097.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. package/cjs/components/Steps/Steps.css +18 -0
  2. package/cjs/components/Steps/Steps.js +113 -0
  3. package/cjs/components/Steps/Steps.js.map +1 -0
  4. package/cjs/components/Steps/Steps.styles.js +9 -0
  5. package/cjs/components/Steps/Steps.styles.js.map +1 -0
  6. package/cjs/components/Steps/Steps.styles_vv31r6.css +1 -0
  7. package/cjs/components/Steps/Steps.tokens.js +82 -0
  8. package/cjs/components/Steps/Steps.tokens.js.map +1 -0
  9. package/cjs/components/Steps/ui/StepItem/StepItem.css +16 -0
  10. package/cjs/components/Steps/ui/StepItem/StepItem.js +114 -0
  11. package/cjs/components/Steps/ui/StepItem/StepItem.js.map +1 -0
  12. package/cjs/components/Steps/ui/StepItem/StepItem.styles.js +93 -0
  13. package/cjs/components/Steps/ui/StepItem/StepItem.styles.js.map +1 -0
  14. package/cjs/components/Steps/ui/StepItem/StepItem.styles_1y1xj5d.css +9 -0
  15. package/cjs/components/Steps/utils/getItemStatus.js +27 -0
  16. package/cjs/components/Steps/utils/getItemStatus.js.map +1 -0
  17. package/cjs/components/Steps/variations/_size/base.js +9 -0
  18. package/cjs/components/Steps/variations/_size/base.js.map +1 -0
  19. package/cjs/components/Steps/variations/_size/base_x642ct.css +1 -0
  20. package/cjs/components/Steps/variations/_view/base.js +9 -0
  21. package/cjs/components/Steps/variations/_view/base.js.map +1 -0
  22. package/cjs/components/Steps/variations/_view/base_x642ct.css +1 -0
  23. package/cjs/index.css +12 -0
  24. package/cjs/index.js +5 -0
  25. package/cjs/index.js.map +1 -1
  26. package/emotion/cjs/components/Steps/Steps.js +125 -0
  27. package/emotion/cjs/components/Steps/Steps.styles.js +9 -0
  28. package/emotion/cjs/components/Steps/Steps.template-doc.mdx +84 -0
  29. package/emotion/cjs/components/Steps/Steps.tokens.js +80 -0
  30. package/emotion/cjs/components/Steps/Steps.types.js +5 -0
  31. package/emotion/cjs/components/Steps/index.js +25 -0
  32. package/emotion/cjs/components/Steps/ui/StepItem/StepItem.js +124 -0
  33. package/emotion/cjs/components/Steps/ui/StepItem/StepItem.styles.js +61 -0
  34. package/emotion/cjs/components/Steps/ui/StepItem/StepItem.types.js +5 -0
  35. package/emotion/cjs/components/Steps/ui/StepItem/index.js +12 -0
  36. package/emotion/cjs/components/Steps/ui/index.js +16 -0
  37. package/emotion/cjs/components/Steps/utils/getItemStatus.js +26 -0
  38. package/emotion/cjs/components/Steps/variations/_size/base.js +8 -0
  39. package/emotion/cjs/components/Steps/variations/_size/tokens.json +1 -0
  40. package/emotion/cjs/components/Steps/variations/_view/base.js +8 -0
  41. package/emotion/cjs/components/Steps/variations/_view/tokens.json +1 -0
  42. package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.config.js +25 -0
  43. package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.js +11 -0
  44. package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.stories.tsx +181 -0
  45. package/emotion/cjs/examples/plasma_web/components/Steps/Steps.config.js +25 -0
  46. package/emotion/cjs/examples/plasma_web/components/Steps/Steps.js +11 -0
  47. package/emotion/cjs/examples/plasma_web/components/Steps/Steps.stories.tsx +181 -0
  48. package/emotion/cjs/index.js +11 -0
  49. package/emotion/es/components/Steps/Steps.js +116 -0
  50. package/emotion/es/components/Steps/Steps.styles.js +3 -0
  51. package/emotion/es/components/Steps/Steps.template-doc.mdx +84 -0
  52. package/emotion/es/components/Steps/Steps.tokens.js +74 -0
  53. package/emotion/es/components/Steps/Steps.types.js +1 -0
  54. package/emotion/es/components/Steps/index.js +2 -0
  55. package/emotion/es/components/Steps/ui/StepItem/StepItem.js +116 -0
  56. package/emotion/es/components/Steps/ui/StepItem/StepItem.styles.js +54 -0
  57. package/emotion/es/components/Steps/ui/StepItem/StepItem.types.js +1 -0
  58. package/emotion/es/components/Steps/ui/StepItem/index.js +1 -0
  59. package/emotion/es/components/Steps/ui/index.js +1 -0
  60. package/emotion/es/components/Steps/utils/getItemStatus.js +20 -0
  61. package/emotion/es/components/Steps/variations/_size/base.js +2 -0
  62. package/emotion/es/components/Steps/variations/_size/tokens.json +1 -0
  63. package/emotion/es/components/Steps/variations/_view/base.js +2 -0
  64. package/emotion/es/components/Steps/variations/_view/tokens.json +1 -0
  65. package/emotion/es/examples/plasma_b2c/components/Steps/Steps.config.js +19 -0
  66. package/emotion/es/examples/plasma_b2c/components/Steps/Steps.js +6 -0
  67. package/emotion/es/examples/plasma_b2c/components/Steps/Steps.stories.tsx +181 -0
  68. package/emotion/es/examples/plasma_web/components/Steps/Steps.config.js +19 -0
  69. package/emotion/es/examples/plasma_web/components/Steps/Steps.js +6 -0
  70. package/emotion/es/examples/plasma_web/components/Steps/Steps.stories.tsx +181 -0
  71. package/emotion/es/index.js +1 -0
  72. package/es/components/Steps/Steps.css +18 -0
  73. package/es/components/Steps/Steps.js +108 -0
  74. package/es/components/Steps/Steps.js.map +1 -0
  75. package/es/components/Steps/Steps.styles.js +5 -0
  76. package/es/components/Steps/Steps.styles.js.map +1 -0
  77. package/es/components/Steps/Steps.styles_vv31r6.css +1 -0
  78. package/es/components/Steps/Steps.tokens.js +77 -0
  79. package/es/components/Steps/Steps.tokens.js.map +1 -0
  80. package/es/components/Steps/ui/StepItem/StepItem.css +16 -0
  81. package/es/components/Steps/ui/StepItem/StepItem.js +110 -0
  82. package/es/components/Steps/ui/StepItem/StepItem.js.map +1 -0
  83. package/es/components/Steps/ui/StepItem/StepItem.styles.js +81 -0
  84. package/es/components/Steps/ui/StepItem/StepItem.styles.js.map +1 -0
  85. package/es/components/Steps/ui/StepItem/StepItem.styles_1y1xj5d.css +9 -0
  86. package/es/components/Steps/utils/getItemStatus.js +23 -0
  87. package/es/components/Steps/utils/getItemStatus.js.map +1 -0
  88. package/es/components/Steps/variations/_size/base.js +5 -0
  89. package/es/components/Steps/variations/_size/base.js.map +1 -0
  90. package/es/components/Steps/variations/_size/base_x642ct.css +1 -0
  91. package/es/components/Steps/variations/_view/base.js +5 -0
  92. package/es/components/Steps/variations/_view/base.js.map +1 -0
  93. package/es/components/Steps/variations/_view/base_x642ct.css +1 -0
  94. package/es/index.css +12 -0
  95. package/es/index.js +2 -0
  96. package/es/index.js.map +1 -1
  97. package/package.json +3 -2
  98. package/styled-components/cjs/components/Steps/Steps.js +125 -0
  99. package/styled-components/cjs/components/Steps/Steps.styles.js +9 -0
  100. package/styled-components/cjs/components/Steps/Steps.template-doc.mdx +84 -0
  101. package/styled-components/cjs/components/Steps/Steps.tokens.js +80 -0
  102. package/styled-components/cjs/components/Steps/Steps.types.js +5 -0
  103. package/styled-components/cjs/components/Steps/index.js +25 -0
  104. package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.js +124 -0
  105. package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.styles.js +52 -0
  106. package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.types.js +5 -0
  107. package/styled-components/cjs/components/Steps/ui/StepItem/index.js +12 -0
  108. package/styled-components/cjs/components/Steps/ui/index.js +16 -0
  109. package/styled-components/cjs/components/Steps/utils/getItemStatus.js +26 -0
  110. package/styled-components/cjs/components/Steps/variations/_size/base.js +8 -0
  111. package/styled-components/cjs/components/Steps/variations/_size/tokens.json +1 -0
  112. package/styled-components/cjs/components/Steps/variations/_view/base.js +8 -0
  113. package/styled-components/cjs/components/Steps/variations/_view/tokens.json +1 -0
  114. package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.config.js +25 -0
  115. package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.js +11 -0
  116. package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.stories.tsx +181 -0
  117. package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.config.js +25 -0
  118. package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.js +11 -0
  119. package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.stories.tsx +181 -0
  120. package/styled-components/cjs/index.js +11 -0
  121. package/styled-components/es/components/Steps/Steps.js +116 -0
  122. package/styled-components/es/components/Steps/Steps.styles.js +3 -0
  123. package/styled-components/es/components/Steps/Steps.template-doc.mdx +84 -0
  124. package/styled-components/es/components/Steps/Steps.tokens.js +74 -0
  125. package/styled-components/es/components/Steps/Steps.types.js +1 -0
  126. package/styled-components/es/components/Steps/index.js +2 -0
  127. package/styled-components/es/components/Steps/ui/StepItem/StepItem.js +116 -0
  128. package/styled-components/es/components/Steps/ui/StepItem/StepItem.styles.js +45 -0
  129. package/styled-components/es/components/Steps/ui/StepItem/StepItem.types.js +1 -0
  130. package/styled-components/es/components/Steps/ui/StepItem/index.js +1 -0
  131. package/styled-components/es/components/Steps/ui/index.js +1 -0
  132. package/styled-components/es/components/Steps/utils/getItemStatus.js +20 -0
  133. package/styled-components/es/components/Steps/variations/_size/base.js +2 -0
  134. package/styled-components/es/components/Steps/variations/_size/tokens.json +1 -0
  135. package/styled-components/es/components/Steps/variations/_view/base.js +2 -0
  136. package/styled-components/es/components/Steps/variations/_view/tokens.json +1 -0
  137. package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.config.js +19 -0
  138. package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.js +6 -0
  139. package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.stories.tsx +181 -0
  140. package/styled-components/es/examples/plasma_web/components/Steps/Steps.config.js +19 -0
  141. package/styled-components/es/examples/plasma_web/components/Steps/Steps.js +6 -0
  142. package/styled-components/es/examples/plasma_web/components/Steps/Steps.stories.tsx +181 -0
  143. package/styled-components/es/index.js +1 -0
  144. package/types/components/Steps/Steps.d.ts +21 -0
  145. package/types/components/Steps/Steps.d.ts.map +1 -0
  146. package/types/components/Steps/Steps.styles.d.ts +2 -0
  147. package/types/components/Steps/Steps.styles.d.ts.map +1 -0
  148. package/types/components/Steps/Steps.tokens.d.ts +75 -0
  149. package/types/components/Steps/Steps.tokens.d.ts.map +1 -0
  150. package/types/components/Steps/Steps.types.d.ts +63 -0
  151. package/types/components/Steps/Steps.types.d.ts.map +1 -0
  152. package/types/components/Steps/index.d.ts +4 -0
  153. package/types/components/Steps/index.d.ts.map +1 -0
  154. package/types/components/Steps/ui/StepItem/StepItem.d.ts +17 -0
  155. package/types/components/Steps/ui/StepItem/StepItem.d.ts.map +1 -0
  156. package/types/components/Steps/ui/StepItem/StepItem.styles.d.ts +32 -0
  157. package/types/components/Steps/ui/StepItem/StepItem.styles.d.ts.map +1 -0
  158. package/types/components/Steps/ui/StepItem/StepItem.types.d.ts +34 -0
  159. package/types/components/Steps/ui/StepItem/StepItem.types.d.ts.map +1 -0
  160. package/types/components/Steps/ui/StepItem/index.d.ts +3 -0
  161. package/types/components/Steps/ui/StepItem/index.d.ts.map +1 -0
  162. package/types/components/Steps/ui/index.d.ts +2 -0
  163. package/types/components/Steps/ui/index.d.ts.map +1 -0
  164. package/types/components/Steps/utils/getItemStatus.d.ts +9 -0
  165. package/types/components/Steps/utils/getItemStatus.d.ts.map +1 -0
  166. package/types/components/Steps/variations/_size/base.d.ts +2 -0
  167. package/types/components/Steps/variations/_size/base.d.ts.map +1 -0
  168. package/types/components/Steps/variations/_view/base.d.ts +2 -0
  169. package/types/components/Steps/variations/_view/base.d.ts.map +1 -0
  170. package/types/examples/plasma_b2c/components/Steps/Steps.config.d.ts +18 -0
  171. package/types/examples/plasma_b2c/components/Steps/Steps.config.d.ts.map +1 -0
  172. package/types/examples/plasma_b2c/components/Steps/Steps.d.ts +35 -0
  173. package/types/examples/plasma_b2c/components/Steps/Steps.d.ts.map +1 -0
  174. package/types/examples/plasma_web/components/Steps/Steps.config.d.ts +18 -0
  175. package/types/examples/plasma_web/components/Steps/Steps.config.d.ts.map +1 -0
  176. package/types/examples/plasma_web/components/Steps/Steps.d.ts +35 -0
  177. package/types/examples/plasma_web/components/Steps/Steps.d.ts.map +1 -0
  178. package/types/index.d.ts +1 -0
  179. package/types/index.d.ts.map +1 -1
@@ -0,0 +1,84 @@
1
+ ---
2
+ id: steps
3
+ title: Steps
4
+ ---
5
+
6
+ import { PropsTable, Description } from '@site/src/components';
7
+
8
+ # Steps
9
+
10
+ <Description name="Steps" />
11
+ <PropsTable name="Steps" />
12
+
13
+ ## Вариант использования с управлением текущим элементом из вне
14
+
15
+ ```tsx live
16
+ import React, { useState } from 'react';
17
+ import { Steps, Button } from '@salutejs/{{ package }}';
18
+
19
+ export function App() {
20
+ const items = [{
21
+ indicator: 1,
22
+ }, {
23
+ indicator: 2,
24
+ }, {
25
+ indicator: 3,
26
+ }];
27
+
28
+ const [current, setCurrent] = useState<number>(0);
29
+ const onClick = () => setCurrent(() => current + 1);
30
+
31
+ return (
32
+ <section>
33
+ <Steps items={items}
34
+ current={current}
35
+ />
36
+ <br />
37
+ <Button view="secondary" onClick={onClick}>
38
+ Next
39
+ </Button>
40
+ </section>
41
+ );
42
+ }
43
+ ```
44
+
45
+ ## Вариант более гибкого использования через onChange и status в items
46
+
47
+ ```tsx live
48
+ import React, { useState } from 'react';
49
+ import { Steps, StepItemProps } from '@salutejs/{{ package }}';
50
+
51
+ export function App() {
52
+ const initialItems = [{
53
+ indicator: 1,
54
+ title: 'Title',
55
+ content: 'Content',
56
+ }, {
57
+ indicator: 2,
58
+ title: 'Title',
59
+ content: 'Content',
60
+ }, {
61
+ indicator: 3,
62
+ title: 'Title',
63
+ content: 'Content',
64
+ }];
65
+
66
+ const [items, setItems] = useState(initialItems);
67
+
68
+ const onChange = (item: StepItemProps, index: number, prevIndex: number) => {
69
+ if (prevIndex !== undefined) {
70
+ items[prevIndex].status = 'completed';
71
+ }
72
+
73
+ items[index].status = 'active';
74
+
75
+ setItems([...items]);
76
+ };
77
+
78
+ return (
79
+ <section>
80
+ <Steps items={items} onChange={onChange} />
81
+ </section>
82
+ );
83
+ }
84
+ ```
@@ -0,0 +1,74 @@
1
+ export var classes = {
2
+ simple: 'simple',
3
+ centered: 'item-centered',
4
+ active: 'item-active',
5
+ inactive: 'item-inactive',
6
+ clickable: 'item-clickable',
7
+ hovered: 'item-hovered',
8
+ disabled: 'item-disabled',
9
+ verticalOrientation: 'vertical-orientation',
10
+ hasIndicator: 'item-has-indicator',
11
+ activeItem: 'item-active',
12
+ indentDivider: 'indent-divider',
13
+ transparentDivider: 'transparent-divider'
14
+ };
15
+ export var tokens = {
16
+ indicatorSize: '--plasma-step-item-indicator-size',
17
+ activeIndicatorSize: '--plasma-step-item-active-indicator-size',
18
+ bulletSize: '--plasma-step-item-bullet-size',
19
+ activeBulletSize: '--plasma-step-item-active-bullet-size',
20
+ titlePaddingTop: '--plasma-step-item-title-padding-top',
21
+ contentPaddingTop: '--plasma-step-item-content-padding-top',
22
+ contentPaddingRight: '--plasma-step-item-content-padding-right',
23
+ contentSidePadding: '--plasma-step-item-content-side-padding',
24
+ contentVerticalPadding: '--plasma-step-item-content-vertical-padding',
25
+ verticalContentPaddingLeft: '--plasma-step-item-vertical-content-padding-left',
26
+ smallIndicatorIndentHeight: '--plasma-step-item-s-indicator-intent-height',
27
+ largeIndicatorIndentHeight: '--plasma-step-item-l-indicator-intent-height',
28
+ smallBulletIndentHeight: '--plasma-step-item-s-bullet-intent-height',
29
+ largeBulletIndentHeight: '--plasma-step-item-l-bullet-intent-height',
30
+ titleFontFamily: '--plasma-step-item-title-font-family',
31
+ titleFontSize: '--plasma-step-item-title-font-size',
32
+ titleFontStyle: '--plasma-step-item-title-font-style',
33
+ titleFontWeight: '--plasma-step-item-title-font-weight',
34
+ titleLetterSpacing: '--plasma-step-item-title-letter-spacing',
35
+ titleLineHeight: '--plasma-step-item-title-line-height',
36
+ contentFontFamily: '--plasma-step-item-content-font-family',
37
+ contentFontSize: '--plasma-step-item-content-font-size',
38
+ contentFontStyle: '--plasma-step-item-content-font-style',
39
+ contentFontWeight: '--plasma-step-item-content-font-weight',
40
+ contentLetterSpacing: '--plasma-step-item-content-letter-spacing',
41
+ contentLineHeight: '--plasma-step-item-content-line-height',
42
+ indicatorFontFamily: '--plasma-step-item-indicator-font-family',
43
+ indicatorFontSize: '--plasma-step-item-indicator-font-size',
44
+ indicatorFontStyle: '--plasma-step-item-indicator-font-style',
45
+ indicatorFontWeight: '--plasma-step-item-indicator-font-weight',
46
+ indicatorLetterSpacing: '--plasma-step-item-indicator-letter-spacing',
47
+ indicatorLineHeight: '--plasma-step-item-indicator-line-height',
48
+ activeIndicatorFontFamily: '--plasma-step-item-active-indicator-font-family',
49
+ activeIndicatorFontSize: '--plasma-step-item-active-indicator-font-size',
50
+ activeIndicatorFontStyle: '--plasma-step-item-active-indicator-font-style',
51
+ activeIndicatorFontWeight: '--plasma-step-item-active-indicator-font-weight',
52
+ activeIndicatorLetterSpacing: '--plasma-step-item-active-indicator-letter-spacing',
53
+ activeIndicatorLineHeight: '--plasma-step-item-active-indicator-line-height',
54
+ activeTitleColor: '--plasma-step-item-active-title-color',
55
+ activeTitleColorHover: '--plasma-step-item-active-title-color-hover',
56
+ inactiveTitleColor: '--plasma-step-item-inactive-title-color',
57
+ inactiveTitleColorHover: '--plasma-step-item-inactive-title-color-hover',
58
+ contentColor: '--plasma-step-item-content-color',
59
+ activeIndicatorBorder: '--plasma-step-item-active-indicator-border',
60
+ activeIndicatorBorderHover: '--plasma-step-item-active-indicator-border-hover',
61
+ activeIndicatorColor: '--plasma-step-item-active-indicator-color',
62
+ activeIndicatorColorHover: '--plasma-step-item-active-indicator-color-hover',
63
+ activeIndicatorBackground: '--plasma-step-item-active-indicator-background',
64
+ completedIndicatorColor: '--plasma-step-item-completed-indicator-color',
65
+ completedIndicatorColorHover: '--plasma-step-item-completed-indicator-color-hover',
66
+ completedIndicatorBackground: '--plasma-step-item-completed-indicator-background',
67
+ completedIndicatorBackgroundHover: '--plasma-step-item-completed-indicator-background-hover',
68
+ inactiveIndicatorColor: '--plasma-step-item-inactive-indicator-color',
69
+ inactiveIndicatorColorHover: '--plasma-step-item-inactive-indicator-color-hover',
70
+ inactiveIndicatorBackground: '--plasma-step-item-inactive-indicator-background',
71
+ inactiveIndicatorBackgroundHover: '--plasma-step-item-inactive-indicator-background-hover',
72
+ disabledOpacity: '--plasma-step-item-disabled-opacity',
73
+ dividerThickness: '--plasma-step-item-divider-thickness'
74
+ };
@@ -0,0 +1,2 @@
1
+ export { stepsConfig, stepsRoot } from './Steps';
2
+ export { tokens as stepsTokens } from './Steps.tokens';
@@ -0,0 +1,116 @@
1
+ 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); }
2
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import React, { useState, useEffect } from 'react';
12
+ import cls from 'classnames';
13
+ import { classes, tokens } from '../../Steps.tokens';
14
+ import { Bullet, BulletIndicator, BulletIndicatorWrapper, StepItemContent, StepItemContentWrapper, StepItemDivider, StepItemStyled, StepItemTitle, SpinnerStyled } from './StepItem.styles';
15
+
16
+ // todo попробовать заменить через baseline выравнивание
17
+ var indicatorSizesIndentsMap = {
18
+ 8: /*#__PURE__*/"var(".concat(tokens.smallBulletIndentHeight, ")"),
19
+ 16: /*#__PURE__*/"var(".concat(tokens.largeBulletIndentHeight, ")"),
20
+ 24: /*#__PURE__*/"var(".concat(tokens.smallIndicatorIndentHeight, ")"),
21
+ 36: /*#__PURE__*/"var(".concat(tokens.largeIndicatorIndentHeight, ")")
22
+ };
23
+ export var StepItem = function StepItem(_ref) {
24
+ var index = _ref.index,
25
+ title = _ref.title,
26
+ content = _ref.content,
27
+ indicator = _ref.indicator,
28
+ _ref$status = _ref.status,
29
+ status = _ref$status === void 0 ? 'inactive' : _ref$status,
30
+ size = _ref.size,
31
+ orientation = _ref.orientation,
32
+ contentAlign = _ref.contentAlign,
33
+ hasLine = _ref.hasLine,
34
+ hasLoader = _ref.hasLoader,
35
+ onClick = _ref.onClick,
36
+ items = _ref.items;
37
+ var _useState = useState(false),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ isHovered = _useState2[0],
40
+ setIsHovered = _useState2[1];
41
+ var isFirst = index === 0;
42
+ var isLast = index === items.length - 1;
43
+ var prevItem = items[index - 1];
44
+ var nextItem = items[index + 1];
45
+ var isActive = status === 'active';
46
+ var isInactive = status === 'inactive';
47
+ var isPrevInactive = prevItem && !(prevItem !== null && prevItem !== void 0 && prevItem.status) || (prevItem === null || prevItem === void 0 ? void 0 : prevItem.status) === 'inactive';
48
+ var isNextInactive = !(nextItem !== null && nextItem !== void 0 && nextItem.status) || (nextItem === null || nextItem === void 0 ? void 0 : nextItem.status) === 'inactive';
49
+ var hasIndicator = indicator != null;
50
+ var BulletNode = hasIndicator ? BulletIndicator : Bullet;
51
+ var item = items[index];
52
+ var isSimple = !title && !content;
53
+ var clickable = Boolean(onClick);
54
+ var isVertical = orientation === 'vertical';
55
+ var isCentered = contentAlign === 'center';
56
+ var isDisabled = item.disabled;
57
+ var onClickHandler = onClick && !isDisabled ? function () {
58
+ return onClick(item, index);
59
+ } : undefined;
60
+ var resultIndicatorSize;
61
+ if (hasIndicator) {
62
+ resultIndicatorSize = isActive ? 36 : 24;
63
+ } else {
64
+ resultIndicatorSize = isActive ? 16 : 8;
65
+ }
66
+ var indentToken = indicatorSizesIndentsMap[resultIndicatorSize];
67
+ var onMouseOver = clickable && !isDisabled ? function () {
68
+ if (isDisabled) {
69
+ setIsHovered(false);
70
+ }
71
+ setIsHovered(true);
72
+ } : undefined;
73
+ var onMouseOut = clickable && !isDisabled ? function () {
74
+ setIsHovered(false);
75
+ } : undefined;
76
+ useEffect(function () {
77
+ if (isDisabled) {
78
+ setIsHovered(false);
79
+ }
80
+ }, [isDisabled]);
81
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StepItemStyled, {
82
+ className: cls(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, classes.simple, isSimple), classes.active, isActive), classes.hovered, isHovered && !isActive), classes.inactive, isInactive), classes.centered, isCentered), classes.disabled, isDisabled), classes.clickable, clickable && !isActive), classes.hasIndicator, hasIndicator), classes.verticalOrientation, isVertical))
83
+ }, /*#__PURE__*/React.createElement(BulletIndicatorWrapper, {
84
+ className: cls(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, classes.verticalOrientation, isVertical), classes.centered, isCentered), classes.simple, isSimple), classes.hasIndicator, hasIndicator)),
85
+ onClick: onClickHandler,
86
+ onFocus: onMouseOver,
87
+ onBlur: onMouseOut,
88
+ onMouseOver: onMouseOver,
89
+ onMouseOut: onMouseOut
90
+ }, contentAlign === 'center' && !isSimple && /*#__PURE__*/React.createElement(StepItemDivider, {
91
+ className: cls(_defineProperty(_defineProperty(_defineProperty({}, classes.simple, isSimple), classes.transparentDivider, !hasLine || isFirst), classes.inactive, isInactive || isPrevInactive))
92
+ }), isVertical && (isSimple ? !isFirst : true) && /*#__PURE__*/React.createElement(StepItemDivider, {
93
+ className: cls(classes.indentDivider, _defineProperty(_defineProperty(_defineProperty({}, classes.simple, isSimple), classes.transparentDivider, !hasLine || isFirst), classes.inactive, isInactive || isPrevInactive)),
94
+ indentToken: indentToken
95
+ }), hasLoader && /*#__PURE__*/React.createElement(SpinnerStyled, {
96
+ hasIndicator: hasIndicator
97
+ }), !hasLoader && /*#__PURE__*/React.createElement(BulletNode, {
98
+ className: cls(_defineProperty(_defineProperty({}, classes.active, isActive), classes.inactive, isInactive))
99
+ }, typeof indicator === 'function' && indicator({
100
+ status: status,
101
+ item: item,
102
+ size: size
103
+ }), typeof indicator !== 'function' && indicator), !isSimple && /*#__PURE__*/React.createElement(StepItemDivider, {
104
+ className: cls(_defineProperty(_defineProperty(_defineProperty({}, classes.simple, isSimple), classes.transparentDivider, !hasLine || isLast), classes.inactive, isInactive || isNextInactive))
105
+ })), !isSimple && /*#__PURE__*/React.createElement(StepItemContentWrapper, {
106
+ className: cls(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, classes.verticalOrientation, isVertical), classes.centered, isCentered), classes.active, isActive), classes.hasIndicator, hasIndicator))
107
+ }, /*#__PURE__*/React.createElement(StepItemTitle, {
108
+ onClick: onClickHandler,
109
+ onFocus: onMouseOver,
110
+ onBlur: onMouseOut,
111
+ onMouseOver: onMouseOver,
112
+ onMouseOut: onMouseOut
113
+ }, title), content && /*#__PURE__*/React.createElement(StepItemContent, null, typeof content === 'function' && content(status, index, items), typeof content !== 'function' && content))), isSimple && !isLast && /*#__PURE__*/React.createElement(StepItemDivider, {
114
+ className: cls(classes.simple, _defineProperty(_defineProperty(_defineProperty({}, classes.verticalOrientation, isVertical), classes.transparentDivider, !hasLine), classes.inactive, isInactive || isNextInactive))
115
+ }));
116
+ };
@@ -0,0 +1,45 @@
1
+ import styled from 'styled-components';
2
+ import { classes, tokens } from '../../Steps.tokens';
3
+ import { component, mergeConfig } from '../../../../engines';
4
+ import { spinnerConfig, spinnerTokens } from '../../../Spinner';
5
+ var mergedConfig = /*#__PURE__*/mergeConfig(spinnerConfig);
6
+ var Spinner = /*#__PURE__*/component(mergedConfig);
7
+ export var SpinnerStyled = /*#__PURE__*/styled(Spinner).withConfig({
8
+ componentId: "plasma-new-hope__sc-bjma6z-0"
9
+ })(["", ":", ";", ":var(", ");"], spinnerTokens.size, function (_ref) {
10
+ var hasIndicator = _ref.hasIndicator;
11
+ return hasIndicator ? "var(".concat(tokens.activeIndicatorSize, ")") : "var(".concat(tokens.activeBulletSize, ")");
12
+ }, spinnerTokens.color, tokens.activeIndicatorColor);
13
+ export var StepItemTitle = /*#__PURE__*/styled.div.withConfig({
14
+ componentId: "plasma-new-hope__sc-bjma6z-1"
15
+ })(["padding-top:var(", ");padding-right:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");word-break:break-word;"], tokens.titlePaddingTop, tokens.contentSidePadding, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight);
16
+ export var StepItemContent = /*#__PURE__*/styled.div.withConfig({
17
+ componentId: "plasma-new-hope__sc-bjma6z-2"
18
+ })(["padding-top:var(", ");padding-right:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");word-break:break-word;color:var(", ");"], tokens.contentPaddingTop, tokens.contentSidePadding, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight, tokens.contentColor);
19
+ export var BulletIndicatorWrapper = /*#__PURE__*/styled.div.withConfig({
20
+ componentId: "plasma-new-hope__sc-bjma6z-3"
21
+ })(["display:flex;align-items:center;&:not(.", "){flex:0;&.", "{width:100%;min-height:var(", ");}&:not(.", "){width:100%;min-height:var(", ");}&.", "{padding-right:var(", ");}}&.", "{flex-direction:column;align-items:center;justify-content:center;min-height:100%;&.", "{min-width:var(", ");}&:not(.", "){min-width:var(", ");}}&.", "{justify-content:center;}"], classes.simple, classes.hasIndicator, tokens.activeIndicatorSize, classes.hasIndicator, tokens.activeBulletSize, classes.verticalOrientation, tokens.verticalContentPaddingLeft, classes.verticalOrientation, classes.hasIndicator, tokens.activeIndicatorSize, classes.hasIndicator, tokens.activeBulletSize, classes.centered);
22
+ export var BulletIndicator = /*#__PURE__*/styled.div.withConfig({
23
+ componentId: "plasma-new-hope__sc-bjma6z-4"
24
+ })(["display:flex;align-items:center;justify-content:center;width:var(", ");height:var(", ");border-radius:50%;box-sizing:border-box;position:relative;color:var(", ");background-color:var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");&.", "{width:var(", ");height:var(", ");border:var(", ") var(", ");font-family:var(", ");font-size:var(", ");font-style:var(", ");font-weight:var(", ");letter-spacing:var(", ");line-height:var(", ");color:var(", ");background:var(", ");}&.", "{color:var(", ");background:var(", ");&:before,&:after{background:var(", ");}}"], tokens.indicatorSize, tokens.indicatorSize, tokens.completedIndicatorColor, tokens.completedIndicatorBackground, tokens.indicatorFontFamily, tokens.indicatorFontSize, tokens.indicatorFontStyle, tokens.indicatorFontWeight, tokens.indicatorLetterSpacing, tokens.indicatorLineHeight, classes.active, tokens.activeIndicatorSize, tokens.activeIndicatorSize, tokens.dividerThickness, tokens.activeIndicatorBorder, tokens.activeIndicatorFontFamily, tokens.activeIndicatorFontSize, tokens.activeIndicatorFontStyle, tokens.activeIndicatorFontWeight, tokens.activeIndicatorLetterSpacing, tokens.activeIndicatorLineHeight, tokens.activeIndicatorColor, tokens.activeIndicatorBackground, classes.inactive, tokens.inactiveIndicatorColor, tokens.inactiveIndicatorBackground, tokens.inactiveIndicatorBackground);
25
+ export var Bullet = /*#__PURE__*/styled(BulletIndicator).withConfig({
26
+ componentId: "plasma-new-hope__sc-bjma6z-5"
27
+ })(["width:var(", ");height:var(", ");&.", "{width:var(", ");height:var(", ");border:var(", ") var(", ");background-color:var(", ");}"], tokens.bulletSize, tokens.bulletSize, classes.active, tokens.activeBulletSize, tokens.activeBulletSize, tokens.dividerThickness, tokens.activeIndicatorBorder, tokens.activeIndicatorBackground);
28
+ export var StepItemDivider = /*#__PURE__*/styled.div.withConfig({
29
+ componentId: "plasma-new-hope__sc-bjma6z-6"
30
+ })(["width:100%;height:var(", ");flex:1;background-color:var(", ");&.", "{background-color:var(", ");}&.", "{background-color:transparent;}&.", "{width:var(", ");height:100%;}&.", "{height:", ";min-height:", ";max-height:", ";&.", "{height:auto;max-height:none;}}"], tokens.dividerThickness, tokens.activeIndicatorColor, classes.inactive, tokens.inactiveIndicatorBackground, classes.transparentDivider, classes.verticalOrientation, tokens.dividerThickness, classes.indentDivider, function (_ref2) {
31
+ var indentToken = _ref2.indentToken;
32
+ return indentToken || '';
33
+ }, function (_ref3) {
34
+ var indentToken = _ref3.indentToken;
35
+ return indentToken || '';
36
+ }, function (_ref4) {
37
+ var indentToken = _ref4.indentToken;
38
+ return indentToken || '';
39
+ }, classes.simple);
40
+ export var StepItemContentWrapper = /*#__PURE__*/styled.div.withConfig({
41
+ componentId: "plasma-new-hope__sc-bjma6z-7"
42
+ })(["&.", "{", "{padding-top:var(", ");padding-right:0;}", "{padding-top:var(", ");padding-bottom:var(", ");padding-right:0;}}"], classes.verticalOrientation, StepItemTitle, tokens.contentVerticalPadding, StepItemContent, tokens.contentVerticalPadding, tokens.contentVerticalPadding);
43
+ export var StepItemStyled = /*#__PURE__*/styled.div.withConfig({
44
+ componentId: "plasma-new-hope__sc-bjma6z-8"
45
+ })(["display:flex;flex-direction:column;align-items:flex-start;&.", "{flex-direction:row;align-items:stretch;", "{width:var(", ");height:100%;}}&.", "{", "{color:var(", ");}}&.", "{", "{color:var(", ");}}&.", "{&:not(.", "){", "{cursor:pointer;color:var(", ");}", ",", "{color:var(", ");background:var(", ");}}&.", "{", "{color:var(", ");}", ",", "{color:var(", ");background:var(", ");}}", "{cursor:pointer;}}&.", "{align-items:center;", "{display:flex;flex-direction:column;align-items:center;padding-left:calc(var(", ") / 2);padding-right:calc(var(", ") / 2);", "{width:100%;}", ",", "{padding-right:0;text-align:center;}}}&.", "{opacity:var(", ");}"], classes.verticalOrientation, StepItemDivider, tokens.dividerThickness, classes.active, StepItemTitle, tokens.activeTitleColor, classes.inactive, StepItemTitle, tokens.inactiveTitleColor, classes.hovered, classes.active, StepItemTitle, tokens.activeTitleColorHover, BulletIndicator, Bullet, tokens.completedIndicatorColorHover, tokens.completedIndicatorBackgroundHover, classes.inactive, StepItemTitle, tokens.inactiveTitleColorHover, BulletIndicator, Bullet, tokens.inactiveIndicatorColorHover, tokens.inactiveIndicatorBackgroundHover, BulletIndicatorWrapper, classes.centered, StepItemContentWrapper, tokens.contentSidePadding, tokens.contentSidePadding, StepItemTitle, StepItemTitle, StepItemContent, classes.disabled, tokens.disabledOpacity);
@@ -0,0 +1 @@
1
+ export { StepItem } from './StepItem';
@@ -0,0 +1 @@
1
+ export * from './StepItem';
@@ -0,0 +1,20 @@
1
+ export var getItemStatus = function getItemStatus(_ref) {
2
+ var isUncontrolled = _ref.isUncontrolled,
3
+ current = _ref.current,
4
+ status = _ref.status,
5
+ index = _ref.index,
6
+ item = _ref.item;
7
+ if (item.disabled) {
8
+ return 'inactive';
9
+ }
10
+ if (!isUncontrolled) {
11
+ return status || item.status || 'inactive';
12
+ }
13
+ if (current > index) {
14
+ return 'completed';
15
+ }
16
+ if (current === index) {
17
+ return status || 'active';
18
+ }
19
+ return 'inactive';
20
+ };
@@ -0,0 +1,2 @@
1
+ import { css } from 'styled-components';
2
+ export var base = /*#__PURE__*/css([""]);
@@ -0,0 +1,2 @@
1
+ import { css } from 'styled-components';
2
+ export var base = /*#__PURE__*/css([""]);
@@ -0,0 +1,19 @@
1
+ import { css } from 'styled-components';
2
+ import { stepsTokens as tokens } from '../../../../components/Steps';
3
+ export var config = {
4
+ defaults: {
5
+ size: 'm',
6
+ view: 'default'
7
+ },
8
+ variations: {
9
+ view: {
10
+ "default": /*#__PURE__*/css(["", ":var(--text-primary);", ":var(--text-primary-hover);", ":solid var(--surface-solid-default);", ":var(--text-primary);", ":var(--surface-clear);", ":var(--inverse-text-primary);", ":var(--inverse-text-primary-hover);", ":var(--surface-solid-default);", ":var(--surface-solid-default-hover);", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":var(--text-secondary);", ":var(--text-secondary-hover);", ":var(--surface-transparent-secondary);", ":var(--surface-transparent-secondary-hover);", ":var(--text-secondary);", ":0.4;"], tokens.activeTitleColor, tokens.activeTitleColorHover, tokens.activeIndicatorBorder, tokens.activeIndicatorColor, tokens.activeIndicatorBackground, tokens.completedIndicatorColor, tokens.completedIndicatorColorHover, tokens.completedIndicatorBackground, tokens.completedIndicatorBackgroundHover, tokens.inactiveTitleColor, tokens.inactiveTitleColorHover, tokens.inactiveIndicatorColor, tokens.inactiveIndicatorColorHover, tokens.inactiveIndicatorBackground, tokens.inactiveIndicatorBackgroundHover, tokens.contentColor, tokens.disabledOpacity)
11
+ },
12
+ size: {
13
+ l: /*#__PURE__*/css(["", ":1.5rem;", ":2.25rem;", ":0.5rem;", ":1rem;", ":0.75rem;", ":0.375rem;", ":2rem;", ":1.0625rem;", ":0.75rem;", ":1rem;", ":0.625rem;", ":1.5rem;", ":1.25rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-l-font-family);", ":var(--plasma-typo-body-l-font-size);", ":var(--plasma-typo-body-l-font-style);", ":var(--plasma-typo-body-l-font-weight);", ":var(--plasma-typo-body-l-letter-spacing);", ":var(--plasma-typo-body-l-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":0.125rem;"], tokens.indicatorSize, tokens.activeIndicatorSize, tokens.bulletSize, tokens.activeBulletSize, tokens.titlePaddingTop, tokens.contentPaddingTop, tokens.contentSidePadding, tokens.contentVerticalPadding, tokens.verticalContentPaddingLeft, tokens.smallIndicatorIndentHeight, tokens.largeIndicatorIndentHeight, tokens.smallBulletIndentHeight, tokens.largeBulletIndentHeight, tokens.indicatorFontFamily, tokens.indicatorFontSize, tokens.indicatorFontStyle, tokens.indicatorFontWeight, tokens.indicatorLetterSpacing, tokens.indicatorLineHeight, tokens.activeIndicatorFontFamily, tokens.activeIndicatorFontSize, tokens.activeIndicatorFontStyle, tokens.activeIndicatorFontWeight, tokens.activeIndicatorLetterSpacing, tokens.activeIndicatorLineHeight, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight, tokens.dividerThickness),
14
+ m: /*#__PURE__*/css(["", ":1.5rem;", ":2.25rem;", ":0.5rem;", ":1rem;", ":0.625rem;", ":0.375rem;", ":1.75rem;", ":0.875rem;", ":0.75rem;", ":0.75rem;", ":0.4375rem;", ":1.25rem;", ":1.125rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-m-font-family);", ":var(--plasma-typo-body-m-font-size);", ":var(--plasma-typo-body-m-font-style);", ":var(--plasma-typo-body-m-font-weight);", ":var(--plasma-typo-body-m-letter-spacing);", ":var(--plasma-typo-body-m-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":0.125rem;"], tokens.indicatorSize, tokens.activeIndicatorSize, tokens.bulletSize, tokens.activeBulletSize, tokens.titlePaddingTop, tokens.contentPaddingTop, tokens.contentSidePadding, tokens.contentVerticalPadding, tokens.verticalContentPaddingLeft, tokens.smallIndicatorIndentHeight, tokens.largeIndicatorIndentHeight, tokens.smallBulletIndentHeight, tokens.largeBulletIndentHeight, tokens.indicatorFontFamily, tokens.indicatorFontSize, tokens.indicatorFontStyle, tokens.indicatorFontWeight, tokens.indicatorLetterSpacing, tokens.indicatorLineHeight, tokens.activeIndicatorFontFamily, tokens.activeIndicatorFontSize, tokens.activeIndicatorFontStyle, tokens.activeIndicatorFontWeight, tokens.activeIndicatorLetterSpacing, tokens.activeIndicatorLineHeight, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight, tokens.dividerThickness),
15
+ s: /*#__PURE__*/css(["", ":1.5rem;", ":1.5rem;", ":0.5rem;", ":1rem;", ":0.5rem;", ":0.375rem;", ":1.5rem;", ":0.6875rem;", ":0.75rem;", ":0.5rem;", ":0.5rem;", ":1rem;", ":0.75rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-s-font-family);", ":var(--plasma-typo-body-s-font-size);", ":var(--plasma-typo-body-s-font-style);", ":var(--plasma-typo-body-s-font-weight);", ":var(--plasma-typo-body-s-letter-spacing);", ":var(--plasma-typo-body-s-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.125rem;"], tokens.indicatorSize, tokens.activeIndicatorSize, tokens.bulletSize, tokens.activeBulletSize, tokens.titlePaddingTop, tokens.contentPaddingTop, tokens.contentSidePadding, tokens.contentVerticalPadding, tokens.verticalContentPaddingLeft, tokens.smallIndicatorIndentHeight, tokens.largeIndicatorIndentHeight, tokens.smallBulletIndentHeight, tokens.largeBulletIndentHeight, tokens.indicatorFontFamily, tokens.indicatorFontSize, tokens.indicatorFontStyle, tokens.indicatorFontWeight, tokens.indicatorLetterSpacing, tokens.indicatorLineHeight, tokens.activeIndicatorFontFamily, tokens.activeIndicatorFontSize, tokens.activeIndicatorFontStyle, tokens.activeIndicatorFontWeight, tokens.activeIndicatorLetterSpacing, tokens.activeIndicatorLineHeight, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight, tokens.dividerThickness),
16
+ xs: /*#__PURE__*/css(["", ":1.5rem;", ":1.5rem;", ":0.5rem;", ":1rem;", ":0.5rem;", ":0.25rem;", ":1.5rem;", ":0.5625rem;", ":0.75rem;", ":0.25rem;", ":0.25rem;", ":0.75rem;", ":0.5rem;", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":var(--plasma-typo-body-xs-font-family);", ":var(--plasma-typo-body-xs-font-size);", ":var(--plasma-typo-body-xs-font-style);", ":var(--plasma-typo-body-xs-font-weight);", ":var(--plasma-typo-body-xs-letter-spacing);", ":var(--plasma-typo-body-xs-line-height);", ":0.125rem;"], tokens.indicatorSize, tokens.activeIndicatorSize, tokens.bulletSize, tokens.activeBulletSize, tokens.titlePaddingTop, tokens.contentPaddingTop, tokens.contentSidePadding, tokens.contentVerticalPadding, tokens.verticalContentPaddingLeft, tokens.smallIndicatorIndentHeight, tokens.largeIndicatorIndentHeight, tokens.smallBulletIndentHeight, tokens.largeBulletIndentHeight, tokens.indicatorFontFamily, tokens.indicatorFontSize, tokens.indicatorFontStyle, tokens.indicatorFontWeight, tokens.indicatorLetterSpacing, tokens.indicatorLineHeight, tokens.activeIndicatorFontFamily, tokens.activeIndicatorFontSize, tokens.activeIndicatorFontStyle, tokens.activeIndicatorFontWeight, tokens.activeIndicatorLetterSpacing, tokens.activeIndicatorLineHeight, tokens.titleFontFamily, tokens.titleFontSize, tokens.titleFontStyle, tokens.titleFontWeight, tokens.titleLetterSpacing, tokens.titleLineHeight, tokens.contentFontFamily, tokens.contentFontSize, tokens.contentFontStyle, tokens.contentFontWeight, tokens.contentLetterSpacing, tokens.contentLineHeight, tokens.dividerThickness)
17
+ }
18
+ }
19
+ };
@@ -0,0 +1,6 @@
1
+ import { stepsConfig } from '../../../../components/Steps';
2
+ import { component, mergeConfig } from '../../../../engines';
3
+ import { config } from './Steps.config';
4
+ var mergedConfig = /*#__PURE__*/mergeConfig(stepsConfig, config);
5
+ var Steps = /*#__PURE__*/component(mergedConfig);
6
+ export { Steps, mergedConfig };
@@ -0,0 +1,181 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import type { ComponentProps } from 'react';
3
+ import type { StoryObj, Meta } from '@storybook/react';
4
+ import { disableProps } from '@salutejs/plasma-sb-utils';
5
+
6
+ import { IconMic } from '../../../../components/_Icon';
7
+ import { argTypesFromConfig, WithTheme } from '../../../_helpers';
8
+ import { StepItemProps } from '../../../../components/Steps/ui';
9
+
10
+ import { Steps, mergedConfig } from './Steps';
11
+
12
+ const meta: Meta<typeof Steps> = {
13
+ title: 'plasma_b2c/Steps',
14
+ decorators: [WithTheme],
15
+ component: Steps,
16
+ argTypes: {
17
+ ...argTypesFromConfig(mergedConfig),
18
+ },
19
+ };
20
+
21
+ export default meta;
22
+
23
+ type Story = StoryObj<ComponentProps<typeof Steps>>;
24
+
25
+ const renderIndicator = ({ status, size }) => {
26
+ let iconSize;
27
+ if (size === 'xs' || size === 's') {
28
+ iconSize = 'xs';
29
+ } else if (status === 'active') {
30
+ iconSize = 's';
31
+ } else {
32
+ iconSize = 'xs';
33
+ }
34
+
35
+ return <IconMic color="inherit" size={iconSize} />;
36
+ };
37
+
38
+ const DefaultStory = (args) => {
39
+ const {
40
+ maxWidth,
41
+ title,
42
+ content,
43
+ size,
44
+ indicatorType,
45
+ quantity,
46
+ hasContent,
47
+ loading,
48
+ disabled,
49
+ simple,
50
+ ...rest
51
+ } = args;
52
+
53
+ const innerTitle = title || 'Title';
54
+
55
+ const [items, setItems] = useState([]);
56
+
57
+ useEffect(() => {
58
+ const newItems = new Array(quantity).fill(null).map((_, index) => {
59
+ const indicator = index + 1;
60
+
61
+ if (simple) {
62
+ return {
63
+ indicator,
64
+ status: 'inactive',
65
+ };
66
+ }
67
+
68
+ return {
69
+ title: innerTitle,
70
+ content,
71
+ indicator,
72
+ status: 'inactive',
73
+ };
74
+ });
75
+
76
+ setItems(newItems);
77
+ }, [hasContent, loading, quantity, innerTitle, content, simple]);
78
+
79
+ useEffect(() => {
80
+ setItems((curItems) =>
81
+ curItems.map((item, index) => {
82
+ if (indicatorType === 'numbered') {
83
+ return { ...item, indicator: index + 1 };
84
+ }
85
+
86
+ if (indicatorType === 'bullet') {
87
+ return { ...item, indicator: undefined };
88
+ }
89
+
90
+ if (indicatorType === 'icon') {
91
+ return { ...item, indicator: renderIndicator };
92
+ }
93
+
94
+ return item;
95
+ }),
96
+ );
97
+ }, [indicatorType]);
98
+
99
+ useEffect(() => {
100
+ setItems((curItems) => curItems.map((item) => ({ ...item, disabled })));
101
+ }, [disabled]);
102
+
103
+ const onChange = (item: StepItemProps, index: number, prevIndex: number) => {
104
+ if (prevIndex !== undefined) {
105
+ items[prevIndex].status = 'completed';
106
+ }
107
+
108
+ items[index].status = 'active';
109
+
110
+ setItems([...items]);
111
+ };
112
+
113
+ return (
114
+ <div style={{ maxWidth }}>
115
+ <Steps size={size} items={items} onChange={onChange} hasLoader={loading} {...rest} />
116
+ </div>
117
+ );
118
+ };
119
+
120
+ export const Default: Story = {
121
+ args: {
122
+ maxWidth: '100%',
123
+ quantity: 6,
124
+ size: 'm',
125
+ title: 'Title',
126
+ content: 'Content',
127
+ contentAlign: 'left',
128
+ indicatorType: 'numbered',
129
+ orientation: 'horizontal',
130
+ hasLine: true,
131
+ hasContent: 'all',
132
+ disabled: false,
133
+ loading: false,
134
+ simple: false,
135
+ },
136
+ argTypes: {
137
+ maxWidth: {
138
+ control: {
139
+ type: 'text',
140
+ },
141
+ },
142
+ size: {
143
+ options: ['xs', 's', 'm', 'l'],
144
+ control: {
145
+ type: 'inline-radio',
146
+ },
147
+ },
148
+ orientation: {
149
+ options: ['horizontal', 'vertical'],
150
+ control: {
151
+ type: 'inline-radio',
152
+ },
153
+ },
154
+ contentAlign: {
155
+ options: ['left', 'center'],
156
+ control: {
157
+ type: 'inline-radio',
158
+ },
159
+ if: { arg: 'orientation', eq: 'horizontal' },
160
+ },
161
+ indicatorType: {
162
+ options: ['numbered', 'bullet', 'icon'],
163
+ control: {
164
+ type: 'inline-radio',
165
+ },
166
+ },
167
+ hasContent: {
168
+ options: ['all', 'active', 'none'],
169
+ control: {
170
+ type: 'inline-radio',
171
+ },
172
+ },
173
+ simple: {
174
+ control: {
175
+ type: 'boolean',
176
+ },
177
+ },
178
+ ...disableProps(['view']),
179
+ },
180
+ render: (args) => <DefaultStory {...args} />,
181
+ };