@atlaskit/tooltip 18.2.2 → 18.3.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.
@@ -32,7 +32,7 @@ var tooltipZIndex = _constants.layers.tooltip();
32
32
  var analyticsAttributes = {
33
33
  componentName: 'tooltip',
34
34
  packageName: "@atlaskit/tooltip",
35
- packageVersion: "18.2.2"
35
+ packageVersion: "18.3.0"
36
36
  };
37
37
 
38
38
  // Inverts motion direction
@@ -46,7 +46,7 @@ var invertedDirection = {
46
46
  /**
47
47
  * Converts a Popper placement to it's general direction.
48
48
  *
49
- * @param position - Popper Placement value, e.g. 'top-start'
49
+ * @param placement - Popper Placement value, e.g. 'top-start'
50
50
  * @returns Popper Direction, e.g. 'top'
51
51
  */
52
52
  var getDirectionFromPlacement = function getDirectionFromPlacement(placement) {
@@ -78,7 +78,9 @@ function Tooltip(_ref) {
78
78
  hideTooltipOnMouseDown = _ref$hideTooltipOnMou === void 0 ? false : _ref$hideTooltipOnMou,
79
79
  analyticsContext = _ref.analyticsContext,
80
80
  _ref$strategy = _ref.strategy,
81
- strategy = _ref$strategy === void 0 ? 'fixed' : _ref$strategy;
81
+ strategy = _ref$strategy === void 0 ? 'fixed' : _ref$strategy,
82
+ _ref$ignoreTooltipPoi = _ref.ignoreTooltipPointerEvents,
83
+ ignoreTooltipPointerEvents = _ref$ignoreTooltipPoi === void 0 ? false : _ref$ignoreTooltipPoi;
82
84
  var tooltipPosition = position === 'mouse' ? mousePosition : position;
83
85
  var onShowHandler = (0, _analyticsNext.usePlatformLeafSyntheticEventHandler)(_objectSpread({
84
86
  fn: onShow,
@@ -460,7 +462,9 @@ function Tooltip(_ref) {
460
462
  * and hide tooltips, including in VR snapshots
461
463
  **/,
462
464
  className: "Tooltip ".concat(className),
463
- style: style,
465
+ style: _objectSpread(_objectSpread({}, style), ignoreTooltipPointerEvents && {
466
+ pointerEvents: 'none'
467
+ }),
464
468
  truncate: truncate,
465
469
  placement: tooltipPosition,
466
470
  testId: getReferenceElement() ? testId : testId && "".concat(testId, "--unresolved"),
@@ -18,7 +18,7 @@ const tooltipZIndex = layers.tooltip();
18
18
  const analyticsAttributes = {
19
19
  componentName: 'tooltip',
20
20
  packageName: "@atlaskit/tooltip",
21
- packageVersion: "18.2.2"
21
+ packageVersion: "18.3.0"
22
22
  };
23
23
 
24
24
  // Inverts motion direction
@@ -32,7 +32,7 @@ const invertedDirection = {
32
32
  /**
33
33
  * Converts a Popper placement to it's general direction.
34
34
  *
35
- * @param position - Popper Placement value, e.g. 'top-start'
35
+ * @param placement - Popper Placement value, e.g. 'top-start'
36
36
  * @returns Popper Direction, e.g. 'top'
37
37
  */
38
38
  const getDirectionFromPlacement = placement => placement.split('-')[0];
@@ -51,7 +51,8 @@ function Tooltip({
51
51
  hideTooltipOnClick = false,
52
52
  hideTooltipOnMouseDown = false,
53
53
  analyticsContext,
54
- strategy = 'fixed'
54
+ strategy = 'fixed',
55
+ ignoreTooltipPointerEvents = false
55
56
  }) {
56
57
  const tooltipPosition = position === 'mouse' ? mousePosition : position;
57
58
  const onShowHandler = usePlatformLeafSyntheticEventHandler({
@@ -438,7 +439,12 @@ function Tooltip({
438
439
  * and hide tooltips, including in VR snapshots
439
440
  **/,
440
441
  className: `Tooltip ${className}`,
441
- style: style,
442
+ style: {
443
+ ...style,
444
+ ...(ignoreTooltipPointerEvents && {
445
+ pointerEvents: 'none'
446
+ })
447
+ },
442
448
  truncate: truncate,
443
449
  placement: tooltipPosition,
444
450
  testId: getReferenceElement() ? testId : testId && `${testId}--unresolved`,
@@ -22,7 +22,7 @@ var tooltipZIndex = layers.tooltip();
22
22
  var analyticsAttributes = {
23
23
  componentName: 'tooltip',
24
24
  packageName: "@atlaskit/tooltip",
25
- packageVersion: "18.2.2"
25
+ packageVersion: "18.3.0"
26
26
  };
27
27
 
28
28
  // Inverts motion direction
@@ -36,7 +36,7 @@ var invertedDirection = {
36
36
  /**
37
37
  * Converts a Popper placement to it's general direction.
38
38
  *
39
- * @param position - Popper Placement value, e.g. 'top-start'
39
+ * @param placement - Popper Placement value, e.g. 'top-start'
40
40
  * @returns Popper Direction, e.g. 'top'
41
41
  */
42
42
  var getDirectionFromPlacement = function getDirectionFromPlacement(placement) {
@@ -68,7 +68,9 @@ function Tooltip(_ref) {
68
68
  hideTooltipOnMouseDown = _ref$hideTooltipOnMou === void 0 ? false : _ref$hideTooltipOnMou,
69
69
  analyticsContext = _ref.analyticsContext,
70
70
  _ref$strategy = _ref.strategy,
71
- strategy = _ref$strategy === void 0 ? 'fixed' : _ref$strategy;
71
+ strategy = _ref$strategy === void 0 ? 'fixed' : _ref$strategy,
72
+ _ref$ignoreTooltipPoi = _ref.ignoreTooltipPointerEvents,
73
+ ignoreTooltipPointerEvents = _ref$ignoreTooltipPoi === void 0 ? false : _ref$ignoreTooltipPoi;
72
74
  var tooltipPosition = position === 'mouse' ? mousePosition : position;
73
75
  var onShowHandler = usePlatformLeafSyntheticEventHandler(_objectSpread({
74
76
  fn: onShow,
@@ -450,7 +452,9 @@ function Tooltip(_ref) {
450
452
  * and hide tooltips, including in VR snapshots
451
453
  **/,
452
454
  className: "Tooltip ".concat(className),
453
- style: style,
455
+ style: _objectSpread(_objectSpread({}, style), ignoreTooltipPointerEvents && {
456
+ pointerEvents: 'none'
457
+ }),
454
458
  truncate: truncate,
455
459
  placement: tooltipPosition,
456
460
  testId: getReferenceElement() ? testId : testId && "".concat(testId, "--unresolved"),
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { TooltipProps } from './types';
3
- declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): JSX.Element;
2
+ import { type TooltipProps } from './types';
3
+ declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, ignoreTooltipPointerEvents, }: TooltipProps): JSX.Element;
4
4
  declare namespace Tooltip {
5
5
  var displayName: string;
6
6
  }
@@ -34,6 +34,10 @@ export interface TooltipProps {
34
34
  * Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300.
35
35
  */
36
36
  delay?: number;
37
+ /**
38
+ * Adds `pointer-events: none` to the tooltip itself. Setting this to true will also prevent the tooltip from persisting when hovered.
39
+ */
40
+ ignoreTooltipPointerEvents?: boolean;
37
41
  /**
38
42
  * Hide the tooltip when the click event is triggered. Use this when the tooltip should be hidden if `onClick` react synthetic event
39
43
  * is triggered, which happens after `onMouseDown` event.
@@ -62,7 +66,7 @@ export interface TooltipProps {
62
66
  */
63
67
  onHide?: (analyticsEvent: UIAnalyticsEvent) => void;
64
68
  /**
65
- * Where the tooltip should appear relative to its' target.
69
+ * Where the tooltip should appear relative to its target.
66
70
  * If set to `"mouse"`, the tooltip will display next to the mouse pointer instead.
67
71
  * Make sure to utilize the `mousePosition` if you want to customize where the tooltip will show in relation to the mouse.
68
72
  */
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { TooltipProps } from './types';
3
- declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): JSX.Element;
2
+ import { type TooltipProps } from './types';
3
+ declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, ignoreTooltipPointerEvents, }: TooltipProps): JSX.Element;
4
4
  declare namespace Tooltip {
5
5
  var displayName: string;
6
6
  }
@@ -34,6 +34,10 @@ export interface TooltipProps {
34
34
  * Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300.
35
35
  */
36
36
  delay?: number;
37
+ /**
38
+ * Adds `pointer-events: none` to the tooltip itself. Setting this to true will also prevent the tooltip from persisting when hovered.
39
+ */
40
+ ignoreTooltipPointerEvents?: boolean;
37
41
  /**
38
42
  * Hide the tooltip when the click event is triggered. Use this when the tooltip should be hidden if `onClick` react synthetic event
39
43
  * is triggered, which happens after `onMouseDown` event.
@@ -62,7 +66,7 @@ export interface TooltipProps {
62
66
  */
63
67
  onHide?: (analyticsEvent: UIAnalyticsEvent) => void;
64
68
  /**
65
- * Where the tooltip should appear relative to its' target.
69
+ * Where the tooltip should appear relative to its target.
66
70
  * If set to `"mouse"`, the tooltip will display next to the mouse pointer instead.
67
71
  * Make sure to utilize the `mousePosition` if you want to customize where the tooltip will show in relation to the mouse.
68
72
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "18.2.2",
3
+ "version": "18.3.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/"
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/popper": "^5.5.0",
49
49
  "@atlaskit/portal": "^4.4.0",
50
50
  "@atlaskit/theme": "^12.7.0",
51
- "@atlaskit/tokens": "^1.43.0",
51
+ "@atlaskit/tokens": "^1.44.0",
52
52
  "@babel/runtime": "^7.0.0",
53
53
  "@emotion/react": "^11.7.1",
54
54
  "bind-event-listener": "^3.0.0",