@atlaskit/tooltip 17.5.15 → 17.5.17

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/tooltip
2
2
 
3
+ ## 17.5.17
4
+
5
+ ### Patch Changes
6
+
7
+ - [`8cc2f888c83`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8cc2f888c83) - Upgrade Typescript from `4.3.5` to `4.5.5`
8
+
9
+ ## 17.5.16
10
+
11
+ ### Patch Changes
12
+
13
+ - [`8d4228767b0`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8d4228767b0) - Upgrade Typescript from `4.2.4` to `4.3.5`.
14
+
3
15
  ## 17.5.15
4
16
 
5
17
  ### Patch Changes
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/Tooltip.js",
5
5
  "module:es2019": "../dist/es2019/Tooltip.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/Tooltip.d.ts"
7
+ "types": "../dist/types/Tooltip.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/Tooltip.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/TooltipContainer.js",
5
5
  "module:es2019": "../dist/es2019/TooltipContainer.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/TooltipContainer.d.ts"
7
+ "types": "../dist/types/TooltipContainer.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/TooltipContainer.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/TooltipPrimitive.js",
5
5
  "module:es2019": "../dist/es2019/TooltipPrimitive.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/TooltipPrimitive.d.ts"
7
+ "types": "../dist/types/TooltipPrimitive.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/TooltipPrimitive.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -58,7 +58,7 @@ var tooltipZIndex = _constants.layers.tooltip();
58
58
  var analyticsAttributes = {
59
59
  componentName: 'tooltip',
60
60
  packageName: "@atlaskit/tooltip",
61
- packageVersion: "17.5.15"
61
+ packageVersion: "17.5.17"
62
62
  }; // Inverts motion direction
63
63
 
64
64
  var invertedDirection = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.5.15",
3
+ "version": "17.5.17",
4
4
  "sideEffects": false
5
5
  }
@@ -20,7 +20,7 @@ const tooltipZIndex = layers.tooltip();
20
20
  const analyticsAttributes = {
21
21
  componentName: 'tooltip',
22
22
  packageName: "@atlaskit/tooltip",
23
- packageVersion: "17.5.15"
23
+ packageVersion: "17.5.17"
24
24
  }; // Inverts motion direction
25
25
 
26
26
  const invertedDirection = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.5.15",
3
+ "version": "17.5.17",
4
4
  "sideEffects": false
5
5
  }
@@ -26,7 +26,7 @@ var tooltipZIndex = layers.tooltip();
26
26
  var analyticsAttributes = {
27
27
  componentName: 'tooltip',
28
28
  packageName: "@atlaskit/tooltip",
29
- packageVersion: "17.5.15"
29
+ packageVersion: "17.5.17"
30
30
  }; // Inverts motion direction
31
31
 
32
32
  var invertedDirection = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.5.15",
