@recursica/mantine-adapter 0.13.1 → 0.15.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 +12 -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 +1329 -1082
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/HoverCard/HoverCard.d.ts +55 -3
- package/dist/src/components/NumberInput/NumberInput.d.ts +10 -2
- package/dist/src/components/Panel/Panel.d.ts +65 -3
- package/dist/src/components/Tooltip/Tooltip.d.ts +42 -3
- package/package.json +1 -1
- package/src/components/Card/Card.module.css +1 -0
- package/src/components/Card/Card.stories.tsx +48 -58
- package/src/components/Dropdown/Dropdown.module.css +0 -3
- package/src/components/HoverCard/HOVERCARD_IMPLEMENTATION_NOTES.md +77 -0
- package/src/components/HoverCard/HoverCard.module.css +84 -0
- package/src/components/HoverCard/HoverCard.stories.tsx +160 -5
- package/src/components/HoverCard/HoverCard.tsx +153 -4
- package/src/components/NumberInput/NUMBER_INPUT_IMPLEMENTATION_NOTES.md +18 -0
- package/src/components/NumberInput/NumberInput.module.css +250 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +84 -4
- package/src/components/NumberInput/NumberInput.tsx +144 -5
- package/src/components/Panel/PANEL_IMPLEMENTATION_NOTES.md +106 -0
- package/src/components/Panel/Panel.module.css +154 -0
- package/src/components/Panel/Panel.stories.tsx +216 -6
- package/src/components/Panel/Panel.tsx +153 -4
- package/src/components/TextArea/TextArea.module.css +0 -3
- package/src/components/TextField/TextField.module.css +0 -3
- package/src/components/Tooltip/TOOLTIP_IMPLEMENTATION_NOTES.md +85 -0
- package/src/components/Tooltip/Tooltip.module.css +81 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +154 -6
- package/src/components/Tooltip/Tooltip.tsx +114 -4
|
@@ -1,17 +1,227 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
1
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Panel } from "./Panel";
|
|
3
|
-
import {
|
|
3
|
+
import { Panel, type PanelProps } from "./Panel";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Text } from "../Text/Text";
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
+
type PanelStoryArgs = Record<string, any>;
|
|
9
|
+
|
|
10
|
+
const meta: Meta = {
|
|
11
|
+
title: "UI-Kit/Panel",
|
|
7
12
|
component: Panel,
|
|
8
13
|
tags: ["autodocs"],
|
|
14
|
+
argTypes: {
|
|
15
|
+
position: {
|
|
16
|
+
control: "select",
|
|
17
|
+
options: ["left", "right", "top", "bottom"],
|
|
18
|
+
description: "Side of the screen the panel slides in from.",
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
control: "text",
|
|
22
|
+
description: "Panel title displayed in the header.",
|
|
23
|
+
},
|
|
24
|
+
withOverlay: {
|
|
25
|
+
control: "boolean",
|
|
26
|
+
description: "Whether to display a background overlay.",
|
|
27
|
+
},
|
|
28
|
+
withCloseButton: {
|
|
29
|
+
control: "boolean",
|
|
30
|
+
description: "Whether to display the close button in the header.",
|
|
31
|
+
},
|
|
32
|
+
wrapHeaderText: {
|
|
33
|
+
control: "boolean",
|
|
34
|
+
description:
|
|
35
|
+
"If true, forces the header text to a single line and truncates with an ellipsis.",
|
|
36
|
+
},
|
|
37
|
+
// Hide auto-detected HTML attributes
|
|
38
|
+
defaultChecked: { table: { disable: true } },
|
|
39
|
+
defaultValue: { table: { disable: true } },
|
|
40
|
+
suppressContentEditableWarning: { table: { disable: true } },
|
|
41
|
+
suppressHydrationWarning: { table: { disable: true } },
|
|
42
|
+
},
|
|
43
|
+
parameters: {
|
|
44
|
+
layout: "fullscreen",
|
|
45
|
+
docs: {
|
|
46
|
+
description: {
|
|
47
|
+
component: `
|
|
48
|
+
The \`Panel\` component slides in or expands from the edge of the screen to reveal additional content or functionality. Built on Mantine's \`Drawer\`, it enforces Recursica design tokens for styling.
|
|
49
|
+
|
|
50
|
+
### Anatomy
|
|
51
|
+
1. **Header** — Title and close icon, remains fixed on scroll
|
|
52
|
+
2. **Divider** — Separates header/footer from content
|
|
53
|
+
3. **Body (Slot)** — Scrollable content area for custom content
|
|
54
|
+
4. **Footer** — Fixed action buttons (Recursica-specific)
|
|
55
|
+
|
|
56
|
+
### Usage
|
|
57
|
+
\`\`\`tsx
|
|
58
|
+
const [opened, { open, close }] = useDisclosure(false);
|
|
59
|
+
|
|
60
|
+
<Button onClick={open}>Open Panel</Button>
|
|
61
|
+
<Panel opened={opened} onClose={close} title="Settings" position="right">
|
|
62
|
+
Content goes here
|
|
63
|
+
<Panel.Footer>
|
|
64
|
+
<Button variant="outline">Cancel</Button>
|
|
65
|
+
<Button variant="solid">Save</Button>
|
|
66
|
+
</Panel.Footer>
|
|
67
|
+
</Panel>
|
|
68
|
+
\`\`\`
|
|
69
|
+
`,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
9
73
|
};
|
|
10
74
|
|
|
11
75
|
export default meta;
|
|
12
76
|
|
|
13
|
-
type Story = StoryObj<
|
|
77
|
+
type Story = StoryObj<PanelStoryArgs>;
|
|
14
78
|
|
|
15
79
|
export const Default: Story = {
|
|
16
|
-
|
|
80
|
+
args: {
|
|
81
|
+
position: "right",
|
|
82
|
+
title: "Panel Title",
|
|
83
|
+
withOverlay: true,
|
|
84
|
+
withCloseButton: true,
|
|
85
|
+
wrapHeaderText: false,
|
|
86
|
+
},
|
|
87
|
+
render: ({ wrapHeaderText, ...args }: PanelStoryArgs) => {
|
|
88
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
89
|
+
const [opened, setOpened] = useState(false);
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<Button variant="solid" onClick={() => setOpened(true)}>
|
|
94
|
+
Open Panel
|
|
95
|
+
</Button>
|
|
96
|
+
<Panel
|
|
97
|
+
opened={opened}
|
|
98
|
+
onClose={() => setOpened(false)}
|
|
99
|
+
title="Panel Title"
|
|
100
|
+
position="right"
|
|
101
|
+
wrapHeaderText={wrapHeaderText}
|
|
102
|
+
{...(args as PanelProps)}
|
|
103
|
+
>
|
|
104
|
+
<Text>
|
|
105
|
+
This is the panel body content area. Panels slide in from the edge
|
|
106
|
+
of the screen to reveal supplementary information, navigation
|
|
107
|
+
options, or toolsets.
|
|
108
|
+
</Text>
|
|
109
|
+
<Panel.Footer>
|
|
110
|
+
<Button variant="outline" onClick={() => setOpened(false)}>
|
|
111
|
+
Cancel
|
|
112
|
+
</Button>
|
|
113
|
+
<Button variant="solid">Save</Button>
|
|
114
|
+
</Panel.Footer>
|
|
115
|
+
</Panel>
|
|
116
|
+
</>
|
|
117
|
+
);
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export const LeftPosition: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
position: "left",
|
|
124
|
+
title: "Navigation",
|
|
125
|
+
withOverlay: true,
|
|
126
|
+
withCloseButton: true,
|
|
127
|
+
wrapHeaderText: false,
|
|
128
|
+
},
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
130
|
+
render: ({ withLayer, layer, ...args }: PanelStoryArgs) => {
|
|
131
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
132
|
+
const [opened, setOpened] = useState(false);
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
<Button variant="outline" onClick={() => setOpened(true)}>
|
|
137
|
+
Open Left Panel
|
|
138
|
+
</Button>
|
|
139
|
+
<Panel
|
|
140
|
+
{...(args as PanelProps)}
|
|
141
|
+
opened={opened}
|
|
142
|
+
onClose={() => setOpened(false)}
|
|
143
|
+
>
|
|
144
|
+
<Text>
|
|
145
|
+
A panel sliding in from the left, commonly used for navigation menus
|
|
146
|
+
or sidebars.
|
|
147
|
+
</Text>
|
|
148
|
+
</Panel>
|
|
149
|
+
</>
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export const ScrollableContent: Story = {
|
|
155
|
+
args: {
|
|
156
|
+
position: "right",
|
|
157
|
+
title: "Scrollable Panel",
|
|
158
|
+
withOverlay: true,
|
|
159
|
+
withCloseButton: true,
|
|
160
|
+
wrapHeaderText: false,
|
|
161
|
+
},
|
|
162
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
163
|
+
render: ({ withLayer, layer, ...args }: PanelStoryArgs) => {
|
|
164
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
165
|
+
const [opened, setOpened] = useState(false);
|
|
166
|
+
|
|
167
|
+
return (
|
|
168
|
+
<>
|
|
169
|
+
<Button variant="solid" onClick={() => setOpened(true)}>
|
|
170
|
+
Open Scrollable Panel
|
|
171
|
+
</Button>
|
|
172
|
+
<Panel
|
|
173
|
+
{...(args as PanelProps)}
|
|
174
|
+
opened={opened}
|
|
175
|
+
onClose={() => setOpened(false)}
|
|
176
|
+
>
|
|
177
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
178
|
+
<p key={i} style={{ marginBottom: "1rem" }}>
|
|
179
|
+
Paragraph {i + 1}: This is sample content to demonstrate the
|
|
180
|
+
scrollable behavior of the panel when content exceeds the viewport
|
|
181
|
+
height.
|
|
182
|
+
</p>
|
|
183
|
+
))}
|
|
184
|
+
<Panel.Footer>
|
|
185
|
+
<Button variant="outline" onClick={() => setOpened(false)}>
|
|
186
|
+
Close
|
|
187
|
+
</Button>
|
|
188
|
+
<Button variant="solid">Apply</Button>
|
|
189
|
+
</Panel.Footer>
|
|
190
|
+
</Panel>
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const LongTitle: Story = {
|
|
197
|
+
args: {
|
|
198
|
+
position: "right",
|
|
199
|
+
title:
|
|
200
|
+
"This is a ridiculously long panel title designed to test how the header CSS handles text overflow and whether it truncates correctly or breaks the layout",
|
|
201
|
+
withOverlay: true,
|
|
202
|
+
withCloseButton: true,
|
|
203
|
+
wrapHeaderText: true,
|
|
204
|
+
},
|
|
205
|
+
render: ({ ...args }: PanelStoryArgs) => {
|
|
206
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
207
|
+
const [opened, setOpened] = useState(false);
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<>
|
|
211
|
+
<Button variant="solid" onClick={() => setOpened(true)}>
|
|
212
|
+
Open Long Title Panel
|
|
213
|
+
</Button>
|
|
214
|
+
<Panel
|
|
215
|
+
{...(args as PanelProps)}
|
|
216
|
+
opened={opened}
|
|
217
|
+
onClose={() => setOpened(false)}
|
|
218
|
+
>
|
|
219
|
+
<Text>
|
|
220
|
+
Check the header to see if the long title is handled gracefully
|
|
221
|
+
without pushing the close button off screen.
|
|
222
|
+
</Text>
|
|
223
|
+
</Panel>
|
|
224
|
+
</>
|
|
225
|
+
);
|
|
226
|
+
},
|
|
17
227
|
};
|
|
@@ -1,7 +1,156 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Drawer as MantineDrawer,
|
|
4
|
+
type DrawerProps as MantineDrawerProps,
|
|
5
|
+
} from "@mantine/core";
|
|
6
|
+
import {
|
|
7
|
+
filterStylingProps,
|
|
8
|
+
type RecursicaOverStyled,
|
|
9
|
+
} from "../../utils/filterStylingProps";
|
|
10
|
+
import styles from "./Panel.module.css";
|
|
2
11
|
|
|
3
|
-
|
|
12
|
+
// ============================================================
|
|
13
|
+
// PANEL (Drawer)
|
|
14
|
+
// ============================================================
|
|
4
15
|
|
|
5
|
-
export
|
|
6
|
-
|
|
16
|
+
export interface RecursicaPanelProps extends MantineDrawerProps {
|
|
17
|
+
/**
|
|
18
|
+
* If true, forces the header text to a single line and truncates with an ellipsis.
|
|
19
|
+
* Note: While the prop is named `wrapHeaderText` for backward compatibility,
|
|
20
|
+
* setting it to `true` actually PREVENTS wrapping (it forces truncation).
|
|
21
|
+
*/
|
|
22
|
+
wrapHeaderText?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Recursica Panel root props. Extends Mantine Drawer.
|
|
27
|
+
*/
|
|
28
|
+
export type PanelProps = RecursicaOverStyled<RecursicaPanelProps>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Recursica Panel component wrapping Mantine's Drawer.
|
|
32
|
+
*
|
|
33
|
+
* Panels slide in or expand from the edge of the screen to reveal
|
|
34
|
+
* additional content or functionality. They are commonly used to provide
|
|
35
|
+
* supplementary information, navigation options, or toolsets without
|
|
36
|
+
* cluttering the main interface.
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* <Panel opened={opened} onClose={close} title="Panel Title" position="right">
|
|
40
|
+
* <Panel.Body>
|
|
41
|
+
* Content goes here
|
|
42
|
+
* </Panel.Body>
|
|
43
|
+
* </Panel>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* Mantine Drawer sub-components available via dot-notation:
|
|
47
|
+
* - `Panel.Header` — Top section with title and close button
|
|
48
|
+
* - `Panel.Title` — Title text within the header
|
|
49
|
+
* - `Panel.CloseButton` — Close button within the header
|
|
50
|
+
* - `Panel.Body` — Scrollable body content area
|
|
51
|
+
* - `Panel.Content` — Outer content container
|
|
52
|
+
* - `Panel.Overlay` — Background overlay
|
|
53
|
+
* - `Panel.Root` — Root element for advanced composition
|
|
54
|
+
* - `Panel.Stack` — Stacked drawer context
|
|
55
|
+
*/
|
|
56
|
+
const PanelBase = function Panel({
|
|
57
|
+
overStyled = false,
|
|
58
|
+
position = "right",
|
|
59
|
+
keepMounted = true,
|
|
60
|
+
wrapHeaderText = false,
|
|
61
|
+
...rest
|
|
62
|
+
}: PanelProps) {
|
|
63
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
64
|
+
|
|
65
|
+
// Bind CSS module classes to Mantine's internal classNames API
|
|
66
|
+
const mergedClassNames: Partial<Record<string, string>> = {
|
|
67
|
+
content: styles.content,
|
|
68
|
+
header: styles.header,
|
|
69
|
+
title: wrapHeaderText ? styles.titleTruncate : styles.title,
|
|
70
|
+
body: styles.body,
|
|
71
|
+
inner: styles.inner,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const classNamesProp = (sanitizedProps as Record<string, unknown>).classNames;
|
|
75
|
+
if (
|
|
76
|
+
classNamesProp &&
|
|
77
|
+
typeof classNamesProp === "object" &&
|
|
78
|
+
!Array.isArray(classNamesProp)
|
|
79
|
+
) {
|
|
80
|
+
const o = classNamesProp as Record<string, string>;
|
|
81
|
+
Object.keys(o).forEach((key) => {
|
|
82
|
+
if (mergedClassNames[key]) {
|
|
83
|
+
mergedClassNames[key] = `${mergedClassNames[key]} ${o[key]}`;
|
|
84
|
+
} else {
|
|
85
|
+
mergedClassNames[key] = o[key];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<MantineDrawer
|
|
92
|
+
position={position} /* Recursica default: right; Mantine default: left */
|
|
93
|
+
keepMounted={keepMounted}
|
|
94
|
+
closeOnClickOutside={rest.closeOnClickOutside ?? Boolean(rest.opened)}
|
|
95
|
+
{...(sanitizedProps as unknown as MantineDrawerProps)}
|
|
96
|
+
classNames={mergedClassNames}
|
|
97
|
+
/>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
PanelBase.displayName = "Panel";
|
|
101
|
+
|
|
102
|
+
// ============================================================
|
|
103
|
+
// PANEL FOOTER (custom — Mantine Drawer has no Footer sub-component)
|
|
104
|
+
// ============================================================
|
|
105
|
+
|
|
106
|
+
export type PanelFooterProps = RecursicaOverStyled<
|
|
107
|
+
React.HTMLAttributes<HTMLDivElement>
|
|
108
|
+
>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Panel footer section with action buttons.
|
|
112
|
+
* Separated from the body by a divider. Remains fixed at the bottom.
|
|
113
|
+
* This is a Recursica-specific sub-component; Mantine Drawer does not
|
|
114
|
+
* natively provide a footer.
|
|
115
|
+
*/
|
|
116
|
+
export const PanelFooter = forwardRef<HTMLDivElement, PanelFooterProps>(
|
|
117
|
+
function PanelFooter({ overStyled = false, ...rest }, ref) {
|
|
118
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
119
|
+
const classNameProp = (sanitizedProps as Record<string, unknown>)
|
|
120
|
+
.className as string | undefined;
|
|
121
|
+
|
|
122
|
+
const finalClassName = classNameProp
|
|
123
|
+
? `${styles.footer} ${classNameProp}`
|
|
124
|
+
: styles.footer;
|
|
125
|
+
|
|
126
|
+
return <div ref={ref} className={finalClassName} {...sanitizedProps} />;
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
PanelFooter.displayName = "PanelFooter";
|
|
130
|
+
|
|
131
|
+
// ============================================================
|
|
132
|
+
// DOT NOTATION EXPORT
|
|
133
|
+
// ============================================================
|
|
134
|
+
|
|
135
|
+
type PanelComponent = typeof PanelBase & {
|
|
136
|
+
Root: typeof MantineDrawer.Root;
|
|
137
|
+
Overlay: typeof MantineDrawer.Overlay;
|
|
138
|
+
Content: typeof MantineDrawer.Content;
|
|
139
|
+
Header: typeof MantineDrawer.Header;
|
|
140
|
+
Title: typeof MantineDrawer.Title;
|
|
141
|
+
CloseButton: typeof MantineDrawer.CloseButton;
|
|
142
|
+
Body: typeof MantineDrawer.Body;
|
|
143
|
+
Stack: typeof MantineDrawer.Stack;
|
|
144
|
+
Footer: typeof PanelFooter;
|
|
7
145
|
};
|
|
146
|
+
|
|
147
|
+
export const Panel = PanelBase as PanelComponent;
|
|
148
|
+
Panel.Root = MantineDrawer.Root;
|
|
149
|
+
Panel.Overlay = MantineDrawer.Overlay;
|
|
150
|
+
Panel.Content = MantineDrawer.Content;
|
|
151
|
+
Panel.Header = MantineDrawer.Header;
|
|
152
|
+
Panel.Title = MantineDrawer.Title;
|
|
153
|
+
Panel.CloseButton = MantineDrawer.CloseButton;
|
|
154
|
+
Panel.Body = MantineDrawer.Body;
|
|
155
|
+
Panel.Stack = MantineDrawer.Stack;
|
|
156
|
+
Panel.Footer = PanelFooter;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Tooltip – Implementation Notes
|
|
2
|
+
|
|
3
|
+
Decisions and design tweaks strictly tailored for the UI Kit's Tooltip wrapped against `@mantine/core`. This is a living document that tracks _why_ specific logic decisions exist.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Single Component API (Not Composable)
|
|
8
|
+
|
|
9
|
+
**Decision:** Unlike HoverCard (which uses `HoverCard` + `HoverCard.Target` + `HoverCard.Dropdown`), Tooltip is a single wrapper component.
|
|
10
|
+
|
|
11
|
+
**Implementation:** Mantine's `Tooltip` takes content via a `label` prop and wraps the trigger element as `children`. There are no separate Target/Dropdown sub-components. The Recursica wrapper preserves this exact API.
|
|
12
|
+
|
|
13
|
+
**Static sub-components:** `Tooltip.Floating` and `Tooltip.Group` are exposed as pass-through references to Mantine's implementations. These do not receive Recursica styling treatment — they are utility wrappers for cursor-following tooltips and shared delay grouping respectively.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Token Namespace: `tooltip`
|
|
18
|
+
|
|
19
|
+
**Decision:** The CSS module exclusively uses variables from the `--recursica_ui-kit_components_tooltip_*` namespace.
|
|
20
|
+
|
|
21
|
+
**Implementation:** The Recursica token system defines the `tooltip` namespace covering:
|
|
22
|
+
|
|
23
|
+
- Geometry: border-radius, border-size, min-width, min-height, max-width, padding
|
|
24
|
+
- Typography: text_font-\* (family, size, style, weight, letter-spacing, line-height, text-decoration, text-transform)
|
|
25
|
+
- Colors (layer-aware): background, border-color, text
|
|
26
|
+
- Elevation: box-shadow
|
|
27
|
+
- Beak: beak-size (16px), beak-inset (8px)
|
|
28
|
+
|
|
29
|
+
No tokens from other component namespaces are referenced.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 3. Hardcoded Values
|
|
34
|
+
|
|
35
|
+
### `border-style: solid` (CSS module)
|
|
36
|
+
|
|
37
|
+
Mantine renders the tooltip using its `Box` component, which does not set `border-style` natively. Without this hardcoded value, the border-width and border-color tokens would have no visible effect. Same pattern as Menu and HoverCard dropdowns.
|
|
38
|
+
|
|
39
|
+
### `arrowSize` defaulted to `16` (Tooltip.tsx)
|
|
40
|
+
|
|
41
|
+
Mantine's `arrowSize` prop is a JavaScript number used for inline style calculations: it sets `width`, `height`, and a positioning offset (`-arrowSize/2`) directly on the arrow `<div>` element. These inline styles cannot be overridden via CSS without `!important`, and the positioning offset has no CSS equivalent. The beak size cannot be fully CSS-driven.
|
|
42
|
+
|
|
43
|
+
The default value `16` matches the Recursica `beak-size` token (`--recursica_ui-kit_components_tooltip_properties_beak-size: 16px`). Developers can override `arrowSize` if needed. This is documented as an open issue in `docs/COMPONENT_ISSUES.md`.
|
|
44
|
+
|
|
45
|
+
**Note:** Mantine calls this the "arrow"; Recursica calls it the "beak". The Recursica prop `withBeak` (defaulting to `true`) maps to Mantine's `withArrow`. Both are accepted; `withBeak` takes precedence.
|
|
46
|
+
|
|
47
|
+
### `multiline={true}` (Tooltip.tsx)
|
|
48
|
+
|
|
49
|
+
Mantine's `multiline` prop controls whether tooltip text wraps (`white-space: nowrap` when false). Recursica always enables multiline because the design system defines a `max-width` token (300px) — text should wrap naturally within that constraint rather than overflowing. The `multiline` prop is not exposed to developers.
|
|
50
|
+
|
|
51
|
+
### Flexbox centering (CSS module)
|
|
52
|
+
|
|
53
|
+
`display: flex; align-items: center; justify-content: center;` is applied to the `.tooltip` class. This ensures text is vertically and horizontally centered within the `min-height: 48px` container defined by the design token. Without this, text sits at the top of the tooltip.
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 4. Recursica `withBeak` Prop
|
|
58
|
+
|
|
59
|
+
**Decision:** `withBeak` is the official Recursica prop for controlling beak visibility, defaulting to `true`.
|
|
60
|
+
|
|
61
|
+
**Implementation:** Both `withBeak` and Mantine's `withArrow` are accepted. Resolution order: `withBeak ?? withArrow`. When both are provided, `withBeak` takes precedence. The default of `true` means tooltips show the beak by default, matching the Recursica design intent.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 5. ClassNames Binding
|
|
66
|
+
|
|
67
|
+
**Decision:** CSS module classes are bound via the `classNames` prop on Mantine's Tooltip root.
|
|
68
|
+
|
|
69
|
+
**Implementation:** The stylesNames for Tooltip are `tooltip` (the container) and `arrow` (the beak). Both are mapped to their respective CSS module classes: `{ tooltip: styles.tooltip, arrow: styles.arrow }`. Consumer-provided `classNames` are merged additively when `overStyled` is true.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 6. Tooltip.Floating and Tooltip.Group
|
|
74
|
+
|
|
75
|
+
**Decision:** These static sub-components are direct pass-throughs to Mantine with no Recursica styling.
|
|
76
|
+
|
|
77
|
+
**Implementation:** `Tooltip.Floating` follows the cursor and uses a different rendering mechanism than standard Tooltip. `Tooltip.Group` is a utility for shared delay timing. Neither has Recursica design tokens defined, so they remain unstyled pass-throughs. If tokens are added in the future, they can be wrapped independently.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 7. Default Position Override
|
|
82
|
+
|
|
83
|
+
**Decision:** Recursica defaults `position` to `"top"`. Mantine defaults to `"bottom"`.
|
|
84
|
+
|
|
85
|
+
**Implementation:** The `position="top"` default is set on the Mantine root element before the prop spread, so developer-provided `position` values still take precedence. This aligns with Recursica's design intent for overlay components to appear above their trigger by default.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/* HARDCODED VALUES:
|
|
2
|
+
- border-style: solid. Structural rendering rule for the tooltip border (Mantine uses Box
|
|
3
|
+
which may not set border-style natively). Same pattern as Menu / HoverCard.
|
|
4
|
+
- arrowSize defaults to 16 in Tooltip.tsx. Mantine uses arrowSize for inline width/height
|
|
5
|
+
and positioning (-arrowSize/2) calculations that cannot be CSS-driven. The default matches
|
|
6
|
+
the Recursica beak-size token (16px). See COMPONENT_ISSUES.md for details.
|
|
7
|
+
- All structural layout (display, position, overflow) is deferred to Mantine's native
|
|
8
|
+
behavior. We only override visual design tokens (colors, typography, spacing, borders).
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/* ======================================
|
|
12
|
+
TOOLTIP CONTAINER
|
|
13
|
+
====================================== */
|
|
14
|
+
|
|
15
|
+
.tooltip {
|
|
16
|
+
background-color: var(
|
|
17
|
+
--recursica_ui-kit_components_tooltip_properties_colors_background
|
|
18
|
+
);
|
|
19
|
+
border-style: solid; /* HARDCODE: Mantine Box does not set border-style natively */
|
|
20
|
+
border-width: var(
|
|
21
|
+
--recursica_ui-kit_components_tooltip_properties_border-size
|
|
22
|
+
);
|
|
23
|
+
border-color: var(
|
|
24
|
+
--recursica_ui-kit_components_tooltip_properties_colors_border-color
|
|
25
|
+
);
|
|
26
|
+
border-radius: var(
|
|
27
|
+
--recursica_ui-kit_components_tooltip_properties_border-radius
|
|
28
|
+
);
|
|
29
|
+
box-shadow: var(--recursica_ui-kit_components_tooltip_properties_elevation);
|
|
30
|
+
|
|
31
|
+
min-width: var(--recursica_ui-kit_components_tooltip_properties_min-width);
|
|
32
|
+
min-height: var(--recursica_ui-kit_components_tooltip_properties_min-height);
|
|
33
|
+
max-width: var(--recursica_ui-kit_components_tooltip_properties_max-width);
|
|
34
|
+
|
|
35
|
+
padding: var(
|
|
36
|
+
--recursica_ui-kit_components_tooltip_properties_vertical-padding
|
|
37
|
+
)
|
|
38
|
+
var(--recursica_ui-kit_components_tooltip_properties_horizontal-padding);
|
|
39
|
+
|
|
40
|
+
/* Vertically center text within min-height container */
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
|
|
44
|
+
/* Typography */
|
|
45
|
+
font-family: var(
|
|
46
|
+
--recursica_ui-kit_components_tooltip_properties_text_font-family
|
|
47
|
+
);
|
|
48
|
+
font-size: var(
|
|
49
|
+
--recursica_ui-kit_components_tooltip_properties_text_font-size
|
|
50
|
+
);
|
|
51
|
+
font-style: var(
|
|
52
|
+
--recursica_ui-kit_components_tooltip_properties_text_font-style
|
|
53
|
+
);
|
|
54
|
+
font-weight: var(
|
|
55
|
+
--recursica_ui-kit_components_tooltip_properties_text_font-weight
|
|
56
|
+
);
|
|
57
|
+
letter-spacing: var(
|
|
58
|
+
--recursica_ui-kit_components_tooltip_properties_text_letter-spacing
|
|
59
|
+
);
|
|
60
|
+
line-height: var(
|
|
61
|
+
--recursica_ui-kit_components_tooltip_properties_text_line-height
|
|
62
|
+
);
|
|
63
|
+
text-decoration: var(
|
|
64
|
+
--recursica_ui-kit_components_tooltip_properties_text_text-decoration
|
|
65
|
+
);
|
|
66
|
+
text-transform: var(
|
|
67
|
+
--recursica_ui-kit_components_tooltip_properties_text_text-transform
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
color: var(--recursica_ui-kit_components_tooltip_properties_colors_text);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* ======================================
|
|
74
|
+
ARROW / BEAK
|
|
75
|
+
====================================== */
|
|
76
|
+
|
|
77
|
+
.arrow {
|
|
78
|
+
border-color: var(
|
|
79
|
+
--recursica_ui-kit_components_tooltip_properties_colors_border-color
|
|
80
|
+
);
|
|
81
|
+
}
|