@fluentui/react-tooltip 9.3.1 → 9.3.3
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.json +97 -1
- package/CHANGELOG.md +31 -2
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/renderTooltip.js +18 -8
- package/lib/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltip.js +19 -16
- package/lib/components/Tooltip/useTooltip.js.map +1 -1
- package/lib-commonjs/Tooltip.js +2 -2
- package/lib-commonjs/Tooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.js +9 -7
- package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.types.js +2 -2
- package/lib-commonjs/components/Tooltip/Tooltip.types.js.map +1 -1
- package/lib-commonjs/components/Tooltip/index.js +6 -6
- package/lib-commonjs/components/Tooltip/index.js.map +1 -1
- package/lib-commonjs/components/Tooltip/private/constants.js +6 -2
- package/lib-commonjs/components/Tooltip/private/constants.js.map +1 -1
- package/lib-commonjs/components/Tooltip/renderTooltip.js +25 -14
- package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltip.js +45 -40
- package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.js +7 -3
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.js.map +1 -1
- package/lib-commonjs/index.js +16 -6
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +13 -13
package/CHANGELOG.json
CHANGED
@@ -2,7 +2,103 @@
|
|
2
2
|
"name": "@fluentui/react-tooltip",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "Tue,
|
5
|
+
"date": "Tue, 05 Sep 2023 15:35:07 GMT",
|
6
|
+
"tag": "@fluentui/react-tooltip_v9.3.3",
|
7
|
+
"version": "9.3.3",
|
8
|
+
"comments": {
|
9
|
+
"patch": [
|
10
|
+
{
|
11
|
+
"author": "beachball",
|
12
|
+
"package": "@fluentui/react-tooltip",
|
13
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.5",
|
14
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"author": "beachball",
|
18
|
+
"package": "@fluentui/react-tooltip",
|
19
|
+
"comment": "Bump @fluentui/react-portal to v9.3.12",
|
20
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
21
|
+
},
|
22
|
+
{
|
23
|
+
"author": "beachball",
|
24
|
+
"package": "@fluentui/react-tooltip",
|
25
|
+
"comment": "Bump @fluentui/react-positioning to v9.9.10",
|
26
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
"author": "beachball",
|
30
|
+
"package": "@fluentui/react-tooltip",
|
31
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.2",
|
32
|
+
"commit": "94019033dfe3fd39ec0cde7dfb3b57c22805aa91"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"date": "Tue, 05 Sep 2023 13:29:10 GMT",
|
39
|
+
"tag": "@fluentui/react-tooltip_v9.3.2",
|
40
|
+
"version": "9.3.2",
|
41
|
+
"comments": {
|
42
|
+
"patch": [
|
43
|
+
{
|
44
|
+
"author": "bernardo.sunderhus@gmail.com",
|
45
|
+
"package": "@fluentui/react-tooltip",
|
46
|
+
"commit": "b93c2ac22355b6cb6f33dd509c6cd9c21f4fffc8",
|
47
|
+
"comment": "bumps @swc/helpers version to 0.5.1"
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"author": "bernardo.sunderhus@gmail.com",
|
51
|
+
"package": "@fluentui/react-tooltip",
|
52
|
+
"commit": "eea6d93a62249ba4fba3347fb291c67ee1a3fb24",
|
53
|
+
"comment": "chore: migrate package to use JSX importSource"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"author": "beachball",
|
57
|
+
"package": "@fluentui/react-tooltip",
|
58
|
+
"comment": "Bump @fluentui/keyboard-keys to v9.0.4",
|
59
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
60
|
+
},
|
61
|
+
{
|
62
|
+
"author": "beachball",
|
63
|
+
"package": "@fluentui/react-tooltip",
|
64
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v9.0.4",
|
65
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
66
|
+
},
|
67
|
+
{
|
68
|
+
"author": "beachball",
|
69
|
+
"package": "@fluentui/react-tooltip",
|
70
|
+
"comment": "Bump @fluentui/react-portal to v9.3.11",
|
71
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
72
|
+
},
|
73
|
+
{
|
74
|
+
"author": "beachball",
|
75
|
+
"package": "@fluentui/react-tooltip",
|
76
|
+
"comment": "Bump @fluentui/react-positioning to v9.9.9",
|
77
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
78
|
+
},
|
79
|
+
{
|
80
|
+
"author": "beachball",
|
81
|
+
"package": "@fluentui/react-tooltip",
|
82
|
+
"comment": "Bump @fluentui/react-shared-contexts to v9.7.3",
|
83
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"author": "beachball",
|
87
|
+
"package": "@fluentui/react-tooltip",
|
88
|
+
"comment": "Bump @fluentui/react-theme to v9.1.12",
|
89
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
90
|
+
},
|
91
|
+
{
|
92
|
+
"author": "beachball",
|
93
|
+
"package": "@fluentui/react-tooltip",
|
94
|
+
"comment": "Bump @fluentui/react-utilities to v9.13.1",
|
95
|
+
"commit": "da959e66f36b429e40ae61810d08dc71c16e154a"
|
96
|
+
}
|
97
|
+
]
|
98
|
+
}
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"date": "Tue, 29 Aug 2023 12:57:36 GMT",
|
6
102
|
"tag": "@fluentui/react-tooltip_v9.3.1",
|
7
103
|
"version": "9.3.1",
|
8
104
|
"comments": {
|
package/CHANGELOG.md
CHANGED
@@ -1,12 +1,41 @@
|
|
1
1
|
# Change Log - @fluentui/react-tooltip
|
2
2
|
|
3
|
-
This log was last generated on Tue,
|
3
|
+
This log was last generated on Tue, 05 Sep 2023 15:35:07 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.3.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.3.3)
|
8
|
+
|
9
|
+
Tue, 05 Sep 2023 15:35:07 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.3.2..@fluentui/react-tooltip_v9.3.3)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.5 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
15
|
+
- Bump @fluentui/react-portal to v9.3.12 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
16
|
+
- Bump @fluentui/react-positioning to v9.9.10 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
17
|
+
- Bump @fluentui/react-utilities to v9.13.2 ([PR #29055](https://github.com/microsoft/fluentui/pull/29055) by beachball)
|
18
|
+
|
19
|
+
## [9.3.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.3.2)
|
20
|
+
|
21
|
+
Tue, 05 Sep 2023 13:29:10 GMT
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.3.1..@fluentui/react-tooltip_v9.3.2)
|
23
|
+
|
24
|
+
### Patches
|
25
|
+
|
26
|
+
- bumps @swc/helpers version to 0.5.1 ([PR #28989](https://github.com/microsoft/fluentui/pull/28989) by bernardo.sunderhus@gmail.com)
|
27
|
+
- chore: migrate package to use JSX importSource ([PR #28959](https://github.com/microsoft/fluentui/pull/28959) by bernardo.sunderhus@gmail.com)
|
28
|
+
- Bump @fluentui/keyboard-keys to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
29
|
+
- Bump @fluentui/react-jsx-runtime to v9.0.4 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
30
|
+
- Bump @fluentui/react-portal to v9.3.11 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
31
|
+
- Bump @fluentui/react-positioning to v9.9.9 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
32
|
+
- Bump @fluentui/react-shared-contexts to v9.7.3 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
33
|
+
- Bump @fluentui/react-theme to v9.1.12 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
34
|
+
- Bump @fluentui/react-utilities to v9.13.1 ([PR #29056](https://github.com/microsoft/fluentui/pull/29056) by beachball)
|
35
|
+
|
7
36
|
## [9.3.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.3.1)
|
8
37
|
|
9
|
-
Tue, 29 Aug 2023 12:
|
38
|
+
Tue, 29 Aug 2023 12:57:36 GMT
|
10
39
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.3.0..@fluentui/react-tooltip_v9.3.1)
|
11
40
|
|
12
41
|
### Patches
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useTooltipStyles_unstable } from './useTooltipStyles.styles';\nimport type { TooltipProps } from './Tooltip.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A tooltip provides light weight contextual information on top of its target element.\n */\nexport const Tooltip: React.FC<TooltipProps> = props => {\n const state = useTooltip_unstable(props);\n\n useTooltipStyles_unstable(state);\n\n useCustomStyleHook_unstable('useTooltipStyles_unstable')(state);\n\n return renderTooltip_unstable(state);\n};\n\nTooltip.displayName = 'Tooltip';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(Tooltip as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","useTooltip_unstable","renderTooltip_unstable","useCustomStyleHook_unstable","useTooltipStyles_unstable","Tooltip","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,yBAAyB,QAAQ,4BAA4B;AAItE;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA
|
1
|
+
{"version":3,"sources":["Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useTooltipStyles_unstable } from './useTooltipStyles.styles';\nimport type { TooltipProps } from './Tooltip.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * A tooltip provides light weight contextual information on top of its target element.\n */\nexport const Tooltip: React.FC<TooltipProps> = props => {\n const state = useTooltip_unstable(props);\n\n useTooltipStyles_unstable(state);\n\n useCustomStyleHook_unstable('useTooltipStyles_unstable')(state);\n\n return renderTooltip_unstable(state);\n};\n\nTooltip.displayName = 'Tooltip';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\n(Tooltip as FluentTriggerComponent).isFluentTriggerComponent = true;\n"],"names":["React","useTooltip_unstable","renderTooltip_unstable","useCustomStyleHook_unstable","useTooltipStyles_unstable","Tooltip","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,mBAAmB,QAAQ,eAAe;AACnD,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,yBAAyB,QAAQ,4BAA4B;AAItE;;CAEC,GACD,OAAO,MAAMC,UAAkCC,CAAAA;IAC7C,MAAMC,QAAQN,oBAAoBK;IAElCF,0BAA0BG;IAE1BJ,4BAA4B,6BAA6BI;IAEzD,OAAOL,uBAAuBK;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG;AACtB,6FAA6F;AAC5FH,QAAmCI,wBAAwB,GAAG"}
|
@@ -1,15 +1,25 @@
|
|
1
|
-
/** @jsxRuntime
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
2
2
|
import { Portal } from '@fluentui/react-portal';
|
3
|
-
import { createElement } from '@fluentui/react-jsx-runtime';
|
4
3
|
import { assertSlots } from '@fluentui/react-utilities';
|
5
4
|
/**
|
6
5
|
* Render the final JSX of Tooltip
|
7
6
|
*/ export const renderTooltip_unstable = (state)=>{
|
8
7
|
assertSlots(state);
|
9
|
-
return /*#__PURE__*/
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
return /*#__PURE__*/ _jsxs(_Fragment, {
|
9
|
+
children: [
|
10
|
+
state.children,
|
11
|
+
state.shouldRenderTooltip && /*#__PURE__*/ _jsx(Portal, {
|
12
|
+
mountNode: state.mountNode,
|
13
|
+
children: /*#__PURE__*/ _jsxs(state.content, {
|
14
|
+
children: [
|
15
|
+
state.withArrow && /*#__PURE__*/ _jsx("div", {
|
16
|
+
ref: state.arrowRef,
|
17
|
+
className: state.arrowClassName
|
18
|
+
}),
|
19
|
+
state.content.children
|
20
|
+
]
|
21
|
+
})
|
22
|
+
})
|
23
|
+
]
|
24
|
+
});
|
15
25
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderTooltip.tsx"],"sourcesContent":["/** @jsxRuntime
|
1
|
+
{"version":3,"sources":["renderTooltip.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Portal } from '@fluentui/react-portal';\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\n\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = (state: TooltipState) => {\n assertSlots<TooltipSlots>(state);\n\n return (\n <>\n {state.children}\n {state.shouldRenderTooltip && (\n <Portal mountNode={state.mountNode}>\n <state.content>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.content.children}\n </state.content>\n </Portal>\n )}\n </>\n );\n};\n"],"names":["Portal","assertSlots","renderTooltip_unstable","state","children","shouldRenderTooltip","mountNode","content","withArrow","div","ref","arrowRef","className","arrowClassName"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC;IACrCF,YAA0BE;IAE1B,qBACE;;YACGA,MAAMC,QAAQ;YACdD,MAAME,mBAAmB,kBACxB,KAACL;gBAAOM,WAAWH,MAAMG,SAAS;0BAChC,cAAA,MAACH,MAAMI,OAAO;;wBACXJ,MAAMK,SAAS,kBAAI,KAACC;4BAAIC,KAAKP,MAAMQ,QAAQ;4BAAEC,WAAWT,MAAMU,cAAc;;wBAC5EV,MAAMI,OAAO,CAACH,QAAQ;;;;;;AAMnC,EAAE"}
|
@@ -12,12 +12,12 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
12
12
|
*
|
13
13
|
* @param props - props from this instance of Tooltip
|
14
14
|
*/ export const useTooltip_unstable = (props)=>{
|
15
|
-
var _child_props, _child_props1, _child_props2, _child_props3;
|
15
|
+
var _child, _child1, _child2, _child_props, _child3, _child_props1, _child4, _child_props2, _child5, _child_props3, _child6;
|
16
16
|
const context = useTooltipVisibility();
|
17
17
|
const isServerSideRender = useIsSSR();
|
18
|
-
const { targetDocument
|
18
|
+
const { targetDocument } = useFluent();
|
19
19
|
const [setDelayTimeout, clearDelayTimeout] = useTimeout();
|
20
|
-
const { appearance ='normal'
|
20
|
+
const { appearance = 'normal', children, content, withArrow = false, positioning = 'above', onVisibleChange, relationship, showDelay = 250, hideDelay = 250, mountNode } = props;
|
21
21
|
const [visible, setVisibleInternal] = useControllableState({
|
22
22
|
state: props.visible,
|
23
23
|
initialState: false
|
@@ -26,7 +26,8 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
26
26
|
clearDelayTimeout();
|
27
27
|
setVisibleInternal((oldVisible)=>{
|
28
28
|
if (data.visible !== oldVisible) {
|
29
|
-
|
29
|
+
var _onVisibleChange;
|
30
|
+
(_onVisibleChange = onVisibleChange) === null || _onVisibleChange === void 0 ? void 0 : _onVisibleChange(ev, data);
|
30
31
|
}
|
31
32
|
return data.visible;
|
32
33
|
});
|
@@ -68,7 +69,7 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
68
69
|
if (state.withArrow) {
|
69
70
|
positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);
|
70
71
|
}
|
71
|
-
const { targetRef
|
72
|
+
const { targetRef, containerRef, arrowRef } = usePositioning(positioningOptions);
|
72
73
|
state.content.ref = useMergedRefs(state.content.ref, containerRef);
|
73
74
|
state.arrowRef = arrowRef;
|
74
75
|
// When this tooltip is visible, hide any other tooltips, and register it
|
@@ -76,7 +77,7 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
76
77
|
// Also add a listener on document to hide the tooltip if Escape is pressed
|
77
78
|
useIsomorphicLayoutEffect(()=>{
|
78
79
|
if (visible) {
|
79
|
-
var _context_visibleTooltip;
|
80
|
+
var _context_visibleTooltip, _targetDocument;
|
80
81
|
const thisTooltip = {
|
81
82
|
hide: (ev)=>setVisible(undefined, {
|
82
83
|
visible: false,
|
@@ -93,16 +94,17 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
93
94
|
ev.stopPropagation();
|
94
95
|
}
|
95
96
|
};
|
96
|
-
targetDocument === null ||
|
97
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.addEventListener('keydown', onDocumentKeyDown, {
|
97
98
|
// As this event is added at targeted document,
|
98
99
|
// we need to capture the event to be sure keydown handling from tooltip happens first
|
99
100
|
capture: true
|
100
101
|
});
|
101
102
|
return ()=>{
|
103
|
+
var _targetDocument;
|
102
104
|
if (context.visibleTooltip === thisTooltip) {
|
103
105
|
context.visibleTooltip = undefined;
|
104
106
|
}
|
105
|
-
targetDocument === null ||
|
107
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
|
106
108
|
capture: true
|
107
109
|
});
|
108
110
|
};
|
@@ -143,9 +145,10 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
143
145
|
const onLeaveTrigger = React.useCallback((ev)=>{
|
144
146
|
let delay = state.hideDelay;
|
145
147
|
if (ev.type === 'blur') {
|
148
|
+
var _targetDocument;
|
146
149
|
// Hide immediately when losing focus
|
147
150
|
delay = 0;
|
148
|
-
ignoreNextFocusEventRef.current = (targetDocument === null ||
|
151
|
+
ignoreNextFocusEventRef.current = ((_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement) === ev.target;
|
149
152
|
}
|
150
153
|
setDelayTimeout(()=>{
|
151
154
|
setVisible(ev, {
|
@@ -185,17 +188,17 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
185
188
|
if (isServerSideRender) {
|
186
189
|
state.shouldRenderTooltip = false;
|
187
190
|
}
|
188
|
-
const childTargetRef = useMergedRefs(child === null ||
|
191
|
+
const childTargetRef = useMergedRefs((_child = child) === null || _child === void 0 ? void 0 : _child.ref, targetRef);
|
189
192
|
// Apply the trigger props to the child, either by calling the render function, or cloning with the new props
|
190
193
|
state.children = applyTriggerPropsToChildren(children, {
|
191
194
|
...triggerAriaProps,
|
192
|
-
...child === null ||
|
195
|
+
...(_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.props,
|
193
196
|
// If the target prop is not provided, attach targetRef to the trigger element's ref prop
|
194
|
-
ref: positioningOptions.target === undefined ? childTargetRef : child === null ||
|
195
|
-
onPointerEnter: useEventCallback(mergeCallbacks(child === null ||
|
196
|
-
onPointerLeave: useEventCallback(mergeCallbacks(child === null ||
|
197
|
-
onFocus: useEventCallback(mergeCallbacks(child === null ||
|
198
|
-
onBlur: useEventCallback(mergeCallbacks(child === null ||
|
197
|
+
ref: positioningOptions.target === undefined ? childTargetRef : (_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.ref,
|
198
|
+
onPointerEnter: useEventCallback(mergeCallbacks((_child3 = child) === null || _child3 === void 0 ? void 0 : (_child_props = _child3.props) === null || _child_props === void 0 ? void 0 : _child_props.onPointerEnter, onEnterTrigger)),
|
199
|
+
onPointerLeave: useEventCallback(mergeCallbacks((_child4 = child) === null || _child4 === void 0 ? void 0 : (_child_props1 = _child4.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.onPointerLeave, onLeaveTrigger)),
|
200
|
+
onFocus: useEventCallback(mergeCallbacks((_child5 = child) === null || _child5 === void 0 ? void 0 : (_child_props2 = _child5.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.onFocus, onEnterTrigger)),
|
201
|
+
onBlur: useEventCallback(mergeCallbacks((_child6 = child) === null || _child6 === void 0 ? void 0 : (_child_props3 = _child6.props) === null || _child_props3 === void 0 ? void 0 : _child_props3.onBlur, onLeaveTrigger))
|
199
202
|
});
|
200
203
|
return state;
|
201
204
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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 useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n slot,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipChildProps, OnVisibleChangeData } 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 (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (data.visible !== oldVisible) {\n onVisibleChange?.(ev, data);\n }\n return data.visible;\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: slot.always(content, {\n defaultProps: {\n role: 'tooltip',\n },\n elementType: 'div',\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 = {\n hide: (ev?: KeyboardEvent) => setVisible(undefined, { visible: false, documentKeyboardEvent: ev }),\n };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide(ev);\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(ev, { visible: true });\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(ev, { visible: false });\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"],"names":["React","mergeArrowOffset","resolvePositioningShorthand","usePositioning","useTooltipVisibility_unstable","useTooltipVisibility","useFluent_unstable","useFluent","applyTriggerPropsToChildren","useControllableState","useId","useIsomorphicLayoutEffect","useIsSSR","useMergedRefs","useTimeout","getTriggerChild","mergeCallbacks","useEventCallback","slot","arrowHeight","tooltipBorderRadius","Escape","useTooltip_unstable","props","child","context","isServerSideRender","targetDocument","setDelayTimeout","clearDelayTimeout","appearance","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","visible","setVisibleInternal","state","initialState","setVisible","useCallback","ev","data","oldVisible","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","ref","thisTooltip","hide","undefined","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","stopPropagation","addEventListener","capture","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","childTargetRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,2BAA2B,EAAEC,cAAc,QAAQ,8BAA8B;AAC5G,SACEC,iCAAiCC,oBAAoB,EACrDC,sBAAsBC,SAAS,QAC1B,kCAAkC;AACzC,SACEC,2BAA2B,EAC3BC,oBAAoB,EACpBC,KAAK,EACLC,yBAAyB,EACzBC,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,IAAI,QACC,4BAA4B;AAEnC,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,sBAAsB;AACvE,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;;;;;;CAOC,GACD,OAAO,MAAMC,sBAAsB,CAACC,QAAsC;QA+MtBC,cACAA,eACPA,eACDA;IAjN1C,MAAMC,UAAUpB;IAChB,MAAMqB,qBAAqBd;IAC3B,MAAM,EAAEe,eAAc,EAAE,GAAGpB;IAC3B,MAAM,CAACqB,iBAAiBC,kBAAkB,GAAGf;IAE7C,MAAM,EACJgB,YAAa,SAAQ,EACrBC,SAAQ,EACRC,QAAO,EACPC,WAAY,KAAK,CAAA,EACjBC,aAAc,QAAO,EACrBC,gBAAe,EACfC,aAAY,EACZC,WAAY,IAAG,EACfC,WAAY,IAAG,EACfC,UAAS,EACV,GAAGhB;IAEJ,MAAM,CAACiB,SAASC,mBAAmB,GAAGhC,qBAAqB;QAAEiC,OAAOnB,MAAMiB,OAAO;QAAEG,cAAc,KAAK;IAAC;IACvG,MAAMC,aAAa5C,MAAM6C,WAAW,CAClC,CAACC,IAAiFC,OAA8B;QAC9GlB;QACAY,mBAAmBO,CAAA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,OAAO1C;AACT,EAAE"}
|
1
|
+
{"version":3,"sources":["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 useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n slot,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipChildProps, OnVisibleChangeData } 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 (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (data.visible !== oldVisible) {\n onVisibleChange?.(ev, data);\n }\n return data.visible;\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: slot.always(content, {\n defaultProps: {\n role: 'tooltip',\n },\n elementType: 'div',\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 = {\n hide: (ev?: KeyboardEvent) => setVisible(undefined, { visible: false, documentKeyboardEvent: ev }),\n };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide(ev);\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(ev, { visible: true });\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(ev, { visible: false });\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"],"names":["React","mergeArrowOffset","resolvePositioningShorthand","usePositioning","useTooltipVisibility_unstable","useTooltipVisibility","useFluent_unstable","useFluent","applyTriggerPropsToChildren","useControllableState","useId","useIsomorphicLayoutEffect","useIsSSR","useMergedRefs","useTimeout","getTriggerChild","mergeCallbacks","useEventCallback","slot","arrowHeight","tooltipBorderRadius","Escape","useTooltip_unstable","props","child","context","isServerSideRender","targetDocument","setDelayTimeout","clearDelayTimeout","appearance","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","visible","setVisibleInternal","state","initialState","setVisible","useCallback","ev","data","oldVisible","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","ref","thisTooltip","hide","undefined","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","stopPropagation","addEventListener","capture","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","childTargetRef"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,2BAA2B,EAAEC,cAAc,QAAQ,8BAA8B;AAC5G,SACEC,iCAAiCC,oBAAoB,EACrDC,sBAAsBC,SAAS,QAC1B,kCAAkC;AACzC,SACEC,2BAA2B,EAC3BC,oBAAoB,EACpBC,KAAK,EACLC,yBAAyB,EACzBC,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,IAAI,QACC,4BAA4B;AAEnC,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,sBAAsB;AACvE,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;;;;;;CAOC,GACD,OAAO,MAAMC,sBAAsB,CAACC;QAuMGC,QAKhCA,SAE6DA,SAChBA,cAAAA,SACAA,eAAAA,SACPA,eAAAA,SACDA,eAAAA;IAjN1C,MAAMC,UAAUpB;IAChB,MAAMqB,qBAAqBd;IAC3B,MAAM,EAAEe,cAAc,EAAE,GAAGpB;IAC3B,MAAM,CAACqB,iBAAiBC,kBAAkB,GAAGf;IAE7C,MAAM,EACJgB,aAAa,QAAQ,EACrBC,QAAQ,EACRC,OAAO,EACPC,YAAY,KAAK,EACjBC,cAAc,OAAO,EACrBC,eAAe,EACfC,YAAY,EACZC,YAAY,GAAG,EACfC,YAAY,GAAG,EACfC,SAAS,EACV,GAAGhB;IAEJ,MAAM,CAACiB,SAASC,mBAAmB,GAAGhC,qBAAqB;QAAEiC,OAAOnB,MAAMiB,OAAO;QAAEG,cAAc;IAAM;IACvG,MAAM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AgB,CAAC,mBAAmB,GAAGjD,MAAMV,OAAO,CAACuB,EAAE;QACvD,+FAA+F;QAC/Fb,MAAMO,mBAAmB,GAAG;IAC9B;IAEA,4DAA4D;IAC5D,IAAIvB,oBAAoB;QACtBgB,MAAMO,mBAAmB,GAAG;IAC9B;IAEA,MAAM2C,iBAAiB/E,eAAcW,SAAAA,mBAAAA,6BAAAA,OAAOyC,GAAG,EAAEH;IAEjD,6GAA6G;IAC7GpB,MAAMX,QAAQ,GAAGvB,4BAA4BuB,UAAU;QACrD,GAAG4D,gBAAgB;YAChBnE,UAAAA,mBAAAA,8BAAAA,QAAOD,KAAK,AAAf;QACA,yFAAyF;QACzF0C,KAAKT,mBAAmB8B,MAAM,KAAKlB,YAAYwB,kBAAiBpE,UAAAA,mBAAAA,8BAAAA,QAAOyC,GAAG;QAC1EsB,gBAAgBtE,iBAAiBD,gBAAeQ,UAAAA,mBAAAA,+BAAAA,eAAAA,QAAOD,KAAK,cAAZC,mCAAAA,aAAc+D,cAAc,EAAER;QAC9ES,gBAAgBvE,iBAAiBD,gBAAeQ,UAAAA,mBAAAA,+BAAAA,gBAAAA,QAAOD,KAAK,cAAZC,oCAAAA,cAAcgE,cAAc,EAAEJ;QAC9EK,SAASxE,iBAAiBD,gBAAeQ,UAAAA,mBAAAA,+BAAAA,gBAAAA,QAAOD,KAAK,cAAZC,oCAAAA,cAAciE,OAAO,EAAEV;QAChEW,QAAQzE,iBAAiBD,gBAAeQ,UAAAA,mBAAAA,+BAAAA,gBAAAA,QAAOD,KAAK,cAAZC,oCAAAA,cAAckE,MAAM,EAAEN;IAChE;IAEA,OAAO1C;AACT,EAAE"}
|
package/lib-commonjs/Tooltip.js
CHANGED
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./components/Tooltip/index"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Tooltip.js"],"sourcesContent":["export * from './components/Tooltip/index';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["Tooltip.js"],"sourcesContent":["export * from './components/Tooltip/index';\n"],"names":[],"mappings":";;;;;uBAAc"}
|
@@ -4,18 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "Tooltip", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return Tooltip;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
11
13
|
const _useTooltip = require("./useTooltip");
|
12
14
|
const _renderTooltip = require("./renderTooltip");
|
13
|
-
const
|
14
|
-
const
|
15
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
16
|
+
const _useTooltipStylesstyles = require("./useTooltipStyles.styles");
|
15
17
|
const Tooltip = (props)=>{
|
16
18
|
const state = (0, _useTooltip.useTooltip_unstable)(props);
|
17
|
-
(0,
|
18
|
-
(0,
|
19
|
+
(0, _useTooltipStylesstyles.useTooltipStyles_unstable)(state);
|
20
|
+
(0, _reactsharedcontexts.useCustomStyleHook_unstable)('useTooltipStyles_unstable')(state);
|
19
21
|
return (0, _renderTooltip.renderTooltip_unstable)(state);
|
20
22
|
};
|
21
23
|
Tooltip.displayName = 'Tooltip';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Tooltip.js"],"sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useTooltipStyles_unstable } from './useTooltipStyles.styles';\n/**\n * A tooltip provides light weight contextual information on top of its target element.\n */ export const Tooltip = (props)=>{\n const state = useTooltip_unstable(props);\n useTooltipStyles_unstable(state);\n useCustomStyleHook_unstable('useTooltipStyles_unstable')(state);\n return renderTooltip_unstable(state);\n};\nTooltip.displayName = 'Tooltip';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\nTooltip.isFluentTriggerComponent = true;\n"],"names":["Tooltip","props","state","useTooltip_unstable","useTooltipStyles_unstable","useCustomStyleHook_unstable","renderTooltip_unstable","displayName","isFluentTriggerComponent"],"mappings":";;;;+BAOiBA
|
1
|
+
{"version":3,"sources":["Tooltip.js"],"sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useTooltipStyles_unstable } from './useTooltipStyles.styles';\n/**\n * A tooltip provides light weight contextual information on top of its target element.\n */ export const Tooltip = (props)=>{\n const state = useTooltip_unstable(props);\n useTooltipStyles_unstable(state);\n useCustomStyleHook_unstable('useTooltipStyles_unstable')(state);\n return renderTooltip_unstable(state);\n};\nTooltip.displayName = 'Tooltip';\n// type casting here is required to ensure internal type FluentTriggerComponent is not leaked\nTooltip.isFluentTriggerComponent = true;\n"],"names":["Tooltip","props","state","useTooltip_unstable","useTooltipStyles_unstable","useCustomStyleHook_unstable","renderTooltip_unstable","displayName","isFluentTriggerComponent"],"mappings":";;;;+BAOiBA;;;eAAAA;;;;iEAPM;4BACa;+BACG;qCACK;wCACF;AAG/B,MAAMA,UAAU,CAACC;IACxB,MAAMC,QAAQC,IAAAA,+BAAmB,EAACF;IAClCG,IAAAA,iDAAyB,EAACF;IAC1BG,IAAAA,gDAA2B,EAAC,6BAA6BH;IACzD,OAAOI,IAAAA,qCAAsB,EAACJ;AAClC;AACAF,QAAQO,WAAW,GAAG;AACtB,6FAA6F;AAC7FP,QAAQQ,wBAAwB,GAAG"}
|
@@ -2,5 +2,5 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
const _react = /*#__PURE__*/
|
5
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
6
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["Tooltip.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["Tooltip.types.js"],"sourcesContent":["import * as React from 'react';\n"],"names":[],"mappings":";;;;;iEAAuB"}
|
@@ -2,9 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
|
-
const
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
6
|
+
_export_star._(require("./Tooltip"), exports);
|
7
|
+
_export_star._(require("./Tooltip.types"), exports);
|
8
|
+
_export_star._(require("./renderTooltip"), exports);
|
9
|
+
_export_star._(require("./useTooltip"), exports);
|
10
|
+
_export_star._(require("./useTooltipStyles.styles"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Tooltip';\nexport * from './Tooltip.types';\nexport * from './renderTooltip';\nexport * from './useTooltip';\nexport * from './useTooltipStyles.styles';\n"],"names":[],"mappings":";;;;;
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './Tooltip';\nexport * from './Tooltip.types';\nexport * from './renderTooltip';\nexport * from './useTooltip';\nexport * from './useTooltipStyles.styles';\n"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
@@ -11,8 +11,12 @@ function _export(target, all) {
|
|
11
11
|
});
|
12
12
|
}
|
13
13
|
_export(exports, {
|
14
|
-
arrowHeight: ()
|
15
|
-
|
14
|
+
arrowHeight: function() {
|
15
|
+
return arrowHeight;
|
16
|
+
},
|
17
|
+
tooltipBorderRadius: function() {
|
18
|
+
return tooltipBorderRadius;
|
19
|
+
}
|
16
20
|
});
|
17
21
|
const arrowHeight = 6;
|
18
22
|
const tooltipBorderRadius = 4;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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 */ export const tooltipBorderRadius = 4;\n"],"names":["arrowHeight","tooltipBorderRadius"],"mappings":"AAAA;;CAEC;;;;;;;;;;;IAAgBA,WAAW
|
1
|
+
{"version":3,"sources":["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 */ export const tooltipBorderRadius = 4;\n"],"names":["arrowHeight","tooltipBorderRadius"],"mappings":"AAAA;;CAEC;;;;;;;;;;;IAAgBA,WAAW;eAAXA;;IAOAC,mBAAmB;eAAnBA;;;AAPN,MAAMD,cAAc;AAOpB,MAAMC,sBAAsB"}
|
@@ -1,22 +1,33 @@
|
|
1
|
-
/** @jsxRuntime
|
1
|
+
/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ "use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
3
3
|
value: true
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "renderTooltip_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return renderTooltip_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
13
|
-
const _reactUtilities = require("@fluentui/react-utilities");
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
12
|
+
const _reactportal = require("@fluentui/react-portal");
|
13
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
14
14
|
const renderTooltip_unstable = (state)=>{
|
15
|
-
(0,
|
16
|
-
return /*#__PURE__*/ (0,
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
(0, _reactutilities.assertSlots)(state);
|
16
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, {
|
17
|
+
children: [
|
18
|
+
state.children,
|
19
|
+
state.shouldRenderTooltip && /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactportal.Portal, {
|
20
|
+
mountNode: state.mountNode,
|
21
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.content, {
|
22
|
+
children: [
|
23
|
+
state.withArrow && /*#__PURE__*/ (0, _jsxruntime.jsx)("div", {
|
24
|
+
ref: state.arrowRef,
|
25
|
+
className: state.arrowClassName
|
26
|
+
}),
|
27
|
+
state.content.children
|
28
|
+
]
|
29
|
+
})
|
30
|
+
})
|
31
|
+
]
|
32
|
+
});
|
22
33
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderTooltip.js"],"sourcesContent":["/** @jsxRuntime
|
1
|
+
{"version":3,"sources":["renderTooltip.js"],"sourcesContent":["/** @jsxRuntime automatic */ /** @jsxImportSource @fluentui/react-jsx-runtime */ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { Portal } from '@fluentui/react-portal';\nimport { assertSlots } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Tooltip\n */ export const renderTooltip_unstable = (state)=>{\n assertSlots(state);\n return /*#__PURE__*/ _jsxs(_Fragment, {\n children: [\n state.children,\n state.shouldRenderTooltip && /*#__PURE__*/ _jsx(Portal, {\n mountNode: state.mountNode,\n children: /*#__PURE__*/ _jsxs(state.content, {\n children: [\n state.withArrow && /*#__PURE__*/ _jsx(\"div\", {\n ref: state.arrowRef,\n className: state.arrowClassName\n }),\n state.content.children\n ]\n })\n })\n ]\n });\n};\n"],"names":["renderTooltip_unstable","state","assertSlots","_jsxs","_Fragment","children","shouldRenderTooltip","_jsx","Portal","mountNode","content","withArrow","ref","arrowRef","className","arrowClassName"],"mappings":"AAAA,0BAA0B,GAAG,iDAAiD;;;;+BAK7DA;;;eAAAA;;;4BALkI;6BAC5H;gCACK;AAGjB,MAAMA,yBAAyB,CAACC;IACvCC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,gBAAK,EAACC,oBAAS,EAAE;QAClCC,UAAU;YACNJ,MAAMI,QAAQ;YACdJ,MAAMK,mBAAmB,IAAI,WAAW,GAAGC,IAAAA,eAAI,EAACC,mBAAM,EAAE;gBACpDC,WAAWR,MAAMQ,SAAS;gBAC1BJ,UAAU,WAAW,GAAGF,IAAAA,gBAAK,EAACF,MAAMS,OAAO,EAAE;oBACzCL,UAAU;wBACNJ,MAAMU,SAAS,IAAI,WAAW,GAAGJ,IAAAA,eAAI,EAAC,OAAO;4BACzCK,KAAKX,MAAMY,QAAQ;4BACnBC,WAAWb,MAAMc,cAAc;wBACnC;wBACAd,MAAMS,OAAO,CAACL,QAAQ;qBACzB;gBACL;YACJ;SACH;IACL;AACJ"}
|
@@ -4,23 +4,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
});
|
5
5
|
Object.defineProperty(exports, "useTooltip_unstable", {
|
6
6
|
enumerable: true,
|
7
|
-
get: ()
|
7
|
+
get: function() {
|
8
|
+
return useTooltip_unstable;
|
9
|
+
}
|
8
10
|
});
|
9
|
-
const
|
10
|
-
const _react = /*#__PURE__*/
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
+
const _reactpositioning = require("@fluentui/react-positioning");
|
14
|
+
const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
|
15
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
14
16
|
const _constants = require("./private/constants");
|
15
|
-
const
|
17
|
+
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
16
18
|
const useTooltip_unstable = (props)=>{
|
17
|
-
var _child_props, _child_props1, _child_props2, _child_props3;
|
18
|
-
const context = (0,
|
19
|
-
const isServerSideRender = (0,
|
20
|
-
const { targetDocument
|
21
|
-
const [setDelayTimeout, clearDelayTimeout] = (0,
|
22
|
-
const { appearance ='normal'
|
23
|
-
const [visible, setVisibleInternal] = (0,
|
19
|
+
var _child, _child1, _child2, _child_props, _child3, _child_props1, _child4, _child_props2, _child5, _child_props3, _child6;
|
20
|
+
const context = (0, _reactsharedcontexts.useTooltipVisibility_unstable)();
|
21
|
+
const isServerSideRender = (0, _reactutilities.useIsSSR)();
|
22
|
+
const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
|
23
|
+
const [setDelayTimeout, clearDelayTimeout] = (0, _reactutilities.useTimeout)();
|
24
|
+
const { appearance = 'normal', children, content, withArrow = false, positioning = 'above', onVisibleChange, relationship, showDelay = 250, hideDelay = 250, mountNode } = props;
|
25
|
+
const [visible, setVisibleInternal] = (0, _reactutilities.useControllableState)({
|
24
26
|
state: props.visible,
|
25
27
|
initialState: false
|
26
28
|
});
|
@@ -28,7 +30,8 @@ const useTooltip_unstable = (props)=>{
|
|
28
30
|
clearDelayTimeout();
|
29
31
|
setVisibleInternal((oldVisible)=>{
|
30
32
|
if (data.visible !== oldVisible) {
|
31
|
-
|
33
|
+
var _onVisibleChange;
|
34
|
+
(_onVisibleChange = onVisibleChange) === null || _onVisibleChange === void 0 ? void 0 : _onVisibleChange(ev, data);
|
32
35
|
}
|
33
36
|
return data.visible;
|
34
37
|
});
|
@@ -51,34 +54,34 @@ const useTooltip_unstable = (props)=>{
|
|
51
54
|
components: {
|
52
55
|
content: 'div'
|
53
56
|
},
|
54
|
-
content:
|
57
|
+
content: _reactutilities.slot.always(content, {
|
55
58
|
defaultProps: {
|
56
59
|
role: 'tooltip'
|
57
60
|
},
|
58
61
|
elementType: 'div'
|
59
62
|
})
|
60
63
|
};
|
61
|
-
state.content.id = (0,
|
64
|
+
state.content.id = (0, _reactutilities.useId)('tooltip-', state.content.id);
|
62
65
|
const positioningOptions = {
|
63
66
|
enabled: state.visible,
|
64
67
|
arrowPadding: 2 * _constants.tooltipBorderRadius,
|
65
68
|
position: 'above',
|
66
69
|
align: 'center',
|
67
70
|
offset: 4,
|
68
|
-
...(0,
|
71
|
+
...(0, _reactpositioning.resolvePositioningShorthand)(state.positioning)
|
69
72
|
};
|
70
73
|
if (state.withArrow) {
|
71
|
-
positioningOptions.offset = (0,
|
74
|
+
positioningOptions.offset = (0, _reactpositioning.mergeArrowOffset)(positioningOptions.offset, _constants.arrowHeight);
|
72
75
|
}
|
73
|
-
const { targetRef
|
74
|
-
state.content.ref = (0,
|
76
|
+
const { targetRef, containerRef, arrowRef } = (0, _reactpositioning.usePositioning)(positioningOptions);
|
77
|
+
state.content.ref = (0, _reactutilities.useMergedRefs)(state.content.ref, containerRef);
|
75
78
|
state.arrowRef = arrowRef;
|
76
79
|
// When this tooltip is visible, hide any other tooltips, and register it
|
77
80
|
// as the visibleTooltip with the TooltipContext.
|
78
81
|
// Also add a listener on document to hide the tooltip if Escape is pressed
|
79
|
-
(0,
|
82
|
+
(0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
|
80
83
|
if (visible) {
|
81
|
-
var _context_visibleTooltip;
|
84
|
+
var _context_visibleTooltip, _targetDocument;
|
82
85
|
const thisTooltip = {
|
83
86
|
hide: (ev)=>setVisible(undefined, {
|
84
87
|
visible: false,
|
@@ -88,23 +91,24 @@ const useTooltip_unstable = (props)=>{
|
|
88
91
|
(_context_visibleTooltip = context.visibleTooltip) === null || _context_visibleTooltip === void 0 ? void 0 : _context_visibleTooltip.hide();
|
89
92
|
context.visibleTooltip = thisTooltip;
|
90
93
|
const onDocumentKeyDown = (ev)=>{
|
91
|
-
if (ev.key ===
|
94
|
+
if (ev.key === _keyboardkeys.Escape) {
|
92
95
|
thisTooltip.hide(ev);
|
93
96
|
// stop propagation to avoid conflicting with other elements that listen for `Escape`
|
94
97
|
// e,g: Dialog, Popover, Menu
|
95
98
|
ev.stopPropagation();
|
96
99
|
}
|
97
100
|
};
|
98
|
-
targetDocument === null ||
|
101
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.addEventListener('keydown', onDocumentKeyDown, {
|
99
102
|
// As this event is added at targeted document,
|
100
103
|
// we need to capture the event to be sure keydown handling from tooltip happens first
|
101
104
|
capture: true
|
102
105
|
});
|
103
106
|
return ()=>{
|
107
|
+
var _targetDocument;
|
104
108
|
if (context.visibleTooltip === thisTooltip) {
|
105
109
|
context.visibleTooltip = undefined;
|
106
110
|
}
|
107
|
-
targetDocument === null ||
|
111
|
+
(_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
|
108
112
|
capture: true
|
109
113
|
});
|
110
114
|
};
|
@@ -145,9 +149,10 @@ const useTooltip_unstable = (props)=>{
|
|
145
149
|
const onLeaveTrigger = _react.useCallback((ev)=>{
|
146
150
|
let delay = state.hideDelay;
|
147
151
|
if (ev.type === 'blur') {
|
152
|
+
var _targetDocument;
|
148
153
|
// Hide immediately when losing focus
|
149
154
|
delay = 0;
|
150
|
-
ignoreNextFocusEventRef.current = (targetDocument === null ||
|
155
|
+
ignoreNextFocusEventRef.current = ((_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement) === ev.target;
|
151
156
|
}
|
152
157
|
setDelayTimeout(()=>{
|
153
158
|
setVisible(ev, {
|
@@ -163,11 +168,11 @@ const useTooltip_unstable = (props)=>{
|
|
163
168
|
]);
|
164
169
|
// Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.
|
165
170
|
// This keeps the tooltip visible when the mouse is moved over it, or it has focus within.
|
166
|
-
state.content.onPointerEnter = (0,
|
167
|
-
state.content.onPointerLeave = (0,
|
168
|
-
state.content.onFocus = (0,
|
169
|
-
state.content.onBlur = (0,
|
170
|
-
const child = (0,
|
171
|
+
state.content.onPointerEnter = (0, _reactutilities.mergeCallbacks)(state.content.onPointerEnter, clearDelayTimeout);
|
172
|
+
state.content.onPointerLeave = (0, _reactutilities.mergeCallbacks)(state.content.onPointerLeave, onLeaveTrigger);
|
173
|
+
state.content.onFocus = (0, _reactutilities.mergeCallbacks)(state.content.onFocus, clearDelayTimeout);
|
174
|
+
state.content.onBlur = (0, _reactutilities.mergeCallbacks)(state.content.onBlur, onLeaveTrigger);
|
175
|
+
const child = (0, _reactutilities.getTriggerChild)(children);
|
171
176
|
const triggerAriaProps = {};
|
172
177
|
if (relationship === 'label') {
|
173
178
|
// aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
|
@@ -187,17 +192,17 @@ const useTooltip_unstable = (props)=>{
|
|
187
192
|
if (isServerSideRender) {
|
188
193
|
state.shouldRenderTooltip = false;
|
189
194
|
}
|
190
|
-
const childTargetRef = (0,
|
195
|
+
const childTargetRef = (0, _reactutilities.useMergedRefs)((_child = child) === null || _child === void 0 ? void 0 : _child.ref, targetRef);
|
191
196
|
// Apply the trigger props to the child, either by calling the render function, or cloning with the new props
|
192
|
-
state.children = (0,
|
197
|
+
state.children = (0, _reactutilities.applyTriggerPropsToChildren)(children, {
|
193
198
|
...triggerAriaProps,
|
194
|
-
...child === null ||
|
199
|
+
...(_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.props,
|
195
200
|
// If the target prop is not provided, attach targetRef to the trigger element's ref prop
|
196
|
-
ref: positioningOptions.target === undefined ? childTargetRef : child === null ||
|
197
|
-
onPointerEnter: (0,
|
198
|
-
onPointerLeave: (0,
|
199
|
-
onFocus: (0,
|
200
|
-
onBlur: (0,
|
201
|
+
ref: positioningOptions.target === undefined ? childTargetRef : (_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.ref,
|
202
|
+
onPointerEnter: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)((_child3 = child) === null || _child3 === void 0 ? void 0 : (_child_props = _child3.props) === null || _child_props === void 0 ? void 0 : _child_props.onPointerEnter, onEnterTrigger)),
|
203
|
+
onPointerLeave: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)((_child4 = child) === null || _child4 === void 0 ? void 0 : (_child_props1 = _child4.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.onPointerLeave, onLeaveTrigger)),
|
204
|
+
onFocus: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)((_child5 = child) === null || _child5 === void 0 ? void 0 : (_child_props2 = _child5.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.onFocus, onEnterTrigger)),
|
205
|
+
onBlur: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)((_child6 = child) === null || _child6 === void 0 ? void 0 : (_child_props3 = _child6.props) === null || _child_props3 === void 0 ? void 0 : _child_props3.onBlur, onLeaveTrigger))
|
201
206
|
});
|
202
207
|
return state;
|
203
208
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["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, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback, slot } 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 */ export const useTooltip_unstable = (props)=>{\n var _child_props, _child_props1, _child_props2, _child_props3;\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n const { appearance ='normal' , children , content , withArrow =false , positioning ='above' , onVisibleChange , relationship , showDelay =250 , hideDelay =250 , mountNode } = props;\n const [visible, setVisibleInternal] = useControllableState({\n state: props.visible,\n initialState: false\n });\n const setVisible = React.useCallback((ev, data)=>{\n clearDelayTimeout();\n setVisibleInternal((oldVisible)=>{\n if (data.visible !== oldVisible) {\n onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, data);\n }\n return data.visible;\n });\n }, [\n clearDelayTimeout,\n setVisibleInternal,\n onVisibleChange\n ]);\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: slot.always(content, {\n defaultProps: {\n role: 'tooltip'\n },\n elementType: 'div'\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 { targetRef , containerRef , arrowRef } = 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: (ev)=>setVisible(undefined, {\n visible: false,\n documentKeyboardEvent: ev\n })\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(ev);\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 }, [\n context,\n targetDocument,\n visible,\n 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 // 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(ev, {\n visible: true\n });\n }, delay);\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n }, [\n setDelayTimeout,\n setVisible,\n state.showDelay,\n context\n ]);\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(ev, {\n visible: false\n });\n }, delay);\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n }, [\n setDelayTimeout,\n setVisible,\n state.hideDelay,\n targetDocument\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 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"],"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","ev","data","oldVisible","shouldRenderTooltip","components","slot","always","defaultProps","role","elementType","id","useId","positioningOptions","enabled","arrowPadding","tooltipBorderRadius","position","align","offset","resolvePositioningShorthand","mergeArrowOffset","arrowHeight","targetRef","containerRef","arrowRef","usePositioning","ref","useMergedRefs","useIsomorphicLayoutEffect","_context_visibleTooltip","thisTooltip","hide","undefined","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","Escape","stopPropagation","addEventListener","capture","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","mergeCallbacks","onPointerLeave","onFocus","onBlur","child","getTriggerChild","triggerAriaProps","childTargetRef","applyTriggerPropsToChildren","useEventCallback"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;kCACuD;qCACyB;gCAC2F;2B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rF,CAAAA,gBAAgBqF,MAAMzF,KAAK,AAAD,MAAO,IAAI,IAAII,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcoF,MAAM,EAAEP;IAC9L;IACA,OAAOtD;AACX"}
|
1
|
+
{"version":3,"sources":["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, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback, slot } 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 */ export const useTooltip_unstable = (props)=>{\n var _child, _child1, _child2, _child_props, _child3, _child_props1, _child4, _child_props2, _child5, _child_props3, _child6;\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n const { appearance = 'normal', children, content, withArrow = false, positioning = 'above', onVisibleChange, relationship, showDelay = 250, hideDelay = 250, mountNode } = props;\n const [visible, setVisibleInternal] = useControllableState({\n state: props.visible,\n initialState: false\n });\n const setVisible = React.useCallback((ev, data)=>{\n clearDelayTimeout();\n setVisibleInternal((oldVisible)=>{\n if (data.visible !== oldVisible) {\n var _onVisibleChange;\n (_onVisibleChange = onVisibleChange) === null || _onVisibleChange === void 0 ? void 0 : _onVisibleChange(ev, data);\n }\n return data.visible;\n });\n }, [\n clearDelayTimeout,\n setVisibleInternal,\n onVisibleChange\n ]);\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: slot.always(content, {\n defaultProps: {\n role: 'tooltip'\n },\n elementType: 'div'\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 { targetRef, containerRef, arrowRef } = 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, _targetDocument;\n const thisTooltip = {\n hide: (ev)=>setVisible(undefined, {\n visible: false,\n documentKeyboardEvent: ev\n })\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(ev);\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 = 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 var _targetDocument;\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n (_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.removeEventListener('keydown', onDocumentKeyDown, {\n capture: true\n });\n };\n }\n }, [\n context,\n targetDocument,\n visible,\n 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 // 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(ev, {\n visible: true\n });\n }, delay);\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n }, [\n setDelayTimeout,\n setVisible,\n state.showDelay,\n context\n ]);\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 var _targetDocument;\n // Hide immediately when losing focus\n delay = 0;\n ignoreNextFocusEventRef.current = ((_targetDocument = targetDocument) === null || _targetDocument === void 0 ? void 0 : _targetDocument.activeElement) === ev.target;\n }\n setDelayTimeout(()=>{\n setVisible(ev, {\n visible: false\n });\n }, delay);\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n }, [\n setDelayTimeout,\n setVisible,\n state.hideDelay,\n targetDocument\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 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 = 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 ...(_child1 = child) === null || _child1 === void 0 ? void 0 : _child1.props,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : (_child2 = child) === null || _child2 === void 0 ? void 0 : _child2.ref,\n onPointerEnter: useEventCallback(mergeCallbacks((_child3 = child) === null || _child3 === void 0 ? void 0 : (_child_props = _child3.props) === null || _child_props === void 0 ? void 0 : _child_props.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks((_child4 = child) === null || _child4 === void 0 ? void 0 : (_child_props1 = _child4.props) === null || _child_props1 === void 0 ? void 0 : _child_props1.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks((_child5 = child) === null || _child5 === void 0 ? void 0 : (_child_props2 = _child5.props) === null || _child_props2 === void 0 ? void 0 : _child_props2.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks((_child6 = child) === null || _child6 === void 0 ? void 0 : (_child_props3 = _child6.props) === null || _child_props3 === void 0 ? void 0 : _child_props3.onBlur, onLeaveTrigger))\n });\n return state;\n};\n"],"names":["useTooltip_unstable","props","_child","_child1","_child2","_child_props","_child3","_child_props1","_child4","_child_props2","_child5","_child_props3","_child6","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","ev","data","oldVisible","_onVisibleChange","shouldRenderTooltip","components","slot","always","defaultProps","role","elementType","id","useId","positioningOptions","enabled","arrowPadding","tooltipBorderRadius","position","align","offset","resolvePositioningShorthand","mergeArrowOffset","arrowHeight","targetRef","containerRef","arrowRef","usePositioning","ref","useMergedRefs","useIsomorphicLayoutEffect","_context_visibleTooltip","_targetDocument","thisTooltip","hide","undefined","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","Escape","stopPropagation","addEventListener","capture","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","mergeCallbacks","onPointerLeave","onFocus","onBlur","child","getTriggerChild","triggerAriaProps","childTargetRef","applyTriggerPropsToChildren","useEventCallback"],"mappings":";;;;+BAaiBA;;;eAAAA;;;;iEAbM;kCACuD;qCACyB;gCAC2F;2BACjJ;8BAC1B;AAQZ,MAAMA,sBAAsB,CAACC;IACpC,IAAIC,QAAQC,SAASC,SAASC,cAAcC,SAASC,eAAeC,SAASC,eAAeC,SAASC,eAAeC;IACpH,MAAMC,UAAUC,IAAAA,kDAAoB;IACpC,MAAMC,qBAAqBC,IAAAA,wBAAQ;IACnC,MAAM,EAAEC,cAAc,EAAE,GAAGC,IAAAA,uCAAS;IACpC,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGC,IAAAA,0BAAU;IACvD,MAAM,EAAEC,aAAa,QAAQ,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,YAAY,KAAK,EAAEC,cAAc,OAAO,EAAEC,eAAe,EAAEC,YAAY,EAAEC,YAAY,GAAG,EAAEC,YAAY,GAAG,EAAEC,SAAS,EAA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AAA,8BAAc,EAAC,AAACzF,CAAAA,UAAU6F,KAAI,MAAO,QAAQ7F,YAAY,KAAK,IAAI,KAAK,IAAI,AAACD,CAAAA,eAAeC,QAAQL,KAAK,AAAD,MAAO,QAAQI,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAayF,cAAc,EAAER;QACvNU,gBAAgBQ,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAAC,AAACvF,CAAAA,UAAU2F,KAAI,MAAO,QAAQ3F,YAAY,KAAK,IAAI,KAAK,IAAI,AAACD,CAAAA,gBAAgBC,QAAQP,KAAK,AAAD,MAAO,QAAQM,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcyF,cAAc,EAAEL;QAC1NM,SAASO,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAAC,AAACrF,CAAAA,UAAUyF,KAAI,MAAO,QAAQzF,YAAY,KAAK,IAAI,KAAK,IAAI,AAACD,CAAAA,gBAAgBC,QAAQT,KAAK,AAAD,MAAO,QAAQQ,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcwF,OAAO,EAAEX;QAC5MY,QAAQM,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAAC,AAACnF,CAAAA,UAAUuF,KAAI,MAAO,QAAQvF,YAAY,KAAK,IAAI,KAAK,IAAI,AAACD,CAAAA,gBAAgBC,QAAQX,KAAK,AAAD,MAAO,QAAQU,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcuF,MAAM,EAAEP;IAC9M;IACA,OAAOxD;AACX"}
|
@@ -9,8 +9,12 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
tooltipClassNames: ()
|
13
|
-
|
12
|
+
tooltipClassNames: function() {
|
13
|
+
return tooltipClassNames;
|
14
|
+
},
|
15
|
+
useTooltipStyles_unstable: function() {
|
16
|
+
return useTooltipStyles_unstable;
|
17
|
+
}
|
14
18
|
});
|
15
19
|
const _react = require("@griffel/react");
|
16
20
|
const tooltipClassNames = {
|
@@ -18,7 +22,7 @@ const tooltipClassNames = {
|
|
18
22
|
};
|
19
23
|
/**
|
20
24
|
* Styles for the tooltip
|
21
|
-
*/ const useStyles = /*#__PURE__*/ (0, _react
|
25
|
+
*/ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
22
26
|
root: {
|
23
27
|
mc9l5x: "fjseox",
|
24
28
|
B7ck84d: "f1ewtqcl",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["useTooltipStyles.styles.js"],"sourcesContent":["import { shorthands, __styles, mergeClasses } from '@griffel/react';\nimport { createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { arrowHeight } from './private/constants';\nexport const tooltipClassNames = {\n content: 'fui-Tooltip__content'\n};\n/**\n * Styles for the tooltip\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"fjseox\",\n B7ck84d: \"f1ewtqcl\",\n B2u0y6b: \"f132xexn\",\n Bceei9c: \"f158kwzp\",\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fy9rknc\",\n Bg96gwp: \"fwrc4pm\",\n Btd35i7: \"fokg9q4\",\n Bbmb7ep: [\"f1aa9q02\", \"f16jpd5f\"],\n Beyfa6y: [\"f16jpd5f\", \"f1aa9q02\"],\n B7oj6ja: [\"f1jar5jt\", \"fyu767a\"],\n Btl43ni: [\"fyu767a\", \"f1jar5jt\"],\n B4j52fo: \"f5ogflp\",\n Bekrc4i: [\"f1hqa2wf\", \"finvdd3\"],\n Bn0qgzm: \"f1f09k3d\",\n ibv6hh: [\"finvdd3\", \"f1hqa2wf\"],\n icvyot: \"fzkkow9\",\n vrafjx: [\"fcdblym\", \"fjik90z\"],\n oivjwe: \"fg706s2\",\n wvpqe5: [\"fjik90z\", \"fcdblym\"],\n g2u3we: \"fghlq4f\",\n h3c5rm: [\"f1gn591s\", \"fjscplz\"],\n B9xav0g: \"fb073pr\",\n zhjwy3: [\"fjscplz\", \"f1gn591s\"],\n z8tnut: \"f10ra9hq\",\n z189sj: [\"fd9xhir\", \"f1jlaasf\"],\n Byoj8tv: \"f1d7kygh\",\n uwmqm3: [\"f1jlaasf\", \"fd9xhir\"],\n De3pzq: \"fxugw4r\",\n sj55zd: \"f19n0e5\",\n Bhu2qc9: \"fxeb0a7\"\n },\n visible: {\n mc9l5x: \"ftgm304\"\n },\n inverted: {\n De3pzq: \"fg3r6xk\",\n sj55zd: \"fonrgv7\"\n },\n arrow: {\n qhf8xq: \"f1euv43f\",\n De3pzq: \"f1u2r49w\",\n Bcdw1i0: \"fd7fpy0\",\n Bj3rh1h: \"f1bsuimh\",\n a9b677: \"f1ekdpwm\",\n Bqenvij: \"f83vc9z\",\n Ftih45: \"f1wl9k8s\",\n B1puzpu: \"f1wkw4r9\",\n Brfgrao: \"f1j7ml58\",\n Bcvre1j: \"fyl8oag\",\n Ccq8qp: \"frdoeuz\",\n Baz25je: \"fb81m9q\",\n cmx5o7: \"f1ljr5q2\",\n B4f6apu: \"fyfemzf\",\n m598lv: \"focyt6c\",\n Bk5zm6e: \"fnhxbxj\",\n y0oebl: \"fdw6hkg\",\n qa3bma: \"f11yjt3y\",\n Bqjgrrk: \"f1172wan\",\n Budzafs: [\"f9e5op9\", \"f112wvtl\"],\n Hv9wc6: [\"ftj5xct\", \"fyavhwi\"],\n hl6cv3: \"f1773hnp\",\n Bh2vraf: \"f1n8855c\",\n yayu3t: \"f1v7783n\",\n wedwtw: \"fsw6im5\",\n rhl9o9: \"fh2hsk5\",\n Bu8t5uz: \"f159pzir\",\n B6q6orb: \"f11yvu4\",\n Bwwlvwl: \"fm1ycve\"\n }\n}, {\n d: [\".fjseox{display:none;}\", \".f1ewtqcl{box-sizing:border-box;}\", \".f132xexn{max-width:240px;}\", \".f158kwzp{cursor:default;}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fy9rknc{font-size:var(--fontSizeBase200);}\", \".fwrc4pm{line-height:var(--lineHeightBase200);}\", \".fokg9q4{overflow-wrap:break-word;}\", \".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}\", \".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}\", \".f5ogflp{border-top-width:1px;}\", \".f1hqa2wf{border-right-width:1px;}\", \".finvdd3{border-left-width:1px;}\", \".f1f09k3d{border-bottom-width:1px;}\", \".fzkkow9{border-top-style:solid;}\", \".fcdblym{border-right-style:solid;}\", \".fjik90z{border-left-style:solid;}\", \".fg706s2{border-bottom-style:solid;}\", \".fghlq4f{border-top-color:var(--colorTransparentStroke);}\", \".f1gn591s{border-right-color:var(--colorTransparentStroke);}\", \".fjscplz{border-left-color:var(--colorTransparentStroke);}\", \".fb073pr{border-bottom-color:var(--colorTransparentStroke);}\", \".f10ra9hq{padding-top:4px;}\", \".fd9xhir{padding-right:11px;}\", \".f1jlaasf{padding-left:11px;}\", \".f1d7kygh{padding-bottom:6px;}\", \".fxugw4r{background-color:var(--colorNeutralBackground1);}\", \".f19n0e5{color:var(--colorNeutralForeground1);}\", \".fxeb0a7{filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));}\", \".ftgm304{display:block;}\", \".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}\", \".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}\", \".f1euv43f{position:absolute;}\", \".f1u2r49w{background-color:inherit;}\", \".fd7fpy0{visibility:hidden;}\", \".f1bsuimh{z-index:-1;}\", \".f1ekdpwm{width:8.484px;}\", \".f83vc9z{height:8.484px;}\", \".f1wl9k8s::before{content:\\\"\\\";}\", \".f1wkw4r9::before{visibility:visible;}\", \".f1j7ml58::before{position:absolute;}\", \".fyl8oag::before{box-sizing:border-box;}\", \".frdoeuz::before{width:inherit;}\", \".fb81m9q::before{height:inherit;}\", \".f1ljr5q2::before{background-color:inherit;}\", \".fyfemzf::before{border-right-width:1px;}\", \".focyt6c::before{border-right-style:solid;}\", \".fnhxbxj::before{border-right-color:var(--colorTransparentStroke);}\", \".fdw6hkg::before{border-bottom-width:1px;}\", \".f11yjt3y::before{border-bottom-style:solid;}\", \".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}\", \".f9e5op9::before{border-bottom-right-radius:var(--borderRadiusSmall);}\", \".f112wvtl::before{border-bottom-left-radius:var(--borderRadiusSmall);}\", \".ftj5xct::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}\", \".fyavhwi::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}\", \"[data-popper-placement^=\\\"top\\\"] .f1773hnp{bottom:-1px;}\", \"[data-popper-placement^=\\\"top\\\"] .f1n8855c{--angle:0;}\", \"[data-popper-placement^=\\\"right\\\"] .f1v7783n{left:-1px;}\", \"[data-popper-placement^=\\\"right\\\"] .fsw6im5{--angle:90deg;}\", \"[data-popper-placement^=\\\"bottom\\\"] .fh2hsk5{top:-1px;}\", \"[data-popper-placement^=\\\"bottom\\\"] .f159pzir{--angle:180deg;}\", \"[data-popper-placement^=\\\"left\\\"] .f11yvu4{right:-1px;}\", \"[data-popper-placement^=\\\"left\\\"] .fm1ycve{--angle:270deg;}\"]\n});\n/**\n * Apply styling to the Tooltip slots based on the state\n */\nexport const useTooltipStyles_unstable = state => {\n const styles = useStyles();\n state.content.className = mergeClasses(tooltipClassNames.content, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.content.className);\n state.arrowClassName = styles.arrow;\n return state;\n};\n//# sourceMappingURL=useTooltipStyles.styles.js.map"],"names":["tooltipClassNames","useTooltipStyles_unstable","content","useStyles","__styles","root","mc9l5x","B7ck84d","B2u0y6b","Bceei9c","Bahqtrf","Be2twd7","Bg96gwp","Btd35i7","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","z8tnut","z189sj","Byoj8tv","uwmqm3","De3pzq","sj55zd","Bhu2qc9","visible","inverted","arrow","qhf8xq","Bcdw1i0","Bj3rh1h","a9b677","Bqenvij","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","state","styles","className","mergeClasses","appearance","arrowClassName"],"mappings":";;;;;;;;;;;IAIaA,iBAAiB
|
1
|
+
{"version":3,"sources":["useTooltipStyles.styles.js"],"sourcesContent":["import { shorthands, __styles, mergeClasses } from '@griffel/react';\nimport { createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { arrowHeight } from './private/constants';\nexport const tooltipClassNames = {\n content: 'fui-Tooltip__content'\n};\n/**\n * Styles for the tooltip\n */\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"fjseox\",\n B7ck84d: \"f1ewtqcl\",\n B2u0y6b: \"f132xexn\",\n Bceei9c: \"f158kwzp\",\n Bahqtrf: \"fk6fouc\",\n Be2twd7: \"fy9rknc\",\n Bg96gwp: \"fwrc4pm\",\n Btd35i7: \"fokg9q4\",\n Bbmb7ep: [\"f1aa9q02\", \"f16jpd5f\"],\n Beyfa6y: [\"f16jpd5f\", \"f1aa9q02\"],\n B7oj6ja: [\"f1jar5jt\", \"fyu767a\"],\n Btl43ni: [\"fyu767a\", \"f1jar5jt\"],\n B4j52fo: \"f5ogflp\",\n Bekrc4i: [\"f1hqa2wf\", \"finvdd3\"],\n Bn0qgzm: \"f1f09k3d\",\n ibv6hh: [\"finvdd3\", \"f1hqa2wf\"],\n icvyot: \"fzkkow9\",\n vrafjx: [\"fcdblym\", \"fjik90z\"],\n oivjwe: \"fg706s2\",\n wvpqe5: [\"fjik90z\", \"fcdblym\"],\n g2u3we: \"fghlq4f\",\n h3c5rm: [\"f1gn591s\", \"fjscplz\"],\n B9xav0g: \"fb073pr\",\n zhjwy3: [\"fjscplz\", \"f1gn591s\"],\n z8tnut: \"f10ra9hq\",\n z189sj: [\"fd9xhir\", \"f1jlaasf\"],\n Byoj8tv: \"f1d7kygh\",\n uwmqm3: [\"f1jlaasf\", \"fd9xhir\"],\n De3pzq: \"fxugw4r\",\n sj55zd: \"f19n0e5\",\n Bhu2qc9: \"fxeb0a7\"\n },\n visible: {\n mc9l5x: \"ftgm304\"\n },\n inverted: {\n De3pzq: \"fg3r6xk\",\n sj55zd: \"fonrgv7\"\n },\n arrow: {\n qhf8xq: \"f1euv43f\",\n De3pzq: \"f1u2r49w\",\n Bcdw1i0: \"fd7fpy0\",\n Bj3rh1h: \"f1bsuimh\",\n a9b677: \"f1ekdpwm\",\n Bqenvij: \"f83vc9z\",\n Ftih45: \"f1wl9k8s\",\n B1puzpu: \"f1wkw4r9\",\n Brfgrao: \"f1j7ml58\",\n Bcvre1j: \"fyl8oag\",\n Ccq8qp: \"frdoeuz\",\n Baz25je: \"fb81m9q\",\n cmx5o7: \"f1ljr5q2\",\n B4f6apu: \"fyfemzf\",\n m598lv: \"focyt6c\",\n Bk5zm6e: \"fnhxbxj\",\n y0oebl: \"fdw6hkg\",\n qa3bma: \"f11yjt3y\",\n Bqjgrrk: \"f1172wan\",\n Budzafs: [\"f9e5op9\", \"f112wvtl\"],\n Hv9wc6: [\"ftj5xct\", \"fyavhwi\"],\n hl6cv3: \"f1773hnp\",\n Bh2vraf: \"f1n8855c\",\n yayu3t: \"f1v7783n\",\n wedwtw: \"fsw6im5\",\n rhl9o9: \"fh2hsk5\",\n Bu8t5uz: \"f159pzir\",\n B6q6orb: \"f11yvu4\",\n Bwwlvwl: \"fm1ycve\"\n }\n}, {\n d: [\".fjseox{display:none;}\", \".f1ewtqcl{box-sizing:border-box;}\", \".f132xexn{max-width:240px;}\", \".f158kwzp{cursor:default;}\", \".fk6fouc{font-family:var(--fontFamilyBase);}\", \".fy9rknc{font-size:var(--fontSizeBase200);}\", \".fwrc4pm{line-height:var(--lineHeightBase200);}\", \".fokg9q4{overflow-wrap:break-word;}\", \".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}\", \".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}\", \".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}\", \".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}\", \".f5ogflp{border-top-width:1px;}\", \".f1hqa2wf{border-right-width:1px;}\", \".finvdd3{border-left-width:1px;}\", \".f1f09k3d{border-bottom-width:1px;}\", \".fzkkow9{border-top-style:solid;}\", \".fcdblym{border-right-style:solid;}\", \".fjik90z{border-left-style:solid;}\", \".fg706s2{border-bottom-style:solid;}\", \".fghlq4f{border-top-color:var(--colorTransparentStroke);}\", \".f1gn591s{border-right-color:var(--colorTransparentStroke);}\", \".fjscplz{border-left-color:var(--colorTransparentStroke);}\", \".fb073pr{border-bottom-color:var(--colorTransparentStroke);}\", \".f10ra9hq{padding-top:4px;}\", \".fd9xhir{padding-right:11px;}\", \".f1jlaasf{padding-left:11px;}\", \".f1d7kygh{padding-bottom:6px;}\", \".fxugw4r{background-color:var(--colorNeutralBackground1);}\", \".f19n0e5{color:var(--colorNeutralForeground1);}\", \".fxeb0a7{filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));}\", \".ftgm304{display:block;}\", \".fg3r6xk{background-color:var(--colorNeutralBackgroundStatic);}\", \".fonrgv7{color:var(--colorNeutralForegroundStaticInverted);}\", \".f1euv43f{position:absolute;}\", \".f1u2r49w{background-color:inherit;}\", \".fd7fpy0{visibility:hidden;}\", \".f1bsuimh{z-index:-1;}\", \".f1ekdpwm{width:8.484px;}\", \".f83vc9z{height:8.484px;}\", \".f1wl9k8s::before{content:\\\"\\\";}\", \".f1wkw4r9::before{visibility:visible;}\", \".f1j7ml58::before{position:absolute;}\", \".fyl8oag::before{box-sizing:border-box;}\", \".frdoeuz::before{width:inherit;}\", \".fb81m9q::before{height:inherit;}\", \".f1ljr5q2::before{background-color:inherit;}\", \".fyfemzf::before{border-right-width:1px;}\", \".focyt6c::before{border-right-style:solid;}\", \".fnhxbxj::before{border-right-color:var(--colorTransparentStroke);}\", \".fdw6hkg::before{border-bottom-width:1px;}\", \".f11yjt3y::before{border-bottom-style:solid;}\", \".f1172wan::before{border-bottom-color:var(--colorTransparentStroke);}\", \".f9e5op9::before{border-bottom-right-radius:var(--borderRadiusSmall);}\", \".f112wvtl::before{border-bottom-left-radius:var(--borderRadiusSmall);}\", \".ftj5xct::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}\", \".fyavhwi::before{transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}\", \"[data-popper-placement^=\\\"top\\\"] .f1773hnp{bottom:-1px;}\", \"[data-popper-placement^=\\\"top\\\"] .f1n8855c{--angle:0;}\", \"[data-popper-placement^=\\\"right\\\"] .f1v7783n{left:-1px;}\", \"[data-popper-placement^=\\\"right\\\"] .fsw6im5{--angle:90deg;}\", \"[data-popper-placement^=\\\"bottom\\\"] .fh2hsk5{top:-1px;}\", \"[data-popper-placement^=\\\"bottom\\\"] .f159pzir{--angle:180deg;}\", \"[data-popper-placement^=\\\"left\\\"] .f11yvu4{right:-1px;}\", \"[data-popper-placement^=\\\"left\\\"] .fm1ycve{--angle:270deg;}\"]\n});\n/**\n * Apply styling to the Tooltip slots based on the state\n */\nexport const useTooltipStyles_unstable = state => {\n const styles = useStyles();\n state.content.className = mergeClasses(tooltipClassNames.content, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.content.className);\n state.arrowClassName = styles.arrow;\n return state;\n};\n//# sourceMappingURL=useTooltipStyles.styles.js.map"],"names":["tooltipClassNames","useTooltipStyles_unstable","content","useStyles","__styles","root","mc9l5x","B7ck84d","B2u0y6b","Bceei9c","Bahqtrf","Be2twd7","Bg96gwp","Btd35i7","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","z8tnut","z189sj","Byoj8tv","uwmqm3","De3pzq","sj55zd","Bhu2qc9","visible","inverted","arrow","qhf8xq","Bcdw1i0","Bj3rh1h","a9b677","Bqenvij","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","state","styles","className","mergeClasses","appearance","arrowClassName"],"mappings":";;;;;;;;;;;IAIaA,iBAAiB;eAAjBA;;IAoFAC,yBAAyB;eAAzBA;;;uBAxFsC;AAI5C,MAAMD,oBAAoB;IAC/BE,SAAS;AACX;AACA;;CAEC,GACD,MAAMC,YAAY,WAAW,GAAEC,IAAAA,eAAQ,EAAC;IACtCC,MAAM;QACJC,QAAQ;QACRC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;QACTC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY;SAAW;QACjCC,SAAS;YAAC;YAAY;SAAU;QAChCC,SAAS;YAAC;YAAW;SAAW;QAChCC,SAAS;QACTC,SAAS;YAAC;YAAY;SAAU;QAChCC,SAAS;QACTC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAU;QAC9BC,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAU;QAC9BC,QAAQ;QACRC,QAAQ;YAAC;YAAY;SAAU;QAC/BC,SAAS;QAC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MAAMnE,OAAO,CAACqE,SAAS,GAAGC,IAAAA,mBAAY,EAACxE,kBAAkBE,OAAO,EAAEoE,OAAOjE,IAAI,EAAEgE,MAAMI,UAAU,KAAK,cAAcH,OAAOhC,QAAQ,EAAE+B,MAAMhC,OAAO,IAAIiC,OAAOjC,OAAO,EAAEgC,MAAMnE,OAAO,CAACqE,SAAS;IAC3LF,MAAMK,cAAc,GAAGJ,OAAO/B,KAAK;IACnC,OAAO8B;AACT,GACA,mDAAmD"}
|
package/lib-commonjs/index.js
CHANGED
@@ -9,10 +9,20 @@ function _export(target, all) {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
_export(exports, {
|
12
|
-
Tooltip: ()
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
Tooltip: function() {
|
13
|
+
return _Tooltip.Tooltip;
|
14
|
+
},
|
15
|
+
renderTooltip_unstable: function() {
|
16
|
+
return _Tooltip.renderTooltip_unstable;
|
17
|
+
},
|
18
|
+
tooltipClassNames: function() {
|
19
|
+
return _Tooltip.tooltipClassNames;
|
20
|
+
},
|
21
|
+
useTooltipStyles_unstable: function() {
|
22
|
+
return _Tooltip.useTooltipStyles_unstable;
|
23
|
+
},
|
24
|
+
useTooltip_unstable: function() {
|
25
|
+
return _Tooltip.useTooltip_unstable;
|
26
|
+
}
|
17
27
|
});
|
18
|
-
const
|
28
|
+
const _Tooltip = require("./Tooltip");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { Tooltip, renderTooltip_unstable, tooltipClassNames, useTooltipStyles_unstable, useTooltip_unstable } from './Tooltip';\n"],"names":["Tooltip","renderTooltip_unstable","tooltipClassNames","useTooltipStyles_unstable","useTooltip_unstable"],"mappings":";;;;;;;;;;;IAASA,OAAO,
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { Tooltip, renderTooltip_unstable, tooltipClassNames, useTooltipStyles_unstable, useTooltip_unstable } from './Tooltip';\n"],"names":["Tooltip","renderTooltip_unstable","tooltipClassNames","useTooltipStyles_unstable","useTooltip_unstable"],"mappings":";;;;;;;;;;;IAASA,OAAO;eAAPA,gBAAO;;IAAEC,sBAAsB;eAAtBA,+BAAsB;;IAAEC,iBAAiB;eAAjBA,0BAAiB;;IAAEC,yBAAyB;eAAzBA,kCAAyB;;IAAEC,mBAAmB;eAAnBA,4BAAmB;;;yBAAQ"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tooltip",
|
3
|
-
"version": "9.3.
|
3
|
+
"version": "9.3.3",
|
4
4
|
"description": "React components for building web experiences",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -33,21 +33,21 @@
|
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/keyboard-keys": "^9.0.
|
37
|
-
"@fluentui/react-jsx-runtime": "^9.0.
|
38
|
-
"@fluentui/react-portal": "^9.3.
|
39
|
-
"@fluentui/react-positioning": "^9.9.
|
40
|
-
"@fluentui/react-shared-contexts": "^9.7.
|
41
|
-
"@fluentui/react-theme": "^9.1.
|
42
|
-
"@fluentui/react-utilities": "^9.13.
|
36
|
+
"@fluentui/keyboard-keys": "^9.0.4",
|
37
|
+
"@fluentui/react-jsx-runtime": "^9.0.5",
|
38
|
+
"@fluentui/react-portal": "^9.3.12",
|
39
|
+
"@fluentui/react-positioning": "^9.9.10",
|
40
|
+
"@fluentui/react-shared-contexts": "^9.7.3",
|
41
|
+
"@fluentui/react-theme": "^9.1.12",
|
42
|
+
"@fluentui/react-utilities": "^9.13.2",
|
43
43
|
"@griffel/react": "^1.5.14",
|
44
|
-
"@swc/helpers": "^0.
|
44
|
+
"@swc/helpers": "^0.5.1"
|
45
45
|
},
|
46
46
|
"peerDependencies": {
|
47
|
-
"@types/react": ">=16.
|
48
|
-
"@types/react-dom": ">=16.
|
49
|
-
"react": ">=16.
|
50
|
-
"react-dom": ">=16.
|
47
|
+
"@types/react": ">=16.14.0 <19.0.0",
|
48
|
+
"@types/react-dom": ">=16.14.0 <19.0.0",
|
49
|
+
"react": ">=16.14.0 <19.0.0",
|
50
|
+
"react-dom": ">=16.14.0 <19.0.0"
|
51
51
|
},
|
52
52
|
"beachball": {
|
53
53
|
"disallowedChangeTypes": [
|