@recursica/mantine-adapter 0.7.0 → 0.9.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 (41) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/mantine-adapter.cjs +1 -1
  3. package/dist/mantine-adapter.cjs.map +1 -1
  4. package/dist/mantine-adapter.css +1 -1
  5. package/dist/mantine-adapter.js +963 -639
  6. package/dist/mantine-adapter.js.map +1 -1
  7. package/dist/src/components/Container/Container.d.ts +14 -0
  8. package/dist/src/components/Dropdown/Dropdown.d.ts +10 -2
  9. package/dist/src/components/Flex/Flex.d.ts +17 -0
  10. package/dist/src/components/Group/Group.d.ts +17 -0
  11. package/dist/src/components/Stack/Stack.d.ts +15 -0
  12. package/dist/src/components/TextArea/TextArea.d.ts +14 -2
  13. package/dist/src/components/index.d.ts +6 -0
  14. package/package.json +1 -1
  15. package/src/components/Accordion/Accordion.module.css +29 -8
  16. package/src/components/Checkbox/CheckboxGroup.tsx +1 -1
  17. package/src/components/Container/CONTAINER_IMPLEMENTATION_NOTES.md +4 -0
  18. package/src/components/Container/Container.module.css +7 -0
  19. package/src/components/Container/Container.stories.tsx +102 -0
  20. package/src/components/Container/Container.tsx +63 -0
  21. package/src/components/Dropdown/DROPDOWN_IMPLEMENTATION_NOTES.md +7 -0
  22. package/src/components/Dropdown/Dropdown.module.css +272 -0
  23. package/src/components/Dropdown/Dropdown.stories.tsx +77 -5
  24. package/src/components/Dropdown/Dropdown.tsx +171 -5
  25. package/src/components/Flex/FLEX_IMPLEMENTATION_NOTES.md +4 -0
  26. package/src/components/Flex/Flex.module.css +7 -0
  27. package/src/components/Flex/Flex.stories.tsx +125 -0
  28. package/src/components/Flex/Flex.tsx +68 -0
  29. package/src/components/Group/GROUP_IMPLEMENTATION_NOTES.md +4 -0
  30. package/src/components/Group/Group.module.css +7 -0
  31. package/src/components/Group/Group.stories.tsx +117 -0
  32. package/src/components/Group/Group.tsx +68 -0
  33. package/src/components/Stack/STACK_IMPLEMENTATION_NOTES.md +4 -0
  34. package/src/components/Stack/Stack.module.css +7 -0
  35. package/src/components/Stack/Stack.stories.tsx +105 -0
  36. package/src/components/Stack/Stack.tsx +66 -0
  37. package/src/components/TextArea/TEXTAREA_IMPLEMENTATION_NOTES.md +7 -0
  38. package/src/components/TextArea/TextArea.module.css +225 -0
  39. package/src/components/TextArea/TextArea.stories.tsx +77 -5
  40. package/src/components/TextArea/TextArea.tsx +149 -5
  41. package/src/components/index.ts +6 -0
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { ContainerProps as MantineContainerProps } from '@mantine/core';
3
+ import { RecursicaOverStyled } from '../../utils/filterStylingProps';
4
+ export interface RecursicaContainerProps {
5
+ /**
6
+ * Children components inside the layout container
7
+ */
8
+ children?: React.ReactNode;
9
+ }
10
+ /**
11
+ * Container layout wrapper
12
+ */
13
+ export type ContainerProps = RecursicaOverStyled<MantineContainerProps & RecursicaContainerProps>;
14
+ export declare const Container: React.ForwardRefExoticComponent<ContainerProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,11 @@
1
1
  import { default as React } from 'react';
