@recursica/mantine-adapter 0.11.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.
- package/CHANGELOG.md +16 -0
- package/README.md +6 -28
- package/dist/mantine-adapter.cjs +1 -1
- package/dist/mantine-adapter.cjs.map +1 -1
- package/dist/mantine-adapter.css +1 -1
- package/dist/mantine-adapter.js +1175 -1033
- package/dist/mantine-adapter.js.map +1 -1
- package/dist/src/components/Avatar/Avatar.d.ts +16 -2
- package/dist/src/components/Badge/Badge.d.ts +14 -1
- package/dist/src/components/Button/Button.d.ts +19 -1
- package/dist/src/components/Card/Card.d.ts +21 -6
- package/dist/src/components/Flex/Flex.d.ts +19 -1
- package/dist/src/components/Menu/Menu.d.ts +115 -3
- package/dist/src/components/Text/Text.d.ts +16 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.tsx +30 -17
- package/src/components/Badge/Badge.tsx +9 -2
- package/src/components/Button/Button.tsx +96 -84
- package/src/components/Card/Card.tsx +27 -7
- package/src/components/Flex/Flex.tsx +14 -2
- package/src/components/Menu/MENU_IMPLEMENTATION_NOTES.md +78 -0
- package/src/components/Menu/Menu.module.css +244 -0
- package/src/components/Menu/Menu.stories.tsx +309 -5
- package/src/components/Menu/Menu.tsx +337 -4
- package/src/components/Text/Text.tsx +16 -6
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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>;
|
|
@@ -1,3 +1,115 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { MenuProps as MantineMenuProps, MenuTargetProps as MantineMenuTargetProps, MenuDropdownProps as MantineMenuDropdownProps, MenuItemProps as MantineMenuItemProps, MenuDividerProps as MantineMenuDividerProps, MenuLabelProps as MantineMenuLabelProps, MenuSubProps as MantineMenuSubProps, MenuSubTargetProps as MantineMenuSubTargetProps, MenuSubDropdownProps as MantineMenuSubDropdownProps } from '@mantine/core';
|
|
2
|
+
import { RecursicaOverStyled } from '../../utils/filterStylingProps';
|
|
3
|
+
/**
|
|
4
|
+
* Recursica Menu component wrapping Mantine's composable Menu.
|
|
5
|
+
*
|
|
6
|
+
* Usage follows the composable dot-notation pattern:
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Menu>
|
|
9
|
+
* <Menu.Target><Button>Open</Button></Menu.Target>
|
|
10
|
+
* <Menu.Dropdown>
|
|
11
|
+
* <Menu.Label>Section</Menu.Label>
|
|
12
|
+
* <Menu.Item>Action</Menu.Item>
|
|
13
|
+
* <Menu.Divider />
|
|
14
|
+
* <Menu.Item>Another action</Menu.Item>
|
|
15
|
+
* </Menu.Dropdown>
|
|
16
|
+
* </Menu>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export type MenuProps = RecursicaOverStyled<MantineMenuProps>;
|
|
20
|
+
declare const MenuBase: {
|
|
21
|
+
({ overStyled, ...rest }: MenuProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Wrapper for the element that triggers the menu.
|
|
26
|
+
* Requires a single child element that supports ref forwarding.
|
|
27
|
+
*/
|
|
28
|
+
export type MenuTargetProps = MantineMenuTargetProps;
|
|
29
|
+
declare const MenuTarget: {
|
|
30
|
+
(props: MenuTargetProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
33
|
+
/** The dropdown panel containing menu items, dividers, and labels. */
|
|
34
|
+
export type MenuDropdownProps = RecursicaOverStyled<MantineMenuDropdownProps>;
|
|
35
|
+
declare const MenuDropdown: import('react').ForwardRefExoticComponent<MenuDropdownProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
36
|
+
/**
|
|
37
|
+
* An individual actionable item within the menu dropdown.
|
|
38
|
+
*
|
|
39
|
+
* **Note:** Mantine's `color` prop is stripped in strict mode to enforce
|
|
40
|
+
* design token adherence. Use `overStyled={true}` if you need to bypass.
|
|
41
|
+
*/
|
|
42
|
+
export type MenuItemProps = RecursicaOverStyled<Omit<MantineMenuItemProps, "color">>;
|
|
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>;
|
|
61
|
+
/** A visual separator between groups of menu items. */
|
|
62
|
+
export type MenuDividerProps = RecursicaOverStyled<MantineMenuDividerProps>;
|
|
63
|
+
declare const MenuDivider: import('react').ForwardRefExoticComponent<MenuDividerProps & import('react').RefAttributes<HTMLHRElement>>;
|
|
64
|
+
/** A non-interactive section label used to categorize groups of menu items. */
|
|
65
|
+
export type MenuLabelProps = RecursicaOverStyled<MantineMenuLabelProps>;
|
|
66
|
+
declare const MenuLabel: import('react').ForwardRefExoticComponent<MenuLabelProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
67
|
+
/** Container for a submenu, wrapping Menu.Sub.Target and Menu.Sub.Dropdown. */
|
|
68
|
+
export type MenuSubProps = MantineMenuSubProps;
|
|
69
|
+
declare const MenuSubBase: {
|
|
70
|
+
(props: MenuSubProps): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
displayName: string;
|
|
72
|
+
};
|
|
73
|
+
/** Wrapper for the element that triggers the submenu. */
|
|
74
|
+
export type MenuSubTargetProps = MantineMenuSubTargetProps;
|
|
75
|
+
declare const MenuSubTarget: {
|
|
76
|
+
(props: MenuSubTargetProps): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
displayName: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* A menu item that acts as a submenu trigger.
|
|
81
|
+
* Renders within Menu.Sub.Target and displays a chevron indicator.
|
|
82
|
+
*/
|
|
83
|
+
export type MenuSubItemProps = RecursicaOverStyled<Omit<MantineMenuItemProps, "color">>;
|
|
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>;
|
|
98
|
+
/** The dropdown panel for a submenu. */
|
|
99
|
+
export type MenuSubDropdownProps = RecursicaOverStyled<MantineMenuSubDropdownProps>;
|
|
100
|
+
declare const MenuSubDropdown: import('react').ForwardRefExoticComponent<MenuSubDropdownProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
101
|
+
type MenuSubComponent = typeof MenuSubBase & {
|
|
102
|
+
Target: typeof MenuSubTarget;
|
|
103
|
+
Item: typeof MenuSubItem;
|
|
104
|
+
Dropdown: typeof MenuSubDropdown;
|
|
105
|
+
};
|
|
106
|
+
type MenuComponent = typeof MenuBase & {
|
|
107
|
+
Target: typeof MenuTarget;
|
|
108
|
+
Dropdown: typeof MenuDropdown;
|
|
109
|
+
Item: typeof MenuItem;
|
|
110
|
+
Divider: typeof MenuDivider;
|
|
111
|
+
Label: typeof MenuLabel;
|
|
112
|
+
Sub: MenuSubComponent;
|
|
113
|
+
};
|
|
114
|
+
export declare const Menu: MenuComponent;
|
|
115
|
+
export {};
|
|
@@ -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('
|
|
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
|
@@ -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 =
|
|
15
|
-
MantineAvatarProps,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
RecursicaAvatarProps;
|
|
19
|
+
export type AvatarProps = RecursicaOverStyled<
|
|
20
|
+
Omit<MantineAvatarProps, "variant" | "size" | "color" | "radius"> &
|
|
21
|
+
RecursicaAvatarProps
|
|
22
|
+
>;
|
|
19
23
|
|
|
20
|
-
|
|
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
|
-
|
|
62
|
-
typeof
|
|
63
|
-
!Array.isArray(
|
|
67
|
+
classNamesProp &&
|
|
68
|
+
typeof classNamesProp === "object" &&
|
|
69
|
+
!Array.isArray(classNamesProp)
|
|
64
70
|
) {
|
|
65
|
-
const o =
|
|
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={
|
|
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
|
-
{...
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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);
|