@fluentui/react-tooltip 0.0.0-nightly-20230807-0415.1 → 0.0.0-nightly-20230808-0415.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +21 -21
- package/CHANGELOG.md +13 -13
- package/lib/components/Tooltip/renderTooltip.js +3 -3
- package/lib/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltip.js +3 -3
- package/lib/components/Tooltip/useTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/renderTooltip.js +2 -2
- package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltip.js +2 -2
- package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.json
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
"name": "@fluentui/react-tooltip",
|
3
3
|
"entries": [
|
4
4
|
{
|
5
|
-
"date": "
|
6
|
-
"tag": "@fluentui/react-tooltip_v0.0.0-nightly-
|
7
|
-
"version": "0.0.0-nightly-
|
5
|
+
"date": "Tue, 08 Aug 2023 04:22:15 GMT",
|
6
|
+
"tag": "@fluentui/react-tooltip_v0.0.0-nightly-20230808-0415.1",
|
7
|
+
"version": "0.0.0-nightly-20230808-0415.1",
|
8
8
|
"comments": {
|
9
9
|
"prerelease": [
|
10
10
|
{
|
@@ -16,56 +16,56 @@
|
|
16
16
|
{
|
17
17
|
"author": "beachball",
|
18
18
|
"package": "@fluentui/react-tooltip",
|
19
|
-
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
20
|
-
"commit": "
|
19
|
+
"comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230808-0415.1",
|
20
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
21
21
|
},
|
22
22
|
{
|
23
23
|
"author": "beachball",
|
24
24
|
"package": "@fluentui/react-tooltip",
|
25
|
-
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
26
|
-
"commit": "
|
25
|
+
"comment": "Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1",
|
26
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
27
27
|
},
|
28
28
|
{
|
29
29
|
"author": "beachball",
|
30
30
|
"package": "@fluentui/react-tooltip",
|
31
|
-
"comment": "Bump @fluentui/react-portal to v0.0.0-nightly-
|
32
|
-
"commit": "
|
31
|
+
"comment": "Bump @fluentui/react-portal to v0.0.0-nightly-20230808-0415.1",
|
32
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
33
33
|
},
|
34
34
|
{
|
35
35
|
"author": "beachball",
|
36
36
|
"package": "@fluentui/react-tooltip",
|
37
|
-
"comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-
|
38
|
-
"commit": "
|
37
|
+
"comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-20230808-0415.1",
|
38
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
39
39
|
},
|
40
40
|
{
|
41
41
|
"author": "beachball",
|
42
42
|
"package": "@fluentui/react-tooltip",
|
43
|
-
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
44
|
-
"commit": "
|
43
|
+
"comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230808-0415.1",
|
44
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
45
45
|
},
|
46
46
|
{
|
47
47
|
"author": "beachball",
|
48
48
|
"package": "@fluentui/react-tooltip",
|
49
|
-
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-
|
50
|
-
"commit": "
|
49
|
+
"comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1",
|
50
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
51
51
|
},
|
52
52
|
{
|
53
53
|
"author": "beachball",
|
54
54
|
"package": "@fluentui/react-tooltip",
|
55
|
-
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-
|
56
|
-
"commit": "
|
55
|
+
"comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1",
|
56
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
57
57
|
},
|
58
58
|
{
|
59
59
|
"author": "beachball",
|
60
60
|
"package": "@fluentui/react-tooltip",
|
61
|
-
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-
|
62
|
-
"commit": "
|
61
|
+
"comment": "Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1",
|
62
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
63
63
|
},
|
64
64
|
{
|
65
65
|
"author": "beachball",
|
66
66
|
"package": "@fluentui/react-tooltip",
|
67
|
-
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
68
|
-
"commit": "
|
67
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1",
|
68
|
+
"commit": "307bdb0a82868b26dbcb9a7aa2318bda66c1cd64"
|
69
69
|
}
|
70
70
|
]
|
71
71
|
}
|
package/CHANGELOG.md
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
# Change Log - @fluentui/react-tooltip
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Tue, 08 Aug 2023 04:22:15 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
-
## [0.0.0-nightly-
|
7
|
+
## [0.0.0-nightly-20230808-0415.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v0.0.0-nightly-20230808-0415.1)
|
8
8
|
|
9
|
-
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.2.28..@fluentui/react-tooltip_v0.0.0-nightly-
|
9
|
+
Tue, 08 Aug 2023 04:22:15 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.2.28..@fluentui/react-tooltip_v0.0.0-nightly-20230808-0415.1)
|
11
11
|
|
12
12
|
### Changes
|
13
13
|
|
14
14
|
- Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
|
15
|
-
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-
|
17
|
-
- Bump @fluentui/react-portal to v0.0.0-nightly-
|
18
|
-
- Bump @fluentui/react-positioning to v0.0.0-nightly-
|
19
|
-
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-
|
20
|
-
- Bump @fluentui/react-theme to v0.0.0-nightly-
|
21
|
-
- Bump @fluentui/react-utilities to v0.0.0-nightly-
|
22
|
-
- Bump @fluentui/react-conformance to v0.0.0-nightly-
|
23
|
-
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-
|
15
|
+
- Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
16
|
+
- Bump @fluentui/react-jsx-runtime to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
17
|
+
- Bump @fluentui/react-portal to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
18
|
+
- Bump @fluentui/react-positioning to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
19
|
+
- Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
20
|
+
- Bump @fluentui/react-theme to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
21
|
+
- Bump @fluentui/react-utilities to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
22
|
+
- Bump @fluentui/react-conformance to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
23
|
+
- Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230808-0415.1 ([commit](https://github.com/microsoft/fluentui/commit/307bdb0a82868b26dbcb9a7aa2318bda66c1cd64) by beachball)
|
24
24
|
|
25
25
|
## [9.2.28](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.2.28)
|
26
26
|
|
@@ -1,14 +1,14 @@
|
|
1
1
|
/** @jsxRuntime classic */ /** @jsxFrag React.Fragment */ /** @jsx createElement */ import * as React from 'react';
|
2
2
|
import { Portal } from '@fluentui/react-portal';
|
3
3
|
import { createElement } from '@fluentui/react-jsx-runtime';
|
4
|
-
import {
|
4
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
5
5
|
/**
|
6
6
|
* Render the final JSX of Tooltip
|
7
7
|
*/ export const renderTooltip_unstable = (state)=>{
|
8
|
-
|
8
|
+
assertSlots(state);
|
9
9
|
return /*#__PURE__*/ createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/ createElement(Portal, {
|
10
10
|
mountNode: state.mountNode
|
11
|
-
}, /*#__PURE__*/ createElement(
|
11
|
+
}, /*#__PURE__*/ createElement(state.content, null, state.withArrow && /*#__PURE__*/ createElement("div", {
|
12
12
|
ref: state.arrowRef,
|
13
13
|
className: state.arrowClassName
|
14
14
|
}), state.content.children)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderTooltip.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag React.Fragment */\n/** @jsx createElement */\n\nimport * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport {
|
1
|
+
{"version":3,"sources":["renderTooltip.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsxFrag React.Fragment */\n/** @jsx createElement */\n\nimport * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\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":["React","Portal","createElement","assertSlots","renderTooltip_unstable","state","children","shouldRenderTooltip","mountNode","content","withArrow","div","ref","arrowRef","className","arrowClassName"],"mappings":"AAAA,wBAAwB,GACxB,4BAA4B,GAC5B,uBAAuB,GAEvB,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,yBAAyB;AAEhD,SAASC,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;CAEC,GACD,OAAO,MAAMC,yBAAyB,CAACC,QAAwB;IAC7DF,YAA0BE;IAE1B,qBACE,AAjBJ,cADA,cAA8B,QAmBvBA,MAAMC,QAAQ,EACdD,MAAME,mBAAmB,kBACxB,AApBR,cAoBSN;QAAOO,WAAWH,MAAMG,SAAS;qBAChC,AArBV,cAqBWH,MAAMI,OAAO,QACXJ,MAAMK,SAAS,kBAAI,AAtBhC,cAsBiCC;QAAIC,KAAKP,MAAMQ,QAAQ;QAAEC,WAAWT,MAAMU,cAAc;QAC5EV,MAAMI,OAAO,CAACH,QAAQ;AAMnC,EAAE"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
2
|
import { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
|
3
3
|
import { useTooltipVisibility_unstable as useTooltipVisibility, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
|
4
|
-
import { applyTriggerPropsToChildren,
|
4
|
+
import { applyTriggerPropsToChildren, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback, slot } from '@fluentui/react-utilities';
|
5
5
|
import { arrowHeight, tooltipBorderRadius } from './private/constants';
|
6
6
|
import { Escape } from '@fluentui/keyboard-keys';
|
7
7
|
/**
|
@@ -51,11 +51,11 @@ import { Escape } from '@fluentui/keyboard-keys';
|
|
51
51
|
components: {
|
52
52
|
content: 'div'
|
53
53
|
},
|
54
|
-
content:
|
54
|
+
content: slot.always(content, {
|
55
55
|
defaultProps: {
|
56
56
|
role: 'tooltip'
|
57
57
|
},
|
58
|
-
|
58
|
+
elementType: 'div'
|
59
59
|
})
|
60
60
|
};
|
61
61
|
state.content.id = useId('tooltip-', state.content.id);
|
@@ -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 resolveShorthand,\n useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipChildProps } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */\nexport const useTooltip_unstable = (props: TooltipProps): TooltipState => {\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n const {\n appearance = 'normal',\n children,\n content,\n withArrow = false,\n positioning = 'above',\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\n mountNode,\n } = props;\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const setVisible = React.useCallback(\n (newVisible: boolean, ev?: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (newVisible !== oldVisible) {\n onVisibleChange?.(ev, { visible: newVisible });\n }\n return newVisible;\n });\n },\n [clearDelayTimeout, setVisibleInternal, onVisibleChange],\n );\n\n const state: TooltipState = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\n appearance,\n mountNode,\n // Slots\n components: {\n content: 'div',\n },\n content: resolveShorthand(content, {\n defaultProps: {\n role: 'tooltip',\n },\n required: true,\n }),\n };\n\n state.content.id = useId('tooltip-', state.content.id);\n\n const positioningOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above' as const,\n align: 'center' as const,\n offset: 4,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);\n }\n\n const {\n targetRef,\n containerRef,\n arrowRef,\n }: {\n targetRef: React.MutableRefObject<unknown>;\n containerRef: React.MutableRefObject<HTMLDivElement>;\n arrowRef: React.MutableRefObject<HTMLDivElement>;\n } = usePositioning(positioningOptions);\n\n state.content.ref = useMergedRefs(state.content.ref, containerRef);\n state.arrowRef = arrowRef;\n\n // When this tooltip is visible, hide any other tooltips, and register it\n // as the visibleTooltip with the TooltipContext.\n // Also add a listener on document to hide the tooltip if Escape is pressed\n useIsomorphicLayoutEffect(() => {\n if (visible) {\n const thisTooltip = { hide: () => setVisible(false) };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true,\n });\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [context, targetDocument, visible, setVisible]);\n\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement.\n // See https://github.com/microsoft/fluentui/issues/13541\n const ignoreNextFocusEventRef = React.useRef(false);\n\n // Listener for onPointerEnter and onFocus on the trigger element\n const onEnterTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {\n ignoreNextFocusEventRef.current = false;\n return;\n }\n\n // Show immediately if another tooltip is already visible\n const delay = context.visibleTooltip ? 0 : state.showDelay;\n\n setDelayTimeout(() => {\n setVisible(true, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.showDelay, context],\n );\n\n // Listener for onPointerLeave and onBlur on the trigger element\n const onLeaveTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n let delay = state.hideDelay;\n\n if (ev.type === 'blur') {\n // Hide immediately when losing focus\n delay = 0;\n\n ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;\n }\n\n setDelayTimeout(() => {\n setVisible(false, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.hideDelay, targetDocument],\n );\n\n // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.\n // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);\n\n const child = getTriggerChild(children);\n\n const triggerAriaProps: Pick<TooltipChildProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> = {};\n\n if (relationship === 'label') {\n // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.\n if (typeof state.content.children === 'string') {\n triggerAriaProps['aria-label'] = state.content.children;\n } else {\n triggerAriaProps['aria-labelledby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n } else if (relationship === 'description') {\n triggerAriaProps['aria-describedby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n\n // Don't render the Tooltip in SSR to avoid hydration errors\n if (isServerSideRender) {\n state.shouldRenderTooltip = false;\n }\n\n const childTargetRef = useMergedRefs(child?.ref, targetRef);\n\n // Apply the trigger props to the child, either by calling the render function, or cloning with the new props\n state.children = applyTriggerPropsToChildren(children, {\n ...triggerAriaProps,\n ...child?.props,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : child?.ref,\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger)),\n });\n\n return state;\n};\n"],"names":["React","mergeArrowOffset","resolvePositioningShorthand","usePositioning","useTooltipVisibility_unstable","useTooltipVisibility","useFluent_unstable","useFluent","applyTriggerPropsToChildren","resolveShorthand","useControllableState","useId","useIsomorphicLayoutEffect","useIsSSR","useMergedRefs","useTimeout","getTriggerChild","mergeCallbacks","useEventCallback","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","newVisible","ev","oldVisible","shouldRenderTooltip","components","defaultProps","role","required","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","ref","thisTooltip","hide","visibleTooltip","onDocumentKeyDown","key","stopPropagation","addEventListener","capture","undefined","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,gBA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,yFAAyF;QACzFyC,KAAKT,mBAAmB6B,MAAM,KAAKX,YAAYiB,iBAAiBlE,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOwC,GAAG;QAC1EqB,gBAAgBnE,iBAAiBD,eAAeO,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,eAAAA,MAAOD,KAAK,cAAZC,0BAAAA,KAAAA,IAAAA,aAAc6D,cAAF,EAAkBR;QAC9ES,gBAAgBpE,iBAAiBD,eAAeO,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,cAAZC,2BAAAA,KAAAA,IAAAA,cAAc8D,cAAF,EAAkBJ;QAC9EK,SAASrE,iBAAiBD,eAAeO,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,cAAZC,2BAAAA,KAAAA,IAAAA,cAAc+D,OAAF,EAAWV;QAChEW,QAAQtE,iBAAiBD,eAAeO,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,cAAZC,2BAAAA,KAAAA,IAAAA,cAAcgE,MAAF,EAAUN;IAChE;IAEA,OAAOxC;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 } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */\nexport const useTooltip_unstable = (props: TooltipProps): TooltipState => {\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n const {\n appearance = 'normal',\n children,\n content,\n withArrow = false,\n positioning = 'above',\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\n mountNode,\n } = props;\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const setVisible = React.useCallback(\n (newVisible: boolean, ev?: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (newVisible !== oldVisible) {\n onVisibleChange?.(ev, { visible: newVisible });\n }\n return newVisible;\n });\n },\n [clearDelayTimeout, setVisibleInternal, onVisibleChange],\n );\n\n const state: TooltipState = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\n appearance,\n mountNode,\n // Slots\n components: {\n content: 'div',\n },\n content: 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 = { hide: () => setVisible(false) };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true,\n });\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [context, targetDocument, visible, setVisible]);\n\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement.\n // See https://github.com/microsoft/fluentui/issues/13541\n const ignoreNextFocusEventRef = React.useRef(false);\n\n // Listener for onPointerEnter and onFocus on the trigger element\n const onEnterTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {\n ignoreNextFocusEventRef.current = false;\n return;\n }\n\n // Show immediately if another tooltip is already visible\n const delay = context.visibleTooltip ? 0 : state.showDelay;\n\n setDelayTimeout(() => {\n setVisible(true, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.showDelay, context],\n );\n\n // Listener for onPointerLeave and onBlur on the trigger element\n const onLeaveTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n let delay = state.hideDelay;\n\n if (ev.type === 'blur') {\n // Hide immediately when losing focus\n delay = 0;\n\n ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;\n }\n\n setDelayTimeout(() => {\n setVisible(false, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.hideDelay, targetDocument],\n );\n\n // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.\n // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);\n\n const child = getTriggerChild(children);\n\n const triggerAriaProps: Pick<TooltipChildProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> = {};\n\n if (relationship === 'label') {\n // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.\n if (typeof state.content.children === 'string') {\n triggerAriaProps['aria-label'] = state.content.children;\n } else {\n triggerAriaProps['aria-labelledby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n } else if (relationship === 'description') {\n triggerAriaProps['aria-describedby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n\n // Don't render the Tooltip in SSR to avoid hydration errors\n if (isServerSideRender) {\n state.shouldRenderTooltip = false;\n }\n\n const childTargetRef = useMergedRefs(child?.ref, targetRef);\n\n // Apply the trigger props to the child, either by calling the render function, or cloning with the new props\n state.children = applyTriggerPropsToChildren(children, {\n ...triggerAriaProps,\n ...child?.props,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : child?.ref,\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger)),\n });\n\n return state;\n};\n"],"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","newVisible","ev","oldVisible","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","ref","thisTooltip","hide","visibleTooltip","onDocumentKeyDown","key","stopPropagation","addEventListener","capture","undefined","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,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kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,eAAAA,MAAOD,KAAK,cAAZC,0BAAAA,KAAAA,IAAAA,aAAc8D,cAAF,EAAkBR;QAC9ES,gBAAgBtE,iBAAiBD,eAAeQ,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,cAAZC,2BAAAA,KAAAA,IAAAA,cAAc+D,cAAF,EAAkBJ;QAC9EK,SAASvE,iBAAiBD,eAAeQ,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,cAAZC,2BAAAA,KAAAA,IAAAA,cAAcgE,OAAF,EAAWV;QAChEW,QAAQxE,iBAAiBD,eAAeQ,kBAAAA,mBAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,cAAZC,2BAAAA,KAAAA,IAAAA,cAAciE,MAAF,EAAUN;IAChE;IAEA,OAAOzC;AACT,EAAE"}
|
@@ -12,10 +12,10 @@ const _reactPortal = require("@fluentui/react-portal");
|
|
12
12
|
const _reactJsxRuntime = require("@fluentui/react-jsx-runtime");
|
13
13
|
const _reactUtilities = require("@fluentui/react-utilities");
|
14
14
|
const renderTooltip_unstable = (state)=>{
|
15
|
-
|
15
|
+
(0, _reactUtilities.assertSlots)(state);
|
16
16
|
return /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_react.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(_reactPortal.Portal, {
|
17
17
|
mountNode: state.mountNode
|
18
|
-
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(
|
18
|
+
}, /*#__PURE__*/ (0, _reactJsxRuntime.createElement)(state.content, null, state.withArrow && /*#__PURE__*/ (0, _reactJsxRuntime.createElement)("div", {
|
19
19
|
ref: state.arrowRef,
|
20
20
|
className: state.arrowClassName
|
21
21
|
}), state.content.children)));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["renderTooltip.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag React.Fragment */ /** @jsx createElement */ import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport {
|
1
|
+
{"version":3,"sources":["renderTooltip.js"],"sourcesContent":["/** @jsxRuntime classic */ /** @jsxFrag React.Fragment */ /** @jsx createElement */ import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { createElement } from '@fluentui/react-jsx-runtime';\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__*/ createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/ createElement(Portal, {\n mountNode: state.mountNode\n }, /*#__PURE__*/ createElement(state.content, null, state.withArrow && /*#__PURE__*/ createElement(\"div\", {\n ref: state.arrowRef,\n className: state.arrowClassName\n }), state.content.children)));\n};\n"],"names":["renderTooltip_unstable","state","assertSlots","createElement","React","Fragment","children","shouldRenderTooltip","Portal","mountNode","content","withArrow","ref","arrowRef","className","arrowClassName"],"mappings":"AAAA,wBAAwB,GAAG,4BAA4B,GAAG,uBAAuB;;;;+BAMhEA;;aAAAA;;;6DAN0F;6BACpF;iCACO;gCACF;AAGjB,MAAMA,yBAAyB,CAACC,QAAQ;IAC/CC,IAAAA,2BAAW,EAACD;IACZ,OAAO,WAAW,GAAGE,IAAAA,8BAAa,EAACC,OAAMC,QAAQ,EAAE,IAAI,EAAEJ,MAAMK,QAAQ,EAAEL,MAAMM,mBAAmB,IAAI,WAAW,GAAGJ,IAAAA,8BAAa,EAACK,mBAAM,EAAE;QACtIC,WAAWR,MAAMQ,SAAS;IAC9B,GAAG,WAAW,GAAGN,IAAAA,8BAAa,EAACF,MAAMS,OAAO,EAAE,IAAI,EAAET,MAAMU,SAAS,IAAI,WAAW,GAAGR,IAAAA,8BAAa,EAAC,OAAO;QACtGS,KAAKX,MAAMY,QAAQ;QACnBC,WAAWb,MAAMc,cAAc;IACnC,IAAId,MAAMS,OAAO,CAACJ,QAAQ;AAC9B"}
|
@@ -53,11 +53,11 @@ const useTooltip_unstable = (props)=>{
|
|
53
53
|
components: {
|
54
54
|
content: 'div'
|
55
55
|
},
|
56
|
-
content:
|
56
|
+
content: _reactUtilities.slot.always(content, {
|
57
57
|
defaultProps: {
|
58
58
|
role: 'tooltip'
|
59
59
|
},
|
60
|
-
|
60
|
+
elementType: 'div'
|
61
61
|
})
|
62
62
|
};
|
63
63
|
state.content.id = (0, _reactUtilities.useId)('tooltip-', state.content.id);
|
@@ -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, resolveShorthand, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback } from '@fluentui/react-utilities';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */ 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((newVisible, ev)=>{\n clearDelayTimeout();\n setVisibleInternal((oldVisible)=>{\n if (newVisible !== oldVisible) {\n onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {\n visible: newVisible\n });\n }\n return newVisible;\n });\n }, [\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: resolveShorthand(content, {\n defaultProps: {\n role: 'tooltip'\n },\n required: true\n })\n };\n state.content.id = useId('tooltip-', state.content.id);\n const positioningOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above',\n align: 'center',\n offset: 4,\n ...resolvePositioningShorthand(state.positioning)\n };\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);\n }\n const { 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: ()=>setVisible(false)\n };\n (_context_visibleTooltip = context.visibleTooltip) === null || _context_visibleTooltip === void 0 ? void 0 : _context_visibleTooltip.hide();\n context.visibleTooltip = thisTooltip;\n const onDocumentKeyDown = (ev)=>{\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true\n });\n return ()=>{\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {\n capture: true\n });\n };\n }\n }, [\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(true, ev);\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(false, ev);\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","newVisible","ev","oldVisible","shouldRenderTooltip","components","resolveShorthand","defaultProps","role","required","id","useId","positioningOptions","enabled","arrowPadding","tooltipBorderRadius","position","align","offset","resolvePositioningShorthand","mergeArrowOffset","arrowHeight","targetRef","containerRef","arrowRef","usePositioning","ref","useMergedRefs","useIsomorphicLayoutEffect","_context_visibleTooltip","thisTooltip","hide","visibleTooltip","onDocumentKeyDown","key","Escape","stopPropagation","addEventListener","capture","undefined","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","mergeCallbacks","onPointerLeave","onFocus","onBlur","child","getTriggerChild","triggerAriaProps","childTargetRef","applyTriggerPropsToChildren","useEventCallback"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;kCACuD;qCACyB;gCACuG;2BAC7J;8BAC1B;AAQZ,MAAMA,sBAAsB,CAACC,QAAQ;IAC5C,IAAIC,cAAcC,eAAeC,eAAeC;IAChD,MAAMC,UAAUC,IAAAA,kDAAoB;IACpC,MAAMC,qBAAqBC,IAAAA,wBAAQ;IACnC,MAAM,EAAEC,eAAc,EAAG,GAAGC,IAAAA,uCAAS;IACrC,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGC,IAAAA,0BAAU;IACvD,MAAM,EAAEC,YAAY,SAAQ,EAAGC,SAAQ,EAAGC,QAAO,EAAGC,WAAW,KAAK,CAAA,EAAGC,aAAa,QAAO,EAAGC,gBAAe,EAAGC,aAAY,EAAGC,WAAW,IAAG,EAAGC,WAAW,IAAG,EAAGC,UAAS,EAAG,GAAGvB;IAChL,MAAM,CAACwB,SAASC,mBAAmB,GAAGC,IAAAA,oCAAoB,EAAC;QACvDC,OAAO3B,MAAMwB,OAA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AAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACrF,CAAAA,gBAAgBqF,MAAMvF,KAAK,AAAD,MAAO,IAAI,IAAIE,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAckF,cAAc,EAAEL;QAC1MM,SAASO,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACpF,CAAAA,gBAAgBoF,MAAMvF,KAAK,AAAD,MAAO,IAAI,IAAIG,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAckF,OAAO,EAAEX;QAC5LY,QAAQM,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACnF,CAAAA,gBAAgBmF,MAAMvF,KAAK,AAAD,MAAO,IAAI,IAAII,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAckF,MAAM,EAAEP;IAC9L;IACA,OAAOpD;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_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((newVisible, ev)=>{\n clearDelayTimeout();\n setVisibleInternal((oldVisible)=>{\n if (newVisible !== oldVisible) {\n onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {\n visible: newVisible\n });\n }\n return newVisible;\n });\n }, [\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: ()=>setVisible(false)\n };\n (_context_visibleTooltip = context.visibleTooltip) === null || _context_visibleTooltip === void 0 ? void 0 : _context_visibleTooltip.hide();\n context.visibleTooltip = thisTooltip;\n const onDocumentKeyDown = (ev)=>{\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true\n });\n return ()=>{\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {\n capture: true\n });\n };\n }\n }, [\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(true, ev);\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(false, ev);\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","newVisible","ev","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","visibleTooltip","onDocumentKeyDown","key","Escape","stopPropagation","addEventListener","capture","undefined","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","mergeCallbacks","onPointerLeave","onFocus","onBlur","child","getTriggerChild","triggerAriaProps","childTargetRef","applyTriggerPropsToChildren","useEventCallback"],"mappings":";;;;+BAaiBA;;aAAAA;;;6DAbM;kCACuD;qCACyB;gCAC2F;2BACjJ;8BAC1B;AAQZ,MAAMA,sBAAsB,CAACC,QAAQ;IAC5C,IAAIC,cAAcC,eAAeC,eAAeC;IAChD,MAAMC,UAAUC,IAAAA,kDAAoB;IACpC,MAAMC,qBAAqBC,IAAAA,wBAAQ;IACnC,MAAM,EAAEC,eAAc,EAAG,GAAGC,IAAAA,uCAAS;IACrC,MAAM,CAACC,iBAAiBC,kBAAkB,GAAGC,IAAAA,0BAAU;IACv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AAU,KAAK,IAAI,KAAK,IAAIA,MAAM9B,GAAG;QACvHyB,gBAAgBU,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACvF,CAAAA,eAAeuF,MAAMxF,KAAK,AAAD,MAAO,IAAI,IAAIC,iBAAiB,KAAK,IAAI,KAAK,IAAIA,aAAakF,cAAc,EAAER;QACvMU,gBAAgBQ,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACtF,CAAAA,gBAAgBsF,MAAMxF,KAAK,AAAD,MAAO,IAAI,IAAIE,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcmF,cAAc,EAAEL;QAC1MM,SAASO,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACrF,CAAAA,gBAAgBqF,MAAMxF,KAAK,AAAD,MAAO,IAAI,IAAIG,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcmF,OAAO,EAAEX;QAC5LY,QAAQM,IAAAA,gCAAgB,EAACT,IAAAA,8BAAc,EAACI,UAAU,IAAI,IAAIA,UAAU,KAAK,IAAI,KAAK,IAAI,AAACpF,CAAAA,gBAAgBoF,MAAMxF,KAAK,AAAD,MAAO,IAAI,IAAII,kBAAkB,KAAK,IAAI,KAAK,IAAIA,cAAcmF,MAAM,EAAEP;IAC9L;IACA,OAAOrD;AACX"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-tooltip",
|
3
|
-
"version": "0.0.0-nightly-
|
3
|
+
"version": "0.0.0-nightly-20230808-0415.1",
|
4
4
|
"description": "React components for building web experiences",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -27,19 +27,19 @@
|
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
29
|
"@fluentui/eslint-plugin": "*",
|
30
|
-
"@fluentui/react-conformance": "0.0.0-nightly-
|
31
|
-
"@fluentui/react-conformance-griffel": "0.0.0-nightly-
|
30
|
+
"@fluentui/react-conformance": "0.0.0-nightly-20230808-0415.1",
|
31
|
+
"@fluentui/react-conformance-griffel": "0.0.0-nightly-20230808-0415.1",
|
32
32
|
"@fluentui/scripts-api-extractor": "*",
|
33
33
|
"@fluentui/scripts-tasks": "*"
|
34
34
|
},
|
35
35
|
"dependencies": {
|
36
|
-
"@fluentui/keyboard-keys": "0.0.0-nightly-
|
37
|
-
"@fluentui/react-jsx-runtime": "0.0.0-nightly-
|
38
|
-
"@fluentui/react-portal": "0.0.0-nightly-
|
39
|
-
"@fluentui/react-positioning": "0.0.0-nightly-
|
40
|
-
"@fluentui/react-shared-contexts": "0.0.0-nightly-
|
41
|
-
"@fluentui/react-theme": "0.0.0-nightly-
|
42
|
-
"@fluentui/react-utilities": "0.0.0-nightly-
|
36
|
+
"@fluentui/keyboard-keys": "0.0.0-nightly-20230808-0415.1",
|
37
|
+
"@fluentui/react-jsx-runtime": "0.0.0-nightly-20230808-0415.1",
|
38
|
+
"@fluentui/react-portal": "0.0.0-nightly-20230808-0415.1",
|
39
|
+
"@fluentui/react-positioning": "0.0.0-nightly-20230808-0415.1",
|
40
|
+
"@fluentui/react-shared-contexts": "0.0.0-nightly-20230808-0415.1",
|
41
|
+
"@fluentui/react-theme": "0.0.0-nightly-20230808-0415.1",
|
42
|
+
"@fluentui/react-utilities": "0.0.0-nightly-20230808-0415.1",
|
43
43
|
"@griffel/react": "^1.5.7",
|
44
44
|
"@swc/helpers": "^0.4.14"
|
45
45
|
},
|