@fluentui/react-tooltip 9.0.0-rc.8 → 9.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +371 -1
- package/CHANGELOG.md +117 -2
- package/dist/index.d.ts +42 -51
- package/{lib → dist}/tsdoc-metadata.json +0 -0
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.types.js.map +1 -1
- package/lib/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltip.js +11 -11
- package/lib/components/Tooltip/useTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltipStyles.js +17 -24
- package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltip.js +10 -10
- package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.js +18 -25
- package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
- package/lib-commonjs/index.js +1 -8
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +10 -12
- package/lib/Tooltip.d.ts +0 -1
- package/lib/components/Tooltip/Tooltip.d.ts +0 -7
- package/lib/components/Tooltip/Tooltip.types.d.ts +0 -118
- package/lib/components/Tooltip/index.d.ts +0 -5
- package/lib/components/Tooltip/private/constants.d.ts +0 -12
- package/lib/components/Tooltip/renderTooltip.d.ts +0 -5
- package/lib/components/Tooltip/useTooltip.d.ts +0 -10
- package/lib/components/Tooltip/useTooltipStyles.d.ts +0 -11
- package/lib/index.d.ts +0 -2
- package/lib-commonjs/Tooltip.d.ts +0 -1
- package/lib-commonjs/components/Tooltip/Tooltip.d.ts +0 -7
- package/lib-commonjs/components/Tooltip/Tooltip.types.d.ts +0 -118
- package/lib-commonjs/components/Tooltip/index.d.ts +0 -5
- package/lib-commonjs/components/Tooltip/private/constants.d.ts +0 -12
- package/lib-commonjs/components/Tooltip/renderTooltip.d.ts +0 -5
- package/lib-commonjs/components/Tooltip/useTooltip.d.ts +0 -10
- package/lib-commonjs/components/Tooltip/useTooltipStyles.d.ts +0 -11
- package/lib-commonjs/index.d.ts +0 -2
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA
|
1
|
+
{"version":3,"sources":["components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AAIa,OAAA,CAAA,iBAAA,GAAkD;EAC7D,OAAO,EAAE;AADoD,CAAlD;AAIb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAkCA;;AAEG;;;AACI,MAAM,yBAAyB,GAAI,KAAD,IAAsC;EAC7E,MAAM,MAAM,GAAG,SAAS,EAAxB;EAEA,KAAK,CAAC,OAAN,CAAc,SAAd,GAA0B,OAAA,CAAA,YAAA,CACxB,OAAA,CAAA,iBAAA,CAAkB,OADM,EAExB,MAAM,CAAC,IAFiB,EAGxB,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QAHlB,EAIxB,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAJA,EAKxB,KAAK,CAAC,OAAN,CAAc,SALU,CAA1B;EAQA,KAAK,CAAC,cAAN,GAAuB,MAAM,CAAC,KAA9B;EAEA,OAAO,KAAP;AACD,CAdM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","sourcesContent":["import { shorthands, makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { arrowHeight } from './private/constants';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\n/**\n * Styles for the tooltip\n */\nconst useStyles = makeStyles({\n root: {\n display: 'none',\n boxSizing: 'border-box',\n maxWidth: '240px',\n cursor: 'default',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n ...shorthands.padding('4px', '11px', '6px', '11px'), // '5px 12px 7px 12px' minus the border width '1px'\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n\n // TODO need to add versions of tokens.alias.shadow.shadow8, etc. that work with filter\n filter:\n `drop-shadow(0 0 2px ${tokens.colorNeutralShadowAmbient}) ` +\n `drop-shadow(0 4px 8px ${tokens.colorNeutralShadowKey})`,\n },\n\n visible: {\n display: 'block',\n },\n\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundInverted,\n color: tokens.colorNeutralForegroundInverted,\n },\n\n arrow: createArrowStyles({ arrowHeight }),\n});\n\n/**\n * Apply styling to the Tooltip slots based on the state\n */\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n const styles = useStyles();\n\n state.content.className = mergeClasses(\n tooltipClassNames.content,\n styles.root,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.content.className,\n );\n\n state.arrowClassName = styles.arrow;\n\n return state;\n};\n"],"sourceRoot":"../src/"}
|
package/lib-commonjs/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.useTooltip_unstable = exports.useTooltipStyles_unstable = exports.tooltipClassNames = exports.
|
6
|
+
exports.useTooltip_unstable = exports.useTooltipStyles_unstable = exports.tooltipClassNames = exports.renderTooltip_unstable = exports.Tooltip = void 0;
|
7
7
|
|
8
8
|
var Tooltip_1 = /*#__PURE__*/require("./Tooltip");
|
9
9
|
|
@@ -18,13 +18,6 @@ Object.defineProperty(exports, "renderTooltip_unstable", {
|
|
18
18
|
get: function () {
|
19
19
|
return Tooltip_1.renderTooltip_unstable;
|
20
20
|
}
|
21
|
-
}); // eslint-disable-next-line deprecation/deprecation
|
22
|
-
|
23
|
-
Object.defineProperty(exports, "tooltipClassName", {
|
24
|
-
enumerable: true,
|
25
|
-
get: function () {
|
26
|
-
return Tooltip_1.tooltipClassName;
|
27
|
-
}
|
28
21
|
});
|
29
22
|
Object.defineProperty(exports, "tooltipClassNames", {
|
30
23
|
enumerable: true,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;AAAA,IAAA,SAAA,gBAAA,OAAA,CAAA,WAAA,CAAA;;AACE,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,SAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,OAAA;EAAO;AAAP,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,wBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,sBAAA;EAAsB;AAAtB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,2BAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,yBAAA;EAAyB;AAAzB,CAAA;AACA,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,qBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,SAAA,CAAA,mBAAA;EAAmB;AAAnB,CAAA","sourcesContent":["export {\n Tooltip,\n renderTooltip_unstable,\n tooltipClassNames,\n useTooltipStyles_unstable,\n useTooltip_unstable,\n} from './Tooltip';\nexport type { OnVisibleChangeData, TooltipProps, TooltipSlots, TooltipState, TooltipTriggerProps } from './Tooltip';\n"],"sourceRoot":"../src/"}
|
package/package.json
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tooltip",
|
3
|
-
"version": "9.0.
|
3
|
+
"version": "9.0.1",
|
4
4
|
"description": "React components for building web experiences",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
7
|
-
"typings": "
|
7
|
+
"typings": "dist/index.d.ts",
|
8
8
|
"sideEffects": false,
|
9
9
|
"repository": {
|
10
10
|
"type": "git",
|
@@ -28,16 +28,16 @@
|
|
28
28
|
"devDependencies": {
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
30
|
"@fluentui/react-conformance": "*",
|
31
|
-
"@fluentui/react-conformance-griffel": "9.0.0-beta.
|
31
|
+
"@fluentui/react-conformance-griffel": "9.0.0-beta.10",
|
32
32
|
"@fluentui/scripts": "^1.0.0"
|
33
33
|
},
|
34
34
|
"dependencies": {
|
35
|
-
"@fluentui/react-portal": "9.0.
|
36
|
-
"@fluentui/react-positioning": "9.0.
|
37
|
-
"@fluentui/react-shared-contexts": "9.0.0
|
38
|
-
"@fluentui/react-theme": "9.0.0
|
39
|
-
"@fluentui/react-utilities": "9.0.0
|
40
|
-
"@griffel/react": "1.0
|
35
|
+
"@fluentui/react-portal": "^9.0.1",
|
36
|
+
"@fluentui/react-positioning": "^9.0.1",
|
37
|
+
"@fluentui/react-shared-contexts": "^9.0.0",
|
38
|
+
"@fluentui/react-theme": "^9.0.0",
|
39
|
+
"@fluentui/react-utilities": "^9.0.0",
|
40
|
+
"@griffel/react": "^1.2.0",
|
41
41
|
"tslib": "^2.1.0"
|
42
42
|
},
|
43
43
|
"peerDependencies": {
|
@@ -48,9 +48,7 @@
|
|
48
48
|
},
|
49
49
|
"beachball": {
|
50
50
|
"disallowedChangeTypes": [
|
51
|
-
"major"
|
52
|
-
"minor",
|
53
|
-
"patch"
|
51
|
+
"major"
|
54
52
|
]
|
55
53
|
},
|
56
54
|
"exports": {
|
package/lib/Tooltip.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './components/Tooltip/index';
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { TooltipProps } from './Tooltip.types';
|
3
|
-
import type { FluentTriggerComponent } from '@fluentui/react-utilities';
|
4
|
-
/**
|
5
|
-
* A tooltip provides light weight contextual information on top of its target element.
|
6
|
-
*/
|
7
|
-
export declare const Tooltip: React.FC<TooltipProps> & FluentTriggerComponent;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
3
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
4
|
-
import type { PortalProps } from '@fluentui/react-portal';
|
5
|
-
/**
|
6
|
-
* Slot properties for Tooltip
|
7
|
-
*/
|
8
|
-
export declare type TooltipSlots = {
|
9
|
-
/**
|
10
|
-
* The text or JSX content of the tooltip.
|
11
|
-
*/
|
12
|
-
content: NonNullable<Slot<'div'>>;
|
13
|
-
};
|
14
|
-
/**
|
15
|
-
* Properties and state for Tooltip
|
16
|
-
*/
|
17
|
-
declare type TooltipCommons = Pick<PortalProps, 'mountNode'> & {
|
18
|
-
/**
|
19
|
-
* (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.
|
20
|
-
*
|
21
|
-
* * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons
|
22
|
-
* displaying only an icon, for example.
|
23
|
-
* * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.
|
24
|
-
* * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to
|
25
|
-
* screen readers, and should only be used if the tooltip's text is available by some other means.
|
26
|
-
*/
|
27
|
-
relationship: 'label' | 'description' | 'inaccessible';
|
28
|
-
/**
|
29
|
-
* The tooltip's visual appearance.
|
30
|
-
* * `normal` - Uses the theme's background and text colors.
|
31
|
-
* * `inverted` - Higher contrast variant that uses the theme's inverted colors.
|
32
|
-
*
|
33
|
-
* @defaultvalue normal
|
34
|
-
*/
|
35
|
-
appearance?: 'normal' | 'inverted';
|
36
|
-
/**
|
37
|
-
* Render an arrow pointing to the target element
|
38
|
-
*
|
39
|
-
* @defaultvalue false
|
40
|
-
*/
|
41
|
-
withArrow?: boolean;
|
42
|
-
/**
|
43
|
-
* Configure the positioning of the tooltip
|
44
|
-
*
|
45
|
-
* @defaultvalue above
|
46
|
-
*/
|
47
|
-
positioning?: PositioningShorthand;
|
48
|
-
/**
|
49
|
-
* Control the tooltip's visibility programatically.
|
50
|
-
*
|
51
|
-
* This can be used in conjunction with onVisibleChange to modify the tooltip's show and hide behavior.
|
52
|
-
*
|
53
|
-
* If not provided, the visibility will be controlled by the tooltip itself, based on hover and focus events on the
|
54
|
-
* trigger (child) element.
|
55
|
-
*/
|
56
|
-
visible?: boolean;
|
57
|
-
/**
|
58
|
-
* Notification when the visibility of the tooltip is changing
|
59
|
-
*/
|
60
|
-
onVisibleChange?: (event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => void;
|
61
|
-
/**
|
62
|
-
* Delay before the tooltip is shown, in milliseconds.
|
63
|
-
*
|
64
|
-
* @defaultvalue 250
|
65
|
-
*/
|
66
|
-
showDelay: number;
|
67
|
-
/**
|
68
|
-
* Delay before the tooltip is hidden, in milliseconds.
|
69
|
-
*
|
70
|
-
* @defaultvalue 250
|
71
|
-
*/
|
72
|
-
hideDelay: number;
|
73
|
-
};
|
74
|
-
/**
|
75
|
-
* The properties that are added to the trigger of the Tooltip
|
76
|
-
*/
|
77
|
-
export declare type TooltipTriggerProps = {
|
78
|
-
ref?: React.Ref<never>;
|
79
|
-
} & Pick<React.HTMLAttributes<HTMLElement>, 'onPointerEnter' | 'onPointerLeave' | 'onFocus' | 'onBlur' | 'aria-describedby' | 'aria-labelledby' | 'aria-label'>;
|
80
|
-
/**
|
81
|
-
* Data for the Tooltip's onVisibleChange event.
|
82
|
-
*/
|
83
|
-
export declare type OnVisibleChangeData = {
|
84
|
-
visible: boolean;
|
85
|
-
};
|
86
|
-
/**
|
87
|
-
* Properties for Tooltip
|
88
|
-
*/
|
89
|
-
export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'relationship'>> & Pick<TooltipCommons, 'relationship'> & {
|
90
|
-
/**
|
91
|
-
* The tooltip can have a single JSX child, or a render function that accepts TooltipTriggerProps.
|
92
|
-
*
|
93
|
-
* If no child is provided, the tooltip's target must be set with the `positioning` prop, and its
|
94
|
-
* visibility must be controlled with the `visible` prop.
|
95
|
-
*/
|
96
|
-
children?: (React.ReactElement & {
|
97
|
-
ref?: React.Ref<unknown>;
|
98
|
-
}) | ((props: TooltipTriggerProps) => React.ReactElement | null) | null;
|
99
|
-
};
|
100
|
-
/**
|
101
|
-
* State used in rendering Tooltip
|
102
|
-
*/
|
103
|
-
export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons & {
|
104
|
-
children?: React.ReactElement | null;
|
105
|
-
/**
|
106
|
-
* Whether the tooltip should be rendered to the DOM.
|
107
|
-
*/
|
108
|
-
shouldRenderTooltip?: boolean;
|
109
|
-
/**
|
110
|
-
* Ref to the arrow element
|
111
|
-
*/
|
112
|
-
arrowRef?: React.Ref<HTMLDivElement>;
|
113
|
-
/**
|
114
|
-
* CSS class for the arrow element
|
115
|
-
*/
|
116
|
-
arrowClassName?: string;
|
117
|
-
};
|
118
|
-
export {};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* The height of the tooltip's arrow in pixels.
|
3
|
-
*/
|
4
|
-
export declare const arrowHeight = 6;
|
5
|
-
/**
|
6
|
-
* The default value of the tooltip's border radius (borderRadiusMedium).
|
7
|
-
*
|
8
|
-
* Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
|
9
|
-
* While we could use getComputedStyle, that adds a performance penalty for something that
|
10
|
-
* will likely never change.
|
11
|
-
*/
|
12
|
-
export declare const tooltipBorderRadius = 4;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { TooltipProps, TooltipState } from './Tooltip.types';
|
2
|
-
/**
|
3
|
-
* Create the state required to render Tooltip.
|
4
|
-
*
|
5
|
-
* The returned state can be modified with hooks such as useTooltipStyles_unstable,
|
6
|
-
* before being passed to renderTooltip_unstable.
|
7
|
-
*
|
8
|
-
* @param props - props from this instance of Tooltip
|
9
|
-
*/
|
10
|
-
export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { TooltipSlots, TooltipState } from './Tooltip.types';
|
2
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
3
|
-
/**
|
4
|
-
* @deprecated Use `tooltipClassNames.root` instead.
|
5
|
-
*/
|
6
|
-
export declare const tooltipClassName = "fui-Tooltip";
|
7
|
-
export declare const tooltipClassNames: SlotClassNames<TooltipSlots>;
|
8
|
-
/**
|
9
|
-
* Apply styling to the Tooltip slots based on the state
|
10
|
-
*/
|
11
|
-
export declare const useTooltipStyles_unstable: (state: TooltipState) => TooltipState;
|
package/lib/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './components/Tooltip/index';
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { TooltipProps } from './Tooltip.types';
|
3
|
-
import type { FluentTriggerComponent } from '@fluentui/react-utilities';
|
4
|
-
/**
|
5
|
-
* A tooltip provides light weight contextual information on top of its target element.
|
6
|
-
*/
|
7
|
-
export declare const Tooltip: React.FC<TooltipProps> & FluentTriggerComponent;
|
@@ -1,118 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
import type { PositioningShorthand } from '@fluentui/react-positioning';
|
3
|
-
import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
|
4
|
-
import type { PortalProps } from '@fluentui/react-portal';
|
5
|
-
/**
|
6
|
-
* Slot properties for Tooltip
|
7
|
-
*/
|
8
|
-
export declare type TooltipSlots = {
|
9
|
-
/**
|
10
|
-
* The text or JSX content of the tooltip.
|
11
|
-
*/
|
12
|
-
content: NonNullable<Slot<'div'>>;
|
13
|
-
};
|
14
|
-
/**
|
15
|
-
* Properties and state for Tooltip
|
16
|
-
*/
|
17
|
-
declare type TooltipCommons = Pick<PortalProps, 'mountNode'> & {
|
18
|
-
/**
|
19
|
-
* (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.
|
20
|
-
*
|
21
|
-
* * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons
|
22
|
-
* displaying only an icon, for example.
|
23
|
-
* * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.
|
24
|
-
* * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to
|
25
|
-
* screen readers, and should only be used if the tooltip's text is available by some other means.
|
26
|
-
*/
|
27
|
-
relationship: 'label' | 'description' | 'inaccessible';
|
28
|
-
/**
|
29
|
-
* The tooltip's visual appearance.
|
30
|
-
* * `normal` - Uses the theme's background and text colors.
|
31
|
-
* * `inverted` - Higher contrast variant that uses the theme's inverted colors.
|
32
|
-
*
|
33
|
-
* @defaultvalue normal
|
34
|
-
*/
|
35
|
-
appearance?: 'normal' | 'inverted';
|
36
|
-
/**
|
37
|
-
* Render an arrow pointing to the target element
|
38
|
-
*
|
39
|
-
* @defaultvalue false
|
40
|
-
*/
|
41
|
-
withArrow?: boolean;
|
42
|
-
/**
|
43
|
-
* Configure the positioning of the tooltip
|
44
|
-
*
|
45
|
-
* @defaultvalue above
|
46
|
-
*/
|
47
|
-
positioning?: PositioningShorthand;
|
48
|
-
/**
|
49
|
-
* Control the tooltip's visibility programatically.
|
50
|
-
*
|
51
|
-
* This can be used in conjunction with onVisibleChange to modify the tooltip's show and hide behavior.
|
52
|
-
*
|
53
|
-
* If not provided, the visibility will be controlled by the tooltip itself, based on hover and focus events on the
|
54
|
-
* trigger (child) element.
|
55
|
-
*/
|
56
|
-
visible?: boolean;
|
57
|
-
/**
|
58
|
-
* Notification when the visibility of the tooltip is changing
|
59
|
-
*/
|
60
|
-
onVisibleChange?: (event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => void;
|
61
|
-
/**
|
62
|
-
* Delay before the tooltip is shown, in milliseconds.
|
63
|
-
*
|
64
|
-
* @defaultvalue 250
|
65
|
-
*/
|
66
|
-
showDelay: number;
|
67
|
-
/**
|
68
|
-
* Delay before the tooltip is hidden, in milliseconds.
|
69
|
-
*
|
70
|
-
* @defaultvalue 250
|
71
|
-
*/
|
72
|
-
hideDelay: number;
|
73
|
-
};
|
74
|
-
/**
|
75
|
-
* The properties that are added to the trigger of the Tooltip
|
76
|
-
*/
|
77
|
-
export declare type TooltipTriggerProps = {
|
78
|
-
ref?: React.Ref<never>;
|
79
|
-
} & Pick<React.HTMLAttributes<HTMLElement>, 'onPointerEnter' | 'onPointerLeave' | 'onFocus' | 'onBlur' | 'aria-describedby' | 'aria-labelledby' | 'aria-label'>;
|
80
|
-
/**
|
81
|
-
* Data for the Tooltip's onVisibleChange event.
|
82
|
-
*/
|
83
|
-
export declare type OnVisibleChangeData = {
|
84
|
-
visible: boolean;
|
85
|
-
};
|
86
|
-
/**
|
87
|
-
* Properties for Tooltip
|
88
|
-
*/
|
89
|
-
export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'relationship'>> & Pick<TooltipCommons, 'relationship'> & {
|
90
|
-
/**
|
91
|
-
* The tooltip can have a single JSX child, or a render function that accepts TooltipTriggerProps.
|
92
|
-
*
|
93
|
-
* If no child is provided, the tooltip's target must be set with the `positioning` prop, and its
|
94
|
-
* visibility must be controlled with the `visible` prop.
|
95
|
-
*/
|
96
|
-
children?: (React.ReactElement & {
|
97
|
-
ref?: React.Ref<unknown>;
|
98
|
-
}) | ((props: TooltipTriggerProps) => React.ReactElement | null) | null;
|
99
|
-
};
|
100
|
-
/**
|
101
|
-
* State used in rendering Tooltip
|
102
|
-
*/
|
103
|
-
export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons & {
|
104
|
-
children?: React.ReactElement | null;
|
105
|
-
/**
|
106
|
-
* Whether the tooltip should be rendered to the DOM.
|
107
|
-
*/
|
108
|
-
shouldRenderTooltip?: boolean;
|
109
|
-
/**
|
110
|
-
* Ref to the arrow element
|
111
|
-
*/
|
112
|
-
arrowRef?: React.Ref<HTMLDivElement>;
|
113
|
-
/**
|
114
|
-
* CSS class for the arrow element
|
115
|
-
*/
|
116
|
-
arrowClassName?: string;
|
117
|
-
};
|
118
|
-
export {};
|
@@ -1,12 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* The height of the tooltip's arrow in pixels.
|
3
|
-
*/
|
4
|
-
export declare const arrowHeight = 6;
|
5
|
-
/**
|
6
|
-
* The default value of the tooltip's border radius (borderRadiusMedium).
|
7
|
-
*
|
8
|
-
* Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
|
9
|
-
* While we could use getComputedStyle, that adds a performance penalty for something that
|
10
|
-
* will likely never change.
|
11
|
-
*/
|
12
|
-
export declare const tooltipBorderRadius = 4;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import type { TooltipProps, TooltipState } from './Tooltip.types';
|
2
|
-
/**
|
3
|
-
* Create the state required to render Tooltip.
|
4
|
-
*
|
5
|
-
* The returned state can be modified with hooks such as useTooltipStyles_unstable,
|
6
|
-
* before being passed to renderTooltip_unstable.
|
7
|
-
*
|
8
|
-
* @param props - props from this instance of Tooltip
|
9
|
-
*/
|
10
|
-
export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;
|
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { TooltipSlots, TooltipState } from './Tooltip.types';
|
2
|
-
import type { SlotClassNames } from '@fluentui/react-utilities';
|
3
|
-
/**
|
4
|
-
* @deprecated Use `tooltipClassNames.root` instead.
|
5
|
-
*/
|
6
|
-
export declare const tooltipClassName = "fui-Tooltip";
|
7
|
-
export declare const tooltipClassNames: SlotClassNames<TooltipSlots>;
|
8
|
-
/**
|
9
|
-
* Apply styling to the Tooltip slots based on the state
|
10
|
-
*/
|
11
|
-
export declare const useTooltipStyles_unstable: (state: TooltipState) => TooltipState;
|
package/lib-commonjs/index.d.ts
DELETED