@recursica/mantine-adapter 0.12.0 → 0.13.1
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 +12 -0
- package/dist/mantine-adapter.cjs +1 -1
- package/dist/mantine-adapter.cjs.map +1 -1
- package/dist/mantine-adapter.js +666 -664
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/Avatar/Avatar.d.ts +16 -2
- package/dist/src/components/Badge/Badge.d.ts +14 -1
- package/dist/src/components/Button/Button.d.ts +19 -1
- package/dist/src/components/Card/Card.d.ts +21 -6
- package/dist/src/components/Flex/Flex.d.ts +19 -1
- package/dist/src/components/Menu/Menu.d.ts +32 -2
- package/dist/src/components/Text/Text.d.ts +16 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.tsx +30 -17
- package/src/components/Badge/Badge.tsx +9 -2
- package/src/components/Button/Button.tsx +96 -84
- package/src/components/Card/Card.tsx +27 -7
- package/src/components/Flex/Flex.tsx +14 -2
- package/src/components/Loader/LOADER_IMPLEMENTATION_NOTES.md +25 -0
- package/src/components/Menu/Menu.tsx +42 -22
- package/src/components/Text/Text.tsx +16 -6
|
@@ -2,6 +2,7 @@ import React, { forwardRef } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
Flex as MantineFlex,
|
|
4
4
|
type FlexProps as MantineFlexProps,
|
|
5
|
+
createPolymorphicComponent,
|
|
5
6
|
} from "@mantine/core";
|
|
6
7
|
import {
|
|
7
8
|
filterStylingProps,
|
|
@@ -27,7 +28,7 @@ export type FlexProps = RecursicaOverStyled<
|
|
|
27
28
|
MantineFlexProps & RecursicaFlexProps
|
|
28
29
|
>;
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
const _Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(
|
|
31
32
|
{ children, overStyled = false, gap = "rec-default", ...rest },
|
|
32
33
|
ref,
|
|
33
34
|
) {
|
|
@@ -64,5 +65,16 @@ export const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(
|
|
|
64
65
|
</MantineFlex>
|
|
65
66
|
);
|
|
66
67
|
});
|
|
68
|
+
_Flex.displayName = "Flex";
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Recursica Flex layout wrapper.
|
|
72
|
+
*
|
|
73
|
+
* Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <Flex component="nav">...</Flex>
|
|
77
|
+
* <Flex component="section">...</Flex>
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
export const Flex = createPolymorphicComponent<"div", FlexProps>(_Flex);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Loader Implementation Notes
|
|
2
|
+
|
|
3
|
+
## Architecture & Integration
|
|
4
|
+
|
|
5
|
+
The `Loader` component acts as a strictly tokenized wrapper bridging the Recursica UI-Kit `loader` variables to the generic Mantine `@mantine/core` `Loader` primitive.
|
|
6
|
+
|
|
7
|
+
### Key Decisions:
|
|
8
|
+
|
|
9
|
+
- **Variant Mapping:** Recursica's `variant` directly proxies to Mantine's `type` prop for `"oval" | "bars" | "dots"`.
|
|
10
|
+
- **Property Overrides Disabled:** Natively overriding specific structural variants directly on the JSX interface like `thickness` and `borderRadius` has been intentionally omitted. Component rendering relies entirely on variables exposed by the underlying UI Kit mappings tied to the size prop.
|
|
11
|
+
|
|
12
|
+
### Token Mapping:
|
|
13
|
+
|
|
14
|
+
Sizes are bound through `data-size` attributes (`sm`, `md`, `lg` parsing to target `<div data-size="small">`, etc.).
|
|
15
|
+
|
|
16
|
+
Mantine natively sets sizing dynamically at the component root and parses thickness/variants differently natively (e.g., `oval` styles its geometry strictly via CSS `border`, while `bars` and `dots` utilize specific DOM inner spans `span.dot` / `span.bar`).
|
|
17
|
+
|
|
18
|
+
#### Specific CSS Targeting Hacks Used
|
|
19
|
+
|
|
20
|
+
- `border-width` structurally styles the `thickness` configuration of the `oval` variant by resolving `--recursica_ui-kit_components_loader_variants_sizes_..._properties_thickness`.
|
|
21
|
+
- For non-oval variants, `border-radius` natively maps downwards to targeting component `span` children within the wrapper to capture `<span className="mantine-Loader-dot" />` geometries safely without polluting the flex wrapper natively.
|
|
22
|
+
|
|
23
|
+
### Unsupported Properties
|
|
24
|
+
|
|
25
|
+
- **xs and xl Sizing:** These sizes are explicitly unsupported in the Recursica standard logic (as surfaced in `filterStylingProps` and UI Kit mappings). Attempting to use them will safely default back or fallthrough statically unless defined later. See `COMPONENT_ISSUES.md`.
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
type MenuSubProps as MantineMenuSubProps,
|
|
11
11
|
type MenuSubTargetProps as MantineMenuSubTargetProps,
|
|
12
12
|
type MenuSubDropdownProps as MantineMenuSubDropdownProps,
|
|
13
|
+
createPolymorphicComponent,
|
|
13
14
|
} from "@mantine/core";
|
|
14
15
|
import {
|
|
15
16
|
filterStylingProps,
|
|
@@ -131,29 +132,39 @@ export type MenuItemProps = RecursicaOverStyled<
|
|
|
131
132
|
Omit<MantineMenuItemProps, "color">
|
|
132
133
|
>;
|
|
133
134
|
|
|
134
|
-
const
|
|
135
|
-
{ overStyled = false, ...rest },
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
139
|
-
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
135
|
+
const _MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(
|
|
136
|
+
function MenuItem({ overStyled = false, ...rest }, ref) {
|
|
137
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
138
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
// Strip Mantine's `color` prop to enforce token-driven styling
|
|
141
|
+
if (!overStyled) {
|
|
142
|
+
delete restRecord["color"];
|
|
143
|
+
}
|
|
145
144
|
|
|
146
|
-
|
|
145
|
+
const classNameProp = restRecord.className as string | undefined;
|
|
147
146
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
156
|
-
|
|
147
|
+
return (
|
|
148
|
+
<MantineMenu.Item
|
|
149
|
+
ref={ref}
|
|
150
|
+
className={classNameProp}
|
|
151
|
+
{...(sanitizedProps as unknown as MantineMenuItemProps)}
|
|
152
|
+
/>
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
);
|
|
156
|
+
_MenuItem.displayName = "MenuItem";
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* An individual actionable item within the menu dropdown.
|
|
160
|
+
*
|
|
161
|
+
* Supports polymorphism via the `component` prop for link-style items.
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* <Menu.Item component="a" href="/settings">Settings</Menu.Item>
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
const MenuItem = createPolymorphicComponent<"button", MenuItemProps>(_MenuItem);
|
|
157
168
|
|
|
158
169
|
// ============================================================
|
|
159
170
|
// MENU DIVIDER
|
|
@@ -240,7 +251,7 @@ export type MenuSubItemProps = RecursicaOverStyled<
|
|
|
240
251
|
Omit<MantineMenuItemProps, "color">
|
|
241
252
|
>;
|
|
242
253
|
|
|
243
|
-
const
|
|
254
|
+
const _MenuSubItem = forwardRef<HTMLButtonElement, MenuSubItemProps>(
|
|
244
255
|
function MenuSubItem({ overStyled = false, ...rest }, ref) {
|
|
245
256
|
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
246
257
|
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
@@ -260,7 +271,16 @@ const MenuSubItem = forwardRef<HTMLButtonElement, MenuSubItemProps>(
|
|
|
260
271
|
);
|
|
261
272
|
},
|
|
262
273
|
);
|
|
263
|
-
|
|
274
|
+
_MenuSubItem.displayName = "MenuSubItem";
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* A menu item that acts as a submenu trigger.
|
|
278
|
+
*
|
|
279
|
+
* Supports polymorphism via the `component` prop.
|
|
280
|
+
*/
|
|
281
|
+
const MenuSubItem = createPolymorphicComponent<"button", MenuSubItemProps>(
|
|
282
|
+
_MenuSubItem,
|
|
283
|
+
);
|
|
264
284
|
|
|
265
285
|
// ============================================================
|
|
266
286
|
// MENU SUB DROPDOWN
|
|
@@ -2,6 +2,7 @@ import { forwardRef, type ReactNode } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
Text as MantineText,
|
|
4
4
|
type TextProps as MantineTextProps,
|
|
5
|
+
createPolymorphicComponent,
|
|
5
6
|
} from "@mantine/core";
|
|
6
7
|
import {
|
|
7
8
|
filterStylingProps,
|
|
@@ -26,11 +27,7 @@ export type RecursicaTextProps = Omit<MantineTextProps, "variant"> & {
|
|
|
26
27
|
|
|
27
28
|
export type TextProps = RecursicaOverStyled<RecursicaTextProps>;
|
|
28
29
|
|
|
29
|
-
|
|
30
|
-
* A generalized typographical wrapper limiting text properties to bounded Recursica UI-kit tokens inherently.
|
|
31
|
-
* Do not use for semantic headings; use the explicit `<Title>` component for `<h1>` - `<h6>`.
|
|
32
|
-
*/
|
|
33
|
-
export const Text = forwardRef<HTMLDivElement, TextProps>(function Text(
|
|
30
|
+
const _Text = forwardRef<HTMLDivElement, TextProps>(function Text(
|
|
34
31
|
{ overStyled = false, variant = "body", ...rest },
|
|
35
32
|
ref,
|
|
36
33
|
) {
|
|
@@ -51,4 +48,17 @@ export const Text = forwardRef<HTMLDivElement, TextProps>(function Text(
|
|
|
51
48
|
/>
|
|
52
49
|
);
|
|
53
50
|
});
|
|
54
|
-
|
|
51
|
+
_Text.displayName = "Text";
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A generalized typographical wrapper limiting text properties to bounded Recursica UI-kit tokens inherently.
|
|
55
|
+
* Do not use for semantic headings; use the explicit `<Title>` component for `<h1>` - `<h6>`.
|
|
56
|
+
*
|
|
57
|
+
* Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* <Text component="span">Inline text</Text>
|
|
61
|
+
* <Text component="label" htmlFor="input-id">Label text</Text>
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export const Text = createPolymorphicComponent<"p", TextProps>(_Text);
|