@topconsultnpm/sdkui-react-beta 6.12.14 → 6.12.15
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.
@@ -7,6 +7,8 @@ interface ITMTooltipProps extends ITooltipOptions {
|
|
7
7
|
content?: React.ReactNode;
|
8
8
|
position?: Position | PositionConfig;
|
9
9
|
hideAfterDelay?: boolean;
|
10
|
+
parentStyle?: React.CSSProperties;
|
11
|
+
childStyle?: React.CSSProperties;
|
10
12
|
}
|
11
|
-
declare const TMTooltip: ({ children, position, content, hideAfterDelay }: ITMTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
13
|
+
declare const TMTooltip: ({ children, position, content, hideAfterDelay, parentStyle, childStyle }: ITMTooltipProps) => import("react/jsx-runtime").JSX.Element;
|
12
14
|
export default TMTooltip;
|
@@ -3,7 +3,7 @@ import { useEffect, useState } from 'react';
|
|
3
3
|
import { Tooltip } from 'devextreme-react/cjs/tooltip';
|
4
4
|
import { genUniqueId } from '../../helper';
|
5
5
|
import { DeviceType, useDeviceType } from './TMDeviceProvider';
|
6
|
-
const TMTooltip = ({ children, position, content, hideAfterDelay }) => {
|
6
|
+
const TMTooltip = ({ children, position, content, hideAfterDelay, parentStyle, childStyle }) => {
|
7
7
|
const [showTooltip, setShowTooltip] = useState(false);
|
8
8
|
const [id, setID] = useState('');
|
9
9
|
useEffect(() => { setID(genUniqueId()); }, [children]);
|
@@ -12,7 +12,7 @@ const TMTooltip = ({ children, position, content, hideAfterDelay }) => {
|
|
12
12
|
return () => window.removeEventListener('click', () => setShowTooltip(false));
|
13
13
|
}, []);
|
14
14
|
const deviceType = useDeviceType();
|
15
|
-
return (_jsxs("div", { children: [_jsx("div", { id: `idContainerTooltip${id}`, style: { display: 'flex', alignItems: 'center', height: 'max-content', width: 'max-content' }, onMouseEnter: () => { setShowTooltip(true); }, onMouseLeave: () => { setShowTooltip(false); }, onTouchStart: () => { setShowTooltip(true); }, onClick: () => { if (deviceType === DeviceType.DESKTOP || !hideAfterDelay)
|
15
|
+
return (_jsxs("div", { style: parentStyle, children: [_jsx("div", { id: `idContainerTooltip${id}`, style: { display: 'flex', alignItems: 'center', height: 'max-content', width: 'max-content', ...childStyle }, onMouseEnter: () => { setShowTooltip(true); }, onMouseLeave: () => { setShowTooltip(false); }, onTouchStart: () => { setShowTooltip(true); }, onClick: () => { if (deviceType === DeviceType.DESKTOP || !hideAfterDelay)
|
16
16
|
return; setTimeout(() => { setShowTooltip(false); }, 1500); }, onTouchEnd: () => { if (deviceType === DeviceType.DESKTOP || !hideAfterDelay)
|
17
17
|
return; setTimeout(() => { setShowTooltip(false); }, 1500); }, children: children }), content &&
|
18
18
|
_jsx(Tooltip, { target: `#idContainerTooltip${id}`, hideOnOutsideClick: true, visible: showTooltip, position: position ?? 'bottom', onHidden: () => setShowTooltip(false), children: content })] }));
|