@atlaskit/tooltip 17.8.1 → 17.8.3

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.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`599bfe90ee3`](https://bitbucket.org/atlassian/atlassian-frontend/commits/599bfe90ee3) - Internal change to use shape tokens. There is no expected visual change.
8
+
9
+ ## 17.8.2
10
+
11
+ ### Patch Changes
12
+
13
+ - [`9d00501a414`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9d00501a414) - Ensure legacy types are published for TS 4.5-4.8
14
+
3
15
  ## 17.8.1
4
16
 
5
17
  ### Patch Changes
@@ -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.1"
35
+ packageVersion: "17.8.3"
36
36
  };
37
37
 
38
38
  // Inverts motion direction
@@ -18,7 +18,7 @@ var baseStyles = (0, _react2.css)({
18
18
  padding: "var(--ds-space-025, 2px)".concat(" ", "var(--ds-space-075, 6px)"),
19
19
  top: "var(--ds-space-0, 0px)",
20
20
  left: "var(--ds-space-0, 0px)",
21
- borderRadius: "var(--ds-radius-100, 3px)",
21
+ borderRadius: "var(--ds-border-radius, 3px)",
22
22
  fontSize: "var(--ds-font-size-075, 12px)",
23
23
  lineHeight: 1.3,
24
24
  overflowWrap: 'break-word',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.8.1",
3
+ "version": "17.8.3",
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.8.1"
23
+ packageVersion: "17.8.3"
24
24
  };
25
25
 
26
26
  // Inverts motion direction
@@ -10,7 +10,7 @@ const baseStyles = css({
10
10
  padding: `${"var(--ds-space-025, 2px)"} ${"var(--ds-space-075, 6px)"}`,
11
11
  top: "var(--ds-space-0, 0px)",
12
12
  left: "var(--ds-space-0, 0px)",
13
- borderRadius: "var(--ds-radius-100, 3px)",
13
+ borderRadius: "var(--ds-border-radius, 3px)",
14
14
  fontSize: "var(--ds-font-size-075, 12px)",
15
15
  lineHeight: 1.3,
16
16
  overflowWrap: 'break-word',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.8.1",
3
+ "version": "17.8.3",
4
4
  "sideEffects": false
5
5
  }
@@ -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.1"
27
+ packageVersion: "17.8.3"
28
28
  };
29
29
 
30
30
  // Inverts motion direction
@@ -10,7 +10,7 @@ var baseStyles = css({
10
10
  padding: "var(--ds-space-025, 2px)".concat(" ", "var(--ds-space-075, 6px)"),
11
11
  top: "var(--ds-space-0, 0px)",
12
12
  left: "var(--ds-space-0, 0px)",
13
- borderRadius: "var(--ds-radius-100, 3px)",
13
+ borderRadius: "var(--ds-border-radius, 3px)",
14
14
  fontSize: "var(--ds-font-size-075, 12px)",
15
15
  lineHeight: 1.3,
16
16
  overflowWrap: 'break-word',
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/tooltip",
3
- "version": "17.8.1",
3
+ "version": "17.8.3",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,8 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
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.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,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 type Source = {
3
+ type: 'mouse';
4
+ mouse: FakeMouseElement;
5
+ } | {
6
+ type: 'keyboard';
7
+ };
8
+ export 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 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;
@@ -1,12 +1,26 @@
1
- import { ComponentType, ElementType, ReactNode } from 'react';
2
- import { TooltipPrimitiveProps } from '../TooltipPrimitive';
3
- import { PositionType, PositionTypeBase } from '../types';
4
- type Props = {
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 type PositionTypeBase = Placement;
6
+ export type PositionType = PositionTypeBase | 'mouse';
7
+ export interface TriggerProps {
8
+ onMouseOver: (event: React.MouseEvent<HTMLElement>) => void;
9
+ onMouseOut: (event: React.MouseEvent<HTMLElement>) => void;
10
+ onMouseMove: ((event: React.MouseEvent<HTMLElement>) => void) | undefined;
11
+ onMouseDown: (event: React.MouseEvent<HTMLElement>) => void;
12
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
13
+ onFocus: (event: React.FocusEvent<HTMLElement>) => void;
14
+ onBlur: (event: React.FocusEvent<HTMLElement>) => void;
15
+ ref: (node: HTMLElement | null) => void;
16
+ 'aria-describedby'?: string | undefined;
17
+ }
18
+ export interface TooltipProps {
5
19
  /**
6
20
  * The content of the tooltip. It can be either a:
7
21
  * 1. `ReactNode`
8
22
  * 2. Function which returns a `ReactNode`
9
-
23
+
10
24
  * The benefit of the second approach is that it allows you to consume the `update` render prop.
11
25
  * This `update` function can be called to manually recalculate the position of the tooltip.
12
26
  */
@@ -43,12 +57,12 @@ type Props = {
43
57
  * Function to be called when the tooltip will be shown. It is called when the
44
58
  * tooltip begins to animate in.
45
59
  */
46
- onShow?: () => void;
60
+ onShow?: (analyticsEvent: UIAnalyticsEvent) => void;
47
61
  /**
48
62
  * Function to be called when the tooltip will be hidden. It is called after the
49
63
  * delay, when the tooltip begins to animate out.
50
64
  */
51
- onHide?: () => void;
65
+ onHide?: (analyticsEvent: UIAnalyticsEvent) => void;
52
66
  /**
53
67
  * Where the tooltip should appear relative to its target.
54
68
  * If set to `"mouse"` the tooltip will display next to the mouse pointer instead.
@@ -59,19 +73,21 @@ type Props = {
59
73
  * Replace the wrapping element. This accepts the name of a html tag which will
60
74
  * be used to wrap the element.
61
75
  * 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
76
  */
66
- tag?: ElementType;
77
+ tag?: keyof JSX.IntrinsicElements | React.ComponentType<React.AllHTMLAttributes<HTMLElement> & {
78
+ ref: React.Ref<HTMLElement>;
79
+ }>;
67
80
  /**
68
81
  * Show only one line of text, and truncate when too long
69
82
  */
70
83
  truncate?: boolean;
71
84
  /**
72
- * Elements to be wrapped by the tooltip
85
+ * Elements to be wrapped by the tooltip.
86
+ * It can be either a:
87
+ * 1. `ReactNode`
88
+ * 2. Function which returns a `ReactNode`
73
89
  */
74
- children: ReactNode;
90
+ children: ReactNode | ((props: TriggerProps) => ReactNode);
75
91
  /**
76
92
  * A `testId` prop is provided for specified elements, which is a unique
77
93
  * string that appears as a data attribute `data-testid` in the rendered code,
@@ -79,6 +95,8 @@ type Props = {
79
95
  testId?: string;
80
96
  /** Analytics context metadata */
81
97
  analyticsContext?: Record<string, any>;
82
- };
83
- export default function PropsHack(props: Props): null;
84
- export {};
98
+ /**
99
+ * Used to define the strategy of popper.
100
+ */
101
+ strategy?: 'absolute' | 'fixed' | undefined;
102
+ }
@@ -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.8.1",
3
+ "version": "17.8.3",
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,7 +24,7 @@
24
24
  "atlaskit:src": "src/index.ts",
25
25
  "atlassian": {
26
26
  "team": "Design System Team",
27
- "releaseModel": "scheduled",
27
+ "releaseModel": "continuous",
28
28
  "website": {
29
29
  "name": "Tooltip",
30
30
  "category": "Components"
@@ -45,7 +45,7 @@
45
45
  "@atlaskit/popper": "^5.5.0",
46
46
  "@atlaskit/portal": "^4.3.0",
47
47
  "@atlaskit/theme": "^12.5.0",
48
- "@atlaskit/tokens": "^1.4.0",
48
+ "@atlaskit/tokens": "^1.11.0",
49
49
  "@babel/runtime": "^7.0.0",
50
50
  "@emotion/react": "^11.7.1",
51
51
  "bind-event-listener": "^2.1.1",
@@ -56,17 +56,17 @@
56
56
  "react-dom": "^16.8.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@atlaskit/button": "^16.7.0",
59
+ "@atlaskit/button": "^16.8.0",
60
60
  "@atlaskit/docs": "*",
61
61
  "@atlaskit/icon": "^21.12.0",
62
62
  "@atlaskit/section-message": "^6.4.0",
63
63
  "@atlaskit/ssr": "*",
64
64
  "@atlaskit/visual-regression": "*",
65
- "@atlaskit/webdriver-runner": "*",
66
65
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
67
66
  "@emotion/styled": "^11.0.0",
68
67
  "@testing-library/dom": "^8.17.1",
69
68
  "@testing-library/react": "^12.1.5",
69
+ "jest-axe": "^4.0.0",
70
70
  "jest-in-case": "^1.0.2",
71
71
  "react-dom": "^16.8.0",
72
72
  "react-redux": "^5.1.2",
@@ -0,0 +1,106 @@
1
+ ## API Report File for "@atlaskit/tooltip"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { ComponentType } from 'react';
8
+ import { CSSProperties } from 'react';
9
+ import { ForwardRefExoticComponent } from 'react';
10
+ import { jsx } from '@emotion/react';
11
+ import { Placement } from '@atlaskit/popper';
12
+ import { ReactNode } from 'react';
13
+ import { RefAttributes } from 'react';
14
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
15
+
16
+ // @public (undocumented)
17
+ export type PositionType = 'mouse' | PositionTypeBase;
18
+
19
+ // @public (undocumented)
20
+ type PositionTypeBase = Placement;
21
+
22
+ // @public (undocumented)
23
+ function Tooltip({ children, position, mousePosition, content, truncate, component: Container, tag: TargetContainer, testId, delay, onShow, onHide, hideTooltipOnClick, hideTooltipOnMouseDown, analyticsContext, strategy, }: TooltipProps): jsx.JSX.Element;
24
+
25
+ // @public (undocumented)
26
+ namespace Tooltip {
27
+ var // (undocumented)
28
+ displayName: string;
29
+ }
30
+ export default Tooltip;
31
+
32
+ // @public (undocumented)
33
+ export const TooltipPrimitive: ForwardRefExoticComponent<Pick<TooltipPrimitiveProps, "children" | "className" | "id" | "onMouseOut" | "onMouseOver" | "placement" | "style" | "testId" | "truncate"> & RefAttributes<HTMLDivElement>>;
34
+
35
+ // @public (undocumented)
36
+ export interface TooltipPrimitiveProps {
37
+ // (undocumented)
38
+ children: ReactNode;
39
+ // (undocumented)
40
+ className?: string;
41
+ // (undocumented)
42
+ id?: string;
43
+ // (undocumented)
44
+ onMouseOut?: (e: React.MouseEvent<HTMLElement>) => void;
45
+ // (undocumented)
46
+ onMouseOver?: (e: React.MouseEvent<HTMLElement>) => void;
47
+ // (undocumented)
48
+ placement: PositionType;
49
+ // (undocumented)
50
+ ref: React.Ref<any>;
51
+ // (undocumented)
52
+ style?: CSSProperties;
53
+ // (undocumented)
54
+ testId?: string;
55
+ // (undocumented)
56
+ truncate?: boolean;
57
+ }
58
+
59
+ // @public (undocumented)
60
+ export interface TooltipProps {
61
+ analyticsContext?: Record<string, any>;
62
+ children: ((props: TriggerProps) => ReactNode) | ReactNode;
63
+ component?: ComponentType<TooltipPrimitiveProps>;
64
+ content: (({ update }: {
65
+ update: () => void;
66
+ }) => ReactNode) | ReactNode;
67
+ delay?: number;
68
+ hideTooltipOnClick?: boolean;
69
+ hideTooltipOnMouseDown?: boolean;
70
+ mousePosition?: PositionTypeBase;
71
+ onHide?: (analyticsEvent: UIAnalyticsEvent) => void;
72
+ onShow?: (analyticsEvent: UIAnalyticsEvent) => void;
73
+ position?: PositionType;
74
+ strategy?: 'absolute' | 'fixed' | undefined;
75
+ tag?: React.ComponentType<React.AllHTMLAttributes<HTMLElement> & {
76
+ ref: React.Ref<HTMLElement>;
77
+ }> | keyof JSX.IntrinsicElements;
78
+ testId?: string;
79
+ truncate?: boolean;
80
+ }
81
+
82
+ // @public (undocumented)
83
+ interface TriggerProps {
84
+ // (undocumented)
85
+ 'aria-describedby'?: string | undefined;
86
+ // (undocumented)
87
+ onBlur: (event: React.FocusEvent<HTMLElement>) => void;
88
+ // (undocumented)
89
+ onClick: (event: React.MouseEvent<HTMLElement>) => void;
90
+ // (undocumented)
91
+ onFocus: (event: React.FocusEvent<HTMLElement>) => void;
92
+ // (undocumented)
93
+ onMouseDown: (event: React.MouseEvent<HTMLElement>) => void;
94
+ // (undocumented)
95
+ onMouseMove: ((event: React.MouseEvent<HTMLElement>) => void) | undefined;
96
+ // (undocumented)
97
+ onMouseOut: (event: React.MouseEvent<HTMLElement>) => void;
98
+ // (undocumented)
99
+ onMouseOver: (event: React.MouseEvent<HTMLElement>) => void;
100
+ // (undocumented)
101
+ ref: (node: HTMLElement | null) => void;
102
+ }
103
+
104
+ // (No @packageDocumentation comment for this package)
105
+
106
+ ```
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = PropsHack;
7
- /* Note: this file is a workaround because extract-react-types cannot correctly process the "tag" prop
8
- It is a copy paste of the `TooltipProps` from `types.ts` except for the `tag` prop which is different */
9
-
10
- function PropsHack(props) {
11
- return null;
12
- }
@@ -1,6 +0,0 @@
1
- /* Note: this file is a workaround because extract-react-types cannot correctly process the "tag" prop
2
- It is a copy paste of the `TooltipProps` from `types.ts` except for the `tag` prop which is different */
3
-
4
- export default function PropsHack(props) {
5
- return null;
6
- }
@@ -1,6 +0,0 @@
1
- /* Note: this file is a workaround because extract-react-types cannot correctly process the "tag" prop
2
- It is a copy paste of the `TooltipProps` from `types.ts` except for the `tag` prop which is different */
3
-
4
- export default function PropsHack(props) {
5
- return null;
6
- }