3
+ "version": "17.5.17",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ /** @jsx jsx */
3
+ 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): JSX.Element;
5
+ declare namespace Tooltip {
6
+ var displayName: string;
7
+ }
8
+ export default Tooltip;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { TooltipPrimitiveProps } from './TooltipPrimitive';
3
+ export interface TooltipContainerProps extends TooltipPrimitiveProps {
4
+ }
5
+ declare const TooltipContainer: import("react").ForwardRefExoticComponent<Pick<TooltipContainerProps, "style" | "className" | "children" | "placement" | "testId" | "onMouseOut" | "onMouseOver" | "id" | "truncate"> & import("react").RefAttributes<HTMLDivElement>>;
6
+ export default TooltipContainer;
@@ -0,0 +1,17 @@
1
+ /** @jsx jsx */
2
+ import { CSSProperties, ReactNode } from 'react';
3
+ import { PositionType } from './types';
4
+ export interface TooltipPrimitiveProps {
5
+ truncate?: boolean;
6
+ style?: CSSProperties;
7
+ className?: string;
8
+ children: ReactNode;
9
+ testId?: string;
10
+ placement: PositionType;
11
+ ref: React.Ref<any>;
12
+ onMouseOver?: (e: React.MouseEvent<HTMLElement>) => void;
13
+ onMouseOut?: (e: React.MouseEvent<HTMLElement>) => void;
14
+ id?: string;
15
+ }
16
+ declare const TooltipPrimitive: import("react").ForwardRefExoticComponent<Pick<TooltipPrimitiveProps, "style" | "className" | "children" | "placement" | "testId" | "onMouseOut" | "onMouseOver" | "id" | "truncate"> & import("react").RefAttributes<HTMLDivElement>>;
17
+ export default TooltipPrimitive;
@@ -0,0 +1,4 @@
1
+ export { default } from './Tooltip';
2
+ export { default as TooltipPrimitive } from './TooltipPrimitive';
3
+ export type { TooltipPrimitiveProps } from './TooltipPrimitive';
4
+ export type { PositionType, TooltipProps } from './types';
@@ -0,0 +1,84 @@
1
+ import { ComponentType, ElementType, ReactNode } from 'react';
2
+ import { TooltipPrimitiveProps } from '../TooltipPrimitive';
3
+ import { PositionType, PositionTypeBase } from '../types';
4
+ declare type Props = {
5
+ /**
6
+ * The content of the tooltip. It can be either a:
7
+ * 1. `ReactNode`
8
+ * 2. Function which returns a `ReactNode`
9
+
10
+ * The benefit of the second approach is that it allows you to consume the `update` render prop.
11
+ * This `update` function can be called to manually recalculate the position of the tooltip.
12
+ */
13
+ content: ReactNode | (({ update }: {
14
+ update: () => void;
15
+ }) => ReactNode);
16
+ /**
17
+ * Extend `TooltipPrimitive` to create your own tooltip and pass it as component
18
+ */
19
+ component?: ComponentType<TooltipPrimitiveProps>;
20
+ /**
21
+ * Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300.
22
+ */
23
+ delay?: number;
24
+ /**
25
+ * Hide the tooltip when the click event is triggered. This should be
26
+ * used when tooltip should be hidden if `onClick` react synthetic event
27
+ * is triggered, which happens after `onMouseDown` event
28
+ */
29
+ hideTooltipOnClick?: boolean;
30
+ /**
31
+ * Hide the tooltip when the mousedown event is triggered. This should be
32
+ * used when tooltip should be hidden if `onMouseDown` react synthetic event
33
+ * is triggered, which happens before `onClick` event
34
+ */
35
+ hideTooltipOnMouseDown?: boolean;
36
+ /**
37
+ * Where the tooltip should appear relative to the mouse pointer.
38
+ * Only used when the `position` prop is set to `"mouse"`.
39
+ * When interacting with the target element using the keyboard will use this position against the target element instead.
40
+ */
41
+ mousePosition?: PositionTypeBase;
42
+ /**
43
+ * Function to be called when the tooltip will be shown. It is called when the
44
+ * tooltip begins to animate in.
45
+ */
46
+ onShow?: () => void;
47
+ /**
48
+ * Function to be called when the tooltip will be hidden. It is called after the
49
+ * delay, when the tooltip begins to animate out.
50
+ */
51
+ onHide?: () => void;
52
+ /**
53
+ * Where the tooltip should appear relative to its target.
54
+ * If set to `"mouse"` the tooltip will display next to the mouse pointer instead.
55
+ * Make sure to utilize the `mousePosition` if you want to customize where the tooltip will show in relation to the mouse.
56
+ */
57
+ position?: PositionType;
58
+ /**
59
+ * Replace the wrapping element. This accepts the name of a html tag which will
60
+ * be used to wrap the element.
61
+ * If you provide a component it needs to support a ref prop which is used by popper for positioning
62
+ * Note: actual type is not ElementType, it is either a JSX.IntrinsticElement (eg "div")
63
+ * or a component that supports React.AllHTMLAttributes<HTMLElement> has a ref prop (React.Ref<HTMLElement>).
64
+ * Using ElementType here for documentation because it is close and works with our prop extraction tool
65
+ */
66
+ tag?: ElementType;
67
+ /**
68
+ * Show only one line of text, and truncate when too long
69
+ */
70
+ truncate?: boolean;
71
+ /**
72
+ * Elements to be wrapped by the tooltip
73
+ */
74
+ children: ReactNode;
75
+ /**
76
+ * A `testId` prop is provided for specified elements, which is a unique
77
+ * string that appears as a data attribute `data-testid` in the rendered code,
78
+ * serving as a hook for automated tests */
79
+ testId?: string;
80
+ /** Analytics context metadata */
81
+ analyticsContext?: Record<string, any>;
82
+ };
83
+ export default function PropsHack(props: Props): null;
84
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare function clearScheduled(): void;
2
+ export declare function scheduleTimeout(fn: () => void, delay: number): void;
@@ -0,0 +1,29 @@
1
+ import { FakeMouseElement } from '../utilities';
2
+ export declare type Source = {
3
+ type: 'mouse';
4
+ mouse: FakeMouseElement;
5
+ } | {
6
+ type: 'keyboard';
7
+ };
8
+ export declare type Entry = {
9
+ source: Source;
10
+ show: (value: {
11
+ isImmediate: boolean;
12
+ }) => void;
13
+ hide: (value: {
14
+ isImmediate: boolean;
15
+ }) => void;
16
+ delay: number;
17
+ done: () => void;
18
+ };
19
+ export declare type API = {
20
+ isActive: () => boolean;
21
+ mousePosition: FakeMouseElement | null;
22
+ requestHide: (value: {
23
+ isImmediate: boolean;
24
+ }) => void;
25
+ finishHideAnimation: () => void;
26
+ keep: () => void;
27
+ abort: () => void;
28
+ };
29
+ export declare function show(entry: Entry): API;
@@ -0,0 +1 @@
1
+ export default function useUniqueId(prefix: string, shouldRenderId: boolean): string | undefined;
@@ -0,0 +1,100 @@
1
+ import { ComponentType, ReactNode } from 'react';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
+ import { Placement } from '@atlaskit/popper';
4
+ import { TooltipPrimitiveProps } from './TooltipPrimitive';
5
+ export declare type PositionTypeBase = Placement;
6
+ export declare type PositionType = PositionTypeBase | 'mouse';
7
+ export interface TriggerProps {
8
+ onMouseOver: (event: React.MouseEvent<HTMLElement>) => void;
9
+ onMouseOut: (event: React.MouseEvent<HTMLElement>) => void;
10
+ onMouseDown: (event: React.MouseEvent<HTMLElement>) => void;
11
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
12
+ onFocus: (event: React.FocusEvent<HTMLElement>) => void;
13
+ onBlur: (event: React.FocusEvent<HTMLElement>) => void;
14
+ ref: (node: HTMLElement | null) => void;
15
+ }
16
+ export interface TooltipProps {
17
+ /**
18
+ * The content of the tooltip. It can be either a:
19
+ * 1. `ReactNode`
20
+ * 2. Function which returns a `ReactNode`
21
+
22
+ * The benefit of the second approach is that it allows you to consume the `update` render prop.
23
+ * This `update` function can be called to manually recalculate the position of the tooltip.
24
+ */
25
+ content: ReactNode | (({ update }: {
26
+ update: () => void;
27
+ }) => ReactNode);
28
+ /**
29
+ * Extend `TooltipPrimitive` to create your own tooltip and pass it as component
30
+ */
31
+ component?: ComponentType<TooltipPrimitiveProps>;
32
+ /**
33
+ * Time in milliseconds to wait before showing and hiding the tooltip. Defaults to 300.
34
+ */
35
+ delay?: number;
36
+ /**
37
+ * Hide the tooltip when the click event is triggered. This should be
38
+ * used when tooltip should be hidden if `onClick` react synthetic event
39
+ * is triggered, which happens after `onMouseDown` event
40
+ */
41
+ hideTooltipOnClick?: boolean;
42
+ /**
43
+ * Hide the tooltip when the mousedown event is triggered. This should be
44
+ * used when tooltip should be hidden if `onMouseDown` react synthetic event
45
+ * is triggered, which happens before `onClick` event
46
+ */
47
+ hideTooltipOnMouseDown?: boolean;
48
+ /**
49
+ * Where the tooltip should appear relative to the mouse pointer.
50
+ * Only used when the `position` prop is set to `"mouse"`.
51
+ * When interacting with the target element using the keyboard will use this position against the target element instead.
52
+ */
53
+ mousePosition?: PositionTypeBase;
54
+ /**
55
+ * Function to be called when the tooltip will be shown. It is called when the
56
+ * tooltip begins to animate in.
57
+ */
58
+ onShow?: (analyticsEvent: UIAnalyticsEvent) => void;
59
+ /**
60
+ * Function to be called when the tooltip will be hidden. It is called after the
61
+ * delay, when the tooltip begins to animate out.
62
+ */
63
+ onHide?: (analyticsEvent: UIAnalyticsEvent) => void;
64
+ /**
65
+ * Where the tooltip should appear relative to its target.
66
+ * If set to `"mouse"` the tooltip will display next to the mouse pointer instead.
67
+ * Make sure to utilize the `mousePosition` if you want to customize where the tooltip will show in relation to the mouse.
68
+ */
69
+ position?: PositionType;
70
+ /**
71
+ * Replace the wrapping element. This accepts the name of a html tag which will
72
+ * be used to wrap the element.
73
+ * If you provide a component it needs to support a ref prop which is used by popper for positioning
74
+ */
75
+ tag?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & {
76
+ ref: React.Ref<HTMLElement>;
77
+ }>;
78
+ /**
79
+ * Show only one line of text, and truncate when too long
80
+ */
81
+ truncate?: boolean;
82
+ /**
83
+ * Elements to be wrapped by the tooltip.
84
+ * It can be either a:
85
+ * 1. `ReactNode`
86
+ * 2. Function which returns a `ReactNode`
87
+ */
88
+ children: ReactNode | ((props: TriggerProps) => ReactNode);
89
+ /**
90
+ * A `testId` prop is provided for specified elements, which is a unique
91
+ * string that appears as a data attribute `data-testid` in the rendered code,
92
+ * serving as a hook for automated tests */
93
+ testId?: string;
94
+ /** Analytics context metadata */
95
+ analyticsContext?: Record<string, any>;
96
+ /**
97
+ * Used to define the strategy of popper.
98
+ */
99
+ strategy?: 'absolute' | 'fixed' | undefined;
100
+ }
@@ -0,0 +1,16 @@
1
+ export interface FakeMouseElement {
2
+ getBoundingClientRect: () => {
3
+ top: number;
4
+ left: number;
5
+ bottom: number;
6
+ right: number;
7
+ width: number;
8
+ height: number;
9
+ };
10
+ clientWidth: number;
11
+ clientHeight: number;
12
+ }
13
+ export declare function getMousePosition(mouseCoordinates: {
14
+ top: number;
15
+ left: number;
16
+ }): FakeMouseElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.5.15",
3
+ "version": "17.5.17",
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/"
@@ -12,6 +12,13 @@
12
12
  "module": "dist/esm/index.js",
