@astral/ui 4.49.0 → 4.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/NewStepper/NewStepper.d.ts +2 -0
- package/components/NewStepper/NewStepper.js +30 -0
- package/components/NewStepper/Step/Description/Description.d.ts +7 -0
- package/components/NewStepper/Step/Description/Description.js +8 -0
- package/components/NewStepper/Step/Description/index.d.ts +1 -0
- package/components/NewStepper/Step/Description/index.js +1 -0
- package/components/NewStepper/Step/Description/styles.d.ts +11 -0
- package/components/NewStepper/Step/Description/styles.js +18 -0
- package/components/NewStepper/Step/Label/Label.d.ts +8 -0
- package/components/NewStepper/Step/Label/Label.js +9 -0
- package/components/NewStepper/Step/Label/index.d.ts +1 -0
- package/components/NewStepper/Step/Label/index.js +1 -0
- package/components/NewStepper/Step/Label/styles.d.ts +25 -0
- package/components/NewStepper/Step/Label/styles.js +18 -0
- package/components/NewStepper/Step/Label/useLogic/index.d.ts +1 -0
- package/components/NewStepper/Step/Label/useLogic/index.js +1 -0
- package/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +7 -0
- package/components/NewStepper/Step/Label/useLogic/useLogic.js +7 -0
- package/components/NewStepper/Step/Step.d.ts +2 -0
- package/components/NewStepper/Step/Step.js +80 -0
- package/components/NewStepper/Step/constants.d.ts +28 -0
- package/components/NewStepper/Step/constants.js +25 -0
- package/components/NewStepper/Step/index.d.ts +3 -0
- package/components/NewStepper/Step/index.js +2 -0
- package/components/NewStepper/Step/styles.d.ts +38 -0
- package/components/NewStepper/Step/styles.js +303 -0
- package/components/NewStepper/Step/types.d.ts +44 -0
- package/components/NewStepper/Step/types.js +1 -0
- package/components/NewStepper/Step/useLogic/index.d.ts +1 -0
- package/components/NewStepper/Step/useLogic/index.js +1 -0
- package/components/NewStepper/Step/useLogic/useLogic.d.ts +23 -0
- package/components/NewStepper/Step/useLogic/useLogic.js +55 -0
- package/components/NewStepper/StepIcon/StepIcon.d.ts +28 -0
- package/components/NewStepper/StepIcon/StepIcon.js +34 -0
- package/components/NewStepper/StepIcon/constants.d.ts +7 -0
- package/components/NewStepper/StepIcon/constants.js +8 -0
- package/components/NewStepper/StepIcon/index.d.ts +2 -0
- package/components/NewStepper/StepIcon/index.js +2 -0
- package/components/NewStepper/StepperContext/StepperContext.d.ts +11 -0
- package/components/NewStepper/StepperContext/StepperContext.js +10 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +7 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +23 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/index.d.ts +1 -0
- package/components/NewStepper/StepperContext/StepperContextProvider/index.js +1 -0
- package/components/NewStepper/StepperContext/index.d.ts +2 -0
- package/components/NewStepper/StepperContext/index.js +2 -0
- package/components/NewStepper/constants.d.ts +12 -0
- package/components/NewStepper/constants.js +13 -0
- package/components/NewStepper/index.d.ts +4 -0
- package/components/NewStepper/index.js +3 -0
- package/components/NewStepper/public.d.ts +4 -0
- package/components/NewStepper/public.js +3 -0
- package/components/NewStepper/styles.d.ts +5 -0
- package/components/NewStepper/styles.js +34 -0
- package/components/NewStepper/types.d.ts +33 -0
- package/components/NewStepper/types.js +1 -0
- package/components/NewStepper/useLogic/index.d.ts +1 -0
- package/components/NewStepper/useLogic/index.js +1 -0
- package/components/NewStepper/useLogic/useLogic.d.ts +15 -0
- package/components/NewStepper/useLogic/useLogic.js +47 -0
- package/components/NewStepper/useLogic/utils/index.d.ts +1 -0
- package/components/NewStepper/useLogic/utils/index.js +1 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/index.d.ts +1 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/index.js +1 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.d.ts +5 -0
- package/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.js +16 -0
- package/components/Stepper/Stepper.d.ts +3 -0
- package/components/Stepper/Stepper.js +3 -0
- package/components/StepperWizard/StepperWizard.d.ts +3 -0
- package/components/StepperWizard/StepperWizard.js +3 -0
- package/components/Typography/Typography.js +1 -1
- package/components/Typography/constants.d.ts +1 -0
- package/components/Typography/constants.js +2 -0
- package/node/components/NewStepper/NewStepper.d.ts +2 -0
- package/node/components/NewStepper/NewStepper.js +34 -0
- package/node/components/NewStepper/Step/Description/Description.d.ts +7 -0
- package/node/components/NewStepper/Step/Description/Description.js +12 -0
- package/node/components/NewStepper/Step/Description/index.d.ts +1 -0
- package/node/components/NewStepper/Step/Description/index.js +17 -0
- package/node/components/NewStepper/Step/Description/styles.d.ts +11 -0
- package/node/components/NewStepper/Step/Description/styles.js +21 -0
- package/node/components/NewStepper/Step/Label/Label.d.ts +8 -0
- package/node/components/NewStepper/Step/Label/Label.js +13 -0
- package/node/components/NewStepper/Step/Label/index.d.ts +1 -0
- package/node/components/NewStepper/Step/Label/index.js +5 -0
- package/node/components/NewStepper/Step/Label/styles.d.ts +25 -0
- package/node/components/NewStepper/Step/Label/styles.js +21 -0
- package/node/components/NewStepper/Step/Label/useLogic/index.d.ts +1 -0
- package/node/components/NewStepper/Step/Label/useLogic/index.js +17 -0
- package/node/components/NewStepper/Step/Label/useLogic/useLogic.d.ts +7 -0
- package/node/components/NewStepper/Step/Label/useLogic/useLogic.js +11 -0
- package/node/components/NewStepper/Step/Step.d.ts +2 -0
- package/node/components/NewStepper/Step/Step.js +84 -0
- package/node/components/NewStepper/Step/constants.d.ts +28 -0
- package/node/components/NewStepper/Step/constants.js +28 -0
- package/node/components/NewStepper/Step/index.d.ts +3 -0
- package/node/components/NewStepper/Step/index.js +7 -0
- package/node/components/NewStepper/Step/styles.d.ts +38 -0
- package/node/components/NewStepper/Step/styles.js +306 -0
- package/node/components/NewStepper/Step/types.d.ts +44 -0
- package/node/components/NewStepper/Step/types.js +2 -0
- package/node/components/NewStepper/Step/useLogic/index.d.ts +1 -0
- package/node/components/NewStepper/Step/useLogic/index.js +17 -0
- package/node/components/NewStepper/Step/useLogic/useLogic.d.ts +23 -0
- package/node/components/NewStepper/Step/useLogic/useLogic.js +59 -0
- package/node/components/NewStepper/StepIcon/StepIcon.d.ts +28 -0
- package/node/components/NewStepper/StepIcon/StepIcon.js +38 -0
- package/node/components/NewStepper/StepIcon/constants.d.ts +7 -0
- package/node/components/NewStepper/StepIcon/constants.js +11 -0
- package/node/components/NewStepper/StepIcon/index.d.ts +2 -0
- package/node/components/NewStepper/StepIcon/index.js +7 -0
- package/node/components/NewStepper/StepperContext/StepperContext.d.ts +11 -0
- package/node/components/NewStepper/StepperContext/StepperContext.js +13 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts +7 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.js +27 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/index.d.ts +1 -0
- package/node/components/NewStepper/StepperContext/StepperContextProvider/index.js +17 -0
- package/node/components/NewStepper/StepperContext/index.d.ts +2 -0
- package/node/components/NewStepper/StepperContext/index.js +18 -0
- package/node/components/NewStepper/constants.d.ts +12 -0
- package/node/components/NewStepper/constants.js +16 -0
- package/node/components/NewStepper/index.d.ts +4 -0
- package/node/components/NewStepper/index.js +10 -0
- package/node/components/NewStepper/public.d.ts +4 -0
- package/node/components/NewStepper/public.js +10 -0
- package/node/components/NewStepper/styles.d.ts +5 -0
- package/node/components/NewStepper/styles.js +37 -0
- package/node/components/NewStepper/types.d.ts +33 -0
- package/node/components/NewStepper/types.js +2 -0
- package/node/components/NewStepper/useLogic/index.d.ts +1 -0
- package/node/components/NewStepper/useLogic/index.js +17 -0
- package/node/components/NewStepper/useLogic/useLogic.d.ts +15 -0
- package/node/components/NewStepper/useLogic/useLogic.js +51 -0
- package/node/components/NewStepper/useLogic/utils/index.d.ts +1 -0
- package/node/components/NewStepper/useLogic/utils/index.js +17 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/index.d.ts +1 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/index.js +17 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.d.ts +5 -0
- package/node/components/NewStepper/useLogic/utils/validateStepperProps/validateStepperProps.js +20 -0
- package/node/components/Stepper/Stepper.d.ts +3 -0
- package/node/components/Stepper/Stepper.js +3 -0
- package/node/components/StepperWizard/StepperWizard.d.ts +3 -0
- package/node/components/StepperWizard/StepperWizard.js +3 -0
- package/node/components/Typography/Typography.js +1 -1
- package/node/components/Typography/constants.d.ts +1 -0
- package/node/components/Typography/constants.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { NextOutlineMd } from '../../../icons/NextOutlineMd';
|
|
2
|
+
import { Button } from '../../Button';
|
|
3
|
+
import { styled } from '../../styled';
|
|
4
|
+
import { typographyClassnames } from '../../Typography/constants';
|
|
5
|
+
import { stepIconClassnames } from '../StepIcon/constants';
|
|
6
|
+
import { stepClassnames } from './constants';
|
|
7
|
+
export const Wrapper = styled.div `
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: ${({ theme }) => theme.microSpacing(5)};
|
|
10
|
+
align-items: center;
|
|
11
|
+
|
|
12
|
+
&.${stepClassnames.alternativeLabel} {
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
flex: 1;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
|
|
18
|
+
& .${stepClassnames.labelContainer} {
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
|
|
21
|
+
text-align: center;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&:first-of-type {
|
|
25
|
+
& .${stepClassnames.connector} {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&.${stepClassnames.connectorArrow} {
|
|
32
|
+
& .${stepClassnames.content} {
|
|
33
|
+
padding: ${({ theme }) => theme.microSpacing(5, 0)};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:not(:first-of-type) .${stepClassnames.content} {
|
|
37
|
+
margin-left: ${({ theme }) => theme.spacing(2)};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&:last-of-type .${stepClassnames.connector} {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&.${stepClassnames.connectorLine} {
|
|
46
|
+
&.${stepClassnames.orientationHorizontal} {
|
|
47
|
+
& .${stepClassnames.content} {
|
|
48
|
+
align-items: center;
|
|
49
|
+
|
|
50
|
+
padding: ${({ theme }) => theme.spacing(0, 1)};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
&.${stepClassnames.alternativeLabel} {
|
|
55
|
+
& .${stepClassnames.content} {
|
|
56
|
+
padding: ${({ theme }) => theme.microSpacing(3, 0)};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&.${stepClassnames.orientationVertical} {
|
|
62
|
+
& .${stepClassnames.content} {
|
|
63
|
+
padding: ${({ theme }) => theme.spacing(1, 0, 0)};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
& .${stepClassnames.connector}:not(.${stepClassnames.hasDescription}) {
|
|
67
|
+
margin-bottom: ${({ theme }) => theme.microSpacing(1)};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&:last-of-type {
|
|
71
|
+
& .${stepClassnames.description} {
|
|
72
|
+
min-height: 0;
|
|
73
|
+
margin: 0;
|
|
74
|
+
padding-left: ${({ theme }) => theme.spacing(6)};
|
|
75
|
+
|
|
76
|
+
border-left: none;
|
|
77
|
+
|
|
78
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
79
|
+
padding-left: ${({ theme }) => theme.spacing(7)};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
& .${stepClassnames.connector} {
|
|
84
|
+
display: none;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
&:last-of-type {
|
|
89
|
+
& .${stepClassnames.content} {
|
|
90
|
+
padding: ${({ theme }) => theme.spacing(1, 0)};
|
|
91
|
+
|
|
92
|
+
& .${stepClassnames.description} {
|
|
93
|
+
margin-bottom: 0;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
& .${stepClassnames.labelMobile} {
|
|
99
|
+
display: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
& .${stepClassnames.label} {
|
|
103
|
+
display: block;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
& .${stepClassnames.content} {
|
|
109
|
+
&.${stepClassnames.active} {
|
|
110
|
+
& .${stepClassnames.label} {
|
|
111
|
+
color: ${({ theme }) => theme.palette.grey[900]};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
& .${stepIconClassnames.root} {
|
|
115
|
+
color: ${({ theme }) => theme.palette.primary[800]};
|
|
116
|
+
|
|
117
|
+
&.${stepIconClassnames.success} {
|
|
118
|
+
color: ${({ theme }) => theme.palette.success[800]};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&.${stepIconClassnames.error} {
|
|
122
|
+
color: ${({ theme }) => theme.palette.error[800]};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.${stepIconClassnames.warning} {
|
|
126
|
+
color: ${({ theme }) => theme.palette.warning[800]};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
export const IconWrapper = styled.div `
|
|
133
|
+
display: flex;
|
|
134
|
+
|
|
135
|
+
& .${stepIconClassnames.root} {
|
|
136
|
+
width: 20px;
|
|
137
|
+
height: 20px;
|
|
138
|
+
|
|
139
|
+
color: ${({ theme }) => theme.palette.grey[300]};
|
|
140
|
+
|
|
141
|
+
transition: ${({ theme }) => theme.transitions.create(['color'], {
|
|
142
|
+
duration: theme.transitions.duration.shorter,
|
|
143
|
+
})};
|
|
144
|
+
|
|
145
|
+
&.${stepIconClassnames.active} {
|
|
146
|
+
color: ${({ theme }) => theme.palette.primary[800]};
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&.${stepIconClassnames.success} {
|
|
150
|
+
color: ${({ theme }) => theme.palette.success[800]};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&.${stepIconClassnames.error} {
|
|
154
|
+
color: ${({ theme }) => theme.palette.error[800]};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&.${stepIconClassnames.warning} {
|
|
158
|
+
color: ${({ theme }) => theme.palette.warning[800]};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
162
|
+
width: 24px;
|
|
163
|
+
height: 24px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
`;
|
|
167
|
+
export const ArrowConnector = styled(NextOutlineMd) `
|
|
168
|
+
width: 20px;
|
|
169
|
+
height: 20px;
|
|
170
|
+
|
|
171
|
+
color: ${({ theme }) => theme.palette.grey[400]};
|
|
172
|
+
|
|
173
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
174
|
+
width: 24px;
|
|
175
|
+
height: 24px;
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
export const LineConnector = styled.div `
|
|
179
|
+
flex: 1 1 auto;
|
|
180
|
+
|
|
181
|
+
height: 2px;
|
|
182
|
+
|
|
183
|
+
border-top: 2px solid ${({ theme }) => theme.palette.grey[300]};
|
|
184
|
+
|
|
185
|
+
&.${stepClassnames.alternativeLabel} {
|
|
186
|
+
position: absolute;
|
|
187
|
+
top: 15px;
|
|
188
|
+
right: calc(50% + 14px);
|
|
189
|
+
left: calc(-50% + 14px);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&.${stepClassnames.orientationVertical} {
|
|
193
|
+
min-height: 16px;
|
|
194
|
+
|
|
195
|
+
/* Смещение необходимо для центрирования линии относительно иконки, т.к. линия шириной 2px, то для выравнивания необходимо число не кратное 2ум */
|
|
196
|
+
margin-left: 9px;
|
|
197
|
+
|
|
198
|
+
border-top: unset;
|
|
199
|
+
border-left: 2px solid ${({ theme }) => theme.palette.grey[300]};
|
|
200
|
+
|
|
201
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
202
|
+
margin-left: 11px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
`;
|
|
206
|
+
export const LabelWrapper = styled.div `
|
|
207
|
+
display: flex;
|
|
208
|
+
gap: ${({ theme }) => theme.spacing(1)};
|
|
209
|
+
align-items: center;
|
|
210
|
+
|
|
211
|
+
color: ${({ theme }) => theme.palette.grey[600]};
|
|
212
|
+
|
|
213
|
+
& .${typographyClassnames.root} {
|
|
214
|
+
transition: ${({ theme }) => theme.transitions.create(['color'], {
|
|
215
|
+
duration: theme.transitions.duration.shorter,
|
|
216
|
+
})};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
220
|
+
white-space: nowrap;
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
export const StepContentWrapper = styled.div `
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
gap: ${({ theme }) => theme.spacing(1)};
|
|
227
|
+
|
|
228
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
229
|
+
gap: ${({ theme }) => theme.microSpacing(1)};
|
|
230
|
+
}
|
|
231
|
+
`;
|
|
232
|
+
export const StyledButton = styled(Button) `
|
|
233
|
+
cursor: pointer;
|
|
234
|
+
|
|
235
|
+
display: flex;
|
|
236
|
+
flex-direction: column;
|
|
237
|
+
gap: ${({ theme }) => theme.spacing(1)};
|
|
238
|
+
align-items: flex-start;
|
|
239
|
+
justify-content: flex-start;
|
|
240
|
+
|
|
241
|
+
width: 100%;
|
|
242
|
+
height: auto;
|
|
243
|
+
padding: 0;
|
|
244
|
+
|
|
245
|
+
background: transparent;
|
|
246
|
+
border: 0;
|
|
247
|
+
|
|
248
|
+
${({ theme }) => theme.breakpoints.down('sm')} {
|
|
249
|
+
gap: ${({ theme }) => theme.microSpacing(1)};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&:hover {
|
|
253
|
+
background: transparent;
|
|
254
|
+
|
|
255
|
+
& .${stepClassnames.label} {
|
|
256
|
+
color: ${({ theme }) => theme.palette.grey[700]};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
& .${stepIconClassnames.root} {
|
|
260
|
+
color: ${({ theme }) => theme.palette.primary[700]};
|
|
261
|
+
|
|
262
|
+
&.${stepIconClassnames.success} {
|
|
263
|
+
color: ${({ theme }) => theme.palette.success[700]};
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
&.${stepIconClassnames.error} {
|
|
267
|
+
color: ${({ theme }) => theme.palette.error[700]};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&.${stepIconClassnames.warning} {
|
|
271
|
+
color: ${({ theme }) => theme.palette.warning[700]};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
&:active {
|
|
277
|
+
background: transparent;
|
|
278
|
+
& .${stepClassnames.label} {
|
|
279
|
+
color: ${({ theme }) => theme.palette.grey[900]};
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
& .${stepIconClassnames.root} {
|
|
283
|
+
color: ${({ theme }) => theme.palette.primary[800]};
|
|
284
|
+
|
|
285
|
+
&.${stepIconClassnames.success} {
|
|
286
|
+
color: ${({ theme }) => theme.palette.success[800]};
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&.${stepIconClassnames.error} {
|
|
290
|
+
color: ${({ theme }) => theme.palette.error[800]};
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
&.${stepIconClassnames.warning} {
|
|
294
|
+
color: ${({ theme }) => theme.palette.warning[700]};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
&:focus-visible {
|
|
300
|
+
border-radius: ${({ theme }) => theme.shape.medium};
|
|
301
|
+
outline: 1px solid ${({ theme }) => theme.palette.components.focused};
|
|
302
|
+
}
|
|
303
|
+
`;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StepIconProps } from '../StepIcon';
|
|
3
|
+
export type StepProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Название шага
|
|
6
|
+
*/
|
|
7
|
+
label: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Флаг ошибки шага
|
|
10
|
+
*/
|
|
11
|
+
isError?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Завершённость шага. Если не передан — считается по `activeStep` (как раньше: пройдены шаги с меньшим `stepId`).
|
|
14
|
+
*/
|
|
15
|
+
isCompleted?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Флаг предупреждения шага
|
|
18
|
+
*/
|
|
19
|
+
isWarning?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Флаг блокировки шага
|
|
22
|
+
*/
|
|
23
|
+
isDisabled?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Дополнительный текст шага
|
|
26
|
+
*/
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* Функция вызываемая при клике на шаг
|
|
30
|
+
*/
|
|
31
|
+
onClick?: (stepId: number) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Кастомный компонент иконки
|
|
34
|
+
*/
|
|
35
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* Класс применяемый к корневому элементу
|
|
38
|
+
*/
|
|
39
|
+
className?: string;
|
|
40
|
+
/**
|
|
41
|
+
* ID шага
|
|
42
|
+
*/
|
|
43
|
+
stepId: number;
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useLogic';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StepProps } from '../types';
|
|
3
|
+
type UseLogicParams = StepProps;
|
|
4
|
+
export declare const useLogic: ({ stepId, isCompleted, onClick, children, isError, isWarning, icon, label, isDisabled, className, }: UseLogicParams) => {
|
|
5
|
+
isCompletedStep: boolean;
|
|
6
|
+
isRenderButton: boolean;
|
|
7
|
+
handleClick: () => void;
|
|
8
|
+
connectorVariant: "line" | "arrow";
|
|
9
|
+
alternativeLabel: boolean;
|
|
10
|
+
orientation: "horizontal" | "vertical";
|
|
11
|
+
stepId: number;
|
|
12
|
+
children: import("react").ReactNode;
|
|
13
|
+
isError: boolean | undefined;
|
|
14
|
+
isWarning: boolean | undefined;
|
|
15
|
+
icon: ((props: Omit<import("../../StepIcon").StepIconProps, "icon">) => import("react").ReactNode) | undefined;
|
|
16
|
+
className: string | undefined;
|
|
17
|
+
label: import("react").ReactNode;
|
|
18
|
+
isRenderVerticalLineConnector: boolean;
|
|
19
|
+
isRenderHorizontalLineConnector: boolean;
|
|
20
|
+
isDisabled: boolean;
|
|
21
|
+
isActiveStep: boolean;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useContext, useEffect } from 'react';
|
|
2
|
+
import { StepperContext } from '../../StepperContext';
|
|
3
|
+
export const useLogic = ({ stepId, isCompleted, onClick, children, isError, isWarning, icon, label, isDisabled, className, }) => {
|
|
4
|
+
const { connector, activeStep, orientation, alternativeLabel, onClickPrevStep, onClickStep, } = useContext(StepperContext);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const hasDescription = Boolean(children);
|
|
7
|
+
const isValidForDescription = orientation === 'vertical' &&
|
|
8
|
+
connector === 'line' &&
|
|
9
|
+
alternativeLabel === false;
|
|
10
|
+
if (hasDescription && !isValidForDescription) {
|
|
11
|
+
// biome-ignore lint/suspicious/noConsole: Сообщение для интеграторов
|
|
12
|
+
console.error('Stepper: description можно использовать только с комбинацией:\n' +
|
|
13
|
+
'orientation="vertical", connector="line", alternativeLabel=false');
|
|
14
|
+
}
|
|
15
|
+
}, []);
|
|
16
|
+
const isCompletedStep = isCompleted !== undefined ? isCompleted : activeStep > stepId;
|
|
17
|
+
const isClickableStep = Boolean(onClick) ||
|
|
18
|
+
Boolean(onClickStep) ||
|
|
19
|
+
(Boolean(onClickPrevStep) && isCompletedStep);
|
|
20
|
+
const isDisabledFromPrevOnlyMode = Boolean(onClickPrevStep) && !isClickableStep;
|
|
21
|
+
const isDisabledStep = Boolean(isDisabled) || isDisabledFromPrevOnlyMode;
|
|
22
|
+
const isRenderButton = Boolean(onClick) || Boolean(onClickPrevStep) || Boolean(onClickStep);
|
|
23
|
+
const handleClick = () => {
|
|
24
|
+
if (isDisabledStep) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (isCompletedStep && onClickPrevStep) {
|
|
28
|
+
onClickPrevStep(stepId);
|
|
29
|
+
}
|
|
30
|
+
onClickStep?.(stepId);
|
|
31
|
+
onClick?.(stepId);
|
|
32
|
+
};
|
|
33
|
+
const isRenderVerticalLineConnector = connector === 'line' && orientation === 'vertical' && !children;
|
|
34
|
+
const isRenderHorizontalLineConnector = connector === 'line' && orientation === 'horizontal' && alternativeLabel;
|
|
35
|
+
const isActiveStep = activeStep === stepId;
|
|
36
|
+
return {
|
|
37
|
+
isCompletedStep,
|
|
38
|
+
isRenderButton,
|
|
39
|
+
handleClick,
|
|
40
|
+
connectorVariant: connector,
|
|
41
|
+
alternativeLabel,
|
|
42
|
+
orientation,
|
|
43
|
+
stepId,
|
|
44
|
+
children,
|
|
45
|
+
isError,
|
|
46
|
+
isWarning,
|
|
47
|
+
icon,
|
|
48
|
+
className,
|
|
49
|
+
label,
|
|
50
|
+
isRenderVerticalLineConnector,
|
|
51
|
+
isRenderHorizontalLineConnector,
|
|
52
|
+
isDisabled: isDisabledStep,
|
|
53
|
+
isActiveStep,
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type StepIconProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Флаг активности шага
|
|
5
|
+
*/
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Флаг завершенности шага
|
|
9
|
+
*/
|
|
10
|
+
isCompleted?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Флаг ошибки шага
|
|
13
|
+
*/
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Флаг предупреждения шага
|
|
17
|
+
*/
|
|
18
|
+
isWarning?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Класс применяемый к корневому элементу
|
|
21
|
+
*/
|
|
22
|
+
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Кастомный компонент иконки
|
|
25
|
+
*/
|
|
26
|
+
icon?: (props: Omit<StepIconProps, 'icon'>) => ReactNode;
|
|
27
|
+
};
|
|
28
|
+
export declare const StepIcon: ({ icon: Icon, isActive, isCompleted, isError, isWarning, }: StepIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { StepDefaultFillMd } from '../../../icons/StepDefaultFillMd';
|
|
3
|
+
import { StepErrorFillMd } from '../../../icons/StepErrorFillMd';
|
|
4
|
+
import { StepSuccessFillMd } from '../../../icons/StepSuccessFillMd';
|
|
5
|
+
import { cva } from '../../utils/cva';
|
|
6
|
+
import { stepIconClassnames } from './constants';
|
|
7
|
+
const stepIcon = cva(stepIconClassnames.root, {
|
|
8
|
+
variants: {
|
|
9
|
+
isActive: {
|
|
10
|
+
true: stepIconClassnames.active,
|
|
11
|
+
},
|
|
12
|
+
isCompleted: {
|
|
13
|
+
true: stepIconClassnames.success,
|
|
14
|
+
},
|
|
15
|
+
isError: {
|
|
16
|
+
true: stepIconClassnames.error,
|
|
17
|
+
},
|
|
18
|
+
isWarning: {
|
|
19
|
+
true: stepIconClassnames.warning,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export const StepIcon = ({ icon: Icon, isActive, isCompleted, isError, isWarning, }) => {
|
|
24
|
+
if (Icon) {
|
|
25
|
+
return (_jsx(Icon, { isActive: isActive, isCompleted: isCompleted, isError: isError, isWarning: isWarning, className: stepIcon({ isActive, isCompleted, isError, isWarning }) }));
|
|
26
|
+
}
|
|
27
|
+
if (isError && !isActive) {
|
|
28
|
+
return _jsx(StepErrorFillMd, { className: stepIcon({ isError: true }) });
|
|
29
|
+
}
|
|
30
|
+
if ((isCompleted && !isActive) || (isCompleted && isWarning && !isActive)) {
|
|
31
|
+
return (_jsx(StepSuccessFillMd, { className: stepIcon({ isCompleted: true, isWarning }) }));
|
|
32
|
+
}
|
|
33
|
+
return (_jsx(StepDefaultFillMd, { className: stepIcon({ isActive, isCompleted, isError, isWarning }) }));
|
|
34
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createUIKitClassname } from '../../utils/createUIKitClassname';
|
|
2
|
+
export const stepIconClassnames = {
|
|
3
|
+
root: createUIKitClassname('step__icon'),
|
|
4
|
+
active: createUIKitClassname('step__icon_active'),
|
|
5
|
+
error: createUIKitClassname('step__icon_error'),
|
|
6
|
+
warning: createUIKitClassname('step__icon_warning'),
|
|
7
|
+
success: createUIKitClassname('step__icon_success'),
|
|
8
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type StepperContextProps = {
|
|
3
|
+
activeStep: number;
|
|
4
|
+
setActiveStep: (step: number) => void;
|
|
5
|
+
orientation: 'horizontal' | 'vertical';
|
|
6
|
+
connector: 'arrow' | 'line';
|
|
7
|
+
alternativeLabel: boolean;
|
|
8
|
+
onClickPrevStep?: (index: number) => void;
|
|
9
|
+
onClickStep?: (index: number) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const StepperContext: import("react").Context<StepperContextProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createContext } from 'react';
|
|
2
|
+
export const StepperContext = createContext({
|
|
3
|
+
activeStep: 0,
|
|
4
|
+
setActiveStep: () => undefined,
|
|
5
|
+
orientation: 'horizontal',
|
|
6
|
+
connector: 'line',
|
|
7
|
+
alternativeLabel: false,
|
|
8
|
+
onClickPrevStep: () => undefined,
|
|
9
|
+
onClickStep: () => undefined,
|
|
10
|
+
});
|
package/components/NewStepper/StepperContext/StepperContextProvider/StepperContextProvider.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type StepperContextProps } from '../StepperContext';
|
|
3
|
+
type Props = StepperContextProps & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const StepperContextProvider: ({ children, orientation, activeStep, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { StepperContext } from '../StepperContext';
|
|
4
|
+
export const StepperContextProvider = ({ children, orientation, activeStep, setActiveStep, connector, alternativeLabel, onClickPrevStep, onClickStep, }) => {
|
|
5
|
+
const contextValue = useMemo(() => ({
|
|
6
|
+
activeStep,
|
|
7
|
+
orientation,
|
|
8
|
+
setActiveStep,
|
|
9
|
+
connector,
|
|
10
|
+
alternativeLabel,
|
|
11
|
+
onClickPrevStep,
|
|
12
|
+
onClickStep,
|
|
13
|
+
}), [
|
|
14
|
+
activeStep,
|
|
15
|
+
orientation,
|
|
16
|
+
setActiveStep,
|
|
17
|
+
connector,
|
|
18
|
+
alternativeLabel,
|
|
19
|
+
onClickPrevStep,
|
|
20
|
+
onClickStep,
|
|
21
|
+
]);
|
|
22
|
+
return (_jsx(StepperContext.Provider, { value: contextValue, children: children }));
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StepperContextProvider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './StepperContextProvider';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const stepperClassnames: {
|
|
2
|
+
root: string;
|
|
3
|
+
lineConnector: string;
|
|
4
|
+
arrowConnector: string;
|
|
5
|
+
orientationHorizontal: string;
|
|
6
|
+
orientationVertical: string;
|
|
7
|
+
alternativeLabel: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
|
|
11
|
+
*/
|
|
12
|
+
export declare const MOBILE_ACTIVE_STEP_SCROLL_DEFER_MS = 300;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createUIKitClassname } from '../utils/createUIKitClassname';
|
|
2
|
+
export const stepperClassnames = {
|
|
3
|
+
root: createUIKitClassname('stepper'),
|
|
4
|
+
lineConnector: createUIKitClassname('stepper_connector-line'),
|
|
5
|
+
arrowConnector: createUIKitClassname('stepper_connector-arrow'),
|
|
6
|
+
orientationHorizontal: createUIKitClassname('stepper_orientation-horizontal'),
|
|
7
|
+
orientationVertical: createUIKitClassname('stepper_orientation-vertical'),
|
|
8
|
+
alternativeLabel: createUIKitClassname('stepper_alternative-label'),
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Задержка перед scrollIntoView после смены activeStep, что бы анимация появления текста завершилась
|
|
12
|
+
*/
|
|
13
|
+
export const MOBILE_ACTIVE_STEP_SCROLL_DEFER_MS = 300;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Wrapper: import("../styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|