@udixio/ui-react 2.9.8 → 2.9.10
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 +26 -0
- package/dist/index.cjs +3 -3
- package/dist/index.js +2572 -2446
- package/dist/lib/components/Button.d.ts +6 -0
- package/dist/lib/components/Button.d.ts.map +1 -1
- package/dist/lib/components/Card.d.ts +4 -0
- package/dist/lib/components/Card.d.ts.map +1 -1
- package/dist/lib/components/Carousel.d.ts +4 -0
- package/dist/lib/components/Carousel.d.ts.map +1 -1
- package/dist/lib/components/CarouselItem.d.ts +4 -0
- package/dist/lib/components/CarouselItem.d.ts.map +1 -1
- package/dist/lib/components/Chip.d.ts +7 -0
- package/dist/lib/components/Chip.d.ts.map +1 -1
- package/dist/lib/components/Chips.d.ts +10 -0
- package/dist/lib/components/Chips.d.ts.map +1 -1
- package/dist/lib/components/Divider.d.ts +2 -0
- package/dist/lib/components/Divider.d.ts.map +1 -1
- package/dist/lib/components/Fab.d.ts +4 -0
- package/dist/lib/components/Fab.d.ts.map +1 -1
- package/dist/lib/components/FabMenu.d.ts +7 -0
- package/dist/lib/components/FabMenu.d.ts.map +1 -1
- package/dist/lib/components/IconButton.d.ts +7 -2
- package/dist/lib/components/IconButton.d.ts.map +1 -1
- package/dist/lib/components/NavigationRail.d.ts +6 -0
- package/dist/lib/components/NavigationRail.d.ts.map +1 -1
- package/dist/lib/components/NavigationRailItem.d.ts +7 -0
- package/dist/lib/components/NavigationRailItem.d.ts.map +1 -1
- package/dist/lib/components/ProgressIndicator.d.ts +6 -0
- package/dist/lib/components/ProgressIndicator.d.ts.map +1 -1
- package/dist/lib/components/SideSheet.d.ts +7 -0
- package/dist/lib/components/SideSheet.d.ts.map +1 -1
- package/dist/lib/components/Slider.d.ts +5 -0
- package/dist/lib/components/Slider.d.ts.map +1 -1
- package/dist/lib/components/Snackbar.d.ts +6 -0
- package/dist/lib/components/Snackbar.d.ts.map +1 -1
- package/dist/lib/components/Switch.d.ts +4 -0
- package/dist/lib/components/Switch.d.ts.map +1 -1
- package/dist/lib/components/Tab.d.ts +5 -0
- package/dist/lib/components/Tab.d.ts.map +1 -1
- package/dist/lib/components/TabGroup.d.ts +4 -0
- package/dist/lib/components/TabGroup.d.ts.map +1 -1
- package/dist/lib/components/TabGroupContext.d.ts +4 -0
- package/dist/lib/components/TabGroupContext.d.ts.map +1 -1
- package/dist/lib/components/TabPanel.d.ts +2 -0
- package/dist/lib/components/TabPanel.d.ts.map +1 -1
- package/dist/lib/components/TabPanels.d.ts +4 -0
- package/dist/lib/components/TabPanels.d.ts.map +1 -1
- package/dist/lib/components/Tabs.d.ts +4 -0
- package/dist/lib/components/Tabs.d.ts.map +1 -1
- package/dist/lib/components/TextField.d.ts +5 -0
- package/dist/lib/components/TextField.d.ts.map +1 -1
- package/dist/lib/components/Tooltip.d.ts +14 -0
- package/dist/lib/components/Tooltip.d.ts.map +1 -0
- package/dist/lib/components/index.d.ts +1 -1
- package/dist/lib/hooks/index.d.ts +5 -0
- package/dist/lib/hooks/index.d.ts.map +1 -0
- package/dist/lib/hooks/useTooltipPosition.d.ts +22 -0
- package/dist/lib/hooks/useTooltipPosition.d.ts.map +1 -0
- package/dist/lib/hooks/useTooltipTrigger.d.ts +44 -0
- package/dist/lib/hooks/useTooltipTrigger.d.ts.map +1 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/interfaces/fab.interface.d.ts +2 -1
- package/dist/lib/interfaces/fab.interface.d.ts.map +1 -1
- package/dist/lib/interfaces/tooltip.interface.d.ts +24 -2
- package/dist/lib/interfaces/tooltip.interface.d.ts.map +1 -1
- package/dist/lib/styles/fab-menu.style.d.ts +4 -4
- package/dist/lib/styles/fab.style.d.ts +4 -4
- package/dist/lib/styles/icon-button.style.d.ts +2 -2
- package/dist/lib/styles/tooltip.style.d.ts +34 -6
- package/dist/lib/styles/tooltip.style.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/components/Button.tsx +6 -0
- package/src/lib/components/Card.tsx +4 -0
- package/src/lib/components/Carousel.tsx +4 -0
- package/src/lib/components/CarouselItem.tsx +4 -0
- package/src/lib/components/Chip.tsx +7 -0
- package/src/lib/components/Chips.tsx +10 -0
- package/src/lib/components/Divider.tsx +2 -0
- package/src/lib/components/Fab.tsx +6 -2
- package/src/lib/components/FabMenu.tsx +7 -0
- package/src/lib/components/IconButton.tsx +12 -8
- package/src/lib/components/NavigationRail.tsx +6 -0
- package/src/lib/components/NavigationRailItem.tsx +7 -0
- package/src/lib/components/ProgressIndicator.tsx +6 -0
- package/src/lib/components/SideSheet.tsx +7 -0
- package/src/lib/components/Slider.tsx +5 -0
- package/src/lib/components/Snackbar.tsx +6 -0
- package/src/lib/components/Switch.tsx +4 -0
- package/src/lib/components/Tab.tsx +5 -0
- package/src/lib/components/TabGroup.tsx +4 -0
- package/src/lib/components/TabGroupContext.tsx +6 -1
- package/src/lib/components/TabPanel.tsx +2 -0
- package/src/lib/components/TabPanels.tsx +4 -0
- package/src/lib/components/Tabs.tsx +4 -0
- package/src/lib/components/TextField.tsx +5 -0
- package/src/lib/components/Tooltip.tsx +217 -0
- package/src/lib/components/index.ts +1 -1
- package/src/lib/hooks/index.ts +11 -0
- package/src/lib/hooks/useTooltipPosition.ts +95 -0
- package/src/lib/hooks/useTooltipTrigger.ts +270 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/interfaces/fab.interface.ts +2 -1
- package/src/lib/interfaces/tooltip.interface.ts +24 -2
- package/src/lib/styles/tooltip.style.ts +1 -0
- package/src/stories/communication/tool-tip.stories.tsx +19 -19
- package/dist/lib/components/ToolTip.d.ts +0 -9
- package/dist/lib/components/ToolTip.d.ts.map +0 -1
- package/src/lib/components/ToolTip.tsx +0 -256
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { Button, ReactProps,
|
|
2
|
+
import { Button, ReactProps, Tooltip, ToolTipInterface } from '../../lib';
|
|
3
3
|
|
|
4
4
|
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
|
|
5
5
|
const meta = {
|
|
6
6
|
title: 'Communication/ToolTip',
|
|
7
|
-
component:
|
|
7
|
+
component: Tooltip,
|
|
8
8
|
parameters: {
|
|
9
9
|
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
|
|
10
10
|
},
|
|
@@ -12,7 +12,7 @@ const meta = {
|
|
|
12
12
|
tags: ['autodocs'],
|
|
13
13
|
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
14
14
|
argTypes: {},
|
|
15
|
-
} satisfies Meta<typeof
|
|
15
|
+
} satisfies Meta<typeof Tooltip>;
|
|
16
16
|
|
|
17
17
|
export default meta;
|
|
18
18
|
type Story = StoryObj<typeof meta>;
|
|
@@ -27,84 +27,84 @@ const createToolTipStory = (
|
|
|
27
27
|
<div className="h-96 relative">
|
|
28
28
|
<div className="h-96 relative">
|
|
29
29
|
<div className="absolute top-0 left-0">
|
|
30
|
-
<
|
|
30
|
+
<Tooltip
|
|
31
31
|
position="bottom-right"
|
|
32
32
|
{...args}
|
|
33
33
|
text="Cliquez pour plus d'infos"
|
|
34
34
|
title="Info rapide"
|
|
35
35
|
>
|
|
36
36
|
<Button variant={'filledTonal'} label={'Bottom-right'}></Button>
|
|
37
|
-
</
|
|
37
|
+
</Tooltip>
|
|
38
38
|
</div>
|
|
39
39
|
<div className="absolute top-0 left-1/2 -translate-x-1/2">
|
|
40
|
-
<
|
|
40
|
+
<Tooltip
|
|
41
41
|
position="bottom"
|
|
42
42
|
{...args}
|
|
43
43
|
text="Cet élément représente les statistiques globales de votre projet."
|
|
44
44
|
title="Statistiques"
|
|
45
45
|
>
|
|
46
46
|
<Button variant={'filledTonal'} label={'Bottom-center'}></Button>
|
|
47
|
-
</
|
|
47
|
+
</Tooltip>
|
|
48
48
|
</div>
|
|
49
49
|
<div className="absolute top-0 right-0">
|
|
50
|
-
<
|
|
50
|
+
<Tooltip
|
|
51
51
|
position="bottom-left"
|
|
52
52
|
{...args}
|
|
53
53
|
text="Cliquez ici pour télécharger le fichier associé."
|
|
54
54
|
title="Téléchargement"
|
|
55
55
|
>
|
|
56
56
|
<Button variant={'filledTonal'} label={'Bottom-left'}></Button>
|
|
57
|
-
</
|
|
57
|
+
</Tooltip>
|
|
58
58
|
</div>
|
|
59
59
|
<div className="absolute top-1/2 left-0 -translate-y-1/2">
|
|
60
|
-
<
|
|
60
|
+
<Tooltip
|
|
61
61
|
position="right"
|
|
62
62
|
{...args}
|
|
63
63
|
text="Cette action ne peut pas être annulée une fois confirmée."
|
|
64
64
|
title="Attention"
|
|
65
65
|
>
|
|
66
66
|
<Button variant={'filledTonal'} label={'Center-right'}></Button>
|
|
67
|
-
</
|
|
67
|
+
</Tooltip>
|
|
68
68
|
</div>
|
|
69
69
|
<div className="absolute top-1/2 right-0 -translate-y-1/2">
|
|
70
|
-
<
|
|
70
|
+
<Tooltip
|
|
71
71
|
position="left"
|
|
72
72
|
{...args}
|
|
73
73
|
text="Modifiez les paramètres dans l'onglet dédié à la personnalisation."
|
|
74
74
|
title="Personnalisation"
|
|
75
75
|
>
|
|
76
76
|
<Button variant={'filledTonal'} label={'Center-left'}></Button>
|
|
77
|
-
</
|
|
77
|
+
</Tooltip>
|
|
78
78
|
</div>
|
|
79
79
|
<div className="absolute bottom-0 left-0">
|
|
80
|
-
<
|
|
80
|
+
<Tooltip
|
|
81
81
|
position="top-right"
|
|
82
82
|
{...args}
|
|
83
83
|
text="L'action demandée supprimera toutes les données correspondantes."
|
|
84
84
|
title="Suppression de données"
|
|
85
85
|
>
|
|
86
86
|
<Button variant={'filledTonal'} label={'Top-right'}></Button>
|
|
87
|
-
</
|
|
87
|
+
</Tooltip>
|
|
88
88
|
</div>
|
|
89
89
|
<div className="absolute bottom-0 left-1/2 -translate-x-1/2">
|
|
90
|
-
<
|
|
90
|
+
<Tooltip
|
|
91
91
|
position="top"
|
|
92
92
|
{...args}
|
|
93
93
|
text="Double-cliquez pour agrandir l'aperçu de l'élément sélectionné."
|
|
94
94
|
title="Aperçu"
|
|
95
95
|
>
|
|
96
96
|
<Button variant={'filledTonal'} label={'Top-center'}></Button>
|
|
97
|
-
</
|
|
97
|
+
</Tooltip>
|
|
98
98
|
</div>
|
|
99
99
|
<div className="absolute bottom-0 right-0">
|
|
100
|
-
<
|
|
100
|
+
<Tooltip
|
|
101
101
|
position="top-left"
|
|
102
102
|
{...args}
|
|
103
103
|
text="Passez la souris sur d'autres icônes pour plus de détails."
|
|
104
104
|
title="Icones et navigation"
|
|
105
105
|
>
|
|
106
106
|
<Button variant={'filledTonal'} label={'Top-left'}></Button>
|
|
107
|
-
</
|
|
107
|
+
</Tooltip>
|
|
108
108
|
</div>
|
|
109
109
|
</div>
|
|
110
110
|
</div>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { MotionProps } from '../utils';
|
|
2
|
-
import { ToolTipInterface } from '../interfaces';
|
|
3
|
-
/**
|
|
4
|
-
* Tooltips display brief labels or messages
|
|
5
|
-
* @status beta
|
|
6
|
-
* @category Communication
|
|
7
|
-
*/
|
|
8
|
-
export declare const ToolTip: ({ variant, buttons, className, children, title, text, position, targetRef, ref, trigger, transition, ...props }: MotionProps<ToolTipInterface>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
//# sourceMappingURL=ToolTip.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ToolTip.d.ts","sourceRoot":"","sources":["../../../src/lib/components/ToolTip.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAMjD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,iHAarB,WAAW,CAAC,gBAAgB,CAAC,4CA8N/B,CAAC"}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cloneElement,
|
|
3
|
-
isValidElement,
|
|
4
|
-
useEffect,
|
|
5
|
-
useRef,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
8
|
-
import { MotionProps } from '../utils';
|
|
9
|
-
import { Button } from './Button';
|
|
10
|
-
import { ToolTipInterface } from '../interfaces';
|
|
11
|
-
import { useToolTipStyle } from '../styles';
|
|
12
|
-
import { v4 } from 'uuid';
|
|
13
|
-
import { AnimatePresence, motion } from 'motion/react';
|
|
14
|
-
import { SyncedFixedWrapper } from '../effects';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Tooltips display brief labels or messages
|
|
18
|
-
* @status beta
|
|
19
|
-
* @category Communication
|
|
20
|
-
*/
|
|
21
|
-
export const ToolTip = ({
|
|
22
|
-
variant = 'plain',
|
|
23
|
-
buttons,
|
|
24
|
-
className,
|
|
25
|
-
children,
|
|
26
|
-
title,
|
|
27
|
-
text,
|
|
28
|
-
position,
|
|
29
|
-
targetRef,
|
|
30
|
-
ref,
|
|
31
|
-
trigger = ['hover', 'focus'],
|
|
32
|
-
transition,
|
|
33
|
-
...props
|
|
34
|
-
}: MotionProps<ToolTipInterface>) => {
|
|
35
|
-
transition = { duration: 0.3, delay: 0.4, ...transition };
|
|
36
|
-
|
|
37
|
-
if (!children && !targetRef) {
|
|
38
|
-
throw new Error('ToolTip must have a child or a targetRef');
|
|
39
|
-
}
|
|
40
|
-
if (!Array.isArray(trigger)) {
|
|
41
|
-
trigger = [trigger];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (buttons && !Array.isArray(buttons)) {
|
|
45
|
-
buttons = [buttons];
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const internalRef = useRef<HTMLElement | null>(null); // Ref interne au cas où targetRef est undefined
|
|
49
|
-
const resolvedRef = targetRef || internalRef; // Utilise targetRef si défini, sinon internalRef
|
|
50
|
-
|
|
51
|
-
const [currentToolTipId, setCurrentToolTipId] = useState<string | null>(null);
|
|
52
|
-
const [id] = useState(v4());
|
|
53
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
54
|
-
|
|
55
|
-
const timeout = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
56
|
-
const showTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
57
|
-
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
const handleUpdate = (event: CustomEvent) => {
|
|
60
|
-
setCurrentToolTipId(event.detail);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
document.addEventListener('tooltip-update', handleUpdate as EventListener);
|
|
64
|
-
return () => {
|
|
65
|
-
document.removeEventListener(
|
|
66
|
-
'tooltip-update',
|
|
67
|
-
handleUpdate as EventListener,
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
}, []);
|
|
71
|
-
|
|
72
|
-
useEffect(() => {
|
|
73
|
-
if (timeout.current) clearTimeout(timeout.current);
|
|
74
|
-
if (showTimeout.current) clearTimeout(showTimeout.current);
|
|
75
|
-
|
|
76
|
-
if (currentToolTipId) {
|
|
77
|
-
if (currentToolTipId === id) {
|
|
78
|
-
showTimeout.current = setTimeout(
|
|
79
|
-
() => {
|
|
80
|
-
setIsVisible(true);
|
|
81
|
-
},
|
|
82
|
-
(transition?.delay ?? 0) * 1000,
|
|
83
|
-
);
|
|
84
|
-
} else {
|
|
85
|
-
setIsVisible(false);
|
|
86
|
-
}
|
|
87
|
-
} else {
|
|
88
|
-
timeout.current = setTimeout(() => {
|
|
89
|
-
setIsVisible(false);
|
|
90
|
-
}, 1200);
|
|
91
|
-
}
|
|
92
|
-
}, [currentToolTipId, id]);
|
|
93
|
-
|
|
94
|
-
// Ajouter des gestionnaires sur l'élément cible (targetRef ou internalRef)
|
|
95
|
-
|
|
96
|
-
const handleMouseEnter = () => {
|
|
97
|
-
if (trigger.includes('hover')) {
|
|
98
|
-
const event = new CustomEvent('tooltip-update', { detail: id });
|
|
99
|
-
document.dispatchEvent(event);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const handleMouseLeave = () => {
|
|
104
|
-
if (trigger.includes('hover')) {
|
|
105
|
-
const event = new CustomEvent('tooltip-update', { detail: null });
|
|
106
|
-
document.dispatchEvent(event);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const handleClick = () => {
|
|
111
|
-
if (trigger.includes('click')) {
|
|
112
|
-
const event = new CustomEvent('tooltip-update', {
|
|
113
|
-
detail: isVisible ? null : id,
|
|
114
|
-
});
|
|
115
|
-
document.dispatchEvent(event);
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const handleFocus = () => {
|
|
120
|
-
if (trigger.includes('focus')) {
|
|
121
|
-
const event = new CustomEvent('tooltip-update', { detail: id });
|
|
122
|
-
document.dispatchEvent(event);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const handleBlur = () => {
|
|
127
|
-
if (trigger.includes('focus')) {
|
|
128
|
-
const event = new CustomEvent('tooltip-update', { detail: null });
|
|
129
|
-
document.dispatchEvent(event);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
if (resolvedRef?.current) {
|
|
135
|
-
const targetElement = resolvedRef.current;
|
|
136
|
-
|
|
137
|
-
targetElement.addEventListener('mouseenter', handleMouseEnter);
|
|
138
|
-
targetElement.addEventListener('mouseleave', handleMouseLeave);
|
|
139
|
-
targetElement.addEventListener('click', handleClick);
|
|
140
|
-
targetElement.addEventListener('focus', handleFocus);
|
|
141
|
-
targetElement.addEventListener('blur', handleBlur);
|
|
142
|
-
|
|
143
|
-
// Nettoyage au démontage
|
|
144
|
-
return () => {
|
|
145
|
-
targetElement.removeEventListener('mouseenter', handleMouseEnter);
|
|
146
|
-
targetElement.removeEventListener('mouseleave', handleMouseLeave);
|
|
147
|
-
targetElement.removeEventListener('click', handleClick);
|
|
148
|
-
targetElement.removeEventListener('focus', handleFocus);
|
|
149
|
-
targetElement.removeEventListener('blur', handleBlur);
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
return;
|
|
153
|
-
}, [resolvedRef, trigger, id, isVisible]);
|
|
154
|
-
|
|
155
|
-
// Si targetRef est undefined, on applique la réf au premier enfant
|
|
156
|
-
const enhancedChildren =
|
|
157
|
-
!targetRef && isValidElement(children)
|
|
158
|
-
? cloneElement(children, { ref: internalRef } as any)
|
|
159
|
-
: children;
|
|
160
|
-
|
|
161
|
-
if (!position && typeof window !== 'undefined') {
|
|
162
|
-
if (resolvedRef?.current && !position) {
|
|
163
|
-
const rect = resolvedRef.current.getBoundingClientRect();
|
|
164
|
-
|
|
165
|
-
const viewportWidth = window.innerWidth;
|
|
166
|
-
const viewportHeight = window.innerHeight;
|
|
167
|
-
|
|
168
|
-
const x = rect.left / viewportWidth; // X entre 0 et 1
|
|
169
|
-
const y = rect.top / viewportHeight; // Y entre 0 et 1
|
|
170
|
-
|
|
171
|
-
if (variant === 'plain') {
|
|
172
|
-
if (x < 1 / 3) {
|
|
173
|
-
position = 'right';
|
|
174
|
-
} else if (x > 2 / 3) {
|
|
175
|
-
position = 'left';
|
|
176
|
-
} else {
|
|
177
|
-
position = y > 0.5 ? 'top' : 'bottom';
|
|
178
|
-
}
|
|
179
|
-
} else {
|
|
180
|
-
if (x < 1 / 2 && y < 1 / 2) {
|
|
181
|
-
position = 'bottom-right';
|
|
182
|
-
} else if (x > 1 / 2 && y < 1 / 2) {
|
|
183
|
-
position = 'bottom-left';
|
|
184
|
-
} else if (x > 1 / 2 && y > 1 / 2) {
|
|
185
|
-
position = 'top-left';
|
|
186
|
-
} else if (x < 1 / 2 && y > 1 / 2) {
|
|
187
|
-
position = 'top-right';
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const styles = useToolTipStyle({
|
|
194
|
-
variant,
|
|
195
|
-
buttons,
|
|
196
|
-
className,
|
|
197
|
-
title,
|
|
198
|
-
text,
|
|
199
|
-
position,
|
|
200
|
-
trigger,
|
|
201
|
-
targetRef: targetRef as any,
|
|
202
|
-
children: children as any,
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
const variants = {
|
|
206
|
-
open: {
|
|
207
|
-
opacity: 1,
|
|
208
|
-
height: 'auto',
|
|
209
|
-
},
|
|
210
|
-
close: {
|
|
211
|
-
opacity: 0,
|
|
212
|
-
height: 16,
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
return (
|
|
217
|
-
<>
|
|
218
|
-
{enhancedChildren}
|
|
219
|
-
<AnimatePresence>
|
|
220
|
-
{isVisible && (
|
|
221
|
-
<SyncedFixedWrapper targetRef={resolvedRef}>
|
|
222
|
-
<motion.div
|
|
223
|
-
initial={'close'}
|
|
224
|
-
variants={variants}
|
|
225
|
-
animate={'open'}
|
|
226
|
-
transition={{ duration: transition.duration }}
|
|
227
|
-
exit={'close'}
|
|
228
|
-
className={styles.toolTip}
|
|
229
|
-
{...props}
|
|
230
|
-
onMouseEnter={handleMouseEnter}
|
|
231
|
-
onMouseLeave={handleMouseLeave}
|
|
232
|
-
>
|
|
233
|
-
<div className={styles.container}>
|
|
234
|
-
{title && <div className={styles.subHead}>{title}</div>}
|
|
235
|
-
<div className={styles.supportingText}>{text}</div>
|
|
236
|
-
{buttons && (
|
|
237
|
-
<div className={styles.actions}>
|
|
238
|
-
{Array.isArray(buttons) &&
|
|
239
|
-
buttons.map((buttonArgs, index) => (
|
|
240
|
-
<Button
|
|
241
|
-
key={index}
|
|
242
|
-
size={'small'}
|
|
243
|
-
variant={'text'}
|
|
244
|
-
{...buttonArgs}
|
|
245
|
-
/>
|
|
246
|
-
))}
|
|
247
|
-
</div>
|
|
248
|
-
)}
|
|
249
|
-
</div>
|
|
250
|
-
</motion.div>
|
|
251
|
-
</SyncedFixedWrapper>
|
|
252
|
-
)}
|
|
253
|
-
</AnimatePresence>
|
|
254
|
-
</>
|
|
255
|
-
);
|
|
256
|
-
};
|