@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.
Files changed (21) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +7 -0
  3. package/lib/components/DataDictionary/components/Tooltip/components/Title/constants.d.ts +3 -0
  4. package/lib/components/DataDictionary/components/Tooltip/components/Title/constants.js +8 -0
  5. package/lib/components/DataDictionary/components/Tooltip/components/Title/title.d.ts +3 -0
  6. package/lib/components/DataDictionary/components/Tooltip/components/Title/title.js +9 -0
  7. package/lib/components/DataDictionary/components/Tooltip/components/Title/types.d.ts +5 -0
  8. package/lib/components/DataDictionary/components/Tooltip/components/Title/types.js +1 -0
  9. package/lib/components/DataDictionary/components/Tooltip/constants.d.ts +2 -0
  10. package/lib/components/DataDictionary/components/Tooltip/constants.js +24 -0
  11. package/lib/components/DataDictionary/components/Tooltip/tooltip.d.ts +4 -0
  12. package/lib/components/DataDictionary/components/Tooltip/tooltip.js +8 -0
  13. package/lib/components/DataDictionary/components/Tooltip/types.d.ts +5 -0
  14. package/lib/components/DataDictionary/components/Tooltip/types.js +1 -0
  15. package/package.json +1 -1
  16. package/src/components/DataDictionary/components/Tooltip/components/Title/constants.ts +11 -0
  17. package/src/components/DataDictionary/components/Tooltip/components/Title/title.tsx +19 -0
  18. package/src/components/DataDictionary/components/Tooltip/components/Title/types.ts +6 -0
  19. package/src/components/DataDictionary/components/Tooltip/constants.ts +26 -0
  20. package/src/components/DataDictionary/components/Tooltip/tooltip.tsx +26 -0
  21. package/src/components/DataDictionary/components/Tooltip/types.ts +10 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "21.1.1"
2
+ ".": "21.2.0"
3
3
  }
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,3 @@
1
+ import { StackProps, TypographyProps } from "@mui/material";
2
+ export declare const STACK_PROPS: StackProps;
3
+ export declare const TYPOGRAPHY_PROPS: TypographyProps;
@@ -0,0 +1,8 @@
1
+ export const STACK_PROPS = {
2
+ spacing: 2,
3
+ useFlexGap: true,
4
+ };
5
+ export const TYPOGRAPHY_PROPS = {
6
+ color: "ink.light",
7
+ component: "div",
8
+ };
@@ -0,0 +1,3 @@
1
+ import { BaseComponentProps } from "../../../../../types";
2
+ import { TitleProps } from "./types";
3
+ export declare const Title: ({ className, description, title, }: BaseComponentProps & Required<TitleProps>) => JSX.Element;
@@ -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,5 @@
1
+ import { ReactNode } from "react";
2
+ export interface TitleProps {
3
+ description?: ReactNode;
4
+ title: ReactNode;
5
+ }
@@ -0,0 +1,2 @@
1
+ import { TooltipProps } from "@mui/material";
2
+ export declare const TOOLTIP_PROPS: Omit<TooltipProps, "children" | "title">;
@@ -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,5 @@
1
+ import { TooltipProps as MTooltipProps } from "@mui/material";
2
+ import { ReactNode } from "react";
3
+ export type TooltipProps = Omit<MTooltipProps, "children"> & {
4
+ children: ReactNode;
5
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "21.1.1",
3
+ "version": "21.2.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
@@ -0,0 +1,11 @@
1
+ import { StackProps, TypographyProps } from "@mui/material";
2
+
3
+ export const STACK_PROPS: StackProps = {
4
+ spacing: 2,
5
+ useFlexGap: true,
6
+ };
7
+
8
+ export const TYPOGRAPHY_PROPS: TypographyProps = {
9
+ color: "ink.light",
10
+ component: "div",
11
+ };
@@ -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,6 @@
1
+ import { ReactNode } from "react";
2
+
3
+ export interface TitleProps {
4
+ description?: ReactNode;
5
+ title: ReactNode;
6
+ }
@@ -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
+ };