13
13
  "module:es2019": "dist/es2019/index.js",
14
14
  "types": "dist/types/index.d.ts",
15
+ "typesVersions": {
16
+ ">=4.0 <4.5": {
17
+ "*": [
18
+ "dist/types-ts4.0/*"
19
+ ]
20
+ }
21
+ },
15
22
  "sideEffects": false,
16
23
  "atlaskit:src": "src/index.ts",
17
24
  "atlassian": {
@@ -36,7 +43,7 @@
36
43
  "@atlaskit/motion": "^1.2.0",
37
44
  "@atlaskit/popper": "^5.0.0",
38
45
  "@atlaskit/portal": "^4.1.0",
39
- "@atlaskit/theme": "^12.1.0",
46
+ "@atlaskit/theme": "^12.2.0",
40
47
  "@atlaskit/tokens": "^0.10.0",
41
48
  "@babel/runtime": "^7.0.0",
42
49
  "@emotion/core": "^10.0.9",
@@ -51,19 +58,19 @@
51
58
  "@atlaskit/button": "^16.3.0",
52
59
  "@atlaskit/docs": "*",
53
60
  "@atlaskit/icon": "^21.10.0",
54
- "@atlaskit/section-message": "^6.1.0",
61
+ "@atlaskit/section-message": "^6.2.0",
55
62
  "@atlaskit/ssr": "*",
56
63
  "@atlaskit/visual-regression": "*",
57
64
  "@atlaskit/webdriver-runner": "*",
58
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
59
- "@emotion/styled": "^10.0.7",
60
- "@testing-library/dom": "^7.7.3",
61
- "@testing-library/react": "^8.0.1",
66
+ "@emotion/styled": "^11.0.0",
67
+ "@testing-library/dom": "^8.17.1",
68
+ "@testing-library/react": "^12.1.5",
62
69
  "jest-in-case": "^1.0.2",
63
70
  "react-dom": "^16.8.0",
64
71
  "react-redux": "^5.1.2",
65
72
  "storybook-addon-performance": "^0.16.0",
66
- "typescript": "4.2.4",
73
+ "typescript": "4.5.5",
67
74
  "wait-for-expect": "^1.2.0"
68
75
  },
69
76
  "keywords": [
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/types.js",
5
5
  "module:es2019": "../dist/es2019/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts"
7
+ "types": "../dist/types/types.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/types.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }
@@ -4,5 +4,12 @@
4
4
  "module": "../dist/esm/utilities.js",
5
5
  "module:es2019": "../dist/es2019/utilities.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/utilities.d.ts"
7
+ "types": "../dist/types/utilities.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/utilities.d.ts"
12
+ ]
13
+ }
14
+ }
8
15
  }