@instructure/ui-tooltip 8.14.0 → 8.14.1-snapshot.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/LICENSE.md +27 -0
- package/es/Tooltip/TooltipLocator.js +4 -2
- package/es/Tooltip/index.js +33 -36
- package/es/Tooltip/props.js +0 -69
- package/lib/Tooltip/TooltipLocator.js +3 -1
- package/lib/Tooltip/index.js +33 -36
- package/lib/Tooltip/props.js +0 -69
- package/package.json +17 -16
- package/src/Tooltip/index.tsx +21 -20
- package/src/Tooltip/props.ts +103 -52
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Tooltip/index.d.ts +24 -25
- package/types/Tooltip/index.d.ts.map +1 -1
- package/types/Tooltip/props.d.ts +72 -9
- package/types/Tooltip/props.d.ts.map +1 -1
package/types/Tooltip/index.d.ts
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { Component } from 'react';
|
|
3
|
+
import type { PopoverProps } from '@instructure/ui-popover';
|
|
3
4
|
import { jsx } from '@instructure/emotion';
|
|
4
|
-
import type { TooltipProps,
|
|
5
|
+
import type { TooltipProps, TooltipState } from './props';
|
|
5
6
|
/**
|
|
6
7
|
---
|
|
7
8
|
category: components
|
|
8
9
|
---
|
|
10
|
+
@tsProps
|
|
9
11
|
**/
|
|
10
|
-
declare class Tooltip extends Component<TooltipProps> {
|
|
12
|
+
declare class Tooltip extends Component<TooltipProps, TooltipState> {
|
|
11
13
|
static readonly componentId = "Tooltip";
|
|
12
14
|
static allowedProps: readonly (keyof {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
children: import("react").ReactNode | import("./props").TooltipRenderChildren;
|
|
16
|
+
renderTip: import("react").ReactNode | (() => import("react").ReactNode);
|
|
15
17
|
isShowingContent?: boolean | undefined;
|
|
16
18
|
defaultIsShowingContent?: boolean | undefined;
|
|
17
19
|
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
@@ -20,15 +22,17 @@ declare class Tooltip extends Component<TooltipProps> {
|
|
|
20
22
|
placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
|
|
21
23
|
mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
22
24
|
constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
|
|
23
|
-
positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
24
25
|
offsetX?: string | number | undefined;
|
|
25
26
|
offsetY?: string | number | undefined;
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
28
|
+
onShowContent?: ((event: import("react").UIEvent<Element, UIEvent> | import("react").FocusEvent<Element, Element>) => void) | undefined;
|
|
29
|
+
onHideContent?: ((event: import("react").UIEvent<Element, UIEvent> | import("react").FocusEvent<Element, Element>, args: {
|
|
30
|
+
documentClick: boolean;
|
|
31
|
+
}) => void) | undefined;
|
|
28
32
|
})[];
|
|
29
33
|
static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
children: import("react").ReactNode | import("./props").TooltipRenderChildren;
|
|
35
|
+
renderTip: import("react").ReactNode | (() => import("react").ReactNode);
|
|
32
36
|
isShowingContent?: boolean | undefined;
|
|
33
37
|
defaultIsShowingContent?: boolean | undefined;
|
|
34
38
|
as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
|
|
@@ -37,36 +41,31 @@ declare class Tooltip extends Component<TooltipProps> {
|
|
|
37
41
|
placement?: import("@instructure/ui-position").PlacementPropValues | undefined;
|
|
38
42
|
mountNode?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
39
43
|
constrain?: import("@instructure/ui-position").PositionConstraint | undefined;
|
|
40
|
-
positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
41
44
|
offsetX?: string | number | undefined;
|
|
42
45
|
offsetY?: string | number | undefined;
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
positionTarget?: import("@instructure/ui-position").PositionMountNode | undefined;
|
|
47
|
+
onShowContent?: ((event: import("react").UIEvent<Element, UIEvent> | import("react").FocusEvent<Element, Element>) => void) | undefined;
|
|
48
|
+
onHideContent?: ((event: import("react").UIEvent<Element, UIEvent> | import("react").FocusEvent<Element, Element>, args: {
|
|
49
|
+
documentClick: boolean;
|
|
50
|
+
}) => void) | undefined;
|
|
45
51
|
}>;
|
|
46
52
|
static defaultProps: {
|
|
47
53
|
readonly defaultIsShowingContent: false;
|
|
48
54
|
readonly color: "primary";
|
|
49
55
|
readonly placement: "top";
|
|
50
|
-
readonly mountNode: null;
|
|
51
56
|
readonly constrain: "window";
|
|
52
57
|
readonly offsetX: 0;
|
|
53
58
|
readonly offsetY: 0;
|
|
54
|
-
readonly onShowContent: (event: any) => void;
|
|
55
|
-
readonly onHideContent: (event: any, { documentClick }: {
|
|
56
|
-
documentClick: any;
|
|
57
|
-
}) => void;
|
|
58
|
-
};
|
|
59
|
-
_id: string;
|
|
60
|
-
state: {
|
|
61
|
-
hasFocus: boolean;
|
|
62
59
|
};
|
|
60
|
+
private readonly _id;
|
|
63
61
|
ref: Element | null;
|
|
64
62
|
handleRef: (el: Element | null) => void;
|
|
63
|
+
constructor(props: TooltipProps);
|
|
65
64
|
componentDidMount(): void;
|
|
66
|
-
componentDidUpdate(
|
|
67
|
-
handleFocus:
|
|
68
|
-
handleBlur:
|
|
69
|
-
renderTrigger():
|
|
65
|
+
componentDidUpdate(): void;
|
|
66
|
+
handleFocus: PopoverProps['onFocus'];
|
|
67
|
+
handleBlur: PopoverProps['onBlur'];
|
|
68
|
+
renderTrigger(): any;
|
|
70
69
|
render(): jsx.JSX.Element;
|
|
71
70
|
}
|
|
72
71
|
export default Tooltip;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAYjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Tooltip/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAYjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAKrD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAGzD;;;;;GAKG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,EAAE,YAAY,CAAC;IACzD,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;;;OAAY;IAE5B,MAAM,CAAC,YAAY;;;;;;;MAOT;IAEV,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAE5B,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAE9B;gBAEW,KAAK,EAAE,YAAY;IAQ/B,iBAAiB;IAIjB,kBAAkB;IAIlB,WAAW,EAAE,YAAY,CAAC,SAAS,CAAC,CAEnC;IAED,UAAU,EAAE,YAAY,CAAC,QAAQ,CAAC,CAEjC;IAED,aAAa;IA6Bb,MAAM;CAiDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/types/Tooltip/props.d.ts
CHANGED
|
@@ -1,37 +1,100 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PropValidators, AsElementType, TooltipTheme } from '@instructure/shared-types';
|
|
2
|
+
import type { PropValidators, AsElementType, TooltipTheme, OtherHTMLAttributes } from '@instructure/shared-types';
|
|
3
3
|
import type { PlacementPropValues, PositionConstraint, PositionMountNode } from '@instructure/ui-position';
|
|
4
4
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
5
|
+
import type { PopoverOwnProps } from '@instructure/ui-popover';
|
|
5
6
|
declare type TooltipRenderChildrenArgs = {
|
|
6
7
|
focused: boolean;
|
|
7
|
-
getTriggerProps: <
|
|
8
|
+
getTriggerProps: <TriggerProps extends Record<string, any>>(props: TriggerProps) => {
|
|
8
9
|
'aria-describedby': string;
|
|
9
|
-
} &
|
|
10
|
+
} & TriggerProps;
|
|
10
11
|
};
|
|
11
12
|
declare type TooltipRenderChildren = (args: TooltipRenderChildrenArgs) => React.ReactNode;
|
|
12
13
|
declare type TooltipOwnProps = {
|
|
13
|
-
|
|
14
|
+
/**
|
|
15
|
+
* A ReactNode or a function that returns a ReactNode with the following params:
|
|
16
|
+
*
|
|
17
|
+
* @param {Boolean} focused - Is the Tooltip trigger focused?
|
|
18
|
+
* @param {Function} getTriggerProps - Props to be spread onto the trigger element
|
|
19
|
+
*/
|
|
14
20
|
children: React.ReactNode | TooltipRenderChildren;
|
|
21
|
+
/**
|
|
22
|
+
* The content to render in the tooltip
|
|
23
|
+
*/
|
|
24
|
+
renderTip: React.ReactNode | (() => React.ReactNode);
|
|
25
|
+
/**
|
|
26
|
+
* Whether or not the tooltip content is shown, when controlled
|
|
27
|
+
*/
|
|
15
28
|
isShowingContent?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether or not to show the content by default, when uncontrolled
|
|
31
|
+
*/
|
|
16
32
|
defaultIsShowingContent?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* the element type to render as (assumes a single child if 'as' is undefined)
|
|
35
|
+
*/
|
|
17
36
|
as?: AsElementType;
|
|
37
|
+
/**
|
|
38
|
+
* The action that causes the Content to display (`click`, `hover`, `focus`)
|
|
39
|
+
*/
|
|
18
40
|
on?: ('click' | 'hover' | 'focus') | ('click' | 'hover' | 'focus')[];
|
|
41
|
+
/**
|
|
42
|
+
* The color of the tooltip content
|
|
43
|
+
*/
|
|
19
44
|
color?: 'primary' | 'primary-inverse';
|
|
45
|
+
/**
|
|
46
|
+
* Specifies where the Tooltip will be placed in relation to the target element.
|
|
47
|
+
* Ex. placement="bottom" will render the Tooltip below the triggering element
|
|
48
|
+
* (Note: if there is not room, it will position opposite. Ex. "top" will
|
|
49
|
+
* automatically switch to "bottom")
|
|
50
|
+
*/
|
|
20
51
|
placement?: PlacementPropValues;
|
|
52
|
+
/**
|
|
53
|
+
* An element or a function returning an element to use as the mount node
|
|
54
|
+
* for the `<Tooltip />` (defaults to `document.body`)
|
|
55
|
+
*/
|
|
21
56
|
mountNode?: PositionMountNode;
|
|
57
|
+
/**
|
|
58
|
+
* The parent in which to constrain the tooltip.
|
|
59
|
+
* One of: 'window', 'scroll-parent', 'parent', 'none', an element,
|
|
60
|
+
* or a function returning an element
|
|
61
|
+
*/
|
|
22
62
|
constrain?: PositionConstraint;
|
|
23
|
-
|
|
63
|
+
/**
|
|
64
|
+
* The horizontal offset for the positioned content
|
|
65
|
+
*/
|
|
24
66
|
offsetX?: string | number;
|
|
67
|
+
/**
|
|
68
|
+
* The vertical offset for the positioned content
|
|
69
|
+
*/
|
|
25
70
|
offsetY?: string | number;
|
|
26
|
-
|
|
27
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Target element for positioning the Tooltip (if it differs from children/trigger)
|
|
73
|
+
*/
|
|
74
|
+
positionTarget?: PositionMountNode;
|
|
75
|
+
/**
|
|
76
|
+
* Callback fired when content is shown. When controlled, this callback is
|
|
77
|
+
* fired when the tooltip expects to be shown
|
|
78
|
+
*/
|
|
79
|
+
onShowContent?: (event: React.UIEvent | React.FocusEvent) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Callback fired when content is hidden. When controlled, this callback is
|
|
82
|
+
* fired when the tooltip expects to be hidden
|
|
83
|
+
*/
|
|
84
|
+
onHideContent?: (event: React.UIEvent | React.FocusEvent, args: {
|
|
85
|
+
documentClick: boolean;
|
|
86
|
+
}) => void;
|
|
28
87
|
};
|
|
29
88
|
declare type PropKeys = keyof TooltipOwnProps;
|
|
30
89
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
31
|
-
declare type
|
|
90
|
+
declare type PropsPassableToPopover = Omit<PopoverOwnProps, 'isShowingContent' | 'defaultIsShowingContent' | 'on' | 'shouldRenderOffscreen' | 'shouldReturnFocus' | 'placement' | 'color' | 'mountNode' | 'constrain' | 'shadow' | 'offsetX' | 'offsetY' | 'positionTarget' | 'renderTrigger' | 'onShowContent' | 'onHideContent' | 'onFocus' | 'onBlur' | 'elementRef'>;
|
|
91
|
+
declare type TooltipProps = PropsPassableToPopover & TooltipOwnProps & WithStyleProps<TooltipTheme, TooltipStyle> & OtherHTMLAttributes<TooltipOwnProps>;
|
|
32
92
|
declare type TooltipStyle = ComponentStyle<'tooltip'>;
|
|
93
|
+
declare type TooltipState = {
|
|
94
|
+
hasFocus: boolean;
|
|
95
|
+
};
|
|
33
96
|
declare const propTypes: PropValidators<PropKeys>;
|
|
34
97
|
declare const allowedProps: AllowedPropKeys;
|
|
35
|
-
export type { TooltipProps, TooltipStyle, TooltipRenderChildren, TooltipRenderChildrenArgs };
|
|
98
|
+
export type { TooltipProps, TooltipState, TooltipStyle, TooltipRenderChildren, TooltipRenderChildrenArgs };
|
|
36
99
|
export { propTypes, allowedProps };
|
|
37
100
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Tooltip/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,YAAY,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Tooltip/props.ts"],"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