@atlaskit/tooltip 17.8.8 → 17.8.10
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 +13 -0
- package/dist/cjs/Tooltip.js +18 -19
- package/dist/es2019/Tooltip.js +18 -19
- package/dist/esm/Tooltip.js +18 -19
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/tooltip
|
|
2
2
|
|
|
3
|
+
## 17.8.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42577](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42577) [`d51b45b02fb`](https://bitbucket.org/atlassian/atlassian-frontend/commits/d51b45b02fb) - Add component to push model consumption in JFE
|
|
8
|
+
|
|
9
|
+
## 17.8.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#42475](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42475) [`c93c86d4089`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c93c86d4089) - Tooltip no longer throws in an effect when the first child of tooltip isn't an element.
|
|
14
|
+
- [#42475](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42475) [`61779a58ad8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/61779a58ad8) - Tooltip nolonger memoizes the ref callback function for the implicit passing-children-jsx API. The children-as-function API remains memoized. For more control and better performance characteristics we recommend leaning on the explicit children-as-function API over the implicit passing-children-jsx API.
|
|
15
|
+
|
|
3
16
|
## 17.8.8
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/cjs/Tooltip.js
CHANGED
|
@@ -32,7 +32,7 @@ var tooltipZIndex = _constants.layers.tooltip();
|
|
|
32
32
|
var analyticsAttributes = {
|
|
33
33
|
componentName: 'tooltip',
|
|
34
34
|
packageName: "@atlaskit/tooltip",
|
|
35
|
-
packageVersion: "17.8.
|
|
35
|
+
packageVersion: "17.8.10"
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// Inverts motion direction
|
|
@@ -97,18 +97,18 @@ function Tooltip(_ref) {
|
|
|
97
97
|
setState = _useState2[1];
|
|
98
98
|
var targetRef = (0, _react.useRef)(null);
|
|
99
99
|
var containerRef = (0, _react.useRef)(null);
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}, [
|
|
100
|
+
|
|
101
|
+
// This function is deliberately _not_ memoized as it needs to re-run every render
|
|
102
|
+
// to pick up any child ref changes. If you use render props you don't have this issue.
|
|
103
|
+
var setImplicitRefFromChildren = function setImplicitRefFromChildren(node) {
|
|
104
|
+
containerRef.current = node;
|
|
105
|
+
targetRef.current = node ? node.firstElementChild : null;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// This is memoized and passed into the render props callback.
|
|
109
|
+
var setDirectRef = (0, _react.useCallback)(function (node) {
|
|
110
|
+
targetRef.current = node;
|
|
111
|
+
}, []);
|
|
112
112
|
|
|
113
113
|
// Putting a few things into refs so that we don't have to break memoization
|
|
114
114
|
var lastState = (0, _react.useRef)(state);
|
|
@@ -355,8 +355,7 @@ function Tooltip(_ref) {
|
|
|
355
355
|
onMouseDown: onMouseDown,
|
|
356
356
|
onClick: onClick,
|
|
357
357
|
onFocus: onFocus,
|
|
358
|
-
onBlur: onBlur
|
|
359
|
-
ref: setRef
|
|
358
|
+
onBlur: onBlur
|
|
360
359
|
};
|
|
361
360
|
|
|
362
361
|
// Don't set `data-testid` unless it's defined, as it's not in the interface.
|
|
@@ -375,8 +374,6 @@ function Tooltip(_ref) {
|
|
|
375
374
|
if (!containerRef.current || !targetRef.current || !tooltipId) {
|
|
376
375
|
return;
|
|
377
376
|
}
|
|
378
|
-
|
|
379
|
-
// Necessary for TS to know that it has the attribute methods
|
|
380
377
|
var target = targetRef.current;
|
|
381
378
|
if (shouldRenderTooltipContainer) {
|
|
382
379
|
target.setAttribute('aria-describedby', tooltipId);
|
|
@@ -389,8 +386,10 @@ function Tooltip(_ref) {
|
|
|
389
386
|
// attribute back into the tooltipTriggerProps and make it required
|
|
390
387
|
// instead of optional in `types`
|
|
391
388
|
children(_objectSpread(_objectSpread({}, tooltipTriggerProps), {}, {
|
|
392
|
-
'aria-describedby': tooltipId
|
|
389
|
+
'aria-describedby': tooltipId,
|
|
390
|
+
ref: setDirectRef
|
|
393
391
|
})) : (0, _react2.jsx)(CastTargetContainer, (0, _extends2.default)({}, tooltipTriggerProps, {
|
|
392
|
+
ref: setImplicitRefFromChildren,
|
|
394
393
|
role: "presentation"
|
|
395
394
|
}), children), shouldRenderTooltipContainer ? (0, _react2.jsx)(_portal.default, {
|
|
396
395
|
zIndex: tooltipZIndex
|
|
@@ -427,7 +426,7 @@ function Tooltip(_ref) {
|
|
|
427
426
|
style: style,
|
|
428
427
|
truncate: truncate,
|
|
429
428
|
placement: tooltipPosition,
|
|
430
|
-
testId: testId,
|
|
429
|
+
testId: getReferenceElement() ? testId : testId && "".concat(testId, "--unresolved"),
|
|
431
430
|
onMouseOut: onMouseOut,
|
|
432
431
|
onMouseOver: onMouseOverTooltip,
|
|
433
432
|
id: tooltipId
|
package/dist/es2019/Tooltip.js
CHANGED
|
@@ -20,7 +20,7 @@ const tooltipZIndex = layers.tooltip();
|
|
|
20
20
|
const analyticsAttributes = {
|
|
21
21
|
componentName: 'tooltip',
|
|
22
22
|
packageName: "@atlaskit/tooltip",
|
|
23
|
-
packageVersion: "17.8.
|
|
23
|
+
packageVersion: "17.8.10"
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
// Inverts motion direction
|
|
@@ -72,18 +72,18 @@ function Tooltip({
|
|
|
72
72
|
const [state, setState] = useState('hide');
|
|
73
73
|
const targetRef = useRef(null);
|
|
74
74
|
const containerRef = useRef(null);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [
|
|
75
|
+
|
|
76
|
+
// This function is deliberately _not_ memoized as it needs to re-run every render
|
|
77
|
+
// to pick up any child ref changes. If you use render props you don't have this issue.
|
|
78
|
+
const setImplicitRefFromChildren = node => {
|
|
79
|
+
containerRef.current = node;
|
|
80
|
+
targetRef.current = node ? node.firstElementChild : null;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// This is memoized and passed into the render props callback.
|
|
84
|
+
const setDirectRef = useCallback(node => {
|
|
85
|
+
targetRef.current = node;
|
|
86
|
+
}, []);
|
|
87
87
|
|
|
88
88
|
// Putting a few things into refs so that we don't have to break memoization
|
|
89
89
|
const lastState = useRef(state);
|
|
@@ -332,8 +332,7 @@ function Tooltip({
|
|
|
332
332
|
onMouseDown,
|
|
333
333
|
onClick,
|
|
334
334
|
onFocus,
|
|
335
|
-
onBlur
|
|
336
|
-
ref: setRef
|
|
335
|
+
onBlur
|
|
337
336
|
};
|
|
338
337
|
|
|
339
338
|
// Don't set `data-testid` unless it's defined, as it's not in the interface.
|
|
@@ -352,8 +351,6 @@ function Tooltip({
|
|
|
352
351
|
if (!containerRef.current || !targetRef.current || !tooltipId) {
|
|
353
352
|
return;
|
|
354
353
|
}
|
|
355
|
-
|
|
356
|
-
// Necessary for TS to know that it has the attribute methods
|
|
357
354
|
const target = targetRef.current;
|
|
358
355
|
if (shouldRenderTooltipContainer) {
|
|
359
356
|
target.setAttribute('aria-describedby', tooltipId);
|
|
@@ -367,8 +364,10 @@ function Tooltip({
|
|
|
367
364
|
// instead of optional in `types`
|
|
368
365
|
children({
|
|
369
366
|
...tooltipTriggerProps,
|
|
370
|
-
'aria-describedby': tooltipId
|
|
367
|
+
'aria-describedby': tooltipId,
|
|
368
|
+
ref: setDirectRef
|
|
371
369
|
}) : jsx(CastTargetContainer, _extends({}, tooltipTriggerProps, {
|
|
370
|
+
ref: setImplicitRefFromChildren,
|
|
372
371
|
role: "presentation"
|
|
373
372
|
}), children), shouldRenderTooltipContainer ? jsx(Portal, {
|
|
374
373
|
zIndex: tooltipZIndex
|
|
@@ -406,7 +405,7 @@ function Tooltip({
|
|
|
406
405
|
style: style,
|
|
407
406
|
truncate: truncate,
|
|
408
407
|
placement: tooltipPosition,
|
|
409
|
-
testId: testId
|
|
408
|
+
testId: getReferenceElement() ? testId : testId && `${testId}--unresolved`,
|
|
410
409
|
onMouseOut: onMouseOut,
|
|
411
410
|
onMouseOver: onMouseOverTooltip,
|
|
412
411
|
id: tooltipId
|
package/dist/esm/Tooltip.js
CHANGED
|
@@ -24,7 +24,7 @@ var tooltipZIndex = layers.tooltip();
|
|
|
24
24
|
var analyticsAttributes = {
|
|
25
25
|
componentName: 'tooltip',
|
|
26
26
|
packageName: "@atlaskit/tooltip",
|
|
27
|
-
packageVersion: "17.8.
|
|
27
|
+
packageVersion: "17.8.10"
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
// Inverts motion direction
|
|
@@ -89,18 +89,18 @@ function Tooltip(_ref) {
|
|
|
89
89
|
setState = _useState2[1];
|
|
90
90
|
var targetRef = useRef(null);
|
|
91
91
|
var containerRef = useRef(null);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, [
|
|
92
|
+
|
|
93
|
+
// This function is deliberately _not_ memoized as it needs to re-run every render
|
|
94
|
+
// to pick up any child ref changes. If you use render props you don't have this issue.
|
|
95
|
+
var setImplicitRefFromChildren = function setImplicitRefFromChildren(node) {
|
|
96
|
+
containerRef.current = node;
|
|
97
|
+
targetRef.current = node ? node.firstElementChild : null;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
// This is memoized and passed into the render props callback.
|
|
101
|
+
var setDirectRef = useCallback(function (node) {
|
|
102
|
+
targetRef.current = node;
|
|
103
|
+
}, []);
|
|
104
104
|
|
|
105
105
|
// Putting a few things into refs so that we don't have to break memoization
|
|
106
106
|
var lastState = useRef(state);
|
|
@@ -347,8 +347,7 @@ function Tooltip(_ref) {
|
|
|
347
347
|
onMouseDown: onMouseDown,
|
|
348
348
|
onClick: onClick,
|
|
349
349
|
onFocus: onFocus,
|
|
350
|
-
onBlur: onBlur
|
|
351
|
-
ref: setRef
|
|
350
|
+
onBlur: onBlur
|
|
352
351
|
};
|
|
353
352
|
|
|
354
353
|
// Don't set `data-testid` unless it's defined, as it's not in the interface.
|
|
@@ -367,8 +366,6 @@ function Tooltip(_ref) {
|
|
|
367
366
|
if (!containerRef.current || !targetRef.current || !tooltipId) {
|
|
368
367
|
return;
|
|
369
368
|
}
|
|
370
|
-
|
|
371
|
-
// Necessary for TS to know that it has the attribute methods
|
|
372
369
|
var target = targetRef.current;
|
|
373
370
|
if (shouldRenderTooltipContainer) {
|
|
374
371
|
target.setAttribute('aria-describedby', tooltipId);
|
|
@@ -381,8 +378,10 @@ function Tooltip(_ref) {
|
|
|
381
378
|
// attribute back into the tooltipTriggerProps and make it required
|
|
382
379
|
// instead of optional in `types`
|
|
383
380
|
children(_objectSpread(_objectSpread({}, tooltipTriggerProps), {}, {
|
|
384
|
-
'aria-describedby': tooltipId
|
|
381
|
+
'aria-describedby': tooltipId,
|
|
382
|
+
ref: setDirectRef
|
|
385
383
|
})) : jsx(CastTargetContainer, _extends({}, tooltipTriggerProps, {
|
|
384
|
+
ref: setImplicitRefFromChildren,
|
|
386
385
|
role: "presentation"
|
|
387
386
|
}), children), shouldRenderTooltipContainer ? jsx(Portal, {
|
|
388
387
|
zIndex: tooltipZIndex
|
|
@@ -419,7 +418,7 @@ function Tooltip(_ref) {
|
|
|
419
418
|
style: style,
|
|
420
419
|
truncate: truncate,
|
|
421
420
|
placement: tooltipPosition,
|
|
422
|
-
testId: testId,
|
|
421
|
+
testId: getReferenceElement() ? testId : testId && "".concat(testId, "--unresolved"),
|
|
423
422
|
onMouseOut: onMouseOut,
|
|
424
423
|
onMouseOver: onMouseOverTooltip,
|
|
425
424
|
id: tooltipId
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tooltip",
|
|
3
|
-
"version": "17.8.
|
|
3
|
+
"version": "17.8.10",
|
|
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/"
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.ts",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Design System Team",
|
|
27
|
+
"productPushConsumption": [
|
|
28
|
+
"jira"
|
|
29
|
+
],
|
|
27
30
|
"releaseModel": "continuous",
|
|
28
31
|
"website": {
|
|
29
32
|
"name": "Tooltip",
|
|
@@ -43,9 +46,9 @@
|
|
|
43
46
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
44
47
|
"@atlaskit/motion": "^1.5.0",
|
|
45
48
|
"@atlaskit/popper": "^5.5.0",
|
|
46
|
-
"@atlaskit/portal": "^4.
|
|
49
|
+
"@atlaskit/portal": "^4.4.0",
|
|
47
50
|
"@atlaskit/theme": "^12.6.0",
|
|
48
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.28.0",
|
|
49
52
|
"@babel/runtime": "^7.0.0",
|
|
50
53
|
"@emotion/react": "^11.7.1",
|
|
51
54
|
"bind-event-listener": "^2.1.1",
|
|
@@ -57,13 +60,14 @@
|
|
|
57
60
|
},
|
|
58
61
|
"devDependencies": {
|
|
59
62
|
"@af/accessibility-testing": "*",
|
|
60
|
-
"@atlaskit/button": "^16.
|
|
63
|
+
"@atlaskit/button": "^16.13.0",
|
|
61
64
|
"@atlaskit/ssr": "*",
|
|
62
65
|
"@atlaskit/visual-regression": "*",
|
|
63
66
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
64
67
|
"@emotion/styled": "^11.0.0",
|
|
65
68
|
"@testing-library/dom": "^8.17.1",
|
|
66
69
|
"@testing-library/react": "^12.1.5",
|
|
70
|
+
"@types/react-redux": "^5.0.0",
|
|
67
71
|
"jest-in-case": "^1.0.2",
|
|
68
72
|
"react-dom": "^16.8.0",
|
|
69
73
|
"react-redux": "^5.1.2",
|