@recursica/mantine-adapter 0.6.0 → 0.7.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/.storybook/commonArgTypes.ts +148 -0
- package/CHANGELOG.md +69 -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 +660 -586
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/src/components/Chip/Chip.d.ts +14 -2
- package/package.json +5 -2
- package/src/OverStyling.stories.tsx +174 -0
- package/src/Version.stories.tsx +56 -0
- package/src/components/Accordion/ACCORDION_IMPLEMENTATION_NOTES.md +48 -0
- package/src/components/Accordion/Accordion.module.css +261 -0
- package/src/components/Accordion/Accordion.stories.tsx +145 -0
- package/src/components/Accordion/Accordion.tsx +200 -0
- package/src/components/Accordion/index.ts +1 -0
- package/src/components/AssistiveElement/AssistiveElement.module.css +111 -0
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +73 -0
- package/src/components/AssistiveElement/AssistiveElement.tsx +91 -0
- package/src/components/Avatar/AVATAR_IMPLEMENTATION_NOTES.md +24 -0
- package/src/components/Avatar/Avatar.module.css +340 -0
- package/src/components/Avatar/Avatar.stories.tsx +102 -0
- package/src/components/Avatar/Avatar.tsx +100 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Badge/BADGE_IMPLEMENTATION_NOTES.md +18 -0
- package/src/components/Badge/Badge.module.css +124 -0
- package/src/components/Badge/Badge.stories.tsx +77 -0
- package/src/components/Badge/Badge.tsx +66 -0
- package/src/components/Breadcrumb/BREADCRUMB_IMPLEMENTATION_NOTES.md +14 -0
- package/src/components/Breadcrumb/Breadcrumb.module.css +26 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +77 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +64 -0
- package/src/components/Button/Button.module.css +275 -0
- package/src/components/Button/Button.stories.tsx +105 -0
- package/src/components/Button/Button.tsx +122 -0
- package/src/components/Button/IMPLEMENTATION_NOTES.md +45 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/CARD_IMPLEMENTATION_NOTES.md +10 -0
- package/src/components/Card/Card.module.css +60 -0
- package/src/components/Card/Card.stories.tsx +141 -0
- package/src/components/Card/Card.tsx +176 -0
- package/src/components/Checkbox/CHECKBOX_IMPLEMENTATION_NOTES.md +25 -0
- package/src/components/Checkbox/Checkbox.module.css +204 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +73 -0
- package/src/components/Checkbox/Checkbox.tsx +111 -0
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +138 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +140 -0
- package/src/components/Chip/CHIP_IMPLEMENTATION_NOTES.md +35 -0
- package/src/components/Chip/Chip.module.css +218 -0
- package/src/components/Chip/Chip.stories.tsx +115 -0
- package/src/components/Chip/Chip.tsx +143 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +22 -0
- package/src/components/DatePicker/DatePicker.tsx +7 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +22 -0
- package/src/components/Dropdown/Dropdown.tsx +7 -0
- package/src/components/FileInput/FileInput.stories.tsx +22 -0
- package/src/components/FileInput/FileInput.tsx +7 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +22 -0
- package/src/components/FileUpload/FileUpload.tsx +7 -0
- package/src/components/FormControlWrapper/FORMCONTROLWRAPPER_IMPLEMENTATION_NOTES.md +32 -0
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +46 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +116 -0
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +170 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +17 -0
- package/src/components/HoverCard/HoverCard.tsx +7 -0
- package/src/components/Label/LABEL_IMPLEMENTATION_NOTES.md +48 -0
- package/src/components/Label/Label.module.css +177 -0
- package/src/components/Label/Label.stories.tsx +123 -0
- package/src/components/Label/Label.tsx +132 -0
- package/src/components/Label/index.ts +1 -0
- package/src/components/Link/Link.stories.tsx +17 -0
- package/src/components/Link/Link.tsx +7 -0
- package/src/components/Loader/Loader.stories.tsx +17 -0
- package/src/components/Loader/Loader.tsx +7 -0
- package/src/components/Menu/Menu.stories.tsx +17 -0
- package/src/components/Menu/Menu.tsx +7 -0
- package/src/components/Modal/Modal.stories.tsx +17 -0
- package/src/components/Modal/Modal.tsx +7 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +22 -0
- package/src/components/NumberInput/NumberInput.tsx +7 -0
- package/src/components/Pagination/Pagination.stories.tsx +17 -0
- package/src/components/Pagination/Pagination.tsx +7 -0
- package/src/components/Panel/Panel.stories.tsx +17 -0
- package/src/components/Panel/Panel.tsx +7 -0
- package/src/components/Popover/Popover.stories.tsx +17 -0
- package/src/components/Popover/Popover.tsx +7 -0
- package/src/components/Radio/Radio.stories.tsx +22 -0
- package/src/components/Radio/Radio.tsx +7 -0
- package/src/components/ReadOnlyField/READ_ONLY_FIELD_IMPLEMENTATION_NOTES.md +15 -0
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +49 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +120 -0
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +75 -0
- package/src/components/ReadOnlyField/ReadOnlyTextField.tsx +46 -0
- package/src/components/ReadOnlyField/WithReadOnlyWrapper.tsx +85 -0
- package/src/components/ReadOnlyField/index.ts +3 -0
- package/src/components/Search/Search.stories.tsx +17 -0
- package/src/components/Search/Search.tsx +7 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +22 -0
- package/src/components/SegmentedControl/SegmentedControl.tsx +7 -0
- package/src/components/Slider/Slider.stories.tsx +22 -0
- package/src/components/Slider/Slider.tsx +7 -0
- package/src/components/Stepper/Stepper.stories.tsx +17 -0
- package/src/components/Stepper/Stepper.tsx +7 -0
- package/src/components/Switch/Switch.stories.tsx +22 -0
- package/src/components/Switch/Switch.tsx +7 -0
- package/src/components/Table/Table.stories.tsx +17 -0
- package/src/components/Table/Table.tsx +7 -0
- package/src/components/Tabs/Tabs.stories.tsx +17 -0
- package/src/components/Tabs/Tabs.tsx +7 -0
- package/src/components/Text/Text.stories.tsx +88 -0
- package/src/components/Text/Text.tsx +54 -0
- package/src/components/TextArea/TextArea.stories.tsx +22 -0
- package/src/components/TextArea/TextArea.tsx +7 -0
- package/src/components/TextField/TEXTFIELD_IMPLEMENTATION_NOTES.md +19 -0
- package/src/components/TextField/TextField.module.css +225 -0
- package/src/components/TextField/TextField.stories.tsx +162 -0
- package/src/components/TextField/TextField.tsx +138 -0
- package/src/components/TimePicker/TimePicker.stories.tsx +22 -0
- package/src/components/TimePicker/TimePicker.tsx +7 -0
- package/src/components/Timeline/Timeline.stories.tsx +17 -0
- package/src/components/Timeline/Timeline.tsx +7 -0
- package/src/components/Title/Title.stories.tsx +63 -0
- package/src/components/Title/Title.tsx +45 -0
- package/src/components/Toast/Toast.stories.tsx +17 -0
- package/src/components/Toast/Toast.tsx +7 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +17 -0
- package/src/components/Tooltip/Tooltip.tsx +7 -0
- package/src/components/TransferList/TransferList.stories.tsx +17 -0
- package/src/components/TransferList/TransferList.tsx +7 -0
- package/src/components/index.ts +39 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +3 -0
- package/src/types/index.ts +9 -0
- package/src/types/mantine.d.ts +7 -0
- package/src/types/scss-modules.d.ts +9 -0
- package/src/utils/ColorSchemeWrapper.tsx +27 -0
- package/src/utils/copyToClipboard.ts +36 -0
- package/src/utils/filterStylingProps.ts +139 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/*
|
|
2
|
+
HARDCODED VALUES:
|
|
3
|
+
- justify-content, align-items, display: Center content for custom internal spans
|
|
4
|
+
- Mantine overrides (--avatar-bd, --avatar-bg, --avatar-color): Remove default static themes
|
|
5
|
+
- Default object-fit for image
|
|
6
|
+
- Transitions and standard flex layouts
|
|
7
|
+
- Image has no explicit size tokens other than root size, assume it scales 100%
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
.root {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
margin: 0;
|
|
13
|
+
border-style: solid;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
position: relative;
|
|
16
|
+
transition: all 0.2s ease;
|
|
17
|
+
|
|
18
|
+
/* HARDCODE: Remove internal Mantine custom props that interfere */
|
|
19
|
+
--avatar-bd: none;
|
|
20
|
+
--avatar-bg: transparent;
|
|
21
|
+
--avatar-color: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* ==== SIZES ==== */
|
|
25
|
+
.root[data-size="small"] {
|
|
26
|
+
width: var(
|
|
27
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_width
|
|
28
|
+
);
|
|
29
|
+
height: var(
|
|
30
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_height
|
|
31
|
+
);
|
|
32
|
+
border-width: var(
|
|
33
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_border-size
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.root[data-size="small"] .iconWrapper {
|
|
38
|
+
width: var(
|
|
39
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_icon-size
|
|
40
|
+
);
|
|
41
|
+
height: var(
|
|
42
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_icon-size
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.root[data-size="small"] .textWrapper {
|
|
47
|
+
font-family: var(
|
|
48
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_font-family
|
|
49
|
+
);
|
|
50
|
+
font-size: var(
|
|
51
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_font-size
|
|
52
|
+
);
|
|
53
|
+
font-style: var(
|
|
54
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_font-style
|
|
55
|
+
);
|
|
56
|
+
font-weight: var(
|
|
57
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_font-weight
|
|
58
|
+
);
|
|
59
|
+
letter-spacing: var(
|
|
60
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_letter-spacing
|
|
61
|
+
);
|
|
62
|
+
line-height: var(
|
|
63
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_line-height
|
|
64
|
+
);
|
|
65
|
+
text-decoration: var(
|
|
66
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_text-decoration
|
|
67
|
+
);
|
|
68
|
+
text-transform: var(
|
|
69
|
+
--recursica_ui-kit_components_avatar_variants_sizes_small_properties_text_text-transform
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.root[data-size="default"] {
|
|
74
|
+
width: var(
|
|
75
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_width
|
|
76
|
+
);
|
|
77
|
+
height: var(
|
|
78
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_height
|
|
79
|
+
);
|
|
80
|
+
border-width: var(
|
|
81
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_border-size
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.root[data-size="default"] .iconWrapper {
|
|
86
|
+
width: var(
|
|
87
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_icon-size
|
|
88
|
+
);
|
|
89
|
+
height: var(
|
|
90
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_icon-size
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.root[data-size="default"] .textWrapper {
|
|
95
|
+
font-family: var(
|
|
96
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_font-family
|
|
97
|
+
);
|
|
98
|
+
font-size: var(
|
|
99
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_font-size
|
|
100
|
+
);
|
|
101
|
+
font-style: var(
|
|
102
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_font-style
|
|
103
|
+
);
|
|
104
|
+
font-weight: var(
|
|
105
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_font-weight
|
|
106
|
+
);
|
|
107
|
+
letter-spacing: var(
|
|
108
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_letter-spacing
|
|
109
|
+
);
|
|
110
|
+
line-height: var(
|
|
111
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_line-height
|
|
112
|
+
);
|
|
113
|
+
text-decoration: var(
|
|
114
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_text-decoration
|
|
115
|
+
);
|
|
116
|
+
text-transform: var(
|
|
117
|
+
--recursica_ui-kit_components_avatar_variants_sizes_default_properties_text_text-transform
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.root[data-size="large"] {
|
|
122
|
+
width: var(
|
|
123
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_width
|
|
124
|
+
);
|
|
125
|
+
height: var(
|
|
126
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_height
|
|
127
|
+
);
|
|
128
|
+
border-width: var(
|
|
129
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_border-size
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.root[data-size="large"] .iconWrapper {
|
|
134
|
+
width: var(
|
|
135
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_icon-size
|
|
136
|
+
);
|
|
137
|
+
height: var(
|
|
138
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_icon-size
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.root[data-size="large"] .textWrapper {
|
|
143
|
+
font-family: var(
|
|
144
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_font-family
|
|
145
|
+
);
|
|
146
|
+
font-size: var(
|
|
147
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_font-size
|
|
148
|
+
);
|
|
149
|
+
font-style: var(
|
|
150
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_font-style
|
|
151
|
+
);
|
|
152
|
+
font-weight: var(
|
|
153
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_font-weight
|
|
154
|
+
);
|
|
155
|
+
letter-spacing: var(
|
|
156
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_letter-spacing
|
|
157
|
+
);
|
|
158
|
+
line-height: var(
|
|
159
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_line-height
|
|
160
|
+
);
|
|
161
|
+
text-decoration: var(
|
|
162
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_text-decoration
|
|
163
|
+
);
|
|
164
|
+
text-transform: var(
|
|
165
|
+
--recursica_ui-kit_components_avatar_variants_sizes_large_properties_text_text-transform
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* ==== STYLES & VARIANTS ==== */
|
|
170
|
+
|
|
171
|
+
/* 1. IMAGE */
|
|
172
|
+
.root[data-style="image"] {
|
|
173
|
+
border-radius: var(
|
|
174
|
+
--recursica_ui-kit_components_avatar_variants_styles_image_properties_border-radius
|
|
175
|
+
);
|
|
176
|
+
border-width: var(
|
|
177
|
+
--recursica_ui-kit_components_avatar_variants_styles_image_properties_border-size
|
|
178
|
+
);
|
|
179
|
+
padding: var(
|
|
180
|
+
--recursica_ui-kit_components_avatar_variants_styles_image_properties_padding
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
/* Missing specific standard variant tokens so hardcoding typical resets */
|
|
184
|
+
background-color: transparent;
|
|
185
|
+
border-color: transparent;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/* Base styles for Internal Nodes */
|
|
189
|
+
.image {
|
|
190
|
+
object-fit: cover;
|
|
191
|
+
width: 100%;
|
|
192
|
+
height: 100%;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.placeholder {
|
|
196
|
+
display: flex;
|
|
197
|
+
align-items: center;
|
|
198
|
+
justify-content: center;
|
|
199
|
+
width: 100%;
|
|
200
|
+
height: 100%;
|
|
201
|
+
color: inherit;
|
|
202
|
+
background-color: transparent;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.iconWrapper {
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
justify-content: center;
|
|
209
|
+
flex-shrink: 0;
|
|
210
|
+
}
|
|
211
|
+
.iconWrapper > * {
|
|
212
|
+
width: 100%;
|
|
213
|
+
height: 100%;
|
|
214
|
+
object-fit: contain;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.textWrapper {
|
|
218
|
+
display: inline-flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
justify-content: center;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* 2. ICON */
|
|
224
|
+
.root[data-style="icon"] {
|
|
225
|
+
border-radius: var(
|
|
226
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_properties_border-radius
|
|
227
|
+
);
|
|
228
|
+
padding: var(
|
|
229
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_properties_padding
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.root[data-style="icon"][data-variant="solid"] {
|
|
234
|
+
border-width: var(
|
|
235
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_solid_properties_border-size
|
|
236
|
+
);
|
|
237
|
+
background-color: var(
|
|
238
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_solid_properties_colors_background
|
|
239
|
+
);
|
|
240
|
+
border-color: var(
|
|
241
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_solid_properties_colors_border-color
|
|
242
|
+
);
|
|
243
|
+
color: var(
|
|
244
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_solid_properties_colors_icon-color,
|
|
245
|
+
var(
|
|
246
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_solid_properties_colors_text-color
|
|
247
|
+
)
|
|
248
|
+
);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.root[data-style="icon"][data-variant="outline"] {
|
|
252
|
+
border-width: var(
|
|
253
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_outline_properties_border-size
|
|
254
|
+
);
|
|
255
|
+
background-color: var(
|
|
256
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_outline_properties_colors_background
|
|
257
|
+
);
|
|
258
|
+
border-color: var(
|
|
259
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_outline_properties_colors_border-color
|
|
260
|
+
);
|
|
261
|
+
color: var(
|
|
262
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_outline_properties_colors_icon-color,
|
|
263
|
+
var(
|
|
264
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_outline_properties_colors_text-color
|
|
265
|
+
)
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.root[data-style="icon"][data-variant="ghost"] {
|
|
270
|
+
border-width: var(
|
|
271
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_ghost_properties_border-size
|
|
272
|
+
);
|
|
273
|
+
background-color: var(
|
|
274
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_ghost_properties_colors_background
|
|
275
|
+
);
|
|
276
|
+
border-color: var(
|
|
277
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_ghost_properties_colors_border-color
|
|
278
|
+
);
|
|
279
|
+
color: var(
|
|
280
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_ghost_properties_colors_icon-color,
|
|
281
|
+
var(
|
|
282
|
+
--recursica_ui-kit_components_avatar_variants_styles_icon_variants_ghost_properties_colors_text-color
|
|
283
|
+
)
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* 3. TEXT */
|
|
288
|
+
.root[data-style="text"] {
|
|
289
|
+
border-radius: var(
|
|
290
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_properties_border-radius
|
|
291
|
+
);
|
|
292
|
+
padding: var(
|
|
293
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_properties_padding
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.root[data-style="text"][data-variant="solid"] {
|
|
298
|
+
border-width: var(
|
|
299
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_solid_properties_border-size
|
|
300
|
+
);
|
|
301
|
+
background-color: var(
|
|
302
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_solid_properties_colors_background
|
|
303
|
+
);
|
|
304
|
+
border-color: var(
|
|
305
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_solid_properties_colors_border-color
|
|
306
|
+
);
|
|
307
|
+
color: var(
|
|
308
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_solid_properties_colors_text-color
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.root[data-style="text"][data-variant="outline"] {
|
|
313
|
+
border-width: var(
|
|
314
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_outline_properties_border-size
|
|
315
|
+
);
|
|
316
|
+
background-color: var(
|
|
317
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_outline_properties_colors_background
|
|
318
|
+
);
|
|
319
|
+
border-color: var(
|
|
320
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_outline_properties_colors_border-color
|
|
321
|
+
);
|
|
322
|
+
color: var(
|
|
323
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_outline_properties_colors_text-color
|
|
324
|
+
);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.root[data-style="text"][data-variant="ghost"] {
|
|
328
|
+
border-width: var(
|
|
329
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_ghost_properties_border-size
|
|
330
|
+
);
|
|
331
|
+
background-color: var(
|
|
332
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_ghost_properties_colors_background
|
|
333
|
+
);
|
|
334
|
+
border-color: var(
|
|
335
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_ghost_properties_colors_border-color
|
|
336
|
+
);
|
|
337
|
+
color: var(
|
|
338
|
+
--recursica_ui-kit_components_avatar_variants_styles_text_variants_ghost_properties_colors_text-color
|
|
339
|
+
);
|
|
340
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { Avatar } from "./Avatar";
|
|
4
|
+
import { Layer } from "@recursica/adapter-common";
|
|
5
|
+
|
|
6
|
+
type AvatarStoryProps = React.ComponentProps<typeof Avatar>;
|
|
7
|
+
|
|
8
|
+
const meta: Meta<AvatarStoryProps> = {
|
|
9
|
+
title: "UI-Kit/Avatar",
|
|
10
|
+
component: Avatar,
|
|
11
|
+
tags: ["autodocs"],
|
|
12
|
+
argTypes: {
|
|
13
|
+
variant: {
|
|
14
|
+
control: "select",
|
|
15
|
+
options: ["solid", "outline", "ghost"],
|
|
16
|
+
description:
|
|
17
|
+
"The visual variant of the avatar (applies to icon/text styles)",
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
control: "radio",
|
|
21
|
+
options: ["default", "small", "large"],
|
|
22
|
+
description: "The size of the avatar",
|
|
23
|
+
},
|
|
24
|
+
src: {
|
|
25
|
+
control: "text",
|
|
26
|
+
description: "Image URL for the image style avatar",
|
|
27
|
+
},
|
|
28
|
+
icon: {
|
|
29
|
+
table: {
|
|
30
|
+
disable: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default meta;
|
|
37
|
+
|
|
38
|
+
type Story = StoryObj<AvatarStoryProps>;
|
|
39
|
+
|
|
40
|
+
export const Default: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
size: "default",
|
|
43
|
+
variant: "solid",
|
|
44
|
+
},
|
|
45
|
+
render: (args) => {
|
|
46
|
+
return <Avatar {...args} />;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const TextSolidDefault: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
children: "JD",
|
|
53
|
+
variant: "solid",
|
|
54
|
+
size: "default",
|
|
55
|
+
},
|
|
56
|
+
render: (args) => <Avatar {...args} />,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const ImageLarge: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
src: "https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=250&q=80",
|
|
62
|
+
size: "large",
|
|
63
|
+
},
|
|
64
|
+
render: (args) => <Avatar {...args} />,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const IconSmallGhost: Story = {
|
|
68
|
+
args: {
|
|
69
|
+
size: "small",
|
|
70
|
+
variant: "ghost",
|
|
71
|
+
icon: (
|
|
72
|
+
<svg
|
|
73
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
74
|
+
width="16"
|
|
75
|
+
height="16"
|
|
76
|
+
viewBox="0 0 24 24"
|
|
77
|
+
fill="none"
|
|
78
|
+
stroke="currentColor"
|
|
79
|
+
strokeWidth="2"
|
|
80
|
+
strokeLinecap="round"
|
|
81
|
+
strokeLinejoin="round"
|
|
82
|
+
>
|
|
83
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path>
|
|
84
|
+
<circle cx="12" cy="7" r="4"></circle>
|
|
85
|
+
</svg>
|
|
86
|
+
),
|
|
87
|
+
},
|
|
88
|
+
render: (args) => <Avatar {...args} />,
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const LayerOneOutline: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
children: "L1",
|
|
94
|
+
variant: "outline",
|
|
95
|
+
size: "default",
|
|
96
|
+
},
|
|
97
|
+
render: (args) => (
|
|
98
|
+
<Layer layer={1} style={{ padding: "24px", display: "inline-block" }}>
|
|
99
|
+
<Avatar {...args} />
|
|
100
|
+
</Layer>
|
|
101
|
+
),
|
|
102
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Avatar as MantineAvatar,
|
|
4
|
+
type AvatarProps as MantineAvatarProps,
|
|
5
|
+
} from "@mantine/core";
|
|
6
|
+
import styles from "./Avatar.module.css";
|
|
7
|
+
|
|
8
|
+
export interface RecursicaAvatarProps {
|
|
9
|
+
size?: "small" | "default" | "large";
|
|
10
|
+
variant?: "solid" | "outline" | "ghost";
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type AvatarProps = Omit<
|
|
15
|
+
MantineAvatarProps,
|
|
16
|
+
"variant" | "size" | "color" | "radius"
|
|
17
|
+
> &
|
|
18
|
+
RecursicaAvatarProps;
|
|
19
|
+
|
|
20
|
+
export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
|
|
21
|
+
{
|
|
22
|
+
size = "default",
|
|
23
|
+
variant = "solid",
|
|
24
|
+
icon,
|
|
25
|
+
className,
|
|
26
|
+
classNames,
|
|
27
|
+
children,
|
|
28
|
+
style,
|
|
29
|
+
src,
|
|
30
|
+
...rest
|
|
31
|
+
},
|
|
32
|
+
ref,
|
|
33
|
+
) {
|
|
34
|
+
const mapVariant = {
|
|
35
|
+
solid: "filled",
|
|
36
|
+
outline: "outline",
|
|
37
|
+
ghost: "transparent",
|
|
38
|
+
} as const;
|
|
39
|
+
|
|
40
|
+
const mapSize = {
|
|
41
|
+
default: "md",
|
|
42
|
+
small: "sm",
|
|
43
|
+
large: "lg",
|
|
44
|
+
} as const;
|
|
45
|
+
|
|
46
|
+
// Determine semantic style based on provided props
|
|
47
|
+
let computedStyle = "text";
|
|
48
|
+
if (src) {
|
|
49
|
+
computedStyle = "image";
|
|
50
|
+
} else if (icon) {
|
|
51
|
+
computedStyle = "icon";
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
55
|
+
root: styles.root,
|
|
56
|
+
image: styles.image,
|
|
57
|
+
placeholder: styles.placeholder,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
if (
|
|
61
|
+
classNames &&
|
|
62
|
+
typeof classNames === "object" &&
|
|
63
|
+
!Array.isArray(classNames)
|
|
64
|
+
) {
|
|
65
|
+
const o = classNames as Partial<Record<string, string>>;
|
|
66
|
+
mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
|
|
67
|
+
mergedClassNames.image = o.image
|
|
68
|
+
? `${styles.image} ${o.image}`
|
|
69
|
+
: styles.image;
|
|
70
|
+
mergedClassNames.placeholder = o.placeholder
|
|
71
|
+
? `${styles.placeholder} ${o.placeholder}`
|
|
72
|
+
: styles.placeholder;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<MantineAvatar
|
|
77
|
+
ref={ref}
|
|
78
|
+
className={className}
|
|
79
|
+
classNames={mergedClassNames}
|
|
80
|
+
variant={mapVariant[variant]}
|
|
81
|
+
size={mapSize[size]}
|
|
82
|
+
style={style}
|
|
83
|
+
src={src}
|
|
84
|
+
data-variant={variant}
|
|
85
|
+
data-size={size}
|
|
86
|
+
data-style={computedStyle}
|
|
87
|
+
{...rest}
|
|
88
|
+
>
|
|
89
|
+
{icon != null ? (
|
|
90
|
+
<span className={styles.iconWrapper} aria-hidden>
|
|
91
|
+
{icon}
|
|
92
|
+
</span>
|
|
93
|
+
) : children != null ? (
|
|
94
|
+
<span className={styles.textWrapper}>{children}</span>
|
|
95
|
+
) : undefined}
|
|
96
|
+
</MantineAvatar>
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
Avatar.displayName = "Avatar";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Avatar";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Badge Implementation Notes
|
|
2
|
+
|
|
3
|
+
This document captures specific decisions, regressions, and structural compromises made when integrating Mantine's `Badge` component into the Recursica styling system.
|
|
4
|
+
|
|
5
|
+
## 1. Stripped Size Properties
|
|
6
|
+
|
|
7
|
+
As logged in `COMPONENT_ISSUES.md`, there are currently no Figma variables mapped for different `size` variants (`small`, `default`, etc.). The component explicitly `Omit`s the Mantine `size` property from its signature to prevent integrators from attempting to drive sizes that do not exist in the tokens.
|
|
8
|
+
|
|
9
|
+
## 2. Intent-Based Variants
|
|
10
|
+
|
|
11
|
+
Mantine supports multiple visual variants (`outline`, `filled`, `light`). However, the existing variable schema for `Badge` only defines "Styles" which act as intents (`alert`, `primary-color`, `success`, `warning`).
|
|
12
|
+
|
|
13
|
+
- Default is arbitrarily mapped to `primary-color` as we lack a pure `neutral` schema right now.
|
|
14
|
+
- `variant` mapped to underlying Mantine prop has been hardcoded to `filled`, since the Recursica coloring fully replaces the Mantine DOM.
|
|
15
|
+
|
|
16
|
+
## 3. The `overStyled` Prop
|
|
17
|
+
|
|
18
|
+
This component implements the newly added `overStyled` architectural standard. By default, passing inline `{style}` React properties to `Badge` will be ignored. This prevents accidental cascading regressions of our strict CSS-variables layouts unless a developer explicitly forces `overStyled={true}`.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/* HARDCODED VALUES:
|
|
2
|
+
- border-style: solid (needs a token if we support other border styles)
|
|
3
|
+
- box-sizing: border-box
|
|
4
|
+
- display: inline-flex
|
|
5
|
+
- align-items: center
|
|
6
|
+
- justify-content: center
|
|
7
|
+
- text-transform: uppercase (Mantine does this, but our tokens also specify it so we map it)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
.root {
|
|
11
|
+
/* HARDCODE: Basic structural assumptions */
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
border-style: solid;
|
|
17
|
+
|
|
18
|
+
/* Base style resets to fully clear Mantine's defaults before applying ours */
|
|
19
|
+
background-color: transparent;
|
|
20
|
+
color: inherit;
|
|
21
|
+
border-color: transparent;
|
|
22
|
+
|
|
23
|
+
/* Apply global badge properties */
|
|
24
|
+
border-radius: var(
|
|
25
|
+
--recursica_ui-kit_components_badge_properties_border-radius
|
|
26
|
+
);
|
|
27
|
+
border-width: var(--recursica_ui-kit_components_badge_properties_border-size);
|
|
28
|
+
box-shadow: var(--recursica_ui-kit_components_badge_properties_elevation);
|
|
29
|
+
|
|
30
|
+
padding-left: var(
|
|
31
|
+
--recursica_ui-kit_components_badge_properties_padding-horizontal
|
|
32
|
+
);
|
|
33
|
+
padding-right: var(
|
|
34
|
+
--recursica_ui-kit_components_badge_properties_padding-horizontal
|
|
35
|
+
);
|
|
36
|
+
padding-top: var(
|
|
37
|
+
--recursica_ui-kit_components_badge_properties_padding-vertical
|
|
38
|
+
);
|
|
39
|
+
padding-bottom: var(
|
|
40
|
+
--recursica_ui-kit_components_badge_properties_padding-vertical
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
font-family: var(
|
|
44
|
+
--recursica_ui-kit_components_badge_properties_text_font-family
|
|
45
|
+
);
|
|
46
|
+
font-size: var(--recursica_ui-kit_components_badge_properties_text_font-size);
|
|
47
|
+
font-weight: var(
|
|
48
|
+
--recursica_ui-kit_components_badge_properties_text_font-weight
|
|
49
|
+
);
|
|
50
|
+
letter-spacing: var(
|
|
51
|
+
--recursica_ui-kit_components_badge_properties_text_letter-spacing
|
|
52
|
+
);
|
|
53
|
+
line-height: var(
|
|
54
|
+
--recursica_ui-kit_components_badge_properties_text_line-height
|
|
55
|
+
);
|
|
56
|
+
text-decoration: var(
|
|
57
|
+
--recursica_ui-kit_components_badge_properties_text_text-decoration
|
|
58
|
+
);
|
|
59
|
+
text-transform: var(
|
|
60
|
+
--recursica_ui-kit_components_badge_properties_text_text-transform
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Variant Definitions */
|
|
65
|
+
|
|
66
|
+
.root[data-variant="alert"] {
|
|
67
|
+
background-color: var(
|
|
68
|
+
--recursica_ui-kit_components_badge_variants_styles_alert_properties_colors_background
|
|
69
|
+
);
|
|
70
|
+
border-color: var(
|
|
71
|
+
--recursica_ui-kit_components_badge_variants_styles_alert_properties_colors_border-color
|
|
72
|
+
);
|
|
73
|
+
color: var(
|
|
74
|
+
--recursica_ui-kit_components_badge_variants_styles_alert_properties_colors_text
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.root[data-variant="primary-color"] {
|
|
79
|
+
background-color: var(
|
|
80
|
+
--recursica_ui-kit_components_badge_variants_styles_primary-color_properties_colors_background
|
|
81
|
+
);
|
|
82
|
+
border-color: var(
|
|
83
|
+
--recursica_ui-kit_components_badge_variants_styles_primary-color_properties_colors_border-color
|
|
84
|
+
);
|
|
85
|
+
color: var(
|
|
86
|
+
--recursica_ui-kit_components_badge_variants_styles_primary-color_properties_colors_text
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.root[data-variant="success"] {
|
|
91
|
+
background-color: var(
|
|
92
|
+
--recursica_ui-kit_components_badge_variants_styles_success_properties_colors_background
|
|
93
|
+
);
|
|
94
|
+
border-color: var(
|
|
95
|
+
--recursica_ui-kit_components_badge_variants_styles_success_properties_colors_border-color
|
|
96
|
+
);
|
|
97
|
+
color: var(
|
|
98
|
+
--recursica_ui-kit_components_badge_variants_styles_success_properties_colors_text
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.root[data-variant="warning"] {
|
|
103
|
+
background-color: var(
|
|
104
|
+
--recursica_ui-kit_components_badge_variants_styles_warning_properties_colors_background
|
|
105
|
+
);
|
|
106
|
+
border-color: var(
|
|
107
|
+
--recursica_ui-kit_components_badge_variants_styles_warning_properties_colors_border-color
|
|
108
|
+
);
|
|
109
|
+
color: var(
|
|
110
|
+
--recursica_ui-kit_components_badge_variants_styles_warning_properties_colors_text
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Target Mantine internal children if needed for typography constraints */
|
|
115
|
+
.root :global(.mantine-Badge-label),
|
|
116
|
+
.root :global(.mantine-Badge-section) {
|
|
117
|
+
/* HARDCODE: Prevent Mantine from overriding our typography setup inside inner wrappers */
|
|
118
|
+
font-size: inherit;
|
|
119
|
+
font-weight: inherit;
|
|
120
|
+
line-height: inherit;
|
|
121
|
+
font-family: inherit;
|
|
122
|
+
letter-spacing: inherit;
|
|
123
|
+
text-transform: inherit;
|
|
124
|
+
}
|