@recursica/mui-adapter 0.9.0 → 0.10.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/mui-adapter.cjs +19 -19
  3. package/dist/mui-adapter.cjs.map +1 -1
  4. package/dist/mui-adapter.css +1 -1
  5. package/dist/mui-adapter.js +1360 -1325
  6. package/dist/mui-adapter.js.map +1 -1
  7. package/dist/src/components/Accordion/Accordion.d.ts +43 -10
  8. package/dist/src/components/Autocomplete/Autocomplete.d.ts +13 -2
  9. package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +13 -2
  10. package/dist/src/components/Button/Button.d.ts +13 -2
  11. package/dist/src/components/Card/Card.d.ts +9 -1
  12. package/dist/src/components/Checkbox/CheckboxGroup.d.ts +14 -3
  13. package/dist/src/components/Chip/Chip.d.ts +13 -2
  14. package/dist/src/components/Container/Container.d.ts +3 -3
  15. package/dist/src/components/Dropdown/Dropdown.d.ts +14 -3
  16. package/dist/src/components/Flex/Flex.d.ts +3 -4
  17. package/dist/src/components/Group/Group.d.ts +3 -4
  18. package/dist/src/components/Link/Link.d.ts +14 -4
  19. package/dist/src/components/Menu/Menu.d.ts +37 -8
  20. package/dist/src/components/Modal/Modal.d.ts +51 -11
  21. package/dist/src/components/NumberInput/NumberInput.d.ts +13 -2
  22. package/dist/src/components/Pagination/Pagination.d.ts +13 -2
  23. package/dist/src/components/Panel/Panel.d.ts +6 -6
  24. package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +15 -4
  25. package/dist/src/components/Slider/Slider.d.ts +13 -2
  26. package/dist/src/components/Stack/Stack.d.ts +3 -4
  27. package/dist/src/components/Stepper/Stepper.d.ts +71 -16
  28. package/dist/src/components/Switch/SwitchGroup.d.ts +14 -3
  29. package/dist/src/components/Table/Table.d.ts +34 -3
  30. package/dist/src/components/Tabs/Tabs.d.ts +45 -8
  31. package/dist/src/components/Text/Text.d.ts +18 -3
  32. package/dist/src/components/TextArea/TextArea.d.ts +14 -3
  33. package/dist/src/components/TextField/TextField.d.ts +13 -2
  34. package/dist/src/components/Timeline/TimelineItem.d.ts +13 -2
  35. package/dist/src/components/Title/Title.d.ts +18 -2
  36. package/dist/src/components/Toast/Toast.d.ts +13 -2
  37. package/dist/src/components/Typography/Typography.d.ts +14 -3
  38. package/dist/src/index.d.ts +1 -0
  39. package/dist/src/utils/filterStylingProps.d.ts +1 -1
  40. package/package.json +2 -2
  41. package/src/components/Avatar/Avatar.tsx +1 -1
  42. package/src/components/Card/CARD_IMPLEMENTATION_NOTES.md +15 -0
  43. package/src/components/Card/Card.module.css +1 -0
  44. package/src/components/Card/Card.tsx +27 -1
  45. package/src/components/Checkbox/CheckboxGroup.tsx +6 -2
  46. package/src/components/Container/Container.tsx +5 -3
  47. package/src/components/Dropdown/Dropdown.tsx +2 -9
  48. package/src/components/Flex/Flex.tsx +5 -2
  49. package/src/components/Group/Group.tsx +4 -3
  50. package/src/components/Link/Link.tsx +1 -1
  51. package/src/components/Panel/PANEL_IMPLEMENTATION_NOTES.md +64 -0
  52. package/src/components/Panel/Panel.stories.tsx +9 -9
  53. package/src/components/Panel/Panel.tsx +14 -9
  54. package/src/components/ReadOnlyField/ReadOnlyField.tsx +1 -1
  55. package/src/components/Stack/Stack.tsx +4 -3
  56. package/src/components/Stepper/Stepper.tsx +5 -1
  57. package/src/components/Switch/SwitchGroup.tsx +5 -1
  58. package/src/components/Table/Table.module.css +7 -0
  59. package/src/components/Table/Table.stories.tsx +35 -3
  60. package/src/components/Table/Table.tsx +61 -5
  61. package/src/components/Tabs/Tabs.tsx +5 -1
  62. package/src/components/Text/Text.tsx +5 -2
  63. package/src/components/TextArea/TextArea.tsx +3 -10
  64. package/src/components/Title/Title.tsx +4 -1
  65. package/src/index.ts +11 -0
  66. package/src/utils/filterStylingProps.ts +1 -0
