@fluentui/react-tooltip 9.8.12 → 9.72.9-experimental.component-base-hooks.20260122-49fc330360.0

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.
@@ -0,0 +1,232 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useTooltipBase_unstable", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return useTooltipBase_unstable;
10
+ }
11
+ });
12
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
+ const _reactpositioning = require("@fluentui/react-positioning");
15
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
16
+ const _reacttabster = require("@fluentui/react-tabster");
17
+ const _reactutilities = require("@fluentui/react-utilities");
18
+ const _constants = require("./private/constants");
19
+ const _useTooltipTimeout = require("./private/useTooltipTimeout");
20
+ const _keyboardkeys = require("@fluentui/keyboard-keys");
21
+ const useTooltipBase_unstable = (props)=>{
22
+ 'use no memo';
23
+ var _child_props, _child_props1, _child_props2, _child_props3, _child_props4, _child_props5, _child_props6;
24
+ const context = (0, _reactsharedcontexts.useTooltipVisibility_unstable)();
25
+ const isServerSideRender = (0, _reactutilities.useIsSSR)();
26
+ const { targetDocument } = (0, _reactsharedcontexts.useFluent_unstable)();
27
+ const [visible, setVisibleInternal] = (0, _reactutilities.useControllableState)({
28
+ state: props.visible,
29
+ initialState: false
30
+ });
31
+ const { children, content, withArrow = false, positioning = 'above', onVisibleChange, relationship, showDelay = 250, hideDelay = 250, mountNode } = props;
32
+ const state = {
33
+ withArrow,
34
+ positioning,
35
+ showDelay,
36
+ hideDelay,
37
+ relationship,
38
+ visible,
39
+ shouldRenderTooltip: visible,
40
+ mountNode,
41
+ // Slots
42
+ components: {
43
+ content: 'div'
44
+ },
45
+ content: _reactutilities.slot.always(content, {
46
+ defaultProps: {
47
+ role: 'tooltip'
48
+ },
49
+ elementType: 'div'
50
+ })
51
+ };
52
+ state.content.id = (0, _reactutilities.useId)('tooltip-', state.content.id);
53
+ const positioningOptions = {
54
+ enabled: state.visible,
55
+ arrowPadding: 2 * _constants.tooltipBorderRadius,
56
+ position: 'above',
57
+ align: 'center',
58
+ offset: 4,
59
+ ...(0, _reactpositioning.resolvePositioningShorthand)(state.positioning)
60
+ };
61
+ if (state.withArrow) {
62
+ positioningOptions.offset = (0, _reactpositioning.mergeArrowOffset)(positioningOptions.offset, _constants.arrowHeight);
63
+ }
64
+ const { targetRef, containerRef, arrowRef } = (0, _reactpositioning.usePositioning)(positioningOptions);
65
+ const [setDelayTimeout, clearDelayTimeout] = (0, _useTooltipTimeout.useTooltipTimeout)(containerRef);
66
+ const setVisible = _react.useCallback((ev, data)=>{
67
+ clearDelayTimeout();
68
+ setVisibleInternal((oldVisible)=>{
69
+ if (data.visible !== oldVisible) {
70
+ onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, data);
71
+ }
72
+ return data.visible;
73
+ });
74
+ }, [
75
+ clearDelayTimeout,
76
+ setVisibleInternal,
77
+ onVisibleChange
78
+ ]);
79
+ state.content.ref = (0, _reactutilities.useMergedRefs)(state.content.ref, containerRef);
80
+ state.arrowRef = arrowRef;
81
+ // When this tooltip is visible, hide any other tooltips, and register it
82
+ // as the visibleTooltip with the TooltipContext.
83
+ // Also add a listener on document to hide the tooltip if Escape is pressed
84
+ (0, _reactutilities.useIsomorphicLayoutEffect)(()=>{
85
+ if (visible) {
86
+ var _context_visibleTooltip;
87
+ const thisTooltip = {
88
+ hide: (ev)=>setVisible(undefined, {
89
+ visible: false,
90
+ documentKeyboardEvent: ev
91
+ })
92
+ };
93
+ (_context_visibleTooltip = context.visibleTooltip) === null || _context_visibleTooltip === void 0 ? void 0 : _context_visibleTooltip.hide();
94
+ context.visibleTooltip = thisTooltip;
95
+ const onDocumentKeyDown = (ev)=>{
96
+ if (ev.key === _keyboardkeys.Escape && !ev.defaultPrevented) {
97
+ thisTooltip.hide(ev);
98
+ // stop propagation to avoid conflicting with other elements that listen for `Escape`
99
+ // e,g: Dialog, Popover, Menu and Tooltip
100
+ ev.preventDefault();
101
+ }
102
+ };
103
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {
104
+ // As this event is added at targeted document,
105
+ // we need to capture the event to be sure keydown handling from tooltip happens first
106
+ capture: true
107
+ });
108
+ return ()=>{
109
+ if (context.visibleTooltip === thisTooltip) {
110
+ context.visibleTooltip = undefined;
111
+ }
112
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
113
+ capture: true
114
+ });
115
+ };
116
+ }
117
+ }, [
118
+ context,
119
+ targetDocument,
120
+ visible,
121
+ setVisible
122
+ ]);
123
+ // Used to skip showing the tooltip in certain situations when the trigger is focused.
124
+ // See comments where this is set for more info.
125
+ const ignoreNextFocusEventRef = _react.useRef(false);
126
+ // Listener for onPointerEnter and onFocus on the trigger element
127
+ const onEnterTrigger = _react.useCallback((ev)=>{
128
+ if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {
129
+ ignoreNextFocusEventRef.current = false;
130
+ return;
131
+ }
132
+ // Show immediately if another tooltip is already visible
133
+ const delay = context.visibleTooltip ? 0 : state.showDelay;
134
+ setDelayTimeout(()=>{
135
+ setVisible(ev, {
136
+ visible: true
137
+ });
138
+ }, delay);
139
+ ev.persist(); // Persist the event since the setVisible call will happen asynchronously
140
+ }, [
141
+ setDelayTimeout,
142
+ setVisible,
143
+ state.showDelay,
144
+ context
145
+ ]);
146
+ const isNavigatingWithKeyboard = (0, _reacttabster.useIsNavigatingWithKeyboard)();
147
+ // Callback ref that attaches a keyborg:focusin event listener.
148
+ const [keyborgListenerCallbackRef] = _react.useState(()=>{
149
+ const onKeyborgFocusIn = (ev)=>{
150
+ var _ev_detail;
151
+ // Skip showing the tooltip if focus moved programmatically.
152
+ // For example, we don't want to show the tooltip when a dialog is closed
153
+ // and Tabster programmatically restores focus to the trigger button.
154
+ // See https://github.com/microsoft/fluentui/issues/27576
155
+ if (((_ev_detail = ev.detail) === null || _ev_detail === void 0 ? void 0 : _ev_detail.isFocusedProgrammatically) && !isNavigatingWithKeyboard()) {
156
+ ignoreNextFocusEventRef.current = true;
157
+ }
158
+ };
159
+ // Save the current element to remove the listener when the ref changes
160
+ let current = null;
161
+ // Callback ref that attaches the listener to the element
162
+ return (element)=>{
163
+ current === null || current === void 0 ? void 0 : current.removeEventListener(_reacttabster.KEYBORG_FOCUSIN, onKeyborgFocusIn);
164
+ element === null || element === void 0 ? void 0 : element.addEventListener(_reacttabster.KEYBORG_FOCUSIN, onKeyborgFocusIn);
165
+ current = element;
166
+ };
167
+ });
168
+ // Listener for onPointerLeave and onBlur on the trigger element
169
+ const onLeaveTrigger = _react.useCallback((ev)=>{
170
+ let delay = state.hideDelay;
171
+ if (ev.type === 'blur') {
172
+ // Hide immediately when losing focus
173
+ delay = 0;
174
+ // The focused element gets a blur event when the document loses focus
175
+ // (e.g. switching tabs in the browser), but we don't want to show the
176
+ // tooltip again when the document gets focus back. Handle this case by
177
+ // checking if the blurred element is still the document's activeElement.
178
+ // See https://github.com/microsoft/fluentui/issues/13541
179
+ ignoreNextFocusEventRef.current = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === ev.target;
180
+ }
181
+ setDelayTimeout(()=>{
182
+ setVisible(ev, {
183
+ visible: false
184
+ });
185
+ }, delay);
186
+ ev.persist(); // Persist the event since the setVisible call will happen asynchronously
187
+ }, [
188
+ setDelayTimeout,
189
+ setVisible,
190
+ state.hideDelay,
191
+ targetDocument
192
+ ]);
193
+ // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.
194
+ // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.
195
+ state.content.onPointerEnter = (0, _reactutilities.mergeCallbacks)(state.content.onPointerEnter, clearDelayTimeout);
196
+ state.content.onPointerLeave = (0, _reactutilities.mergeCallbacks)(state.content.onPointerLeave, onLeaveTrigger);
197
+ state.content.onFocus = (0, _reactutilities.mergeCallbacks)(state.content.onFocus, clearDelayTimeout);
198
+ state.content.onBlur = (0, _reactutilities.mergeCallbacks)(state.content.onBlur, onLeaveTrigger);
199
+ const child = (0, _reactutilities.getTriggerChild)(children);
200
+ const triggerAriaProps = {};
201
+ const isPopupExpanded = (child === null || child === void 0 ? void 0 : (_child_props = child.props) === null || _child_props === void 0 ? void 0 : _child_props['aria-haspopup']) && ((child === null || child === void 0 ? void 0 : (_child_props1 = child.props) === null || _child_props1 === void 0 ? void 0 : _child_props1['aria-expanded']) === true || (child === null || child === void 0 ? void 0 : (_child_props2 = child.props) === null || _child_props2 === void 0 ? void 0 : _child_props2['aria-expanded']) === 'true');
202
+ if (relationship === 'label') {
203
+ // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
204
+ if (typeof state.content.children === 'string') {
205
+ triggerAriaProps['aria-label'] = state.content.children;
206
+ } else {
207
+ triggerAriaProps['aria-labelledby'] = state.content.id;
208
+ // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
209
+ state.shouldRenderTooltip = true;
210
+ }
211
+ } else if (relationship === 'description') {
212
+ triggerAriaProps['aria-describedby'] = state.content.id;
213
+ // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
214
+ state.shouldRenderTooltip = true;
215
+ }
216
+ // Case 1: Don't render the Tooltip in SSR to avoid hydration errors
217
+ // Case 2: Don't render the Tooltip, if it triggers Menu or another popup and it's already opened
218
+ if (isServerSideRender || isPopupExpanded) {
219
+ state.shouldRenderTooltip = false;
220
+ }
221
+ // Apply the trigger props to the child, either by calling the render function, or cloning with the new props
222
+ state.children = (0, _reactutilities.applyTriggerPropsToChildren)(children, {
223
+ ...triggerAriaProps,
224
+ ...child === null || child === void 0 ? void 0 : child.props,
225
+ ref: (0, _reactutilities.useMergedRefs)((0, _reactutilities.getReactElementRef)(child), keyborgListenerCallbackRef, positioningOptions.target === undefined ? targetRef : undefined),
226
+ onPointerEnter: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props3 = child.props) === null || _child_props3 === void 0 ? void 0 : _child_props3.onPointerEnter, onEnterTrigger)),
227
+ onPointerLeave: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props4 = child.props) === null || _child_props4 === void 0 ? void 0 : _child_props4.onPointerLeave, onLeaveTrigger)),
228
+ onFocus: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props5 = child.props) === null || _child_props5 === void 0 ? void 0 : _child_props5.onFocus, onEnterTrigger)),
229
+ onBlur: (0, _reactutilities.useEventCallback)((0, _reactutilities.mergeCallbacks)(child === null || child === void 0 ? void 0 : (_child_props6 = child.props) === null || _child_props6 === void 0 ? void 0 : _child_props6.onBlur, onLeaveTrigger))
230
+ });
231
+ return state;
232
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/Tooltip/useTooltipBase.tsx"],"sourcesContent":["'use client';\n\nimport * 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 type { KeyborgFocusInEvent } from '@fluentui/react-tabster';\nimport { KEYBORG_FOCUSIN, useIsNavigatingWithKeyboard } from '@fluentui/react-tabster';\nimport {\n applyTriggerPropsToChildren,\n useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n slot,\n getReactElementRef,\n} from '@fluentui/react-utilities';\nimport type { TooltipBaseProps, TooltipBaseState, TooltipChildProps, OnVisibleChangeData } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { useTooltipTimeout } from './private/useTooltipTimeout';\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 useTooltipBase_unstable = (props: TooltipBaseProps): TooltipBaseState => {\n 'use no memo';\n\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n\n const {\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 state: TooltipBaseState = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\n targetRef: React.MutableRefObject<unknown>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n containerRef: React.MutableRefObject<HTMLDivElement>;\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n arrowRef: React.MutableRefObject<HTMLDivElement>;\n } = usePositioning(positioningOptions);\n\n const [setDelayTimeout, clearDelayTimeout] = useTooltipTimeout(containerRef);\n\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 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 && !ev.defaultPrevented) {\n thisTooltip.hide(ev);\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu and Tooltip\n ev.preventDefault();\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 // Used to skip showing the tooltip in certain situations when the trigger is focused.\n // See comments where this is set for more info.\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 const isNavigatingWithKeyboard = useIsNavigatingWithKeyboard();\n\n // Callback ref that attaches a keyborg:focusin event listener.\n const [keyborgListenerCallbackRef] = React.useState(() => {\n const onKeyborgFocusIn = ((ev: KeyborgFocusInEvent) => {\n // Skip showing the tooltip if focus moved programmatically.\n // For example, we don't want to show the tooltip when a dialog is closed\n // and Tabster programmatically restores focus to the trigger button.\n // See https://github.com/microsoft/fluentui/issues/27576\n if (ev.detail?.isFocusedProgrammatically && !isNavigatingWithKeyboard()) {\n ignoreNextFocusEventRef.current = true;\n }\n }) as EventListener;\n\n // Save the current element to remove the listener when the ref changes\n let current: Element | null = null;\n\n // Callback ref that attaches the listener to the element\n return (element: Element | null) => {\n current?.removeEventListener(KEYBORG_FOCUSIN, onKeyborgFocusIn);\n element?.addEventListener(KEYBORG_FOCUSIN, onKeyborgFocusIn);\n current = element;\n };\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 // 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 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 const isPopupExpanded =\n child?.props?.['aria-haspopup'] &&\n (child?.props?.['aria-expanded'] === true || child?.props?.['aria-expanded'] === 'true');\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 // Case 1: Don't render the Tooltip in SSR to avoid hydration errors\n // Case 2: Don't render the Tooltip, if it triggers Menu or another popup and it's already opened\n if (isServerSideRender || isPopupExpanded) {\n state.shouldRenderTooltip = false;\n }\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 ref: useMergedRefs(\n getReactElementRef<HTMLButtonElement>(child),\n keyborgListenerCallbackRef,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n positioningOptions.target === undefined ? targetRef : undefined,\n ),\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","KEYBORG_FOCUSIN","useIsNavigatingWithKeyboard","applyTriggerPropsToChildren","useControllableState","useId","useIsomorphicLayoutEffect","useIsSSR","useMergedRefs","getTriggerChild","mergeCallbacks","useEventCallback","slot","getReactElementRef","arrowHeight","tooltipBorderRadius","useTooltipTimeout","Escape","useTooltipBase_unstable","props","child","context","isServerSideRender","targetDocument","visible","setVisibleInternal","state","initialState","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","setDelayTimeout","clearDelayTimeout","setVisible","useCallback","ev","data","oldVisible","ref","thisTooltip","hide","undefined","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","defaultPrevented","preventDefault","addEventListener","capture","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","isNavigatingWithKeyboard","keyborgListenerCallbackRef","useState","onKeyborgFocusIn","detail","isFocusedProgrammatically","element","onLeaveTrigger","activeElement","target","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","isPopupExpanded"],"mappings":"AAAA;;;;;+BAoCayB;;;;;;;iEAlCU,QAAQ;kCAC+C,8BAA8B;qCAIrG,kCAAkC;8BAEoB,0BAA0B;gCAahF,4BAA4B;2BAEc,sBAAsB;mCACrC,8BAA8B;8BACzC,0BAA0B;AAU1C,gCAAgC,CAACC;IACtC;QAkNEC,cACCA,eAA4CA,eAiCGA,eACAA,eACPA,eACDA;IArP1C,MAAMC,cAAUvB,kDAAAA;IAChB,MAAMwB,yBAAqBf,wBAAAA;IAC3B,MAAM,EAAEgB,cAAc,EAAE,OAAGvB,uCAAAA;IA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,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcsE,cAAc,EAAEf;QAC9EgB,oBAAgBhF,gCAAAA,MAAiBD,8BAAAA,EAAeU,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcuE,cAAc,EAAEJ;QAC9EK,SAASjF,oCAAAA,MAAiBD,8BAAAA,EAAeU,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcwE,OAAO,EAAEjB;QAChEkB,YAAQlF,gCAAAA,MAAiBD,8BAAAA,EAAeU,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcyE,MAAM,EAAEN;IAChE;IAEA,OAAO7D;AACT,EAAE"}
@@ -26,3 +26,6 @@ _export(exports, {
26
26
  }
27
27
  });
