@salutejs/plasma-new-hope 0.158.0-canary.1443.11128958088.0 → 0.158.0-canary.1451.11128265656.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/index.css +0 -12
- package/cjs/index.js +0 -5
- package/cjs/index.js.map +1 -1
- package/emotion/cjs/index.js +0 -11
- package/emotion/es/index.js +0 -1
- package/es/index.css +0 -12
- package/es/index.js +0 -2
- package/es/index.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/index.js +0 -11
- package/styled-components/es/index.js +0 -1
- package/types/index.d.ts +0 -1
- package/types/index.d.ts.map +1 -1
- package/cjs/components/Steps/Steps.css +0 -18
- package/cjs/components/Steps/Steps.js +0 -118
- package/cjs/components/Steps/Steps.js.map +0 -1
- package/cjs/components/Steps/Steps.styles.js +0 -9
- package/cjs/components/Steps/Steps.styles.js.map +0 -1
- package/cjs/components/Steps/Steps.styles_1qandre.css +0 -1
- package/cjs/components/Steps/Steps.tokens.js +0 -81
- package/cjs/components/Steps/Steps.tokens.js.map +0 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.css +0 -16
- package/cjs/components/Steps/ui/StepItem/StepItem.js +0 -117
- package/cjs/components/Steps/ui/StepItem/StepItem.js.map +0 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.styles.js +0 -83
- package/cjs/components/Steps/ui/StepItem/StepItem.styles.js.map +0 -1
- package/cjs/components/Steps/ui/StepItem/StepItem.styles_1nnkvta.css +0 -9
- package/cjs/components/Steps/variations/_size/base.js +0 -9
- package/cjs/components/Steps/variations/_size/base.js.map +0 -1
- package/cjs/components/Steps/variations/_size/base_x642ct.css +0 -1
- package/cjs/components/Steps/variations/_view/base.js +0 -9
- package/cjs/components/Steps/variations/_view/base.js.map +0 -1
- package/cjs/components/Steps/variations/_view/base_x642ct.css +0 -1
- package/emotion/cjs/components/Steps/Steps.js +0 -130
- package/emotion/cjs/components/Steps/Steps.review-doc.mdx +0 -304
- package/emotion/cjs/components/Steps/Steps.styles.js +0 -9
- package/emotion/cjs/components/Steps/Steps.template-doc.mdx +0 -84
- package/emotion/cjs/components/Steps/Steps.tokens.js +0 -79
- package/emotion/cjs/components/Steps/Steps.types.js +0 -5
- package/emotion/cjs/components/Steps/index.js +0 -25
- package/emotion/cjs/components/Steps/ui/StepItem/StepItem.js +0 -127
- package/emotion/cjs/components/Steps/ui/StepItem/StepItem.styles.js +0 -52
- package/emotion/cjs/components/Steps/ui/StepItem/StepItem.types.js +0 -5
- package/emotion/cjs/components/Steps/ui/StepItem/index.js +0 -12
- package/emotion/cjs/components/Steps/ui/index.js +0 -16
- package/emotion/cjs/components/Steps/variations/_size/base.js +0 -8
- package/emotion/cjs/components/Steps/variations/_size/tokens.json +0 -1
- package/emotion/cjs/components/Steps/variations/_view/base.js +0 -8
- package/emotion/cjs/components/Steps/variations/_view/tokens.json +0 -1
- package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.config.js +0 -25
- package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.js +0 -13
- package/emotion/cjs/examples/plasma_b2c/components/Steps/Steps.stories.tsx +0 -169
- package/emotion/cjs/examples/plasma_web/components/Steps/Steps.config.js +0 -25
- package/emotion/cjs/examples/plasma_web/components/Steps/Steps.js +0 -13
- package/emotion/cjs/examples/plasma_web/components/Steps/Steps.stories.tsx +0 -169
- package/emotion/es/components/Steps/Steps.js +0 -121
- package/emotion/es/components/Steps/Steps.review-doc.mdx +0 -304
- package/emotion/es/components/Steps/Steps.styles.js +0 -3
- package/emotion/es/components/Steps/Steps.template-doc.mdx +0 -84
- package/emotion/es/components/Steps/Steps.tokens.js +0 -73
- package/emotion/es/components/Steps/Steps.types.js +0 -1
- package/emotion/es/components/Steps/index.js +0 -2
- package/emotion/es/components/Steps/ui/StepItem/StepItem.js +0 -118
- package/emotion/es/components/Steps/ui/StepItem/StepItem.styles.js +0 -45
- package/emotion/es/components/Steps/ui/StepItem/StepItem.types.js +0 -1
- package/emotion/es/components/Steps/ui/StepItem/index.js +0 -1
- package/emotion/es/components/Steps/ui/index.js +0 -1
- package/emotion/es/components/Steps/variations/_size/base.js +0 -2
- package/emotion/es/components/Steps/variations/_size/tokens.json +0 -1
- package/emotion/es/components/Steps/variations/_view/base.js +0 -2
- package/emotion/es/components/Steps/variations/_view/tokens.json +0 -1
- package/emotion/es/examples/plasma_b2c/components/Steps/Steps.config.js +0 -19
- package/emotion/es/examples/plasma_b2c/components/Steps/Steps.js +0 -9
- package/emotion/es/examples/plasma_b2c/components/Steps/Steps.stories.tsx +0 -169
- package/emotion/es/examples/plasma_web/components/Steps/Steps.config.js +0 -19
- package/emotion/es/examples/plasma_web/components/Steps/Steps.js +0 -9
- package/emotion/es/examples/plasma_web/components/Steps/Steps.stories.tsx +0 -169
- package/es/components/Steps/Steps.css +0 -18
- package/es/components/Steps/Steps.js +0 -113
- package/es/components/Steps/Steps.js.map +0 -1
- package/es/components/Steps/Steps.styles.js +0 -5
- package/es/components/Steps/Steps.styles.js.map +0 -1
- package/es/components/Steps/Steps.styles_1qandre.css +0 -1
- package/es/components/Steps/Steps.tokens.js +0 -76
- package/es/components/Steps/Steps.tokens.js.map +0 -1
- package/es/components/Steps/ui/StepItem/StepItem.css +0 -16
- package/es/components/Steps/ui/StepItem/StepItem.js +0 -113
- package/es/components/Steps/ui/StepItem/StepItem.js.map +0 -1
- package/es/components/Steps/ui/StepItem/StepItem.styles.js +0 -71
- package/es/components/Steps/ui/StepItem/StepItem.styles.js.map +0 -1
- package/es/components/Steps/ui/StepItem/StepItem.styles_1nnkvta.css +0 -9
- package/es/components/Steps/variations/_size/base.js +0 -5
- package/es/components/Steps/variations/_size/base.js.map +0 -1
- package/es/components/Steps/variations/_size/base_x642ct.css +0 -1
- package/es/components/Steps/variations/_view/base.js +0 -5
- package/es/components/Steps/variations/_view/base.js.map +0 -1
- package/es/components/Steps/variations/_view/base_x642ct.css +0 -1
- package/styled-components/cjs/components/Steps/Steps.js +0 -130
- package/styled-components/cjs/components/Steps/Steps.review-doc.mdx +0 -304
- package/styled-components/cjs/components/Steps/Steps.styles.js +0 -9
- package/styled-components/cjs/components/Steps/Steps.template-doc.mdx +0 -84
- package/styled-components/cjs/components/Steps/Steps.tokens.js +0 -79
- package/styled-components/cjs/components/Steps/Steps.types.js +0 -5
- package/styled-components/cjs/components/Steps/index.js +0 -25
- package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.js +0 -127
- package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.styles.js +0 -43
- package/styled-components/cjs/components/Steps/ui/StepItem/StepItem.types.js +0 -5
- package/styled-components/cjs/components/Steps/ui/StepItem/index.js +0 -12
- package/styled-components/cjs/components/Steps/ui/index.js +0 -16
- package/styled-components/cjs/components/Steps/variations/_size/base.js +0 -8
- package/styled-components/cjs/components/Steps/variations/_size/tokens.json +0 -1
- package/styled-components/cjs/components/Steps/variations/_view/base.js +0 -8
- package/styled-components/cjs/components/Steps/variations/_view/tokens.json +0 -1
- package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.config.js +0 -25
- package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.js +0 -13
- package/styled-components/cjs/examples/plasma_b2c/components/Steps/Steps.stories.tsx +0 -169
- package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.config.js +0 -25
- package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.js +0 -13
- package/styled-components/cjs/examples/plasma_web/components/Steps/Steps.stories.tsx +0 -169
- package/styled-components/es/components/Steps/Steps.js +0 -121
- package/styled-components/es/components/Steps/Steps.review-doc.mdx +0 -304
- package/styled-components/es/components/Steps/Steps.styles.js +0 -3
- package/styled-components/es/components/Steps/Steps.template-doc.mdx +0 -84
- package/styled-components/es/components/Steps/Steps.tokens.js +0 -73
- package/styled-components/es/components/Steps/Steps.types.js +0 -1
- package/styled-components/es/components/Steps/index.js +0 -2
- package/styled-components/es/components/Steps/ui/StepItem/StepItem.js +0 -118
- package/styled-components/es/components/Steps/ui/StepItem/StepItem.styles.js +0 -36
- package/styled-components/es/components/Steps/ui/StepItem/StepItem.types.js +0 -1
- package/styled-components/es/components/Steps/ui/StepItem/index.js +0 -1
- package/styled-components/es/components/Steps/ui/index.js +0 -1
- package/styled-components/es/components/Steps/variations/_size/base.js +0 -2
- package/styled-components/es/components/Steps/variations/_size/tokens.json +0 -1
- package/styled-components/es/components/Steps/variations/_view/base.js +0 -2
- package/styled-components/es/components/Steps/variations/_view/tokens.json +0 -1
- package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.config.js +0 -19
- package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.js +0 -9
- package/styled-components/es/examples/plasma_b2c/components/Steps/Steps.stories.tsx +0 -169
- package/styled-components/es/examples/plasma_web/components/Steps/Steps.config.js +0 -19
- package/styled-components/es/examples/plasma_web/components/Steps/Steps.js +0 -9
- package/styled-components/es/examples/plasma_web/components/Steps/Steps.stories.tsx +0 -169
- package/types/components/Steps/Steps.d.ts +0 -23
- package/types/components/Steps/Steps.d.ts.map +0 -1
- package/types/components/Steps/Steps.styles.d.ts +0 -2
- package/types/components/Steps/Steps.styles.d.ts.map +0 -1
- package/types/components/Steps/Steps.tokens.d.ts +0 -74
- package/types/components/Steps/Steps.tokens.d.ts.map +0 -1
- package/types/components/Steps/Steps.types.d.ts +0 -55
- package/types/components/Steps/Steps.types.d.ts.map +0 -1
- package/types/components/Steps/index.d.ts +0 -4
- package/types/components/Steps/index.d.ts.map +0 -1
- package/types/components/Steps/ui/StepItem/StepItem.d.ts +0 -17
- package/types/components/Steps/ui/StepItem/StepItem.d.ts.map +0 -1
- package/types/components/Steps/ui/StepItem/StepItem.styles.d.ts +0 -20
- package/types/components/Steps/ui/StepItem/StepItem.styles.d.ts.map +0 -1
- package/types/components/Steps/ui/StepItem/StepItem.types.d.ts +0 -35
- package/types/components/Steps/ui/StepItem/StepItem.types.d.ts.map +0 -1
- package/types/components/Steps/ui/StepItem/index.d.ts +0 -3
- package/types/components/Steps/ui/StepItem/index.d.ts.map +0 -1
- package/types/components/Steps/ui/index.d.ts +0 -2
- package/types/components/Steps/ui/index.d.ts.map +0 -1
- package/types/components/Steps/variations/_size/base.d.ts +0 -2
- package/types/components/Steps/variations/_size/base.d.ts.map +0 -1
- package/types/components/Steps/variations/_view/base.d.ts +0 -2
- package/types/components/Steps/variations/_view/base.d.ts.map +0 -1
- package/types/examples/plasma_b2c/components/Steps/Steps.config.d.ts +0 -18
- package/types/examples/plasma_b2c/components/Steps/Steps.config.d.ts.map +0 -1
- package/types/examples/plasma_b2c/components/Steps/Steps.d.ts +0 -35
- package/types/examples/plasma_b2c/components/Steps/Steps.d.ts.map +0 -1
- package/types/examples/plasma_web/components/Steps/Steps.config.d.ts +0 -18
- package/types/examples/plasma_web/components/Steps/Steps.config.d.ts.map +0 -1
- package/types/examples/plasma_web/components/Steps/Steps.d.ts +0 -35
- package/types/examples/plasma_web/components/Steps/Steps.d.ts.map +0 -1
@@ -1,304 +0,0 @@
|
|
1
|
-
---
|
2
|
-
id: steps
|
3
|
-
title: Steps
|
4
|
-
---
|
5
|
-
|
6
|
-
# Steps
|
7
|
-
Шаги могут отображаться в нескольких размерах, в упрощенном виде и в горизонтальной/вертикальной ориентации
|
8
|
-
|
9
|
-
```tsx live
|
10
|
-
import { ReactNode } from 'react';
|
11
|
-
|
12
|
-
export type StepStatus = 'active' | 'inactive' | 'completed';
|
13
|
-
|
14
|
-
export interface StepItemProps {
|
15
|
-
/**
|
16
|
-
* Заголовок
|
17
|
-
*/
|
18
|
-
title?: string;
|
19
|
-
/**
|
20
|
-
* Контент, может быть как React компонентом, так и функцией
|
21
|
-
*/
|
22
|
-
content?: string | ReactNode | ((status: StepStatus, index: number, items: StepItemProps[]) => ReactNode);
|
23
|
-
/**
|
24
|
-
* Индикатор шага, может быть как React компонентом, так и функцией
|
25
|
-
*/
|
26
|
-
indicator?: number | string | ReactNode | ((status: StepStatus, item: StepItemProps) => ReactNode | null);
|
27
|
-
/**
|
28
|
-
* Статус шага: активный, инактивный, завершенный
|
29
|
-
* @description
|
30
|
-
* active - активный шаг
|
31
|
-
* inactive - не пройденный шаг
|
32
|
-
* completed - пройденный шаг
|
33
|
-
*/
|
34
|
-
status?: StepStatus;
|
35
|
-
/**
|
36
|
-
* Отключенный шаг
|
37
|
-
* @default false
|
38
|
-
*/
|
39
|
-
disabled?: boolean;
|
40
|
-
}
|
41
|
-
|
42
|
-
interface BaseSteps {
|
43
|
-
/**
|
44
|
-
* Ориентация компонента
|
45
|
-
* @default 'horizontal'
|
46
|
-
*/
|
47
|
-
orientation?: 'horizontal' | 'vertical';
|
48
|
-
/**
|
49
|
-
* Выравнивание контента в шагах
|
50
|
-
* @default 'left'
|
51
|
-
*/
|
52
|
-
contentAlign?: 'left' | 'center';
|
53
|
-
/**
|
54
|
-
* Включает разделительную линию
|
55
|
-
* @default true
|
56
|
-
*/
|
57
|
-
hasLine?: boolean;
|
58
|
-
/**
|
59
|
-
* Индекс текущего шага, для uncontrolled компонента
|
60
|
-
*/
|
61
|
-
current?: number;
|
62
|
-
/**
|
63
|
-
* Статус текущего шага, имеет приоритет над item.status
|
64
|
-
*/
|
65
|
-
status?: StepStatus;
|
66
|
-
/**
|
67
|
-
* Обработчик изменения шага, делает индикаторы и заголовки шагов кликабельными
|
68
|
-
*/
|
69
|
-
onChange?: (item: StepItemProps, index: number, prevIndex?: number) => void;
|
70
|
-
/**
|
71
|
-
* Массив шагов
|
72
|
-
*/
|
73
|
-
items: StepItemProps[];
|
74
|
-
}
|
75
|
-
|
76
|
-
type IndicatorSizeSimple = 8 | 16;
|
77
|
-
type IndicatorSize = 24 | 36;
|
78
|
-
|
79
|
-
export type Steps = BaseSteps & {
|
80
|
-
/**
|
81
|
-
* Размер шага
|
82
|
-
*/
|
83
|
-
size: 'xs' | 's';
|
84
|
-
indicatorSize: never;
|
85
|
-
} & {
|
86
|
-
/**
|
87
|
-
* Размер шага
|
88
|
-
*/
|
89
|
-
size: 'm' | 'l';
|
90
|
-
/**
|
91
|
-
* Размер индикатора
|
92
|
-
*/
|
93
|
-
indicatorSize: IndicatorSize | IndicatorSizeSimple;
|
94
|
-
};
|
95
|
-
|
96
|
-
```
|
97
|
-
|
98
|
-
примеры использования https://codesandbox.io/p/devbox/crzql2?file=%2Fsrc%2FDemo.tsx%3A23%2C1
|
99
|
-
|
100
|
-
```
|
101
|
-
import React, { useState } from 'react';
|
102
|
-
import { fullItems } from './App.data.tsx';
|
103
|
-
import { Steps } from './Steps/Steps.tsx';
|
104
|
-
import { StepItemProps, StepStatus } from './Steps/Steps.types';
|
105
|
-
|
106
|
-
const DemoContent: React.FC<{ onClick: () => void; status: string; index?: number; current?: number }> = ({
|
107
|
-
onClick,
|
108
|
-
status,
|
109
|
-
index,
|
110
|
-
current = 0,
|
111
|
-
children,
|
112
|
-
}) => {
|
113
|
-
return (
|
114
|
-
<>
|
115
|
-
<div>Content</div>
|
116
|
-
<button onClick={onClick} disabled={index !== (current || 0)}>
|
117
|
-
{children}
|
118
|
-
</button>
|
119
|
-
</>
|
120
|
-
);
|
121
|
-
};
|
122
|
-
|
123
|
-
export const DemoWithExternalControl = () => {
|
124
|
-
const items = [
|
125
|
-
{
|
126
|
-
title: 'Title',
|
127
|
-
indicator: '1',
|
128
|
-
content: 'Content',
|
129
|
-
},
|
130
|
-
{
|
131
|
-
title: 'Title',
|
132
|
-
indicator: '2',
|
133
|
-
content: 'Content',
|
134
|
-
},
|
135
|
-
{
|
136
|
-
title: 'Title',
|
137
|
-
indicator: '3',
|
138
|
-
content: 'Content',
|
139
|
-
},
|
140
|
-
{
|
141
|
-
title: 'Title',
|
142
|
-
indicator: '4',
|
143
|
-
content: 'Content',
|
144
|
-
},
|
145
|
-
];
|
146
|
-
|
147
|
-
const [current, setCurrent] = useState(1);
|
148
|
-
const [status, setStatus] = useState('active');
|
149
|
-
|
150
|
-
const isLast = current === items.length - 1;
|
151
|
-
|
152
|
-
const onClick = () => {
|
153
|
-
if (isLast) {
|
154
|
-
setStatus('completed');
|
155
|
-
} else {
|
156
|
-
setCurrent(current + 1);
|
157
|
-
}
|
158
|
-
};
|
159
|
-
|
160
|
-
return (
|
161
|
-
<>
|
162
|
-
<Steps style={{ width: '1000px' }} current={current} status={status} items={items} />
|
163
|
-
<br />
|
164
|
-
<div>
|
165
|
-
External control:{' '}
|
166
|
-
<button onClick={onClick} style={{ width: '5rem' }}>
|
167
|
-
{isLast ? 'complete' : 'next'}
|
168
|
-
</button>
|
169
|
-
</div>
|
170
|
-
<hr />
|
171
|
-
</>
|
172
|
-
);
|
173
|
-
};
|
174
|
-
|
175
|
-
export const DemoWithInternalControls = () => {
|
176
|
-
const [current, setCurrent] = useState(undefined);
|
177
|
-
const [status, setStatus] = useState<StepStatus | undefined>();
|
178
|
-
|
179
|
-
const renderContent = (status, index, items) => {
|
180
|
-
const isFirst = index === 0 && current === undefined;
|
181
|
-
const isLast = index === items.length - 1;
|
182
|
-
|
183
|
-
const onNext = () => setCurrent((current) => (current === undefined ? 0 : current + 1));
|
184
|
-
const onComplete = () => {
|
185
|
-
setStatus('completed');
|
186
|
-
};
|
187
|
-
|
188
|
-
return (
|
189
|
-
<DemoContent onClick={isLast ? onComplete : onNext} index={index} status={status} current={current}>
|
190
|
-
{isFirst && 'go'}
|
191
|
-
{isLast && 'complete'}
|
192
|
-
{!isFirst && !isLast && 'next'}
|
193
|
-
</DemoContent>
|
194
|
-
);
|
195
|
-
};
|
196
|
-
|
197
|
-
return (
|
198
|
-
<Steps
|
199
|
-
current={current}
|
200
|
-
status={status}
|
201
|
-
items={[
|
202
|
-
{
|
203
|
-
title: 'Title',
|
204
|
-
indicator: '1',
|
205
|
-
content: renderContent,
|
206
|
-
},
|
207
|
-
{
|
208
|
-
title: 'Title',
|
209
|
-
indicator: '2',
|
210
|
-
content: renderContent,
|
211
|
-
},
|
212
|
-
{
|
213
|
-
title: 'Title',
|
214
|
-
indicator: '3',
|
215
|
-
content: renderContent,
|
216
|
-
},
|
217
|
-
{
|
218
|
-
title: 'Title',
|
219
|
-
indicator: '4',
|
220
|
-
content: renderContent,
|
221
|
-
},
|
222
|
-
]}
|
223
|
-
/>
|
224
|
-
);
|
225
|
-
};
|
226
|
-
|
227
|
-
export const DemoWithControlledUsage = () => {
|
228
|
-
const [exampleItems, setExampleItems] = useState<StepItemProps[]>(() =>
|
229
|
-
fullItems.map((item) => ({ ...item, status: 'inactive' }))
|
230
|
-
);
|
231
|
-
|
232
|
-
return (
|
233
|
-
<Steps
|
234
|
-
style={{ width: '1000px' }}
|
235
|
-
onChange={(item, index) => {
|
236
|
-
setExampleItems(
|
237
|
-
exampleItems.map((item, itemIndex) => {
|
238
|
-
if (index > itemIndex) {
|
239
|
-
return { ...item, status: 'completed' };
|
240
|
-
}
|
241
|
-
|
242
|
-
if (index === itemIndex) {
|
243
|
-
return { ...item, status: 'active' };
|
244
|
-
}
|
245
|
-
|
246
|
-
return { ...item, status: 'inactive' };
|
247
|
-
})
|
248
|
-
);
|
249
|
-
}}
|
250
|
-
items={exampleItems}
|
251
|
-
/>
|
252
|
-
);
|
253
|
-
};
|
254
|
-
|
255
|
-
export const DemoWithControlledFreeUsage = () => {
|
256
|
-
const [items, setItems] = useState<StepItemProps[]>(() => fullItems.map((item) => ({ ...item, status: 'inactive' })));
|
257
|
-
|
258
|
-
return (
|
259
|
-
<Steps
|
260
|
-
style={{ width: '1000px' }}
|
261
|
-
onChange={(item, index, prevIndex) => {
|
262
|
-
console.log('!!! onChange', index, prevIndex);
|
263
|
-
|
264
|
-
const newItems = [...items];
|
265
|
-
if (prevIndex !== undefined) {
|
266
|
-
newItems[prevIndex].status = 'completed';
|
267
|
-
}
|
268
|
-
newItems[index].status = 'active';
|
269
|
-
|
270
|
-
setItems(newItems);
|
271
|
-
}}
|
272
|
-
items={items}
|
273
|
-
/>
|
274
|
-
);
|
275
|
-
};
|
276
|
-
|
277
|
-
export const DemoControlledWithStatus = () => {
|
278
|
-
const [items, setItems] = useState<StepItemProps[]>(() => fullItems.map(({ status, ...item }) => ({ ...item })));
|
279
|
-
return (
|
280
|
-
<Steps
|
281
|
-
style={{ width: '1000px' }}
|
282
|
-
current={2}
|
283
|
-
status="active"
|
284
|
-
onClick={(item, index) => {
|
285
|
-
setItems(
|
286
|
-
items.map((item, itemIndex) => {
|
287
|
-
if (index > itemIndex) {
|
288
|
-
return { ...item, status: 'completed' };
|
289
|
-
}
|
290
|
-
|
291
|
-
if (index === itemIndex) {
|
292
|
-
return { ...item, status: 'active' };
|
293
|
-
}
|
294
|
-
|
295
|
-
return { ...item, status: 'inactive' };
|
296
|
-
})
|
297
|
-
);
|
298
|
-
}}
|
299
|
-
items={items}
|
300
|
-
/>
|
301
|
-
);
|
302
|
-
};
|
303
|
-
|
304
|
-
```
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.base = void 0;
|
7
|
-
var _react = /*#__PURE__*/require("@emotion/react");
|
8
|
-
var _Steps = /*#__PURE__*/require("./Steps.tokens");
|
9
|
-
var base = exports.base = /*#__PURE__*/(0, _react.css)("display:flex;flex-direction:row;&.", _Steps.classes.simple, "{align-items:center;&.", _Steps.classes.hasIndicator, "{height:var(", _Steps.tokens.activeIndicatorSize, ");}&:not(.", _Steps.classes.hasIndicator, "){height:var(", _Steps.tokens.activeBulletSize, ");}&.", _Steps.classes.verticalOrientation, "{&.", _Steps.classes.hasIndicator, "{width:var(", _Steps.tokens.activeIndicatorSize, ");height:auto;}&:not(.", _Steps.classes.hasIndicator, "){width:var(", _Steps.tokens.activeBulletSize, ");height:auto;}}}&.", _Steps.classes.verticalOrientation, "{display:inline;flex-direction:column;justify-content:center;&.", _Steps.classes.simple, "{display:inline-flex;}};label:plasma-new-hope__base;" + (process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy1lbW90aW9uL2NvbXBvbmVudHMvU3RlcHMvU3RlcHMuc3R5bGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUl1QiIsImZpbGUiOiIuLi8uLi8uLi8uLi9zcmMtZW1vdGlvbi9jb21wb25lbnRzL1N0ZXBzL1N0ZXBzLnN0eWxlcy50cyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGNzcyB9IGZyb20gJ0BlbW90aW9uL3JlYWN0JztcblxuaW1wb3J0IHsgY2xhc3NlcywgdG9rZW5zIH0gZnJvbSAnLi9TdGVwcy50b2tlbnMnO1xuXG5leHBvcnQgY29uc3QgYmFzZSA9IGNzc2BcbiAgICBkaXNwbGF5OiBmbGV4O1xuICAgIGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cbiAgICAmLiR7Y2xhc3Nlcy5zaW1wbGV9IHtcbiAgICAgICAgYWxpZ24taXRlbXM6IGNlbnRlcjtcblxuICAgICAgICAmLiR7Y2xhc3Nlcy5oYXNJbmRpY2F0b3J9IHtcbiAgICAgICAgICAgIGhlaWdodDogdmFyKCR7dG9rZW5zLmFjdGl2ZUluZGljYXRvclNpemV9KTtcbiAgICAgICAgfVxuICAgICAgICAmOm5vdCguJHtjbGFzc2VzLmhhc0luZGljYXRvcn0pIHtcbiAgICAgICAgICAgIGhlaWdodDogdmFyKCR7dG9rZW5zLmFjdGl2ZUJ1bGxldFNpemV9KTtcbiAgICAgICAgfVxuXG4gICAgICAgICYuJHtjbGFzc2VzLnZlcnRpY2FsT3JpZW50YXRpb259IHtcbiAgICAgICAgICAgICYuJHtjbGFzc2VzLmhhc0luZGljYXRvcn0ge1xuICAgICAgICAgICAgICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuYWN0aXZlSW5kaWNhdG9yU2l6ZX0pO1xuICAgICAgICAgICAgICAgIGhlaWdodDogYXV0bztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgICY6bm90KC4ke2NsYXNzZXMuaGFzSW5kaWNhdG9yfSkge1xuICAgICAgICAgICAgICAgIHdpZHRoOiB2YXIoJHt0b2tlbnMuYWN0aXZlQnVsbGV0U2l6ZX0pO1xuICAgICAgICAgICAgICAgIGhlaWdodDogYXV0bztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgIH1cblxuICAgICYuJHtjbGFzc2VzLnZlcnRpY2FsT3JpZW50YXRpb259IHtcbiAgICAgICAgZGlzcGxheTogaW5saW5lO1xuICAgICAgICBmbGV4LWRpcmVjdGlvbjogY29sdW1uO1xuICAgICAgICBqdXN0aWZ5LWNvbnRlbnQ6IGNlbnRlcjtcblxuICAgICAgICAmLiR7Y2xhc3Nlcy5zaW1wbGV9IHtcbiAgICAgICAgICAgIGRpc3BsYXk6IGlubGluZS1mbGV4O1xuICAgICAgICB9XG4gICAgfVxuYDtcbiJdfQ== */"));
|
@@ -1,84 +0,0 @@
|
|
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
|
-
const items = [{
|
20
|
-
indicator: 1,
|
21
|
-
}, {
|
22
|
-
indicator: 2,
|
23
|
-
}, {
|
24
|
-
indicator: 3,
|
25
|
-
}];
|
26
|
-
|
27
|
-
export function App() {
|
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
|
-
const initialItems = [{
|
52
|
-
indicator: 1,
|
53
|
-
title: 'Title',
|
54
|
-
content: 'Content',
|
55
|
-
}, {
|
56
|
-
indicator: 2,
|
57
|
-
title: 'Title',
|
58
|
-
content: 'Content',
|
59
|
-
}, {
|
60
|
-
indicator: 3,
|
61
|
-
title: 'Title',
|
62
|
-
content: 'Content',
|
63
|
-
}];
|
64
|
-
|
65
|
-
export function App() {
|
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
|
-
```
|
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.tokens = exports.classes = void 0;
|
7
|
-
var classes = exports.classes = {
|
8
|
-
simple: '--plasma-steps-simple',
|
9
|
-
centered: '--plasma-step-item-centered',
|
10
|
-
active: '--plasma-step-item-active',
|
11
|
-
inactive: '--plasma-step-item-inactive',
|
12
|
-
clickable: '--plasma-step-item-clickable',
|
13
|
-
hovered: '--plasma-step-item-hovered',
|
14
|
-
disabled: '--plasma-step-item-disabled',
|
15
|
-
verticalOrientation: '--plasma-steps-vertical-orientation',
|
16
|
-
hasIndicator: '--plasma-step-item-has-indicator',
|
17
|
-
activeItem: '--plasma-step-item-has-indicator',
|
18
|
-
transparentDivider: '--plasma-steps-transparent-divider'
|
19
|
-
};
|
20
|
-
var tokens = exports.tokens = {
|
21
|
-
indicatorSize: '--plasma-step-item-indicator-size',
|
22
|
-
activeIndicatorSize: '--plasma-step-item-active-indicator-size',
|
23
|
-
bulletSize: '--plasma-step-item-bullet-size',
|
24
|
-
activeBulletSize: '--plasma-step-item-active-bullet-size',
|
25
|
-
titlePaddingTop: '--plasma-step-item-title-padding-top',
|
26
|
-
contentPaddingTop: '--plasma-step-item-content-padding-top',
|
27
|
-
contentPaddingRight: '--plasma-step-item-content-padding-right',
|
28
|
-
contentSidePadding: '--plasma-step-item-content-side-padding',
|
29
|
-
contentVerticalPadding: '--plasma-step-item-content-vertical-padding',
|
30
|
-
verticalContentPaddingLeft: '--plasma-step-item-vertical-content-padding-left',
|
31
|
-
smallIndicatorIndentHeight: '--plasma-step-item-s-indicator-intent-height',
|
32
|
-
largeIndicatorIndentHeight: '--plasma-step-item-l-indicator-intent-height',
|
33
|
-
smallBulletIndentHeight: '--plasma-step-item-s-bullet-intent-height',
|
34
|
-
largeBulletIndentHeight: '--plasma-step-item-l-bullet-intent-height',
|
35
|
-
titleFontFamily: '--plasma-step-item-title-font-family',
|
36
|
-
titleFontSize: '--plasma-step-item-title-font-size',
|
37
|
-
titleFontStyle: '--plasma-step-item-title-font-style',
|
38
|
-
titleFontWeight: '--plasma-step-item-title-font-weight',
|
39
|
-
titleLetterSpacing: '--plasma-step-item-title-letter-spacing',
|
40
|
-
titleLineHeight: '--plasma-step-item-title-line-height',
|
41
|
-
contentFontFamily: '--plasma-step-item-content-font-family',
|
42
|
-
contentFontSize: '--plasma-step-item-content-font-size',
|
43
|
-
contentFontStyle: '--plasma-step-item-content-font-style',
|
44
|
-
contentFontWeight: '--plasma-step-item-content-font-weight',
|
45
|
-
contentLetterSpacing: '--plasma-step-item-content-letter-spacing',
|
46
|
-
contentLineHeight: '--plasma-step-item-content-line-height',
|
47
|
-
indicatorFontFamily: '--plasma-step-item-indicator-font-family',
|
48
|
-
indicatorFontSize: '--plasma-step-item-indicator-font-size',
|
49
|
-
indicatorFontStyle: '--plasma-step-item-indicator-font-style',
|
50
|
-
indicatorFontWeight: '--plasma-step-item-indicator-font-weight',
|
51
|
-
indicatorLetterSpacing: '--plasma-step-item-indicator-letter-spacing',
|
52
|
-
indicatorLineHeight: '--plasma-step-item-indicator-line-height',
|
53
|
-
activeIndicatorFontFamily: '--plasma-step-item-active-indicator-font-family',
|
54
|
-
activeIndicatorFontSize: '--plasma-step-item-active-indicator-font-size',
|
55
|
-
activeIndicatorFontStyle: '--plasma-step-item-active-indicator-font-style',
|
56
|
-
activeIndicatorFontWeight: '--plasma-step-item-active-indicator-font-weight',
|
57
|
-
activeIndicatorLetterSpacing: '--plasma-step-item-active-indicator-letter-spacing',
|
58
|
-
activeIndicatorLineHeight: '--plasma-step-item-active-indicator-line-height',
|
59
|
-
activeTitleColor: '--plasma-step-item-active-title-color',
|
60
|
-
activeTitleColorHover: '--plasma-step-item-active-title-color-hover',
|
61
|
-
inactiveTitleColor: '--plasma-step-item-inactive-title-color',
|
62
|
-
inactiveTitleColorHover: '--plasma-step-item-inactive-title-color-hover',
|
63
|
-
contentColor: '--plasma-step-item-content-color',
|
64
|
-
activeIndicatorBorder: '--plasma-step-item-active-indicator-border',
|
65
|
-
activeIndicatorBorderHover: '--plasma-step-item-active-indicator-border-hover',
|
66
|
-
activeIndicatorColor: '--plasma-step-item-active-indicator-color',
|
67
|
-
activeIndicatorColorHover: '--plasma-step-item-active-indicator-color-hover',
|
68
|
-
activeIndicatorBackground: '--plasma-step-item-active-indicator-background',
|
69
|
-
completedIndicatorColor: '--plasma-step-item-completed-indicator-color',
|
70
|
-
completedIndicatorColorHover: '--plasma-step-item-completed-indicator-color-hover',
|
71
|
-
completedIndicatorBackground: '--plasma-step-item-completed-indicator-background',
|
72
|
-
completedIndicatorBackgroundHover: '--plasma-step-item-completed-indicator-background-hover',
|
73
|
-
inactiveIndicatorColor: '--plasma-step-item-inactive-indicator-color',
|
74
|
-
inactiveIndicatorColorHover: '--plasma-step-item-inactive-indicator-color-hover',
|
75
|
-
inactiveIndicatorBackground: '--plasma-step-item-inactive-indicator-background',
|
76
|
-
inactiveIndicatorBackgroundHover: '--plasma-step-item-inactive-indicator-background-hover',
|
77
|
-
disabledOpacity: '--plasma-step-item-disabled-opacity',
|
78
|
-
dividerThickness: '--plasma-step-item-divider-thickness'
|
79
|
-
};
|
@@ -1,25 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
Object.defineProperty(exports, "stepsConfig", {
|
7
|
-
enumerable: true,
|
8
|
-
get: function get() {
|
9
|
-
return _Steps.stepsConfig;
|
10
|
-
}
|
11
|
-
});
|
12
|
-
Object.defineProperty(exports, "stepsRoot", {
|
13
|
-
enumerable: true,
|
14
|
-
get: function get() {
|
15
|
-
return _Steps.stepsRoot;
|
16
|
-
}
|
17
|
-
});
|
18
|
-
Object.defineProperty(exports, "stepsTokens", {
|
19
|
-
enumerable: true,
|
20
|
-
get: function get() {
|
21
|
-
return _Steps2.tokens;
|
22
|
-
}
|
23
|
-
});
|
24
|
-
var _Steps = /*#__PURE__*/require("./Steps");
|
25
|
-
var _Steps2 = /*#__PURE__*/require("./Steps.tokens");
|
@@ -1,127 +0,0 @@
|
|
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.StepItem = void 0;
|
8
|
-
var _react = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("react"));
|
9
|
-
var _classnames = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require("classnames"));
|
10
|
-
var _Steps = /*#__PURE__*/require("../../Steps.tokens");
|
11
|
-
var _StepItem = /*#__PURE__*/require("./StepItem.styles");
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13
|
-
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); }
|
14
|
-
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; }
|
15
|
-
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; }
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
17
|
-
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); }
|
18
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
19
|
-
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."); }
|
20
|
-
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); }
|
21
|
-
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; }
|
22
|
-
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; } }
|
23
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
24
|
-
var indicatorSizesIndentsMap = {
|
25
|
-
8: /*#__PURE__*/"var(".concat(_Steps.tokens.smallBulletIndentHeight, ")"),
|
26
|
-
16: /*#__PURE__*/"var(".concat(_Steps.tokens.largeBulletIndentHeight, ")"),
|
27
|
-
24: /*#__PURE__*/"var(".concat(_Steps.tokens.smallIndicatorIndentHeight, ")"),
|
28
|
-
36: /*#__PURE__*/"var(".concat(_Steps.tokens.largeIndicatorIndentHeight, ")")
|
29
|
-
};
|
30
|
-
var StepItem = exports.StepItem = function StepItem(_ref) {
|
31
|
-
var index = _ref.index,
|
32
|
-
title = _ref.title,
|
33
|
-
content = _ref.content,
|
34
|
-
indicator = _ref.indicator,
|
35
|
-
_ref$status = _ref.status,
|
36
|
-
status = _ref$status === void 0 ? 'inactive' : _ref$status,
|
37
|
-
size = _ref.size,
|
38
|
-
orientation = _ref.orientation,
|
39
|
-
contentAlign = _ref.contentAlign,
|
40
|
-
hasLine = _ref.hasLine,
|
41
|
-
hasLoader = _ref.hasLoader,
|
42
|
-
onClick = _ref.onClick,
|
43
|
-
items = _ref.items;
|
44
|
-
var _useState = (0, _react.useState)(false),
|
45
|
-
_useState2 = _slicedToArray(_useState, 2),
|
46
|
-
isHovered = _useState2[0],
|
47
|
-
setIsHovered = _useState2[1];
|
48
|
-
var isFirst = index === 0;
|
49
|
-
var isLast = index === items.length - 1;
|
50
|
-
var prevItem = items[index - 1];
|
51
|
-
var nextItem = items[index + 1];
|
52
|
-
var isActive = status === 'active';
|
53
|
-
var isInactive = status === 'inactive';
|
54
|
-
var isPrevInactive = prevItem && !(prevItem !== null && prevItem !== void 0 && prevItem.status) || (prevItem === null || prevItem === void 0 ? void 0 : prevItem.status) === 'inactive';
|
55
|
-
var isNextInactive = !(nextItem !== null && nextItem !== void 0 && nextItem.status) || (nextItem === null || nextItem === void 0 ? void 0 : nextItem.status) === 'inactive';
|
56
|
-
var hasIndicator = indicator != null;
|
57
|
-
var BulletNode = hasIndicator ? _StepItem.BulletIndicator : _StepItem.Bullet;
|
58
|
-
var item = items[index];
|
59
|
-
var isSimple = !title && !content;
|
60
|
-
var clickable = Boolean(onClick);
|
61
|
-
var isVertical = orientation === 'vertical';
|
62
|
-
var isCentered = contentAlign === 'center';
|
63
|
-
var isDisabled = item.disabled;
|
64
|
-
var onClickHandler = onClick && !isDisabled ? function () {
|
65
|
-
return onClick(item, index);
|
66
|
-
} : undefined;
|
67
|
-
var resultIndicatorSize;
|
68
|
-
if (hasIndicator) {
|
69
|
-
resultIndicatorSize = isActive ? 36 : 24;
|
70
|
-
} else {
|
71
|
-
resultIndicatorSize = isActive ? 16 : 8;
|
72
|
-
}
|
73
|
-
var sizeToken = indicatorSizesIndentsMap[resultIndicatorSize];
|
74
|
-
var onMouseOver = clickable && !isDisabled ? function () {
|
75
|
-
if (isDisabled) {
|
76
|
-
setIsHovered(false);
|
77
|
-
}
|
78
|
-
setIsHovered(true);
|
79
|
-
} : undefined;
|
80
|
-
var onMouseOut = clickable && !isDisabled ? function () {
|
81
|
-
setIsHovered(false);
|
82
|
-
} : undefined;
|
83
|
-
(0, _react.useEffect)(function () {
|
84
|
-
if (isDisabled) {
|
85
|
-
setIsHovered(false);
|
86
|
-
}
|
87
|
-
}, [isDisabled]);
|
88
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemStyled, {
|
89
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.active, isActive), _Steps.classes.hovered, isHovered && !isActive), _Steps.classes.inactive, isInactive), _Steps.classes.centered, isCentered), _Steps.classes.disabled, isDisabled), _Steps.classes.clickable, clickable && !isActive), _Steps.classes.hasIndicator, hasIndicator), _Steps.classes.verticalOrientation, isVertical))
|
90
|
-
}, /*#__PURE__*/_react["default"].createElement(_StepItem.BulletIndicatorWrapper, {
|
91
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.centered, isCentered), _Steps.classes.simple, isSimple), _Steps.classes.hasIndicator, hasIndicator)),
|
92
|
-
onClick: onClickHandler,
|
93
|
-
onFocus: onMouseOver,
|
94
|
-
onBlur: onMouseOut,
|
95
|
-
onMouseOver: onMouseOver,
|
96
|
-
onMouseOut: onMouseOut
|
97
|
-
}, contentAlign === 'center' && !isSimple && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
98
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine || isFirst), _Steps.classes.inactive, isInactive || isPrevInactive))
|
99
|
-
}), isVertical && (isSimple ? !isFirst : true) && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
100
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine || isFirst), _Steps.classes.inactive, isInactive || isPrevInactive)),
|
101
|
-
style: {
|
102
|
-
height: isSimple ? 'none' : sizeToken,
|
103
|
-
minHeight: sizeToken,
|
104
|
-
maxHeight: isSimple ? 'none' : sizeToken
|
105
|
-
}
|
106
|
-
}), hasLoader && /*#__PURE__*/_react["default"].createElement(_StepItem.SpinnerStyled, {
|
107
|
-
size: hasIndicator ? "var(".concat(_Steps.tokens.activeIndicatorSize, ")") : "var(".concat(_Steps.tokens.activeBulletSize, ")")
|
108
|
-
}), !hasLoader && /*#__PURE__*/_react["default"].createElement(BulletNode, {
|
109
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty({}, _Steps.classes.active, isActive), _Steps.classes.inactive, isInactive))
|
110
|
-
}, typeof indicator === 'function' && indicator({
|
111
|
-
status: status,
|
112
|
-
item: item,
|
113
|
-
size: size
|
114
|
-
}), typeof indicator !== 'function' && indicator), !isSimple && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
115
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine || isLast), _Steps.classes.inactive, isInactive || isNextInactive))
|
116
|
-
})), !isSimple && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemContentWrapper, {
|
117
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.verticalOrientation, isVertical), _Steps.classes.centered, isCentered), _Steps.classes.active, isActive), _Steps.classes.hasIndicator, hasIndicator))
|
118
|
-
}, /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemTitle, {
|
119
|
-
onClick: onClickHandler,
|
120
|
-
onFocus: onMouseOver,
|
121
|
-
onBlur: onMouseOut,
|
122
|
-
onMouseOver: onMouseOver,
|
123
|
-
onMouseOut: onMouseOut
|
124
|
-
}, title), content && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemContent, null, typeof content === 'function' && content(status, index, items), typeof content !== 'function' && content))), isSimple && !isLast && /*#__PURE__*/_react["default"].createElement(_StepItem.StepItemDivider, {
|
125
|
-
className: (0, _classnames["default"])(_defineProperty(_defineProperty(_defineProperty({}, _Steps.classes.simple, isSimple), _Steps.classes.transparentDivider, !hasLine), _Steps.classes.inactive, isInactive || isNextInactive))
|
126
|
-
}));
|
127
|
-
};
|