@@ -12,7 +12,17 @@ import {
12
12
  } from "@recursica/adapter-common";
13
13
 
14
14
  // ==== CARD CONTAINER ====
15
- export type CardProps = RecursicaOverStyled<MuiCardProps & RecursicaCardProps>;
15
+ export type CardProps = RecursicaOverStyled<
16
+ MuiCardProps & RecursicaCardProps
17
+ > & {
18
+ flex?: string | number;
19
+ flexGrow?: string | number;
20
+ flexShrink?: string | number;
21
+ flexBasis?: string | number;
22
+ grow?: string | number;
23
+ h?: string | number;
24
+ height?: string | number;
25
+ };
16
26
 
17
27
  /**
18
28
  * The root Card elevation box. It establishes the global background color, border radius, nested component gap, and outer shadow governed by the current `Layer` context.
@@ -23,6 +33,22 @@ const CardBase = forwardRef<HTMLDivElement, CardProps>(function Card(
23
33
  ) {
24
34
  const sanitizedProps = filterStylingProps(rest, overStyled);
25
35
 
36
+ // Expose outer layout/flexbox properties on Card to allow structuring alongside siblings
37
+ const safeCardLayoutKeys = [
38
+ "flex",
39
+ "flexGrow",
40
+ "flexShrink",
41
+ "flexBasis",
42
+ "grow",
43
+ "h",
44
+ "height",
45
+ ] as const;
46
+ safeCardLayoutKeys.forEach((key) => {
47
+ if (key in rest && !(key in sanitizedProps)) {
48
+ (sanitizedProps as any)[key] = (rest as any)[key];
49
+ }
50
+ });
51
+
26
52
  const mergedClassNames: Partial<Record<string, string>> = {
27
53
  root: styles.root,
28
54
  };
@@ -21,7 +21,10 @@ export const CheckboxGroupContext = React.createContext<{
21
21
  import { type RecursicaCheckboxGroupProps as BaseRecursicaCheckboxGroupProps } from "@recursica/adapter-common";
22
22
 
23
23
  export interface RecursicaCheckboxGroupProps
24
- extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange">,
24
+ extends Omit<
25
+ React.HTMLAttributes<HTMLDivElement>,
26
+ "onChange" | "defaultValue"
27
+ >,
25
28
  Omit<
26
29
  RecursicaFormControlWrapperProps,
27
30
  | "controlMaxWidth"
@@ -29,6 +32,7 @@ export interface RecursicaCheckboxGroupProps
29
32
  | "onChange"
30
33
  | "classes"
31
34
  | "withAsterisk"
35
+ | "defaultValue"
32
36
  >,
33
37
  ReadOnlyControlProps,
34
38
  BaseRecursicaCheckboxGroupProps {}
@@ -112,7 +116,7 @@ export const CheckboxGroup = forwardRef<HTMLDivElement, CheckboxGroupProps>(
112
116
  activeComponent={
113
117
  <CheckboxGroupContext.Provider
114
118
  value={{
115
- value: value !== undefined ? value : defaultValue,
119
+ value: (value !== undefined ? value : defaultValue) as any[],
116
120
  onChange: handleChange,
117
121
  name: restRecord.name as string | undefined,
118
122
  readOnly: readOnly || !!(restRecord as any).disabled,
@@ -6,16 +6,18 @@
6
6
  * (Stack, Group, Flex), Container explicitly ALLOWS the `sx` prop as an escape hatch
7
7
  * for advanced layout positioning.
8
8
  */
9
- import React, { forwardRef } from "react";
9
+ import { forwardRef } from "react";
10
10
  import {
11
11
  Container as MUIContainer,
12
12
  type ContainerProps as MUIContainerProps,
13
13
  } from "@mui/material";
14
14
 