28
28
  const _Tooltip = require("./Tooltip");
29
+ // Experimental APIs - will be uncommented in experimental release
30
+ // export { useTooltipBase_unstable } from './Tooltip';
31
+ // export type { TooltipBaseProps, TooltipBaseState } from './Tooltip';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Tooltip,\n renderTooltip_unstable,\n tooltipClassNames,\n useTooltipStyles_unstable,\n useTooltip_unstable,\n} from './Tooltip';\nexport type {\n OnVisibleChangeData,\n TooltipProps,\n TooltipSlots,\n TooltipState,\n TooltipChildProps as TooltipTriggerProps,\n} from './Tooltip';\n"],"names":["Tooltip","renderTooltip_unstable","tooltipClassNames","useTooltipStyles_unstable","useTooltip_unstable"],"mappings":";;;;;;;;;;;;eACEA,gBAAO;;;eACPC,+BAAsB;;;eACtBC,0BAAiB;;;eACjBC,kCAAyB;;;eACzBC,4BAAmB;;;yBACd,YAAY"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Tooltip,\n renderTooltip_unstable,\n tooltipClassNames,\n useTooltipStyles_unstable,\n useTooltip_unstable,\n} from './Tooltip';\nexport type {\n OnVisibleChangeData,\n TooltipProps,\n TooltipSlots,\n TooltipState,\n TooltipChildProps as TooltipTriggerProps,\n} from './Tooltip';\n\n// Experimental APIs - will be uncommented in experimental release\n// export { useTooltipBase_unstable } from './Tooltip';\n// export type { TooltipBaseProps, TooltipBaseState } from './Tooltip';\n"],"names":["Tooltip","renderTooltip_unstable","tooltipClassNames","useTooltipStyles_unstable","useTooltip_unstable"],"mappings":";;;;;;;;;;;;eACEA,gBAAO;;;eACPC,+BAAsB;;;eACtBC,0BAAiB;;;eACjBC,kCAAyB;;;eACzBC,4BAAmB;;;yBACd,YAAY;CASnB,kEAAkE;CAClE,uDAAuD;CACvD,uEAAuE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-tooltip",
3
- "version": "9.8.12",
3
+ "version": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
4
4
  "description": "React components for building web experiences",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -11,21 +11,15 @@
