@databiosphere/findable-ui 21.1.1 → 21.2.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/lib/components/DataDictionary/components/Tooltip/components/Title/constants.d.ts +3 -0
- package/lib/components/DataDictionary/components/Tooltip/components/Title/constants.js +8 -0
- package/lib/components/DataDictionary/components/Tooltip/components/Title/title.d.ts +3 -0
- package/lib/components/DataDictionary/components/Tooltip/components/Title/title.js +9 -0
- package/lib/components/DataDictionary/components/Tooltip/components/Title/types.d.ts +5 -0
- package/lib/components/DataDictionary/components/Tooltip/components/Title/types.js +1 -0
- package/lib/components/DataDictionary/components/Tooltip/constants.d.ts +2 -0
- package/lib/components/DataDictionary/components/Tooltip/constants.js +24 -0
- package/lib/components/DataDictionary/components/Tooltip/tooltip.d.ts +4 -0
- package/lib/components/DataDictionary/components/Tooltip/tooltip.js +8 -0
- package/lib/components/DataDictionary/components/Tooltip/types.d.ts +5 -0
- package/lib/components/DataDictionary/components/Tooltip/types.js +1 -0
- package/package.json +1 -1
- package/src/components/DataDictionary/components/Tooltip/components/Title/constants.ts +11 -0
- package/src/components/DataDictionary/components/Tooltip/components/Title/title.tsx +19 -0
- package/src/components/DataDictionary/components/Tooltip/components/Title/types.ts +6 -0
- package/src/components/DataDictionary/components/Tooltip/constants.ts +26 -0
- package/src/components/DataDictionary/components/Tooltip/tooltip.tsx +26 -0
- package/src/components/DataDictionary/components/Tooltip/types.ts +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [21.2.0](https://github.com/DataBiosphere/findable-ui/compare/v21.1.1...v21.2.0) (2025-02-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* create data dictionary tooltip component ([#317](https://github.com/DataBiosphere/findable-ui/issues/317)) ([#318](https://github.com/DataBiosphere/findable-ui/issues/318)) ([be4fd30](https://github.com/DataBiosphere/findable-ui/commit/be4fd30bcc2d04db230f0beefbae5ff3f7998d0b))
|
|
9
|
+
|
|
3
10
|
## [21.1.1](https://github.com/DataBiosphere/findable-ui/compare/v21.1.0...v21.1.1) (2025-01-31)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Stack, Typography } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TEXT_BODY_LARGE_500 } from "../../../../../../theme/common/typography";
|
|
4
|
+
import { STACK_PROPS, TYPOGRAPHY_PROPS } from "./constants";
|
|
5
|
+
export const Title = ({ className, description, title, }) => {
|
|
6
|
+
return (React.createElement(Stack, { ...STACK_PROPS, className: className },
|
|
7
|
+
React.createElement(Typography, { variant: TEXT_BODY_LARGE_500 }, title),
|
|
8
|
+
React.createElement(Typography, { ...TYPOGRAPHY_PROPS }, description)));
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { TEXT_BODY_SMALL_400_2_LINES } from "../../../../theme/common/typography";
|
|
2
|
+
export const TOOLTIP_PROPS = {
|
|
3
|
+
arrow: true,
|
|
4
|
+
disableInteractive: true,
|
|
5
|
+
enterNextDelay: 250,
|
|
6
|
+
slotProps: {
|
|
7
|
+
arrow: { sx: (theme) => ({ color: theme.palette.common.white }) },
|
|
8
|
+
popper: {
|
|
9
|
+
modifiers: [
|
|
10
|
+
{ name: "offset", options: { offset: [0, 2] } },
|
|
11
|
+
{ name: "preventOverflow", options: { padding: 8 } },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
tooltip: {
|
|
15
|
+
sx: (theme) => ({
|
|
16
|
+
...theme.typography[TEXT_BODY_SMALL_400_2_LINES],
|
|
17
|
+
backgroundColor: theme.palette.common.white,
|
|
18
|
+
borderRadius: 2,
|
|
19
|
+
color: theme.palette.ink.main,
|
|
20
|
+
padding: 4,
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { BaseComponentProps } from "../../../types";
|
|
2
|
+
import { TitleProps } from "./components/Title/types";
|
|
3
|
+
import { TooltipProps } from "./types";
|
|
4
|
+
export declare const Tooltip: ({ children, className, description, title, ...props }: BaseComponentProps & TitleProps & TooltipProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Tooltip as MTooltip } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Title } from "./components/Title/title";
|
|
4
|
+
import { TOOLTIP_PROPS } from "./constants";
|
|
5
|
+
export const Tooltip = ({ children, className, description, title, ...props }) => {
|
|
6
|
+
return (React.createElement(MTooltip, { ...TOOLTIP_PROPS, className: className, title: description && React.createElement(Title, { description: description, title: title }), ...props },
|
|
7
|
+
React.createElement("span", null, children)));
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Stack, Typography } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TEXT_BODY_LARGE_500 } from "../../../../../../theme/common/typography";
|
|
4
|
+
import { BaseComponentProps } from "../../../../../types";
|
|
5
|
+
import { STACK_PROPS, TYPOGRAPHY_PROPS } from "./constants";
|
|
6
|
+
import { TitleProps } from "./types";
|
|
7
|
+
|
|
8
|
+
export const Title = ({
|
|
9
|
+
className,
|
|
10
|
+
description,
|
|
11
|
+
title,
|
|
12
|
+
}: BaseComponentProps & Required<TitleProps>): JSX.Element => {
|
|
13
|
+
return (
|
|
14
|
+
<Stack {...STACK_PROPS} className={className}>
|
|
15
|
+
<Typography variant={TEXT_BODY_LARGE_500}>{title}</Typography>
|
|
16
|
+
<Typography {...TYPOGRAPHY_PROPS}>{description}</Typography>
|
|
17
|
+
</Stack>
|
|
18
|
+
);
|
|
19
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { TooltipProps } from "@mui/material";
|
|
2
|
+
import { TEXT_BODY_SMALL_400_2_LINES } from "../../../../theme/common/typography";
|
|
3
|
+
|
|
4
|
+
export const TOOLTIP_PROPS: Omit<TooltipProps, "children" | "title"> = {
|
|
5
|
+
arrow: true,
|
|
6
|
+
disableInteractive: true,
|
|
7
|
+
enterNextDelay: 250,
|
|
8
|
+
slotProps: {
|
|
9
|
+
arrow: { sx: (theme) => ({ color: theme.palette.common.white }) },
|
|
10
|
+
popper: {
|
|
11
|
+
modifiers: [
|
|
12
|
+
{ name: "offset", options: { offset: [0, 2] } },
|
|
13
|
+
{ name: "preventOverflow", options: { padding: 8 } },
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
tooltip: {
|
|
17
|
+
sx: (theme) => ({
|
|
18
|
+
...theme.typography[TEXT_BODY_SMALL_400_2_LINES],
|
|
19
|
+
backgroundColor: theme.palette.common.white,
|
|
20
|
+
borderRadius: 2,
|
|
21
|
+
color: theme.palette.ink.main,
|
|
22
|
+
padding: 4,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Tooltip as MTooltip } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { BaseComponentProps } from "../../../types";
|
|
4
|
+
import { Title } from "./components/Title/title";
|
|
5
|
+
import { TitleProps } from "./components/Title/types";
|
|
6
|
+
import { TOOLTIP_PROPS } from "./constants";
|
|
7
|
+
import { TooltipProps } from "./types";
|
|
8
|
+
|
|
9
|
+
export const Tooltip = ({
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
description,
|
|
13
|
+
title,
|
|
14
|
+
...props
|
|
15
|
+
}: BaseComponentProps & TitleProps & TooltipProps): JSX.Element => {
|
|
16
|
+
return (
|
|
17
|
+
<MTooltip
|
|
18
|
+
{...TOOLTIP_PROPS}
|
|
19
|
+
className={className}
|
|
20
|
+
title={description && <Title description={description} title={title} />}
|
|
21
|
+
{...props}
|
|
22
|
+
>
|
|
23
|
+
<span>{children}</span>
|
|
24
|
+
</MTooltip>
|
|
25
|
+
);
|
|
26
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TooltipProps as MTooltipProps } from "@mui/material";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
// `children` is defined as a `ReactNode` instead of an `Element`
|
|
5
|
+
// because the Data Dictionary `Tooltip` component wraps its child in a `span` element.
|
|
6
|
+
// This ensures that `children` can hold a ref properly (see https://mui.com/material-ui/api/tooltip/#props).
|
|
7
|
+
|
|
8
|
+
export type TooltipProps = Omit<MTooltipProps, "children"> & {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|