15
+ import { type WithRecursicaSpacing } from "../../utils/filterStylingProps";
15
16
  import { type RecursicaContainerProps } from "@recursica/adapter-common";
16
17
 
17
- export type ContainerProps = Omit<MUIContainerProps, "maxWidth"> &
18
- RecursicaContainerProps;
18
+ export type ContainerProps = WithRecursicaSpacing<
19
+ Omit<MUIContainerProps, "maxWidth"> & RecursicaContainerProps
20
+ >;
19
21
 
20
22
  export const Container = forwardRef<HTMLDivElement, ContainerProps>(
21
23
  function Container({ children, size, ...rest }, ref) {
@@ -20,16 +20,9 @@ export interface RecursicaDropdownProps
20
20
  MuiSelectProps,
21
21
  "size" | "variant" | "classes" | "inputProps" | "SelectDisplayProps"
22
22
  >,
23
- Pick<
23
+ Omit<
24
24
  RecursicaFormControlWrapperProps,
25
- | "assistiveText"
26
- | "assistiveWithIcon"
27
- | "formLayout"
28
- | "labelSize"
29
- | "labelAlignment"
30
- | "labelOptionalText"
31
- | "labelWithEditIcon"
32
- | "onLabelEditClick"
25
+ "controlMaxWidth" | "controlMinWidth"
33
26
  >,
34
27
  ReadOnlyControlProps,
35
28
  BaseRecursicaDropdownProps {}
@@ -8,17 +8,20 @@
8
8
  * Like Stack and Group, this is a primitive layout component. It strictly filters out the
9
9
  * `sx` prop using `OmitSx` and `filterSxProp` to enforce the use of standard layout scales.
10
10
  */
11
- import React, { forwardRef } from "react";
11
+ import { forwardRef } from "react";
12
12
  import { Box as MUIBox, type BoxProps as MUIBoxProps } from "@mui/material";
13
13
  import {
14
14
  SPACING_MAP,
15
15
  type OmitSx,
16
16
  filterSxProp,
17
+ type WithRecursicaSpacing,
17
18
  } from "../../utils/filterStylingProps";
18
19
 
19
20
  import { type RecursicaFlexProps } from "@recursica/adapter-common";
20
21
 
21
- export type FlexProps = OmitSx<MUIBoxProps & RecursicaFlexProps>;
22
+ export type FlexProps = WithRecursicaSpacing<
23
+ OmitSx<MUIBoxProps & RecursicaFlexProps>
24
+ >;
22
25
 
23
26
  export const Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(
24
27
  {
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from "react";
1
+ import { forwardRef } from "react";
2
2
  import {
3
3
  Stack as MUIStack,
4
4
  type StackProps as MUIStackProps,
@@ -7,12 +7,13 @@ import {
7
7
  SPACING_MAP,
8
8
  type OmitSx,
9
9
  filterSxProp,
10
+ type WithRecursicaSpacing,
10
11
  } from "../../utils/filterStylingProps";
11
12
 
12
13
  import { type RecursicaGroupProps } from "@recursica/adapter-common";
13
14
 
14
- export type GroupProps = OmitSx<
15
- Omit<MUIStackProps, "spacing" | "direction"> & RecursicaGroupProps
15
+ export type GroupProps = WithRecursicaSpacing<
16
+ OmitSx<Omit<MUIStackProps, "spacing" | "direction"> & RecursicaGroupProps>
16
17
  >;
17
18
 
18
19
  export const Group = forwardRef<HTMLDivElement, GroupProps>(function Group(
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from "react";
1
+ import { forwardRef } from "react";
2
2
  import { Link as MUILink, type LinkProps as MUILinkProps } from "@mui/material";
3
3
  import {
4
4
  filterStylingProps,
@@ -0,0 +1,64 @@
1
+ # Panel – Implementation Notes
2
+
3
+ Decisions and design tweaks strictly tailored for the UI Kit's Panel wrapped against `@mui/material`. This is a living document that tracks _why_ specific logic decisions exist.
4
+
5
+ ---
6
+
7
+ ## 1. Mapping to MUI Drawer
8
+
9
+ **Decision:** Panel maps to MUI's `Drawer` component, not `Paper` or `Card`.
10
+
11
+ **Implementation:** Per the Recursica design system specification, "Panels slide in or expand from the edge of the screen to reveal additional content or functionality." This is the exact behavior of MUI's `Drawer` component, which provides:
12
+
13
+ - Slide-in animation from any screen edge (using the `anchor` prop)
14
+ - Backdrop/overlay support
15
+ - Focus trap and overlay portal management
16
+ - Internal scroll lock when open
17
+
18
+ ---
19
+
20
+ ## 2. Token Namespace: `panel`
21
+
22
+ **Decision:** The CSS module exclusively uses variables from the `--recursica_ui-kit_components_panel_*` namespace.
23
+
24
+ **Implementation:** The Recursica token system defines the `panel` namespace covering:
25
+
26
+ - Geometry: border-radius, border-size, min-width (200px), max-width (960px)
27
+ - Content padding: content-horizontal-padding (xl), content-vertical-padding (lg)
28
+ - Header/Footer padding: header-footer-horizontal-padding (xl), header-footer-vertical-padding (md)
29
+ - Spacing: header-close-gap (md), footer-button-gap (md)
30
+ - Divider: divider-size (1px), divider-color
31
+ - Elevation: elevation-3
32
+ - Colors (layer-aware): background, border-color, content, divider-color, header-footer-background, title
33
+ - Non-CSS: header-style ("h3")
34
+
35
+ No tokens from other component namespaces are referenced.
36
+
37
+ ---
38
+
39
+ ## 3. Default Placement Override
40
+
41
+ **Decision:** Use `placement` instead of `position` for configuring slide-out direction, and default it to `"right"`.
42
+
43
+ **Implementation:** The prop was renamed from `position` to `placement` to prevent collision with the CSS `position` keyword, which is strictly blocked by the styling gatekeeper (`BLOCKED_STYLING_KEYS`). This allows configuring the drawer direction natively while maintaining strict design-system boundaries. The `placement="right"` default is mapped internally to MUI Drawer's `anchor` prop before any other sanitized props are applied. Right-side panels are the most common pattern for supplementary content, settings, and detail views.
44
+
45
+ ---
46
+
47
+ ## 4. Custom Panel.Footer
48
+
49
+ **Decision:** A custom `Panel.Footer` sub-component is provided. MUI's Drawer does not have a native footer.
50
+
51
+ **Implementation:** `Panel.Footer` is a `<div>` with styling referencing Recursica CSS variables for:
52
+
53
+ - `header-footer-background` and `header-footer-padding` tokens
54
+ - Top divider using `divider-size` and `divider-color`
55
+ - `footer-button-gap` for action button spacing
56
+ - `margin-top: auto` to push the footer to the bottom
57
+
58
+ ---
59
+
60
+ ## 5. Visibility Mapping (`opened` -> `open`)
61
+
62
+ **Decision:** Accept `opened` prop to match the standard Recursica component API.
63
+
64
+ **Implementation:** MUI Drawer natively expects the `open` boolean prop. The wrapper maps the incoming framework-agnostic `opened` prop to MUI's `open={Boolean(opened)}`, allowing consistent usage across both adapter implementations.
@@ -12,7 +12,7 @@ const meta: Meta = {
12
12
  component: Panel,
13
13
  tags: ["autodocs"],
14
14
  argTypes: {
15
- position: {
15
+ placement: {
16
16
  control: "select",
17
17
  options: ["left", "right", "top", "bottom"],
18
18
  description: "Side of the screen the panel slides in from.",
@@ -45,7 +45,7 @@ const meta: Meta = {
45
45
  docs: {
46
46
  description: {
47
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.
48
+ The \`Panel\` component slides in or expands from the edge of the screen to reveal additional content or functionality. Built on Mui's \`Drawer\`, it enforces Recursica design tokens for styling.
49
49
 
50
50
  ### Anatomy
51
51
  1. **Header** — Title and close icon, remains fixed on scroll
@@ -58,7 +58,7 @@ The \`Panel\` component slides in or expands from the edge of the screen to reve
58
58
  const [opened, { open, close }] = useDisclosure(false);
59
59
 
60
60
  <Button onClick={open}>Open Panel</Button>
61
- <Panel opened={opened} onClose={close} title="Settings" position="right">
61
+ <Panel opened={opened} onClose={close} title="Settings" placement="right">
62
62
  Content goes here
63
63
  <Panel.Footer>
64
64
  <Button variant="outline">Cancel</Button>
@@ -78,7 +78,7 @@ type Story = StoryObj<PanelStoryArgs>;
78
78
 
79
79
  export const Default: Story = {
80
80
  args: {
81
- position: "right",
81
+ placement: "right",
82
82
  title: "Panel Title",
83
83
  withOverlay: true,
84
84
  withCloseButton: true,
@@ -98,7 +98,7 @@ export const Default: Story = {
98
98
  opened={opened}
99
99
  onClose={() => setOpened(false)}
100
100
  title="Panel Title"
101
- position="right"
101
+ placement="right"
102
102
  wrapHeaderText={wrapHeaderText}
103
103
  >
104
104
  <Text>
@@ -118,9 +118,9 @@ export const Default: Story = {
118
118
  },
119
119
  };
120
120
 
121
- export const LeftPosition: Story = {
121
+ export const LeftPlacement: Story = {
122
122
  args: {
123
- position: "left",
123
+ placement: "left",
124
124
  title: "Navigation",
125
125
  withOverlay: true,
126
126
  withCloseButton: true,
@@ -153,7 +153,7 @@ export const LeftPosition: Story = {
153
153
 
154
154
  export const ScrollableContent: Story = {
155
155
  args: {
156
- position: "right",
156
+ placement: "right",
157
157
  title: "Scrollable Panel",
158
158
  withOverlay: true,
159
159
  withCloseButton: true,
@@ -195,7 +195,7 @@ export const ScrollableContent: Story = {
195
195
 
196
196
  export const LongTitle: Story = {
197
197
  args: {
198
- position: "right",
198
+ placement: "right",
199
199
  title:
200
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
201
  withOverlay: true,
@@ -13,11 +13,18 @@ import styles from "./Panel.module.css";
13
13
  // PANEL (Drawer)
14
14
  // ============================================================
15
15
 
16
- import { type RecursicaPanelProps } from "@recursica/adapter-common";
16
+ import { type RecursicaPanelProps as BaseRecursicaPanelProps } from "@recursica/adapter-common";
17
17
 
18
18
  /**
19
19
  * Recursica Panel root props. Extends Mui Drawer.
20
20
  */
21
+ export interface RecursicaPanelProps
22
+ extends Omit<
23
+ MuiDrawerProps,
24
+ "classes" | "position" | "style" | "anchor" | "open"
25
+ >,
26
+ BaseRecursicaPanelProps {}
27
+
21
28
  export type PanelProps = RecursicaOverStyled<RecursicaPanelProps>;
22
29
 
23
30
  /**
@@ -29,7 +36,7 @@ export type PanelProps = RecursicaOverStyled<RecursicaPanelProps>;
29
36
  * cluttering the main interface.
30
37
  *
31
38
  * ```tsx
32
- * <Panel opened={opened} onClose={close} title="Panel Title" position="right">
39
+ * <Panel opened={opened} onClose={close} title="Panel Title" placement="right">
33
40
  * <Panel.Body>
34
41
  * Content goes here
35
42
  * </Panel.Body>
@@ -48,14 +55,12 @@ export type PanelProps = RecursicaOverStyled<RecursicaPanelProps>;
48
55
  */
49
56
  const PanelBase = function Panel({
50
57
  overStyled = false,
51
- position = "right",
58
+ placement = "right",
52
59
  keepMounted = true,
53
60
  wrapHeaderText = false,
61
+ opened,
54
62
  ...rest
55
- }: PanelProps & {
56
- position?: "left" | "right" | "top" | "bottom";
57
- opened?: boolean;
58
- }) {
63
+ }: PanelProps) {
59
64
  const sanitizedProps = filterStylingProps(rest, overStyled);
60
65
 
61
66
  // Bind CSS module classes to Mui's internal classNames API
@@ -85,9 +90,9 @@ const PanelBase = function Panel({
85
90
 
86
91
  return (
87
92
  <MuiDrawer
88
- anchor={position} /* Recursica default: right; Mui default: left */
93
+ anchor={placement} /* Recursica default: right; Mui default: left */
89
94
  keepMounted={keepMounted}
90
- open={Boolean(rest.opened)}
95
+ open={Boolean(opened)}
91
96
  {...(sanitizedProps as unknown as MuiDrawerProps)}
92
97
  classes={mergedClassNames}
93
98
  />
@@ -81,7 +81,7 @@ export const ReadOnlyField = React.forwardRef<
81
81
  }
82
82
 
83
83
  // Type coercions securely bounding the output values cleanly explicitly.
84
- let displayValue: React.ReactNode = value;
84
+ let displayValue: React.ReactNode = value as any;
85
85
 
86
86
  if (type === "boolean" || type === "switch") {
87
87
  displayValue = value ? "True" : "False";
@@ -1,4 +1,4 @@
1
- import React, { forwardRef } from "react";
1
+ import { forwardRef } from "react";
2
2
  import {
3
3
  Stack as MUIStack,
4
4
  type StackProps as MUIStackProps,
@@ -7,12 +7,13 @@ import {
7
7
  SPACING_MAP,
8
8
  type OmitSx,
9
9
  filterSxProp,
10
+ type WithRecursicaSpacing,
10
11
  } from "../../utils/filterStylingProps";
11
12
 
12
13
  import { type RecursicaStackProps } from "@recursica/adapter-common";
13
14
 
14
- export type StackProps = OmitSx<
15
- Omit<MUIStackProps, "spacing"> & RecursicaStackProps
15
+ export type StackProps = WithRecursicaSpacing<
16
+ OmitSx<Omit<MUIStackProps, "spacing"> & RecursicaStackProps>
16
17
  >;
17
18
 
18
19
  export const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(
@@ -19,7 +19,11 @@ import styles from "./Stepper.module.css";
19
19
 
20
20
  import { type RecursicaStepperProps } from "@recursica/adapter-common";
21
21
 
22
- export type StepperProps = RecursicaOverStyled<RecursicaStepperProps>;
22
+ export interface RecursicaStepperPropsExtended
23
+ extends Omit<Partial<MuiStepperProps>, "size">,
24
+ RecursicaStepperProps {}
25
+
26
+ export type StepperProps = RecursicaOverStyled<RecursicaStepperPropsExtended>;
23
27
 
24
28
  export const Stepper = forwardRef<HTMLDivElement, StepperProps>(
25
29
  function Stepper(props, ref) {
@@ -28,7 +28,11 @@ export interface RecursicaSwitchGroupProps
28
28
  >,
29
29
  Omit<
30
30
  RecursicaFormControlWrapperProps,
31
- "controlMaxWidth" | "controlMinWidth" | "classes" | "onChange"
31
+ | "controlMaxWidth"
32
+ | "controlMinWidth"
33
+ | "classes"
34
+ | "onChange"
35
+ | "defaultValue"
32
36
  >,
33
37
  ReadOnlyControlProps,
34
38
  BaseRecursicaSwitchGroupProps {}
@@ -0,0 +1,7 @@
1
+ /* HARDCODED VALUES:
2
+ * None. This is a generic layout wrapper.
3
+ */
4
+
5
+ .root {
6
+ /* MUI Table handles table layout natively. */
7
+ }
@@ -1,9 +1,8 @@
1
1
  import type { Meta, StoryObj } from "@storybook/react";
2
2
  import { Table } from "./Table";
3
- import { ComingSoon } from "@recursica/storybook-template";
4
3
 
5
4
  const meta: Meta<typeof Table> = {
6
- title: "UI-Kit/🚧 Table",
5
+ title: "UI-Kit/Table",
7
6
  component: Table,
8
7
  tags: ["autodocs"],
9
8
  };
@@ -12,6 +11,39 @@ export default meta;
12
11
 
13
12
  type Story = StoryObj<typeof Table>;
14
13
 
14
+ const elements = [
15
+ { position: 6, mass: 12.011, symbol: "C", name: "Carbon" },
16
+ { position: 7, mass: 14.007, symbol: "N", name: "Nitrogen" },
17
+ { position: 8, mass: 15.999, symbol: "O", name: "Oxygen" },
18
+ { position: 9, mass: 18.998, symbol: "F", name: "Fluorine" },
19
+ { position: 10, mass: 20.18, symbol: "Ne", name: "Neon" },
20
+ ];
21
+
15
22
  export const Default: Story = {
16
- render: () => <ComingSoon componentName="Table" />,
23
+ render: () => {
24
+ const rows = elements.map((element) => (
25
+ <Table.Row key={element.name}>
26
+ <Table.Cell>{element.position}</Table.Cell>
27
+ <Table.Cell>{element.name}</Table.Cell>
28
+ <Table.Cell>{element.symbol}</Table.Cell>
29
+ <Table.Cell>{element.mass}</Table.Cell>
30
+ </Table.Row>
31
+ ));
32
+
33
+ return (
34
+ <Table.Container>
35
+ <Table>
36
+ <Table.Head>
37
+ <Table.Row>
38
+ <Table.Cell>Element position</Table.Cell>
39
+ <Table.Cell>Element name</Table.Cell>
40
+ <Table.Cell>Symbol</Table.Cell>
41
+ <Table.Cell>Atomic mass</Table.Cell>
42
+ </Table.Row>
43
+ </Table.Head>
44
+ <Table.Body>{rows}</Table.Body>
45
+ </Table>
46
+ </Table.Container>
47
+ );
48
+ },
17
49
  };
@@ -1,9 +1,65 @@
1
- import React from "react";
1
+ import { forwardRef } from "react";
2
+ import {
3
+ Table as MuiTable,
4
+ type TableProps as MuiTableProps,
5
+ TableBody as MuiTableBody,
6
+ TableCell as MuiTableCell,
7
+ TableContainer as MuiTableContainer,
8
+ TableHead as MuiTableHead,
9
+ TableRow as MuiTableRow,
10
+ TableFooter as MuiTableFooter,
11
+ TableSortLabel as MuiTableSortLabel,
12
+ } from "@mui/material";
13
+ import {
14
+ filterStylingProps,
15
+ type RecursicaOverStyled,
16
+ } from "../../utils/filterStylingProps";
2
17
  import { type RecursicaTableProps } from "@recursica/adapter-common";
18
+ import styles from "./Table.module.css";
3
19
 
4
- export type TableProps = React.HTMLAttributes<HTMLDivElement> &
5
- RecursicaTableProps;
20
+ export type TableProps = RecursicaOverStyled<
21
+ MuiTableProps & RecursicaTableProps
22
+ >;
6
23
 
7
- export const Table: React.FC<TableProps> = (props) => {
8
- return <div {...props}>Table</div>;
24
+ const TableBase = forwardRef<HTMLTableElement, TableProps>(function Table(
25
+ { overStyled = false, className, ...rest },
26
+ ref,
27
+ ) {
28
+ const sanitizedProps = filterStylingProps(rest, overStyled);
29
+ const classNameProp = (sanitizedProps as Record<string, unknown>)
30
+ .className as string | undefined;
31
+
32
+ const rootClass = styles.root;
33
+ const finalClass = classNameProp
34
+ ? `${rootClass} ${classNameProp}`
35
+ : rootClass;
36
+
37
+ return (
38
+ <MuiTable
39
+ ref={ref}
40
+ className={finalClass}
41
+ {...(sanitizedProps as unknown as MuiTableProps)}
42
+ />
43
+ );
44
+ });
45
+
46
+ TableBase.displayName = "Table";
47
+
48
+ type TableComponent = typeof TableBase & {
49
+ Body: typeof MuiTableBody;
50
+ Cell: typeof MuiTableCell;
51
+ Container: typeof MuiTableContainer;
52
+ Head: typeof MuiTableHead;
53
+ Row: typeof MuiTableRow;
54
+ Footer: typeof MuiTableFooter;
55
+ SortLabel: typeof MuiTableSortLabel;
9
56
  };
57
+
58
+ export const Table = TableBase as TableComponent;
59
+ Table.Body = MuiTableBody;
60
+ Table.Cell = MuiTableCell;
61
+ Table.Container = MuiTableContainer;
62
+ Table.Head = MuiTableHead;
63
+ Table.Row = MuiTableRow;
64
+ Table.Footer = MuiTableFooter;
65
+ Table.SortLabel = MuiTableSortLabel;
@@ -13,7 +13,11 @@ import styles from "./Tabs.module.css";
13
13
 
14
14
  import { type RecursicaTabsProps } from "@recursica/adapter-common";
15
15
 
16
- export type TabsProps = RecursicaOverStyled<RecursicaTabsProps>;
16
+ export interface RecursicaTabsPropsExtended
17
+ extends Omit<MuiTabsProps, "variant">,
18
+ RecursicaTabsProps {}
19
+
20
+ export type TabsProps = RecursicaOverStyled<RecursicaTabsPropsExtended>;
17
21
 
18
22
  export const Tabs = forwardRef<HTMLDivElement, TabsProps>(
19
23
  function Tabs(props, ref) {
@@ -1,9 +1,12 @@
1
- import React, { forwardRef } from "react";
1
+ import { forwardRef } from "react";
2
+ import { type TypographyProps as MuiTypographyProps } from "@mui/material";
2
3
  import { Typography } from "../Typography/Typography";
3
4
  import { type RecursicaOverStyled } from "../../utils/filterStylingProps";
4
5
  import { type RecursicaTextProps } from "@recursica/adapter-common";
5
6
 
6
- export type TextProps = RecursicaOverStyled<RecursicaTextProps>;
7
+ export type TextProps = RecursicaOverStyled<
8
+ Omit<MuiTypographyProps, "variant" | "classes"> & RecursicaTextProps
9
+ >;
7
10
 
8
11
  export const Text = forwardRef<HTMLElement, TextProps>(function Text(
9
12
  { variant = "body", ...rest },
@@ -18,18 +18,11 @@ import { type RecursicaTextAreaProps as BaseRecursicaTextAreaProps } from "@recu
18
18
  export interface RecursicaTextAreaProps
19
19
  extends Omit<
20
20
  MuiTextareaProps,
21
- "size" | "variant" | "radius" | "wrapperProps"
21
+ "size" | "variant" | "radius" | "wrapperProps" | "maxRows" | "minRows"
22
22
  >,
23
- Pick<
23
+ Omit<
24
24
  RecursicaFormControlWrapperProps,
25
- | "assistiveText"
26
- | "assistiveWithIcon"
27
- | "formLayout"
28
- | "labelSize"
29
- | "labelAlignment"
30
- | "labelOptionalText"
31
- | "labelWithEditIcon"
32
- | "onLabelEditClick"
25
+ "controlMaxWidth" | "controlMinWidth"
33
26
  >,
34
27
  ReadOnlyControlProps,
35
28
  BaseRecursicaTextAreaProps {}
@@ -1,9 +1,12 @@
1
1
  import React, { forwardRef } from "react";
2
+ import { type TypographyProps as MuiTypographyProps } from "@mui/material";
2
3
  import { Typography } from "../Typography/Typography";
3
4
  import { type RecursicaOverStyled } from "../../utils/filterStylingProps";
4
5
  import { type RecursicaTitleProps } from "@recursica/adapter-common";
5
6
 
6
- export type TitleProps = RecursicaOverStyled<RecursicaTitleProps>;
7
+ export type TitleProps = RecursicaOverStyled<
8
+ Omit<MuiTypographyProps, "variant" | "classes"> & RecursicaTitleProps
9
+ >;
7
10
 
8
11
  export const Title = forwardRef<HTMLElement, TitleProps>(function Title(
9
12
  { order = 1, component, ...rest },
package/src/index.ts CHANGED
@@ -1,3 +1,14 @@
1
1
  import "@recursica/adapter-common/style.css";
2
2
  export * from "./components";
3
3
  export * from "@recursica/adapter-common";
4
+
5
+ export type {
6
+ RecursicaAutocompleteProps,
7
+ RecursicaDropdownProps,
8
+ RecursicaFormControlWrapperProps,
9
+ RecursicaNumberInputProps,
10
+ RecursicaSliderProps,
11
+ RecursicaTextAreaProps,
12
+ RecursicaTextFieldProps,
13
+ RecursicaToastProps,
14
+ } from "./components";
@@ -57,6 +57,7 @@ export {
57
57
  type RecursicaOverStyled,
58
58
  type BlockedStylingKeys,
59
59
  type ForbiddenStyles,
60
+ type WithRecursicaSpacing,
60
61
  } from "@recursica/adapter-common";
61
62
 
62
63
  const LAYOUT_PROPS = new Set([