@recursica/mui-adapter 0.2.0 → 0.3.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 +6 -0
- package/dist/mui-adapter.cjs +1 -1
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +249 -90
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Box/Box.d.ts +2 -3
- package/dist/src/components/Button/Button.d.ts +33 -2
- package/dist/src/components/Container/Container.d.ts +8 -2
- package/dist/src/components/Flex/Flex.d.ts +25 -2
- package/dist/src/components/Group/Group.d.ts +10 -2
- package/dist/src/components/Link/Link.d.ts +13 -2
- package/dist/src/components/Stack/Stack.d.ts +8 -2
- package/dist/src/components/Text/Text.d.ts +18 -2
- package/dist/src/components/Title/Title.d.ts +17 -2
- package/dist/src/components/Typography/Typography.d.ts +27 -0
- package/dist/src/utils/filterStylingProps.d.ts +3 -0
- package/package.json +2 -1
- package/src/Introduction.stories.tsx +113 -110
- package/src/OverStyling.tsx +18 -23
- package/src/Version.tsx +14 -21
- package/src/components/Accordion/Accordion.stories.tsx +19 -0
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +19 -0
- package/src/components/Avatar/Avatar.stories.tsx +19 -0
- package/src/components/Badge/Badge.stories.tsx +19 -0
- package/src/components/Box/Box.stories.tsx +19 -10
- package/src/components/Box/Box.tsx +11 -14
- package/src/components/Box/IMPLEMENTATION_NOTES.md +5 -0
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +19 -0
- package/src/components/Button/BUTTON_IMPLEMENTATION_NOTES.md +17 -0
- package/src/components/Button/Button.module.css +300 -0
- package/src/components/Button/Button.stories.tsx +136 -5
- package/src/components/Button/Button.tsx +116 -5
- package/src/components/Card/Card.stories.tsx +19 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +19 -0
- package/src/components/Chip/Chip.stories.tsx +19 -0
- package/src/components/Container/Container.stories.tsx +19 -0
- package/src/components/Container/Container.tsx +56 -5
- package/src/components/Container/IMPLEMENTATION_NOTES.md +5 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +19 -0
- package/src/components/Dropdown/Dropdown.stories.tsx +19 -0
- package/src/components/FileInput/FileInput.stories.tsx +19 -0
- package/src/components/FileUpload/FileUpload.stories.tsx +19 -0
- package/src/components/Flex/Flex.stories.tsx +19 -0
- package/src/components/Flex/Flex.tsx +77 -5
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +19 -0
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +19 -0
- package/src/components/Group/Group.stories.tsx +133 -5
- package/src/components/Group/Group.tsx +57 -5
- package/src/components/HoverCard/HoverCard.stories.tsx +19 -0
- package/src/components/Label/Label.stories.tsx +19 -0
- package/src/components/Link/Link.module.css +133 -0
- package/src/components/Link/Link.stories.tsx +52 -4
- package/src/components/Link/Link.tsx +47 -5
- package/src/components/Loader/Loader.stories.tsx +19 -0
- package/src/components/Menu/Menu.stories.tsx +19 -0
- package/src/components/Modal/Modal.stories.tsx +19 -0
- package/src/components/NumberInput/NumberInput.stories.tsx +19 -0
- package/src/components/Pagination/Pagination.stories.tsx +19 -0
- package/src/components/Panel/Panel.stories.tsx +19 -0
- package/src/components/Radio/Radio.stories.tsx +19 -0
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +19 -0
- package/src/components/SegmentedControl/SegmentedControl.stories.tsx +19 -0
- package/src/components/Slider/Slider.stories.tsx +19 -0
- package/src/components/Stack/Stack.stories.tsx +118 -5
- package/src/components/Stack/Stack.tsx +37 -5
- package/src/components/Stepper/Stepper.stories.tsx +19 -0
- package/src/components/Switch/Switch.stories.tsx +19 -0
- package/src/components/Table/Table.stories.tsx +19 -0
- package/src/components/Tabs/Tabs.stories.tsx +19 -0
- package/src/components/Text/Text.stories.tsx +87 -3
- package/src/components/Text/Text.tsx +27 -4
- package/src/components/TextArea/TextArea.stories.tsx +19 -0
- package/src/components/TextField/TextField.stories.tsx +19 -0
- package/src/components/TimePicker/TimePicker.stories.tsx +19 -0
- package/src/components/Timeline/Timeline.stories.tsx +19 -0
- package/src/components/Title/Title.stories.tsx +68 -3
- package/src/components/Title/Title.tsx +29 -5
- package/src/components/Toast/Toast.stories.tsx +19 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +19 -0
- package/src/components/TransferList/TransferList.stories.tsx +19 -0
- package/src/components/Typography/Typography.tsx +42 -0
- package/src/utils/ColorSchemeWrapper.tsx +1 -5
- package/src/utils/filterStylingProps.ts +13 -1
|
@@ -1,16 +1,81 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
2
|
import { Title } from "./Title";
|
|
3
|
-
import {
|
|
3
|
+
import { Layer } from "@recursica/adapter-common";
|
|
4
4
|
|
|
5
5
|
const meta: Meta<typeof Title> = {
|
|
6
|
-
title: "UI-Kit
|
|
6
|
+
title: "UI-Kit/Title",
|
|
7
7
|
component: Title,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
"The semantic `<Title>` abstraction intrinsically links pure `h1-h6` tag generation with exact Recursica design boundaries to preserve SEO and screen reader trees uniformly globally.",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
controls: {
|
|
17
|
+
include: [
|
|
18
|
+
"layer",
|
|
19
|
+
"withLayer",
|
|
20
|
+
"order",
|
|
21
|
+
"children",
|
|
22
|
+
"component",
|
|
23
|
+
"variant",
|
|
24
|
+
"size",
|
|
25
|
+
"icon",
|
|
26
|
+
"disabled",
|
|
27
|
+
"href",
|
|
28
|
+
"onClick",
|
|
29
|
+
"onChange",
|
|
30
|
+
"value",
|
|
31
|
+
"checked",
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
argTypes: {
|
|
36
|
+
order: {
|
|
37
|
+
control: "select",
|
|
38
|
+
options: [1, 2, 3, 4, 5, 6],
|
|
39
|
+
description:
|
|
40
|
+
"Controls the `h` tag and the resultant typographical weighting natively mapped to Recursica.",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
9
43
|
};
|
|
10
44
|
|
|
11
45
|
export default meta;
|
|
46
|
+
|
|
12
47
|
type Story = StoryObj<typeof Title>;
|
|
13
48
|
|
|
14
49
|
export const Default: Story = {
|
|
15
|
-
|
|
50
|
+
args: {
|
|
51
|
+
order: 1,
|
|
52
|
+
children: "Semantic H1 Document Boundary",
|
|
53
|
+
},
|
|
54
|
+
render: ({ ...args }) => (
|
|
55
|
+
<Layer layer={0} style={{ padding: "48px" }}>
|
|
56
|
+
<Title {...args} />
|
|
57
|
+
</Layer>
|
|
58
|
+
),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const StaticVariations: Story = {
|
|
62
|
+
args: {},
|
|
63
|
+
render: () => (
|
|
64
|
+
<Layer
|
|
65
|
+
layer={0}
|
|
66
|
+
style={{
|
|
67
|
+
padding: "48px",
|
|
68
|
+
display: "flex",
|
|
69
|
+
flexDirection: "column",
|
|
70
|
+
gap: "24px",
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<Title order={1}>H1 Title</Title>
|
|
74
|
+
<Title order={2}>H2 Title</Title>
|
|
75
|
+
<Title order={3}>H3 Title</Title>
|
|
76
|
+
<Title order={4}>H4 Title</Title>
|
|
77
|
+
<Title order={5}>H5 Title</Title>
|
|
78
|
+
<Title order={6}>H6 Title</Title>
|
|
79
|
+
</Layer>
|
|
80
|
+
),
|
|
16
81
|
};
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Typography } from "../Typography/Typography";
|
|
3
|
+
import { type RecursicaOverStyled } from "../../utils/filterStylingProps";
|
|
4
|
+
import { type TypographyProps as MuiTypographyProps } from "@mui/material";
|
|
2
5
|
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
export type RecursicaTitleProps = Omit<MuiTypographyProps, "variant"> & {
|
|
7
|
+
order?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
component?: React.ElementType;
|
|
7
10
|
};
|
|
11
|
+
|
|
12
|
+
export type TitleProps = RecursicaOverStyled<RecursicaTitleProps>;
|
|
13
|
+
|
|
14
|
+
export const Title = forwardRef<HTMLElement, TitleProps>(function Title(
|
|
15
|
+
{ order = 1, component, ...rest },
|
|
16
|
+
ref,
|
|
17
|
+
) {
|
|
18
|
+
const typographyClass = `recursica_brand_typography_h${order}`;
|
|
19
|
+
const defaultComponent = `h${order}` as React.ElementType;
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Typography
|
|
23
|
+
ref={ref}
|
|
24
|
+
typographyClass={typographyClass}
|
|
25
|
+
component={component || defaultComponent}
|
|
26
|
+
{...rest}
|
|
27
|
+
/>
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
Title.displayName = "Title";
|
|
@@ -6,6 +6,25 @@ const meta: Meta<typeof Toast> = {
|
|
|
6
6
|
title: "UI-Kit/🚧 Toast",
|
|
7
7
|
component: Toast,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: {
|
|
11
|
+
include: [
|
|
12
|
+
"layer",
|
|
13
|
+
"withLayer",
|
|
14
|
+
"children",
|
|
15
|
+
"component",
|
|
16
|
+
"variant",
|
|
17
|
+
"size",
|
|
18
|
+
"icon",
|
|
19
|
+
"disabled",
|
|
20
|
+
"href",
|
|
21
|
+
"onClick",
|
|
22
|
+
"onChange",
|
|
23
|
+
"value",
|
|
24
|
+
"checked",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
9
28
|
};
|
|
10
29
|
|
|
11
30
|
export default meta;
|
|
@@ -6,6 +6,25 @@ const meta: Meta<typeof Tooltip> = {
|
|
|
6
6
|
title: "UI-Kit/🚧 Tooltip",
|
|
7
7
|
component: Tooltip,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: {
|
|
11
|
+
include: [
|
|
12
|
+
"layer",
|
|
13
|
+
"withLayer",
|
|
14
|
+
"children",
|
|
15
|
+
"component",
|
|
16
|
+
"variant",
|
|
17
|
+
"size",
|
|
18
|
+
"icon",
|
|
19
|
+
"disabled",
|
|
20
|
+
"href",
|
|
21
|
+
"onClick",
|
|
22
|
+
"onChange",
|
|
23
|
+
"value",
|
|
24
|
+
"checked",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
9
28
|
};
|
|
10
29
|
|
|
11
30
|
export default meta;
|
|
@@ -6,6 +6,25 @@ const meta: Meta<typeof TransferList> = {
|
|
|
6
6
|
title: "UI-Kit/🚧 TransferList",
|
|
7
7
|
component: TransferList,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
+
parameters: {
|
|
10
|
+
controls: {
|
|
11
|
+
include: [
|
|
12
|
+
"layer",
|
|
13
|
+
"withLayer",
|
|
14
|
+
"children",
|
|
15
|
+
"component",
|
|
16
|
+
"variant",
|
|
17
|
+
"size",
|
|
18
|
+
"icon",
|
|
19
|
+
"disabled",
|
|
20
|
+
"href",
|
|
21
|
+
"onClick",
|
|
22
|
+
"onChange",
|
|
23
|
+
"value",
|
|
24
|
+
"checked",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
9
28
|
};
|
|
10
29
|
|
|
11
30
|
export default meta;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Typography as MuiTypography,
|
|
4
|
+
type TypographyProps as MuiTypographyProps,
|
|
5
|
+
} from "@mui/material";
|
|
6
|
+
import {
|
|
7
|
+
filterStylingProps,
|
|
8
|
+
type RecursicaOverStyled,
|
|
9
|
+
} from "../../utils/filterStylingProps";
|
|
10
|
+
|
|
11
|
+
export type TypographyProps = RecursicaOverStyled<
|
|
12
|
+
Omit<MuiTypographyProps, "variant"> & {
|
|
13
|
+
/**
|
|
14
|
+
* Internal typography class mapping
|
|
15
|
+
*/
|
|
16
|
+
typographyClass: string;
|
|
17
|
+
component?: React.ElementType;
|
|
18
|
+
}
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export const Typography = forwardRef<HTMLElement, TypographyProps>(
|
|
22
|
+
function Typography({ typographyClass, overStyled = false, ...rest }, ref) {
|
|
23
|
+
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
24
|
+
const restRecord = sanitizedProps as Record<string, unknown>;
|
|
25
|
+
|
|
26
|
+
const classNameProp = restRecord.className as string | undefined;
|
|
27
|
+
const finalClass = classNameProp
|
|
28
|
+
? `${typographyClass} ${classNameProp}`
|
|
29
|
+
: typographyClass;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<MuiTypography
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={finalClass}
|
|
35
|
+
variant="inherit"
|
|
36
|
+
{...sanitizedProps}
|
|
37
|
+
/>
|
|
38
|
+
);
|
|
39
|
+
},
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
Typography.displayName = "Typography";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useMantineColorScheme } from "@mantine/core";
|
|
2
1
|
import { useEffect } from "react";
|
|
3
2
|
import { addons } from "storybook/internal/preview-api";
|
|
4
3
|
import { DARK_MODE_EVENT_NAME } from "storybook-dark-mode";
|
|
@@ -10,18 +9,15 @@ export function ColorSchemeWrapper({
|
|
|
10
9
|
}: {
|
|
11
10
|
children: React.ReactNode;
|
|
12
11
|
}) {
|
|
13
|
-
const { setColorScheme } = useMantineColorScheme();
|
|
14
|
-
|
|
15
12
|
useEffect(() => {
|
|
16
13
|
const handleColorScheme = (value: boolean) => {
|
|
17
14
|
const theme = value ? "dark" : "light";
|
|
18
|
-
setColorScheme(theme);
|
|
19
15
|
document.documentElement.setAttribute("data-recursica-theme", theme);
|
|
20
16
|
};
|
|
21
17
|
|
|
22
18
|
channel.on(DARK_MODE_EVENT_NAME, handleColorScheme);
|
|
23
19
|
return () => channel.off(DARK_MODE_EVENT_NAME, handleColorScheme);
|
|
24
|
-
}, [
|
|
20
|
+
}, []);
|
|
25
21
|
|
|
26
22
|
return <>{children}</>;
|
|
27
23
|
}
|
|
@@ -89,7 +89,7 @@ const LAYOUT_PROPS = new Set([
|
|
|
89
89
|
"right",
|
|
90
90
|
]);
|
|
91
91
|
|
|
92
|
-
const SPACING_MAP: Record<string, string> = {
|
|
92
|
+
export const SPACING_MAP: Record<string, string> = {
|
|
93
93
|
"rec-none": "var(--recursica_brand_dimensions_general_none)",
|
|
94
94
|
"rec-sm": "var(--recursica_brand_dimensions_general_sm)",
|
|
95
95
|
"rec-default": "var(--recursica_brand_dimensions_general_default)",
|
|
@@ -101,6 +101,18 @@ const SPACING_MAP: Record<string, string> = {
|
|
|
101
101
|
|
|
102
102
|
export type ForbiddenStyles = { [K in BlockedStylingKeys]?: never };
|
|
103
103
|
|
|
104
|
+
export type OmitSx<T> = Omit<T, "sx">;
|
|
105
|
+
|
|
106
|
+
export function filterSxProp<T extends Record<string, unknown>>(
|
|
107
|
+
props: T,
|
|
108
|
+
): Omit<T, "sx"> {
|
|
109
|
+
const sanitized = { ...props };
|
|
110
|
+
if ("sx" in sanitized) {
|
|
111
|
+
delete sanitized["sx"];
|
|
112
|
+
}
|
|
113
|
+
return sanitized as Omit<T, "sx">;
|
|
114
|
+
}
|
|
115
|
+
|
|
104
116
|
export type RecursicaOverStyled<T> =
|
|
105
117
|
| (Omit<T, BlockedStylingKeys> &
|
|
106
118
|
ForbiddenStyles & { overStyled?: false | undefined })
|