@fluentui/react-tooltip 9.2.3 → 9.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/.swcrc +30 -0
- package/CHANGELOG.json +91 -1
- package/CHANGELOG.md +30 -2
- package/lib/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +1 -0
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.types.js +1 -1
- package/lib/components/Tooltip/Tooltip.types.js.map +1 -1
- package/lib/components/Tooltip/index.js.map +1 -1
- package/lib/components/Tooltip/private/constants.js +1 -2
- package/lib/components/Tooltip/private/constants.js.map +1 -1
- package/lib/components/Tooltip/renderTooltip.js +1 -3
- package/lib/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltip.js +7 -7
- package/lib/components/Tooltip/useTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Tooltip.js +5 -4
- package/lib-commonjs/Tooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.js +20 -21
- package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.types.js +5 -2
- package/lib-commonjs/components/Tooltip/Tooltip.types.js.map +1 -1
- package/lib-commonjs/components/Tooltip/index.js +9 -8
- package/lib-commonjs/components/Tooltip/index.js.map +1 -1
- package/lib-commonjs/components/Tooltip/private/constants.js +17 -16
- package/lib-commonjs/components/Tooltip/private/constants.js.map +1 -1
- package/lib-commonjs/components/Tooltip/renderTooltip.js +19 -24
- package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltip.js +191 -194
- package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.js +200 -92
- package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
- package/lib-commonjs/index.js +16 -33
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +11 -10
- package/lib-amd/Tooltip.js +0 -6
- package/lib-amd/Tooltip.js.map +0 -1
- package/lib-amd/components/Tooltip/Tooltip.js +0 -20
- package/lib-amd/components/Tooltip/Tooltip.js.map +0 -1
- package/lib-amd/components/Tooltip/Tooltip.types.js +0 -5
- package/lib-amd/components/Tooltip/Tooltip.types.js.map +0 -1
- package/lib-amd/components/Tooltip/index.js +0 -10
- package/lib-amd/components/Tooltip/index.js.map +0 -1
- package/lib-amd/components/Tooltip/private/constants.js +0 -18
- package/lib-amd/components/Tooltip/private/constants.js.map +0 -1
- package/lib-amd/components/Tooltip/renderTooltip.js +0 -19
- package/lib-amd/components/Tooltip/renderTooltip.js.map +0 -1
- package/lib-amd/components/Tooltip/useTooltip.js +0 -158
- package/lib-amd/components/Tooltip/useTooltip.js.map +0 -1
- package/lib-amd/components/Tooltip/useTooltipStyles.js +0 -36
- package/lib-amd/components/Tooltip/useTooltipStyles.js.map +0 -1
- package/lib-amd/index.js +0 -11
- package/lib-amd/index.js.map +0 -1
@@ -1,19 +1,20 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.tooltipBorderRadius = exports.arrowHeight = void 0;
|
7
1
|
/**
|
8
2
|
* The height of the tooltip's arrow in pixels.
|
9
|
-
*/
|
10
|
-
exports
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
3
|
+
*/ "use strict";
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
function _export(target, all) {
|
8
|
+
for(var name in all)Object.defineProperty(target, name, {
|
9
|
+
enumerable: true,
|
10
|
+
get: all[name]
|
11
|
+
});
|
12
|
+
}
|
13
|
+
_export(exports, {
|
14
|
+
arrowHeight: ()=>arrowHeight,
|
15
|
+
tooltipBorderRadius: ()=>tooltipBorderRadius
|
16
|
+
});
|
17
|
+
const arrowHeight = 6;
|
18
|
+
const tooltipBorderRadius = 4; //# sourceMappingURL=constants.js.map
|
19
|
+
|
19
20
|
//# sourceMappingURL=constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../../lib/components/Tooltip/private/constants.js"],"sourcesContent":["/**\n * The height of the tooltip's arrow in pixels.\n */export const arrowHeight = 6;\n/**\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const tooltipBorderRadius = 4;\n//# sourceMappingURL=constants.js.map"],"names":["arrowHeight","tooltipBorderRadius"],"mappings":"AAAA;;CAEC;;;;;;;;;;;IAAeA,WAAW,MAAXA;IAQHC,mBAAmB,MAAnBA;;AARH,MAAMD,cAAc;AAQvB,MAAMC,sBAAsB,GACnC,qCAAqC"}
|
@@ -1,28 +1,23 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
4
|
+
});
|
5
|
+
Object.defineProperty(exports, "renderTooltip_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>renderTooltip_unstable
|
5
8
|
});
|
6
|
-
|
7
|
-
const
|
8
|
-
const
|
9
|
-
const
|
10
|
-
|
11
|
-
|
12
|
-
*/
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
}, React.createElement(slots.content, {
|
21
|
-
...slotProps.content
|
22
|
-
}, state.withArrow && React.createElement("div", {
|
23
|
-
ref: state.arrowRef,
|
24
|
-
className: state.arrowClassName
|
25
|
-
}), state.content.children)));
|
26
|
-
};
|
27
|
-
exports.renderTooltip_unstable = renderTooltip_unstable;
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactPortal = require("@fluentui/react-portal");
|
12
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
13
|
+
const renderTooltip_unstable = (state)=>{
|
14
|
+
const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
|
15
|
+
return /*#__PURE__*/ _react.createElement(_react.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/ _react.createElement(_reactPortal.Portal, {
|
16
|
+
mountNode: state.mountNode
|
17
|
+
}, /*#__PURE__*/ _react.createElement(slots.content, slotProps.content, state.withArrow && /*#__PURE__*/ _react.createElement("div", {
|
18
|
+
ref: state.arrowRef,
|
19
|
+
className: state.arrowClassName
|
20
|
+
}), state.content.children)));
|
21
|
+
}; //# sourceMappingURL=renderTooltip.js.map
|
22
|
+
|
28
23
|
//# sourceMappingURL=renderTooltip.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"
|
1
|
+
{"version":3,"sources":["../../../lib/components/Tooltip/renderTooltip.js"],"sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n return /*#__PURE__*/React.createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/React.createElement(Portal, {\n mountNode: state.mountNode\n }, /*#__PURE__*/React.createElement(slots.content, slotProps.content, state.withArrow && /*#__PURE__*/React.createElement(\"div\", {\n ref: state.arrowRef,\n className: state.arrowClassName\n }), state.content.children)));\n};\n//# sourceMappingURL=renderTooltip.js.map"],"names":["renderTooltip_unstable","state","slots","slotProps","getSlots","React","createElement","Fragment","children","shouldRenderTooltip","Portal","mountNode","content","withArrow","ref","arrowRef","className","arrowClassName"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;6BACA;gCACE;AAIlB,MAAMA,yBAAyBC,CAAAA,QAAS;IAC7C,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,OAAO,WAAW,GAAEI,OAAMC,aAAa,CAACD,OAAME,QAAQ,EAAE,IAAI,EAAEN,MAAMO,QAAQ,EAAEP,MAAMQ,mBAAmB,IAAI,WAAW,GAAEJ,OAAMC,aAAa,CAACI,mBAAM,EAAE;QAClJC,WAAWV,MAAMU,SAAS;IAC5B,GAAG,WAAW,GAAEN,OAAMC,aAAa,CAACJ,MAAMU,OAAO,EAAET,UAAUS,OAAO,EAAEX,MAAMY,SAAS,IAAI,WAAW,GAAER,OAAMC,aAAa,CAAC,OAAO;QAC/HQ,KAAKb,MAAMc,QAAQ;QACnBC,WAAWf,MAAMgB,cAAc;IACjC,IAAIhB,MAAMW,OAAO,CAACJ,QAAQ;AAC5B,GACA,yCAAyC"}
|
@@ -1,203 +1,200 @@
|
|
1
1
|
"use strict";
|
2
|
-
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
4
|
-
|
3
|
+
value: true
|
5
4
|
});
|
6
|
-
exports
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
const
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
} = react_shared_contexts_1.useFluent_unstable();
|
28
|
-
const [setDelayTimeout, clearDelayTimeout] = react_utilities_1.useTimeout();
|
29
|
-
const {
|
30
|
-
appearance = 'normal',
|
31
|
-
children,
|
32
|
-
content,
|
33
|
-
withArrow = false,
|
34
|
-
positioning = 'above',
|
35
|
-
onVisibleChange,
|
36
|
-
relationship,
|
37
|
-
showDelay = 250,
|
38
|
-
hideDelay = 250,
|
39
|
-
mountNode
|
40
|
-
} = props;
|
41
|
-
const [visible, setVisibleInternal] = react_utilities_1.useControllableState({
|
42
|
-
state: props.visible,
|
43
|
-
initialState: false
|
44
|
-
});
|
45
|
-
const setVisible = React.useCallback((newVisible, ev) => {
|
46
|
-
clearDelayTimeout();
|
47
|
-
setVisibleInternal(oldVisible => {
|
48
|
-
if (newVisible !== oldVisible) {
|
49
|
-
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {
|
50
|
-
visible: newVisible
|
51
|
-
});
|
52
|
-
}
|
53
|
-
return newVisible;
|
5
|
+
Object.defineProperty(exports, "useTooltip_unstable", {
|
6
|
+
enumerable: true,
|
7
|
+
get: ()=>useTooltip_unstable
|
8
|
+
});
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
11
|
+
const _reactPositioning = require("@fluentui/react-positioning");
|
12
|
+
const _reactSharedContexts = require("@fluentui/react-shared-contexts");
|
13
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
14
|
+
const _constants = require("./private/constants");
|
15
|
+
const _keyboardKeys = require("@fluentui/keyboard-keys");
|
16
|
+
const useTooltip_unstable = (props)=>{
|
17
|
+
var _child_props, _child_props1, _child_props2, _child_props3;
|
18
|
+
const context = (0, _reactSharedContexts.useTooltipVisibility_unstable)();
|
19
|
+
const isServerSideRender = (0, _reactUtilities.useIsSSR)();
|
20
|
+
const { targetDocument } = (0, _reactSharedContexts.useFluent_unstable)();
|
21
|
+
const [setDelayTimeout, clearDelayTimeout] = (0, _reactUtilities.useTimeout)();
|
22
|
+
const { appearance ='normal' , children , content , withArrow =false , positioning ='above' , onVisibleChange , relationship , showDelay =250 , hideDelay =250 , mountNode } = props;
|
23
|
+
const [visible, setVisibleInternal] = (0, _reactUtilities.useControllableState)({
|
24
|
+
state: props.visible,
|
25
|
+
initialState: false
|
54
26
|
});
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
appearance,
|
65
|
-
mountNode,
|
66
|
-
// Slots
|
67
|
-
components: {
|
68
|
-
content: 'div'
|
69
|
-
},
|
70
|
-
content: react_utilities_1.resolveShorthand(content, {
|
71
|
-
defaultProps: {
|
72
|
-
role: 'tooltip'
|
73
|
-
},
|
74
|
-
required: true
|
75
|
-
})
|
76
|
-
};
|
77
|
-
state.content.id = react_utilities_1.useId('tooltip-', state.content.id);
|
78
|
-
const positioningOptions = {
|
79
|
-
enabled: state.visible,
|
80
|
-
arrowPadding: 2 * constants_1.tooltipBorderRadius,
|
81
|
-
position: 'above',
|
82
|
-
align: 'center',
|
83
|
-
offset: 4,
|
84
|
-
...react_positioning_1.resolvePositioningShorthand(state.positioning)
|
85
|
-
};
|
86
|
-
if (state.withArrow) {
|
87
|
-
positioningOptions.offset = react_positioning_1.mergeArrowOffset(positioningOptions.offset, constants_1.arrowHeight);
|
88
|
-
}
|
89
|
-
const {
|
90
|
-
targetRef,
|
91
|
-
containerRef,
|
92
|
-
arrowRef
|
93
|
-
} = react_positioning_1.usePositioning(positioningOptions);
|
94
|
-
state.content.ref = react_utilities_1.useMergedRefs(state.content.ref, containerRef);
|
95
|
-
state.arrowRef = arrowRef;
|
96
|
-
// When this tooltip is visible, hide any other tooltips, and register it
|
97
|
-
// as the visibleTooltip with the TooltipContext.
|
98
|
-
// Also add a listener on document to hide the tooltip if Escape is pressed
|
99
|
-
react_utilities_1.useIsomorphicLayoutEffect(() => {
|
100
|
-
var _a;
|
101
|
-
if (visible) {
|
102
|
-
const thisTooltip = {
|
103
|
-
hide: () => setVisible(false)
|
104
|
-
};
|
105
|
-
(_a = context.visibleTooltip) === null || _a === void 0 ? void 0 : _a.hide();
|
106
|
-
context.visibleTooltip = thisTooltip;
|
107
|
-
const onDocumentKeyDown = ev => {
|
108
|
-
if (ev.key === keyboard_keys_1.Escape) {
|
109
|
-
thisTooltip.hide();
|
110
|
-
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
111
|
-
// e,g: Dialog, Popover, Menu
|
112
|
-
ev.stopPropagation();
|
113
|
-
}
|
114
|
-
};
|
115
|
-
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {
|
116
|
-
// As this event is added at targeted document,
|
117
|
-
// we need to capture the event to be sure keydown handling from tooltip happens first
|
118
|
-
capture: true
|
119
|
-
});
|
120
|
-
return () => {
|
121
|
-
if (context.visibleTooltip === thisTooltip) {
|
122
|
-
context.visibleTooltip = undefined;
|
123
|
-
}
|
124
|
-
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
|
125
|
-
capture: true
|
27
|
+
const setVisible = _react.useCallback((newVisible, ev)=>{
|
28
|
+
clearDelayTimeout();
|
29
|
+
setVisibleInternal((oldVisible)=>{
|
30
|
+
if (newVisible !== oldVisible) {
|
31
|
+
onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {
|
32
|
+
visible: newVisible
|
33
|
+
});
|
34
|
+
}
|
35
|
+
return newVisible;
|
126
36
|
});
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
37
|
+
}, [
|
38
|
+
clearDelayTimeout,
|
39
|
+
setVisibleInternal,
|
40
|
+
onVisibleChange
|
41
|
+
]);
|
42
|
+
const state = {
|
43
|
+
withArrow,
|
44
|
+
positioning,
|
45
|
+
showDelay,
|
46
|
+
hideDelay,
|
47
|
+
relationship,
|
48
|
+
visible,
|
49
|
+
shouldRenderTooltip: visible,
|
50
|
+
appearance,
|
51
|
+
mountNode,
|
52
|
+
// Slots
|
53
|
+
components: {
|
54
|
+
content: 'div'
|
55
|
+
},
|
56
|
+
content: (0, _reactUtilities.resolveShorthand)(content, {
|
57
|
+
defaultProps: {
|
58
|
+
role: 'tooltip'
|
59
|
+
},
|
60
|
+
required: true
|
61
|
+
})
|
62
|
+
};
|
63
|
+
state.content.id = (0, _reactUtilities.useId)('tooltip-', state.content.id);
|
64
|
+
const positioningOptions = {
|
65
|
+
enabled: state.visible,
|
66
|
+
arrowPadding: 2 * _constants.tooltipBorderRadius,
|
67
|
+
position: 'above',
|
68
|
+
align: 'center',
|
69
|
+
offset: 4,
|
70
|
+
...(0, _reactPositioning.resolvePositioningShorthand)(state.positioning)
|
71
|
+
};
|
72
|
+
if (state.withArrow) {
|
73
|
+
positioningOptions.offset = (0, _reactPositioning.mergeArrowOffset)(positioningOptions.offset, _constants.arrowHeight);
|
141
74
|
}
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
75
|
+
const { targetRef , containerRef , arrowRef } = (0, _reactPositioning.usePositioning)(positioningOptions);
|
76
|
+
state.content.ref = (0, _reactUtilities.useMergedRefs)(state.content.ref, containerRef);
|
77
|
+
state.arrowRef = arrowRef;
|
78
|
+
// When this tooltip is visible, hide any other tooltips, and register it
|
79
|
+
// as the visibleTooltip with the TooltipContext.
|
80
|
+
// Also add a listener on document to hide the tooltip if Escape is pressed
|
81
|
+
(0, _reactUtilities.useIsomorphicLayoutEffect)(()=>{
|
82
|
+
if (visible) {
|
83
|
+
var _context_visibleTooltip;
|
84
|
+
const thisTooltip = {
|
85
|
+
hide: ()=>setVisible(false)
|
86
|
+
};
|
87
|
+
(_context_visibleTooltip = context.visibleTooltip) === null || _context_visibleTooltip === void 0 ? void 0 : _context_visibleTooltip.hide();
|
88
|
+
context.visibleTooltip = thisTooltip;
|
89
|
+
const onDocumentKeyDown = (ev)=>{
|
90
|
+
if (ev.key === _keyboardKeys.Escape) {
|
91
|
+
thisTooltip.hide();
|
92
|
+
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
93
|
+
// e,g: Dialog, Popover, Menu
|
94
|
+
ev.stopPropagation();
|
95
|
+
}
|
96
|
+
};
|
97
|
+
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {
|
98
|
+
// As this event is added at targeted document,
|
99
|
+
// we need to capture the event to be sure keydown handling from tooltip happens first
|
100
|
+
capture: true
|
101
|
+
});
|
102
|
+
return ()=>{
|
103
|
+
if (context.visibleTooltip === thisTooltip) {
|
104
|
+
context.visibleTooltip = undefined;
|
105
|
+
}
|
106
|
+
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
|
107
|
+
capture: true
|
108
|
+
});
|
109
|
+
};
|
110
|
+
}
|
111
|
+
}, [
|
112
|
+
context,
|
113
|
+
targetDocument,
|
114
|
+
visible,
|
115
|
+
setVisible
|
116
|
+
]);
|
117
|
+
// The focused element gets a blur event when the document loses focus
|
118
|
+
// (e.g. switching tabs in the browser), but we don't want to show the
|
119
|
+
// tooltip again when the document gets focus back. Handle this case by
|
120
|
+
// checking if the blurred element is still the document's activeElement.
|
121
|
+
// See https://github.com/microsoft/fluentui/issues/13541
|
122
|
+
const ignoreNextFocusEventRef = _react.useRef(false);
|
123
|
+
// Listener for onPointerEnter and onFocus on the trigger element
|
124
|
+
const onEnterTrigger = _react.useCallback((ev)=>{
|
125
|
+
if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {
|
126
|
+
ignoreNextFocusEventRef.current = false;
|
127
|
+
return;
|
128
|
+
}
|
129
|
+
// Show immediately if another tooltip is already visible
|
130
|
+
const delay = context.visibleTooltip ? 0 : state.showDelay;
|
131
|
+
setDelayTimeout(()=>{
|
132
|
+
setVisible(true, ev);
|
133
|
+
}, delay);
|
134
|
+
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
|
135
|
+
}, [
|
136
|
+
setDelayTimeout,
|
137
|
+
setVisible,
|
138
|
+
state.showDelay,
|
139
|
+
context
|
140
|
+
]);
|
141
|
+
// Listener for onPointerLeave and onBlur on the trigger element
|
142
|
+
const onLeaveTrigger = _react.useCallback((ev)=>{
|
143
|
+
let delay = state.hideDelay;
|
144
|
+
if (ev.type === 'blur') {
|
145
|
+
// Hide immediately when losing focus
|
146
|
+
delay = 0;
|
147
|
+
ignoreNextFocusEventRef.current = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === ev.target;
|
148
|
+
}
|
149
|
+
setDelayTimeout(()=>{
|
150
|
+
setVisible(false, ev);
|
151
|
+
}, delay);
|
152
|
+
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
|
153
|
+
}, [
|
154
|
+
setDelayTimeout,
|
155
|
+
setVisible,
|
156
|
+
state.hideDelay,
|
157
|
+
targetDocument
|
158
|
+
]);
|
159
|
+
// Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.
|
160
|
+
// This keeps the tooltip visible when the mouse is moved over it, or it has focus within.
|
161
|
+
state.content.onPointerEnter = (0, _reactUtilities.mergeCallbacks)(state.content.onPointerEnter, clearDelayTimeout);
|
162
|
+
state.content.onPointerLeave = (0, _reactUtilities.mergeCallbacks)(state.content.onPointerLeave, onLeaveTrigger);
|
163
|
+
state.content.onFocus = (0, _reactUtilities.mergeCallbacks)(state.content.onFocus, clearDelayTimeout);
|
164
|
+
state.content.onBlur = (0, _reactUtilities.mergeCallbacks)(state.content.onBlur, onLeaveTrigger);
|
165
|
+
const child = (0, _reactUtilities.getTriggerChild)(children);
|
166
|
+
const triggerAriaProps = {};
|
167
|
+
if (relationship === 'label') {
|
168
|
+
// aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
|
169
|
+
if (typeof state.content.children === 'string') {
|
170
|
+
triggerAriaProps['aria-label'] = state.content.children;
|
171
|
+
} else {
|
172
|
+
triggerAriaProps['aria-labelledby'] = state.content.id;
|
173
|
+
// Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
|
174
|
+
state.shouldRenderTooltip = true;
|
175
|
+
}
|
176
|
+
} else if (relationship === 'description') {
|
177
|
+
triggerAriaProps['aria-describedby'] = state.content.id;
|
178
|
+
// Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
|
179
|
+
state.shouldRenderTooltip = true;
|
156
180
|
}
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
ev.persist(); // Persist the event since the setVisible call will happen asynchronously
|
161
|
-
}, [setDelayTimeout, setVisible, state.hideDelay, targetDocument]);
|
162
|
-
// Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.
|
163
|
-
// This keeps the tooltip visible when the mouse is moved over it, or it has focus within.
|
164
|
-
state.content.onPointerEnter = react_utilities_1.mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);
|
165
|
-
state.content.onPointerLeave = react_utilities_1.mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);
|
166
|
-
state.content.onFocus = react_utilities_1.mergeCallbacks(state.content.onFocus, clearDelayTimeout);
|
167
|
-
state.content.onBlur = react_utilities_1.mergeCallbacks(state.content.onBlur, onLeaveTrigger);
|
168
|
-
const child = react_utilities_1.getTriggerChild(children);
|
169
|
-
const triggerAriaProps = {};
|
170
|
-
if (relationship === 'label') {
|
171
|
-
// aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
|
172
|
-
if (typeof state.content.children === 'string') {
|
173
|
-
triggerAriaProps['aria-label'] = state.content.children;
|
174
|
-
} else {
|
175
|
-
triggerAriaProps['aria-labelledby'] = state.content.id;
|
176
|
-
// Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
|
177
|
-
state.shouldRenderTooltip = true;
|
181
|
+
// Don't render the Tooltip in SSR to avoid hydration errors
|
182
|
+
if (isServerSideRender) {
|
183
|
+
state.shouldRenderTooltip = false;
|
178
184
|
}
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
ref: positioningOptions.target === undefined ? childTargetRef : child === null || child === void 0 ? void 0 : child.ref,
|
195
|
-
onPointerEnter: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger)),
|
196
|
-
onPointerLeave: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger)),
|
197
|
-
onFocus: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger)),
|
198
|
-
onBlur: react_utilities_1.useEventCallback(react_utilities_1.mergeCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger))
|
199
|
-
});
|
200
|
-
return state;
|
201
|
-
};
|
202
|
-
exports.useTooltip_unstable = useTooltip_unstable;
|
185
|
+
const childTargetRef = (0, _reactUtilities.useMergedRefs)(child === null || child === void 0 ? void 0 : child.ref, targetRef);
|
186
|
+
// Apply the trigger props to the child, either by calling the render function, or cloning with the new props
|
187
|
+
state.children = (0, _reactUtilities.applyTriggerPropsToChildren)(children, {
|
188
|
+
...triggerAriaProps,
|
189
|
+
...child === null || child === void 0 ? void 0 : child.props,
|
190
|
+
// If the target prop is not provided, attach targetRef to the trigger element's ref prop
|
191
|
+
ref: positioningOptions.target === undefined ? childTargetRef : child === null || child === void 0 ? void 0 : child.ref,
|
192
|
+
onPointerEnter: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props = child.props) === null || _child_props === void 0 ? void 0 : _child_props.onPointerEnter, onEnterTrigger)),
|
193
|
+
onPointerLeave: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.onPointerLeave, onLeaveTrigger)),
|
194
|
+
onFocus: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.onFocus, onEnterTrigger)),
|
195
|
+
onBlur: (0, _reactUtilities.useEventCallback)((0, _reactUtilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props3 = child.props) === null || _child_props3 === void 0 ? void 0 : _child_props3.onBlur, onLeaveTrigger))
|
196
|
+
});
|
197
|
+
return state;
|
198
|
+
}; //# sourceMappingURL=useTooltip.js.map
|
199
|
+
|
203
200
|
//# sourceMappingURL=useTooltip.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["React","require","react_positioning_1","react_shared_contexts_1","react_utilities_1","constants_1","keyboard_keys_1","useTooltip_unstable","props","context","useTooltipVisibility_unstable","isServerSideRender","useIsSSR","targetDocument","useFluent_unstable","setDelayTimeout","clearDelayTimeout","useTimeout","appearance","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","visible","setVisibleInternal","useControllableState","state","initialState","setVisible","useCallback","newVisible","ev","oldVisible","shouldRenderTooltip","components","resolveShorthand","defaultProps","role","required","id","useId","positioningOptions","enabled","arrowPadding","tooltipBorderRadius","position","align","offset","resolvePositioningShorthand","mergeArrowOffset","arrowHeight","targetRef","containerRef","arrowRef","usePositioning","ref","useMergedRefs","useIsomorphicLayoutEffect","thisTooltip","hide","_a","visibleTooltip","onDocumentKeyDown","key","Escape","stopPropagation","addEventListener","capture","undefined","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","mergeCallbacks","onPointerLeave","onFocus","onBlur","child","getTriggerChild","triggerAriaProps","childTargetRef","applyTriggerPropsToChildren","useEventCallback","_b","_c","_d","exports"],"sources":["../src/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport {\n useTooltipVisibility_unstable as useTooltipVisibility,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport {\n applyTriggerPropsToChildren,\n resolveShorthand,\n useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipChildProps } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */\nexport const useTooltip_unstable = (props: TooltipProps): TooltipState => {\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n const {\n appearance = 'normal',\n children,\n content,\n withArrow = false,\n positioning = 'above',\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\n mountNode,\n } = props;\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const setVisible = React.useCallback(\n (newVisible: boolean, ev?: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (newVisible !== oldVisible) {\n onVisibleChange?.(ev, { visible: newVisible });\n }\n return newVisible;\n });\n },\n [clearDelayTimeout, setVisibleInternal, onVisibleChange],\n );\n\n const state: TooltipState = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\n appearance,\n mountNode,\n // Slots\n components: {\n content: 'div',\n },\n content: resolveShorthand(content, {\n defaultProps: {\n role: 'tooltip',\n },\n required: true,\n }),\n };\n\n state.content.id = useId('tooltip-', state.content.id);\n\n const positioningOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above' as const,\n align: 'center' as const,\n offset: 4,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);\n }\n\n const {\n targetRef,\n containerRef,\n arrowRef,\n }: {\n targetRef: React.MutableRefObject<unknown>;\n containerRef: React.MutableRefObject<HTMLDivElement>;\n arrowRef: React.MutableRefObject<HTMLDivElement>;\n } = usePositioning(positioningOptions);\n\n state.content.ref = useMergedRefs(state.content.ref, containerRef);\n state.arrowRef = arrowRef;\n\n // When this tooltip is visible, hide any other tooltips, and register it\n // as the visibleTooltip with the TooltipContext.\n // Also add a listener on document to hide the tooltip if Escape is pressed\n useIsomorphicLayoutEffect(() => {\n if (visible) {\n const thisTooltip = { hide: () => setVisible(false) };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true,\n });\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [context, targetDocument, visible, setVisible]);\n\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement.\n // See https://github.com/microsoft/fluentui/issues/13541\n const ignoreNextFocusEventRef = React.useRef(false);\n\n // Listener for onPointerEnter and onFocus on the trigger element\n const onEnterTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {\n ignoreNextFocusEventRef.current = false;\n return;\n }\n\n // Show immediately if another tooltip is already visible\n const delay = context.visibleTooltip ? 0 : state.showDelay;\n\n setDelayTimeout(() => {\n setVisible(true, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.showDelay, context],\n );\n\n // Listener for onPointerLeave and onBlur on the trigger element\n const onLeaveTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n let delay = state.hideDelay;\n\n if (ev.type === 'blur') {\n // Hide immediately when losing focus\n delay = 0;\n\n ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;\n }\n\n setDelayTimeout(() => {\n setVisible(false, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.hideDelay, targetDocument],\n );\n\n // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.\n // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);\n\n const child = getTriggerChild(children);\n\n const triggerAriaProps: Pick<TooltipChildProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> = {};\n\n if (relationship === 'label') {\n // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.\n if (typeof state.content.children === 'string') {\n triggerAriaProps['aria-label'] = state.content.children;\n } else {\n triggerAriaProps['aria-labelledby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n } else if (relationship === 'description') {\n triggerAriaProps['aria-describedby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n\n // Don't render the Tooltip in SSR to avoid hydration errors\n if (isServerSideRender) {\n state.shouldRenderTooltip = false;\n }\n\n const childTargetRef = useMergedRefs(child?.ref, targetRef);\n\n // Apply the trigger props to the child, either by calling the render function, or cloning with the new props\n state.children = applyTriggerPropsToChildren(children, {\n ...triggerAriaProps,\n ...child?.props,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : child?.ref,\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger)),\n });\n\n return state;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,mBAAA,gBAAAD,OAAA;AACA,MAAAE,uBAAA,gBAAAF,OAAA;AAIA,MAAAG,iBAAA,gBAAAH,OAAA;AAcA,MAAAI,WAAA,gBAAAJ,OAAA;AACA,MAAAK,eAAA,gBAAAL,OAAA;AAEA;;;;;;;;AAQO,MAAMM,mBAAmB,GAAIC,KAAmB,IAAkB;;EACvE,MAAMC,OAAO,GAAGN,uBAAA,CAAAO,6BAAoB,EAAE;EACtC,MAAMC,kBAAkB,GAAGP,iBAAA,CAAAQ,QAAQ,EAAE;EACrC,MAAM;IAAEC;EAAc,CAAE,GAAGV,uBAAA,CAAAW,kBAAS,EAAE;EACtC,MAAM,CAACC,eAAe,EA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,KAAK,uBAALA,KAAK,CAAElF,KAAK,cAAAwF,EAAA,uBAAAA,EAAA,CAAET,cAAc,EAAEL,cAAc,CAAC,CAAC;IAC9FM,OAAO,EAAEpF,iBAAA,CAAA2F,gBAAgB,CAAC3F,iBAAA,CAAAkF,cAAc,CAAC,CAAAW,EAAA,GAAAP,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAElF,KAAK,cAAAyF,EAAA,uBAAAA,EAAA,CAAET,OAAO,EAAEX,cAAc,CAAC,CAAC;IAChFY,MAAM,EAAErF,iBAAA,CAAA2F,gBAAgB,CAAC3F,iBAAA,CAAAkF,cAAc,CAAC,CAAAY,EAAA,GAAAR,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAElF,KAAK,cAAA0F,EAAA,uBAAAA,EAAA,CAAET,MAAM,EAAEP,cAAc,CAAC;GAC9E,CAAC;EAEF,OAAOnD,KAAK;AACd,CAAC;AApNYoE,OAAA,CAAA5F,mBAAmB,GAAAA,mBAAA"}
|
1
|
+
{"version":3,"sources":["../../../lib/components/Tooltip/useTooltip.js"],"sourcesContent":["import * as React from 'react';\nimport { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport { useTooltipVisibility_unstable as useTooltipVisibility, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { applyTriggerPropsToChildren, resolveShorthand, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback } from '@fluentui/react-utilities';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */\nexport const useTooltip_unstable = props => {\n var _child_props, _child_props1, _child_props2, _child_props3;\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const {\n targetDocument\n } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n const {\n appearance = 'normal',\n children,\n content,\n withArrow = false,\n positioning = 'above',\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\n mountNode\n } = props;\n const [visible, setVisibleInternal] = useControllableState({\n state: props.visible,\n initialState: false\n });\n const setVisible = React.useCallback((newVisible, ev) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (newVisible !== oldVisible) {\n onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {\n visible: newVisible\n });\n }\n return newVisible;\n });\n }, [clearDelayTimeout, setVisibleInternal, onVisibleChange]);\n const state = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\n appearance,\n mountNode,\n // Slots\n components: {\n content: 'div'\n },\n content: resolveShorthand(content, {\n defaultProps: {\n role: 'tooltip'\n },\n required: true\n })\n };\n state.content.id = useId('tooltip-', state.content.id);\n const positioningOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above',\n align: 'center',\n offset: 4,\n ...resolvePositioningShorthand(state.positioning)\n };\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);\n }\n const {\n targetRef,\n containerRef,\n arrowRef\n } = usePositioning(positioningOptions);\n state.content.ref = useMergedRefs(state.content.ref, containerRef);\n state.arrowRef = arrowRef;\n // When this tooltip is visible, hide any other tooltips, and register it\n // as the visibleTooltip with the TooltipContext.\n // Also add a listener on document to hide the tooltip if Escape is pressed\n useIsomorphicLayoutEffect(() => {\n if (visible) {\n var _context_visibleTooltip;\n const thisTooltip = {\n hide: () => setVisible(false)\n };\n (_context_visibleTooltip = context.visibleTooltip) === null || _context_visibleTooltip === void 0 ? void 0 : _context_visibleTooltip.hide();\n context.visibleTooltip = thisTooltip;\n const onDocumentKeyDown = ev => {\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true\n });\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {\n capture: true\n });\n };\n }\n }, [context, targetDocument, visible, setVisible]);\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement.\n // See https://github.com/microsoft/fluentui/issues/13541\n const ignoreNextFocusEventRef = React.useRef(false);\n // Listener for onPointerEnter and onFocus on the trigger element\n const onEnterTrigger = React.useCallback(ev => {\n if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {\n ignoreNextFocusEventRef.current = false;\n return;\n }\n // Show immediately if another tooltip is already visible\n const delay = context.visibleTooltip ? 0 : state.showDelay;\n setDelayTimeout(() => {\n setVisible(true, ev);\n }, delay);\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n }, [setDelayTimeout, setVisible, state.showDelay, context]);\n // Listener for onPointerLeave and onBlur on the trigger element\n const onLeaveTrigger = React.useCallback(ev => {\n let delay = state.hideDelay;\n if (ev.type === 'blur') {\n // Hide immediately when losing focus\n delay = 0;\n ignoreNextFocusEventRef.current = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === ev.target;\n }\n setDelayTimeout(() => {\n setVisible(false, ev);\n }, delay);\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n }, [setDelayTimeout, setVisible, state.hideDelay, targetDocument]);\n // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.\n // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);\n const child = getTriggerChild(children);\n const triggerAriaProps = {};\n if (relationship === 'label') {\n // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.\n if (typeof state.content.children === 'string') {\n triggerAriaProps['aria-label'] = state.content.children;\n } else {\n triggerAriaProps['aria-labelledby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n } else if (relationship === 'description') {\n triggerAriaProps['aria-describedby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n // Don't render the Tooltip in SSR to avoid hydration errors\n if (isServerSideRender) {\n state.shouldRenderTooltip = false;\n }\n const childTargetRef = useMergedRefs(child === null || child === void 0 ? void 0 : child.ref, targetRef);\n // Apply the trigger props to the child, either by calling the render function, or cloning with the new props\n state.children = applyTriggerPropsToChildren(children, {\n ...triggerAriaProps,\n ...(child === null || child === void 0 ? void 0 : child.props),\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : child === null || child === void 0 ? void 0 : child.ref,\n onPointerEnter: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : (_child_props = child.props) === null || _child_props === void 0 ? void 0 : _child_props.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks(child === null || child === void 0 ? void 0 : (_child_props3 = child.props) === null || _child_props3 === void 0 ? void 0 : _child_props3.onBlur, onLeaveTrigger))\n });\n return state;\n};\n//# sourceMappingURL=useTooltip.js.map"],"names":["useTooltip_unstable","props","_child_props","_child_props1","_child_props2","_child_props3","context","useTooltipVisibility","isServerSideRender","useIsSSR","targetDocument","useFluent","setDelayTimeout","clearDelayTimeout","useTimeout","appearance","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","visible","setVisibleInternal","useControllableState","state","initialState","setVisible","React","useCallback","newVisible","ev","oldVisible","shouldRenderTooltip","components","resolveShorthand","defaultProps","role","required","id","useId","positioningOptions","enabled","arrowPadding","tooltipBorderRadius","position","align","offset","resolvePositioningShorthand","mergeArrowOffset","arrowHeight","targetRef","containerRef","arrowRef","usePositioning","ref","useMergedRefs","useIsomorphicLayoutEffect","_context_visibleTooltip","thisTooltip","hide","visibleTooltip","onDocumentKeyDown","key","Escape","stopPropagation","addEventListener","capture","undefined","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","mergeCallbacks","onPointerLeave","onFocus","onBlur","child","getTriggerChild","triggerAriaProps","childTargetRef","applyTriggerPropsToChildren","useEventCallback"],"mappings":";;;;+BAcaA;;aAAAA;;;6DAdU;kCACuD;qCACyB;gCACuG;2BAC7J;8BAC1B;AAShB,MAAMA,sBAAsBC,CAAAA,QAAS;IAC1C,IAAIC,cAAcC,eAAeC,eAAeC;IAChD,MAAMC,UAAUC,IAAAA,kDAAoB;IACpC,MAAMC,qBAAqBC,IAAAA,wBAAQ;IACnC,MAAM,EACJC,eAAc,EACf,GAAGC,IAAAA,uCAAS;IACb,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGC,IAAAA,0BAAU;IACvD,MAAM,EACJC,YAAa,SAAQ,EACrBC,SAAQ,EACRC,QAAO,EACPC,WAA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