@recursica/mantine-adapter 0.19.0 → 0.21.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.
@@ -4,7 +4,10 @@ import {
4
4
  type FlexProps as MantineFlexProps,
5
5
  createPolymorphicComponent,
6
6
  } from "@mantine/core";
7
- import { type RecursicaSpacing } from "../../utils/filterStylingProps";
7
+ import {
8
+ type RecursicaSpacing,
9
+ mapLayoutProps,
10
+ } from "../../utils/filterStylingProps";
8
11
  import styles from "./Flex.module.css";
9
12
 
10
13
  export interface RecursicaFlexProps {
@@ -27,7 +30,7 @@ export interface RecursicaFlexProps {
27
30
  export type FlexProps = MantineFlexProps & RecursicaFlexProps;
28
31
 
29
32
  const _Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(
30
- { children, gap = "rec-default", ...rest },
33
+ { children, gap = "rec-default", rowGap, columnGap, ...rest },
31
34
  ref,
32
35
  ) {
33
36
  const mergedClassNames: Partial<Record<string, string>> = {
@@ -54,8 +57,10 @@ const _Flex = forwardRef<HTMLDivElement, FlexProps>(function Flex(
54
57
  ref={ref}
55
58
  className={finalClass}
56
59
  classNames={mergedClassNames}
57
- gap={gap}
58
- {...rest}
60
+ {...mapLayoutProps({ gap, rowGap, columnGap, ...rest } as Record<
61
+ string,
62
+ unknown
63
+ >)}
59
64
  >
60
65
  {children}
61
66
  </MantineFlex>
@@ -3,7 +3,10 @@ import {
3
3
  Group as MantineGroup,
4
4
  type GroupProps as MantineGroupProps,
5
5
  } from "@mantine/core";
6
- import { type RecursicaSpacing } from "../../utils/filterStylingProps";
6
+ import {
7
+ type RecursicaSpacing,
8
+ mapLayoutProps,
9
+ } from "../../utils/filterStylingProps";
7
10
  import styles from "./Group.module.css";
8
11
 
9
12
  export interface RecursicaGroupProps {
@@ -53,8 +56,7 @@ export const Group = forwardRef<HTMLDivElement, GroupProps>(function Group(
53
56
  ref={ref}
54
57
  className={finalClass}
55
58
  classNames={mergedClassNames}
56
- gap={gap}
57
- {...rest}
59
+ {...mapLayoutProps({ gap, ...rest } as Record<string, unknown>)}
58
60
  >
59
61
  {children}
60
62
  </MantineGroup>
@@ -2,8 +2,12 @@ import { forwardRef } from "react";
2
2
  import {
3
3
  Stack as MantineStack,
4
4
  type StackProps as MantineStackProps,
5
+ createPolymorphicComponent,
5
6
  } from "@mantine/core";
6
- import { type RecursicaSpacing } from "../../utils/filterStylingProps";
7
+ import {
8
+ type RecursicaSpacing,
9
+ mapLayoutProps,
10
+ } from "../../utils/filterStylingProps";
7
11
  import styles from "./Stack.module.css";
8
12
 
9
13
  export interface RecursicaStackProps {
@@ -23,7 +27,7 @@ export interface RecursicaStackProps {
23
27
  */
24
28
  export type StackProps = MantineStackProps & RecursicaStackProps;
25
29
 
26
- export const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(
30
+ const _Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(
27
31
  { children, gap = "rec-default", ...rest },
28
32
  ref,
29
33
  ) {
@@ -51,12 +55,12 @@ export const Stack = forwardRef<HTMLDivElement, StackProps>(function Stack(
51
55
  ref={ref}
52
56
  className={finalClass}
53
57
  classNames={mergedClassNames}
54
- gap={gap}
55
- {...rest}
58
+ {...mapLayoutProps({ gap, ...rest } as Record<string, unknown>)}
56
59
  >
57
60
  {children}
58
61
  </MantineStack>
59
62
  );
60
63
  });
64
+ _Stack.displayName = "Stack";
61
65
 
62
- Stack.displayName = "Stack";
66
+ export const Stack = createPolymorphicComponent<"div", StackProps>(_Stack);
@@ -23,6 +23,12 @@
23
23
  );
24
24
  gap: var(--recursica_ui-kit_components_toast_properties_spacing);
25
25
 
26
+ /* Hide Mantine's native colored vertical line */
27
+ &::before {
28
+ display: none;
29
+ content: none;
30
+ }
31
+
26
32
  & .icon {
27
33
  width: var(--recursica_ui-kit_components_toast_properties_icon) !important;
28
34
  height: var(--recursica_ui-kit_components_toast_properties_icon) !important;
@@ -91,7 +91,7 @@ const LAYOUT_PROPS = new Set([
91
91
  "right",
92
92
  ]);
93
93
 
94
- const SPACING_MAP: Record<string, string> = {
94
+ export const SPACING_MAP: Record<string, string> = {
95
95
  "rec-none": "var(--recursica_brand_dimensions_general_none)",
96
96
  "rec-sm": "var(--recursica_brand_dimensions_general_sm)",
97
97
  "rec-default": "var(--recursica_brand_dimensions_general_default)",
@@ -108,6 +108,22 @@ export type RecursicaOverStyled<T> =
108
108
  ForbiddenStyles & { overStyled?: false | undefined })
109
109
  | (T & { overStyled: true });
110
110
 
111
+ export function mapLayoutProps<T extends Record<string, unknown>>(props: T): T {
112
+ const mapped = { ...props };
113
+ for (const [key, value] of Object.entries(mapped)) {
114
+ if (
115
+ typeof value === "string" &&
116
+ value.startsWith("rec-") &&
117
+ LAYOUT_PROPS.has(key)
118
+ ) {
119
+ if (value in SPACING_MAP) {
120
+ (mapped as Record<string, unknown>)[key] = SPACING_MAP[value];
121
+ }
122
+ }
123
+ }
124
+ return mapped;
125
+ }
126
+
111
127
  export function filterStylingProps<T extends Record<string, unknown>>(
112
128
  props: T,
113
129
  overStyled?: boolean,