2
- export type DropdownProps = React.HTMLAttributes<HTMLDivElement>;
3
- export declare const Dropdown: React.FC<DropdownProps>;
2
+ import { SelectProps as MantineSelectProps } from '@mantine/core';
3
+ import { ReadOnlyControlProps } from '@recursica/adapter-common';
4
+ import { RecursicaOverStyled } from '../../utils/filterStylingProps';
5
+ import { RecursicaFormControlWrapperProps } from '../FormControlWrapper/FormControlWrapper';
6
+ export interface RecursicaDropdownProps extends Omit<MantineSelectProps, "size" | "variant" | "radius" | "wrapperProps">, Pick<RecursicaFormControlWrapperProps, "assistiveText" | "assistiveWithIcon" | "formLayout" | "labelSize" | "labelAlignment" | "labelOptionalText" | "labelWithEditIcon" | "onLabelEditClick">, ReadOnlyControlProps {
7
+ /** Internal hook for Selects to override raw layout width properties when necessary */
8
+ containerWidth?: React.CSSProperties["width"];
9
+ }
10
+ export type DropdownProps = RecursicaOverStyled<RecursicaDropdownProps>;
11
+ export declare const Dropdown: React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { FlexProps as MantineFlexProps } from '@mantine/core';
3
+ import { RecursicaOverStyled, RecursicaSpacing } from '../../utils/filterStylingProps';
4
+ export interface RecursicaFlexProps {
5
+ /**
6
+ * Children components inside the Flex container
7
+ */
8
+ children?: React.ReactNode;
9
+ gap?: MantineFlexProps["gap"] | RecursicaSpacing;
10
+ rowGap?: MantineFlexProps["gap"] | RecursicaSpacing;
11
+ columnGap?: MantineFlexProps["gap"] | RecursicaSpacing;
12
+ }
13
+ /**
14
+ * Flex layout wrapper
15
+ */
16
+ export type FlexProps = RecursicaOverStyled<MantineFlexProps & RecursicaFlexProps>;
17
+ export declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,17 @@
1
+ import { default as React } from 'react';
2
+ import { GroupProps as MantineGroupProps } from '@mantine/core';
3
+ import { RecursicaOverStyled, RecursicaSpacing } from '../../utils/filterStylingProps';
4
+ export interface RecursicaGroupProps {
5
+ /**
6
+ * Children components inside the group
7
+ */
8
+ children?: React.ReactNode;
9
+ gap?: MantineGroupProps["gap"] | RecursicaSpacing;
10
+ rowGap?: MantineGroupProps["gap"] | RecursicaSpacing;
11
+ columnGap?: MantineGroupProps["gap"] | RecursicaSpacing;
12
+ }
13
+ /**
14
+ * Group flex layout wrapper
15
+ */
16
+ export type GroupProps = RecursicaOverStyled<MantineGroupProps & RecursicaGroupProps>;
17
+ export declare const Group: React.ForwardRefExoticComponent<GroupProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,15 @@
1
+ import { default as React } from 'react';
2
+ import { StackProps as MantineStackProps } from '@mantine/core';
3
+ import { RecursicaOverStyled, RecursicaSpacing } from '../../utils/filterStylingProps';
4
+ export interface RecursicaStackProps {
5
+ /**
6
+ * Children components inside the stack
7
+ */
8
+ children?: React.ReactNode;
9
+ gap?: MantineStackProps["gap"] | RecursicaSpacing;
10
+ }
11
+ /**
12
+ * Stack flex layout wrapper
13
+ */
14
+ export type StackProps = RecursicaOverStyled<MantineStackProps & RecursicaStackProps>;
15
+ export declare const Stack: React.ForwardRefExoticComponent<StackProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,3 +1,15 @@
1
1
  import { default as React } from 'react';
2
- export type TextAreaProps = React.HTMLAttributes<HTMLDivElement>;
3
- export declare const TextArea: React.FC<TextAreaProps>;
2
+ import { TextareaProps as MantineTextareaProps } from '@mantine/core';
3
+ import { ReadOnlyControlProps } from '@recursica/adapter-common';
4
+ import { RecursicaOverStyled } from '../../utils/filterStylingProps';
5
+ import { RecursicaFormControlWrapperProps } from '../FormControlWrapper/FormControlWrapper';
6
+ export interface RecursicaTextAreaProps extends Omit<MantineTextareaProps, "size" | "variant" | "radius" | "wrapperProps">, Pick<RecursicaFormControlWrapperProps, "assistiveText" | "assistiveWithIcon" | "formLayout" | "labelSize" | "labelAlignment" | "labelOptionalText" | "labelWithEditIcon" | "onLabelEditClick">, ReadOnlyControlProps {
7
+ /** Maximum rows for autosize textarea to grow */
8
+ maxRows?: number;
9
+ /** Minimum rows of autosize textarea */
10
+ minRows?: number;
11
+ /** If set, enables textarea height growing with its content */
12
+ autosize?: boolean;
13
+ }
14
+ export type TextAreaProps = RecursicaOverStyled<RecursicaTextAreaProps>;
15
+ export declare const TextArea: React.ForwardRefExoticComponent<TextAreaProps & React.RefAttributes<HTMLTextAreaElement>>;
@@ -7,10 +7,13 @@ export * from './Card/Card';
7
7
  export * from './Checkbox/Checkbox';
