@atlaskit/tooltip 20.12.0 → 20.13.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 +14 -0
- package/dist/cjs/internal/tooltip-manager.js +2 -1
- package/dist/cjs/tooltip.js +8 -4
- package/dist/es2019/internal/tooltip-manager.js +2 -1
- package/dist/es2019/tooltip.js +7 -4
- package/dist/esm/internal/tooltip-manager.js +2 -1
- package/dist/esm/tooltip.js +8 -4
- package/dist/types/internal/tooltip-manager.d.ts +1 -0
- package/dist/types/tooltip.d.ts +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types-ts4.5/internal/tooltip-manager.d.ts +1 -0
- package/dist/types-ts4.5/tooltip.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/tooltip
|
|
2
2
|
|
|
3
|
+
## 20.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`05a04a1bfd2f9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05a04a1bfd2f9) -
|
|
8
|
+
Adds the experimental `UNSAFE_shouldAlwaysFadeIn` prop behind the
|
|
9
|
+
`platform_dst_nav4_side_nav_resize_tooltip_feedback` feature gate. When used, the tooltip will
|
|
10
|
+
always use the fade in animation, and never use the show immediate behaviour, even when another
|
|
11
|
+
tooltip is already visible.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 20.12.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -100,7 +100,8 @@ function show(entry) {
|
|
|
100
100
|
return null;
|
|
101
101
|
}
|
|
102
102
|
function start() {
|
|
103
|
-
var
|
|
103
|
+
var shouldAlwaysFadeIn = (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? entry.shouldAlwaysFadeIn : false;
|
|
104
|
+
var showImmediately = Boolean(active && active.isVisible()) && !shouldAlwaysFadeIn;
|
|
104
105
|
|
|
105
106
|
// If there was an active tooltip; we tell it to remove itself at once!
|
|
106
107
|
if (active) {
|
package/dist/cjs/tooltip.js
CHANGED
|
@@ -90,7 +90,9 @@ function Tooltip(_ref) {
|
|
|
90
90
|
ignoreTooltipPointerEvents = _ref$ignoreTooltipPoi === void 0 ? false : _ref$ignoreTooltipPoi,
|
|
91
91
|
_ref$isScreenReaderAn = _ref.isScreenReaderAnnouncementDisabled,
|
|
92
92
|
isScreenReaderAnnouncementDisabled = _ref$isScreenReaderAn === void 0 ? false : _ref$isScreenReaderAn,
|
|
93
|
-
shortcut = _ref.shortcut
|
|
93
|
+
shortcut = _ref.shortcut,
|
|
94
|
+
_ref$UNSAFE_shouldAlw = _ref.UNSAFE_shouldAlwaysFadeIn,
|
|
95
|
+
shouldAlwaysFadeIn = _ref$UNSAFE_shouldAlw === void 0 ? false : _ref$UNSAFE_shouldAlw;
|
|
94
96
|
// Not using a gate for this check. When the gate is disabled `mouse-y` and `mouse-x` are treated as `mouse`.
|
|
95
97
|
var isMousePosition = position === 'mouse' || position === 'mouse-y' || position === 'mouse-x';
|
|
96
98
|
var tooltipPosition = isMousePosition ? mousePosition : position;
|
|
@@ -134,6 +136,7 @@ function Tooltip(_ref) {
|
|
|
134
136
|
var delayStable = (0, _useStableRef.default)(delay);
|
|
135
137
|
var canAppearStable = (0, _useStableRef.default)(canAppear);
|
|
136
138
|
var hasCalledShowHandler = (0, _react.useRef)(false);
|
|
139
|
+
var shouldAlwaysFadeInStable = (0, _useStableRef.default)(shouldAlwaysFadeIn);
|
|
137
140
|
var start = (0, _react.useCallback)(function (api) {
|
|
138
141
|
// @ts-ignore
|
|
139
142
|
apiRef.current = api;
|
|
@@ -246,7 +249,7 @@ function Tooltip(_ref) {
|
|
|
246
249
|
hasCalledShowHandler.current = true;
|
|
247
250
|
onShowHandlerStable.current();
|
|
248
251
|
}
|
|
249
|
-
setState(isImmediate ? '
|
|
252
|
+
setState(!isImmediate ? 'fade-in' : 'show-immediate');
|
|
250
253
|
},
|
|
251
254
|
hide: function hide(_ref4) {
|
|
252
255
|
var isImmediate = _ref4.isImmediate;
|
|
@@ -256,11 +259,12 @@ function Tooltip(_ref) {
|
|
|
256
259
|
setState('before-fade-out');
|
|
257
260
|
}
|
|
258
261
|
},
|
|
259
|
-
done: done
|
|
262
|
+
done: done,
|
|
263
|
+
shouldAlwaysFadeIn: (0, _platformFeatureFlags.fg)('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? shouldAlwaysFadeInStable.current : false
|
|
260
264
|
};
|
|
261
265
|
var api = (0, _tooltipManager.show)(entry);
|
|
262
266
|
start(api);
|
|
263
|
-
}, [canAppearStable, delayStable, done, start, abort, onShowHandlerStable]);
|
|
267
|
+
}, [canAppearStable, delayStable, done, start, abort, onShowHandlerStable, shouldAlwaysFadeInStable]);
|
|
264
268
|
var hideTooltipOnEsc = (0, _react.useCallback)(function () {
|
|
265
269
|
var _apiRef$current2;
|
|
266
270
|
(_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 || _apiRef$current2.requestHide({
|
|
@@ -96,7 +96,8 @@ export function show(entry) {
|
|
|
96
96
|
return null;
|
|
97
97
|
}
|
|
98
98
|
function start() {
|
|
99
|
-
const
|
|
99
|
+
const shouldAlwaysFadeIn = fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? entry.shouldAlwaysFadeIn : false;
|
|
100
|
+
const showImmediately = Boolean(active && active.isVisible()) && !shouldAlwaysFadeIn;
|
|
100
101
|
|
|
101
102
|
// If there was an active tooltip; we tell it to remove itself at once!
|
|
102
103
|
if (active) {
|
package/dist/es2019/tooltip.js
CHANGED
|
@@ -63,7 +63,8 @@ function Tooltip({
|
|
|
63
63
|
strategy = 'fixed',
|
|
64
64
|
ignoreTooltipPointerEvents = false,
|
|
65
65
|
isScreenReaderAnnouncementDisabled = false,
|
|
66
|
-
shortcut
|
|
66
|
+
shortcut,
|
|
67
|
+
UNSAFE_shouldAlwaysFadeIn: shouldAlwaysFadeIn = false
|
|
67
68
|
}) {
|
|
68
69
|
// Not using a gate for this check. When the gate is disabled `mouse-y` and `mouse-x` are treated as `mouse`.
|
|
69
70
|
const isMousePosition = position === 'mouse' || position === 'mouse-y' || position === 'mouse-x';
|
|
@@ -107,6 +108,7 @@ function Tooltip({
|
|
|
107
108
|
const delayStable = useStableRef(delay);
|
|
108
109
|
const canAppearStable = useStableRef(canAppear);
|
|
109
110
|
const hasCalledShowHandler = useRef(false);
|
|
111
|
+
const shouldAlwaysFadeInStable = useStableRef(shouldAlwaysFadeIn);
|
|
110
112
|
const start = useCallback(api => {
|
|
111
113
|
// @ts-ignore
|
|
112
114
|
apiRef.current = api;
|
|
@@ -221,7 +223,7 @@ function Tooltip({
|
|
|
221
223
|
hasCalledShowHandler.current = true;
|
|
222
224
|
onShowHandlerStable.current();
|
|
223
225
|
}
|
|
224
|
-
setState(isImmediate ? '
|
|
226
|
+
setState(!isImmediate ? 'fade-in' : 'show-immediate');
|
|
225
227
|
},
|
|
226
228
|
hide: ({
|
|
227
229
|
isImmediate
|
|
@@ -232,11 +234,12 @@ function Tooltip({
|
|
|
232
234
|
setState('before-fade-out');
|
|
233
235
|
}
|
|
234
236
|
},
|
|
235
|
-
done
|
|
237
|
+
done,
|
|
238
|
+
shouldAlwaysFadeIn: fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? shouldAlwaysFadeInStable.current : false
|
|
236
239
|
};
|
|
237
240
|
const api = show(entry);
|
|
238
241
|
start(api);
|
|
239
|
-
}, [canAppearStable, delayStable, done, start, abort, onShowHandlerStable]);
|
|
242
|
+
}, [canAppearStable, delayStable, done, start, abort, onShowHandlerStable, shouldAlwaysFadeInStable]);
|
|
240
243
|
const hideTooltipOnEsc = useCallback(() => {
|
|
241
244
|
var _apiRef$current2;
|
|
242
245
|
(_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 ? void 0 : _apiRef$current2.requestHide({
|
|
@@ -95,7 +95,8 @@ export function show(entry) {
|
|
|
95
95
|
return null;
|
|
96
96
|
}
|
|
97
97
|
function start() {
|
|
98
|
-
var
|
|
98
|
+
var shouldAlwaysFadeIn = fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? entry.shouldAlwaysFadeIn : false;
|
|
99
|
+
var showImmediately = Boolean(active && active.isVisible()) && !shouldAlwaysFadeIn;
|
|
99
100
|
|
|
100
101
|
// If there was an active tooltip; we tell it to remove itself at once!
|
|
101
102
|
if (active) {
|
package/dist/esm/tooltip.js
CHANGED
|
@@ -81,7 +81,9 @@ function Tooltip(_ref) {
|
|
|
81
81
|
ignoreTooltipPointerEvents = _ref$ignoreTooltipPoi === void 0 ? false : _ref$ignoreTooltipPoi,
|
|
82
82
|
_ref$isScreenReaderAn = _ref.isScreenReaderAnnouncementDisabled,
|
|
83
83
|
isScreenReaderAnnouncementDisabled = _ref$isScreenReaderAn === void 0 ? false : _ref$isScreenReaderAn,
|
|
84
|
-
shortcut = _ref.shortcut
|
|
84
|
+
shortcut = _ref.shortcut,
|
|
85
|
+
_ref$UNSAFE_shouldAlw = _ref.UNSAFE_shouldAlwaysFadeIn,
|
|
86
|
+
shouldAlwaysFadeIn = _ref$UNSAFE_shouldAlw === void 0 ? false : _ref$UNSAFE_shouldAlw;
|
|
85
87
|
// Not using a gate for this check. When the gate is disabled `mouse-y` and `mouse-x` are treated as `mouse`.
|
|
86
88
|
var isMousePosition = position === 'mouse' || position === 'mouse-y' || position === 'mouse-x';
|
|
87
89
|
var tooltipPosition = isMousePosition ? mousePosition : position;
|
|
@@ -125,6 +127,7 @@ function Tooltip(_ref) {
|
|
|
125
127
|
var delayStable = useStableRef(delay);
|
|
126
128
|
var canAppearStable = useStableRef(canAppear);
|
|
127
129
|
var hasCalledShowHandler = useRef(false);
|
|
130
|
+
var shouldAlwaysFadeInStable = useStableRef(shouldAlwaysFadeIn);
|
|
128
131
|
var start = useCallback(function (api) {
|
|
129
132
|
// @ts-ignore
|
|
130
133
|
apiRef.current = api;
|
|
@@ -237,7 +240,7 @@ function Tooltip(_ref) {
|
|
|
237
240
|
hasCalledShowHandler.current = true;
|
|
238
241
|
onShowHandlerStable.current();
|
|
239
242
|
}
|
|
240
|
-
setState(isImmediate ? '
|
|
243
|
+
setState(!isImmediate ? 'fade-in' : 'show-immediate');
|
|
241
244
|
},
|
|
242
245
|
hide: function hide(_ref4) {
|
|
243
246
|
var isImmediate = _ref4.isImmediate;
|
|
@@ -247,11 +250,12 @@ function Tooltip(_ref) {
|
|
|
247
250
|
setState('before-fade-out');
|
|
248
251
|
}
|
|
249
252
|
},
|
|
250
|
-
done: done
|
|
253
|
+
done: done,
|
|
254
|
+
shouldAlwaysFadeIn: fg('platform_dst_nav4_side_nav_resize_tooltip_feedback') ? shouldAlwaysFadeInStable.current : false
|
|
251
255
|
};
|
|
252
256
|
var api = show(entry);
|
|
253
257
|
start(api);
|
|
254
|
-
}, [canAppearStable, delayStable, done, start, abort, onShowHandlerStable]);
|
|
258
|
+
}, [canAppearStable, delayStable, done, start, abort, onShowHandlerStable, shouldAlwaysFadeInStable]);
|
|
255
259
|
var hideTooltipOnEsc = useCallback(function () {
|
|
256
260
|
var _apiRef$current2;
|
|
257
261
|
(_apiRef$current2 = apiRef.current) === null || _apiRef$current2 === void 0 || _apiRef$current2.requestHide({
|
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, }: 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, }: TooltipProps): React.JSX.Element;
|
|
9
9
|
export default Tooltip;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -140,4 +140,10 @@ export interface TooltipProps {
|
|
|
140
140
|
* Keys will be displayed as individual keyboard key segments after the tooltip content.
|
|
141
141
|
*/
|
|
142
142
|
shortcut?: string[];
|
|
143
|
+
/**
|
|
144
|
+
* When set to true, the tooltip will always use the fade-in animation
|
|
145
|
+
* and never use the show-immediate behavior, even when another tooltip
|
|
146
|
+
* is already visible.
|
|
147
|
+
*/
|
|
148
|
+
UNSAFE_shouldAlwaysFadeIn?: boolean;
|
|
143
149
|
}
|
|
@@ -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, }: 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, }: TooltipProps): React.JSX.Element;
|
|
9
9
|
export default Tooltip;
|
|
@@ -140,4 +140,10 @@ export interface TooltipProps {
|
|
|
140
140
|
* Keys will be displayed as individual keyboard key segments after the tooltip content.
|
|
141
141
|
*/
|
|
142
142
|
shortcut?: string[];
|
|
143
|
+
/**
|
|
144
|
+
* When set to true, the tooltip will always use the fade-in animation
|
|
145
|
+
* and never use the show-immediate behavior, even when another tooltip
|
|
146
|
+
* is already visible.
|
|
147
|
+
*/
|
|
148
|
+
UNSAFE_shouldAlwaysFadeIn?: boolean;
|
|
143
149
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tooltip",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.13.0",
|
|
4
4
|
"description": "A tooltip describes an interactive element on mouse hover or keyboard focus.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@atlaskit/motion": "^5.3.0",
|
|
39
39
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
40
40
|
"@atlaskit/popper": "^7.1.0",
|
|
41
|
-
"@atlaskit/portal": "^5.
|
|
41
|
+
"@atlaskit/portal": "^5.2.0",
|
|
42
42
|
"@atlaskit/theme": "^21.0.0",
|
|
43
43
|
"@atlaskit/tokens": "^9.1.0",
|
|
44
44
|
"@babel/runtime": "^7.0.0",
|
|
@@ -57,13 +57,14 @@
|
|
|
57
57
|
"@atlaskit/button": "^23.9.0",
|
|
58
58
|
"@atlaskit/css": "^0.19.0",
|
|
59
59
|
"@atlaskit/docs": "^11.2.0",
|
|
60
|
-
"@atlaskit/icon": "^29.
|
|
60
|
+
"@atlaskit/icon": "^29.4.0",
|
|
61
61
|
"@atlaskit/link": "^3.3.0",
|
|
62
62
|
"@atlaskit/primitives": "^17.0.0",
|
|
63
|
-
"@atlaskit/section-message": "^8.
|
|
63
|
+
"@atlaskit/section-message": "^8.12.0",
|
|
64
|
+
"@atlassian/feature-flags-test-utils": "^1.0.0",
|
|
64
65
|
"@atlassian/ssr-tests": "workspace:^",
|
|
65
66
|
"@atlassian/testing-library": "^0.4.0",
|
|
66
|
-
"@testing-library/react": "^
|
|
67
|
+
"@testing-library/react": "^16.3.0",
|
|
67
68
|
"react-dom": "^18.2.0",
|
|
68
69
|
"tiny-invariant": "^1.2.0"
|
|
69
70
|
},
|