@atlaskit/tooltip 17.5.16 → 17.6.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 +12 -0
- package/Tooltip/package.json +8 -1
- package/TooltipContainer/package.json +8 -1
- package/TooltipPrimitive/package.json +8 -1
- package/dist/cjs/Tooltip.js +8 -8
- package/dist/cjs/TooltipContainer.js +7 -7
- package/dist/cjs/TooltipPrimitive.js +4 -4
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/Tooltip.js +2 -2
- package/dist/es2019/TooltipContainer.js +1 -1
- package/dist/es2019/TooltipPrimitive.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/Tooltip.js +2 -2
- package/dist/esm/TooltipContainer.js +1 -1
- package/dist/esm/TooltipPrimitive.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/Tooltip.d.ts +2 -2
- package/dist/types-ts4.0/Tooltip.d.ts +8 -0
- package/dist/types-ts4.0/TooltipContainer.d.ts +6 -0
- package/dist/types-ts4.0/TooltipPrimitive.d.ts +17 -0
- package/dist/types-ts4.0/index.d.ts +4 -0
- package/dist/types-ts4.0/internal/props-for-extract-react-types.d.ts +84 -0
- package/dist/types-ts4.0/internal/shared-schedule.d.ts +2 -0
- package/dist/types-ts4.0/internal/tooltip-manager.d.ts +29 -0
- package/dist/types-ts4.0/internal/use-unique-id.d.ts +1 -0
- package/dist/types-ts4.0/types.d.ts +100 -0
- package/dist/types-ts4.0/utilities.d.ts +16 -0
- package/package.json +16 -9
- package/report.api.md +6 -5
- package/types/package.json +8 -1
- package/utilities/package.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/tooltip
|
|
2
2
|
|
|
3
|
+
## 17.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`15f0ad7aaa3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/15f0ad7aaa3) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
|
|
8
|
+
|
|
9
|
+
## 17.5.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
|
|
14
|
+
|
|
3
15
|
## 17.5.16
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/Tooltip/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/Tooltip.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/Tooltip.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/Tooltip.d.ts"
|
|
7
|
+
"types": "../dist/types/Tooltip.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/Tooltip.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/TooltipContainer.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/TooltipContainer.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/TooltipContainer.d.ts"
|
|
7
|
+
"types": "../dist/types/TooltipContainer.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/TooltipContainer.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/TooltipPrimitive.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/TooltipPrimitive.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/TooltipPrimitive.d.ts"
|
|
7
|
+
"types": "../dist/types/TooltipPrimitive.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/TooltipPrimitive.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/dist/cjs/Tooltip.js
CHANGED
|
@@ -17,7 +17,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _react2 = require("@emotion/react");
|
|
21
21
|
|
|
22
22
|
var _bindEventListener = require("bind-event-listener");
|
|
23
23
|
|
|
@@ -58,7 +58,7 @@ var tooltipZIndex = _constants.layers.tooltip();
|
|
|
58
58
|
var analyticsAttributes = {
|
|
59
59
|
componentName: 'tooltip',
|
|
60
60
|
packageName: "@atlaskit/tooltip",
|
|
61
|
-
packageVersion: "17.
|
|
61
|
+
packageVersion: "17.6.0"
|
|
62
62
|
}; // Inverts motion direction
|
|
63
63
|
|
|
64
64
|
var invertedDirection = {
|
|
@@ -407,11 +407,11 @@ function Tooltip(_ref) {
|
|
|
407
407
|
'aria-describedby': tooltipId,
|
|
408
408
|
'data-testid': testId ? "".concat(testId, "--container") : undefined
|
|
409
409
|
};
|
|
410
|
-
return (0,
|
|
410
|
+
return (0, _react2.jsx)(_react.default.Fragment, null, typeof children === 'function' ? children(tooltipTriggerProps) : (0, _react2.jsx)(CastTargetContainer, (0, _extends2.default)({}, tooltipTriggerProps, {
|
|
411
411
|
role: "presentation"
|
|
412
|
-
}), children), shouldRenderTooltipContainer ? (0,
|
|
412
|
+
}), children), shouldRenderTooltipContainer ? (0, _react2.jsx)(_portal.default, {
|
|
413
413
|
zIndex: tooltipZIndex
|
|
414
|
-
}, (0,
|
|
414
|
+
}, (0, _react2.jsx)(_popper.Popper, {
|
|
415
415
|
placement: tooltipPosition,
|
|
416
416
|
referenceElement: getReferenceElement(),
|
|
417
417
|
strategy: strategy
|
|
@@ -424,9 +424,9 @@ function Tooltip(_ref) {
|
|
|
424
424
|
// E.g. a tooltip's position is on the 'right', it should enter from and exit to the 'left'
|
|
425
425
|
// This gives the effect the tooltip is appearing from the target
|
|
426
426
|
var direction = position === 'mouse' ? undefined : invertedDirection[getDirectionFromPlacement(placement)];
|
|
427
|
-
return (0,
|
|
427
|
+
return (0, _react2.jsx)(_motion.ExitingPersistence, {
|
|
428
428
|
appear: true
|
|
429
|
-
}, shouldRenderTooltipChildren && (0,
|
|
429
|
+
}, shouldRenderTooltipChildren && (0, _react2.jsx)(_motion.FadeIn, {
|
|
430
430
|
distance: "constant",
|
|
431
431
|
entranceDirection: direction,
|
|
432
432
|
exitDirection: direction,
|
|
@@ -435,7 +435,7 @@ function Tooltip(_ref) {
|
|
|
435
435
|
}, function (_ref5) {
|
|
436
436
|
var className = _ref5.className;
|
|
437
437
|
return (// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
438
|
-
(0,
|
|
438
|
+
(0, _react2.jsx)(Container, {
|
|
439
439
|
ref: ref,
|
|
440
440
|
className: "Tooltip ".concat(className),
|
|
441
441
|
style: style,
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
13
|
|
|
14
14
|
var _colors = require("@atlaskit/theme/colors");
|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ var _constants = require("@atlaskit/theme/constants");
|
|
|
20
20
|
var _TooltipPrimitive = _interopRequireDefault(require("./TooltipPrimitive"));
|
|
21
21
|
|
|
22
22
|
/** @jsx jsx */
|
|
23
|
-
var baseStyles = (0,
|
|
23
|
+
var baseStyles = (0, _react2.css)({
|
|
24
24
|
boxSizing: 'border-box',
|
|
25
25
|
maxWidth: '240px',
|
|
26
26
|
padding: '2px 6px',
|
|
@@ -32,17 +32,17 @@ var baseStyles = (0, _core.css)({
|
|
|
32
32
|
overflowWrap: 'break-word',
|
|
33
33
|
wordWrap: 'break-word'
|
|
34
34
|
});
|
|
35
|
-
var truncateStyles = (0,
|
|
35
|
+
var truncateStyles = (0, _react2.css)({
|
|
36
36
|
maxWidth: '420px',
|
|
37
37
|
overflow: 'hidden',
|
|
38
38
|
textOverflow: 'ellipsis',
|
|
39
39
|
whiteSpace: 'nowrap'
|
|
40
40
|
});
|
|
41
|
-
var lightStyles = (0,
|
|
41
|
+
var lightStyles = (0, _react2.css)({
|
|
42
42
|
backgroundColor: "var(--ds-background-neutral-bold, ".concat(_colors.N800, ")"),
|
|
43
43
|
color: "var(--ds-text-inverse, ".concat(_colors.N0, ")")
|
|
44
44
|
});
|
|
45
|
-
var darkStyles = (0,
|
|
45
|
+
var darkStyles = (0, _react2.css)({
|
|
46
46
|
backgroundColor: "var(--ds-background-neutral-bold, ".concat(_colors.DN0, ")"),
|
|
47
47
|
color: "var(--ds-text-inverse, ".concat(_colors.DN600, ")")
|
|
48
48
|
});
|
|
@@ -56,10 +56,10 @@ var TooltipContainer = /*#__PURE__*/(0, _react.forwardRef)(function TooltipConta
|
|
|
56
56
|
onMouseOut = _ref.onMouseOut,
|
|
57
57
|
onMouseOver = _ref.onMouseOver,
|
|
58
58
|
id = _ref.id;
|
|
59
|
-
return (0,
|
|
59
|
+
return (0, _react2.jsx)(_components.default.Consumer, null, function (_ref2) {
|
|
60
60
|
var mode = _ref2.mode;
|
|
61
61
|
return (// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
62
|
-
(0,
|
|
62
|
+
(0, _react2.jsx)(_TooltipPrimitive.default, {
|
|
63
63
|
ref: ref,
|
|
64
64
|
style: style,
|
|
65
65
|
className: className,
|
|
@@ -11,7 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
11
11
|
|
|
12
12
|
var _react = require("react");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _react2 = require("@emotion/react");
|
|
15
15
|
|
|
16
16
|
var _constants = require("@atlaskit/theme/constants");
|
|
17
17
|
|
|
@@ -20,7 +20,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
|
|
22
22
|
var VAR_PRIMITIVE_ZINDEX = 'tooltipPrimitiveZindex';
|
|
23
|
-
var primitiveStyles = (0,
|
|
23
|
+
var primitiveStyles = (0, _react2.css)({
|
|
24
24
|
zindex: "var(".concat(VAR_PRIMITIVE_ZINDEX, ")"),
|
|
25
25
|
cursor: "default"
|
|
26
26
|
});
|
|
@@ -36,11 +36,11 @@ var TooltipPrimitive = /*#__PURE__*/(0, _react.forwardRef)(function TooltipPrimi
|
|
|
36
36
|
|
|
37
37
|
var styleWithZIndex = _objectSpread(_objectSpread({}, style), {}, (0, _defineProperty2.default)({}, VAR_PRIMITIVE_ZINDEX, _constants.layers.tooltip()));
|
|
38
38
|
|
|
39
|
-
return (0,
|
|
39
|
+
return (0, _react2.jsx)("div", {
|
|
40
40
|
ref: ref,
|
|
41
41
|
style: styleWithZIndex,
|
|
42
42
|
"data-testid": testId ? "".concat(testId, "--wrapper") : undefined
|
|
43
|
-
}, (0,
|
|
43
|
+
}, (0, _react2.jsx)("div", {
|
|
44
44
|
role: "tooltip",
|
|
45
45
|
className: className,
|
|
46
46
|
onMouseOut: onMouseOut,
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/Tooltip.js
CHANGED
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
|
|
3
3
|
/** @jsx jsx */
|
|
4
4
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/
|
|
5
|
+
import { jsx } from '@emotion/react';
|
|
6
6
|
import { bind } from 'bind-event-listener';
|
|
7
7
|
import { usePlatformLeafSyntheticEventHandler } from '@atlaskit/analytics-next';
|
|
8
8
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -20,7 +20,7 @@ const tooltipZIndex = layers.tooltip();
|
|
|
20
20
|
const analyticsAttributes = {
|
|
21
21
|
componentName: 'tooltip',
|
|
22
22
|
packageName: "@atlaskit/tooltip",
|
|
23
|
-
packageVersion: "17.
|
|
23
|
+
packageVersion: "17.6.0"
|
|
24
24
|
}; // Inverts motion direction
|
|
25
25
|
|
|
26
26
|
const invertedDirection = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { DN0, DN600, N0, N800 } from '@atlaskit/theme/colors';
|
|
5
5
|
import GlobalTheme from '@atlaskit/theme/components';
|
|
6
6
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { layers } from '@atlaskit/theme/constants';
|
|
5
5
|
const VAR_PRIMITIVE_ZINDEX = 'tooltipPrimitiveZindex';
|
|
6
6
|
const primitiveStyles = css({
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/Tooltip.js
CHANGED
|
@@ -8,7 +8,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
8
8
|
|
|
9
9
|
/** @jsx jsx */
|
|
10
10
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
11
|
-
import { jsx } from '@emotion/
|
|
11
|
+
import { jsx } from '@emotion/react';
|
|
12
12
|
import { bind } from 'bind-event-listener';
|
|
13
13
|
import { usePlatformLeafSyntheticEventHandler } from '@atlaskit/analytics-next';
|
|
14
14
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -26,7 +26,7 @@ var tooltipZIndex = layers.tooltip();
|
|
|
26
26
|
var analyticsAttributes = {
|
|
27
27
|
componentName: 'tooltip',
|
|
28
28
|
packageName: "@atlaskit/tooltip",
|
|
29
|
-
packageVersion: "17.
|
|
29
|
+
packageVersion: "17.6.0"
|
|
30
30
|
}; // Inverts motion direction
|
|
31
31
|
|
|
32
32
|
var invertedDirection = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import { css, jsx } from '@emotion/
|
|
3
|
+
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { DN0, DN600, N0, N800 } from '@atlaskit/theme/colors';
|
|
5
5
|
import GlobalTheme from '@atlaskit/theme/components';
|
|
6
6
|
import { borderRadius } from '@atlaskit/theme/constants';
|
|
@@ -6,7 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
6
6
|
|
|
7
7
|
/** @jsx jsx */
|
|
8
8
|
import { forwardRef } from 'react';
|
|
9
|
-
import { css, jsx } from '@emotion/
|
|
9
|
+
import { css, jsx } from '@emotion/react';
|
|
10
10
|
import { layers } from '@atlaskit/theme/constants';
|
|
11
11
|
var VAR_PRIMITIVE_ZINDEX = 'tooltipPrimitiveZindex';
|
|
12
12
|
var primitiveStyles = css({
|
package/dist/esm/version.json
CHANGED
package/dist/types/Tooltip.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
-
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
3
|
import { TooltipProps } from './types';
|
|
4
|
-
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): JSX.Element;
|
|
4
|
+
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): jsx.JSX.Element;
|
|
5
5
|
declare namespace Tooltip {
|
|
6
6
|
var displayName: string;
|
|
7
7
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { jsx } from '@emotion/react';
|
|
3
|
+
import { TooltipProps } from './types';
|
|
4
|
+
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): jsx.JSX.Element;
|
|
5
|
+
declare namespace Tooltip {
|
|
6
|
+
var displayName: string;
|
|
7
|
+
}
|
|
8
|
+
export default Tooltip;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TooltipPrimitiveProps } from './TooltipPrimitive';
|
|
3
|
+
export interface TooltipContainerProps extends TooltipPrimitiveProps {
|
|
4
|
+
}
|
|
5
|
+
declare const TooltipContainer: import("react").ForwardRefExoticComponent<Pick<TooltipContainerProps, "style" | "className" | "children" | "placement" | "testId" | "onMouseOut" | "onMouseOver" | "id" | "truncate"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export default TooltipContainer;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @jsx jsx */
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
import { PositionType } from './types';
|
|
4
|
+
export interface TooltipPrimitiveProps {
|
|
5
|
+
truncate?: boolean;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
testId?: string;
|
|
10
|
+
placement: PositionType;
|
|
11
|
+
ref: React.Ref<any>;
|
|
12
|
+
onMouseOver?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
13
|
+
onMouseOut?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
14
|
+
id?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const TooltipPrimitive: import("react").ForwardRefExoticComponent<Pick<TooltipPrimitiveProps, "style" | "className" | "children" | "placement" | "testId" | "onMouseOut" | "onMouseOver" | "id" | "truncate"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default TooltipPrimitive;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ComponentType, ElementType, ReactNode } from 'react';
|
|
2
|
+
import { TooltipPrimitiveProps } from '../TooltipPrimitive';
|
|
3
|
+
import { PositionType, PositionTypeBase } from '../types';
|
|
4
|
+
declare type Props = {
|
|
5
|
+
/**
|
|
6
|
+
* The content of the tooltip. It can be either a:
|
|
7
|
+
* 1. `ReactNode`
|
|
8
|
+
* 2. Function which returns a `ReactNode`
|
|
9
|
+
|
|
10
|
+
* The benefit of the second approach is that it allows you to consume the `update` render prop.
|
|
11
|
+
* This `update` function can be called to manually recalculate the position of the tooltip.
|
|
12
|
+
*/
|
|
13
|
+
content: ReactNode | (({ update }: {
|
|
14
|
+
update: () => void;
|
|
15
|
+
}) => ReactNode);
|
|
16
|
+
/**
|
|
17
|
+
* Extend `TooltipPrimitive` to create your own tooltip and pass it as component
|
|
18
|
+
*/
|
|
19
|
+
component?: ComponentType<TooltipPrimitiveProps>;
|
|
20
|
+
/**
|
|
21
|
+
* Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300.
|
|
22
|
+
*/
|
|
23
|
+
delay?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Hide the tooltip when the click event is triggered. This should be
|
|
26
|
+
* used when tooltip should be hidden if `onClick` react synthetic event
|
|
27
|
+
* is triggered, which happens after `onMouseDown` event
|
|
28
|
+
*/
|
|
29
|
+
hideTooltipOnClick?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Hide the tooltip when the mousedown event is triggered. This should be
|
|
32
|
+
* used when tooltip should be hidden if `onMouseDown` react synthetic event
|
|
33
|
+
* is triggered, which happens before `onClick` event
|
|
34
|
+
*/
|
|
35
|
+
hideTooltipOnMouseDown?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Where the tooltip should appear relative to the mouse pointer.
|
|
38
|
+
* Only used when the `position` prop is set to `"mouse"`.
|
|
39
|
+
* When interacting with the target element using the keyboard will use this position against the target element instead.
|
|
40
|
+
*/
|
|
41
|
+
mousePosition?: PositionTypeBase;
|
|
42
|
+
/**
|
|
43
|
+
* Function to be called when the tooltip will be shown. It is called when the
|
|
44
|
+
* tooltip begins to animate in.
|
|
45
|
+
*/
|
|
46
|
+
onShow?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Function to be called when the tooltip will be hidden. It is called after the
|
|
49
|
+
* delay, when the tooltip begins to animate out.
|
|
50
|
+
*/
|
|
51
|
+
onHide?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* Where the tooltip should appear relative to its target.
|
|
54
|
+
* If set to `"mouse"` the tooltip will display next to the mouse pointer instead.
|
|
55
|
+
* Make sure to utilize the `mousePosition` if you want to customize where the tooltip will show in relation to the mouse.
|
|
56
|
+
*/
|
|
57
|
+
position?: PositionType;
|
|
58
|
+
/**
|
|
59
|
+
* Replace the wrapping element. This accepts the name of a html tag which will
|
|
60
|
+
* be used to wrap the element.
|
|
61
|
+
* If you provide a component it needs to support a ref prop which is used by popper for positioning
|
|
62
|
+
* Note: actual type is not ElementType, it is either a JSX.IntrinsticElement (eg "div")
|
|
63
|
+
* or a component that supports React.AllHTMLAttributes<HTMLElement> has a ref prop (React.Ref<HTMLElement>).
|
|
64
|
+
* Using ElementType here for documentation because it is close and works with our prop extraction tool
|
|
65
|
+
*/
|
|
66
|
+
tag?: ElementType;
|
|
67
|
+
/**
|
|
68
|
+
* Show only one line of text, and truncate when too long
|
|
69
|
+
*/
|
|
70
|
+
truncate?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Elements to be wrapped by the tooltip
|
|
73
|
+
*/
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
/**
|
|
76
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
77
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
78
|
+
* serving as a hook for automated tests */
|
|
79
|
+
testId?: string;
|
|
80
|
+
/** Analytics context metadata */
|
|
81
|
+
analyticsContext?: Record<string, any>;
|
|
82
|
+
};
|
|
83
|
+
export default function PropsHack(props: Props): null;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FakeMouseElement } from '../utilities';
|
|
2
|
+
export declare type Source = {
|
|
3
|
+
type: 'mouse';
|
|
4
|
+
mouse: FakeMouseElement;
|
|
5
|
+
} | {
|
|
6
|
+
type: 'keyboard';
|
|
7
|
+
};
|
|
8
|
+
export declare type Entry = {
|
|
9
|
+
source: Source;
|
|
10
|
+
show: (value: {
|
|
11
|
+
isImmediate: boolean;
|
|
12
|
+
}) => void;
|
|
13
|
+
hide: (value: {
|
|
14
|
+
isImmediate: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
delay: number;
|
|
17
|
+
done: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare type API = {
|
|
20
|
+
isActive: () => boolean;
|
|
21
|
+
mousePosition: FakeMouseElement | null;
|
|
22
|
+
requestHide: (value: {
|
|
23
|
+
isImmediate: boolean;
|
|
24
|
+
}) => void;
|
|
25
|
+
finishHideAnimation: () => void;
|
|
26
|
+
keep: () => void;
|
|
27
|
+
abort: () => void;
|
|
28
|
+
};
|
|
29
|
+
export declare function show(entry: Entry): API;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useUniqueId(prefix: string, shouldRenderId: boolean): string | undefined;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
3
|
+
import { Placement } from '@atlaskit/popper';
|
|
4
|
+
import { TooltipPrimitiveProps } from './TooltipPrimitive';
|
|
5
|
+
export declare type PositionTypeBase = Placement;
|
|
6
|
+
export declare type PositionType = PositionTypeBase | 'mouse';
|
|
7
|
+
export interface TriggerProps {
|
|
8
|
+
onMouseOver: (event: React.MouseEvent<HTMLElement>) => void;
|
|
9
|
+
onMouseOut: (event: React.MouseEvent<HTMLElement>) => void;
|
|
10
|
+
onMouseDown: (event: React.MouseEvent<HTMLElement>) => void;
|
|
11
|
+
onClick: (event: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
+
onFocus: (event: React.FocusEvent<HTMLElement>) => void;
|
|
13
|
+
onBlur: (event: React.FocusEvent<HTMLElement>) => void;
|
|
14
|
+
ref: (node: HTMLElement | null) => void;
|
|
15
|
+
}
|
|
16
|
+
export interface TooltipProps {
|
|
17
|
+
/**
|
|
18
|
+
* The content of the tooltip. It can be either a:
|
|
19
|
+
* 1. `ReactNode`
|
|
20
|
+
* 2. Function which returns a `ReactNode`
|
|
21
|
+
|
|
22
|
+
* The benefit of the second approach is that it allows you to consume the `update` render prop.
|
|
23
|
+
* This `update` function can be called to manually recalculate the position of the tooltip.
|
|
24
|
+
*/
|
|
25
|
+
content: ReactNode | (({ update }: {
|
|
26
|
+
update: () => void;
|
|
27
|
+
}) => ReactNode);
|
|
28
|
+
/**
|
|
29
|
+
* Extend `TooltipPrimitive` to create your own tooltip and pass it as component
|
|
30
|
+
*/
|
|
31
|
+
component?: ComponentType<TooltipPrimitiveProps>;
|
|
32
|
+
/**
|
|
33
|
+
* Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300.
|
|
34
|
+
*/
|
|
35
|
+
delay?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Hide the tooltip when the click event is triggered. This should be
|
|
38
|
+
* used when tooltip should be hidden if `onClick` react synthetic event
|
|
39
|
+
* is triggered, which happens after `onMouseDown` event
|
|
40
|
+
*/
|
|
41
|
+
hideTooltipOnClick?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Hide the tooltip when the mousedown event is triggered. This should be
|
|
44
|
+
* used when tooltip should be hidden if `onMouseDown` react synthetic event
|
|
45
|
+
* is triggered, which happens before `onClick` event
|
|
46
|
+
*/
|
|
47
|
+
hideTooltipOnMouseDown?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Where the tooltip should appear relative to the mouse pointer.
|
|
50
|
+
* Only used when the `position` prop is set to `"mouse"`.
|
|
51
|
+
* When interacting with the target element using the keyboard will use this position against the target element instead.
|
|
52
|
+
*/
|
|
53
|
+
mousePosition?: PositionTypeBase;
|
|
54
|
+
/**
|
|
55
|
+
* Function to be called when the tooltip will be shown. It is called when the
|
|
56
|
+
* tooltip begins to animate in.
|
|
57
|
+
*/
|
|
58
|
+
onShow?: (analyticsEvent: UIAnalyticsEvent) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Function to be called when the tooltip will be hidden. It is called after the
|
|
61
|
+
* delay, when the tooltip begins to animate out.
|
|
62
|
+
*/
|
|
63
|
+
onHide?: (analyticsEvent: UIAnalyticsEvent) => void;
|
|
64
|
+
/**
|
|
65
|
+
* Where the tooltip should appear relative to its target.
|
|
66
|
+
* If set to `"mouse"` the tooltip will display next to the mouse pointer instead.
|
|
67
|
+
* Make sure to utilize the `mousePosition` if you want to customize where the tooltip will show in relation to the mouse.
|
|
68
|
+
*/
|
|
69
|
+
position?: PositionType;
|
|
70
|
+
/**
|
|
71
|
+
* Replace the wrapping element. This accepts the name of a html tag which will
|
|
72
|
+
* be used to wrap the element.
|
|
73
|
+
* If you provide a component it needs to support a ref prop which is used by popper for positioning
|
|
74
|
+
*/
|
|
75
|
+
tag?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & {
|
|
76
|
+
ref: React.Ref<HTMLElement>;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Show only one line of text, and truncate when too long
|
|
80
|
+
*/
|
|
81
|
+
truncate?: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Elements to be wrapped by the tooltip.
|
|
84
|
+
* It can be either a:
|
|
85
|
+
* 1. `ReactNode`
|
|
86
|
+
* 2. Function which returns a `ReactNode`
|
|
87
|
+
*/
|
|
88
|
+
children: ReactNode | ((props: TriggerProps) => ReactNode);
|
|
89
|
+
/**
|
|
90
|
+
* A `testId` prop is provided for specified elements, which is a unique
|
|
91
|
+
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
92
|
+
* serving as a hook for automated tests */
|
|
93
|
+
testId?: string;
|
|
94
|
+
/** Analytics context metadata */
|
|
95
|
+
analyticsContext?: Record<string, any>;
|
|
96
|
+
/**
|
|
97
|
+
* Used to define the strategy of popper.
|
|
98
|
+
*/
|
|
99
|
+
strategy?: 'absolute' | 'fixed' | undefined;
|
|
100
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface FakeMouseElement {
|
|
2
|
+
getBoundingClientRect: () => {
|
|
3
|
+
top: number;
|
|
4
|
+
left: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
right: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
clientWidth: number;
|
|
11
|
+
clientHeight: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function getMousePosition(mouseCoordinates: {
|
|
14
|
+
top: number;
|
|
15
|
+
left: number;
|
|
16
|
+
}): FakeMouseElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tooltip",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.6.0",
|
|
4
4
|
"description": "A tooltip is a floating, non-actionable label used to explain a user interface element or feature.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
+
"typesVersions": {
|
|
16
|
+
">=4.0 <4.5": {
|
|
17
|
+
"*": [
|
|
18
|
+
"dist/types-ts4.0/*"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
15
22
|
"sideEffects": false,
|
|
16
23
|
"atlaskit:src": "src/index.ts",
|
|
17
24
|
"atlassian": {
|
|
@@ -36,10 +43,10 @@
|
|
|
36
43
|
"@atlaskit/motion": "^1.2.0",
|
|
37
44
|
"@atlaskit/popper": "^5.0.0",
|
|
38
45
|
"@atlaskit/portal": "^4.1.0",
|
|
39
|
-
"@atlaskit/theme": "^12.
|
|
46
|
+
"@atlaskit/theme": "^12.2.0",
|
|
40
47
|
"@atlaskit/tokens": "^0.10.0",
|
|
41
48
|
"@babel/runtime": "^7.0.0",
|
|
42
|
-
"@emotion/
|
|
49
|
+
"@emotion/react": "^11.7.1",
|
|
43
50
|
"bind-event-listener": "^2.1.1",
|
|
44
51
|
"react-uid": "^2.2.0"
|
|
45
52
|
},
|
|
@@ -50,20 +57,20 @@
|
|
|
50
57
|
"devDependencies": {
|
|
51
58
|
"@atlaskit/button": "^16.3.0",
|
|
52
59
|
"@atlaskit/docs": "*",
|
|
53
|
-
"@atlaskit/icon": "^21.
|
|
54
|
-
"@atlaskit/section-message": "^6.
|
|
60
|
+
"@atlaskit/icon": "^21.11.0",
|
|
61
|
+
"@atlaskit/section-message": "^6.3.0",
|
|
55
62
|
"@atlaskit/ssr": "*",
|
|
56
63
|
"@atlaskit/visual-regression": "*",
|
|
57
64
|
"@atlaskit/webdriver-runner": "*",
|
|
58
65
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
59
|
-
"@emotion/styled": "^
|
|
60
|
-
"@testing-library/dom": "^
|
|
61
|
-
"@testing-library/react": "^
|
|
66
|
+
"@emotion/styled": "^11.0.0",
|
|
67
|
+
"@testing-library/dom": "^8.17.1",
|
|
68
|
+
"@testing-library/react": "^12.1.5",
|
|
62
69
|
"jest-in-case": "^1.0.2",
|
|
63
70
|
"react-dom": "^16.8.0",
|
|
64
71
|
"react-redux": "^5.1.2",
|
|
65
72
|
"storybook-addon-performance": "^0.16.0",
|
|
66
|
-
"typescript": "4.
|
|
73
|
+
"typescript": "4.5.5",
|
|
67
74
|
"wait-for-expect": "^1.2.0"
|
|
68
75
|
},
|
|
69
76
|
"keywords": [
|
package/report.api.md
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
## API Report File for "@atlaskit/tooltip"
|
|
1
|
+
## API Report File for "@atlaskit/tooltip".
|
|
2
2
|
|
|
3
|
-
> Do not edit this file.
|
|
3
|
+
> Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
/// <reference types="react" />
|
|
5
|
+
[Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
6
|
|
|
7
|
+
```ts
|
|
8
8
|
import { ComponentType } from 'react';
|
|
9
9
|
import { CSSProperties } from 'react';
|
|
10
10
|
import { ForwardRefExoticComponent } from 'react';
|
|
11
|
+
import { jsx } from '@emotion/react';
|
|
11
12
|
import { Placement } from '@atlaskit/popper';
|
|
12
13
|
import { ReactNode } from 'react';
|
|
13
14
|
import { RefAttributes } from 'react';
|
|
@@ -33,7 +34,7 @@ declare function Tooltip({
|
|
|
33
34
|
hideTooltipOnMouseDown,
|
|
34
35
|
analyticsContext,
|
|
35
36
|
strategy,
|
|
36
|
-
}: TooltipProps): JSX.Element;
|
|
37
|
+
}: TooltipProps): jsx.JSX.Element;
|
|
37
38
|
|
|
38
39
|
declare namespace Tooltip {
|
|
39
40
|
var displayName: string;
|
package/types/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/types.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/types.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/types.d.ts"
|
|
7
|
+
"types": "../dist/types/types.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/types.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|
package/utilities/package.json
CHANGED
|
@@ -4,5 +4,12 @@
|
|
|
4
4
|
"module": "../dist/esm/utilities.js",
|
|
5
5
|
"module:es2019": "../dist/es2019/utilities.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"types": "../dist/types/utilities.d.ts"
|
|
7
|
+
"types": "../dist/types/utilities.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.0 <4.5": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.0/utilities.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
8
15
|
}
|