@recursica/mui-adapter 0.6.0 → 0.7.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/ARCHITECTURE.md +15 -0
- package/CHANGELOG.md +6 -0
- package/SETUP.md +77 -0
- package/USAGE.md +55 -0
- package/dist/mui-adapter.cjs +26 -26
- package/dist/mui-adapter.cjs.map +1 -1
- package/dist/mui-adapter.css +1 -1
- package/dist/mui-adapter.js +3721 -3511
- package/dist/mui-adapter.js.map +1 -1
- package/dist/src/components/Accordion/Accordion.d.ts +9 -29
- package/dist/src/components/AssistiveElement/AssistiveElement.d.ts +2 -5
- package/dist/src/components/Autocomplete/Autocomplete.d.ts +4 -8
- package/dist/src/components/Avatar/Avatar.d.ts +1 -6
- package/dist/src/components/Badge/Badge.d.ts +1 -4
- package/dist/src/components/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/dist/src/components/Button/Button.d.ts +2 -17
- package/dist/src/components/Card/Card.d.ts +2 -4
- package/dist/src/components/Checkbox/Checkbox.d.ts +4 -6
- package/dist/src/components/Checkbox/CheckboxGroup.d.ts +8 -6
- package/dist/src/components/Chip/Chip.d.ts +2 -11
- package/dist/src/components/Container/Container.d.ts +1 -5
- package/dist/src/components/DatePicker/DatePicker.d.ts +2 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +4 -14
- package/dist/src/components/Flex/Flex.d.ts +2 -22
- package/dist/src/components/FormControlLayout/FormControlLayout.d.ts +2 -7
- package/dist/src/components/FormControlWrapper/FormControlWrapper.d.ts +3 -18
- package/dist/src/components/Group/Group.d.ts +2 -7
- package/dist/src/components/HoverCard/HoverCard.d.ts +13 -39
- package/dist/src/components/Label/Label.d.ts +2 -9
- package/dist/src/components/Link/Link.d.ts +2 -6
- package/dist/src/components/Loader/Loader.d.ts +2 -7
- package/dist/src/components/Menu/Menu.d.ts +24 -98
- package/dist/src/components/Modal/Modal.d.ts +32 -31
- package/dist/src/components/NumberInput/NumberInput.d.ts +3 -5
- package/dist/src/components/Pagination/Pagination.d.ts +8 -41
- package/dist/src/components/Panel/Panel.d.ts +5 -18
- package/dist/src/components/Radio/Radio.d.ts +4 -4
- package/dist/src/components/Radio/RadioGroup.d.ts +3 -7
- package/dist/src/components/ReadOnlyField/ReadOnlyField.d.ts +2 -5
- package/dist/src/components/SegmentedControl/SegmentedControl.d.ts +5 -15
- package/dist/src/components/Slider/Slider.d.ts +4 -14
- package/dist/src/components/Stack/Stack.d.ts +2 -5
- package/dist/src/components/Stepper/Stepper.d.ts +36 -16
- package/dist/src/components/Switch/Switch.d.ts +4 -4
- package/dist/src/components/Switch/SwitchGroup.d.ts +4 -4
- package/dist/src/components/Table/Table.d.ts +2 -1
- package/dist/src/components/Tabs/Tabs.d.ts +11 -26
- package/dist/src/components/Text/Text.d.ts +2 -16
- package/dist/src/components/TextArea/TextArea.d.ts +3 -9
- package/dist/src/components/TextField/TextField.d.ts +3 -7
- package/dist/src/components/TimePicker/TimePicker.d.ts +2 -1
- package/dist/src/components/Timeline/Timeline.d.ts +2 -1
- package/dist/src/components/Timeline/TimelineItem.d.ts +2 -13
- package/dist/src/components/Title/Title.d.ts +2 -15
- package/dist/src/components/Toast/Toast.d.ts +11 -16
- package/dist/src/components/Tooltip/Tooltip.d.ts +7 -21
- package/dist/src/components/TransferList/TransferList.d.ts +2 -1
- package/dist/src/components/Typography/Typography.d.ts +1 -1
- package/dist/src/utils/RequireAccessibleLabel.d.ts +1 -18
- package/dist/src/utils/filterStylingProps.d.ts +1 -11
- package/llms.txt +16 -0
- package/package.json +6 -2
- package/src/components/Accordion/Accordion.module.css +1 -2
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.tsx +19 -23
- package/src/components/AssistiveElement/AssistiveElement.module.css +32 -29
- package/src/components/AssistiveElement/AssistiveElement.stories.tsx +10 -27
- package/src/components/AssistiveElement/AssistiveElement.tsx +11 -15
- package/src/components/Autocomplete/Autocomplete.module.css +17 -18
- package/src/components/Autocomplete/Autocomplete.stories.tsx +7 -16
- package/src/components/Autocomplete/Autocomplete.tsx +27 -45
- package/src/components/Avatar/Avatar.tsx +2 -13
- package/src/components/Badge/Badge.tsx +2 -5
- package/src/components/Breadcrumb/Breadcrumb.tsx +1 -4
- package/src/components/Button/Button.module.css +19 -61
- package/src/components/Button/Button.stories.tsx +24 -23
- package/src/components/Button/Button.tsx +7 -18
- package/src/components/Card/Card.module.css +36 -0
- package/src/components/Card/Card.tsx +6 -4
- package/src/components/Checkbox/Checkbox.module.css +27 -10
- package/src/components/Checkbox/Checkbox.tsx +124 -24
- package/src/components/Checkbox/CheckboxGroup.stories.tsx +139 -0
- package/src/components/Checkbox/CheckboxGroup.tsx +43 -23
- package/src/components/Chip/Chip.module.css +52 -34
- package/src/components/Chip/Chip.tsx +45 -47
- package/src/components/Container/Container.stories.tsx +103 -20
- package/src/components/Container/Container.tsx +1 -13
- package/src/components/DatePicker/DatePicker.stories.tsx +125 -19
- package/src/components/DatePicker/DatePicker.tsx +3 -1
- package/src/components/Dropdown/Dropdown.tsx +7 -9
- package/src/components/FileInput/FileInput.stories.tsx +2 -19
- package/src/components/FileUpload/FileUpload.stories.tsx +2 -19
- package/src/components/Flex/Flex.stories.tsx +113 -20
- package/src/components/Flex/Flex.tsx +16 -26
- package/src/components/FormControlLayout/FormControlLayout.stories.tsx +0 -8
- package/src/components/FormControlLayout/FormControlLayout.tsx +18 -7
- package/src/components/FormControlWrapper/FormControlWrapper.module.css +1 -10
- package/src/components/FormControlWrapper/FormControlWrapper.stories.tsx +12 -21
- package/src/components/FormControlWrapper/FormControlWrapper.tsx +11 -30
- package/src/components/Group/Group.stories.tsx +6 -30
- package/src/components/Group/Group.tsx +14 -9
- package/src/components/HoverCard/HoverCard.tsx +72 -75
- package/src/components/Label/Label.module.css +4 -0
- package/src/components/Label/Label.stories.tsx +18 -12
- package/src/components/Label/Label.tsx +3 -9
- package/src/components/Link/Link.module.css +4 -3
- package/src/components/Link/Link.stories.tsx +2 -8
- package/src/components/Link/Link.tsx +1 -5
- package/src/components/Loader/Loader.module.css +1 -2
- package/src/components/Loader/Loader.tsx +1 -7
- package/src/components/Menu/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Menu/Menu.stories.tsx +106 -188
- package/src/components/Menu/Menu.tsx +34 -280
- package/src/components/Modal/Modal.tsx +158 -160
- package/src/components/NumberInput/NumberInput.tsx +6 -18
- package/src/components/Pagination/IMPLEMENTATION_NOTES.md +3 -0
- package/src/components/Pagination/Pagination.module.css +12 -24
- package/src/components/Pagination/Pagination.stories.tsx +0 -8
- package/src/components/Pagination/Pagination.tsx +20 -140
- package/src/components/Panel/Panel.tsx +7 -30
- package/src/components/Radio/Radio.module.css +25 -10
- package/src/components/Radio/Radio.tsx +51 -19
- package/src/components/Radio/RadioGroup.stories.tsx +117 -0
- package/src/components/Radio/RadioGroup.tsx +26 -12
- package/src/components/ReadOnlyField/ReadOnlyField.module.css +6 -6
- package/src/components/ReadOnlyField/ReadOnlyField.stories.tsx +5 -36
- package/src/components/ReadOnlyField/ReadOnlyField.tsx +9 -13
- package/src/components/SegmentedControl/SegmentedControl.module.css +23 -47
- package/src/components/SegmentedControl/SegmentedControl.tsx +44 -14
- package/src/components/Slider/Slider.module.css +1 -4
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +26 -25
- package/src/components/Stack/Stack.stories.tsx +4 -25
- package/src/components/Stack/Stack.tsx +1 -5
- package/src/components/Stepper/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Stepper/Stepper.stories.tsx +56 -43
- package/src/components/Stepper/Stepper.tsx +89 -87
- package/src/components/Switch/Switch.module.css +21 -0
- package/src/components/Switch/Switch.tsx +63 -16
- package/src/components/Switch/SwitchGroup.stories.tsx +132 -0
- package/src/components/Switch/SwitchGroup.tsx +27 -18
- package/src/components/Table/Table.stories.tsx +1 -19
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/IMPLEMENTATION_NOTES.md +4 -0
- package/src/components/Tabs/Tabs.stories.tsx +41 -24
- package/src/components/Tabs/Tabs.tsx +49 -66
- package/src/components/Text/Text.stories.tsx +5 -17
- package/src/components/Text/Text.tsx +1 -15
- package/src/components/TextArea/TextArea.tsx +7 -17
- package/src/components/TextField/TextField.stories.tsx +1 -27
- package/src/components/TextField/TextField.tsx +4 -6
- package/src/components/TimePicker/TimePicker.stories.tsx +2 -19
- package/src/components/TimePicker/TimePicker.tsx +3 -1
- package/src/components/Timeline/Timeline.tsx +4 -1
- package/src/components/Timeline/TimelineItem.tsx +1 -12
- package/src/components/Title/Title.stories.tsx +0 -18
- package/src/components/Title/Title.tsx +1 -7
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.tsx +62 -28
- package/src/components/Tooltip/Tooltip.tsx +11 -37
- package/src/components/TransferList/TransferList.stories.tsx +1 -19
- package/src/components/TransferList/TransferList.tsx +3 -1
- package/src/utils/RequireAccessibleLabel.ts +1 -12
- package/src/utils/filterStylingProps.ts +7 -20
|
@@ -6,28 +6,11 @@ const meta: Meta<typeof TimePicker> = {
|
|
|
6
6
|
title: "UI-Kit/🚧 TimePicker",
|
|
7
7
|
component: TimePicker,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
-
|
|
10
|
-
controls: {
|
|
11
|
-
include: [
|
|
12
|
-
"layer",
|
|
13
|
-
"withLayer",
|
|
14
|
-
"children",
|
|
15
|
-
"component",
|
|
16
|
-
"variant",
|
|
17
|
-
"size",
|
|
18
|
-
"icon",
|
|
19
|
-
"disabled",
|
|
20
|
-
"href",
|
|
21
|
-
"onClick",
|
|
22
|
-
"onChange",
|
|
23
|
-
"value",
|
|
24
|
-
"checked",
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
9
|
+
argTypes: {},
|
|
28
10
|
};
|
|
29
11
|
|
|
30
12
|
export default meta;
|
|
13
|
+
|
|
31
14
|
type Story = StoryObj<typeof TimePicker>;
|
|
32
15
|
|
|
33
16
|
export const Default: Story = {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./TimePicker.module.css";
|
|
3
|
+
import { type RecursicaTimePickerProps } from "@recursica/adapter-common";
|
|
3
4
|
|
|
4
|
-
export type TimePickerProps = React.HTMLAttributes<HTMLDivElement
|
|
5
|
+
export type TimePickerProps = React.HTMLAttributes<HTMLDivElement> &
|
|
6
|
+
RecursicaTimePickerProps;
|
|
5
7
|
|
|
6
8
|
export const TimePicker: React.FC<TimePickerProps> = (props) => {
|
|
7
9
|
return <div {...props}>TimePicker</div>;
|
|
@@ -9,13 +9,16 @@ import {
|
|
|
9
9
|
import styles from "./Timeline.module.css";
|
|
10
10
|
import { TimelineItem } from "./TimelineItem";
|
|
11
11
|
|
|
12
|
+
import { type RecursicaTimelineProps } from "@recursica/adapter-common";
|
|
13
|
+
|
|
12
14
|
/**
|
|
13
15
|
* Properties for the strictly-tokenized Timeline component.
|
|
14
16
|
* Native Mui abstract properties like `color`, `radius`, `bulletSize`, and `lineWidth`
|
|
15
17
|
* have been stripped out to strictly enforce the structural mappings of the Recursica UI Kit.
|
|
16
18
|
*/
|
|
17
19
|
export type TimelineProps = RecursicaOverStyled<
|
|
18
|
-
Omit<MuiTimelineProps, "color" | "radius" | "bulletSize" | "lineWidth">
|
|
20
|
+
Omit<MuiTimelineProps, "color" | "radius" | "bulletSize" | "lineWidth"> &
|
|
21
|
+
RecursicaTimelineProps
|
|
19
22
|
>;
|
|
20
23
|
|
|
21
24
|
interface TimelineComponent
|
|
@@ -8,18 +8,7 @@ import {
|
|
|
8
8
|
} from "../../utils/filterStylingProps";
|
|
9
9
|
import styles from "./Timeline.module.css";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Timestamp text displayed below the description.
|
|
14
|
-
*/
|
|
15
|
-
timestamp?: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* The structural styling variant of the bullet container.
|
|
18
|
-
* Maps to the UI Kit structural tokens.
|
|
19
|
-
* @default "default"
|
|
20
|
-
*/
|
|
21
|
-
bulletVariant?: "default" | "avatar" | "icon" | "icon-alternative";
|
|
22
|
-
}
|
|
11
|
+
import { type RecursicaTimelineItemProps } from "@recursica/adapter-common";
|
|
23
12
|
|
|
24
13
|
export type TimelineItemProps = RecursicaOverStyled<
|
|
25
14
|
Omit<MuiTimelineItemProps, "radius" | "color" | "lineVariant"> &
|
|
@@ -13,24 +13,6 @@ const meta: Meta<typeof Title> = {
|
|
|
13
13
|
"The semantic `<Title>` abstraction intrinsically links pure `h1-h6` tag generation with exact Recursica design boundaries to preserve SEO and screen reader trees uniformly globally.",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
|
-
controls: {
|
|
17
|
-
include: [
|
|
18
|
-
"layer",
|
|
19
|
-
"withLayer",
|
|
20
|
-
"order",
|
|
21
|
-
"children",
|
|
22
|
-
"component",
|
|
23
|
-
"variant",
|
|
24
|
-
"size",
|
|
25
|
-
"icon",
|
|
26
|
-
"disabled",
|
|
27
|
-
"href",
|
|
28
|
-
"onClick",
|
|
29
|
-
"onChange",
|
|
30
|
-
"value",
|
|
31
|
-
"checked",
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
16
|
},
|
|
35
17
|
argTypes: {
|
|
36
18
|
order: {
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from "react";
|
|
2
2
|
import { Typography } from "../Typography/Typography";
|
|
3
3
|
import { type RecursicaOverStyled } from "../../utils/filterStylingProps";
|
|
4
|
-
import { type
|
|
5
|
-
|
|
6
|
-
export type RecursicaTitleProps = Omit<MuiTypographyProps, "variant"> & {
|
|
7
|
-
order?: 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
|
-
children?: React.ReactNode;
|
|
9
|
-
component?: React.ElementType;
|
|
10
|
-
};
|
|
4
|
+
import { type RecursicaTitleProps } from "@recursica/adapter-common";
|
|
11
5
|
|
|
12
6
|
export type TitleProps = RecursicaOverStyled<RecursicaTitleProps>;
|
|
13
7
|
|
|
@@ -12,7 +12,7 @@ const meta = {
|
|
|
12
12
|
docs: {
|
|
13
13
|
description: {
|
|
14
14
|
component:
|
|
15
|
-
"The `Toast` component is a standalone visual component wrapping
|
|
15
|
+
"The `Toast` component is a standalone visual component wrapping Mui's `Alert`. Note that this component is visually decoupled from `@mui/material/Snackbar` and is meant to be used when you need to render a static or manually-controlled notification panel.",
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Alert as MuiAlert,
|
|
4
|
+
AlertTitle as MuiAlertTitle,
|
|
5
|
+
IconButton as MuiIconButton,
|
|
6
|
+
type AlertProps as MuiAlertProps,
|
|
5
7
|
} from "@mui/material";
|
|
6
8
|
import {
|
|
7
9
|
filterStylingProps,
|
|
@@ -9,51 +11,63 @@ import {
|
|
|
9
11
|
} from "../../utils/filterStylingProps";
|
|
10
12
|
import styles from "./Toast.module.css";
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The visual variant of the toast.
|
|
15
|
-
* @default "default"
|
|
16
|
-
*/
|
|
17
|
-
variant?: "default" | "error" | "success";
|
|
14
|
+
import { type RecursicaToastProps as BaseRecursicaToastProps } from "@recursica/adapter-common";
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
export interface RecursicaToastProps extends BaseRecursicaToastProps {
|
|
17
|
+
withCloseButton?: boolean;
|
|
18
|
+
title?: React.ReactNode;
|
|
19
|
+
icon?: React.ReactNode;
|
|
20
|
+
onClose?: () => void;
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
/**
|
|
27
|
-
* Toast component wrapping Mui's
|
|
24
|
+
* Toast component wrapping Mui's Alert.
|
|
28
25
|
*
|
|
29
26
|
* Can be used as a standalone visual component to display a notification or message.
|
|
30
27
|
*/
|
|
31
28
|
export type ToastProps = RecursicaOverStyled<
|
|
32
|
-
Omit<
|
|
29
|
+
Omit<MuiAlertProps, "color" | "radius" | "variant" | "onClose"> &
|
|
33
30
|
RecursicaToastProps
|
|
34
31
|
>;
|
|
35
32
|
|
|
33
|
+
const CloseIcon = () => (
|
|
34
|
+
<svg
|
|
35
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
36
|
+
width="20"
|
|
37
|
+
height="20"
|
|
38
|
+
viewBox="0 0 24 24"
|
|
39
|
+
fill="none"
|
|
40
|
+
stroke="currentColor"
|
|
41
|
+
strokeWidth="2"
|
|
42
|
+
strokeLinecap="round"
|
|
43
|
+
strokeLinejoin="round"
|
|
44
|
+
>
|
|
45
|
+
<path d="M18 6L6 18M6 6l12 12" />
|
|
46
|
+
</svg>
|
|
47
|
+
);
|
|
48
|
+
|
|
36
49
|
export const Toast = React.forwardRef<HTMLDivElement, ToastProps>(
|
|
37
50
|
function Toast(
|
|
38
51
|
{
|
|
39
52
|
overStyled = false,
|
|
40
53
|
variant = "default",
|
|
41
54
|
withCloseButton = true,
|
|
55
|
+
title,
|
|
56
|
+
icon,
|
|
57
|
+
children,
|
|
58
|
+
onClose,
|
|
59
|
+
className,
|
|
42
60
|
...rest
|
|
43
61
|
},
|
|
44
62
|
ref,
|
|
45
63
|
) {
|
|
46
64
|
const sanitizedProps = filterStylingProps(rest, overStyled);
|
|
47
65
|
|
|
48
|
-
// Bind CSS module classes to Mui's internal classNames API
|
|
49
66
|
const mergedClassNames: Partial<Record<string, string>> = {
|
|
50
67
|
root: styles.root,
|
|
51
|
-
|
|
52
|
-
title: styles.title,
|
|
53
|
-
description: styles.description,
|
|
54
|
-
closeButton: styles.closeButton,
|
|
68
|
+
message: styles.body,
|
|
55
69
|
icon: styles.icon,
|
|
56
|
-
|
|
70
|
+
action: styles.closeButton,
|
|
57
71
|
};
|
|
58
72
|
|
|
59
73
|
const classNamesProp = (sanitizedProps as Record<string, unknown>)
|
|
@@ -73,19 +87,39 @@ export const Toast = React.forwardRef<HTMLDivElement, ToastProps>(
|
|
|
73
87
|
});
|
|
74
88
|
}
|
|
75
89
|
|
|
90
|
+
const handleClose = () => {
|
|
91
|
+
if (onClose) onClose();
|
|
92
|
+
};
|
|
93
|
+
|
|
76
94
|
return (
|
|
77
|
-
<
|
|
95
|
+
<MuiAlert
|
|
78
96
|
ref={ref}
|
|
79
|
-
|
|
80
|
-
withBorder={false} // Border is handled via CSS or tokens if needed
|
|
97
|
+
icon={icon}
|
|
81
98
|
data-variant={variant}
|
|
99
|
+
className={`${className || ""}`}
|
|
82
100
|
classes={mergedClassNames}
|
|
83
|
-
|
|
101
|
+
action={
|
|
102
|
+
withCloseButton ? (
|
|
103
|
+
<MuiIconButton
|
|
104
|
+
size="small"
|
|
105
|
+
aria-label="close"
|
|
106
|
+
color="inherit"
|
|
107
|
+
onClick={handleClose}
|
|
108
|
+
>
|
|
109
|
+
<CloseIcon />
|
|
110
|
+
</MuiIconButton>
|
|
111
|
+
) : undefined
|
|
112
|
+
}
|
|
84
113
|
{...(sanitizedProps as unknown as Omit<
|
|
85
|
-
|
|
86
|
-
"color" | "radius" | "variant" | "
|
|
114
|
+
MuiAlertProps,
|
|
115
|
+
"color" | "radius" | "variant" | "onClose"
|
|
87
116
|
>)}
|
|
88
|
-
|
|
117
|
+
>
|
|
118
|
+
{title && (
|
|
119
|
+
<MuiAlertTitle className={styles.title}>{title}</MuiAlertTitle>
|
|
120
|
+
)}
|
|
121
|
+
<div className={styles.description}>{children}</div>
|
|
122
|
+
</MuiAlert>
|
|
89
123
|
);
|
|
90
124
|
},
|
|
91
125
|
);
|
|
@@ -15,15 +15,7 @@ import styles from "./Tooltip.module.css";
|
|
|
15
15
|
/**
|
|
16
16
|
* Recursica-specific props for Tooltip.
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Whether to display a beak (arrow) pointing from the tooltip to the target.
|
|
21
|
-
* This is the Recursica equivalent of Mui's `withArrow`.
|
|
22
|
-
* When both `withBeak` and `withArrow` are provided, `withBeak` takes precedence.
|
|
23
|
-
* @default true
|
|
24
|
-
*/
|
|
25
|
-
withBeak?: boolean;
|
|
26
|
-
}
|
|
18
|
+
import { type RecursicaTooltipProps } from "@recursica/adapter-common";
|
|
27
19
|
|
|
28
20
|
/**
|
|
29
21
|
* Recursica Tooltip component wrapping Mui's Tooltip.
|
|
@@ -49,9 +41,12 @@ export type TooltipProps = RecursicaOverStyled<
|
|
|
49
41
|
const TooltipBase = function Tooltip({
|
|
50
42
|
overStyled = false,
|
|
51
43
|
withBeak = true,
|
|
44
|
+
label,
|
|
45
|
+
opened,
|
|
52
46
|
...rest
|
|
53
|
-
}: TooltipProps) {
|
|
54
|
-
const
|
|
47
|
+
}: TooltipProps & { label?: React.ReactNode; opened?: boolean }) {
|
|
48
|
+
const { title, ...restProps } = rest;
|
|
49
|
+
const sanitizedProps = filterStylingProps(restProps, overStyled);
|
|
55
50
|
|
|
56
51
|
// Bind CSS module classes to Mui's internal classNames API
|
|
57
52
|
const mergedClassNames: Partial<Record<string, string>> = {
|
|
@@ -75,16 +70,6 @@ const TooltipBase = function Tooltip({
|
|
|
75
70
|
});
|
|
76
71
|
}
|
|
77
72
|
|
|
78
|
-
// arrowSize must be a JS number prop — Mui uses it for inline width/height
|
|
79
|
-
// and positioning offset (-arrowSize/2) calculations that cannot be CSS-driven.
|
|
80
|
-
// Default to 16 to match the Recursica beak-size token (16px).
|
|
81
|
-
const arrowSize =
|
|
82
|
-
((sanitizedProps as Record<string, unknown>).arrowSize as
|
|
83
|
-
| number
|
|
84
|
-
| undefined) ?? 16;
|
|
85
|
-
|
|
86
|
-
// Resolve withBeak (Recursica) vs withArrow (Mui).
|
|
87
|
-
// withBeak takes precedence when both are provided.
|
|
88
73
|
const withArrow = (sanitizedProps as Record<string, unknown>).withArrow as
|
|
89
74
|
| boolean
|
|
90
75
|
| undefined;
|
|
@@ -92,26 +77,15 @@ const TooltipBase = function Tooltip({
|
|
|
92
77
|
|
|
93
78
|
return (
|
|
94
79
|
<MuiTooltip
|
|
80
|
+
title={label || title || ""}
|
|
81
|
+
open={opened}
|
|
95
82
|
placement="top" /* Recursica default; Mui defaults to "bottom" */
|
|
96
|
-
|
|
97
|
-
arrowSize={arrowSize}
|
|
98
|
-
withArrow={resolvedWithArrow}
|
|
83
|
+
arrow={resolvedWithArrow}
|
|
99
84
|
classes={mergedClassNames}
|
|
100
|
-
{...(sanitizedProps as unknown as MuiTooltipProps)}
|
|
85
|
+
{...(sanitizedProps as unknown as Omit<MuiTooltipProps, "title">)}
|
|
101
86
|
/>
|
|
102
87
|
);
|
|
103
88
|
};
|
|
104
89
|
TooltipBase.displayName = "Tooltip";
|
|
105
90
|
|
|
106
|
-
|
|
107
|
-
// DOT NOTATION EXPORT
|
|
108
|
-
// ============================================================
|
|
109
|
-
|
|
110
|
-
type TooltipComponent = typeof TooltipBase & {
|
|
111
|
-
Floating: typeof MuiTooltip.Floating;
|
|
112
|
-
Group: typeof MuiTooltip.Group;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
export const Tooltip = TooltipBase as TooltipComponent;
|
|
116
|
-
Tooltip.Floating = MuiTooltip.Floating;
|
|
117
|
-
Tooltip.Group = MuiTooltip.Group;
|
|
91
|
+
export const Tooltip = TooltipBase;
|
|
@@ -6,28 +6,10 @@ const meta: Meta<typeof TransferList> = {
|
|
|
6
6
|
title: "UI-Kit/🚧 TransferList",
|
|
7
7
|
component: TransferList,
|
|
8
8
|
tags: ["autodocs"],
|
|
9
|
-
parameters: {
|
|
10
|
-
controls: {
|
|
11
|
-
include: [
|
|
12
|
-
"layer",
|
|
13
|
-
"withLayer",
|
|
14
|
-
"children",
|
|
15
|
-
"component",
|
|
16
|
-
"variant",
|
|
17
|
-
"size",
|
|
18
|
-
"icon",
|
|
19
|
-
"disabled",
|
|
20
|
-
"href",
|
|
21
|
-
"onClick",
|
|
22
|
-
"onChange",
|
|
23
|
-
"value",
|
|
24
|
-
"checked",
|
|
25
|
-
],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
9
|
};
|
|
29
10
|
|
|
30
11
|
export default meta;
|
|
12
|
+
|
|
31
13
|
type Story = StoryObj<typeof TransferList>;
|
|
32
14
|
|
|
33
15
|
export const Default: Story = {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import "./TransferList.module.css";
|
|
3
|
+
import { type RecursicaTransferListProps } from "@recursica/adapter-common";
|
|
3
4
|
|
|
4
|
-
export type TransferListProps = React.HTMLAttributes<HTMLDivElement
|
|
5
|
+
export type TransferListProps = React.HTMLAttributes<HTMLDivElement> &
|
|
6
|
+
RecursicaTransferListProps;
|
|
5
7
|
|
|
6
8
|
export const TransferList: React.FC<TransferListProps> = (props) => {
|
|
7
9
|
return <div {...props}>TransferList</div>;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Enforces accessibility by strictly requiring at least one form of labeling:
|
|
5
|
-
* either a visual \`label\`, an \`aria-label\`, or an \`aria-labelledby\`.
|
|
6
|
-
*/
|
|
7
|
-
export type RequireAccessibleLabel<T> = T &
|
|
8
|
-
(
|
|
9
|
-
| { label: ReactNode; "aria-label"?: string; "aria-labelledby"?: string }
|
|
10
|
-
| { label?: ReactNode; "aria-label": string; "aria-labelledby"?: string }
|
|
11
|
-
| { label?: ReactNode; "aria-label"?: string; "aria-labelledby": string }
|
|
12
|
-
);
|
|
1
|
+
export { type RequireAccessibleLabel } from "@recursica/adapter-common";
|
|
@@ -51,19 +51,13 @@ export const BLOCKED_STYLING_KEYS = [
|
|
|
51
51
|
"position",
|
|
52
52
|
"zIndex",
|
|
53
53
|
] as const;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
| "rec-md"
|
|
62
|
-
| "rec-lg"
|
|
63
|
-
| "rec-xl"
|
|
64
|
-
| "rec-2xl";
|
|
65
|
-
|
|
66
|
-
export type RecursicaSize = "small" | "default" | "large";
|
|
54
|
+
export {
|
|
55
|
+
type RecursicaSpacing,
|
|
56
|
+
type RecursicaSize,
|
|
57
|
+
type RecursicaOverStyled,
|
|
58
|
+
type BlockedStylingKeys,
|
|
59
|
+
type ForbiddenStyles,
|
|
60
|
+
} from "@recursica/adapter-common";
|
|
67
61
|
|
|
68
62
|
const LAYOUT_PROPS = new Set([
|
|
69
63
|
"m",
|
|
@@ -99,8 +93,6 @@ export const SPACING_MAP: Record<string, string> = {
|
|
|
99
93
|
"rec-2xl": "var(--recursica_brand_dimensions_general_2xl)",
|
|
100
94
|
};
|
|
101
95
|
|
|
102
|
-
export type ForbiddenStyles = { [K in BlockedStylingKeys]?: never };
|
|
103
|
-
|
|
104
96
|
export type OmitSx<T> = Omit<T, "sx">;
|
|
105
97
|
|
|
106
98
|
export function filterSxProp<T extends Record<string, unknown>>(
|
|
@@ -113,11 +105,6 @@ export function filterSxProp<T extends Record<string, unknown>>(
|
|
|
113
105
|
return sanitized as Omit<T, "sx">;
|
|
114
106
|
}
|
|
115
107
|
|
|
116
|
-
export type RecursicaOverStyled<T> =
|
|
117
|
-
| (Omit<T, BlockedStylingKeys> &
|
|
118
|
-
ForbiddenStyles & { overStyled?: false | undefined })
|
|
119
|
-
| (T & { overStyled: true });
|
|
120
|
-
|
|
121
108
|
export function filterStylingProps<T extends Record<string, unknown>>(
|
|
122
109
|
props: T,
|
|
123
110
|
overStyled?: boolean,
|