@recursica/mantine-adapter 0.12.0 → 0.13.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.
@@ -1,9 +1,23 @@
1
1
  import { default as React } from 'react';
2
2
  import { AvatarProps as MantineAvatarProps } from '@mantine/core';
3
+ import { RecursicaOverStyled } from '../../utils/filterStylingProps';
3
4
  export interface RecursicaAvatarProps {
4
5
  size?: "small" | "default" | "large";
5
6
  variant?: "solid" | "outline" | "ghost";
6
7
  icon?: React.ReactNode;
7
8
  }
8
- export type AvatarProps = Omit<MantineAvatarProps, "variant" | "size" | "color" | "radius"> & RecursicaAvatarProps;
9
- export declare const Avatar: React.ForwardRefExoticComponent<Omit<MantineAvatarProps, "color" | "radius" | "variant" | "size"> & RecursicaAvatarProps & React.RefAttributes<HTMLDivElement>>;
9
+ export type AvatarProps = RecursicaOverStyled<Omit<MantineAvatarProps, "variant" | "size" | "color" | "radius"> & RecursicaAvatarProps>;
10
+ /**
11
+ * Recursica Avatar component wrapping Mantine's Avatar.
12
+ *
13
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
14
+ */
15
+ export declare const Avatar: (<C = "div">(props: import('@mantine/core').PolymorphicComponentProps<C, AvatarProps>) => React.ReactElement) & Omit<React.FunctionComponent<((AvatarProps & {
16
+ component?: any;
17
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "children" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "unstyled" | "variant" | "attributes" | "overStyled" | "name" | "icon" | "size" | "gradient" | "src" | "alt" | "imageProps" | "autoContrast" | "allowedInitialsColors" | "component"> & {
18
+ ref?: any;
19
+ renderRoot?: (props: any) => any;
20
+ }) | (AvatarProps & {
21
+ component: React.ElementType;
22
+ renderRoot?: (props: Record<string, any>) => any;
23
+ })>, never> & Record<string, never>;
@@ -5,4 +5,17 @@ export interface RecursicaBadgeProps {
5
5
  variant?: "alert" | "primary-color" | "success" | "warning";
6
6
  }
7
7
  export type BadgeProps = RecursicaOverStyled<Omit<MantineBadgeProps, "variant" | "size" | "color" | "radius"> & RecursicaBadgeProps>;
8
- export declare const Badge: import('react').ForwardRefExoticComponent<BadgeProps & import('react').RefAttributes<HTMLDivElement>>;
8
+ /**
9
+ * Recursica Badge component wrapping Mantine's Badge.
10
+ *
11
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
12
+ */
13
+ export declare const Badge: (<C = "div">(props: import('@mantine/core').PolymorphicComponentProps<C, BadgeProps>) => React.ReactElement) & Omit<import('react').FunctionComponent<((BadgeProps & {
14
+ component?: any;
15
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "circle" | "children" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "unstyled" | "variant" | "attributes" | "overStyled" | "gradient" | "autoContrast" | "component" | "leftSection" | "rightSection" | "fullWidth"> & {
16
+ ref?: any;
17
+ renderRoot?: (props: any) => any;
18
+ }) | (BadgeProps & {
19
+ component: React.ElementType;
20
+ renderRoot?: (props: Record<string, any>) => any;
21
+ })>, never> & Record<string, never>;
@@ -7,4 +7,22 @@ export interface RecursicaButtonProps {
7
7
  icon?: React.ReactNode;
8
8
  }
9
9
  export type ButtonProps = RecursicaOverStyled<Omit<MantineButtonProps, "variant" | "size" | "leftSection" | "fullWidth"> & RecursicaButtonProps>;
10
- export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
10
+ /**
11
+ * Recursica Button component wrapping Mantine's Button.
12
+ *
13
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
14
+ * @example
15
+ * ```tsx
16
+ * <Button component="a" href="/dashboard">Navigate</Button>
17
+ * <Button renderRoot={(props) => <Link to="/home" {...props} />}>Home</Button>
18
+ * ```
19
+ */
20
+ export declare const Button: (<C = "button">(props: import('@mantine/core').PolymorphicComponentProps<C, ButtonProps>) => React.ReactElement) & Omit<React.FunctionComponent<((ButtonProps & {
21
+ component?: any;
22
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "color" | "children" | "radius" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "unstyled" | "variant" | "attributes" | "overStyled" | "disabled" | "icon" | "justify" | "size" | "gradient" | "autoContrast" | "component" | "loading" | "rightSection" | "data-disabled" | "loaderProps"> & {
23
+ ref?: any;
24
+ renderRoot?: (props: any) => any;
25
+ }) | (ButtonProps & {
26
+ component: React.ElementType;
27
+ renderRoot?: (props: Record<string, any>) => any;
28
+ })>, never> & Record<string, never>;
@@ -1,10 +1,6 @@
1
1
  import { CardProps as MantineCardProps, CardSectionProps as MantineCardSectionProps } from '@mantine/core';
2
2
  import { RecursicaOverStyled } from '../../utils/filterStylingProps';
3
3
  export type CardProps = RecursicaOverStyled<MantineCardProps>;
4
- /**
5
- * 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.
6
- */
7
- declare const CardBase: import('react').ForwardRefExoticComponent<CardProps & import('react').RefAttributes<HTMLDivElement>>;
8
4
  export type RecursicaCardSectionProps = MantineCardSectionProps & {
9
5
  children?: React.ReactNode;
10
6
  };
@@ -28,11 +24,30 @@ export type CardContentProps = RecursicaOverStyled<React.HTMLAttributes<HTMLDivE
28
24
  * Internal container that safely binds typography and structural flex gaps driven by the active UI kit tokens natively, preserving correct padding blocks compared to rigid `Card.Section` edges.
29
25
  */
30
26
  export declare const CardContent: import('react').ForwardRefExoticComponent<CardContentProps & import('react').RefAttributes<HTMLDivElement>>;
31
- type CardComponent = typeof CardBase & {
27
+ /**
28
+ * Recursica Card component wrapping Mantine's Card (Paper).
29
+ *
30
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
31
+ * Use dot-notation sub-components for structured card layouts.
32
+ */
33
+ declare const PolymorphicCard: (<C = "div">(props: import('@mantine/core').PolymorphicComponentProps<C, CardProps>) => React.ReactElement) & Omit<import('react').FunctionComponent<((CardProps & {
34
+ component?: any;
35
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "shadow" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "children" | "radius" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "unstyled" | "variant" | "attributes" | "overStyled" | "component" | "withBorder" | "padding"> & {
36
+ ref?: any;
37
+ renderRoot?: (props: any) => any;
38
+ }) | (CardProps & {
39
+ component: React.ElementType;
40
+ renderRoot?: (props: Record<string, any>) => any;
41
+ })>, never> & {
42
+ Section: typeof CardSection;
43
+ Header: typeof CardHeader;
44
+ Footer: typeof CardFooter;
45
+ Content: typeof CardContent;
46
+ };
47
+ export declare const Card: typeof PolymorphicCard & {
32
48
  Section: typeof CardSection;
33
49
  Header: typeof CardHeader;
34
50
  Footer: typeof CardFooter;
35
51
  Content: typeof CardContent;
36
52
  };
37
- export declare const Card: CardComponent;
38
53
  export {};
@@ -14,4 +14,22 @@ export interface RecursicaFlexProps {
14
14
  * Flex layout wrapper
15
15
  */
16
16
  export type FlexProps = RecursicaOverStyled<MantineFlexProps & RecursicaFlexProps>;
17
- export declare const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<HTMLDivElement>>;
17
+ /**
18
+ * Recursica Flex layout wrapper.
19
+ *
20
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
21
+ * @example
22
+ * ```tsx
23
+ * <Flex component="nav">...</Flex>
24
+ * <Flex component="section">...</Flex>
25
+ * ```
26
+ */
27
+ export declare const Flex: (<C = "div">(props: import('@mantine/core').PolymorphicComponentProps<C, FlexProps>) => React.ReactElement) & Omit<React.FunctionComponent<((FlexProps & {
28
+ component?: any;
29
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "gap" | "rowGap" | "columnGap" | "top" | "left" | "bottom" | "right" | "key" | "defaultValue" | "onChange" | "slot" | "title" | "defaultChecked" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "unstyled" | "variant" | "attributes" | "overStyled" | "justify" | "component" | "direction" | "wrap" | "align"> & {
30
+ ref?: any;
31
+ renderRoot?: (props: any) => any;
32
+ }) | (FlexProps & {
33
+ component: React.ElementType;
34
+ renderRoot?: (props: Record<string, any>) => any;
35
+ })>, never> & Record<string, never>;
@@ -40,7 +40,24 @@ declare const MenuDropdown: import('react').ForwardRefExoticComponent<MenuDropdo
40
40
  * design token adherence. Use `overStyled={true}` if you need to bypass.
41
41
  */
42
42
  export type MenuItemProps = RecursicaOverStyled<Omit<MantineMenuItemProps, "color">>;
43
- declare const MenuItem: import('react').ForwardRefExoticComponent<MenuItemProps & import('react').RefAttributes<HTMLButtonElement>>;
43
+ /**
44
+ * An individual actionable item within the menu dropdown.
45
+ *
46
+ * Supports polymorphism via the `component` prop for link-style items.
47
+ * @example
48
+ * ```tsx
49
+ * <Menu.Item component="a" href="/settings">Settings</Menu.Item>
50
+ * ```
51
+ */
52
+ declare const MenuItem: (<C = "button">(props: import('@mantine/core').PolymorphicComponentProps<C, MenuItemProps>) => React.ReactElement) & Omit<import('react').FunctionComponent<((MenuItemProps & {
53
+ component?: any;
54
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "children" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "variant" | "overStyled" | "disabled" | "component" | "leftSection" | "rightSection" | "data-disabled" | "closeMenuOnClick"> & {
55
+ ref?: any;
56
+ renderRoot?: (props: any) => any;
57
+ }) | (MenuItemProps & {
58
+ component: React.ElementType;
59
+ renderRoot?: (props: Record<string, any>) => any;
60
+ })>, never> & Record<string, never>;
44
61
  /** A visual separator between groups of menu items. */
45
62
  export type MenuDividerProps = RecursicaOverStyled<MantineMenuDividerProps>;
46
63
  declare const MenuDivider: import('react').ForwardRefExoticComponent<MenuDividerProps & import('react').RefAttributes<HTMLHRElement>>;
@@ -64,7 +81,20 @@ declare const MenuSubTarget: {
64
81
  * Renders within Menu.Sub.Target and displays a chevron indicator.
65
82
  */
66
83
  export type MenuSubItemProps = RecursicaOverStyled<Omit<MantineMenuItemProps, "color">>;
67
- declare const MenuSubItem: import('react').ForwardRefExoticComponent<MenuSubItemProps & import('react').RefAttributes<HTMLButtonElement>>;
84
+ /**
85
+ * A menu item that acts as a submenu trigger.
86
+ *
87
+ * Supports polymorphism via the `component` prop.
88
+ */
89
+ declare const MenuSubItem: (<C = "button">(props: import('@mantine/core').PolymorphicComponentProps<C, MenuSubItemProps>) => React.ReactElement) & Omit<import('react').FunctionComponent<((MenuSubItemProps & {
90
+ component?: any;
91
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "children" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "variant" | "overStyled" | "disabled" | "component" | "leftSection" | "rightSection" | "data-disabled" | "closeMenuOnClick"> & {
92
+ ref?: any;
93
+ renderRoot?: (props: any) => any;
94
+ }) | (MenuSubItemProps & {
95
+ component: React.ElementType;
96
+ renderRoot?: (props: Record<string, any>) => any;
97
+ })>, never> & Record<string, never>;
68
98
  /** The dropdown panel for a submenu. */
69
99
  export type MenuSubDropdownProps = RecursicaOverStyled<MantineMenuSubDropdownProps>;
70
100
  declare const MenuSubDropdown: import('react').ForwardRefExoticComponent<MenuSubDropdownProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -13,5 +13,20 @@ export type TextProps = RecursicaOverStyled<RecursicaTextProps>;
13
13
  /**
14
14
  * A generalized typographical wrapper limiting text properties to bounded Recursica UI-kit tokens inherently.
15
15
  * Do not use for semantic headings; use the explicit `<Title>` component for `<h1>` - `<h6>`.
16
+ *
17
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
18
+ * @example
19
+ * ```tsx
20
+ * <Text component="span">Inline text</Text>
21
+ * <Text component="label" htmlFor="input-id">Label text</Text>
22
+ * ```
16
23
  */
17
- export declare const Text: import('react').ForwardRefExoticComponent<TextProps & import('react').RefAttributes<HTMLDivElement>>;
24
+ export declare const Text: (<C = "p">(props: import('@mantine/core').PolymorphicComponentProps<C, TextProps>) => React.ReactElement) & Omit<import('react').FunctionComponent<((TextProps & {
25
+ component?: any;
26
+ }) & Omit<Omit<any, "ref">, "className" | "classNames" | "style" | "styles" | "vars" | "p" | "px" | "py" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "opacity" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "td" | "bd" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "top" | "left" | "bottom" | "right" | "span" | "color" | "children" | "__vars" | "__size" | "hiddenFrom" | "visibleFrom" | "lightHidden" | "darkHidden" | "mod" | "ms" | "me" | "ps" | "pe" | "bdrs" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "inset" | "display" | "flex" | "unstyled" | "variant" | "attributes" | "overStyled" | "inherit" | "inline" | "size" | "gradient" | "component" | "__staticSelector" | "lineClamp" | "truncate"> & {
27
+ ref?: any;
28
+ renderRoot?: (props: any) => any;
29
+ }) | (TextProps & {
30
+ component: React.ElementType;
31
+ renderRoot?: (props: Record<string, any>) => any;
32
+ })>, never> & Record<string, never>;
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.12.0",
14
+ "version": "0.13.0",
15
15
  "type": "module",
16
16
  "main": "./dist/mantine-adapter.cjs",
17
17
  "module": "./dist/mantine-adapter.js",
@@ -2,7 +2,12 @@ import React, { forwardRef } from "react";
2
2
  import {
3
3
  Avatar as MantineAvatar,
4
4
  type AvatarProps as MantineAvatarProps,
5
+ createPolymorphicComponent,
5
6
  } from "@mantine/core";
7
+ import {
8
+ filterStylingProps,
9
+ type RecursicaOverStyled,
10
+ } from "../../utils/filterStylingProps";
6
11
  import styles from "./Avatar.module.css";
7
12
 
8
13
  export interface RecursicaAvatarProps {
@@ -11,22 +16,19 @@ export interface RecursicaAvatarProps {
11
16
  icon?: React.ReactNode;
12
17
  }
13
18
 
14
- export type AvatarProps = Omit<
15
- MantineAvatarProps,
16
- "variant" | "size" | "color" | "radius"
17
- > &
18
- RecursicaAvatarProps;
19
+ export type AvatarProps = RecursicaOverStyled<
20
+ Omit<MantineAvatarProps, "variant" | "size" | "color" | "radius"> &
21
+ RecursicaAvatarProps
22
+ >;
19
23
 
20
- export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
24
+ const _Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
21
25
  {
22
26
  size = "default",
23
27
  variant = "solid",
24
28
  icon,
25
- className,
26
- classNames,
27
29
  children,
28
- style,
29
30
  src,
31
+ overStyled = false,
30
32
  ...rest
31
33
  },
32
34
  ref,
@@ -43,6 +45,9 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
43
45
  large: "lg",
44
46
  } as const;
45
47
 
48
+ const sanitizedProps = filterStylingProps(rest, overStyled);
49
+ const restRecord = sanitizedProps as Record<string, unknown>;
50
+
46
51
  // Determine semantic style based on provided props
47
52
  let computedStyle = "text";
48
53
  if (src) {
@@ -57,12 +62,13 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
57
62
  placeholder: styles.placeholder,
58
63
  };
59
64
 
65
+ const classNamesProp = restRecord.classNames;
60
66
  if (
61
- classNames &&
62
- typeof classNames === "object" &&
63
- !Array.isArray(classNames)
67
+ classNamesProp &&
68
+ typeof classNamesProp === "object" &&
69
+ !Array.isArray(classNamesProp)
64
70
  ) {
65
- const o = classNames as Partial<Record<string, string>>;
71
+ const o = classNamesProp as Partial<Record<string, string>>;
66
72
  mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
67
73
  mergedClassNames.image = o.image
68
74
  ? `${styles.image} ${o.image}`
@@ -72,19 +78,20 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
72
78
  : styles.placeholder;
73
79
  }
74
80
 
81
+ const classNameProp = restRecord.className as string | undefined;
82
+
75
83
  return (
76
84
  <MantineAvatar
77
85
  ref={ref}
78
- className={className}
86
+ className={classNameProp}
79
87
  classNames={mergedClassNames}
80
88
  variant={mapVariant[variant]}
81
89
  size={mapSize[size]}
82
- style={style}
83
90
  src={src}
84
91
  data-variant={variant}
85
92
  data-size={size}
86
93
  data-style={computedStyle}
87
- {...rest}
94
+ {...sanitizedProps}
88
95
  >
89
96
  {icon != null ? (
90
97
  <span className={styles.iconWrapper} aria-hidden>
@@ -96,5 +103,11 @@ export const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(
96
103
  </MantineAvatar>
97
104
  );
98
105
  });
106
+ _Avatar.displayName = "Avatar";
99
107
 
100
- Avatar.displayName = "Avatar";
108
+ /**
109
+ * Recursica Avatar component wrapping Mantine's Avatar.
110
+ *
111
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
112
+ */
113
+ export const Avatar = createPolymorphicComponent<"div", AvatarProps>(_Avatar);
@@ -2,6 +2,7 @@ import { forwardRef } from "react";
2
2
  import {
3
3
  Badge as MantineBadge,
4
4
  type BadgeProps as MantineBadgeProps,
5
+ createPolymorphicComponent,
5
6
  } from "@mantine/core";
6
7
  import {
7
8
  filterStylingProps,
@@ -19,7 +20,7 @@ export type BadgeProps = RecursicaOverStyled<
19
20
  RecursicaBadgeProps
20
21
  >;
21
22
 
22
- export const Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
23
+ const _Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
23
24
  { variant = "primary-color", overStyled = false, ...rest },
24
25
  ref,
25
26
  ) {
@@ -62,5 +63,11 @@ export const Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
62
63
  />
63
64
  );
64
65
  });
66
+ _Badge.displayName = "Badge";
65
67
 
66
- Badge.displayName = "Badge";
68
+ /**
69
+ * Recursica Badge component wrapping Mantine's Badge.
70
+ *
71
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
72
+ */
73
+ export const Badge = createPolymorphicComponent<"div", BadgeProps>(_Badge);
@@ -2,6 +2,7 @@ import React, { forwardRef } from "react";
2
2
  import {
3
3
  Button as MantineButton,
4
4
  type ButtonProps as MantineButtonProps,
5
+ createPolymorphicComponent,
5
6
  } from "@mantine/core";
6
7
  import {
7
8
  filterStylingProps,
@@ -26,97 +27,108 @@ function hasVisibleChildren(children: React.ReactNode): boolean {
26
27
  return true;
27
28
  }
28
29
 
29
- export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
30
- function Button(
31
- {
32
- variant = "solid",
33
- size = "default",
34
- icon,
35
- children,
36
- overStyled = false,
37
- ...rest
38
- },
39
- ref,
40
- ) {
41
- const mapVariant = {
42
- solid: "filled",
43
- outline: "outline",
44
- text: "subtle",
45
- } as const;
30
+ const _Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
31
+ {
32
+ variant = "solid",
33
+ size = "default",
34
+ icon,
35
+ children,
36
+ overStyled = false,
37
+ ...rest
38
+ },
39
+ ref,
40
+ ) {
41
+ const mapVariant = {
42
+ solid: "filled",
43
+ outline: "outline",
44
+ text: "subtle",
45
+ } as const;
46
46
 
47
- const mapSize = {
48
- default: "md",
49
- small: "sm",
50
- } as const;
47
+ const mapSize = {
48
+ default: "md",
49
+ small: "sm",
50
+ } as const;
51
51
 
52
- const sanitizedProps = filterStylingProps(rest, overStyled);
53
- const restRecord = sanitizedProps as Record<string, unknown>;
52
+ const sanitizedProps = filterStylingProps(rest, overStyled);
53
+ const restRecord = sanitizedProps as Record<string, unknown>;
54
54
 
55
- // Explicitly delete blocked semantic expansion dimension props
56
- delete restRecord["fullWidth"];
55
+ // Explicitly delete blocked semantic expansion dimension props
56
+ delete restRecord["fullWidth"];
57
57
 
58
- const hasLeftSection = !!icon || !!restRecord["leftSection"];
59
- const hasRightSection = !!restRecord["rightSection"];
60
- const isIconOnly =
61
- (hasLeftSection || hasRightSection) && !hasVisibleChildren(children);
58
+ const hasLeftSection = !!icon || !!restRecord["leftSection"];
59
+ const hasRightSection = !!restRecord["rightSection"];
60
+ const isIconOnly =
61
+ (hasLeftSection || hasRightSection) && !hasVisibleChildren(children);
62
62
 
63
- if (
64
- typeof process !== "undefined" &&
65
- process.env.NODE_ENV !== "production" &&
66
- isIconOnly &&
67
- !restRecord["aria-label"]
68
- ) {
69
- console.warn(
70
- '[Recursica Button] Icon-only buttons must provide an accessible name. Pass aria-label (e.g. aria-label="Submit").',
71
- );
72
- }
63
+ if (
64
+ typeof process !== "undefined" &&
65
+ process.env.NODE_ENV !== "production" &&
66
+ isIconOnly &&
67
+ !restRecord["aria-label"]
68
+ ) {
69
+ console.warn(
70
+ '[Recursica Button] Icon-only buttons must provide an accessible name. Pass aria-label (e.g. aria-label="Submit").',
71
+ );
72
+ }
73
73
 
74
- const mergedClassNames: Partial<Record<string, string>> = {
75
- root: styles.root,
76
- section: styles.section,
77
- label: styles.label,
78
- };
74
+ const mergedClassNames: Partial<Record<string, string>> = {
75
+ root: styles.root,
76
+ section: styles.section,
77
+ label: styles.label,
78
+ };
79
79
 
80
- const classNamesProp = restRecord.classNames;
81
- if (
82
- classNamesProp &&
83
- typeof classNamesProp === "object" &&
84
- !Array.isArray(classNamesProp)
85
- ) {
86
- const o = classNamesProp as Partial<Record<string, string>>;
87
- mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
88
- mergedClassNames.section = o.section ?? styles.section;
89
- mergedClassNames.label = o.label ?? styles.label;
90
- }
80
+ const classNamesProp = restRecord.classNames;
81
+ if (
82
+ classNamesProp &&
83
+ typeof classNamesProp === "object" &&
84
+ !Array.isArray(classNamesProp)
85
+ ) {
86
+ const o = classNamesProp as Partial<Record<string, string>>;
87
+ mergedClassNames.root = o.root ? `${styles.root} ${o.root}` : styles.root;
88
+ mergedClassNames.section = o.section ?? styles.section;
89
+ mergedClassNames.label = o.label ?? styles.label;
90
+ }
91
91
 
92
- const classNameProp = restRecord.className as string | undefined;
93
- const finalClass = classNameProp
94
- ? `${styles.root} ${classNameProp}`
95
- : styles.root;
92
+ const classNameProp = restRecord.className as string | undefined;
93
+ const finalClass = classNameProp
94
+ ? `${styles.root} ${classNameProp}`
95
+ : styles.root;
96
96
 
97
- return (
98
- <MantineButton
99
- ref={ref}
100
- className={finalClass}
101
- classNames={mergedClassNames}
102
- variant={mapVariant[variant]}
103
- size={mapSize[size]}
104
- leftSection={
105
- icon != null ? (
106
- <span className={styles.iconWrapper} aria-hidden>
107
- {icon}
108
- </span>
109
- ) : undefined
110
- }
111
- data-variant={variant}
112
- data-size={size}
113
- {...(isIconOnly ? { "data-icon-only": "" } : {})}
114
- {...sanitizedProps}
115
- >
116
- <span className={styles.labelText}>{children}</span>
117
- </MantineButton>
118
- );
119
- },
120
- );
97
+ return (
98
+ <MantineButton
99
+ ref={ref}
100
+ className={finalClass}
101
+ classNames={mergedClassNames}
102
+ variant={mapVariant[variant]}
103
+ size={mapSize[size]}
104
+ leftSection={
105
+ icon != null ? (
106
+ <span className={styles.iconWrapper} aria-hidden>
107
+ {icon}
108
+ </span>
109
+ ) : undefined
110
+ }
111
+ data-variant={variant}
112
+ data-size={size}
113
+ {...(isIconOnly ? { "data-icon-only": "" } : {})}
114
+ {...sanitizedProps}
115
+ >
116
+ <span className={styles.labelText}>{children}</span>
117
+ </MantineButton>
118
+ );
119
+ });
120
+ _Button.displayName = "Button";
121
121
 
122
- Button.displayName = "Button";
122
+ /**
123
+ * Recursica Button component wrapping Mantine's Button.
124
+ *
125
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
126
+ * @example
127
+ * ```tsx
128
+ * <Button component="a" href="/dashboard">Navigate</Button>
129
+ * <Button renderRoot={(props) => <Link to="/home" {...props} />}>Home</Button>
130
+ * ```
131
+ */
132
+ export const Button = createPolymorphicComponent<"button", ButtonProps>(
133
+ _Button,
134
+ );
@@ -3,6 +3,7 @@ import {
3
3
  Card as MantineCard,
4
4
  type CardProps as MantineCardProps,
5
5
  type CardSectionProps as MantineCardSectionProps,
6
+ createPolymorphicComponent,
6
7
  } from "@mantine/core";
7
8
  import {
8
9
  filterStylingProps,
@@ -162,15 +163,34 @@ export const CardContent = forwardRef<HTMLDivElement, CardContentProps>(
162
163
  CardContent.displayName = "CardContent";
163
164
 
164
165
  // ==== DOT NOTATION EXPORT ====
165
- type CardComponent = typeof CardBase & {
166
+
167
+ /**
168
+ * Recursica Card component wrapping Mantine's Card (Paper).
169
+ *
170
+ * Supports polymorphism via the `component` prop or `renderRoot` for custom element rendering.
171
+ * Use dot-notation sub-components for structured card layouts.
172
+ */
173
+ const PolymorphicCard = createPolymorphicComponent<
174
+ "div",
175
+ CardProps,
176
+ {
177
+ Section: typeof CardSection;
178
+ Header: typeof CardHeader;
179
+ Footer: typeof CardFooter;
180
+ Content: typeof CardContent;
181
+ }
182
+ >(CardBase);
183
+
184
+ // Attach static components for dot-notation access
185
+ const _card = PolymorphicCard as Record<string, unknown>;
186
+ _card.Section = CardSection;
187
+ _card.Header = CardHeader;
188
+ _card.Footer = CardFooter;
189
+ _card.Content = CardContent;
190
+
191
+ export const Card = PolymorphicCard as typeof PolymorphicCard & {
166
192
  Section: typeof CardSection;
167
193
  Header: typeof CardHeader;
168
194
  Footer: typeof CardFooter;
169
195
  Content: typeof CardContent;
170
196
  };
171
-
172
- export const Card = CardBase as CardComponent;
173
- Card.Section = CardSection;
174
- Card.Header = CardHeader;
175
- Card.Footer = CardFooter;
176
- Card.Content = CardContent;