@recursica/mantine-adapter 0.16.0 → 0.18.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/CHANGELOG.md +16 -0
- package/dist/mantine-adapter.cjs +1 -1
- package/dist/mantine-adapter.cjs.map +1 -1
- package/dist/mantine-adapter.css +1 -1
- package/dist/mantine-adapter.js +1677 -1505
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/OverStyling.d.ts +1 -0
- package/dist/src/Version.d.ts +1 -0
- package/dist/src/components/Container/Container.d.ts +8 -5
- package/dist/src/components/Flex/Flex.d.ts +10 -7
- package/dist/src/components/Group/Group.d.ts +8 -5
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +16 -3
- package/dist/src/components/Stack/Stack.d.ts +8 -5
- package/dist/src/components/Stepper/Stepper.d.ts +12 -2
- package/dist/src/components/Tabs/Tabs.d.ts +19 -3
- package/dist/src/components/index.d.ts +0 -2
- package/package.json +4 -3
- package/src/Introduction.stories.tsx +180 -0
- package/src/{OverStyling.stories.tsx → OverStyling.tsx} +23 -11
- package/src/{Version.stories.tsx → Version.tsx} +1 -13
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Container/Container.tsx +13 -17
- package/src/components/Flex/Flex.tsx +13 -17
- package/src/components/Group/Group.tsx +13 -17
- package/src/components/Pagination/Pagination.stories.tsx +0 -1
- package/src/components/Panel/Panel.stories.tsx +1 -1
- package/src/components/SegmentedControl/IMPLEMENTATION_NOTES.md +17 -0
- package/src/components/SegmentedControl/SegmentedControl.module.css +138 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +108 -6
- package/src/components/SegmentedControl/SegmentedControl.tsx +96 -5
- package/src/components/Stack/Stack.tsx +13 -17
- package/src/components/Stepper/Stepper.module.css +353 -0
- package/src/components/Stepper/Stepper.stories.tsx +135 -4
- package/src/components/Stepper/Stepper.tsx +68 -5
- package/src/components/Tabs/Tabs.module.css +401 -0
- package/src/components/Tabs/Tabs.stories.tsx +141 -4
- package/src/components/Tabs/Tabs.tsx +107 -5
- package/src/components/index.ts +0 -2
- package/dist/src/components/Popover/Popover.d.ts +0 -3
- package/dist/src/components/Search/Search.d.ts +0 -3
- package/src/components/Popover/Popover.stories.tsx +0 -17
- package/src/components/Popover/Popover.tsx +0 -7
- package/src/components/Search/Search.stories.tsx +0 -17
- package/src/components/Search/Search.tsx +0 -7
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Recursica Stepper CSS module natively binding to Figma variables.
|
|
3
|
+
|
|
4
|
+
HARDCODED CSS NOTE:
|
|
5
|
+
For horizontal layout, Mantine natively renders the text horizontally alongside the icon.
|
|
6
|
+
To achieve Recursica's layout where horizontal orientation stacks text below the icon,
|
|
7
|
+
we force `.step` to be a column, `.stepBody` to remove margin and text-align center,
|
|
8
|
+
and the `.separator`'s margin-top is dynamically calculated `calc((indicator-size / 2) - 1px)`
|
|
9
|
+
to ensure it continues to align with the vertical center of the indicator rather than the
|
|
10
|
+
whole step wrapper.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
.root {
|
|
14
|
+
/* Orientation specific gaps are mapped via data attributes */
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.root.horizontal .steps {
|
|
18
|
+
align-items: flex-start;
|
|
19
|
+
--stepper-step-gap: var(
|
|
20
|
+
--recursica_ui-kit_components_stepper_variants_orientation_horizontal_properties_step-gap
|
|
21
|
+
);
|
|
22
|
+
--stepper-max-text-width: var(
|
|
23
|
+
--recursica_ui-kit_components_stepper_variants_orientation_horizontal_properties_max-text-width
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.root.horizontal .step {
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: var(
|
|
31
|
+
--recursica_ui-kit_components_stepper_variants_orientation_horizontal_properties_indicator-label-gap
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.root.horizontal .stepBody {
|
|
36
|
+
width: var(--stepper-max-text-width);
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: flex-start;
|
|
41
|
+
margin-left: 0; /* Mantine natively applies a margin-inline-start */
|
|
42
|
+
gap: var(
|
|
43
|
+
--recursica_ui-kit_components_stepper_variants_orientation_horizontal_properties_label-description-gap
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.root.horizontal .stepLabel,
|
|
48
|
+
.root.horizontal .stepDescription {
|
|
49
|
+
width: max-content;
|
|
50
|
+
max-width: var(--stepper-max-text-width);
|
|
51
|
+
text-align: center;
|
|
52
|
+
white-space: normal;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.root.horizontal .separator {
|
|
56
|
+
align-self: flex-start; /* Force to top regardless of container alignment */
|
|
57
|
+
margin-top: calc(var(--stepper-indicator-size) / 2 - 1px);
|
|
58
|
+
margin-left: calc(
|
|
59
|
+
-1 * (var(--stepper-max-text-width) - var(--stepper-indicator-size)) / 2
|
|
60
|
+
);
|
|
61
|
+
margin-right: calc(
|
|
62
|
+
-1 * (var(--stepper-max-text-width) - var(--stepper-indicator-size)) / 2
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Vertical Orientation */
|
|
67
|
+
.root.vertical {
|
|
68
|
+
--stepper-step-gap: var(
|
|
69
|
+
--recursica_ui-kit_components_stepper_variants_orientation_vertical_properties_step-gap
|
|
70
|
+
);
|
|
71
|
+
--separator-spacing: 0px; /* Force the line to touch the circle */
|
|
72
|
+
--stepper-max-text-width: var(
|
|
73
|
+
--recursica_ui-kit_components_stepper_variants_orientation_vertical_properties_max-text-width
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.root.vertical .step {
|
|
78
|
+
gap: var(
|
|
79
|
+
--recursica_ui-kit_components_stepper_variants_orientation_vertical_properties_indicator-label-gap
|
|
80
|
+
);
|
|
81
|
+
margin-top: 0 !important; /* Remove Mantine's gap */
|
|
82
|
+
padding-bottom: var(
|
|
83
|
+
--stepper-step-gap
|
|
84
|
+
); /* Move gap inside the step so the separator line can stretch through it */
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.root.vertical .step:last-of-type {
|
|
88
|
+
padding-bottom: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.root.vertical .stepBody {
|
|
92
|
+
gap: var(
|
|
93
|
+
--recursica_ui-kit_components_stepper_variants_orientation_vertical_properties_label-description-gap
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Sizes */
|
|
98
|
+
.large {
|
|
99
|
+
--stepper-icon-size: var(
|
|
100
|
+
--recursica_ui-kit_components_stepper_variants_sizes_large_properties_indicator-size
|
|
101
|
+
); /* Maps to Mantine's circle size */
|
|
102
|
+
--stepper-indicator-size: var(
|
|
103
|
+
--recursica_ui-kit_components_stepper_variants_sizes_large_properties_indicator-size
|
|
104
|
+
);
|
|
105
|
+
--stepper-border-size: var(
|
|
106
|
+
--recursica_ui-kit_components_stepper_variants_sizes_large_properties_indicator-border-size
|
|
107
|
+
);
|
|
108
|
+
--stepper-border-radius: var(
|
|
109
|
+
--recursica_ui-kit_components_stepper_variants_sizes_large_properties_indicator-border-radius
|
|
110
|
+
);
|
|
111
|
+
--stepper-font-size: var(
|
|
112
|
+
--recursica_ui-kit_components_stepper_variants_sizes_large_properties_step-number-font-size
|
|
113
|
+
);
|
|
114
|
+
--stepper-svg-size: var(
|
|
115
|
+
--recursica_ui-kit_components_stepper_variants_sizes_large_properties_completed-icon-size
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.small {
|
|
120
|
+
--stepper-icon-size: var(
|
|
121
|
+
--recursica_ui-kit_components_stepper_variants_sizes_small_properties_indicator-size
|
|
122
|
+
); /* Maps to Mantine's circle size */
|
|
123
|
+
--stepper-indicator-size: var(
|
|
124
|
+
--recursica_ui-kit_components_stepper_variants_sizes_small_properties_indicator-size
|
|
125
|
+
);
|
|
126
|
+
--stepper-border-size: var(
|
|
127
|
+
--recursica_ui-kit_components_stepper_variants_sizes_small_properties_indicator-border-size
|
|
128
|
+
);
|
|
129
|
+
--stepper-border-radius: var(
|
|
130
|
+
--recursica_ui-kit_components_stepper_variants_sizes_small_properties_indicator-border-radius
|
|
131
|
+
);
|
|
132
|
+
--stepper-font-size: var(
|
|
133
|
+
--recursica_ui-kit_components_stepper_variants_sizes_small_properties_step-number-font-size
|
|
134
|
+
);
|
|
135
|
+
--stepper-svg-size: var(
|
|
136
|
+
--recursica_ui-kit_components_stepper_variants_sizes_small_properties_completed-icon-size
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Core Element Structuring using mapped variables */
|
|
141
|
+
.root .step {
|
|
142
|
+
/* Default to Mantine's native flex behavior (stretch) so the vertical separator spans the full height */
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.root .stepBody {
|
|
146
|
+
max-width: var(--stepper-max-text-width);
|
|
147
|
+
display: flex;
|
|
148
|
+
flex-direction: column;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.root .stepLabel {
|
|
152
|
+
font-family: var(
|
|
153
|
+
--recursica_ui-kit_components_stepper_properties_label-text_font-family
|
|
154
|
+
);
|
|
155
|
+
font-size: var(
|
|
156
|
+
--recursica_ui-kit_components_stepper_properties_label-text_font-size
|
|
157
|
+
);
|
|
158
|
+
font-style: var(
|
|
159
|
+
--recursica_ui-kit_components_stepper_properties_label-text_font-style
|
|
160
|
+
);
|
|
161
|
+
font-weight: var(
|
|
162
|
+
--recursica_ui-kit_components_stepper_properties_label-text_font-weight
|
|
163
|
+
);
|
|
164
|
+
letter-spacing: var(
|
|
165
|
+
--recursica_ui-kit_components_stepper_properties_label-text_letter-spacing
|
|
166
|
+
);
|
|
167
|
+
line-height: var(
|
|
168
|
+
--recursica_ui-kit_components_stepper_properties_label-text_line-height
|
|
169
|
+
);
|
|
170
|
+
text-decoration: var(
|
|
171
|
+
--recursica_ui-kit_components_stepper_properties_label-text_text-decoration
|
|
172
|
+
);
|
|
173
|
+
text-transform: var(
|
|
174
|
+
--recursica_ui-kit_components_stepper_properties_label-text_text-transform
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.root .stepDescription {
|
|
179
|
+
font-family: var(
|
|
180
|
+
--recursica_ui-kit_components_stepper_properties_description-text_font-family
|
|
181
|
+
);
|
|
182
|
+
font-size: var(
|
|
183
|
+
--recursica_ui-kit_components_stepper_properties_description-text_font-size
|
|
184
|
+
);
|
|
185
|
+
font-style: var(
|
|
186
|
+
--recursica_ui-kit_components_stepper_properties_description-text_font-style
|
|
187
|
+
);
|
|
188
|
+
font-weight: var(
|
|
189
|
+
--recursica_ui-kit_components_stepper_properties_description-text_font-weight
|
|
190
|
+
);
|
|
191
|
+
letter-spacing: var(
|
|
192
|
+
--recursica_ui-kit_components_stepper_properties_description-text_letter-spacing
|
|
193
|
+
);
|
|
194
|
+
line-height: var(
|
|
195
|
+
--recursica_ui-kit_components_stepper_properties_description-text_line-height
|
|
196
|
+
);
|
|
197
|
+
text-decoration: var(
|
|
198
|
+
--recursica_ui-kit_components_stepper_properties_description-text_text-decoration
|
|
199
|
+
);
|
|
200
|
+
text-transform: var(
|
|
201
|
+
--recursica_ui-kit_components_stepper_properties_description-text_text-transform
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.root .stepIcon {
|
|
206
|
+
width: var(--stepper-indicator-size);
|
|
207
|
+
height: var(--stepper-indicator-size);
|
|
208
|
+
min-width: var(--stepper-indicator-size);
|
|
209
|
+
min-height: var(--stepper-indicator-size);
|
|
210
|
+
border-width: var(--stepper-border-size);
|
|
211
|
+
border-radius: 50%; /* Override Figma token to ensure perfectly circular indicators */
|
|
212
|
+
font-size: var(--stepper-font-size);
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
justify-content: center;
|
|
216
|
+
/* Font details are implicitly mapped by sizes, but colors map to states */
|
|
217
|
+
/* Upcoming State (Pending) - Default */
|
|
218
|
+
background-color: var(
|
|
219
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-indicator-background
|
|
220
|
+
);
|
|
221
|
+
border-color: var(
|
|
222
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-indicator-border-color
|
|
223
|
+
);
|
|
224
|
+
color: var(
|
|
225
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-indicator-text
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Completed State */
|
|
230
|
+
.root .stepIcon[data-completed] {
|
|
231
|
+
background-color: var(
|
|
232
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-indicator-background
|
|
233
|
+
);
|
|
234
|
+
border-color: var(
|
|
235
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-indicator-border-color
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.root .stepCompletedIcon {
|
|
240
|
+
color: var(
|
|
241
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-indicator-text
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.root .stepCompletedIcon svg {
|
|
246
|
+
width: var(--stepper-svg-size);
|
|
247
|
+
height: var(--stepper-svg-size);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.root .step[data-progress="completed"] .stepLabel {
|
|
251
|
+
color: var(
|
|
252
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-label-color
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.root .step[data-progress="completed"] .stepDescription {
|
|
257
|
+
color: var(
|
|
258
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-description-color
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/* Current State (Progressing) */
|
|
263
|
+
.root .stepIcon[data-progress] {
|
|
264
|
+
background-color: var(
|
|
265
|
+
--recursica_ui-kit_components_stepper_properties_colors_current-indicator-background
|
|
266
|
+
);
|
|
267
|
+
border-color: var(
|
|
268
|
+
--recursica_ui-kit_components_stepper_properties_colors_current-indicator-border-color
|
|
269
|
+
);
|
|
270
|
+
color: var(
|
|
271
|
+
--recursica_ui-kit_components_stepper_properties_colors_current-indicator-text
|
|
272
|
+
);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.root .step[data-progress="progress"] .stepLabel {
|
|
276
|
+
color: var(
|
|
277
|
+
--recursica_ui-kit_components_stepper_properties_colors_current-label-color
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.root .step[data-progress="progress"] .stepDescription {
|
|
282
|
+
color: var(
|
|
283
|
+
--recursica_ui-kit_components_stepper_properties_colors_current-description-color
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* Upcoming State (Pending Labels) */
|
|
288
|
+
.root .step[data-progress="pending"] .stepLabel {
|
|
289
|
+
color: var(
|
|
290
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-label-color
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.root .step[data-progress="pending"] .stepDescription {
|
|
295
|
+
color: var(
|
|
296
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-description-color
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* Horizontal Separator */
|
|
301
|
+
.root .separator {
|
|
302
|
+
margin: 0 var(--stepper-step-gap); /* Apply the gap logic to the separator natively */
|
|
303
|
+
background-color: var(
|
|
304
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-connector-color
|
|
305
|
+
);
|
|
306
|
+
height: var(
|
|
307
|
+
--recursica_ui-kit_components_stepper_properties_upcoming-connector-size
|
|
308
|
+
);
|
|
309
|
+
border: none;
|
|
310
|
+
min-width: 20px;
|
|
311
|
+
flex: 1;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.root .separator[data-active] {
|
|
315
|
+
background-color: var(
|
|
316
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-connector-color
|
|
317
|
+
);
|
|
318
|
+
height: var(
|
|
319
|
+
--recursica_ui-kit_components_stepper_properties_completed-connector-size
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/* Vertical Separator */
|
|
324
|
+
.root .verticalSeparator {
|
|
325
|
+
border-inline-start: var(
|
|
326
|
+
--recursica_ui-kit_components_stepper_properties_upcoming-connector-size
|
|
327
|
+
)
|
|
328
|
+
solid
|
|
329
|
+
var(
|
|
330
|
+
--recursica_ui-kit_components_stepper_properties_colors_upcoming-connector-color
|
|
331
|
+
);
|
|
332
|
+
top: var(
|
|
333
|
+
--stepper-icon-size
|
|
334
|
+
); /* Overrides Mantine's gap math to force the line to touch the icon */
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.root .verticalSeparator[data-active] {
|
|
338
|
+
border-inline-start: var(
|
|
339
|
+
--recursica_ui-kit_components_stepper_properties_completed-connector-size
|
|
340
|
+
)
|
|
341
|
+
solid
|
|
342
|
+
var(
|
|
343
|
+
--recursica_ui-kit_components_stepper_properties_colors_completed-connector-color
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/* Hide Content
|
|
348
|
+
Recursica Steppers are purely navigational/structural. Content should be managed
|
|
349
|
+
by the parent layout outside of the Stepper DOM.
|
|
350
|
+
*/
|
|
351
|
+
.root .content {
|
|
352
|
+
display: none;
|
|
353
|
+
}
|
|
@@ -1,17 +1,148 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
3
|
import { Stepper } from "./Stepper";
|
|
3
|
-
import {
|
|
4
|
+
import { Button } from "../Button/Button";
|
|
5
|
+
import { Group } from "../Group/Group";
|
|
6
|
+
import { Flex } from "../Flex/Flex";
|
|
4
7
|
|
|
5
8
|
const meta: Meta<typeof Stepper> = {
|
|
6
|
-
title: "UI-Kit
|
|
9
|
+
title: "UI-Kit/Stepper",
|
|
7
10
|
component: Stepper,
|
|
8
11
|
tags: ["autodocs"],
|
|
12
|
+
parameters: {
|
|
13
|
+
layout: "centered",
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component: `
|
|
17
|
+
The \`Stepper\` component provides a visual progression interface strictly mapped to Recursica's UI-Kit.
|
|
18
|
+
This component wraps Mantine's \`Stepper\` and natively enforces Figma tokens for sizes, colors, gaps, and states (\`completed\`, \`current\`, \`upcoming\`).
|
|
19
|
+
|
|
20
|
+
### Layout & Orientation
|
|
21
|
+
Orientation dictates how the steps flow:
|
|
22
|
+
- **horizontal**: Steps render side-by-side.
|
|
23
|
+
- **vertical**: Steps stack vertically, mapping seamlessly to the vertical gap tokens.
|
|
24
|
+
`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
argTypes: {
|
|
29
|
+
size: {
|
|
30
|
+
control: "radio",
|
|
31
|
+
options: ["small", "large"],
|
|
32
|
+
},
|
|
33
|
+
orientation: {
|
|
34
|
+
control: "radio",
|
|
35
|
+
options: ["horizontal", "vertical"],
|
|
36
|
+
},
|
|
37
|
+
defaultChecked: {
|
|
38
|
+
table: { disable: true },
|
|
39
|
+
},
|
|
40
|
+
},
|
|
9
41
|
};
|
|
10
42
|
|
|
11
43
|
export default meta;
|
|
12
|
-
|
|
13
44
|
type Story = StoryObj<typeof Stepper>;
|
|
14
45
|
|
|
46
|
+
const InteractiveStepper = (args: React.ComponentProps<typeof Stepper>) => {
|
|
47
|
+
const [active, setActive] = useState(1);
|
|
48
|
+
const nextStep = () =>
|
|
49
|
+
setActive((current) => (current < 3 ? current + 1 : current));
|
|
50
|
+
const prevStep = () =>
|
|
51
|
+
setActive((current) => (current > 0 ? current - 1 : current));
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Flex direction="column" w={600}>
|
|
55
|
+
<Stepper {...args} active={active} onStepClick={setActive}>
|
|
56
|
+
<Stepper.Step
|
|
57
|
+
label="First step"
|
|
58
|
+
description="Create an account and set up your billing profile"
|
|
59
|
+
/>
|
|
60
|
+
<Stepper.Step
|
|
61
|
+
label="Second step"
|
|
62
|
+
description="Verify email and ensure all notification preferences are correct"
|
|
63
|
+
/>
|
|
64
|
+
<Stepper.Step label="Final step" description="Get full access" />
|
|
65
|
+
<Stepper.Completed>
|
|
66
|
+
Completed, click back button to get to previous step
|
|
67
|
+
</Stepper.Completed>
|
|
68
|
+
</Stepper>
|
|
69
|
+
|
|
70
|
+
<Group mt={24} justify="center" gap={8}>
|
|
71
|
+
<Button variant="outline" onClick={prevStep} disabled={active === 0}>
|
|
72
|
+
Previous step
|
|
73
|
+
</Button>
|
|
74
|
+
<Button variant="outline" onClick={nextStep} disabled={active === 3}>
|
|
75
|
+
Next step
|
|
76
|
+
</Button>
|
|
77
|
+
</Group>
|
|
78
|
+
</Flex>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
|
|
15
82
|
export const Default: Story = {
|
|
16
|
-
render: () => <
|
|
83
|
+
render: (args) => <InteractiveStepper {...args} />,
|
|
84
|
+
args: {
|
|
85
|
+
size: "large",
|
|
86
|
+
orientation: "horizontal",
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const Small: Story = {
|
|
91
|
+
render: (args) => <InteractiveStepper {...args} />,
|
|
92
|
+
args: {
|
|
93
|
+
size: "small",
|
|
94
|
+
orientation: "horizontal",
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const Vertical: Story = {
|
|
99
|
+
render: (args) => <InteractiveStepper {...args} />,
|
|
100
|
+
args: {
|
|
101
|
+
size: "large",
|
|
102
|
+
orientation: "vertical",
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const StressTestStepper = (args: React.ComponentProps<typeof Stepper>) => {
|
|
107
|
+
const [active, setActive] = useState(1);
|
|
108
|
+
const nextStep = () =>
|
|
109
|
+
setActive((current) => (current < 3 ? current + 1 : current));
|
|
110
|
+
const prevStep = () =>
|
|
111
|
+
setActive((current) => (current > 0 ? current - 1 : current));
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<Flex direction="column" w={600}>
|
|
115
|
+
<Stepper {...args} active={active} onStepClick={setActive}>
|
|
116
|
+
<Stepper.Step
|
|
117
|
+
label="This is an extremely long step title designed to test how the layout handles multiline text wrapping and constraints"
|
|
118
|
+
description="Create an account and set up your billing profile"
|
|
119
|
+
/>
|
|
120
|
+
<Stepper.Step
|
|
121
|
+
label="Second step"
|
|
122
|
+
description="Verify email and ensure all notification preferences are correct"
|
|
123
|
+
/>
|
|
124
|
+
<Stepper.Step label="Final step" />
|
|
125
|
+
<Stepper.Completed>
|
|
126
|
+
Completed, click back button to get to previous step
|
|
127
|
+
</Stepper.Completed>
|
|
128
|
+
</Stepper>
|
|
129
|
+
|
|
130
|
+
<Group mt={24} justify="center" gap={8}>
|
|
131
|
+
<Button variant="outline" onClick={prevStep} disabled={active === 0}>
|
|
132
|
+
Previous step
|
|
133
|
+
</Button>
|
|
134
|
+
<Button variant="outline" onClick={nextStep} disabled={active === 3}>
|
|
135
|
+
Next step
|
|
136
|
+
</Button>
|
|
137
|
+
</Group>
|
|
138
|
+
</Flex>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
export const LayoutStressTest: Story = {
|
|
143
|
+
render: (args) => <StressTestStepper {...args} />,
|
|
144
|
+
args: {
|
|
145
|
+
size: "large",
|
|
146
|
+
orientation: "horizontal",
|
|
147
|
+
},
|
|
17
148
|
};
|
|
@@ -1,7 +1,70 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Stepper as MantineStepper,
|
|
4
|
+
type StepperProps as MantineStepperProps,
|
|
5
|
+
} from "@mantine/core";
|
|
6
|
+
import {
|
|
7
|
+
filterStylingProps,
|
|
8
|
+
type RecursicaOverStyled,
|
|
9
|
+
} from "../../utils/filterStylingProps";
|
|
10
|
+
import styles from "./Stepper.module.css";
|
|
2
11
|
|
|
3
|
-
export
|
|
12
|
+
export interface RecursicaStepperProps
|
|
13
|
+
extends Omit<
|
|
14
|
+
MantineStepperProps,
|
|
15
|
+
"size" | "color" | "radius" | "iconSize" | "contentPadding"
|
|
16
|
+
> {
|
|
17
|
+
size?: "small" | "large";
|
|
18
|
+
}
|
|
4
19
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
export type StepperProps = RecursicaOverStyled<RecursicaStepperProps>;
|
|
21
|
+
|
|
22
|
+
const _Stepper = forwardRef<HTMLDivElement, StepperProps>(
|
|
23
|
+
function Stepper(props, ref) {
|
|
24
|
+
const {
|
|
25
|
+
overStyled = false,
|
|
26
|
+
size = "large",
|
|
27
|
+
orientation = "horizontal",
|
|
28
|
+
className,
|
|
29
|
+
style,
|
|
30
|
+
...rest
|
|
31
|
+
} = props;
|
|
32
|
+
|
|
33
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<MantineStepper
|
|
37
|
+
ref={ref}
|
|
38
|
+
orientation={orientation}
|
|
39
|
+
className={`${styles.root} ${orientation === "horizontal" ? styles.horizontal : styles.vertical} ${size === "large" ? styles.large : styles.small} ${className || ""}`}
|
|
40
|
+
style={style as React.CSSProperties}
|
|
41
|
+
data-size={size}
|
|
42
|
+
data-orientation={orientation}
|
|
43
|
+
classNames={{
|
|
44
|
+
steps: styles.steps,
|
|
45
|
+
step: styles.step,
|
|
46
|
+
stepIcon: styles.stepIcon,
|
|
47
|
+
stepCompletedIcon: styles.stepCompletedIcon,
|
|
48
|
+
stepBody: styles.stepBody,
|
|
49
|
+
stepLabel: styles.stepLabel,
|
|
50
|
+
stepDescription: styles.stepDescription,
|
|
51
|
+
separator: styles.separator,
|
|
52
|
+
verticalSeparator: styles.verticalSeparator,
|
|
53
|
+
content: styles.content,
|
|
54
|
+
}}
|
|
55
|
+
{...(sanitizedProps as MantineStepperProps)}
|
|
56
|
+
/>
|
|
57
|
+
);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
// We need to re-export the static components Step and Completed
|
|
62
|
+
export const Stepper: typeof _Stepper & {
|
|
63
|
+
Step: typeof MantineStepper.Step;
|
|
64
|
+
Completed: typeof MantineStepper.Completed;
|
|
65
|
+
} = Object.assign(_Stepper, {
|
|
66
|
+
Step: MantineStepper.Step,
|
|
67
|
+
Completed: MantineStepper.Completed,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
_Stepper.displayName = "Stepper";
|