@atlaskit/tooltip 20.13.0 → 20.14.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 +9 -0
- package/dist/cjs/tooltip.js +13 -6
- package/dist/es2019/tooltip.js +14 -7
- package/dist/esm/tooltip.js +14 -7
- package/dist/types/tooltip.d.ts +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types-ts4.5/tooltip.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/tooltip
|
|
2
2
|
|
|
3
|
+
## 20.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`9cb76d1d2b1a0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9cb76d1d2b1a0) -
|
|
8
|
+
Adds `UNSAFE_shouldRenderToParent` prop behind the
|
|
9
|
+
`platform_dst_nav4_side_nav_resize_tooltip_feedback` feature gate. When enabled the tooltip will
|
|
10
|
+
be rendered as a sibling instead of in a portal.
|
|
11
|
+
|
|
3
12
|
## 20.13.0
|
|
4
13
|
|
|
5
14
|
### Minor Changes
|
package/dist/cjs/tooltip.js
CHANGED
|
@@ -33,7 +33,7 @@ var tooltipZIndex = _constants.layers.tooltip();
|
|
|
33
33
|
var analyticsAttributes = {
|
|
34
34
|
componentName: 'tooltip',
|
|
35
35
|
packageName: "@atlaskit/tooltip",
|
|
36
|
-
packageVersion: "
|
|
36
|
+
packageVersion: "20.13.0"
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
// Inverts motion direction
|
|
@@ -92,7 +92,9 @@ function Tooltip(_ref) {
|
|
|
92
92
|
isScreenReaderAnnouncementDisabled = _ref$isScreenReaderAn === void 0 ? false : _ref$isScreenReaderAn,
|
|
93
93
|
shortcut = _ref.shortcut,
|
|
94
94
|
_ref$UNSAFE_shouldAlw = _ref.UNSAFE_shouldAlwaysFadeIn,
|
|
95
|
-
shouldAlwaysFadeIn = _ref$UNSAFE_shouldAlw === void 0 ? false : _ref$UNSAFE_shouldAlw
|
|
95
|
+
shouldAlwaysFadeIn = _ref$UNSAFE_shouldAlw === void 0 ? false : _ref$UNSAFE_shouldAlw,
|
|
96
|
+
_ref$UNSAFE_shouldRen = _ref.UNSAFE_shouldRenderToParent,
|
|
97
|
+
UNSAFE_shouldRenderToParent = _ref$UNSAFE_shouldRen === void 0 ? false : _ref$UNSAFE_shouldRen;
|
|
96
98
|
// Not using a gate for this check. When the gate is disabled `mouse-y` and `mouse-x` are treated as `mouse`.
|
|
97
99
|
var isMousePosition = position === 'mouse' || position === 'mouse-y' || position === 'mouse-x';
|
|
98
100
|
var tooltipPosition = isMousePosition ? mousePosition : position;
|
|
@@ -503,6 +505,7 @@ function Tooltip(_ref) {
|
|
|
503
505
|
hidden: true,
|
|
504
506
|
id: tooltipIdForHiddenContent
|
|
505
507
|
}, typeof content === 'function' ? content({}) : content) : null;
|
|
508
|
+
var PopperWrapper = UNSAFE_shouldRenderToParent && (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? _react.Fragment : TooltipPortal;
|
|
506
509
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof children === 'function' ?
|
|
507
510
|
/*#__PURE__*/
|
|
508
511
|
// once we deprecate the wrapped approach, we can put the aria
|
|
@@ -523,9 +526,7 @@ function Tooltip(_ref) {
|
|
|
523
526
|
* - Should `role="presentation"` only be used if `shouldRenderHiddenContent == false`?
|
|
524
527
|
*/,
|
|
525
528
|
role: "presentation"
|
|
526
|
-
}), children, hiddenContent), shouldRenderTooltipPopup ? /*#__PURE__*/_react.default.createElement(
|
|
527
|
-
zIndex: tooltipZIndex
|
|
528
|
-
}, /*#__PURE__*/_react.default.createElement(_popper.Popper, {
|
|
529
|
+
}), children, hiddenContent), shouldRenderTooltipPopup ? /*#__PURE__*/_react.default.createElement(PopperWrapper, null, /*#__PURE__*/_react.default.createElement(_popper.Popper, {
|
|
529
530
|
placement: tooltipPosition,
|
|
530
531
|
referenceElement: getReferenceElement(),
|
|
531
532
|
strategy: strategy
|
|
@@ -572,4 +573,10 @@ function Tooltip(_ref) {
|
|
|
572
573
|
}));
|
|
573
574
|
})) : null);
|
|
574
575
|
}
|
|
575
|
-
var _default = exports.default = Tooltip;
|
|
576
|
+
var _default = exports.default = Tooltip;
|
|
577
|
+
var TooltipPortal = function TooltipPortal(_ref7) {
|
|
578
|
+
var children = _ref7.children;
|
|
579
|
+
return /*#__PURE__*/_react.default.createElement(_portal.default, {
|
|
580
|
+
zIndex: tooltipZIndex
|
|
581
|
+
}, children);
|
|
582
|
+
};
|
package/dist/es2019/tooltip.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { bind } from 'bind-event-listener';
|
|
4
4
|
import { usePlatformLeafSyntheticEventHandler } from '@atlaskit/analytics-next';
|
|
5
5
|
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: "
|
|
23
|
+
packageVersion: "20.13.0"
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// Inverts motion direction
|
|
@@ -64,7 +64,8 @@ function Tooltip({
|
|
|
64
64
|
ignoreTooltipPointerEvents = false,
|
|
65
65
|
isScreenReaderAnnouncementDisabled = false,
|
|
66
66
|
shortcut,
|
|
67
|
-
UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn = false
|
|
67
|
+
UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn = false,
|
|
68
|
+
UNSAFE_shouldRenderToParent = false
|
|
68
69
|
}) {
|
|
69
70
|
// Not using a gate for this check. When the gate is disabled `mouse-y` and `mouse-x` are treated as `mouse`.
|
|
70
71
|
const isMousePosition = position === 'mouse' || position === 'mouse-y' || position === 'mouse-x';
|
|
@@ -476,6 +477,7 @@ function Tooltip({
|
|
|
476
477
|
hidden: true,
|
|
477
478
|
id: tooltipIdForHiddenContent
|
|
478
479
|
}, typeof content === 'function' ? content({}) : content) : null;
|
|
480
|
+
const PopperWrapper = UNSAFE_shouldRenderToParent && fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? Fragment : TooltipPortal;
|
|
479
481
|
return /*#__PURE__*/React.createElement(React.Fragment, null, typeof children === 'function' ?
|
|
480
482
|
/*#__PURE__*/
|
|
481
483
|
// once we deprecate the wrapped approach, we can put the aria
|
|
@@ -497,9 +499,7 @@ function Tooltip({
|
|
|
497
499
|
* - Should `role="presentation"` only be used if `shouldRenderHiddenContent == false`?
|
|
498
500
|
*/,
|
|
499
501
|
role: "presentation"
|
|
500
|
-
}), children, hiddenContent), shouldRenderTooltipPopup ? /*#__PURE__*/React.createElement(
|
|
501
|
-
zIndex: tooltipZIndex
|
|
502
|
-
}, /*#__PURE__*/React.createElement(Popper, {
|
|
502
|
+
}), children, hiddenContent), shouldRenderTooltipPopup ? /*#__PURE__*/React.createElement(PopperWrapper, null, /*#__PURE__*/React.createElement(Popper, {
|
|
503
503
|
placement: tooltipPosition,
|
|
504
504
|
referenceElement: getReferenceElement(),
|
|
505
505
|
strategy: strategy
|
|
@@ -551,4 +551,11 @@ function Tooltip({
|
|
|
551
551
|
}) : content)));
|
|
552
552
|
})) : null);
|
|
553
553
|
}
|
|
554
|
-
export default Tooltip;
|
|
554
|
+
export default Tooltip;
|
|
555
|
+
const TooltipPortal = ({
|
|
556
|
+
children
|
|
557
|
+
}) => {
|
|
558
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
|
559
|
+
zIndex: tooltipZIndex
|
|
560
|
+
}, children);
|
|
561
|
+
};
|
package/dist/esm/tooltip.js
CHANGED
|
@@ -3,7 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
6
|
+
import React, { Fragment, useCallback, useEffect, useRef, useState } from 'react';
|
|
7
7
|
import { bind } from 'bind-event-listener';
|
|
8
8
|
import { usePlatformLeafSyntheticEventHandler } from '@atlaskit/analytics-next';
|
|
9
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -24,7 +24,7 @@ var tooltipZIndex = layers.tooltip();
|
|
|
24
24
|
var analyticsAttributes = {
|
|
25
25
|
componentName: 'tooltip',
|
|
26
26
|
packageName: "@atlaskit/tooltip",
|
|
27
|
-
packageVersion: "
|
|
27
|
+
packageVersion: "20.13.0"
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// Inverts motion direction
|
|
@@ -83,7 +83,9 @@ function Tooltip(_ref) {
|
|
|
83
83
|
isScreenReaderAnnouncementDisabled = _ref$isScreenReaderAn === void 0 ? false : _ref$isScreenReaderAn,
|
|
84
84
|
shortcut = _ref.shortcut,
|
|
85
85
|
_ref$UNSAFE_shouldAlw = _ref.UNSAFE_shouldAlwaysFadeIn,
|
|
86
|
-
shouldAlwaysFadeIn = _ref$UNSAFE_shouldAlw === void 0 ? false : _ref$UNSAFE_shouldAlw
|
|
86
|
+
shouldAlwaysFadeIn = _ref$UNSAFE_shouldAlw === void 0 ? false : _ref$UNSAFE_shouldAlw,
|
|
87
|
+
_ref$UNSAFE_shouldRen = _ref.UNSAFE_shouldRenderToParent,
|
|
88
|
+
UNSAFE_shouldRenderToParent = _ref$UNSAFE_shouldRen === void 0 ? false : _ref$UNSAFE_shouldRen;
|
|
87
89
|
// Not using a gate for this check. When the gate is disabled `mouse-y` and `mouse-x` are treated as `mouse`.
|
|
88
90
|
var isMousePosition = position === 'mouse' || position === 'mouse-y' || position === 'mouse-x';
|
|
89
91
|
var tooltipPosition = isMousePosition ? mousePosition : position;
|
|
@@ -494,6 +496,7 @@ function Tooltip(_ref) {
|
|
|
494
496
|
hidden: true,
|
|
495
497
|
id: tooltipIdForHiddenContent
|
|
496
498
|
}, typeof content === 'function' ? content({}) : content) : null;
|
|
499
|
+
var PopperWrapper = UNSAFE_shouldRenderToParent && fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? Fragment : TooltipPortal;
|
|
497
500
|
return /*#__PURE__*/React.createElement(React.Fragment, null, typeof children === 'function' ?
|
|
498
501
|
/*#__PURE__*/
|
|
499
502
|
// once we deprecate the wrapped approach, we can put the aria
|
|
@@ -514,9 +517,7 @@ function Tooltip(_ref) {
|
|
|
514
517
|
* - Should `role="presentation"` only be used if `shouldRenderHiddenContent == false`?
|
|
515
518
|
*/,
|
|
516
519
|
role: "presentation"
|
|
517
|
-
}), children, hiddenContent), shouldRenderTooltipPopup ? /*#__PURE__*/React.createElement(
|
|
518
|
-
zIndex: tooltipZIndex
|
|
519
|
-
}, /*#__PURE__*/React.createElement(Popper, {
|
|
520
|
+
}), children, hiddenContent), shouldRenderTooltipPopup ? /*#__PURE__*/React.createElement(PopperWrapper, null, /*#__PURE__*/React.createElement(Popper, {
|
|
520
521
|
placement: tooltipPosition,
|
|
521
522
|
referenceElement: getReferenceElement(),
|
|
522
523
|
strategy: strategy
|
|
@@ -563,4 +564,10 @@ function Tooltip(_ref) {
|
|
|
563
564
|
}));
|
|
564
565
|
})) : null);
|
|
565
566
|
}
|
|
566
|
-
export default Tooltip;
|
|
567
|
+
export default Tooltip;
|
|
568
|
+
var TooltipPortal = function TooltipPortal(_ref7) {
|
|
569
|
+
var children = _ref7.children;
|
|
570
|
+
return /*#__PURE__*/React.createElement(Portal, {
|
|
571
|
+
zIndex: tooltipZIndex
|
|
572
|
+
}, children);
|
|
573
|
+
};
|
package/dist/types/tooltip.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ import { type TooltipProps } from './types';
|
|
|
5
5
|
*
|
|
6
6
|
* A tooltip is a floating, non-actionable label used to explain a user interface element or feature.
|
|
7
7
|
*/
|
|
8
|
-
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, canAppear, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, ignoreTooltipPointerEvents, isScreenReaderAnnouncementDisabled, shortcut, UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn, }: TooltipProps): React.JSX.Element;
|
|
8
|
+
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, canAppear, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, ignoreTooltipPointerEvents, isScreenReaderAnnouncementDisabled, shortcut, UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn, UNSAFE_shouldRenderToParent, }: TooltipProps): React.JSX.Element;
|
|
9
9
|
export default Tooltip;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -146,4 +146,10 @@ export interface TooltipProps {
|
|
|
146
146
|
* is already visible.
|
|
147
147
|
*/
|
|
148
148
|
UNSAFE_shouldAlwaysFadeIn?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* When enabled, the tooltip will be rendered as a sibling to the trigger element instead of being portaled to the document body.
|
|
151
|
+
*
|
|
152
|
+
* This is an experimental prop and may be removed at any time. It is not yet intended for public use.
|
|
153
|
+
*/
|
|
154
|
+
UNSAFE_shouldRenderToParent?: boolean;
|
|
149
155
|
}
|
|
@@ -5,5 +5,5 @@ import { type TooltipProps } from './types';
|
|
|
5
5
|
*
|
|
6
6
|
* A tooltip is a floating, non-actionable label used to explain a user interface element or feature.
|
|
7
7
|
*/
|
|
8
|
-
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, canAppear, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, ignoreTooltipPointerEvents, isScreenReaderAnnouncementDisabled, shortcut, UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn, }: TooltipProps): React.JSX.Element;
|
|
8
|
+
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, canAppear, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, ignoreTooltipPointerEvents, isScreenReaderAnnouncementDisabled, shortcut, UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn, UNSAFE_shouldRenderToParent, }: TooltipProps): React.JSX.Element;
|
|
9
9
|
export default Tooltip;
|
|
@@ -146,4 +146,10 @@ export interface TooltipProps {
|
|
|
146
146
|
* is already visible.
|
|
147
147
|
*/
|
|
148
148
|
UNSAFE_shouldAlwaysFadeIn?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* When enabled, the tooltip will be rendered as a sibling to the trigger element instead of being portaled to the document body.
|
|
151
|
+
*
|
|
152
|
+
* This is an experimental prop and may be removed at any time. It is not yet intended for public use.
|
|
153
|
+
*/
|
|
154
|
+
UNSAFE_shouldRenderToParent?: boolean;
|
|
149
155
|
}
|
package/package.json
CHANGED