@fluentui/react-tooltip 9.74.9-experimental.menu-disable-autofocus.20261008-e9914a95c6.0 → 9.75.0-experimental.css-modules.20261031-810ab07afb.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.
- package/CHANGELOG.md +26 -13
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/components/Tooltip/Tooltip.module.css +35 -0
- package/lib/components/Tooltip/Tooltip.types.js.map +1 -1
- package/lib/components/Tooltip/index.js.map +1 -1
- package/lib/components/Tooltip/private/constants.js.map +1 -1
- package/lib/components/Tooltip/private/useTooltipTimeout.js.map +1 -1
- package/lib/components/Tooltip/renderTooltip.js +2 -2
- package/lib/components/Tooltip/renderTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltip.js.map +1 -1
- package/lib/components/Tooltip/useTooltipBase.js.map +1 -1
- package/lib/components/Tooltip/useTooltipStyles.styles.css.js +11 -0
- package/lib/components/Tooltip/useTooltipStyles.styles.css.js.map +1 -0
- package/lib/components/Tooltip/useTooltipStyles.styles.raw.css.js +11 -0
- package/lib/components/Tooltip/useTooltipStyles.styles.raw.css.js.map +1 -0
- package/lib/components/Tooltip/useTooltipStyles.styles.raw.js.map +1 -1
- package/lib-commonjs/Tooltip.cjs +7 -7
- package/lib-commonjs/components/Tooltip/Tooltip.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/Tooltip.module.css +35 -0
- package/lib-commonjs/components/Tooltip/Tooltip.types.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/index.cjs +7 -7
- package/lib-commonjs/components/Tooltip/index.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/private/constants.cjs +3 -3
- package/lib-commonjs/components/Tooltip/private/constants.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/private/useTooltipTimeout.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/renderTooltip.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltip.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipBase.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.cjs +3 -3
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.css.cjs +30 -0
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.css.cjs.map +1 -0
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.raw.cjs +3 -3
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.raw.cjs.map +1 -1
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.raw.css.cjs +30 -0
- package/lib-commonjs/components/Tooltip/useTooltipStyles.styles.raw.css.cjs.map +1 -0
- package/lib-commonjs/index.cjs +7 -7
- package/package.json +14 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-tooltip
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Sat, 31 Oct 2026 11:08:41 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [9.
|
|
7
|
+
## [9.75.0-experimental.css-modules.20261031-810ab07afb.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.75.0-experimental.css-modules.20261031-810ab07afb.0)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.10.7..@fluentui/react-tooltip_v9.74.9-experimental.menu-disable-autofocus.20261008-e9914a95c6.0)
|
|
9
|
+
Sat, 31 Oct 2026 11:08:41 GMT
|
|
11
10
|
|
|
12
11
|
### Changes
|
|
13
12
|
|
|
14
|
-
- Release 9.
|
|
15
|
-
- Bump @fluentui/keyboard-keys to v9.
|
|
16
|
-
- Bump @fluentui/react-jsx-runtime to v9.
|
|
17
|
-
- Bump @fluentui/react-portal to v9.
|
|
18
|
-
- Bump @fluentui/react-positioning to v9.
|
|
19
|
-
- Bump @fluentui/react-shared-contexts to v9.
|
|
20
|
-
- Bump @fluentui/react-tabster to v9.
|
|
21
|
-
- Bump @fluentui/react-theme to v9.
|
|
22
|
-
- Bump @fluentui/react-utilities to v9.
|
|
13
|
+
- Release 9.75.0-experimental.css-modules.20261031-810ab07afb ([commit](https://github.com/microsoft/fluentui/commit/undefined) by 257645319+office-ogx-auth-helper[bot]@users.noreply.github.com)
|
|
14
|
+
- Bump @fluentui/keyboard-keys to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
15
|
+
- Bump @fluentui/react-jsx-runtime to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
16
|
+
- Bump @fluentui/react-portal to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
17
|
+
- Bump @fluentui/react-positioning to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
18
|
+
- Bump @fluentui/react-shared-contexts to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
19
|
+
- Bump @fluentui/react-tabster to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
20
|
+
- Bump @fluentui/react-theme to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
21
|
+
- Bump @fluentui/react-utilities to v9.75.0-experimental.css-modules.20261031-810ab07afb.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
22
|
+
|
|
23
|
+
## [9.10.8](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.10.8)
|
|
24
|
+
|
|
25
|
+
Mon, 19 Oct 2026 16:49:01 GMT
|
|
26
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.10.7..@fluentui/react-tooltip_v9.10.8)
|
|
27
|
+
|
|
28
|
+
### Patches
|
|
29
|
+
|
|
30
|
+
- fix: preserve virtual target tooltips ([PR #36794](https://github.com/microsoft/fluentui/pull/36794) by paulmardling@microsoft.com)
|
|
31
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
32
|
+
- Bump @fluentui/react-portal to v9.8.17 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
33
|
+
- Bump @fluentui/react-positioning to v9.23.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
34
|
+
- Bump @fluentui/react-tabster to v9.26.19 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
35
|
+
- Bump @fluentui/react-utilities to v9.27.0 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
|
|
23
36
|
|
|
24
37
|
## [9.10.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.10.7)
|
|
25
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["'use client';\n\nimport type * 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":["useTooltip_unstable","renderTooltip_unstable","useCustomStyleHook_unstable","useTooltipStyles_unstable","Tooltip","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA;AAGA,SAASA,mBAAmB,QAAQ,kBAAe;AACnD,SAASC,sBAAsB,QAAQ,qBAAkB;AACzD,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,yBAAyB,QAAQ,+BAA4B;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"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.content {
|
|
3
|
+
display: none;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
max-width: calc(var(--spacingHorizontalXXXL) * 7 + var(--spacingHorizontalL));
|
|
6
|
+
cursor: default;
|
|
7
|
+
font-family: var(--fontFamilyBase);
|
|
8
|
+
font-size: var(--fontSizeBase200);
|
|
9
|
+
line-height: var(--lineHeightBase200);
|
|
10
|
+
overflow-wrap: break-word;
|
|
11
|
+
border-radius: var(--borderRadiusMedium);
|
|
12
|
+
border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
|
|
13
|
+
padding: var(--spacingHorizontalXS) calc(var(--spacingHorizontalM) - var(--strokeWidthThin))
|
|
14
|
+
var(--spacingHorizontalSNudge) calc(var(--spacingHorizontalM) - var(--strokeWidthThin));
|
|
15
|
+
background-color: var(--colorNeutralBackground1);
|
|
16
|
+
color: var(--colorNeutralForeground1);
|
|
17
|
+
filter: drop-shadow(0 0 var(--spacingHorizontalXXS) var(--colorNeutralShadowAmbient))
|
|
18
|
+
drop-shadow(0 var(--spacingHorizontalXS) var(--spacingHorizontalS) var(--colorNeutralShadowKey));
|
|
19
|
+
}
|
|
20
|
+
.visible {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
.hidden {
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
.inverted {
|
|
28
|
+
background-color: var(--colorNeutralBackgroundStatic);
|
|
29
|
+
color: var(--colorNeutralForegroundStaticInverted);
|
|
30
|
+
}
|
|
31
|
+
.arrow {
|
|
32
|
+
--fui-positioning-arrow-height: calc(var(--spacingVerticalSNudge) * 1.414);
|
|
33
|
+
--fui-positioning-arrow-offset: calc(var(--spacingVerticalSNudge) * -0.707);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/Tooltip.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState, JSXElement, Slot, TriggerProps } from '@fluentui/react-utilities';\nimport type { PortalProps } from '@fluentui/react-portal';\n\n/**\n * Slot properties for Tooltip\n */\nexport type TooltipSlots = {\n /**\n * The text or JSX content of the tooltip.\n */\n content: NonNullable<Slot<'div'>>;\n};\n\n/**\n * The properties that are added to the child of the Tooltip\n */\nexport type TooltipChildProps = {\n ref?: React.Ref<unknown>;\n} & Pick<\n React.HTMLAttributes<HTMLElement>,\n | 'aria-describedby'\n | 'aria-label'\n | 'aria-labelledby'\n | 'onBlur'\n | 'onFocus'\n | 'onPointerEnter'\n | 'onPointerLeave'\n | 'aria-haspopup'\n | 'aria-expanded'\n>;\n\n/**\n * Data for the Tooltip's onVisibleChange event.\n */\nexport type OnVisibleChangeData = {\n visible: boolean;\n\n /**\n * The event object, if this visibility change was triggered by a keyboard event on the document element\n * (such as Escape to hide the visible tooltip). Otherwise undefined.\n */\n documentKeyboardEvent?: KeyboardEvent;\n};\n\n/**\n * Properties for Tooltip\n */\nexport type TooltipProps = ComponentProps<TooltipSlots> &\n TriggerProps<TooltipChildProps> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * The tooltip's visual appearance.\n * * `normal` - Uses the theme's background and text colors.\n * * `inverted` - Higher contrast variant that uses the theme's inverted colors.\n *\n * @default normal\n */\n appearance?: 'normal' | 'inverted';\n /**\n * Delay before the tooltip is hidden, in milliseconds.\n *\n * @default 250\n */\n hideDelay?: number;\n\n /**\n * Notification when the visibility of the tooltip is changing.\n *\n * **Note**: for backwards compatibility, `event` will be undefined if this was triggered by a keyboard event on\n * the document element. Use `data.documentKeyboardEvent` if the keyboard event object is needed.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onVisibleChange?: (\n event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined,\n data: OnVisibleChangeData,\n ) => void;\n\n /**\n * Configure the positioning of the tooltip\n *\n * @default above\n */\n positioning?: PositioningShorthand;\n\n /**\n * (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.\n *\n * * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons\n * displaying only an icon, for example.\n * * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.\n * * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to\n * screen readers, and should only be used if the tooltip's text is available by some other means.\n */\n relationship: 'label' | 'description' | 'inaccessible';\n\n /**\n * Delay before the tooltip is shown, in milliseconds.\n *\n * @default 250\n */\n showDelay?: number;\n\n /**\n * Control the tooltip's visibility programatically.\n *\n * This can be used in conjunction with onVisibleChange to modify the tooltip's show and hide behavior.\n *\n * If not provided, the visibility will be controlled by the tooltip itself, based on hover and focus events on the\n * trigger (child) element.\n *\n * @default false\n */\n visible?: boolean;\n\n /**\n * Render an arrow pointing to the target element\n *\n * @default false\n */\n withArrow?: boolean;\n };\n\nexport type TooltipBaseProps = Omit<TooltipProps, 'appearance'>;\n\n/**\n * State used in rendering Tooltip\n */\nexport type TooltipState = ComponentState<TooltipSlots> &\n Pick<TooltipProps, 'mountNode' | 'relationship'> &\n Required<Pick<TooltipProps, 'appearance' | 'hideDelay' | 'positioning' | 'showDelay' | 'visible' | 'withArrow'>> & {\n children?: JSXElement | null;\n\n /**\n * Whether positioning has determined that the tooltip or its target is outside its clipping boundary.\n */\n hidden?: boolean;\n\n /**\n * Whether the tooltip should be rendered to the DOM.\n */\n shouldRenderTooltip?: boolean;\n\n /**\n * Ref to the arrow element\n */\n arrowRef?: React.Ref<HTMLDivElement>;\n\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n\nexport type TooltipBaseState = Omit<TooltipState, 'appearance'>;\n"],"names":[],"mappings":"AA2JA,WAAgE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/index.ts"],"sourcesContent":["export { Tooltip } from './Tooltip';\nexport type {\n OnVisibleChangeData,\n TooltipChildProps,\n TooltipBaseProps,\n TooltipProps,\n TooltipSlots,\n TooltipBaseState,\n TooltipState,\n} from './Tooltip.types';\nexport { renderTooltip_unstable } from './renderTooltip';\nexport { useTooltip_unstable } from './useTooltip';\nexport { useTooltipBase_unstable } from './useTooltipBase';\nexport { tooltipClassNames, useTooltipStyles_unstable } from './useTooltipStyles.styles';\n"],"names":["Tooltip","renderTooltip_unstable","useTooltip_unstable","useTooltipBase_unstable","tooltipClassNames","useTooltipStyles_unstable"],"mappings":"AAAA,SAASA,OAAO,QAAQ,eAAY;AAUpC,SAASC,sBAAsB,QAAQ,qBAAkB;AACzD,SAASC,mBAAmB,QAAQ,kBAAe;AACnD,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,iBAAiB,EAAEC,yBAAyB,QAAQ,+BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Tooltip/private/constants.ts"],"sourcesContent":["/**\n * The height of the tooltip's arrow in pixels.\n */\nexport const arrowHeight = 6;\n\n/**\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const tooltipBorderRadius = 4;\n"],"names":["arrowHeight","tooltipBorderRadius"],"mappings":"AAAA;;CAEC,GACD,OAAO,MAAMA,cAAc,EAAE;AAE7B;;;;;;CAMC,GACD,OAAO,MAAMC,sBAAsB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Tooltip/private/useTooltipTimeout.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst setTimeoutNoop = (_callback: Function) => -1;\nconst clearTimeoutNoop = (_handle: number) => undefined;\n\ntype BrowserTimerSetter =\n | ((fn: () => void, duration?: number, ...args: Record<string, unknown>[]) => number)\n | ((fn: () => void) => number);\n\n/**\n * @internal\n * @param triggerElementRef - Reference to the trigger element\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTooltipTimeout(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n triggerElementRef: React.MutableRefObject<HTMLElement>,\n): readonly [(fn: () => void, delay?: number) => number, () => void] {\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n const setTimerFn: BrowserTimerSetter = win ? win.setTimeout : setTimeoutNoop;\n const clearTimerFn: (id: number) => void = win ? win.clearTimeout : clearTimeoutNoop;\n\n const id = React.useRef<number | undefined>(undefined);\n\n const set = React.useCallback(\n (fn: () => void, delay?: number) => {\n if (id.current !== undefined) {\n clearTimerFn(id.current);\n }\n\n id.current = setTimerFn(fn, delay ?? 0);\n return id.current;\n },\n [clearTimerFn, setTimerFn],\n );\n\n const cancel = React.useCallback(() => {\n if (id.current !== undefined) {\n clearTimerFn(id.current);\n id.current = undefined;\n }\n }, [clearTimerFn]);\n\n // StrictMode-aware cleanup: only clear timeout if element has no parent (real unmount)\n React.useEffect(() => {\n const el = triggerElementRef.current;\n return () => {\n const isRealUnmount = !el || !el.isConnected;\n\n if (isRealUnmount) {\n cancel();\n }\n };\n }, [cancel, triggerElementRef]);\n\n return [set, cancel];\n}\n"],"names":["React","useFluent_unstable","useFluent","setTimeoutNoop","_callback","clearTimeoutNoop","_handle","undefined","useTooltipTimeout","triggerElementRef","targetDocument","win","defaultView","setTimerFn","setTimeout","clearTimerFn","clearTimeout","id","useRef","set","useCallback","fn","delay","current","cancel","useEffect","el","isRealUnmount","isConnected"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAElF,MAAMC,iBAAiB,CAACC,YAAwB,CAAC;AACjD,MAAMC,mBAAmB,CAACC,UAAoBC;AAM9C;;;;CAIC,GACD,OAAO,SAASC,kBACd,4DAA4D;AAC5DC,iBAAsD;IAEtD,MAAM,EAAEC,cAAc,EAAE,GAAGR;IAC3B,MAAMS,MAAMD,2BAAAA,qCAAAA,eAAgBE,WAAW;IAEvC,MAAMC,aAAiCF,MAAMA,IAAIG,UAAU,GAAGX;IAC9D,MAAMY,eAAqCJ,MAAMA,IAAIK,YAAY,GAAGX;IAEpE,MAAMY,KAAKjB,MAAMkB,MAAM,CAAqBX;IAE5C,MAAMY,MAAMnB,MAAMoB,WAAW,CAC3B,CAACC,IAAgBC;QACf,IAAIL,GAAGM,OAAO,KAAKhB,WAAW;YAC5BQ,aAAaE,GAAGM,OAAO;QACzB;QAEAN,GAAGM,OAAO,GAAGV,WAAWQ,IAAIC,kBAAAA,mBAAAA,QAAS;QACrC,OAAOL,GAAGM,OAAO;IACnB,GACA;QAACR;QAAcF;KAAW;IAG5B,MAAMW,SAASxB,MAAMoB,WAAW,CAAC;QAC/B,IAAIH,GAAGM,OAAO,KAAKhB,WAAW;YAC5BQ,aAAaE,GAAGM,OAAO;YACvBN,GAAGM,OAAO,GAAGhB;QACf;IACF,GAAG;QAACQ;KAAa;IAEjB,uFAAuF;IACvFf,MAAMyB,SAAS,CAAC;QACd,MAAMC,KAAKjB,kBAAkBc,OAAO;QACpC,OAAO;YACL,MAAMI,gBAAgB,CAACD,MAAM,CAACA,GAAGE,WAAW;YAE5C,IAAID,eAAe;gBACjBH;YACF;QACF;IACF,GAAG;QAACA;QAAQf;KAAkB;IAE9B,OAAO;QAACU;QAAKK;KAAO;AACtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { Portal } from "@fluentui/react-portal";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { Portal } from "@fluentui/react-portal";
|
|
3
3
|
import { assertSlots } from "@fluentui/react-utilities";
|
|
4
4
|
/**
|
|
5
5
|
* Render the final JSX of Tooltip
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/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 { JSXElement } from '@fluentui/react-utilities';\nimport type { TooltipBaseState, TooltipSlots } from './Tooltip.types';\n\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = (state: TooltipBaseState): JSXElement => {\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,GAEjD,SAASA,MAAM,QAAQ,yBAAyB;AAChD,SAASC,WAAW,QAAQ,4BAA4B;AAIxD;;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"sourcesContent":["'use client';\n\nimport type { TooltipProps, TooltipState } from './Tooltip.types';\nimport { useTooltipBase_unstable } from './useTooltipBase';\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 'use no memo'; // justified: compiler would optimize useTooltip_unstable — manual opt-out to preserve runtime behavior\n\n const { appearance = 'normal', ...baseProps } = props;\n\n const state = useTooltipBase_unstable(baseProps);\n\n return {\n appearance,\n ...state,\n };\n};\n"],"names":["useTooltipBase_unstable","useTooltip_unstable","props","appearance","baseProps","state"],"mappings":"AAAA;AAGA,SAASA,uBAAuB,QAAQ,sBAAmB;AAE3D;;;;;;;CAOC,GACD,OAAO,MAAMC,sBAAsB,CAACC;IAClC,eAAe,uGAAuG;IAEtH,MAAM,EAAEC,aAAa,QAAQ,EAAE,GAAGC,WAAW,GAAGF;IAEhD,MAAMG,QAAQL,wBAAwBI;IAEtC,OAAO;QACLD;QACA,GAAGE,KAAK;IACV;AACF,EAAE"}
|
|
@@ -1 +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 type { PositioningProps } 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 isHTMLElement,\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\ntype OnPositioningEndEvent = Parameters<Exclude<PositioningProps['onPositioningEnd'], undefined>>[0];\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 const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const [hidden, setHidden] = React.useState(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 hidden,\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 resolvedPositioning = resolvePositioningShorthand(state.positioning);\n const isVirtualTarget = resolvedPositioning.target !== undefined && !isHTMLElement(resolvedPositioning.target);\n const onPositioningEnd = useEventCallback((event: OnPositioningEndEvent) => {\n // Portaled tooltips can escape the trigger's clipping ancestors while the trigger is still visible.\n // Virtual targets can be reported as hidden based on synthetic geometry.\n setHidden(!isVirtualTarget && event.detail.referenceHidden);\n resolvedPositioning.onPositioningEnd?.(event);\n });\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 ...resolvedPositioning,\n onPositioningEnd,\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 // eslint-disable-next-line react-hooks/immutability\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 // Dismiss the tooltip when the document becomes hidden (e.g. tab backgrounded,\n // app switched on mobile). The original trigger (hover/tap/focus) is no longer\n // active in this case, so persisting the tooltip is a stale UI state.\n const onDocumentVisibilityChange = () => {\n if (targetDocument?.visibilityState === 'hidden') {\n thisTooltip.hide();\n }\n };\n\n targetDocument?.addEventListener('visibilitychange', onDocumentVisibilityChange);\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n targetDocument?.removeEventListener('visibilitychange', onDocumentVisibilityChange);\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/immutability\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n // eslint-disable-next-line react-hooks/immutability\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/refs\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\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","isHTMLElement","arrowHeight","tooltipBorderRadius","useTooltipTimeout","Escape","useTooltipBase_unstable","props","child","context","isServerSideRender","targetDocument","visible","setVisibleInternal","state","initialState","hidden","setHidden","useState","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","resolvedPositioning","isVirtualTarget","target","undefined","onPositioningEnd","event","detail","referenceHidden","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","setDelayTimeout","clearDelayTimeout","setVisible","useCallback","ev","data","oldVisible","ref","thisTooltip","hide","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","defaultPrevented","preventDefault","addEventListener","capture","onDocumentVisibilityChange","visibilityState","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","isNavigatingWithKeyboard","keyborgListenerCallbackRef","onKeyborgFocusIn","isFocusedProgrammatically","element","onLeaveTrigger","activeElement","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","isPopupExpanded"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,2BAA2B,EAAEC,cAAc,QAAQ,8BAA8B;AAE5G,SACEC,iCAAiCC,oBAAoB,EACrDC,sBAAsBC,SAAS,QAC1B,kCAAkC;AAEzC,SAASC,eAAe,EAAEC,2BAA2B,QAAQ,0BAA0B;AACvF,SACEC,2BAA2B,EAC3BC,oBAAoB,EACpBC,KAAK,EACLC,yBAAyB,EACzBC,QAAQ,EACRC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,IAAI,EACJC,kBAAkB,EAClBC,aAAa,QACR,4BAA4B;AAEnC,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,yBAAsB;AACvE,SAASC,iBAAiB,QAAQ,iCAA8B;AAChE,SAASC,MAAM,QAAQ,0BAA0B;AAIjD;;;;;;;CAOC,GACD,OAAO,MAAMC,0BAA0B,CAACC;QAgPpCC,cACCA,eAA4CA,eAsCGA,eAEAA,eAEPA,eAEDA;IA5R1C,MAAMC,UAAUxB;IAChB,MAAMyB,qBAAqBhB;IAC3B,MAAM,EAAEiB,cAAc,EAAE,GAAGxB;IAE3B,MAAM,CAACyB,SAASC,mBAAmB,GAAGtB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D,KAAK,cAAZC,oCAAAA,cAAc+E,cAAc,EAAEZ;QAC9E,4CAA4C;QAC5Ca,gBAAgB1F,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAcgF,cAAc,EAAEH;QAC9E,4CAA4C;QAC5CI,SAAS3F,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAciF,OAAO,EAAEd;QAChE,4CAA4C;QAC5Ce,QAAQ5F,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAckF,MAAM,EAAEL;IAChE;IAEA,OAAOvE;AACT,EAAE"}
|
|
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 type { PositioningProps } 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 isHTMLElement,\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\ntype OnPositioningEndEvent = Parameters<Exclude<PositioningProps['onPositioningEnd'], undefined>>[0];\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 const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const [hidden, setHidden] = React.useState(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 hidden,\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 resolvedPositioning = resolvePositioningShorthand(state.positioning);\n const isVirtualTarget = resolvedPositioning.target !== undefined && !isHTMLElement(resolvedPositioning.target);\n const onPositioningEnd = useEventCallback((event: OnPositioningEndEvent) => {\n // Portaled tooltips can escape the trigger's clipping ancestors while the trigger is still visible.\n // Virtual targets can be reported as hidden based on synthetic geometry.\n setHidden(!isVirtualTarget && event.detail.referenceHidden);\n resolvedPositioning.onPositioningEnd?.(event);\n });\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 ...resolvedPositioning,\n onPositioningEnd,\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 // eslint-disable-next-line react-hooks/immutability\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 // Dismiss the tooltip when the document becomes hidden (e.g. tab backgrounded,\n // app switched on mobile). The original trigger (hover/tap/focus) is no longer\n // active in this case, so persisting the tooltip is a stale UI state.\n const onDocumentVisibilityChange = () => {\n if (targetDocument?.visibilityState === 'hidden') {\n thisTooltip.hide();\n }\n };\n\n targetDocument?.addEventListener('visibilitychange', onDocumentVisibilityChange);\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n targetDocument?.removeEventListener('visibilitychange', onDocumentVisibilityChange);\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/immutability\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n // eslint-disable-next-line react-hooks/immutability\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/refs\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\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","isHTMLElement","arrowHeight","tooltipBorderRadius","useTooltipTimeout","Escape","useTooltipBase_unstable","props","child","context","isServerSideRender","targetDocument","visible","setVisibleInternal","state","initialState","hidden","setHidden","useState","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","resolvedPositioning","isVirtualTarget","target","undefined","onPositioningEnd","event","detail","referenceHidden","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","setDelayTimeout","clearDelayTimeout","setVisible","useCallback","ev","data","oldVisible","ref","thisTooltip","hide","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","defaultPrevented","preventDefault","addEventListener","capture","onDocumentVisibilityChange","visibilityState","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","isNavigatingWithKeyboard","keyborgListenerCallbackRef","onKeyborgFocusIn","isFocusedProgrammatically","element","onLeaveTrigger","activeElement","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","isPopupExpanded"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,gBAAgB,EAAEC,2BAA2B,EAAEC,cAAc,QAAQ,8BAA8B;AAE5G,SACEC,iCAAiCC,oBAAoB,EACrDC,sBAAsBC,SAAS,QAC1B,kCAAkC;AAEzC,SAASC,eAAe,EAAEC,2BAA2B,QAAQ,0BAA0B;AACvF,SACEC,2BAA2B,EAC3BC,oBAAoB,EACpBC,KAAK,EACLC,yBAAyB,EACzBC,QAAQ,EACRC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,gBAAgB,EAChBC,IAAI,EACJC,kBAAkB,EAClBC,aAAa,QACR,4BAA4B;AAEnC,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,yBAAsB;AACvE,SAASC,iBAAiB,QAAQ,iCAA8B;AAChE,SAASC,MAAM,QAAQ,0BAA0B;AAIjD;;;;;;;CAOC,GACD,OAAO,MAAMC,0BAA0B,CAACC;QAgPpCC,cACCA,e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hE,cACHK,mBAAsCQ,QACtCyE,4BACA,yFAAyF;QACzFtC,mBAAmBN,MAAM,KAAKC,YAAYW,YAAYX;QAExD,4CAA4C;QAC5CiD,gBAAgBzF,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAc+E,cAAc,EAAEZ;QAC9E,4CAA4C;QAC5Ca,gBAAgB1F,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAcgF,cAAc,EAAEH;QAC9E,4CAA4C;QAC5CI,SAAS3F,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAciF,OAAO,EAAEd;QAChE,4CAA4C;QAC5Ce,QAAQ5F,iBAAiBD,eAAeW,kBAAAA,6BAAAA,gBAAAA,MAAOD,KAAK,cAAZC,oCAAAA,cAAckF,MAAM,EAAEL;IAChE;IAEA,OAAOvE;AACT,EAAE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import arrowStyles from "@fluentui/react-positioning/arrow.module.css";
|
|
3
|
+
import styles from "./Tooltip.module.css";
|
|
4
|
+
export const tooltipClassNames = {
|
|
5
|
+
content: 'fui-Tooltip__content'
|
|
6
|
+
};
|
|
7
|
+
export const useTooltipStyles_unstable = (state)=>{
|
|
8
|
+
state.content.className = clsx(tooltipClassNames.content, styles.content, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.hidden && styles.hidden, state.content.className);
|
|
9
|
+
state.arrowClassName = clsx(arrowStyles.arrow, styles.arrow);
|
|
10
|
+
return state;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport arrowStyles from '@fluentui/react-positioning/arrow.module.css';\nimport styles from './Tooltip.module.css';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n state.content.className = clsx(\n tooltipClassNames.content,\n styles.content,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.hidden && styles.hidden,\n state.content.className,\n );\n state.arrowClassName = clsx(arrowStyles.arrow, styles.arrow);\n return state;\n};\n"],"names":["clsx","arrowStyles","styles","tooltipClassNames","content","useTooltipStyles_unstable","state","className","appearance","inverted","visible","hidden","arrowClassName","arrow"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,iBAAiB,+CAA+C;AACvE,OAAOC,YAAY,uBAAuB;AAE1C,OAAO,MAAMC,oBAAkD;IAC7DC,SAAS;AACX,EAAE;AAEF,OAAO,MAAMC,4BAA4B,CAACC;IACxCA,MAAMF,OAAO,CAACG,SAAS,GAAGP,KACxBG,kBAAkBC,OAAO,EACzBF,OAAOE,OAAO,EACdE,MAAME,UAAU,KAAK,cAAcN,OAAOO,QAAQ,EAClDH,MAAMI,OAAO,IAAIR,OAAOQ,OAAO,EAC/BJ,MAAMK,MAAM,IAAIT,OAAOS,MAAM,EAC7BL,MAAMF,OAAO,CAACG,SAAS;IAEzBD,MAAMM,cAAc,GAAGZ,KAAKC,YAAYY,KAAK,EAAEX,OAAOW,KAAK;IAC3D,OAAOP;AACT,EAAE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import arrowStyles from "@fluentui/react-positioning/arrow.module.css";
|
|
3
|
+
import styles from "./Tooltip.module.css";
|
|
4
|
+
export const tooltipClassNames = {
|
|
5
|
+
content: 'fui-Tooltip__content'
|
|
6
|
+
};
|
|
7
|
+
export const useTooltipStyles_unstable = (state)=>{
|
|
8
|
+
state.content.className = clsx(tooltipClassNames.content, styles.content, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.hidden && styles.hidden, state.content.className);
|
|
9
|
+
state.arrowClassName = clsx(arrowStyles.arrow, styles.arrow);
|
|
10
|
+
return state;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport arrowStyles from '@fluentui/react-positioning/arrow.module.css';\nimport styles from './Tooltip.module.css';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n state.content.className = clsx(\n tooltipClassNames.content,\n styles.content,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.hidden && styles.hidden,\n state.content.className,\n );\n state.arrowClassName = clsx(arrowStyles.arrow, styles.arrow);\n return state;\n};\n"],"names":["clsx","arrowStyles","styles","tooltipClassNames","content","useTooltipStyles_unstable","state","className","appearance","inverted","visible","hidden","arrowClassName","arrow"],"mappings":"AAAA,SAASA,IAAI,QAAQ,OAAO;AAG5B,OAAOC,iBAAiB,+CAA+C;AACvE,OAAOC,YAAY,uBAAuB;AAE1C,OAAO,MAAMC,oBAAkD;IAC7DC,SAAS;AACX,EAAE;AAEF,OAAO,MAAMC,4BAA4B,CAACC;IACxCA,MAAMF,OAAO,CAACG,SAAS,GAAGP,KACxBG,kBAAkBC,OAAO,EACzBF,OAAOE,OAAO,EACdE,MAAME,UAAU,KAAK,cAAcN,OAAOO,QAAQ,EAClDH,MAAMI,OAAO,IAAIR,OAAOQ,OAAO,EAC/BJ,MAAMK,MAAM,IAAIT,OAAOS,MAAM,EAC7BL,MAAMF,OAAO,CAACG,SAAS;IAEzBD,MAAMM,cAAc,GAAGZ,KAAKC,YAAYY,KAAK,EAAEX,OAAOW,KAAK;IAC3D,OAAOP;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { arrowHeight } from './private/constants';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\n/**\n * Styles for the tooltip\n */\nconst useStyles = makeStyles({\n root: {\n display: 'none',\n boxSizing: 'border-box',\n maxWidth: '240px',\n cursor: 'default',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n overflowWrap: 'break-word',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n padding: '4px 11px 6px 11px', // '5px 12px 7px 12px' minus the border width '1px'\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n\n // TODO need to add versions of tokens.alias.shadow.shadow8, etc. that work with filter\n filter:\n `drop-shadow(0 0 2px ${tokens.colorNeutralShadowAmbient}) ` +\n `drop-shadow(0 4px 8px ${tokens.colorNeutralShadowKey})`,\n },\n\n visible: {\n display: 'block',\n },\n\n hidden: {\n visibility: 'hidden',\n pointerEvents: 'none',\n },\n\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundStatic,\n color: tokens.colorNeutralForegroundStaticInverted,\n },\n\n arrow: createArrowStyles({ arrowHeight }),\n});\n\n/**\n * Apply styling to the Tooltip slots based on the state\n */\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n const styles = useStyles();\n\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(\n tooltipClassNames.content,\n styles.root,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.hidden && styles.hidden,\n state.content.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.arrowClassName = styles.arrow;\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","createArrowStyles","tokens","arrowHeight","tooltipClassNames","content","useStyles","root","display","boxSizing","maxWidth","cursor","fontFamily","fontFamilyBase","fontSize","fontSizeBase200","lineHeight","lineHeightBase200","overflowWrap","borderRadius","borderRadiusMedium","border","colorTransparentStroke","padding","backgroundColor","colorNeutralBackground1","color","colorNeutralForeground1","filter","colorNeutralShadowAmbient","colorNeutralShadowKey","visible","hidden","visibility","pointerEvents","inverted","colorNeutralBackgroundStatic","colorNeutralForegroundStaticInverted","arrow","useTooltipStyles_unstable","state","styles","className","appearance","arrowClassName"],"mappings":"AAAA;AAEA,SAASA,UAAU,EAAEC,YAAY,QAAQ,iBAAiB;AAC1D,SAASC,iBAAiB,QAAQ,8BAA8B;AAChE,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,WAAW,QAAQ,yBAAsB;AAIlD,OAAO,MAAMC,oBAAkD;IAC7DC,SAAS;AACX,EAAE;AAEF;;CAEC,GACD,MAAMC,YAAYP,WAAW;IAC3BQ,MAAM;QACJC,SAAS;QACTC,WAAW;QACXC,UAAU;QACVC,QAAQ;QACRC,YAAYV,OAAOW,cAAc;QACjCC,UAAUZ,OAAOa,eAAe;QAChCC,YAAYd,OAAOe,iBAAiB;QACpCC,cAAc;QACdC,cAAcjB,OAAOkB,kBAAkB;QACvCC,QAAQ,CAAC,UAAU,EAAEnB,OAAOoB,sBAAsB,EAAE;QACpDC,SAAS;QACTC,iBAAiBtB,OAAOuB,uBAAuB;QAC/CC,OAAOxB,OAAOyB,uBAAuB;QAErC,uFAAuF;QACvFC,QACE,CAAC,oBAAoB,EAAE1B,OAAO2B,yBAAyB,CAAC,EAAE,CAAC,GAC3D,CAAC,sBAAsB,EAAE3B,OAAO4B,qBAAqB,CAAC,CAAC,CAAC;IAC5D;IAEAC,SAAS;QACPvB,SAAS;IACX;IAEAwB,QAAQ;QACNC,YAAY;QACZC,eAAe;IACjB;IAEAC,UAAU;QACRX,iBAAiBtB,OAAOkC,4BAA4B;QACpDV,OAAOxB,OAAOmC,oCAAoC;IACpD;IAEAC,OAAOrC,kBAAkB;QAAEE;IAAY;AACzC;AAEA;;CAEC,GACD,OAAO,MAAMoC,4BAA4B,CAACC;IACxC,MAAMC,SAASnC;IAEf,oDAAoD;IACpDkC,MAAMnC,OAAO,CAACqC,SAAS,GAAG1C,aACxBI,kBAAkBC,OAAO,EACzBoC,OAAOlC,IAAI,EACXiC,MAAMG,UAAU,KAAK,cAAcF,OAAON,QAAQ,EAClDK,MAAMT,OAAO,IAAIU,OAAOV,OAAO,EAC/BS,MAAMR,MAAM,IAAIS,OAAOT,MAAM,EAC7BQ,MAAMnC,OAAO,CAACqC,SAAS;IAGzB,oDAAoD;IACpDF,MAAMI,cAAc,GAAGH,OAAOH,KAAK;IAEnC,OAAOE;AACT,EAAE"}
|
package/lib-commonjs/Tooltip.cjs
CHANGED
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
Tooltip
|
|
12
|
+
get Tooltip () {
|
|
13
13
|
return _index.Tooltip;
|
|
14
14
|
},
|
|
15
|
-
renderTooltip_unstable
|
|
15
|
+
get renderTooltip_unstable () {
|
|
16
16
|
return _index.renderTooltip_unstable;
|
|
17
17
|
},
|
|
18
|
-
tooltipClassNames
|
|
18
|
+
get tooltipClassNames () {
|
|
19
19
|
return _index.tooltipClassNames;
|
|
20
20
|
},
|
|
21
|
-
useTooltipBase_unstable
|
|
21
|
+
get useTooltipBase_unstable () {
|
|
22
22
|
return _index.useTooltipBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useTooltipStyles_unstable
|
|
24
|
+
get useTooltipStyles_unstable () {
|
|
25
25
|
return _index.useTooltipStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useTooltip_unstable
|
|
27
|
+
get useTooltip_unstable () {
|
|
28
28
|
return _index.useTooltip_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["'use client';\n\nimport type * 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":["useTooltip_unstable","renderTooltip_unstable","useCustomStyleHook_unstable","useTooltipStyles_unstable","Tooltip","props","state","displayName","isFluentTriggerComponent"],"mappings":"AAAA;;;;;;;;;;;4BAGoC,kBAAe;+BACZ,qBAAkB;qCACb,kCAAkC;wCACpC,+BAA4B;AAO/D,MAAMI,UAAkCC,CAAAA;IAC7C,MAAMC,YAAQN,+BAAAA,EAAoBK;QAElCF,iDAAAA,EAA0BG;QAE1BJ,gDAAAA,EAA4B,6BAA6BI;IAEzD,WAAOL,qCAAAA,EAAuBK;AAChC,EAAE;AAEFF,QAAQG,WAAW,GAAG;AACtB,6FAA6F;AAC5FH,QAAmCI,wBAAwB,GAAG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
@layer fluentui {
|
|
2
|
+
.content {
|
|
3
|
+
display: none;
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
max-width: calc(var(--spacingHorizontalXXXL) * 7 + var(--spacingHorizontalL));
|
|
6
|
+
cursor: default;
|
|
7
|
+
font-family: var(--fontFamilyBase);
|
|
8
|
+
font-size: var(--fontSizeBase200);
|
|
9
|
+
line-height: var(--lineHeightBase200);
|
|
10
|
+
overflow-wrap: break-word;
|
|
11
|
+
border-radius: var(--borderRadiusMedium);
|
|
12
|
+
border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
|
|
13
|
+
padding: var(--spacingHorizontalXS) calc(var(--spacingHorizontalM) - var(--strokeWidthThin))
|
|
14
|
+
var(--spacingHorizontalSNudge) calc(var(--spacingHorizontalM) - var(--strokeWidthThin));
|
|
15
|
+
background-color: var(--colorNeutralBackground1);
|
|
16
|
+
color: var(--colorNeutralForeground1);
|
|
17
|
+
filter: drop-shadow(0 0 var(--spacingHorizontalXXS) var(--colorNeutralShadowAmbient))
|
|
18
|
+
drop-shadow(0 var(--spacingHorizontalXS) var(--spacingHorizontalS) var(--colorNeutralShadowKey));
|
|
19
|
+
}
|
|
20
|
+
.visible {
|
|
21
|
+
display: block;
|
|
22
|
+
}
|
|
23
|
+
.hidden {
|
|
24
|
+
visibility: hidden;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
.inverted {
|
|
28
|
+
background-color: var(--colorNeutralBackgroundStatic);
|
|
29
|
+
color: var(--colorNeutralForegroundStaticInverted);
|
|
30
|
+
}
|
|
31
|
+
.arrow {
|
|
32
|
+
--fui-positioning-arrow-height: calc(var(--spacingVerticalSNudge) * 1.414);
|
|
33
|
+
--fui-positioning-arrow-offset: calc(var(--spacingVerticalSNudge) * -0.707);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/Tooltip.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState, JSXElement, Slot, TriggerProps } from '@fluentui/react-utilities';\nimport type { PortalProps } from '@fluentui/react-portal';\n\n/**\n * Slot properties for Tooltip\n */\nexport type TooltipSlots = {\n /**\n * The text or JSX content of the tooltip.\n */\n content: NonNullable<Slot<'div'>>;\n};\n\n/**\n * The properties that are added to the child of the Tooltip\n */\nexport type TooltipChildProps = {\n ref?: React.Ref<unknown>;\n} & Pick<\n React.HTMLAttributes<HTMLElement>,\n | 'aria-describedby'\n | 'aria-label'\n | 'aria-labelledby'\n | 'onBlur'\n | 'onFocus'\n | 'onPointerEnter'\n | 'onPointerLeave'\n | 'aria-haspopup'\n | 'aria-expanded'\n>;\n\n/**\n * Data for the Tooltip's onVisibleChange event.\n */\nexport type OnVisibleChangeData = {\n visible: boolean;\n\n /**\n * The event object, if this visibility change was triggered by a keyboard event on the document element\n * (such as Escape to hide the visible tooltip). Otherwise undefined.\n */\n documentKeyboardEvent?: KeyboardEvent;\n};\n\n/**\n * Properties for Tooltip\n */\nexport type TooltipProps = ComponentProps<TooltipSlots> &\n TriggerProps<TooltipChildProps> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * The tooltip's visual appearance.\n * * `normal` - Uses the theme's background and text colors.\n * * `inverted` - Higher contrast variant that uses the theme's inverted colors.\n *\n * @default normal\n */\n appearance?: 'normal' | 'inverted';\n /**\n * Delay before the tooltip is hidden, in milliseconds.\n *\n * @default 250\n */\n hideDelay?: number;\n\n /**\n * Notification when the visibility of the tooltip is changing.\n *\n * **Note**: for backwards compatibility, `event` will be undefined if this was triggered by a keyboard event on\n * the document element. Use `data.documentKeyboardEvent` if the keyboard event object is needed.\n */\n // eslint-disable-next-line @nx/workspace-consistent-callback-type -- can't change type of existing callback\n onVisibleChange?: (\n event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined,\n data: OnVisibleChangeData,\n ) => void;\n\n /**\n * Configure the positioning of the tooltip\n *\n * @default above\n */\n positioning?: PositioningShorthand;\n\n /**\n * (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.\n *\n * * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons\n * displaying only an icon, for example.\n * * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.\n * * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to\n * screen readers, and should only be used if the tooltip's text is available by some other means.\n */\n relationship: 'label' | 'description' | 'inaccessible';\n\n /**\n * Delay before the tooltip is shown, in milliseconds.\n *\n * @default 250\n */\n showDelay?: number;\n\n /**\n * Control the tooltip's visibility programatically.\n *\n * This can be used in conjunction with onVisibleChange to modify the tooltip's show and hide behavior.\n *\n * If not provided, the visibility will be controlled by the tooltip itself, based on hover and focus events on the\n * trigger (child) element.\n *\n * @default false\n */\n visible?: boolean;\n\n /**\n * Render an arrow pointing to the target element\n *\n * @default false\n */\n withArrow?: boolean;\n };\n\nexport type TooltipBaseProps = Omit<TooltipProps, 'appearance'>;\n\n/**\n * State used in rendering Tooltip\n */\nexport type TooltipState = ComponentState<TooltipSlots> &\n Pick<TooltipProps, 'mountNode' | 'relationship'> &\n Required<Pick<TooltipProps, 'appearance' | 'hideDelay' | 'positioning' | 'showDelay' | 'visible' | 'withArrow'>> & {\n children?: JSXElement | null;\n\n /**\n * Whether positioning has determined that the tooltip or its target is outside its clipping boundary.\n */\n hidden?: boolean;\n\n /**\n * Whether the tooltip should be rendered to the DOM.\n */\n shouldRenderTooltip?: boolean;\n\n /**\n * Ref to the arrow element\n */\n arrowRef?: React.Ref<HTMLDivElement>;\n\n /**\n * CSS class for the arrow element\n */\n arrowClassName?: string;\n };\n\nexport type TooltipBaseState = Omit<TooltipState, 'appearance'>;\n"],"names":[],"mappings":""}
|
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
Tooltip
|
|
12
|
+
get Tooltip () {
|
|
13
13
|
return _Tooltip.Tooltip;
|
|
14
14
|
},
|
|
15
|
-
renderTooltip_unstable
|
|
15
|
+
get renderTooltip_unstable () {
|
|
16
16
|
return _renderTooltip.renderTooltip_unstable;
|
|
17
17
|
},
|
|
18
|
-
tooltipClassNames
|
|
18
|
+
get tooltipClassNames () {
|
|
19
19
|
return _useTooltipStylesstyles.tooltipClassNames;
|
|
20
20
|
},
|
|
21
|
-
useTooltipBase_unstable
|
|
21
|
+
get useTooltipBase_unstable () {
|
|
22
22
|
return _useTooltipBase.useTooltipBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useTooltipStyles_unstable
|
|
24
|
+
get useTooltipStyles_unstable () {
|
|
25
25
|
return _useTooltipStylesstyles.useTooltipStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useTooltip_unstable
|
|
27
|
+
get useTooltip_unstable () {
|
|
28
28
|
return _useTooltip.useTooltip_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/index.ts"],"sourcesContent":["export { Tooltip } from './Tooltip';\nexport type {\n OnVisibleChangeData,\n TooltipChildProps,\n TooltipBaseProps,\n TooltipProps,\n TooltipSlots,\n TooltipBaseState,\n TooltipState,\n} from './Tooltip.types';\nexport { renderTooltip_unstable } from './renderTooltip';\nexport { useTooltip_unstable } from './useTooltip';\nexport { useTooltipBase_unstable } from './useTooltipBase';\nexport { tooltipClassNames, useTooltipStyles_unstable } from './useTooltipStyles.styles';\n"],"names":["Tooltip","renderTooltip_unstable","useTooltip_unstable","useTooltipBase_unstable","tooltipClassNames","useTooltipStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,gBAAO;;;eAUPC,qCAAsB;;;eAGtBG,yCAAiB;;;eADjBD,uCAAuB;;;eACJE,iDAAyB;;;eAF5CH,+BAAmB;;;yBAXJ,eAAY;+BAUG,qBAAkB;4BACrB,kBAAe;gCACX,sBAAmB;wCACE,+BAA4B"}
|
|
@@ -7,14 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
function _export(target, all) {
|
|
8
8
|
for(var name in all)Object.defineProperty(target, name, {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: all
|
|
10
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
_export(exports, {
|
|
14
|
-
arrowHeight
|
|
14
|
+
get arrowHeight () {
|
|
15
15
|
return arrowHeight;
|
|
16
16
|
},
|
|
17
|
-
tooltipBorderRadius
|
|
17
|
+
get tooltipBorderRadius () {
|
|
18
18
|
return tooltipBorderRadius;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Tooltip/private/constants.ts"],"sourcesContent":["/**\n * The height of the tooltip's arrow in pixels.\n */\nexport const arrowHeight = 6;\n\n/**\n * The default value of the tooltip's border radius (borderRadiusMedium).\n *\n * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.\n * While we could use getComputedStyle, that adds a performance penalty for something that\n * will likely never change.\n */\nexport const tooltipBorderRadius = 4;\n"],"names":["arrowHeight","tooltipBorderRadius"],"mappings":"AAAA;;CAEC,GACD;;;;;;;;;;;;;;;;;;AAAO,MAAMA,cAAc,EAAE;AAStB,MAAMC,sBAAsB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Tooltip/private/useTooltipTimeout.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\n\nconst setTimeoutNoop = (_callback: Function) => -1;\nconst clearTimeoutNoop = (_handle: number) => undefined;\n\ntype BrowserTimerSetter =\n | ((fn: () => void, duration?: number, ...args: Record<string, unknown>[]) => number)\n | ((fn: () => void) => number);\n\n/**\n * @internal\n * @param triggerElementRef - Reference to the trigger element\n * @returns A pair of [setTimeout, clearTimeout] that are stable between renders.\n */\nexport function useTooltipTimeout(\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n triggerElementRef: React.MutableRefObject<HTMLElement>,\n): readonly [(fn: () => void, delay?: number) => number, () => void] {\n const { targetDocument } = useFluent();\n const win = targetDocument?.defaultView;\n\n const setTimerFn: BrowserTimerSetter = win ? win.setTimeout : setTimeoutNoop;\n const clearTimerFn: (id: number) => void = win ? win.clearTimeout : clearTimeoutNoop;\n\n const id = React.useRef<number | undefined>(undefined);\n\n const set = React.useCallback(\n (fn: () => void, delay?: number) => {\n if (id.current !== undefined) {\n clearTimerFn(id.current);\n }\n\n id.current = setTimerFn(fn, delay ?? 0);\n return id.current;\n },\n [clearTimerFn, setTimerFn],\n );\n\n const cancel = React.useCallback(() => {\n if (id.current !== undefined) {\n clearTimerFn(id.current);\n id.current = undefined;\n }\n }, [clearTimerFn]);\n\n // StrictMode-aware cleanup: only clear timeout if element has no parent (real unmount)\n React.useEffect(() => {\n const el = triggerElementRef.current;\n return () => {\n const isRealUnmount = !el || !el.isConnected;\n\n if (isRealUnmount) {\n cancel();\n }\n };\n }, [cancel, triggerElementRef]);\n\n return [set, cancel];\n}\n"],"names":["React","useFluent_unstable","useFluent","setTimeoutNoop","_callback","clearTimeoutNoop","_handle","undefined","useTooltipTimeout","triggerElementRef","targetDocument","win","defaultView","setTimerFn","setTimeout","clearTimerFn","clearTimeout","id","useRef","set","useCallback","fn","delay","current","cancel","useEffect","el","isRealUnmount","isConnected"],"mappings":"AAAA;;;;;+BAiBgBQ,kBACd,4DAA4D;;;;;;;iEAhBvC,QAAQ;qCACiB,kCAAkC;AAElF,MAAML,iBAAiB,CAACC,YAAwB,CAAC;AACjD,MAAMC,mBAAmB,CAACC,UAAoBC;AAWvC,2BAELE,iBAAsD;IAEtD,MAAM,EAAEC,cAAc,EAAE,GAAGR,2CAAAA;IAC3B,MAAMS,MAAMD,mBAAAA,QAAAA,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAgBE,WAAW;IAEvC,MAAMC,aAAiCF,MAAMA,IAAIG,UAAU,GAAGX;IAC9D,MAAMY,eAAqCJ,MAAMA,IAAIK,YAAY,GAAGX;IAEpE,MAAMY,KAAKjB,OAAMkB,MAAM,CAAqBX;IAE5C,MAAMY,MAAMnB,OAAMoB,WAAW,CAC3B,CAACC,IAAgBC;QACf,IAAIL,GAAGM,OAAO,KAAKhB,WAAW;YAC5BQ,aAAaE,GAAGM,OAAO;QACzB;QAEAN,GAAGM,OAAO,GAAGV,WAAWQ,IAAIC,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,QAAS;QACrC,OAAOL,GAAGM,OAAO;IACnB,GACA;QAACR;QAAcF;KAAW;IAG5B,MAAMW,SAASxB,OAAMoB,WAAW,CAAC;QAC/B,IAAIH,GAAGM,OAAO,KAAKhB,WAAW;YAC5BQ,aAAaE,GAAGM,OAAO;YACvBN,GAAGM,OAAO,GAAGhB;QACf;IACF,GAAG;QAACQ;KAAa;IAEjB,uFAAuF;IACvFf,OAAMyB,SAAS,CAAC;QACd,MAAMC,KAAKjB,kBAAkBc,OAAO;QACpC,OAAO;YACL,MAAMI,gBAAgB,CAACD,MAAM,CAACA,GAAGE,WAAW;YAE5C,IAAID,eAAe;gBACjBH;YACF;QACF;IACF,GAAG;QAACA;QAAQf;KAAkB;IAE9B,OAAO;QAACU;QAAKK;KAAO;AACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/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 { JSXElement } from '@fluentui/react-utilities';\nimport type { TooltipBaseState, TooltipSlots } from './Tooltip.types';\n\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = (state: TooltipBaseState): JSXElement => {\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":";;;;+BAWaE;;;;;;;6BAXb,CAA0B,GAC1B,iDAAiD,GAEjD,SAASF,MAAM,QAAQ,yBAAyB;gCACpB,4BAA4B;AAOjD,+BAA+B,CAACG;QACrCF,2BAAAA,EAA0BE;IAE1B,OAAA,WAAA,OACE,gBAAA,EAAA,oBAAA,EAAA;;YACGA,MAAMC,QAAQ;YACdD,MAAME,mBAAmB,IAAA,WAAA,OACxB,eAAA,EAACL,mBAAAA,EAAAA;gBAAOM,WAAWH,MAAMG,SAAS;0BAChC,WAAA,GAAA,oBAAA,EAACH,MAAMI,OAAO,EAAA;;wBACXJ,MAAMK,SAAS,IAAA,WAAA,OAAI,eAAA,EAACC,OAAAA;4BAAIC,KAAKP,MAAMQ,QAAQ;4BAAEC,WAAWT,MAAMU,cAAc;;wBAC5EV,MAAMI,OAAO,CAACH,QAAQ;;;;;;AAMnC,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"sourcesContent":["'use client';\n\nimport type { TooltipProps, TooltipState } from './Tooltip.types';\nimport { useTooltipBase_unstable } from './useTooltipBase';\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 'use no memo'; // justified: compiler would optimize useTooltip_unstable — manual opt-out to preserve runtime behavior\n\n const { appearance = 'normal', ...baseProps } = props;\n\n const state = useTooltipBase_unstable(baseProps);\n\n return {\n appearance,\n ...state,\n };\n};\n"],"names":["useTooltipBase_unstable","useTooltip_unstable","props","appearance","baseProps","state"],"mappings":"AAAA;;;;;;;;;;;gCAGwC,sBAAmB;AAUpD,MAAMC,sBAAsB,CAACC;IAClC,eAAe,uGAAuG;IAEtH,MAAM,EAAEC,aAAa,QAAQ,EAAE,GAAGC,WAAW,GAAGF;IAEhD,MAAMG,YAAQL,uCAAAA,EAAwBI;IAEtC,OAAO;QACLD;QACA,GAAGE,KAAK;IACV;AACF,EAAE"}
|
|
@@ -1 +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 type { PositioningProps } 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 isHTMLElement,\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\ntype OnPositioningEndEvent = Parameters<Exclude<PositioningProps['onPositioningEnd'], undefined>>[0];\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 const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const [hidden, setHidden] = React.useState(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 hidden,\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 resolvedPositioning = resolvePositioningShorthand(state.positioning);\n const isVirtualTarget = resolvedPositioning.target !== undefined && !isHTMLElement(resolvedPositioning.target);\n const onPositioningEnd = useEventCallback((event: OnPositioningEndEvent) => {\n // Portaled tooltips can escape the trigger's clipping ancestors while the trigger is still visible.\n // Virtual targets can be reported as hidden based on synthetic geometry.\n setHidden(!isVirtualTarget && event.detail.referenceHidden);\n resolvedPositioning.onPositioningEnd?.(event);\n });\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 ...resolvedPositioning,\n onPositioningEnd,\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 // eslint-disable-next-line react-hooks/immutability\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 // Dismiss the tooltip when the document becomes hidden (e.g. tab backgrounded,\n // app switched on mobile). The original trigger (hover/tap/focus) is no longer\n // active in this case, so persisting the tooltip is a stale UI state.\n const onDocumentVisibilityChange = () => {\n if (targetDocument?.visibilityState === 'hidden') {\n thisTooltip.hide();\n }\n };\n\n targetDocument?.addEventListener('visibilitychange', onDocumentVisibilityChange);\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n targetDocument?.removeEventListener('visibilitychange', onDocumentVisibilityChange);\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/immutability\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n // eslint-disable-next-line react-hooks/immutability\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/refs\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\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","isHTMLElement","arrowHeight","tooltipBorderRadius","useTooltipTimeout","Escape","useTooltipBase_unstable","props","child","context","isServerSideRender","targetDocument","visible","setVisibleInternal","state","initialState","hidden","setHidden","useState","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","resolvedPositioning","isVirtualTarget","target","undefined","onPositioningEnd","event","detail","referenceHidden","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","setDelayTimeout","clearDelayTimeout","setVisible","useCallback","ev","data","oldVisible","ref","thisTooltip","hide","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","defaultPrevented","preventDefault","addEventListener","capture","onDocumentVisibilityChange","visibilityState","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","isNavigatingWithKeyboard","keyborgListenerCallbackRef","onKeyborgFocusIn","isFocusedProgrammatically","element","onLeaveTrigger","activeElement","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","isPopupExpanded"],"mappings":"AAAA;;;;;+BAwCa0B;;;;;;;iEAtCU,QAAQ;kCAC+C,8BAA8B;qCAKrG,kCAAkC;8BAEoB,0BAA0B;gCAchF,4BAA4B;2BAEc,yBAAsB;mCACrC,iCAA8B;8BACzC,0BAA0B;AAY1C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AA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAc+E,cAAc,EAAEZ;QAC9E,4CAA4C;QAC5Ca,gBAAgB1F,oCAAAA,MAAiBD,8BAAAA,EAAeW,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcgF,cAAc,EAAEH;QAC9E,4CAA4C;QAC5CI,aAAS3F,gCAAAA,MAAiBD,8BAAAA,EAAeW,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,AAALA,MAAK,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAciF,OAAO,EAAEd;QAChE,4CAA4C;QAC5Ce,YAAQ5F,gCAAAA,MAAiBD,8BAAAA,EAAeW,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAckF,MAAM,EAAEL;IAChE;IAEA,OAAOvE;AACT,EAAE"}
|
|
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 type { PositioningProps } 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 isHTMLElement,\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\ntype OnPositioningEndEvent = Parameters<Exclude<PositioningProps['onPositioningEnd'], undefined>>[0];\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 const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const [hidden, setHidden] = React.useState(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 hidden,\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 resolvedPositioning = resolvePositioningShorthand(state.positioning);\n const isVirtualTarget = resolvedPositioning.target !== undefined && !isHTMLElement(resolvedPositioning.target);\n const onPositioningEnd = useEventCallback((event: OnPositioningEndEvent) => {\n // Portaled tooltips can escape the trigger's clipping ancestors while the trigger is still visible.\n // Virtual targets can be reported as hidden based on synthetic geometry.\n setHidden(!isVirtualTarget && event.detail.referenceHidden);\n resolvedPositioning.onPositioningEnd?.(event);\n });\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 ...resolvedPositioning,\n onPositioningEnd,\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 // eslint-disable-next-line react-hooks/immutability\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 // Dismiss the tooltip when the document becomes hidden (e.g. tab backgrounded,\n // app switched on mobile). The original trigger (hover/tap/focus) is no longer\n // active in this case, so persisting the tooltip is a stale UI state.\n const onDocumentVisibilityChange = () => {\n if (targetDocument?.visibilityState === 'hidden') {\n thisTooltip.hide();\n }\n };\n\n targetDocument?.addEventListener('visibilitychange', onDocumentVisibilityChange);\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n targetDocument?.removeEventListener('visibilitychange', onDocumentVisibilityChange);\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/preserve-manual-memoization\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 // eslint-disable-next-line react-hooks/immutability\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n // eslint-disable-next-line react-hooks/immutability\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n // eslint-disable-next-line react-hooks/immutability, react-hooks/refs\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/refs\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n // eslint-disable-next-line react-hooks/refs\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n // eslint-disable-next-line react-hooks/refs\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","isHTMLElement","arrowHeight","tooltipBorderRadius","useTooltipTimeout","Escape","useTooltipBase_unstable","props","child","context","isServerSideRender","targetDocument","visible","setVisibleInternal","state","initialState","hidden","setHidden","useState","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","shouldRenderTooltip","components","always","defaultProps","role","elementType","id","resolvedPositioning","isVirtualTarget","target","undefined","onPositioningEnd","event","detail","referenceHidden","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","setDelayTimeout","clearDelayTimeout","setVisible","useCallback","ev","data","oldVisible","ref","thisTooltip","hide","documentKeyboardEvent","visibleTooltip","onDocumentKeyDown","key","defaultPrevented","preventDefault","addEventListener","capture","onDocumentVisibilityChange","visibilityState","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","isNavigatingWithKeyboard","keyborgListenerCallbackRef","onKeyborgFocusIn","isFocusedProgrammatically","element","onLeaveTrigger","activeElement","onPointerEnter","onPointerLeave","onFocus","onBlur","triggerAriaProps","isPopupExpanded"],"mappings":"AAAA;;;;;+BAwCa0B;;;;;;;iEAtCU,QAAQ;kCAC+C,8BAA8B;qCAKrG,kCAAkC;8BAEoB,0BAA0B;gCAchF,4BAA4B;2BAEc,yBAAsB;mCACrC,iCAA8B;8BACzC,0BAA0B;AAY1C,gCAAgC,CAACC;QAgPpCC,cACCA,eAA4CA,eAsCGA,eAEAA,eAEPA,eAEDA;IA5R1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IAAAA,cAAc+E,cAAc,EAAEZ;QAC9E,4CAA4C;QAC5Ca,gBAAgB1F,oCAAAA,MAAiBD,8BAAAA,EAAeW,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAcgF,cAAc,EAAEH;QAC9E,4CAA4C;QAC5CI,aAAS3F,gCAAAA,MAAiBD,8BAAAA,EAAeW,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAK,AAALA,MAAK,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAciF,OAAO,EAAEd;QAChE,4CAA4C;QAC5Ce,YAAQ5F,gCAAAA,MAAiBD,8BAAAA,EAAeW,UAAAA,QAAAA,UAAAA,KAAAA,IAAAA,KAAAA,IAAAA,CAAAA,gBAAAA,MAAOD,KAAAA,AAAK,MAAA,QAAZC,kBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,cAAckF,MAAM,EAAEL;IAChE;IAEA,OAAOvE;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
tooltipClassNames
|
|
13
|
+
get tooltipClassNames () {
|
|
14
14
|
return tooltipClassNames;
|
|
15
15
|
},
|
|
16
|
-
useTooltipStyles_unstable
|
|
16
|
+
get useTooltipStyles_unstable () {
|
|
17
17
|
return useTooltipStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useTooltipStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nimport { createArrowStyles } from \"@fluentui/react-positioning\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { arrowHeight } from \"./private/constants.js\";\nexport const tooltipClassNames = {\n content: 'fui-Tooltip__content'\n};\n/**\n * Styles for the tooltip\n */ const useStyles = makeStyles({\n root: {\n display: 'none',\n boxSizing: 'border-box',\n maxWidth: '240px',\n cursor: 'default',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n overflowWrap: 'break-word',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n padding: '4px 11px 6px 11px',\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n // TODO need to add versions of tokens.alias.shadow.shadow8, etc. that work with filter\n filter: `drop-shadow(0 0 2px ${tokens.colorNeutralShadowAmbient}) ` + `drop-shadow(0 4px 8px ${tokens.colorNeutralShadowKey})`\n },\n visible: {\n display: 'block'\n },\n hidden: {\n visibility: 'hidden',\n pointerEvents: 'none'\n },\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundStatic,\n color: tokens.colorNeutralForegroundStaticInverted\n },\n arrow: createArrowStyles({\n arrowHeight\n })\n});\n/**\n * Apply styling to the Tooltip slots based on the state\n */ export const useTooltipStyles_unstable = (state)=>{\n const styles = useStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(tooltipClassNames.content, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.hidden && styles.hidden, state.content.className);\n // eslint-disable-next-line react-hooks/immutability\n state.arrowClassName = styles.arrow;\n return state;\n};\n"],"names":["__styles","mergeClasses","createArrowStyles","tokens","arrowHeight","tooltipClassNames","content","useStyles","root","mc9l5x","B7ck84d","B2u0y6b","Bceei9c","Bahqtrf","Be2twd7","Bg96gwp","Btd35i7","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","De3pzq","sj55zd","Bhu2qc9","visible","hidden","Bcdw1i0","Bkecrkj","inverted","arrow","qhf8xq","Bj3rh1h","rhnwrx","Bdy53xb","B2eet1l","Bz10aip","Bqenvij","a9b677","Ftih45","Br0sdwz","cmx5o7","susq4k","Biibvgv","Bicfajf","qehafq","Brs5u8j","Ccq8qp","Baz25je","Bcgcnre","Bqjgrrk","qa3bma","y0oebl","Biqmznv","Bm6vgfq","Bbv0w2i","uvfttm","eqrjj","Bk5zm6e","m598lv","B4f6apu","ydt019","Bq4z7u6","Bdkvgpv","B0qfbqy","kj8mxx","r59vdv","Bkw5xw4","hl6cv3","aea9ga","yayu3t","Bhsv975","rhl9o9","B7gxrvb","B6q6orb","B0lu1f8","d","p","useTooltipStyles_unstable","state","styles","className","appearance","arrowClassName"],"mappings":"AAAA,YAAY;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["useTooltipStyles.styles.js"],"sourcesContent":["'use client';\nimport { makeStyles, mergeClasses } from \"@griffel/react\";\nimport { createArrowStyles } from \"@fluentui/react-positioning\";\nimport { tokens } from \"@fluentui/react-theme\";\nimport { arrowHeight } from \"./private/constants.js\";\nexport const tooltipClassNames = {\n content: 'fui-Tooltip__content'\n};\n/**\n * Styles for the tooltip\n */ const useStyles = makeStyles({\n root: {\n display: 'none',\n boxSizing: 'border-box',\n maxWidth: '240px',\n cursor: 'default',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n overflowWrap: 'break-word',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n padding: '4px 11px 6px 11px',\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n // TODO need to add versions of tokens.alias.shadow.shadow8, etc. that work with filter\n filter: `drop-shadow(0 0 2px ${tokens.colorNeutralShadowAmbient}) ` + `drop-shadow(0 4px 8px ${tokens.colorNeutralShadowKey})`\n },\n visible: {\n display: 'block'\n },\n hidden: {\n visibility: 'hidden',\n pointerEvents: 'none'\n },\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundStatic,\n color: tokens.colorNeutralForegroundStaticInverted\n },\n arrow: createArrowStyles({\n arrowHeight\n })\n});\n/**\n * Apply styling to the Tooltip slots based on the state\n */ export const useTooltipStyles_unstable = (state)=>{\n const styles = useStyles();\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(tooltipClassNames.content, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.hidden && styles.hidden, state.content.className);\n // eslint-disable-next-line react-hooks/immutability\n state.arrowClassName = styles.arrow;\n return state;\n};\n"],"names":["__styles","mergeClasses","createArrowStyles","tokens","arrowHeight","tooltipClassNames","content","useStyles","root","mc9l5x","B7ck84d","B2u0y6b","Bceei9c","Bahqtrf","Be2twd7","Bg96gwp","Btd35i7","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bgfg5da","B9xav0g","oivjwe","Bn0qgzm","B4g9neb","zhjwy3","wvpqe5","ibv6hh","u1mtju","h3c5rm","vrafjx","Bekrc4i","i8vvqc","g2u3we","icvyot","B4j52fo","irswps","Byoj8tv","uwmqm3","z189sj","z8tnut","B0ocmuz","De3pzq","sj55zd","Bhu2qc9","visible","hidden","Bcdw1i0","Bkecrkj","inverted","arrow","qhf8xq","Bj3rh1h","rhnwrx","Bdy53xb","B2eet1l","Bz10aip","Bqenvij","a9b677","Ftih45","Br0sdwz","cmx5o7","susq4k","Biibvgv","Bicfajf","qehafq","Brs5u8j","Ccq8qp","Baz25je","Bcgcnre","Bqjgrrk","qa3bma","y0oebl","Biqmznv","Bm6vgfq","Bbv0w2i","uvfttm","eqrjj","Bk5zm6e","m598lv","B4f6apu","ydt019","Bq4z7u6","Bdkvgpv","B0qfbqy","kj8mxx","r59vdv","Bkw5xw4","hl6cv3","aea9ga","yayu3t","Bhsv975","rhl9o9","B7gxrvb","B6q6orb","B0lu1f8","d","p","useTooltipStyles_unstable","state","styles","className","appearance","arrowClassName"],"mappings":"AAAA,YAAY;;;;;;;;;;;;QAKCK,iBAAiB;;;;eAwCb+F,yBAAyB;;;uBA5CD,gBAAgB;AAIlD,0BAA0B;IAC7B9F,OAAO,EAAE;AACb,CAAC;AACD;;CAEA,GAAI,MAAMC,SAAS,GAAA,WAAA,OAAGP,eAAA,EAAA;IAAAQ,IAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,MAAA,EAAA;QAAAC,OAAA,EAAA;IAAA;IAAAC,OAAA,EAAA;Q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;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;QAAA;QAAA;YAAA;YAAA;gBAAAA,CAAA,EAAA,CAAA;YAAA;SAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;AAAA,CAgCrB,CAAC;AAGS,mCAAmCE,KAAK,IAAG;IAClD,MAAMC,MAAM,GAAG/F,SAAS,CAAC,CAAC;IAC1B,oDAAA;IACA8F,KAAK,CAAC/F,OAAO,CAACiG,SAAS,OAAGtG,mBAAY,EAACI,iBAAiB,CAACC,OAAO,EAAEgG,MAAM,CAAC9F,IAAI,EAAE6F,KAAK,CAACG,UAAU,KAAK,UAAU,IAAIF,MAAM,CAACnD,QAAQ,EAAEkD,KAAK,CAACtD,OAAO,IAAIuD,MAAM,CAACvD,OAAO,EAAEsD,KAAK,CAACrD,MAAM,IAAIsD,MAAM,CAACtD,MAAM,EAAEqD,KAAK,CAAC/F,OAAO,CAACiG,SAAS,CAAC;IAC3N,oDAAA;IACAF,KAAK,CAACI,cAAc,GAAGH,MAAM,CAAClD,KAAK;IACnC,OAAOiD,KAAK;AAChB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get tooltipClassNames () {
|
|
13
|
+
return tooltipClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useTooltipStyles_unstable () {
|
|
16
|
+
return useTooltipStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _arrowmodulecss = /*#__PURE__*/ _interop_require_default._(require("@fluentui/react-positioning/arrow.module.css"));
|
|
22
|
+
const _Tooltipmodulecss = /*#__PURE__*/ _interop_require_default._(require("./Tooltip.module.css"));
|
|
23
|
+
const tooltipClassNames = {
|
|
24
|
+
content: 'fui-Tooltip__content'
|
|
25
|
+
};
|
|
26
|
+
const useTooltipStyles_unstable = (state)=>{
|
|
27
|
+
state.content.className = (0, _clsx.clsx)(tooltipClassNames.content, _Tooltipmodulecss.default.content, state.appearance === 'inverted' && _Tooltipmodulecss.default.inverted, state.visible && _Tooltipmodulecss.default.visible, state.hidden && _Tooltipmodulecss.default.hidden, state.content.className);
|
|
28
|
+
state.arrowClassName = (0, _clsx.clsx)(_arrowmodulecss.default.arrow, _Tooltipmodulecss.default.arrow);
|
|
29
|
+
return state;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport arrowStyles from '@fluentui/react-positioning/arrow.module.css';\nimport styles from './Tooltip.module.css';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n state.content.className = clsx(\n tooltipClassNames.content,\n styles.content,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.hidden && styles.hidden,\n state.content.className,\n );\n state.arrowClassName = clsx(arrowStyles.arrow, styles.arrow);\n return state;\n};\n"],"names":["clsx","arrowStyles","styles","tooltipClassNames","content","useTooltipStyles_unstable","state","className","appearance","inverted","visible","hidden","arrowClassName","arrow"],"mappings":";;;;;;;;;;;QAMaG;;;;;;;;sBANQ,OAAO;yEAGJ,+CAA+C;2EACpD,uBAAuB;AAEnC,0BAAwD;IAC7DC,SAAS;AACX,EAAE;AAEK,MAAMC,4BAA4B,CAACC;IACxCA,MAAMF,OAAO,CAACG,SAAS,GAAGP,cAAAA,EACxBG,kBAAkBC,OAAO,EACzBF,yBAAAA,CAAOE,OAAO,EACdE,MAAME,UAAU,KAAK,cAAcN,yBAAAA,CAAOO,QAAQ,EAClDH,MAAMI,OAAO,IAAIR,yBAAAA,CAAOQ,OAAO,EAC/BJ,MAAMK,MAAM,IAAIT,yBAAAA,CAAOS,MAAM,EAC7BL,MAAMF,OAAO,CAACG,SAAS;IAEzBD,MAAMM,cAAc,OAAGZ,UAAAA,EAAKC,uBAAAA,CAAYY,KAAK,EAAEX,yBAAAA,CAAOW,KAAK;IAC3D,OAAOP;AACT,EAAE"}
|
|
@@ -6,14 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
function _export(target, all) {
|
|
7
7
|
for(var name in all)Object.defineProperty(target, name, {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: all
|
|
9
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
tooltipClassNames
|
|
13
|
+
get tooltipClassNames () {
|
|
14
14
|
return tooltipClassNames;
|
|
15
15
|
},
|
|
16
|
-
useTooltipStyles_unstable
|
|
16
|
+
get useTooltipStyles_unstable () {
|
|
17
17
|
return useTooltipStyles_unstable;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.styles.ts"],"sourcesContent":["'use client';\n\nimport { makeStyles, mergeClasses } from '@griffel/react';\nimport { createArrowStyles } from '@fluentui/react-positioning';\nimport { tokens } from '@fluentui/react-theme';\nimport { arrowHeight } from './private/constants';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\n/**\n * Styles for the tooltip\n */\nconst useStyles = makeStyles({\n root: {\n display: 'none',\n boxSizing: 'border-box',\n maxWidth: '240px',\n cursor: 'default',\n fontFamily: tokens.fontFamilyBase,\n fontSize: tokens.fontSizeBase200,\n lineHeight: tokens.lineHeightBase200,\n overflowWrap: 'break-word',\n borderRadius: tokens.borderRadiusMedium,\n border: `1px solid ${tokens.colorTransparentStroke}`,\n padding: '4px 11px 6px 11px', // '5px 12px 7px 12px' minus the border width '1px'\n backgroundColor: tokens.colorNeutralBackground1,\n color: tokens.colorNeutralForeground1,\n\n // TODO need to add versions of tokens.alias.shadow.shadow8, etc. that work with filter\n filter:\n `drop-shadow(0 0 2px ${tokens.colorNeutralShadowAmbient}) ` +\n `drop-shadow(0 4px 8px ${tokens.colorNeutralShadowKey})`,\n },\n\n visible: {\n display: 'block',\n },\n\n hidden: {\n visibility: 'hidden',\n pointerEvents: 'none',\n },\n\n inverted: {\n backgroundColor: tokens.colorNeutralBackgroundStatic,\n color: tokens.colorNeutralForegroundStaticInverted,\n },\n\n arrow: createArrowStyles({ arrowHeight }),\n});\n\n/**\n * Apply styling to the Tooltip slots based on the state\n */\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n const styles = useStyles();\n\n // eslint-disable-next-line react-hooks/immutability\n state.content.className = mergeClasses(\n tooltipClassNames.content,\n styles.root,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.hidden && styles.hidden,\n state.content.className,\n );\n\n // eslint-disable-next-line react-hooks/immutability\n state.arrowClassName = styles.arrow;\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","createArrowStyles","tokens","arrowHeight","tooltipClassNames","content","useStyles","root","display","boxSizing","maxWidth","cursor","fontFamily","fontFamilyBase","fontSize","fontSizeBase200","lineHeight","lineHeightBase200","overflowWrap","borderRadius","borderRadiusMedium","border","colorTransparentStroke","padding","backgroundColor","colorNeutralBackground1","color","colorNeutralForeground1","filter","colorNeutralShadowAmbient","colorNeutralShadowKey","visible","hidden","visibility","pointerEvents","inverted","colorNeutralBackgroundStatic","colorNeutralForegroundStaticInverted","arrow","useTooltipStyles_unstable","state","styles","className","appearance","arrowClassName"],"mappings":"AAAA;;;;;;;;;;;;QASaK;;;QAiDAmC;;;;uBAxD4B,iBAAiB;kCACxB,8BAA8B;4BACzC,wBAAwB;2BACnB,yBAAsB;AAI3C,0BAAwD;IAC7DlC,SAAS;AACX,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAYP,iBAAAA,EAAW;IAC3BQ,MAAM;QACJC,SAAS;QACTC,WAAW;QACXC,UAAU;QACVC,QAAQ;QACRC,YAAYV,kBAAAA,CAAOW,cAAc;QACjCC,UAAUZ,kBAAAA,CAAOa,eAAe;QAChCC,YAAYd,kBAAAA,CAAOe,iBAAiB;QACpCC,cAAc;QACdC,cAAcjB,kBAAAA,CAAOkB,kBAAkB;QACvCC,QAAQ,CAAC,UAAU,EAAEnB,kBAAAA,CAAOoB,sBAAsB,EAAE;QACpDC,SAAS;QACTC,iBAAiBtB,kBAAAA,CAAOuB,uBAAuB;QAC/CC,OAAOxB,kBAAAA,CAAOyB,uBAAuB;QAErC,uFAAuF;QACvFC,QACE,CAAC,oBAAoB,EAAE1B,kBAAAA,CAAO2B,yBAAyB,CAAC,EAAE,CAAC,GAC3D,CAAC,sBAAsB,EAAE3B,kBAAAA,CAAO4B,qBAAqB,CAAC,CAAC,CAAC;IAC5D;IAEAC,SAAS;QACPvB,SAAS;IACX;IAEAwB,QAAQ;QACNC,YAAY;QACZC,eAAe;IACjB;IAEAC,UAAU;QACRX,iBAAiBtB,kBAAAA,CAAOkC,4BAA4B;QACpDV,OAAOxB,kBAAAA,CAAOmC,oCAAoC;IACpD;IAEAC,WAAOrC,mCAAAA,EAAkB;qBAAEE,sBAAAA;IAAY;AACzC;AAKO,kCAAkC,CAACqC;IACxC,MAAMC,SAASnC;IAEf,oDAAoD;IACpDkC,MAAMnC,OAAO,CAACqC,SAAS,OAAG1C,mBAAAA,EACxBI,kBAAkBC,OAAO,EACzBoC,OAAOlC,IAAI,EACXiC,MAAMG,UAAU,KAAK,cAAcF,OAAON,QAAQ,EAClDK,MAAMT,OAAO,IAAIU,OAAOV,OAAO,EAC/BS,MAAMR,MAAM,IAAIS,OAAOT,MAAM,EAC7BQ,MAAMnC,OAAO,CAACqC,SAAS;IAGzB,oDAAoD;IACpDF,MAAMI,cAAc,GAAGH,OAAOH,KAAK;IAEnC,OAAOE;AACT,EAAE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get tooltipClassNames () {
|
|
13
|
+
return tooltipClassNames;
|
|
14
|
+
},
|
|
15
|
+
get useTooltipStyles_unstable () {
|
|
16
|
+
return useTooltipStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
|
|
20
|
+
const _clsx = require("clsx");
|
|
21
|
+
const _arrowmodulecss = /*#__PURE__*/ _interop_require_default._(require("@fluentui/react-positioning/arrow.module.css"));
|
|
22
|
+
const _Tooltipmodulecss = /*#__PURE__*/ _interop_require_default._(require("./Tooltip.module.css"));
|
|
23
|
+
const tooltipClassNames = {
|
|
24
|
+
content: 'fui-Tooltip__content'
|
|
25
|
+
};
|
|
26
|
+
const useTooltipStyles_unstable = (state)=>{
|
|
27
|
+
state.content.className = (0, _clsx.clsx)(tooltipClassNames.content, _Tooltipmodulecss.default.content, state.appearance === 'inverted' && _Tooltipmodulecss.default.inverted, state.visible && _Tooltipmodulecss.default.visible, state.hidden && _Tooltipmodulecss.default.hidden, state.content.className);
|
|
28
|
+
state.arrowClassName = (0, _clsx.clsx)(_arrowmodulecss.default.arrow, _Tooltipmodulecss.default.arrow);
|
|
29
|
+
return state;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.styles.css.ts"],"sourcesContent":["import { clsx } from 'clsx';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\nimport arrowStyles from '@fluentui/react-positioning/arrow.module.css';\nimport styles from './Tooltip.module.css';\n\nexport const tooltipClassNames: SlotClassNames<TooltipSlots> = {\n content: 'fui-Tooltip__content',\n};\n\nexport const useTooltipStyles_unstable = (state: TooltipState): TooltipState => {\n state.content.className = clsx(\n tooltipClassNames.content,\n styles.content,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.hidden && styles.hidden,\n state.content.className,\n );\n state.arrowClassName = clsx(arrowStyles.arrow, styles.arrow);\n return state;\n};\n"],"names":["clsx","arrowStyles","styles","tooltipClassNames","content","useTooltipStyles_unstable","state","className","appearance","inverted","visible","hidden","arrowClassName","arrow"],"mappings":";;;;;;;;;;;QAMaG;;;;;;;;sBANQ,OAAO;yEAGJ,+CAA+C;2EACpD,uBAAuB;AAEnC,0BAAwD;IAC7DC,SAAS;AACX,EAAE;AAEK,MAAMC,4BAA4B,CAACC;IACxCA,MAAMF,OAAO,CAACG,SAAS,GAAGP,cAAAA,EACxBG,kBAAkBC,OAAO,EACzBF,yBAAAA,CAAOE,OAAO,EACdE,MAAME,UAAU,KAAK,cAAcN,yBAAAA,CAAOO,QAAQ,EAClDH,MAAMI,OAAO,IAAIR,yBAAAA,CAAOQ,OAAO,EAC/BJ,MAAMK,MAAM,IAAIT,yBAAAA,CAAOS,MAAM,EAC7BL,MAAMF,OAAO,CAACG,SAAS;IAEzBD,MAAMM,cAAc,OAAGZ,UAAAA,EAAKC,uBAAAA,CAAYY,KAAK,EAAEX,yBAAAA,CAAOW,KAAK;IAC3D,OAAOP;AACT,EAAE"}
|
package/lib-commonjs/index.cjs
CHANGED
|
@@ -5,26 +5,26 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
Tooltip
|
|
12
|
+
get Tooltip () {
|
|
13
13
|
return _Tooltip.Tooltip;
|
|
14
14
|
},
|
|
15
|
-
renderTooltip_unstable
|
|
15
|
+
get renderTooltip_unstable () {
|
|
16
16
|
return _Tooltip.renderTooltip_unstable;
|
|
17
17
|
},
|
|
18
|
-
tooltipClassNames
|
|
18
|
+
get tooltipClassNames () {
|
|
19
19
|
return _Tooltip.tooltipClassNames;
|
|
20
20
|
},
|
|
21
|
-
useTooltipBase_unstable
|
|
21
|
+
get useTooltipBase_unstable () {
|
|
22
22
|
return _Tooltip.useTooltipBase_unstable;
|
|
23
23
|
},
|
|
24
|
-
useTooltipStyles_unstable
|
|
24
|
+
get useTooltipStyles_unstable () {
|
|
25
25
|
return _Tooltip.useTooltipStyles_unstable;
|
|
26
26
|
},
|
|
27
|
-
useTooltip_unstable
|
|
27
|
+
get useTooltip_unstable () {
|
|
28
28
|
return _Tooltip.useTooltip_unstable;
|
|
29
29
|
}
|
|
30
30
|
});
|
package/package.json
CHANGED
|
@@ -1,27 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-tooltip",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
4
4
|
"description": "React components for building web experiences",
|
|
5
5
|
"main": "lib-commonjs/index.cjs",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
|
-
"sideEffects":
|
|
8
|
+
"sideEffects": [
|
|
9
|
+
"**/*.css"
|
|
10
|
+
],
|
|
9
11
|
"repository": {
|
|
10
12
|
"type": "git",
|
|
11
13
|
"url": "https://github.com/microsoft/fluentui"
|
|
12
14
|
},
|
|
13
15
|
"license": "MIT",
|
|
14
16
|
"dependencies": {
|
|
15
|
-
"@fluentui/keyboard-keys": "9.
|
|
16
|
-
"@fluentui/react-jsx-runtime": "9.
|
|
17
|
-
"@fluentui/react-portal": "9.
|
|
18
|
-
"@fluentui/react-positioning": "9.
|
|
19
|
-
"@fluentui/react-shared-contexts": "9.
|
|
20
|
-
"@fluentui/react-tabster": "9.
|
|
21
|
-
"@fluentui/react-theme": "9.
|
|
22
|
-
"@fluentui/react-utilities": "9.
|
|
17
|
+
"@fluentui/keyboard-keys": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
18
|
+
"@fluentui/react-jsx-runtime": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
19
|
+
"@fluentui/react-portal": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
20
|
+
"@fluentui/react-positioning": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
21
|
+
"@fluentui/react-shared-contexts": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
22
|
+
"@fluentui/react-tabster": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
23
|
+
"@fluentui/react-theme": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
24
|
+
"@fluentui/react-utilities": "9.75.0-experimental.css-modules.20261031-810ab07afb.0",
|
|
23
25
|
"@griffel/react": "^1.5.32",
|
|
24
|
-
"@swc/helpers": "^0.5.1"
|
|
26
|
+
"@swc/helpers": "^0.5.1",
|
|
27
|
+
"clsx": "^2.1.1"
|
|
25
28
|
},
|
|
26
29
|
"peerDependencies": {
|
|
27
30
|
"@types/react": ">=16.14.0 <20.0.0",
|