8
8
  export * from './Checkbox/CheckboxGroup';
9
9
  export * from './Chip/Chip';
10
+ export * from './Container/Container';
10
11
  export * from './DatePicker/DatePicker';
11
12
  export * from './Dropdown/Dropdown';
12
13
  export * from './FileInput/FileInput';
13
14
  export * from './FileUpload/FileUpload';
15
+ export * from './Flex/Flex';
16
+ export * from './Group/Group';
14
17
  export * from './HoverCard/HoverCard';
15
18
  export * from './Link/Link';
16
19
  export * from './Loader/Loader';
@@ -26,14 +29,17 @@ export * from './ReadOnlyField';
26
29
  export * from './Search/Search';
27
30
  export * from './SegmentedControl/SegmentedControl';
28
31
  export * from './Slider/Slider';
32
+ export * from './Stack/Stack';
29
33
  export * from './Stepper/Stepper';
30
34
  export * from './Switch/Switch';
31
35
  export * from './Table/Table';
32
36
  export * from './Tabs/Tabs';
37
+ export * from './Text/Text';
33
38
  export * from './TextArea/TextArea';
34
39
  export * from './TextField/TextField';
35
40
  export * from './TimePicker/TimePicker';
36
41
  export * from './Timeline/Timeline';
42
+ export * from './Title/Title';
37
43
  export * from './Toast/Toast';
38
44
  export * from './Tooltip/Tooltip';
39
45
  export * from './TransferList/TransferList';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "type": "git",
12
12
  "url": "git+https://github.com/borderux/recursica.git"
13
13
  },
14
- "version": "0.7.0",
14
+ "version": "0.9.0",
15
15
  "type": "module",
16
16
  "main": "./dist/mantine-adapter.cjs",
17
17
  "module": "./dist/mantine-adapter.js",
@@ -40,16 +40,22 @@
40
40
 
41
41
  border-style: solid;
42
42
  border-color: var(
43
- --recursica_ui-kit_components_accordion-item_properties_colors_divider
43
+ --recursica_ui-kit_components_accordion-item_properties_colors_item-border-color
44
44
  );
45
45
  border-width: var(
46
- --recursica_ui-kit_components_accordion-item_properties_divider-size
46
+ --recursica_ui-kit_components_accordion-item_properties_item-border-size
47
+ );
48
+ border-bottom-color: var(
49
+ --recursica_ui-kit_components_accordion_properties_colors_divider
50
+ );
51
+ border-bottom-width: var(
52
+ --recursica_ui-kit_components_accordion_properties_divider-size
47
53
  );
48
54
  border-radius: var(
49
55
  --recursica_ui-kit_components_accordion-item_properties_border-radius
50
56
  );
51
57
  box-shadow: var(
52
- --recursica_ui-kit_components_accordion-item_properties_elevation
58
+ --recursica_ui-kit_components_accordion-item_properties_elevation-item
53
59
  );
54
60
 
