@indico-data/design-system 3.6.2 → 3.6.3
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/lib/components/tooltip/Tooltip.d.ts +5 -3
- package/lib/index.d.ts +5 -3
- package/lib/index.esm.js +2 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tooltip/Tooltip.stories.tsx +10 -0
- package/src/components/tooltip/Tooltip.tsx +6 -2
package/package.json
CHANGED
|
@@ -71,6 +71,16 @@ const meta: Meta = {
|
|
|
71
71
|
},
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
|
+
positionStrategy: {
|
|
75
|
+
control: 'select',
|
|
76
|
+
options: ['absolute', 'fixed'],
|
|
77
|
+
table: {
|
|
78
|
+
category: 'Props',
|
|
79
|
+
type: {
|
|
80
|
+
summary: 'absolute | fixed',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
74
84
|
children: {
|
|
75
85
|
control: false,
|
|
76
86
|
table: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import { PlacesType, Tooltip as ReactTooltip } from 'react-tooltip';
|
|
2
|
+
import { PlacesType, Tooltip as ReactTooltip, PositionStrategy } from 'react-tooltip';
|
|
3
3
|
|
|
4
4
|
export interface TooltipProps {
|
|
5
5
|
id: string;
|
|
@@ -9,14 +9,16 @@ export interface TooltipProps {
|
|
|
9
9
|
delayShow?: number;
|
|
10
10
|
/** The delay in milliseconds before the tooltip is hidden */
|
|
11
11
|
delayHide?: number;
|
|
12
|
-
children: React.ReactNode;
|
|
13
12
|
/** The placement of the tooltip */
|
|
14
13
|
place?: PlacesType;
|
|
15
14
|
/** The width of the tooltip */
|
|
16
15
|
width?: CSSProperties['width'];
|
|
17
16
|
/** The max width of the tooltip */
|
|
18
17
|
maxWidth?: CSSProperties['maxWidth'];
|
|
18
|
+
/** The position strategy of the tooltip */
|
|
19
|
+
positionStrategy?: PositionStrategy;
|
|
19
20
|
/** The content of the tooltip */
|
|
21
|
+
children: React.ReactNode;
|
|
20
22
|
[key: string]: any;
|
|
21
23
|
}
|
|
22
24
|
|
|
@@ -30,6 +32,7 @@ export const Tooltip = ({
|
|
|
30
32
|
width = 'max-content',
|
|
31
33
|
maxWidth,
|
|
32
34
|
opacity = 1,
|
|
35
|
+
positionStrategy = 'absolute',
|
|
33
36
|
...rest
|
|
34
37
|
}: TooltipProps) => {
|
|
35
38
|
return (
|
|
@@ -51,6 +54,7 @@ export const Tooltip = ({
|
|
|
51
54
|
delayShow={delayShow}
|
|
52
55
|
delayHide={delayHide}
|
|
53
56
|
opacity={opacity}
|
|
57
|
+
positionStrategy={positionStrategy}
|
|
54
58
|
{...rest}
|
|
55
59
|
>
|
|
56
60
|
{children}
|