@youversion/design-system-components 3.8.5 → 3.9.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 +11 -0
- package/dist/index.es.js +1826 -1814
- package/dist/index.umd.js +3 -3
- package/dist/src/Tooltip/Tooltip.d.ts +30 -13
- package/dist/src/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/src/Tooltip/Tooltip.stories.d.ts +3 -1
- package/dist/src/Tooltip/Tooltip.stories.d.ts.map +1 -1
- package/dist/src/Tooltip/TooltipContent.d.ts +34 -0
- package/dist/src/Tooltip/TooltipContent.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { AllHTMLAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { TooltipContentProps } from './TooltipContent';
|
|
3
|
+
export interface TooltipProps extends AllHTMLAttributes<HTMLDivElement>, TooltipContentProps {
|
|
4
|
+
/** Additional class names to apply to the tooltip container. */
|
|
5
|
+
className?: string;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
|
-
* The **Tooltip** component is used to tell the user some
|
|
8
|
+
* The **Tooltip** component is used to tell the user some information.
|
|
9
|
+
*
|
|
10
|
+
* It can render:
|
|
11
|
+
* - A simple text string via the `content` prop.
|
|
12
|
+
* - Structured content with a `title` and `content` via the `structuredContent` prop.
|
|
13
|
+
* - Fully custom markup via `children`.
|
|
14
|
+
*
|
|
15
|
+
* @param content - Simple text content to display inside the tooltip.
|
|
16
|
+
* @param structuredContent - Structured content object containing a `title` and `content`.
|
|
17
|
+
* @param children - Custom React nodes to render inside the tooltip. Overrides `content` and `structuredContent`.
|
|
18
|
+
* @param textClassName - Additional class names applied to text elements inside the tooltip.
|
|
19
|
+
* @param className - Additional class names applied to the tooltip container.
|
|
20
|
+
* @returns A styled tooltip container with the provided content.
|
|
8
21
|
*
|
|
9
|
-
* @param content - The information to render to the user.
|
|
10
|
-
* @returns Renders the text that is passed in to the `content` prop.
|
|
11
22
|
* @example
|
|
12
23
|
* ```typescriptreact
|
|
13
24
|
* import { Tooltip } from '@youversion/design-system-components';
|
|
@@ -15,17 +26,23 @@ export interface TooltipProps extends AllHTMLAttributes<HTMLDivElement> {
|
|
|
15
26
|
* function MyComponent() {
|
|
16
27
|
* return (
|
|
17
28
|
* <>
|
|
18
|
-
* <Tooltip content=
|
|
29
|
+
* <Tooltip content="This is some information you should know" />
|
|
19
30
|
* <Tooltip
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
31
|
+
* structuredContent={{
|
|
32
|
+
* title: "Title",
|
|
33
|
+
* content: "Detailed description goes here."
|
|
34
|
+
* }}
|
|
35
|
+
* />
|
|
36
|
+
* <Tooltip>
|
|
37
|
+
* <div>
|
|
38
|
+
* <strong>Custom heading</strong>
|
|
39
|
+
* <p>Custom body content</p>
|
|
40
|
+
* </div>
|
|
41
|
+
* </Tooltip>
|
|
25
42
|
* </>
|
|
26
43
|
* )
|
|
27
44
|
* }
|
|
28
45
|
* ```
|
|
29
46
|
*/
|
|
30
|
-
export declare const Tooltip: ({ content, className, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare const Tooltip: ({ content, className, children, structuredContent, textClassName, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
31
48
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvE,MAAM,WAAW,YAAa,SAAQ,iBAAiB,CAAC,cAAc,CAAC,EAAE,mBAAmB;IAC1F,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,eAAO,MAAM,OAAO,gFAAiF,YAAY,4CAehH,CAAC"}
|
|
@@ -2,5 +2,7 @@ import { Meta } from '@storybook/react';
|
|
|
2
2
|
import { Tooltip } from './Tooltip';
|
|
3
3
|
declare const _default: Meta<typeof Tooltip>;
|
|
4
4
|
export default _default;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const WithStandardContent: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Tooltip").TooltipProps>;
|
|
6
|
+
export declare const WithCustomContent: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Tooltip").TooltipProps>;
|
|
7
|
+
export declare const WithStructuredContent: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./Tooltip").TooltipProps>;
|
|
6
8
|
//# sourceMappingURL=Tooltip.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAW,MAAM,kBAAkB,CAAC;AAIjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;wBAK/B,IAAI,CAAC,OAAO,OAAO,CAAC;AAHzB,wBAG0B;AAK1B,eAAO,MAAM,mBAAmB,uHAAoB,CAAC;AAMrD,eAAO,MAAM,iBAAiB,uHAAoB,CAAC;AAiBnD,eAAO,MAAM,qBAAqB,uHAAoB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface TooltipContentProps {
|
|
3
|
+
/** Custom React children to render inside the tooltip. Overrides `content` and `structuredContent` if provided. */
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/** Simple text content to display within the tooltip. */
|
|
6
|
+
content?: string;
|
|
7
|
+
/** Structured content with a title and body text to display inside the tooltip. */
|
|
8
|
+
structuredContent?: {
|
|
9
|
+
/** Body text displayed below the title. */
|
|
10
|
+
content: string;
|
|
11
|
+
/** Title text displayed at the top of the tooltip. */
|
|
12
|
+
title: string;
|
|
13
|
+
/** Additional class names to apply to the title. */
|
|
14
|
+
titleClassName?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Additional class names to apply to text elements inside the tooltip. */
|
|
17
|
+
textClassName?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The **TooltipContent** component handles rendering of the actual content inside a tooltip.
|
|
21
|
+
*
|
|
22
|
+
* It supports three modes:
|
|
23
|
+
* - Rendering custom `children` if provided.
|
|
24
|
+
* - Rendering a structured object with `title` and `content`.
|
|
25
|
+
* - Rendering a simple text string.
|
|
26
|
+
*
|
|
27
|
+
* @param children - Custom React nodes to render inside the tooltip.
|
|
28
|
+
* @param content - Simple text string to display inside the tooltip.
|
|
29
|
+
* @param structuredContent - Structured object containing a `title` and `content`.
|
|
30
|
+
* @param textClassName - Additional class names applied to text elements.
|
|
31
|
+
* @returns The rendered tooltip content based on the provided props.
|
|
32
|
+
*/
|
|
33
|
+
export declare function TooltipContent({ children, content, structuredContent, textClassName }: TooltipContentProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=TooltipContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TooltipContent.d.ts","sourceRoot":"","sources":["../../../src/Tooltip/TooltipContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,MAAM,WAAW,mBAAmB;IAClC,mHAAmH;IACnH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,yDAAyD;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,iBAAiB,CAAC,EAAE;QAClB,2CAA2C;QAC3C,OAAO,EAAE,MAAM,CAAC;QAChB,sDAAsD;QACtD,KAAK,EAAE,MAAM,CAAC;QACd,oDAAoD;QACpD,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;GAaG;AAEH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,EAAE,mBAAmB,qTAiB1G"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youversion/design-system-components",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"main": "./dist/index.umd.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@radix-ui/react-slot": "1.1.0",
|
|
25
25
|
"@youversion/design-system-core": "5.0.0",
|
|
26
|
-
"@youversion/design-system-icons": "2.
|
|
26
|
+
"@youversion/design-system-icons": "2.3.0",
|
|
27
27
|
"@youversion/design-system-tokens": "3.0.0",
|
|
28
28
|
"clsx": "1.2.1",
|
|
29
29
|
"tailwind-merge": "1.13.2"
|