11
11
  "url": "https://github.com/microsoft/fluentui"
12
12
  },
13
13
  "license": "MIT",
14
- "devDependencies": {
15
- "@fluentui/react-conformance": "*",
16
- "@fluentui/eslint-plugin": "*",
17
- "@fluentui/react-conformance-griffel": "*",
18
- "@fluentui/scripts-api-extractor": "*"
19
- },
20
14
  "dependencies": {
21
- "@fluentui/keyboard-keys": "^9.0.8",
22
- "@fluentui/react-jsx-runtime": "^9.3.4",
23
- "@fluentui/react-portal": "^9.8.9",
24
- "@fluentui/react-positioning": "^9.20.11",
25
- "@fluentui/react-shared-contexts": "^9.26.0",
26
- "@fluentui/react-tabster": "^9.26.11",
27
- "@fluentui/react-theme": "^9.2.0",
28
- "@fluentui/react-utilities": "^9.26.0",
15
+ "@fluentui/keyboard-keys": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
16
+ "@fluentui/react-jsx-runtime": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
17
+ "@fluentui/react-portal": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
18
+ "@fluentui/react-positioning": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
19
+ "@fluentui/react-shared-contexts": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
20
+ "@fluentui/react-tabster": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
21
+ "@fluentui/react-theme": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
22
+ "@fluentui/react-utilities": "9.72.9-experimental.component-base-hooks.20260122-49fc330360.0",
29
23
  "@griffel/react": "^1.5.32",
30
24
  "@swc/helpers": "^0.5.1"
31
25
  },
@@ -35,12 +29,7 @@
35
29
  "react": ">=16.14.0 <20.0.0",
36
30
  "react-dom": ">=16.14.0 <20.0.0"
37
31
  },
38
- "beachball": {
39
- "disallowedChangeTypes": [
40
- "major",
41
- "prerelease"
42
- ]
43
- },
32
+ "beachball": {},
44
33
  "exports": {
45
34
  ".": {
46
35
  "types": "./dist/index.d.ts",