@recursica/mui-adapter 0.2.0 → 0.4.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/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 +286 -91
- 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 +40 -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/Loader/Loader.d.ts +9 -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 +33 -0
- package/src/components/Button/Button.module.css +343 -0
- package/src/components/Button/Button.stories.tsx +181 -5
- package/src/components/Button/Button.tsx +141 -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_IMPLEMENTATION_NOTES.md +25 -0
- package/src/components/Loader/Loader.module.css +166 -0
- package/src/components/Loader/Loader.stories.tsx +93 -6
- package/src/components/Loader/Loader.tsx +69 -5
- 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,3 +1,41 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { RecursicaLoaderProps } from '../Loader/Loader';
|
|
3
|
+
import { ButtonProps as MuiButtonProps } from '@mui/material';
|
|
4
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
5
|
+
export interface RecursicaButtonProps {
|
|
6
|
+
variant?: "solid" | "outline" | "text";
|
|
7
|
+
size?: "default" | "small";
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* For polymorphic support (e.g., `component="a"`), native to MUI.
|
|
11
|
+
*/
|
|
12
|
+
component?: React.ElementType;
|
|
13
|
+
/** Which Recursica Loader variant to use */
|
|
14
|
+
loaderVariant?: RecursicaLoaderProps["variant"];
|
|
15
|
+
/** The size variant for the loader */
|
|
16
|
+
loaderSize?: RecursicaLoaderProps["size"];
|
|
17
|
+
/** Whether to use the Recursica loader or fallback to the Mantine loader */
|
|
18
|
+
useRecursicaLoader?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export type ButtonProps = RecursicaOverStyled<Omit<MuiButtonProps, "variant" | "size" | "color" | "fullWidth"> & RecursicaButtonProps>;
|
|
21
|
+
/**
|
|
22
|
+
* Recursica Button component wrapping MUI's Button.
|
|
23
|
+
*
|
|
24
|
+
* Supports polymorphism via the `component` prop for custom element rendering.
|
|
25
|
+
* This is particularly useful when you need a button that behaves as a hyperlink (rendering an `<a>` tag)
|
|
26
|
+
* or integrates with a routing library (e.g., `react-router-dom` or Next.js), while preserving full visual styling.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* // Renders as an <a> tag natively
|
|
31
|
+
* <Button component="a" href="/dashboard" target="_blank">Navigate</Button>
|
|
32
|
+
*
|
|
33
|
+
* // Renders using a custom router link
|
|
34
|
+
* <Button component={Link} to="/home">Home</Button>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const Button: React.ForwardRefExoticComponent<(Omit<Omit<Omit<MuiButtonProps, "color" | "variant" | "size" | "fullWidth"> & RecursicaButtonProps, "style" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "typography" | "fontFamily" | "fontSize" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "backgroundColor" | "sx"> & import('../../utils/filterStylingProps').ForbiddenStyles & {
|
|
38
|
+
overStyled?: false | undefined;
|
|
39
|
+
}, "ref"> | Omit<Omit<MuiButtonProps, "color" | "variant" | "size" | "fullWidth"> & RecursicaButtonProps & {
|
|
40
|
+
overStyled: true;
|
|
41
|
+
}, "ref">) & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { ContainerProps as MUIContainerProps } from '@mui/material';
|
|
3
|
+
import { RecursicaSpacing } from '../../utils/filterStylingProps';
|
|
4
|
+
export interface RecursicaContainerProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl" | RecursicaSpacing | (string & {}) | number;
|
|
7
|
+
}
|
|
8
|
+
export type ContainerProps = Omit<MUIContainerProps, "maxWidth"> & RecursicaContainerProps;
|
|
9
|
+
export declare const Container: React.ForwardRefExoticComponent<Omit<ContainerProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,26 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { BoxProps as MUIBoxProps } from '@mui/material';
|
|
3
|
+
import { RecursicaSpacing, OmitSx } from '../../utils/filterStylingProps';
|
|
4
|
+
export interface RecursicaFlexProps {
|
|
5
|
+
/**
|
|
6
|
+
* Content to render inside the flex container.
|
|
7
|
+
*/
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
/**
|
|
10
|
+
* The gap between flex items. Accepts standard MUI spacing or Recursica gap tokens
|
|
11
|
+
* (e.g. "rec-md").
|
|
12
|
+
*/
|
|
13
|
+
gap?: string | number | RecursicaSpacing;
|
|
14
|
+
/**
|
|
15
|
+
* The vertical gap between flex items when wrapping. Accepts standard MUI spacing
|
|
16
|
+
* or Recursica gap tokens.
|
|
17
|
+
*/
|
|
18
|
+
rowGap?: string | number | RecursicaSpacing;
|
|
19
|
+
/**
|
|
20
|
+
* The horizontal gap between flex items when wrapping. Accepts standard MUI spacing
|
|
21
|
+
* or Recursica gap tokens.
|
|
22
|
+
*/
|
|
23
|
+
columnGap?: string | number | RecursicaSpacing;
|
|
24
|
+
}
|
|
25
|
+
export type FlexProps = OmitSx<MUIBoxProps & RecursicaFlexProps>;
|
|
26
|
+
export declare const Flex: React.ForwardRefExoticComponent<Omit<FlexProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { StackProps as MUIStackProps } from '@mui/material';
|
|
3
|
+
import { RecursicaSpacing, OmitSx } from '../../utils/filterStylingProps';
|
|
4
|
+
export interface RecursicaGroupProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
gap?: MUIStackProps["spacing"] | RecursicaSpacing;
|
|
7
|
+
rowGap?: MUIStackProps["spacing"] | RecursicaSpacing;
|
|
8
|
+
columnGap?: MUIStackProps["spacing"] | RecursicaSpacing;
|
|
9
|
+
}
|
|
10
|
+
export type GroupProps = OmitSx<Omit<MUIStackProps, "spacing" | "direction"> & RecursicaGroupProps>;
|
|
11
|
+
export declare const Group: React.ForwardRefExoticComponent<Omit<GroupProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { LinkProps as MUILinkProps } from '@mui/material';
|
|
3
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
4
|
+
export interface RecursicaLinkProps {
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
component?: React.ElementType;
|
|
8
|
+
}
|
|
9
|
+
export type LinkProps = RecursicaOverStyled<Omit<MUILinkProps, "underline"> & RecursicaLinkProps>;
|
|
10
|
+
export declare const Link: React.ForwardRefExoticComponent<(Omit<Omit<Omit<MUILinkProps, "underline"> & RecursicaLinkProps, "style" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "typography" | "fontFamily" | "fontSize" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "backgroundColor" | "sx"> & import('../../utils/filterStylingProps').ForbiddenStyles & {
|
|
11
|
+
overStyled?: false | undefined;
|
|
12
|
+
}, "ref"> | Omit<Omit<MUILinkProps, "underline"> & RecursicaLinkProps & {
|
|
13
|
+
overStyled: true;
|
|
14
|
+
}, "ref">) & React.RefAttributes<HTMLAnchorElement>>;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
import { RecursicaOverStyled, RecursicaSize } from '../../utils/filterStylingProps';
|
|
3
|
+
export interface RecursicaLoaderProps {
|
|
4
|
+
/** Map to the component styles defined in variables */
|
|
5
|
+
variant?: "oval" | "bars" | "dots";
|
|
6
|
+
/** Map to Recursica sizes */
|
|
7
|
+
size?: "sm" | "md" | "lg" | RecursicaSize;
|
|
8
|
+
}
|
|
9
|
+
export type LoaderProps = RecursicaOverStyled<React.HTMLAttributes<HTMLSpanElement> & RecursicaLoaderProps>;
|
|
10
|
+
export declare const Loader: React.ForwardRefExoticComponent<LoaderProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { StackProps as MUIStackProps } from '@mui/material';
|
|
3
|
+
import { RecursicaSpacing, OmitSx } from '../../utils/filterStylingProps';
|
|
4
|
+
export interface RecursicaStackProps {
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
gap?: MUIStackProps["spacing"] | RecursicaSpacing;
|
|
7
|
+
}
|
|
8
|
+
export type StackProps = OmitSx<Omit<MUIStackProps, "spacing"> & RecursicaStackProps>;
|
|
9
|
+
export declare const Stack: React.ForwardRefExoticComponent<Omit<StackProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
3
|
+
import { TypographyProps as MuiTypographyProps } from '@mui/material';
|
|
4
|
+
export type TextVariant = "body" | "body-small" | "caption" | "overline" | "subtitle" | "subtitle-small";
|
|
5
|
+
export type RecursicaTextProps = Omit<MuiTypographyProps, "variant"> & {
|
|
6
|
+
variant?: TextVariant;
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
component?: React.ElementType;
|
|
9
|
+
};
|
|
10
|
+
export type TextProps = RecursicaOverStyled<RecursicaTextProps>;
|
|
11
|
+
export declare const Text: React.ForwardRefExoticComponent<(Omit<Omit<RecursicaTextProps, "style" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "typography" | "fontFamily" | "fontSize" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "backgroundColor" | "sx"> & import('../../utils/filterStylingProps').ForbiddenStyles & {
|
|
12
|
+
overStyled?: false | undefined;
|
|
13
|
+
}, "ref"> | Omit<Omit<MuiTypographyProps, "variant"> & {
|
|
14
|
+
variant?: TextVariant;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
component?: React.ElementType;
|
|
17
|
+
} & {
|
|
18
|
+
overStyled: true;
|
|
19
|
+
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
@@ -1,3 +1,18 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
3
|
+
import { TypographyProps as MuiTypographyProps } from '@mui/material';
|
|
4
|
+
export type RecursicaTitleProps = Omit<MuiTypographyProps, "variant"> & {
|
|
5
|
+
order?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
component?: React.ElementType;
|
|
8
|
+
};
|
|
9
|
+
export type TitleProps = RecursicaOverStyled<RecursicaTitleProps>;
|
|
10
|
+
export declare const Title: React.ForwardRefExoticComponent<(Omit<Omit<RecursicaTitleProps, "style" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "typography" | "fontFamily" | "fontSize" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "backgroundColor" | "sx"> & import('../../utils/filterStylingProps').ForbiddenStyles & {
|
|
11
|
+
overStyled?: false | undefined;
|
|
12
|
+
}, "ref"> | Omit<Omit<MuiTypographyProps, "variant"> & {
|
|
13
|
+
order?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
component?: React.ElementType;
|
|
16
|
+
} & {
|
|
17
|
+
overStyled: true;
|
|
18
|
+
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { TypographyProps as MuiTypographyProps } from '@mui/material';
|
|
3
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
4
|
+
export type TypographyProps = RecursicaOverStyled<Omit<MuiTypographyProps, "variant"> & {
|
|
5
|
+
/**
|
|
6
|
+
* Internal typography class mapping
|
|
7
|
+
*/
|
|
8
|
+
typographyClass: string;
|
|
9
|
+
component?: React.ElementType;
|
|
10
|
+
}>;
|
|
11
|
+
export declare const Typography: React.ForwardRefExoticComponent<(Omit<Omit<Omit<MuiTypographyProps, "variant"> & {
|
|
12
|
+
/**
|
|
13
|
+
* Internal typography class mapping
|
|
14
|
+
*/
|
|
15
|
+
typographyClass: string;
|
|
16
|
+
component?: React.ElementType;
|
|
17
|
+
}, "style" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "typography" | "fontFamily" | "fontSize" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "backgroundColor" | "sx"> & import('../../utils/filterStylingProps').ForbiddenStyles & {
|
|
18
|
+
overStyled?: false | undefined;
|
|
19
|
+
}, "ref"> | Omit<Omit<MuiTypographyProps, "variant"> & {
|
|
20
|
+
/**
|
|
21
|
+
* Internal typography class mapping
|
|
22
|
+
*/
|
|
23
|
+
typographyClass: string;
|
|
24
|
+
component?: React.ElementType;
|
|
25
|
+
} & {
|
|
26
|
+
overStyled: true;
|
|
27
|
+
}, "ref">) & React.RefAttributes<HTMLElement>>;
|
|
@@ -25,9 +25,12 @@ export declare const BLOCKED_STYLING_KEYS: readonly ["className", "classes", "st
|
|
|
25
25
|
export type BlockedStylingKeys = (typeof BLOCKED_STYLING_KEYS)[number];
|
|
26
26
|
export type RecursicaSpacing = "rec-none" | "rec-sm" | "rec-default" | "rec-md" | "rec-lg" | "rec-xl" | "rec-2xl";
|
|
27
27
|
export type RecursicaSize = "small" | "default" | "large";
|
|
28
|
+
export declare const SPACING_MAP: Record<string, string>;
|
|
28
29
|
export type ForbiddenStyles = {
|
|
29
30
|
[K in BlockedStylingKeys]?: never;
|
|
30
31
|
};
|
|
32
|
+
export type OmitSx<T> = Omit<T, "sx">;
|
|
33
|
+
export declare function filterSxProp<T extends Record<string, unknown>>(props: T): Omit<T, "sx">;
|
|
31
34
|
export type RecursicaOverStyled<T> = (Omit<T, BlockedStylingKeys> & ForbiddenStyles & {
|
|
32
35
|
overStyled?: false | undefined;
|
|
33
36
|
}) | (T & {
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "git+https://github.com/borderux/recursica.git",
|
|
14
14
|
"directory": "packages/mui-adapter"
|
|
15
15
|
},
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.4.0",
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"access": "public"
|
|
19
19
|
},
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"storybook": "^10.3.3",
|
|
83
83
|
"storybook-dark-mode": "^5.0.0",
|
|
84
84
|
"strip-literal": "^3.0.0",
|
|
85
|
+
"ts-morph": "^28.0.0",
|
|
85
86
|
"typescript": "~5.8.3",
|
|
86
87
|
"typescript-eslint": "^8.30.1",
|
|
87
88
|
"vite": "^6.3.5",
|
|
@@ -1,157 +1,160 @@
|
|
|
1
1
|
import type { Meta } from "@storybook/react-vite";
|
|
2
2
|
import { AdaptersContent, MuiLogo } from "@recursica/storybook-template";
|
|
3
|
-
import { Button } from "./components/Button/Button";
|
|
4
3
|
import { VersionInfo } from "./Version";
|
|
5
4
|
import { OverStylingInfo } from "./OverStyling";
|
|
6
5
|
|
|
7
6
|
const DOCS_URL = "https://recursica.com";
|
|
8
7
|
const FORGE_URL = "https://forge.recursica.com";
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
marginBottom: 32,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const headingStyle: React.CSSProperties = {
|
|
15
|
-
fontSize: 14,
|
|
16
|
-
fontWeight: 600,
|
|
17
|
-
color: "#333",
|
|
18
|
-
marginBottom: 8,
|
|
19
|
-
marginTop: 0,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const bodyStyle: React.CSSProperties = {
|
|
23
|
-
fontSize: 14,
|
|
24
|
-
lineHeight: 1.6,
|
|
25
|
-
color: "#444",
|
|
26
|
-
margin: 0,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const linkStyle: React.CSSProperties = {
|
|
30
|
-
color: "#0066cc",
|
|
31
|
-
textDecoration: "none",
|
|
32
|
-
};
|
|
9
|
+
import { Container, Box, Group, Title, Text, Link } from "./components";
|
|
33
10
|
|
|
34
11
|
function IntroductionContent() {
|
|
35
12
|
return (
|
|
36
|
-
<
|
|
37
|
-
<
|
|
38
|
-
style={{
|
|
39
|
-
display: "flex",
|
|
40
|
-
alignItems: "center",
|
|
41
|
-
gap: "16px",
|
|
42
|
-
marginBottom: "16px",
|
|
43
|
-
}}
|
|
44
|
-
>
|
|
13
|
+
<Container size="md" style={{ padding: "32px 0", maxWidth: 640 }}>
|
|
14
|
+
<Group gap="rec-md" mb={2}>
|
|
45
15
|
<MuiLogo width={40} height={40} />
|
|
46
|
-
<
|
|
47
|
-
<
|
|
16
|
+
<Box>
|
|
17
|
+
<Title order={1} m={0}>
|
|
48
18
|
Recursica Design System (MUI Adapter)
|
|
49
|
-
</
|
|
50
|
-
<
|
|
51
|
-
href="https://mui.com"
|
|
52
|
-
target="_blank"
|
|
53
|
-
rel="noreferrer"
|
|
54
|
-
style={linkStyle}
|
|
55
|
-
>
|
|
19
|
+
</Title>
|
|
20
|
+
<Link href="https://mui.com" target="_blank" rel="noreferrer">
|
|
56
21
|
mui.com
|
|
57
|
-
</
|
|
58
|
-
</
|
|
59
|
-
</
|
|
60
|
-
<
|
|
22
|
+
</Link>
|
|
23
|
+
</Box>
|
|
24
|
+
</Group>
|
|
25
|
+
<Text mb={4}>
|
|
61
26
|
This Storybook showcases the Recursica design system implemented for the{" "}
|
|
62
27
|
<strong>Material UI (MUI) Kit</strong>. It provides reusable components
|
|
63
28
|
that map our design tokens to MUI's robust component layer.
|
|
64
|
-
</
|
|
29
|
+
</Text>
|
|
65
30
|
|
|
66
|
-
<section
|
|
67
|
-
<
|
|
68
|
-
|
|
31
|
+
<Box component="section" sx={{ mb: 4 }}>
|
|
32
|
+
<Title order={2} mb={1}>
|
|
33
|
+
Looking for another UI Kit?
|
|
34
|
+
</Title>
|
|
35
|
+
<Text>
|
|
69
36
|
Are you using a different UI Kit (like Mantine)? Recursica provides
|
|
70
37
|
multiple adapters for different frameworks.
|
|
71
|
-
</
|
|
72
|
-
<
|
|
73
|
-
<
|
|
38
|
+
</Text>
|
|
39
|
+
<Box sx={{ mt: 2 }}>
|
|
40
|
+
<a
|
|
74
41
|
href="./?path=/story/introduction--adapters"
|
|
75
42
|
target="_parent"
|
|
76
|
-
|
|
43
|
+
className="adapter-btn"
|
|
44
|
+
style={{
|
|
45
|
+
display: "inline-flex",
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
backgroundColor:
|
|
49
|
+
"var(--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_background)",
|
|
50
|
+
color:
|
|
51
|
+
"var(--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_text)",
|
|
52
|
+
textDecoration: "none",
|
|
53
|
+
borderRadius:
|
|
54
|
+
"var(--recursica_ui-kit_components_button_variants_sizes_default_properties_border-radius)",
|
|
55
|
+
height:
|
|
56
|
+
"var(--recursica_ui-kit_components_button_variants_sizes_default_properties_height)",
|
|
57
|
+
padding:
|
|
58
|
+
"0 var(--recursica_ui-kit_components_button_variants_sizes_default_properties_horizontal-padding)",
|
|
59
|
+
fontFamily:
|
|
60
|
+
"var(--recursica_ui-kit_components_button_variants_sizes_default_properties_text_font-family)",
|
|
61
|
+
fontSize:
|
|
62
|
+
"var(--recursica_ui-kit_components_button_variants_sizes_default_properties_text_font-size)",
|
|
63
|
+
fontWeight:
|
|
64
|
+
"var(--recursica_ui-kit_components_button_variants_sizes_default_properties_text_font-weight)",
|
|
65
|
+
boxShadow:
|
|
66
|
+
"var(--recursica_ui-kit_components_button_variants_styles_solid_properties_elevation)",
|
|
67
|
+
border:
|
|
68
|
+
"var(--recursica_ui-kit_components_button_variants_styles_solid_properties_border-size) solid var(--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_border-color)",
|
|
69
|
+
transition: "opacity 0.2s ease",
|
|
70
|
+
}}
|
|
71
|
+
onMouseOver={(e) => {
|
|
72
|
+
e.currentTarget.style.opacity = "0.85";
|
|
73
|
+
e.currentTarget.style.color =
|
|
74
|
+
"var(--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_text-hover)";
|
|
75
|
+
}}
|
|
76
|
+
onMouseOut={(e) => {
|
|
77
|
+
e.currentTarget.style.opacity = "1";
|
|
78
|
+
e.currentTarget.style.color =
|
|
79
|
+
"var(--recursica_ui-kit_components_button_variants_styles_solid_properties_colors_text)";
|
|
80
|
+
}}
|
|
77
81
|
>
|
|
78
82
|
View Supported Adapters
|
|
79
|
-
</
|
|
80
|
-
</
|
|
81
|
-
</
|
|
82
|
-
|
|
83
|
-
<section
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
83
|
+
</a>
|
|
84
|
+
</Box>
|
|
85
|
+
</Box>
|
|
86
|
+
|
|
87
|
+
<Box component="section" sx={{ mb: 4 }}>
|
|
88
|
+
<Title order={2} mb={1}>
|
|
89
|
+
Installation
|
|
90
|
+
</Title>
|
|
91
|
+
<Text>To install the MUI adapter in your project, run:</Text>
|
|
92
|
+
<Box
|
|
93
|
+
component="pre"
|
|
94
|
+
sx={{
|
|
95
|
+
p: 1.5,
|
|
96
|
+
bgcolor: "grey.100",
|
|
97
|
+
borderRadius: 1,
|
|
93
98
|
fontSize: 13,
|
|
94
|
-
|
|
99
|
+
mt: 1,
|
|
95
100
|
}}
|
|
96
101
|
>
|
|
97
102
|
<code>
|
|
98
103
|
npm install @recursica/mui-adapter @mui/material @emotion/react
|
|
99
104
|
@emotion/styled
|
|
100
105
|
</code>
|
|
101
|
-
</
|
|
102
|
-
</
|
|
103
|
-
|
|
104
|
-
<section
|
|
105
|
-
<
|
|
106
|
-
|
|
106
|
+
</Box>
|
|
107
|
+
</Box>
|
|
108
|
+
|
|
109
|
+
<Box component="section" sx={{ mb: 4 }}>
|
|
110
|
+
<Title order={2} mb={1}>
|
|
111
|
+
Tokens
|
|
112
|
+
</Title>
|
|
113
|
+
<Text>
|
|
107
114
|
Raw design tokens (colors, sizes, font weights, opacities, etc.) that
|
|
108
115
|
feed the theme and components. These are the primitive values defined
|
|
109
116
|
in your token set and exposed as CSS custom properties.
|
|
110
|
-
</
|
|
111
|
-
</
|
|
112
|
-
|
|
113
|
-
<section
|
|
114
|
-
<
|
|
115
|
-
|
|
117
|
+
</Text>
|
|
118
|
+
</Box>
|
|
119
|
+
|
|
120
|
+
<Box component="section" sx={{ mb: 4 }}>
|
|
121
|
+
<Title order={2} mb={1}>
|
|
122
|
+
Theme
|
|
123
|
+
</Title>
|
|
124
|
+
<Text>
|
|
116
125
|
Brand and theme layer built on top of tokens. Typography types,
|
|
117
126
|
dimensions, and layout grids are defined here. Theme uses the tokens
|
|
118
127
|
and exposes both CSS variables and helper classes (e.g. typography
|
|
119
128
|
classes) for consistent styling across the product.
|
|
120
|
-
</
|
|
121
|
-
</
|
|
122
|
-
|
|
123
|
-
<section
|
|
124
|
-
<
|
|
125
|
-
|
|
129
|
+
</Text>
|
|
130
|
+
</Box>
|
|
131
|
+
|
|
132
|
+
<Box component="section" sx={{ mb: 4 }}>
|
|
133
|
+
<Title order={2} mb={1}>
|
|
134
|
+
Configuring Recursica
|
|
135
|
+
</Title>
|
|
136
|
+
<Text>
|
|
126
137
|
To modify the Recursica configuration (tokens, brand, theme), go to{" "}
|
|
127
|
-
<
|
|
128
|
-
href={FORGE_URL}
|
|
129
|
-
target="_blank"
|
|
130
|
-
rel="noopener noreferrer"
|
|
131
|
-
style={linkStyle}
|
|
132
|
-
>
|
|
138
|
+
<Link href={FORGE_URL} target="_blank" rel="noopener noreferrer">
|
|
133
139
|
{FORGE_URL}
|
|
134
|
-
</
|
|
140
|
+
</Link>
|
|
135
141
|
. Changes there drive the tokens and theme you see in this Storybook.
|
|
136
|
-
</
|
|
137
|
-
</
|
|
138
|
-
|
|
139
|
-
<section
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
+
</Text>
|
|
143
|
+
</Box>
|
|
144
|
+
|
|
145
|
+
<Box component="section" sx={{ mb: 4 }}>
|
|
146
|
+
<Title order={2} mb={1}>
|
|
147
|
+
Documentation
|
|
148
|
+
</Title>
|
|
149
|
+
<Text>
|
|
142
150
|
For full documentation, guides, and API reference, visit{" "}
|
|
143
|
-
<
|
|
144
|
-
href={DOCS_URL}
|
|
145
|
-
target="_blank"
|
|
146
|
-
rel="noopener noreferrer"
|
|
147
|
-
style={linkStyle}
|
|
148
|
-
>
|
|
151
|
+
<Link href={DOCS_URL} target="_blank" rel="noopener noreferrer">
|
|
149
152
|
{DOCS_URL}
|
|
150
|
-
</
|
|
153
|
+
</Link>
|
|
151
154
|
.
|
|
152
|
-
</
|
|
153
|
-
</
|
|
154
|
-
</
|
|
155
|
+
</Text>
|
|
156
|
+
</Box>
|
|
157
|
+
</Container>
|
|
155
158
|
);
|
|
156
159
|
}
|
|
157
160
|
|
package/src/OverStyling.tsx
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
Paper,
|
|
4
|
-
Typography as Text,
|
|
5
|
-
Divider,
|
|
6
|
-
Stack,
|
|
7
|
-
Box,
|
|
8
|
-
} from "@mui/material";
|
|
1
|
+
import { Paper, Divider } from "@mui/material";
|
|
2
|
+
import { Container, Stack, Box, Text, Title } from "./components";
|
|
9
3
|
import { Button } from "./components/Button/Button";
|
|
10
4
|
|
|
11
5
|
export const OverStylingInfo = () => {
|
|
12
6
|
return (
|
|
13
|
-
<Container
|
|
7
|
+
<Container size="md" style={{ padding: "32px 0" }}>
|
|
14
8
|
<Paper variant="outlined" sx={{ p: 4, borderRadius: 2 }}>
|
|
15
|
-
<
|
|
9
|
+
<Title order={4} mb={2}>
|
|
16
10
|
Over Styling (<code>overStyled</code>)
|
|
17
|
-
</
|
|
11
|
+
</Title>
|
|
18
12
|
<Text mb={2}>
|
|
19
13
|
By default, all Recursica components are strictly sandboxed. This
|
|
20
14
|
means they are protected against arbitrary styling configurations
|
|
@@ -31,9 +25,9 @@ export const OverStylingInfo = () => {
|
|
|
31
25
|
<code>overStyled={`{true}`}</code>.
|
|
32
26
|
</Text>
|
|
33
27
|
|
|
34
|
-
<
|
|
28
|
+
<Title order={6} mb={1} mt={4}>
|
|
35
29
|
The Core Philosophy
|
|
36
|
-
</
|
|
30
|
+
</Title>
|
|
37
31
|
<Text mb={1}>
|
|
38
32
|
**You should not over-style components.** Using{" "}
|
|
39
33
|
<code>overStyled</code> explicitly signifies that you are breaking
|
|
@@ -77,9 +71,9 @@ export const OverStylingInfo = () => {
|
|
|
77
71
|
|
|
78
72
|
<Divider sx={{ mb: 4 }} />
|
|
79
73
|
|
|
80
|
-
<
|
|
74
|
+
<Title order={6} mb={1}>
|
|
81
75
|
Permitted Layout Properties
|
|
82
|
-
</
|
|
76
|
+
</Title>
|
|
83
77
|
<Text mb={1}>
|
|
84
78
|
Unlike deep styling bounds (colors, typography, padding, dimensions),
|
|
85
79
|
external <strong>layout spacing properties</strong> like Margins (
|
|
@@ -113,7 +107,7 @@ export const OverStylingInfo = () => {
|
|
|
113
107
|
</Text>
|
|
114
108
|
</li>
|
|
115
109
|
</Box>
|
|
116
|
-
<Text mb={1} sx={{ fontWeight: 500 }}>
|
|
110
|
+
<Text mb={1} overStyled sx={{ fontWeight: 500 }}>
|
|
117
111
|
Available Recursica Layout Tokens:
|
|
118
112
|
</Text>
|
|
119
113
|
<Box component="ul" sx={{ pl: 4, mb: 4 }}>
|
|
@@ -156,9 +150,9 @@ export const OverStylingInfo = () => {
|
|
|
156
150
|
|
|
157
151
|
<Divider sx={{ mb: 4 }} />
|
|
158
152
|
|
|
159
|
-
<
|
|
153
|
+
<Title order={6} mb={1}>
|
|
160
154
|
Primitive Layout Components Exemption
|
|
161
|
-
</
|
|
155
|
+
</Title>
|
|
162
156
|
<Text mb={1}>
|
|
163
157
|
Unlike complex UI components (Buttons, Tabs, Inputs) which are
|
|
164
158
|
strictly protected, <strong>Primitive Layout Components</strong> (
|
|
@@ -178,9 +172,9 @@ export const OverStylingInfo = () => {
|
|
|
178
172
|
|
|
179
173
|
<Divider sx={{ mb: 4 }} />
|
|
180
174
|
|
|
181
|
-
<
|
|
175
|
+
<Title order={6} mb={2}>
|
|
182
176
|
Live Example
|
|
183
|
-
</
|
|
177
|
+
</Title>
|
|
184
178
|
<Text mb={4}>
|
|
185
179
|
Below is a side-by-side comparison. The first is a standard Recursica
|
|
186
180
|
Button protected by the design tokens mapping. The second flagrantly
|
|
@@ -188,26 +182,27 @@ export const OverStylingInfo = () => {
|
|
|
188
182
|
styling generics to punch right through the sandbox layout.
|
|
189
183
|
</Text>
|
|
190
184
|
|
|
191
|
-
<Stack direction="row"
|
|
185
|
+
<Stack direction="row" gap="rec-default">
|
|
192
186
|
<Box>
|
|
193
187
|
<Text
|
|
194
188
|
variant="caption"
|
|
189
|
+
overStyled
|
|
195
190
|
sx={{ color: "text.secondary", mb: 1, display: "block" }}
|
|
196
191
|
>
|
|
197
192
|
Strict Baseline (Default)
|
|
198
193
|
</Text>
|
|
199
|
-
{/* Note: In mui-adapter, Button is currently a stub so we just pass standard React props */}
|
|
200
194
|
<Button>Standard UI Kit Button</Button>
|
|
201
195
|
</Box>
|
|
202
196
|
<Box>
|
|
203
197
|
<Text
|
|
204
198
|
variant="caption"
|
|
199
|
+
overStyled
|
|
205
200
|
sx={{ color: "text.secondary", mb: 1, display: "block" }}
|
|
206
201
|
>
|
|
207
202
|
overStyled={`{true}`}
|
|
208
203
|
</Text>
|
|
209
|
-
{/* Note: Button props are just standard HTML div props for the stub */}
|
|
210
204
|
<Button
|
|
205
|
+
overStyled={true}
|
|
211
206
|
style={{
|
|
212
207
|
backgroundColor: "pink",
|
|
213
208
|
color: "black",
|