55
61
  background-color: var(
@@ -79,10 +85,10 @@
79
85
 
80
86
  /* Strip Mantine's baked padding directly */
81
87
  padding: var(
82
- --recursica_ui-kit_components_accordion-item_properties_padding-vertical
88
+ --recursica_ui-kit_components_accordion-item_properties_header-vertical-padding
83
89
  )
84
90
  var(
85
- --recursica_ui-kit_components_accordion-item_properties_padding-horizontal
91
+ --recursica_ui-kit_components_accordion-item_properties_header-horizontal-padding
86
92
  );
87
93
  background-color: transparent;
88
94
 
@@ -206,11 +212,26 @@
206
212
  /* ==== ACCORDION PANEL (CONTENT) ==== */
207
213
  .panel {
208
214
  box-sizing: border-box;
209
- margin: 0;
215
+ margin: var(
216
+ --recursica_ui-kit_components_accordion-item_properties_content-margin
217
+ );
210
218
  padding: 0; /* Overriding dynamic layout structure */
211
219
  background-color: var(
212
220
  --recursica_ui-kit_components_accordion-item_properties_colors_content-background
213
221
  );
222
+ border-style: solid;
223
+ border-color: var(
224
+ --recursica_ui-kit_components_accordion-item_properties_colors_content-border-color
225
+ );
226
+ border-width: var(
227
+ --recursica_ui-kit_components_accordion-item_properties_content-border-size
228
+ );
229
+ border-radius: var(
230
+ --recursica_ui-kit_components_accordion-item_properties_content-border-radius
231
+ );
232
+ box-shadow: var(
233
+ --recursica_ui-kit_components_accordion-item_properties_elevation-content
234
+ );
214
235
  }
215
236
 
216
237
  .content {
@@ -218,7 +239,7 @@
218
239
  /* Strip Mantine padding and apply logic directly mapped */
219
240
  padding: 0
220
241
  var(
221
- --recursica_ui-kit_components_accordion-item_properties_padding-horizontal
242
+ --recursica_ui-kit_components_accordion-item_properties_content-horizontal-padding
222
243
  )
223
244
  var(
224
245
  --recursica_ui-kit_components_accordion-item_properties_content-bottom-padding
@@ -226,7 +247,7 @@
226
247
 
227
248
  /* Apply offset gap explicitly calculated below header */
228
249
  padding-top: var(
229
- --recursica_ui-kit_components_accordion-item_properties_header-content-gap
250
+ --recursica_ui-kit_components_accordion-item_properties_content-top-padding
230
251
  );
231
252
 
232
253
  color: var(
@@ -125,7 +125,7 @@ export const CheckboxGroup = forwardRef<HTMLDivElement, CheckboxGroupProps>(
125
125
  {React.Children.map(children, (child) => {
126
126
  if (React.isValidElement(child)) {
127
127
  return React.cloneElement(child as React.ReactElement<any>, {
128
- disabled: readOnly || child.props.disabled,
128
+ disabled: readOnly || (child.props as any).disabled,
129
129
  });
130
130
  }
131
131
  return child;
@@ -0,0 +1,4 @@
1
+ # Container Implementation Notes
2
+
3
+ The `Container` component is a generic layout wrapper mapped directly to Mantine's `Container`.
4
+ It serves to provide standardized centered max-width bounds around content. Mantine handles the width boundaries inherently based on size properties.
@@ -0,0 +1,7 @@
1
+ /* HARDCODED VALUES:
2
+ * None. This is a generic layout wrapper.
3
+ */
4
+
5
+ .root {
6
+ /* Mantine handles container constraints natively. */
7
+ }
@@ -0,0 +1,102 @@
1
+ import React from "react";
2
+ import type { Meta, StoryObj } from "@storybook/react";
3
+ import { Container } from "./Container";
4
+ import { Text } from "../Text/Text";
5
+
6
+ type ContainerStoryProps = React.ComponentProps<typeof Container>;
7
+
8
+ const meta: Meta<ContainerStoryProps> = {
9
+ title: "UI-Kit/Container",
10
+ component: Container,
11
+ tags: ["autodocs"],
12
+ parameters: {
13
+ docs: {
14
+ description: {
15
+ component:
16
+ "Container is a generic layout wrapper that safely maps to Mantine's Container, standardizing maximum content widths across the application.",
17
+ },
18
+ },
19
+ },
20
+ args: {
21
+ size: "md",
22
+ fluid: false,
23
+ },
24
+ argTypes: {
25
+ size: {
26
+ control: "select",
27
+ options: ["xs", "sm", "md", "lg", "xl"],
28
+ description: "Maximum width defined by Mantine system sizes",
29
+ },
30
+ fluid: {
31
+ control: "boolean",
32
+ description: "If true, overrides size and sets max-width to 100%",
33
+ },
34
+ defaultChecked: {
35
+ table: { disable: true },
36
+ },
37
+ },
38
+ };
39
+
40
+ export default meta;
41
+
42
+ type Story = StoryObj<ContainerStoryProps>;
43
+
44
+ export const Default: Story = {
45
+ render: (args) => (
46
+ <div style={{ backgroundColor: "#f0f0f0", padding: "16px" }}>
47
+ <Container
48
+ {...args}
49
+ style={{
50
+ backgroundColor: "white",
51
+ padding: "16px",
52
+ border: "1px solid #ccc",
53
+ }}
54
+ >
55
+ <Text>
56
+ This is a Container holding centered content. The background and
57
+ border are added just to demonstrate the layout bounds visually.
58
+ </Text>
59
+ </Container>
60
+ </div>
61
+ ),
62
+ };
63
+
64
+ export const SmallContainer: Story = {
65
+ args: {
66
+ size: "sm",
67
+ },
68
+ render: (args) => (
69
+ <div style={{ backgroundColor: "#f0f0f0", padding: "16px" }}>
70
+ <Container
71
+ {...args}
72
+ style={{
73
+ backgroundColor: "white",
74
+ padding: "16px",
75
+ border: "1px solid #ccc",
76
+ }}
77
+ >
78
+ <Text>Small Container Layout</Text>
79
+ </Container>
80
+ </div>
81
+ ),
82
+ };
83
+
84
+ export const FluidContainer: Story = {
85
+ args: {
86
+ fluid: true,
87
+ },
88
+ render: (args) => (
89
+ <div style={{ backgroundColor: "#f0f0f0", padding: "16px" }}>
90
+ <Container
91
+ {...args}
92
+ style={{
93
+ backgroundColor: "white",
94
+ padding: "16px",
95
+ border: "1px solid #ccc",
96
+ }}
97
+ >
98
+ <Text>Fluid Container Layout</Text>
99
+ </Container>
100
+ </div>
101
+ ),
102
+ };
@@ -0,0 +1,63 @@
1
+ import React, { forwardRef } from "react";
2
+ import {
3
+ Container as MantineContainer,
4
+ type ContainerProps as MantineContainerProps,
5
+ } from "@mantine/core";
6
+ import {
7
+ filterStylingProps,
8
+ type RecursicaOverStyled,
9
+ } from "../../utils/filterStylingProps";
10
+ import styles from "./Container.module.css";
11
+
12
+ export interface RecursicaContainerProps {
13
+ /**
14
+ * Children components inside the layout container
15
+ */
16
+ children?: React.ReactNode;
17
+ }
18
+
19
+ /**
20
+ * Container layout wrapper
21
+ */
22
+ export type ContainerProps = RecursicaOverStyled<
23
+ MantineContainerProps & RecursicaContainerProps
24
+ >;
25
+
26
+ export const Container = forwardRef<HTMLDivElement, ContainerProps>(
27
+ function Container({ children, overStyled = false, ...rest }, ref) {
28
+ const sanitizedProps = filterStylingProps(rest, overStyled);
29
+ const restRecord = sanitizedProps as Record<string, unknown>;
30
+
31
+ const mergedClassNames: Partial<Record<string, string>> = {
32
+ root: styles.root,
33
+ };
34
+
35
+ const classNamesProp = restRecord.classNames;
36
+ if (
37
+ classNamesProp &&
38
+ typeof classNamesProp === "object" &&
39
+ !Array.isArray(classNamesProp)
40
+ ) {
41
+ const o = classNamesProp as Partial<Record<string, string>>;
42
+ mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
43
+ }
44
+
45
+ const classNameProp = restRecord.className as string | undefined;
46
+ const finalClass = classNameProp
47
+ ? `${styles.root} ${classNameProp}`
48
+ : styles.root;
49
+
50
+ return (
51
+ <MantineContainer
52
+ ref={ref}
53
+ className={finalClass}
54
+ classNames={mergedClassNames}
55
+ {...sanitizedProps}
56
+ >
57
+ {children}
58
+ </MantineContainer>
59
+ );
60
+ },
61
+ );
62
+
63
+ Container.displayName = "Container";
@@ -0,0 +1,7 @@
1
+ # Dropdown Implementation Notes
2
+
3
+ The `Dropdown` component is mapped explicitly to Mantine's `<Select>` following the exact same strict encapsulation rules as `TextField`.
4
+
5
+ 1. **Naked Primitive Mapping:** Mantine's `Select` natively executes macro-label generation. To decouple it, we explicitly disable internal labels (`label={undefined}`) and inject it purely inside our generic `FormControlWrapper`.
6
+ 2. **Strict Dropdown Design Tokens:** The adapter implements strictly sandboxed styling utilizing only `--recursica_ui-kit_components_dropdown_...` variables. It explicitly does NOT inherit general `text-field` tokens despite geometric similarities, ensuring dropdown menus can be themed independently.
7
+ 3. **Dropdown Appendages:** To correctly map Mantine's detached Popover `.dropdown` and list `.option` items, we targeted focus and geometric bindings appending standard padding structures matched to the dropdown height overrides dynamically into our `Dropdown.module.css`.