@atlaskit/tooltip 18.1.0 → 18.1.2
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/dist/cjs/Tooltip.js +17 -13
- package/dist/es2019/Tooltip.js +16 -14
- package/dist/esm/Tooltip.js +16 -14
- package/dist/types/Tooltip.d.ts +2 -3
- package/dist/types/types.d.ts +8 -8
- package/dist/types-ts4.5/Tooltip.d.ts +2 -3
- package/dist/types-ts4.5/types.d.ts +8 -8
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/tooltip
|
|
2
2
|
|
|
3
|
+
## 18.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#75714](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/75714) [`33f4a64132a3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/33f4a64132a3) - Remove duplicate accessible labels on Icon buttons, which were unnecessarily added through the `aria-label` attribute.
|
|
8
|
+
|
|
9
|
+
## 18.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#64251](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/64251) [`92b280e734a7`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/92b280e734a7) - Add a hidden tooltip content when tooltip is in a modal for screen reader announcement
|
|
14
|
+
|
|
3
15
|
## 18.1.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/Tooltip.js
CHANGED
|
@@ -10,7 +10,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _react2 = require("@emotion/react");
|
|
14
13
|
var _bindEventListener = require("bind-event-listener");
|
|
15
14
|
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
16
15
|
var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
|
|
@@ -28,12 +27,12 @@ var _utilities = require("./utilities");
|
|
|
28
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
28
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
29
|
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; }
|
|
31
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
30
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
32
31
|
var tooltipZIndex = _constants.layers.tooltip();
|
|
33
32
|
var analyticsAttributes = {
|
|
34
33
|
componentName: 'tooltip',
|
|
35
34
|
packageName: "@atlaskit/tooltip",
|
|
36
|
-
packageVersion: "18.1.
|
|
35
|
+
packageVersion: "18.1.2"
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
// Inverts motion direction
|
|
@@ -413,19 +412,25 @@ function Tooltip(_ref) {
|
|
|
413
412
|
target.removeAttribute('aria-describedby');
|
|
414
413
|
}
|
|
415
414
|
}, [shouldRenderTooltipContainer, tooltipId]);
|
|
416
|
-
|
|
415
|
+
var hiddenContent = /*#__PURE__*/_react.default.createElement("span", {
|
|
416
|
+
"data-testid": testId ? "".concat(testId, "-hidden") : undefined,
|
|
417
|
+
hidden: true,
|
|
418
|
+
id: tooltipId
|
|
419
|
+
}, typeof content === 'function' ? content({}) : content);
|
|
420
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, typeof children === 'function' ?
|
|
421
|
+
/*#__PURE__*/
|
|
417
422
|
// once we deprecate the wrapped approach, we can put the aria
|
|
418
423
|
// attribute back into the tooltipTriggerProps and make it required
|
|
419
424
|
// instead of optional in `types`
|
|
420
|
-
children(_objectSpread(_objectSpread({}, tooltipTriggerProps), {}, {
|
|
425
|
+
_react.default.createElement(_react.default.Fragment, null, children(_objectSpread(_objectSpread({}, tooltipTriggerProps), {}, {
|
|
421
426
|
'aria-describedby': tooltipId,
|
|
422
427
|
ref: setDirectRef
|
|
423
|
-
})) :
|
|
428
|
+
})), shouldRenderTooltipContainer && hiddenContent) : /*#__PURE__*/_react.default.createElement(CastTargetContainer, (0, _extends2.default)({}, tooltipTriggerProps, {
|
|
424
429
|
ref: setImplicitRefFromChildren,
|
|
425
430
|
role: "presentation"
|
|
426
|
-
}), children), shouldRenderTooltipContainer ?
|
|
431
|
+
}), children, shouldRenderTooltipContainer && hiddenContent), shouldRenderTooltipContainer ? /*#__PURE__*/_react.default.createElement(_portal.default, {
|
|
427
432
|
zIndex: tooltipZIndex
|
|
428
|
-
},
|
|
433
|
+
}, /*#__PURE__*/_react.default.createElement(_popper.Popper, {
|
|
429
434
|
placement: tooltipPosition,
|
|
430
435
|
referenceElement: getReferenceElement(),
|
|
431
436
|
strategy: strategy
|
|
@@ -438,9 +443,9 @@ function Tooltip(_ref) {
|
|
|
438
443
|
// E.g. a tooltip's position is on the 'right', it should enter from and exit to the 'left'
|
|
439
444
|
// This gives the effect the tooltip is appearing from the target
|
|
440
445
|
var direction = position === 'mouse' ? undefined : invertedDirection[getDirectionFromPlacement(placement)];
|
|
441
|
-
return
|
|
446
|
+
return /*#__PURE__*/_react.default.createElement(_motion.ExitingPersistence, {
|
|
442
447
|
appear: true
|
|
443
|
-
}, shouldRenderTooltipChildren &&
|
|
448
|
+
}, shouldRenderTooltipChildren && /*#__PURE__*/_react.default.createElement(_motion.FadeIn, {
|
|
444
449
|
distance: "constant",
|
|
445
450
|
entranceDirection: direction,
|
|
446
451
|
exitDirection: direction,
|
|
@@ -448,7 +453,7 @@ function Tooltip(_ref) {
|
|
|
448
453
|
duration: state === 'show-immediate' ? 0 : _durations.mediumDurationMs
|
|
449
454
|
}, function (_ref6) {
|
|
450
455
|
var className = _ref6.className;
|
|
451
|
-
return
|
|
456
|
+
return /*#__PURE__*/_react.default.createElement(Container, {
|
|
452
457
|
ref: ref
|
|
453
458
|
/**
|
|
454
459
|
* "Tooltip" classname is a hook used by tests to manipulate
|
|
@@ -460,8 +465,7 @@ function Tooltip(_ref) {
|
|
|
460
465
|
placement: tooltipPosition,
|
|
461
466
|
testId: getReferenceElement() ? testId : testId && "".concat(testId, "--unresolved"),
|
|
462
467
|
onMouseOut: onMouseOut,
|
|
463
|
-
onMouseOver: onMouseOverTooltip
|
|
464
|
-
id: tooltipId
|
|
468
|
+
onMouseOver: onMouseOverTooltip
|
|
465
469
|
}, typeof content === 'function' ? content({
|
|
466
470
|
update: update
|
|
467
471
|
}) : content);
|
package/dist/es2019/Tooltip.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
/** @jsx jsx */
|
|
3
|
-
|
|
4
2
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
-
import { jsx } from '@emotion/react';
|
|
6
3
|
import { bind } from 'bind-event-listener';
|
|
7
4
|
import { usePlatformLeafSyntheticEventHandler } from '@atlaskit/analytics-next';
|
|
8
5
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -21,7 +18,7 @@ const tooltipZIndex = layers.tooltip();
|
|
|
21
18
|
const analyticsAttributes = {
|
|
22
19
|
componentName: 'tooltip',
|
|
23
20
|
packageName: "@atlaskit/tooltip",
|
|
24
|
-
packageVersion: "18.1.
|
|
21
|
+
packageVersion: "18.1.2"
|
|
25
22
|
};
|
|
26
23
|
|
|
27
24
|
// Inverts motion direction
|
|
@@ -391,20 +388,26 @@ function Tooltip({
|
|
|
391
388
|
target.removeAttribute('aria-describedby');
|
|
392
389
|
}
|
|
393
390
|
}, [shouldRenderTooltipContainer, tooltipId]);
|
|
394
|
-
|
|
391
|
+
const hiddenContent = /*#__PURE__*/React.createElement("span", {
|
|
392
|
+
"data-testid": testId ? `${testId}-hidden` : undefined,
|
|
393
|
+
hidden: true,
|
|
394
|
+
id: tooltipId
|
|
395
|
+
}, typeof content === 'function' ? content({}) : content);
|
|
396
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, typeof children === 'function' ?
|
|
397
|
+
/*#__PURE__*/
|
|
395
398
|
// once we deprecate the wrapped approach, we can put the aria
|
|
396
399
|
// attribute back into the tooltipTriggerProps and make it required
|
|
397
400
|
// instead of optional in `types`
|
|
398
|
-
children({
|
|
401
|
+
React.createElement(React.Fragment, null, children({
|
|
399
402
|
...tooltipTriggerProps,
|
|
400
403
|
'aria-describedby': tooltipId,
|
|
401
404
|
ref: setDirectRef
|
|
402
|
-
}) :
|
|
405
|
+
}), shouldRenderTooltipContainer && hiddenContent) : /*#__PURE__*/React.createElement(CastTargetContainer, _extends({}, tooltipTriggerProps, {
|
|
403
406
|
ref: setImplicitRefFromChildren,
|
|
404
407
|
role: "presentation"
|
|
405
|
-
}), children), shouldRenderTooltipContainer ?
|
|
408
|
+
}), children, shouldRenderTooltipContainer && hiddenContent), shouldRenderTooltipContainer ? /*#__PURE__*/React.createElement(Portal, {
|
|
406
409
|
zIndex: tooltipZIndex
|
|
407
|
-
},
|
|
410
|
+
}, /*#__PURE__*/React.createElement(Popper, {
|
|
408
411
|
placement: tooltipPosition,
|
|
409
412
|
referenceElement: getReferenceElement(),
|
|
410
413
|
strategy: strategy
|
|
@@ -418,9 +421,9 @@ function Tooltip({
|
|
|
418
421
|
// E.g. a tooltip's position is on the 'right', it should enter from and exit to the 'left'
|
|
419
422
|
// This gives the effect the tooltip is appearing from the target
|
|
420
423
|
const direction = position === 'mouse' ? undefined : invertedDirection[getDirectionFromPlacement(placement)];
|
|
421
|
-
return
|
|
424
|
+
return /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
422
425
|
appear: true
|
|
423
|
-
}, shouldRenderTooltipChildren &&
|
|
426
|
+
}, shouldRenderTooltipChildren && /*#__PURE__*/React.createElement(FadeIn, {
|
|
424
427
|
distance: "constant",
|
|
425
428
|
entranceDirection: direction,
|
|
426
429
|
exitDirection: direction,
|
|
@@ -428,7 +431,7 @@ function Tooltip({
|
|
|
428
431
|
duration: state === 'show-immediate' ? 0 : mediumDurationMs
|
|
429
432
|
}, ({
|
|
430
433
|
className
|
|
431
|
-
}) =>
|
|
434
|
+
}) => /*#__PURE__*/React.createElement(Container, {
|
|
432
435
|
ref: ref
|
|
433
436
|
/**
|
|
434
437
|
* "Tooltip" classname is a hook used by tests to manipulate
|
|
@@ -440,8 +443,7 @@ function Tooltip({
|
|
|
440
443
|
placement: tooltipPosition,
|
|
441
444
|
testId: getReferenceElement() ? testId : testId && `${testId}--unresolved`,
|
|
442
445
|
onMouseOut: onMouseOut,
|
|
443
|
-
onMouseOver: onMouseOverTooltip
|
|
444
|
-
id: tooltipId
|
|
446
|
+
onMouseOver: onMouseOverTooltip
|
|
445
447
|
}, typeof content === 'function' ? content({
|
|
446
448
|
update
|
|
447
449
|
}) : content)));
|
package/dist/esm/Tooltip.js
CHANGED
|
@@ -3,10 +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
|
-
/** @jsx jsx */
|
|
7
|
-
|
|
8
6
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
|
-
import { jsx } from '@emotion/react';
|
|
10
7
|
import { bind } from 'bind-event-listener';
|
|
11
8
|
import { usePlatformLeafSyntheticEventHandler } from '@atlaskit/analytics-next';
|
|
12
9
|
import noop from '@atlaskit/ds-lib/noop';
|
|
@@ -25,7 +22,7 @@ var tooltipZIndex = layers.tooltip();
|
|
|
25
22
|
var analyticsAttributes = {
|
|
26
23
|
componentName: 'tooltip',
|
|
27
24
|
packageName: "@atlaskit/tooltip",
|
|
28
|
-
packageVersion: "18.1.
|
|
25
|
+
packageVersion: "18.1.2"
|
|
29
26
|
};
|
|
30
27
|
|
|
31
28
|
// Inverts motion direction
|
|
@@ -405,19 +402,25 @@ function Tooltip(_ref) {
|
|
|
405
402
|
target.removeAttribute('aria-describedby');
|
|
406
403
|
}
|
|
407
404
|
}, [shouldRenderTooltipContainer, tooltipId]);
|
|
408
|
-
|
|
405
|
+
var hiddenContent = /*#__PURE__*/React.createElement("span", {
|
|
406
|
+
"data-testid": testId ? "".concat(testId, "-hidden") : undefined,
|
|
407
|
+
hidden: true,
|
|
408
|
+
id: tooltipId
|
|
409
|
+
}, typeof content === 'function' ? content({}) : content);
|
|
410
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, typeof children === 'function' ?
|
|
411
|
+
/*#__PURE__*/
|
|
409
412
|
// once we deprecate the wrapped approach, we can put the aria
|
|
410
413
|
// attribute back into the tooltipTriggerProps and make it required
|
|
411
414
|
// instead of optional in `types`
|
|
412
|
-
children(_objectSpread(_objectSpread({}, tooltipTriggerProps), {}, {
|
|
415
|
+
React.createElement(React.Fragment, null, children(_objectSpread(_objectSpread({}, tooltipTriggerProps), {}, {
|
|
413
416
|
'aria-describedby': tooltipId,
|
|
414
417
|
ref: setDirectRef
|
|
415
|
-
})) :
|
|
418
|
+
})), shouldRenderTooltipContainer && hiddenContent) : /*#__PURE__*/React.createElement(CastTargetContainer, _extends({}, tooltipTriggerProps, {
|
|
416
419
|
ref: setImplicitRefFromChildren,
|
|
417
420
|
role: "presentation"
|
|
418
|
-
}), children), shouldRenderTooltipContainer ?
|
|
421
|
+
}), children, shouldRenderTooltipContainer && hiddenContent), shouldRenderTooltipContainer ? /*#__PURE__*/React.createElement(Portal, {
|
|
419
422
|
zIndex: tooltipZIndex
|
|
420
|
-
},
|
|
423
|
+
}, /*#__PURE__*/React.createElement(Popper, {
|
|
421
424
|
placement: tooltipPosition,
|
|
422
425
|
referenceElement: getReferenceElement(),
|
|
423
426
|
strategy: strategy
|
|
@@ -430,9 +433,9 @@ function Tooltip(_ref) {
|
|
|
430
433
|
// E.g. a tooltip's position is on the 'right', it should enter from and exit to the 'left'
|
|
431
434
|
// This gives the effect the tooltip is appearing from the target
|
|
432
435
|
var direction = position === 'mouse' ? undefined : invertedDirection[getDirectionFromPlacement(placement)];
|
|
433
|
-
return
|
|
436
|
+
return /*#__PURE__*/React.createElement(ExitingPersistence, {
|
|
434
437
|
appear: true
|
|
435
|
-
}, shouldRenderTooltipChildren &&
|
|
438
|
+
}, shouldRenderTooltipChildren && /*#__PURE__*/React.createElement(FadeIn, {
|
|
436
439
|
distance: "constant",
|
|
437
440
|
entranceDirection: direction,
|
|
438
441
|
exitDirection: direction,
|
|
@@ -440,7 +443,7 @@ function Tooltip(_ref) {
|
|
|
440
443
|
duration: state === 'show-immediate' ? 0 : mediumDurationMs
|
|
441
444
|
}, function (_ref6) {
|
|
442
445
|
var className = _ref6.className;
|
|
443
|
-
return
|
|
446
|
+
return /*#__PURE__*/React.createElement(Container, {
|
|
444
447
|
ref: ref
|
|
445
448
|
/**
|
|
446
449
|
* "Tooltip" classname is a hook used by tests to manipulate
|
|
@@ -452,8 +455,7 @@ function Tooltip(_ref) {
|
|
|
452
455
|
placement: tooltipPosition,
|
|
453
456
|
testId: getReferenceElement() ? testId : testId && "".concat(testId, "--unresolved"),
|
|
454
457
|
onMouseOut: onMouseOut,
|
|
455
|
-
onMouseOver: onMouseOverTooltip
|
|
456
|
-
id: tooltipId
|
|
458
|
+
onMouseOver: onMouseOverTooltip
|
|
457
459
|
}, typeof content === 'function' ? content({
|
|
458
460
|
update: update
|
|
459
461
|
}) : content);
|
package/dist/types/Tooltip.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/// <reference types="react" />
|
|
3
2
|
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):
|
|
3
|
+
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): JSX.Element;
|
|
5
4
|
declare namespace Tooltip {
|
|
6
5
|
var displayName: string;
|
|
7
6
|
}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -25,10 +25,10 @@ export interface TooltipProps {
|
|
|
25
25
|
* This `update` function can be called to manually recalculate the position of the tooltip.
|
|
26
26
|
*/
|
|
27
27
|
content: ReactNode | (({ update }: {
|
|
28
|
-
update
|
|
28
|
+
update?: () => void;
|
|
29
29
|
}) => ReactNode);
|
|
30
30
|
/**
|
|
31
|
-
* Extend `TooltipPrimitive` to create your own tooltip and pass it as component
|
|
31
|
+
* Extend `TooltipPrimitive` to create your own tooltip and pass it as component.
|
|
32
32
|
*/
|
|
33
33
|
component?: ComponentType<TooltipPrimitiveProps>;
|
|
34
34
|
/**
|
|
@@ -38,13 +38,13 @@ export interface TooltipProps {
|
|
|
38
38
|
/**
|
|
39
39
|
* Hide the tooltip when the click event is triggered. This should be
|
|
40
40
|
* used when tooltip should be hidden if `onClick` react synthetic event
|
|
41
|
-
* is triggered, which happens after `onMouseDown` event
|
|
41
|
+
* is triggered, which happens after `onMouseDown` event.
|
|
42
42
|
*/
|
|
43
43
|
hideTooltipOnClick?: boolean;
|
|
44
44
|
/**
|
|
45
45
|
* Hide the tooltip when the mousedown event is triggered. This should be
|
|
46
46
|
* used when tooltip should be hidden if `onMouseDown` react synthetic event
|
|
47
|
-
* is triggered, which happens before `onClick` event
|
|
47
|
+
* is triggered, which happens before `onClick` event.
|
|
48
48
|
*/
|
|
49
49
|
hideTooltipOnMouseDown?: boolean;
|
|
50
50
|
/**
|
|
@@ -72,13 +72,13 @@ export interface TooltipProps {
|
|
|
72
72
|
/**
|
|
73
73
|
* Replace the wrapping element. This accepts the name of a html tag which will
|
|
74
74
|
* be used to wrap the element.
|
|
75
|
-
* If you provide a component it needs to support a ref prop which is used by popper for positioning
|
|
75
|
+
* If you provide a component it needs to support a ref prop which is used by popper for positioning.
|
|
76
76
|
*/
|
|
77
77
|
tag?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & {
|
|
78
78
|
ref: React.Ref<HTMLElement>;
|
|
79
79
|
}>;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Used to show only one line of text, and truncate when too long. Avoid this wherever possible, as any important information that is truncated will be visually hidden to the person reading the tooltip.
|
|
82
82
|
*/
|
|
83
83
|
truncate?: boolean;
|
|
84
84
|
/**
|
|
@@ -91,9 +91,9 @@ export interface TooltipProps {
|
|
|
91
91
|
/**
|
|
92
92
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
93
93
|
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
94
|
-
* serving as a hook for automated tests */
|
|
94
|
+
* serving as a hook for automated tests. */
|
|
95
95
|
testId?: string;
|
|
96
|
-
/** Analytics context metadata */
|
|
96
|
+
/** Analytics context metadata. */
|
|
97
97
|
analyticsContext?: Record<string, any>;
|
|
98
98
|
/**
|
|
99
99
|
* Used to define the strategy of popper.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx } from '@emotion/react';
|
|
1
|
+
/// <reference types="react" />
|
|
3
2
|
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):
|
|
3
|
+
declare function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): JSX.Element;
|
|
5
4
|
declare namespace Tooltip {
|
|
6
5
|
var displayName: string;
|
|
7
6
|
}
|
|
@@ -25,10 +25,10 @@ export interface TooltipProps {
|
|
|
25
25
|
* This `update` function can be called to manually recalculate the position of the tooltip.
|
|
26
26
|
*/
|
|
27
27
|
content: ReactNode | (({ update }: {
|
|
28
|
-
update
|
|
28
|
+
update?: () => void;
|
|
29
29
|
}) => ReactNode);
|
|
30
30
|
/**
|
|
31
|
-
* Extend `TooltipPrimitive` to create your own tooltip and pass it as component
|
|
31
|
+
* Extend `TooltipPrimitive` to create your own tooltip and pass it as component.
|
|
32
32
|
*/
|
|
33
33
|
component?: ComponentType<TooltipPrimitiveProps>;
|
|
34
34
|
/**
|
|
@@ -38,13 +38,13 @@ export interface TooltipProps {
|
|
|
38
38
|
/**
|
|
39
39
|
* Hide the tooltip when the click event is triggered. This should be
|
|
40
40
|
* used when tooltip should be hidden if `onClick` react synthetic event
|
|
41
|
-
* is triggered, which happens after `onMouseDown` event
|
|
41
|
+
* is triggered, which happens after `onMouseDown` event.
|
|
42
42
|
*/
|
|
43
43
|
hideTooltipOnClick?: boolean;
|
|
44
44
|
/**
|
|
45
45
|
* Hide the tooltip when the mousedown event is triggered. This should be
|
|
46
46
|
* used when tooltip should be hidden if `onMouseDown` react synthetic event
|
|
47
|
-
* is triggered, which happens before `onClick` event
|
|
47
|
+
* is triggered, which happens before `onClick` event.
|
|
48
48
|
*/
|
|
49
49
|
hideTooltipOnMouseDown?: boolean;
|
|
50
50
|
/**
|
|
@@ -72,13 +72,13 @@ export interface TooltipProps {
|
|
|
72
72
|
/**
|
|
73
73
|
* Replace the wrapping element. This accepts the name of a html tag which will
|
|
74
74
|
* be used to wrap the element.
|
|
75
|
-
* If you provide a component it needs to support a ref prop which is used by popper for positioning
|
|
75
|
+
* If you provide a component it needs to support a ref prop which is used by popper for positioning.
|
|
76
76
|
*/
|
|
77
77
|
tag?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & {
|
|
78
78
|
ref: React.Ref<HTMLElement>;
|
|
79
79
|
}>;
|
|
80
80
|
/**
|
|
81
|
-
*
|
|
81
|
+
* Used to show only one line of text, and truncate when too long. Avoid this wherever possible, as any important information that is truncated will be visually hidden to the person reading the tooltip.
|
|
82
82
|
*/
|
|
83
83
|
truncate?: boolean;
|
|
84
84
|
/**
|
|
@@ -91,9 +91,9 @@ export interface TooltipProps {
|
|
|
91
91
|
/**
|
|
92
92
|
* A `testId` prop is provided for specified elements, which is a unique
|
|
93
93
|
* string that appears as a data attribute `data-testid` in the rendered code,
|
|
94
|
-
* serving as a hook for automated tests */
|
|
94
|
+
* serving as a hook for automated tests. */
|
|
95
95
|
testId?: string;
|
|
96
|
-
/** Analytics context metadata */
|
|
96
|
+
/** Analytics context metadata. */
|
|
97
97
|
analyticsContext?: Record<string, any>;
|
|
98
98
|
/**
|
|
99
99
|
* Used to define the strategy of popper.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/tooltip",
|
|
3
|
-
"version": "18.1.
|
|
3
|
+
"version": "18.1.2",
|
|
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/"
|
|
@@ -42,13 +42,13 @@
|
|
|
42
42
|
"./utilities": "./src/utilities.ts"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@atlaskit/analytics-next": "^9.
|
|
45
|
+
"@atlaskit/analytics-next": "^9.2.0",
|
|
46
46
|
"@atlaskit/ds-lib": "^2.2.0",
|
|
47
47
|
"@atlaskit/motion": "^1.5.0",
|
|
48
48
|
"@atlaskit/popper": "^5.5.0",
|
|
49
49
|
"@atlaskit/portal": "^4.4.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
|
-
"@atlaskit/tokens": "^1.
|
|
51
|
+
"@atlaskit/tokens": "^1.38.0",
|
|
52
52
|
"@babel/runtime": "^7.0.0",
|
|
53
53
|
"@emotion/react": "^11.7.1",
|
|
54
54
|
"bind-event-listener": "^2.1.1",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@af/accessibility-testing": "*",
|
|
63
|
-
"@atlaskit/button": "^17.
|
|
63
|
+
"@atlaskit/button": "^17.5.0",
|
|
64
64
|
"@atlaskit/ssr": "*",
|
|
65
65
|
"@atlaskit/visual-regression": "*",
|
|
66
66
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|