@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,401 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Recursica Tabs CSS module natively binding to Figma variables.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
.root {
|
|
6
|
+
width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
Mantine Tabs Anatomy:
|
|
11
|
+
.root
|
|
12
|
+
.list (container for tabs)
|
|
13
|
+
.tab (individual tab)
|
|
14
|
+
.panel (content)
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/* ---------------------------------
|
|
18
|
+
ORIENTATION & SPACING
|
|
19
|
+
--------------------------------- */
|
|
20
|
+
|
|
21
|
+
/* Horizontal Orientation */
|
|
22
|
+
.root[data-orientation="horizontal"] {
|
|
23
|
+
--tabs-element-gap: var(
|
|
24
|
+
--recursica_ui-kit_components_tabs_variants_orientation_horizontal_properties_element-gap
|
|
25
|
+
);
|
|
26
|
+
--tabs-horizontal-padding: var(
|
|
27
|
+
--recursica_ui-kit_components_tabs_variants_orientation_horizontal_properties_horizontal-padding
|
|
28
|
+
);
|
|
29
|
+
--tabs-icon-size: var(
|
|
30
|
+
--recursica_ui-kit_components_tabs_variants_orientation_horizontal_properties_icon-size
|
|
31
|
+
);
|
|
32
|
+
--tabs-space-between-tabs: var(
|
|
33
|
+
--recursica_ui-kit_components_tabs_variants_orientation_horizontal_properties_space-between-tabs
|
|
34
|
+
);
|
|
35
|
+
--tabs-vertical-padding: var(
|
|
36
|
+
--recursica_ui-kit_components_tabs_variants_orientation_horizontal_properties_vertical-padding
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.root[data-orientation="horizontal"] .list {
|
|
41
|
+
gap: var(--tabs-space-between-tabs);
|
|
42
|
+
width: 100%;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* Vertical Orientation */
|
|
46
|
+
.root[data-orientation="vertical"] {
|
|
47
|
+
--tabs-element-gap: var(
|
|
48
|
+
--recursica_ui-kit_components_tabs_variants_orientation_vertical_properties_element-gap
|
|
49
|
+
);
|
|
50
|
+
--tabs-horizontal-padding: var(
|
|
51
|
+
--recursica_ui-kit_components_tabs_variants_orientation_vertical_properties_horizontal-padding
|
|
52
|
+
);
|
|
53
|
+
--tabs-icon-size: var(
|
|
54
|
+
--recursica_ui-kit_components_tabs_variants_orientation_vertical_properties_icon-size
|
|
55
|
+
);
|
|
56
|
+
--tabs-space-between-tabs: var(
|
|
57
|
+
--recursica_ui-kit_components_tabs_variants_orientation_vertical_properties_space-between-tabs
|
|
58
|
+
);
|
|
59
|
+
--tabs-vertical-padding: var(
|
|
60
|
+
--recursica_ui-kit_components_tabs_variants_orientation_vertical_properties_vertical-padding
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.root[data-orientation="vertical"] .list {
|
|
65
|
+
gap: var(--tabs-space-between-tabs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* ---------------------------------
|
|
69
|
+
VARIANTS
|
|
70
|
+
--------------------------------- */
|
|
71
|
+
|
|
72
|
+
.root[data-variant="default"][data-orientation] {
|
|
73
|
+
--tabs-active-border-size: var(
|
|
74
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_active_border-size
|
|
75
|
+
) !important;
|
|
76
|
+
--tabs-inactive-border-size: var(
|
|
77
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_inactive_border-size
|
|
78
|
+
) !important;
|
|
79
|
+
--tabs-border-radius: var(
|
|
80
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_border-radius
|
|
81
|
+
) !important;
|
|
82
|
+
--tabs-border-color: var(
|
|
83
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_inactive_colors_border-color
|
|
84
|
+
) !important;
|
|
85
|
+
--tabs-color: var(
|
|
86
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_active_colors_border-color
|
|
87
|
+
) !important;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.root[data-variant="default"][data-orientation="horizontal"] .list {
|
|
91
|
+
margin-bottom: var(
|
|
92
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_orientation_horizontal_properties_tabs-content-gap
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.root[data-variant="default"][data-orientation="vertical"] .list {
|
|
97
|
+
margin-right: var(
|
|
98
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_orientation_vertical_properties_tabs-content-gap
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* Outline Variant */
|
|
103
|
+
.root[data-variant="outline"][data-orientation] {
|
|
104
|
+
--tabs-active-border-size: var(
|
|
105
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_active_border-size
|
|
106
|
+
) !important;
|
|
107
|
+
--tabs-inactive-border-size: var(
|
|
108
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_inactive_border-size
|
|
109
|
+
) !important;
|
|
110
|
+
--tabs-border-radius: var(
|
|
111
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_border-radius
|
|
112
|
+
) !important;
|
|
113
|
+
--tabs-border-color: var(
|
|
114
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_inactive_colors_border-color
|
|
115
|
+
) !important;
|
|
116
|
+
--tabs-color: var(
|
|
117
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_active_colors_border-color
|
|
118
|
+
) !important;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.root[data-variant="outline"][data-orientation="horizontal"] .list {
|
|
122
|
+
margin-bottom: var(
|
|
123
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_orientation_horizontal_properties_tabs-content-gap
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.root[data-variant="outline"][data-orientation="vertical"] .list {
|
|
128
|
+
margin-right: var(
|
|
129
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_orientation_vertical_properties_tabs-content-gap
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Pills Variant */
|
|
134
|
+
.root[data-variant="pills"][data-orientation] {
|
|
135
|
+
--tabs-active-border-size: var(
|
|
136
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_active_border-size
|
|
137
|
+
);
|
|
138
|
+
--tabs-inactive-border-size: var(
|
|
139
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_inactive_border-size
|
|
140
|
+
);
|
|
141
|
+
--tabs-border-radius: var(
|
|
142
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_border-radius
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.root[data-variant="pills"][data-orientation="horizontal"] .list {
|
|
147
|
+
margin-bottom: var(
|
|
148
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_orientation_horizontal_properties_tabs-content-gap
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.root[data-variant="pills"][data-orientation="vertical"] .list {
|
|
153
|
+
margin-right: var(
|
|
154
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_orientation_vertical_properties_tabs-content-gap
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* ---------------------------------
|
|
159
|
+
TAB ELEMENT
|
|
160
|
+
--------------------------------- */
|
|
161
|
+
.root .tab {
|
|
162
|
+
min-width: var(--recursica_ui-kit_components_tabs_properties_min-width);
|
|
163
|
+
max-width: var(--recursica_ui-kit_components_tabs_properties_max-width);
|
|
164
|
+
padding: var(--tabs-vertical-padding) var(--tabs-horizontal-padding);
|
|
165
|
+
gap: var(--tabs-element-gap);
|
|
166
|
+
display: flex;
|
|
167
|
+
align-items: center;
|
|
168
|
+
/* Alignment can be mapped if defined */
|
|
169
|
+
justify-content: flex-start;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
position: relative;
|
|
172
|
+
|
|
173
|
+
/* Typography (Inactive by default) */
|
|
174
|
+
font-family: var(
|
|
175
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_font-family
|
|
176
|
+
);
|
|
177
|
+
font-size: var(
|
|
178
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_font-size
|
|
179
|
+
);
|
|
180
|
+
font-style: var(
|
|
181
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_font-style
|
|
182
|
+
);
|
|
183
|
+
font-weight: var(
|
|
184
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_font-weight
|
|
185
|
+
);
|
|
186
|
+
letter-spacing: var(
|
|
187
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_letter-spacing
|
|
188
|
+
);
|
|
189
|
+
line-height: var(
|
|
190
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_line-height
|
|
191
|
+
);
|
|
192
|
+
text-decoration: var(
|
|
193
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_text-decoration
|
|
194
|
+
);
|
|
195
|
+
text-transform: var(
|
|
196
|
+
--recursica_ui-kit_components_tabs_properties_inactive-text_text-transform
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Hover effect (moved to bottom for specificity, see end of file) */
|
|
201
|
+
|
|
202
|
+
.root .tab[data-active] {
|
|
203
|
+
font-family: var(
|
|
204
|
+
--recursica_ui-kit_components_tabs_properties_active-text_font-family
|
|
205
|
+
);
|
|
206
|
+
font-size: var(
|
|
207
|
+
--recursica_ui-kit_components_tabs_properties_active-text_font-size
|
|
208
|
+
);
|
|
209
|
+
font-style: var(
|
|
210
|
+
--recursica_ui-kit_components_tabs_properties_active-text_font-style
|
|
211
|
+
);
|
|
212
|
+
font-weight: var(
|
|
213
|
+
--recursica_ui-kit_components_tabs_properties_active-text_font-weight
|
|
214
|
+
);
|
|
215
|
+
letter-spacing: var(
|
|
216
|
+
--recursica_ui-kit_components_tabs_properties_active-text_letter-spacing
|
|
217
|
+
);
|
|
218
|
+
line-height: var(
|
|
219
|
+
--recursica_ui-kit_components_tabs_properties_active-text_line-height
|
|
220
|
+
);
|
|
221
|
+
text-decoration: var(
|
|
222
|
+
--recursica_ui-kit_components_tabs_properties_active-text_text-decoration
|
|
223
|
+
);
|
|
224
|
+
text-transform: var(
|
|
225
|
+
--recursica_ui-kit_components_tabs_properties_active-text_text-transform
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* Icon support */
|
|
230
|
+
.root .tab svg {
|
|
231
|
+
width: var(--tabs-icon-size);
|
|
232
|
+
height: var(--tabs-icon-size);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/* Disabled State */
|
|
236
|
+
.root .tab[data-disabled] {
|
|
237
|
+
opacity: var(--recursica_brand_states_disabled);
|
|
238
|
+
cursor: not-allowed;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* ---------------------------------
|
|
242
|
+
COLORS
|
|
243
|
+
Because colors are defined per-layer and theme via generic variable structures,
|
|
244
|
+
we rely on Mantine injecting the correct data-variant attributes, but we must
|
|
245
|
+
map the colors in our CSS. Recursica handles dark/light automatically via root.
|
|
246
|
+
--------------------------------- */
|
|
247
|
+
|
|
248
|
+
/* ---------------------------------
|
|
249
|
+
BORDER RADIUS GEOMETRY
|
|
250
|
+
--------------------------------- */
|
|
251
|
+
|
|
252
|
+
/* Pills get full radius on all sides */
|
|
253
|
+
.root[data-variant="pills"] .tab {
|
|
254
|
+
border-radius: var(--tabs-border-radius);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* Default & Outline Horizontal get top radius only so they sit flush on the panel */
|
|
258
|
+
.root[data-variant="default"][data-orientation="horizontal"]:not(
|
|
259
|
+
[data-inverted]
|
|
260
|
+
)
|
|
261
|
+
.tab,
|
|
262
|
+
.root[data-variant="outline"][data-orientation="horizontal"]:not(
|
|
263
|
+
[data-inverted]
|
|
264
|
+
)
|
|
265
|
+
.tab {
|
|
266
|
+
border-radius: var(--tabs-border-radius) var(--tabs-border-radius) 0 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* Inverted horizontal tabs hang downwards, so bottom corners are rounded */
|
|
270
|
+
.root[data-variant="default"][data-orientation="horizontal"][data-inverted]
|
|
271
|
+
.tab,
|
|
272
|
+
.root[data-variant="outline"][data-orientation="horizontal"][data-inverted]
|
|
273
|
+
.tab {
|
|
274
|
+
border-radius: 0 0 var(--tabs-border-radius) var(--tabs-border-radius);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Default & Outline Vertical get left radius only so they sit flush against the right-side panel */
|
|
278
|
+
.root[data-variant="default"][data-orientation="vertical"] .tab,
|
|
279
|
+
.root[data-variant="outline"][data-orientation="vertical"] .tab {
|
|
280
|
+
border-radius: var(--tabs-border-radius) 0 0 var(--tabs-border-radius);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* Default Variant Colors */
|
|
284
|
+
.root[data-variant="default"] .tab {
|
|
285
|
+
background-color: var(
|
|
286
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_inactive_colors_background
|
|
287
|
+
);
|
|
288
|
+
color: var(
|
|
289
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_inactive_colors_text-color
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
.root[data-variant="default"] .tab svg {
|
|
293
|
+
color: var(
|
|
294
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_inactive_colors_icon-color
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.root[data-variant="default"] .tab[data-active] {
|
|
299
|
+
background-color: var(
|
|
300
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_active_colors_background
|
|
301
|
+
);
|
|
302
|
+
color: var(
|
|
303
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_active_colors_text-color
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
.root[data-variant="default"] .tab[data-active] svg {
|
|
307
|
+
color: var(
|
|
308
|
+
--recursica_ui-kit_components_tabs_variants_styles_default_properties_active_colors_icon-color
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Outline Variant Colors */
|
|
313
|
+
.root[data-variant="outline"] .tab {
|
|
314
|
+
background-color: var(
|
|
315
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_inactive_colors_background
|
|
316
|
+
);
|
|
317
|
+
color: var(
|
|
318
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_inactive_colors_text-color
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
.root[data-variant="outline"] .tab svg {
|
|
322
|
+
color: var(
|
|
323
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_inactive_colors_icon-color
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.root[data-variant="outline"] .tab[data-active] {
|
|
328
|
+
background-color: var(
|
|
329
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_active_colors_background
|
|
330
|
+
);
|
|
331
|
+
color: var(
|
|
332
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_active_colors_text-color
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
.root[data-variant="outline"] .tab[data-active] svg {
|
|
336
|
+
color: var(
|
|
337
|
+
--recursica_ui-kit_components_tabs_variants_styles_outline_properties_active_colors_icon-color
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/* Pills Variant Colors */
|
|
342
|
+
.root[data-variant="pills"] .tab {
|
|
343
|
+
background-color: var(
|
|
344
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_inactive_colors_background
|
|
345
|
+
);
|
|
346
|
+
color: var(
|
|
347
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_inactive_colors_text-color
|
|
348
|
+
);
|
|
349
|
+
border: var(--tabs-inactive-border-size) solid
|
|
350
|
+
var(
|
|
351
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_inactive_colors_border-color
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
.root[data-variant="pills"] .tab svg {
|
|
355
|
+
color: var(
|
|
356
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_inactive_colors_icon-color
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.root[data-variant="pills"] .tab[data-active] {
|
|
361
|
+
background-color: var(
|
|
362
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_active_colors_background
|
|
363
|
+
);
|
|
364
|
+
color: var(
|
|
365
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_active_colors_text-color
|
|
366
|
+
);
|
|
367
|
+
border: var(--tabs-active-border-size) solid
|
|
368
|
+
var(
|
|
369
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_active_colors_border-color
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
.root[data-variant="pills"] .tab[data-active] svg {
|
|
373
|
+
color: var(
|
|
374
|
+
--recursica_ui-kit_components_tabs_variants_styles_pills_properties_active_colors_icon-color
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/* Content panel */
|
|
379
|
+
.root .panel {
|
|
380
|
+
/* Recursica doesn't define panel colors intrinsically, leaves it to child content */
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/* Hover state uses a pseudo-element to apply opacity to the background without fading the text */
|
|
384
|
+
.root[data-variant] .tab:not([data-active]):hover::before {
|
|
385
|
+
content: "";
|
|
386
|
+
position: absolute;
|
|
387
|
+
inset: 0;
|
|
388
|
+
border-radius: inherit;
|
|
389
|
+
background-color: var(
|
|
390
|
+
--recursica_ui-kit_components_tabs_properties_hover-color
|
|
391
|
+
);
|
|
392
|
+
opacity: var(--recursica_ui-kit_components_tabs_properties_hover-opacity);
|
|
393
|
+
pointer-events: none;
|
|
394
|
+
z-index: 0;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/* Ensure tab content sits above the hover background */
|
|
398
|
+
.root .tab > * {
|
|
399
|
+
z-index: 1;
|
|
400
|
+
position: relative;
|
|
401
|
+
}
|
|
@@ -1,17 +1,154 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { Tabs } from "./Tabs";
|
|
3
|
-
import {
|
|
3
|
+
import { Flex } from "../Flex/Flex";
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Tabs> = {
|
|
6
|
-
title: "UI-Kit
|
|
6
|
+
title: "UI-Kit/Tabs",
|
|
7
7
|
component: Tabs,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: "centered",
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
variant: {
|
|
14
|
+
control: "radio",
|
|
15
|
+
options: ["default", "outline", "pills"],
|
|
16
|
+
},
|
|
17
|
+
orientation: {
|
|
18
|
+
control: "radio",
|
|
19
|
+
options: ["horizontal", "vertical"],
|
|
20
|
+
},
|
|
21
|
+
// @ts-expect-error Custom prop not in native TabsProps
|
|
22
|
+
disabled: {
|
|
23
|
+
control: "boolean",
|
|
24
|
+
},
|
|
25
|
+
defaultChecked: {
|
|
26
|
+
table: {
|
|
27
|
+
disable: true,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
9
31
|
};
|
|
10
32
|
|
|
11
33
|
export default meta;
|
|
12
|
-
|
|
13
34
|
type Story = StoryObj<typeof Tabs>;
|
|
14
35
|
|
|
36
|
+
const InteractiveTabs = (
|
|
37
|
+
args: React.ComponentProps<typeof Tabs> & { disabled?: boolean },
|
|
38
|
+
) => {
|
|
39
|
+
return (
|
|
40
|
+
<Flex w={600} h={300}>
|
|
41
|
+
<Tabs defaultValue="gallery" {...args}>
|
|
42
|
+
<Tabs.List>
|
|
43
|
+
<Tabs.Tab
|
|
44
|
+
value="gallery"
|
|
45
|
+
disabled={args.disabled}
|
|
46
|
+
leftSection={
|
|
47
|
+
<svg
|
|
48
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
49
|
+
viewBox="0 0 24 24"
|
|
50
|
+
fill="none"
|
|
51
|
+
stroke="currentColor"
|
|
52
|
+
strokeWidth="2"
|
|
53
|
+
strokeLinecap="round"
|
|
54
|
+
strokeLinejoin="round"
|
|
55
|
+
>
|
|
56
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
|
|
57
|
+
<circle cx="8.5" cy="8.5" r="1.5"></circle>
|
|
58
|
+
<polyline points="21 15 16 10 5 21"></polyline>
|
|
59
|
+
</svg>
|
|
60
|
+
}
|
|
61
|
+
>
|
|
62
|
+
Gallery
|
|
63
|
+
</Tabs.Tab>
|
|
64
|
+
<Tabs.Tab
|
|
65
|
+
value="messages"
|
|
66
|
+
disabled={args.disabled}
|
|
67
|
+
leftSection={
|
|
68
|
+
<svg
|
|
69
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
+
viewBox="0 0 24 24"
|
|
71
|
+
fill="none"
|
|
72
|
+
stroke="currentColor"
|
|
73
|
+
strokeWidth="2"
|
|
74
|
+
strokeLinecap="round"
|
|
75
|
+
strokeLinejoin="round"
|
|
76
|
+
>
|
|
77
|
+
<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>
|
|
78
|
+
</svg>
|
|
79
|
+
}
|
|
80
|
+
>
|
|
81
|
+
Messages
|
|
82
|
+
</Tabs.Tab>
|
|
83
|
+
<Tabs.Tab
|
|
84
|
+
value="settings"
|
|
85
|
+
disabled={args.disabled}
|
|
86
|
+
leftSection={
|
|
87
|
+
<svg
|
|
88
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
+
viewBox="0 0 24 24"
|
|
90
|
+
fill="none"
|
|
91
|
+
stroke="currentColor"
|
|
92
|
+
strokeWidth="2"
|
|
93
|
+
strokeLinecap="round"
|
|
94
|
+
strokeLinejoin="round"
|
|
95
|
+
>
|
|
96
|
+
<circle cx="12" cy="12" r="3"></circle>
|
|
97
|
+
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path>
|
|
98
|
+
</svg>
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
Settings
|
|
102
|
+
</Tabs.Tab>
|
|
103
|
+
</Tabs.List>
|
|
104
|
+
|
|
105
|
+
<Tabs.Panel value="gallery">Gallery tab content</Tabs.Panel>
|
|
106
|
+
|
|
107
|
+
<Tabs.Panel value="messages">Messages tab content</Tabs.Panel>
|
|
108
|
+
|
|
109
|
+
<Tabs.Panel value="settings">Settings tab content</Tabs.Panel>
|
|
110
|
+
</Tabs>
|
|
111
|
+
</Flex>
|
|
112
|
+
);
|
|
113
|
+
};
|
|
114
|
+
|
|
15
115
|
export const Default: Story = {
|
|
16
|
-
render: () => <
|
|
116
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
117
|
+
args: {
|
|
118
|
+
variant: "default",
|
|
119
|
+
orientation: "horizontal",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const Outline: Story = {
|
|
124
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
125
|
+
args: {
|
|
126
|
+
variant: "outline",
|
|
127
|
+
orientation: "horizontal",
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const Pills: Story = {
|
|
132
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
133
|
+
args: {
|
|
134
|
+
variant: "pills",
|
|
135
|
+
orientation: "horizontal",
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const Vertical: Story = {
|
|
140
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
141
|
+
args: {
|
|
142
|
+
variant: "default",
|
|
143
|
+
orientation: "vertical",
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export const Inverted: Story = {
|
|
148
|
+
render: (args) => <InteractiveTabs {...args} />,
|
|
149
|
+
args: {
|
|
150
|
+
variant: "default",
|
|
151
|
+
orientation: "horizontal",
|
|
152
|
+
inverted: true,
|
|
153
|
+
},
|
|
17
154
|
};
|
|
@@ -1,7 +1,109 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Tabs as MantineTabs,
|
|
4
|
+
type TabsProps as MantineTabsProps,
|
|
5
|
+
type TabsListProps as MantineTabsListProps,
|
|
6
|
+
type TabsTabProps as MantineTabsTabProps,
|
|
7
|
+
type TabsPanelProps as MantineTabsPanelProps,
|
|
8
|
+
} from "@mantine/core";
|
|
9
|
+
import {
|
|
10
|
+
filterStylingProps,
|
|
11
|
+
type RecursicaOverStyled,
|
|
12
|
+
} from "../../utils/filterStylingProps";
|
|
13
|
+
import styles from "./Tabs.module.css";
|
|
2
14
|
|
|
3
|
-
export
|
|
15
|
+
export interface RecursicaTabsProps
|
|
16
|
+
extends Omit<
|
|
17
|
+
MantineTabsProps,
|
|
18
|
+
"variant" | "classNames" | "color" | "radius"
|
|
19
|
+
> {
|
|
20
|
+
variant?: "default" | "outline" | "pills";
|
|
21
|
+
}
|
|
4
22
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
23
|
+
export type TabsProps = RecursicaOverStyled<RecursicaTabsProps>;
|
|
24
|
+
|
|
25
|
+
const _Tabs = forwardRef<HTMLDivElement, TabsProps>(function Tabs(props, ref) {
|
|
26
|
+
const {
|
|
27
|
+
variant = "default",
|
|
28
|
+
orientation = "horizontal",
|
|
29
|
+
overStyled = false,
|
|
30
|
+
className,
|
|
31
|
+
...rest
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<MantineTabs
|
|
38
|
+
ref={ref}
|
|
39
|
+
variant={variant}
|
|
40
|
+
orientation={orientation}
|
|
41
|
+
className={`${styles.root} ${className || ""}`}
|
|
42
|
+
data-variant={variant}
|
|
43
|
+
data-orientation={orientation}
|
|
44
|
+
classNames={{
|
|
45
|
+
list: styles.list,
|
|
46
|
+
tab: styles.tab,
|
|
47
|
+
panel: styles.panel,
|
|
48
|
+
}}
|
|
49
|
+
{...(sanitizedProps as MantineTabsProps)}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
_Tabs.displayName = "Tabs";
|
|
55
|
+
|
|
56
|
+
export type TabsListProps = RecursicaOverStyled<MantineTabsListProps>;
|
|
57
|
+
|
|
58
|
+
const _TabsList = forwardRef<HTMLDivElement, TabsListProps>(
|
|
59
|
+
function TabsList(props, ref) {
|
|
60
|
+
const { overStyled = false, ...rest } = props;
|
|
61
|
+
return (
|
|
62
|
+
<MantineTabs.List
|
|
63
|
+
ref={ref}
|
|
64
|
+
{...(filterStylingProps(rest, overStyled) as MantineTabsListProps)}
|
|
65
|
+
/>
|
|
66
|
+
);
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
_TabsList.displayName = "Tabs.List";
|
|
70
|
+
|
|
71
|
+
export type TabsTabProps = RecursicaOverStyled<MantineTabsTabProps>;
|
|
72
|
+
|
|
73
|
+
const _TabsTab = forwardRef<HTMLButtonElement, TabsTabProps>(
|
|
74
|
+
function TabsTab(props, ref) {
|
|
75
|
+
const { overStyled = false, ...rest } = props;
|
|
76
|
+
return (
|
|
77
|
+
<MantineTabs.Tab
|
|
78
|
+
ref={ref}
|
|
79
|
+
{...(filterStylingProps(rest, overStyled) as MantineTabsTabProps)}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
_TabsTab.displayName = "Tabs.Tab";
|
|
85
|
+
|
|
86
|
+
export type TabsPanelProps = RecursicaOverStyled<MantineTabsPanelProps>;
|
|
87
|
+
|
|
88
|
+
const _TabsPanel = forwardRef<HTMLDivElement, TabsPanelProps>(
|
|
89
|
+
function TabsPanel(props, ref) {
|
|
90
|
+
const { overStyled = false, ...rest } = props;
|
|
91
|
+
return (
|
|
92
|
+
<MantineTabs.Panel
|
|
93
|
+
ref={ref}
|
|
94
|
+
{...(filterStylingProps(rest, overStyled) as MantineTabsPanelProps)}
|
|
95
|
+
/>
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
_TabsPanel.displayName = "Tabs.Panel";
|
|
100
|
+
|
|
101
|
+
export const Tabs: typeof _Tabs & {
|
|
102
|
+
List: typeof _TabsList;
|
|
103
|
+
Tab: typeof _TabsTab;
|
|
104
|
+
Panel: typeof _TabsPanel;
|
|
105
|
+
} = Object.assign(_Tabs, {
|
|
106
|
+
List: _TabsList,
|
|
107
|
+
Tab: _TabsTab,
|
|
108
|
+
Panel: _TabsPanel,
|
|
109
|
+
});
|
package/src/components/index.ts
CHANGED
|
@@ -24,11 +24,9 @@ export * from "./Modal/Modal";
|
|
|
24
24
|
export * from "./NumberInput/NumberInput";
|
|
25
25
|
export * from "./Pagination/Pagination";
|
|
26
26
|
export * from "./Panel/Panel";
|
|
27
|
-
export * from "./Popover/Popover";
|
|
28
27
|
export * from "./Radio/Radio";
|
|
29
28
|
export * from "./Radio/RadioGroup";
|
|
30
29
|
export * from "./ReadOnlyField";
|
|
31
|
-
export * from "./Search/Search";
|
|
32
30
|
export * from "./SegmentedControl/SegmentedControl";
|
|
33
31
|
export * from "./Slider/Slider";
|
|
34
32
|
export * from "./Stack/Stack";
|