@fluentui/react-tooltip 0.0.0-nightly-20230317-1454.1 → 0.0.0-nightly-20230321-0440.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/CHANGELOG.json +17 -17
  2. package/CHANGELOG.md +11 -11
  3. package/lib/Tooltip.js +1 -1
  4. package/lib/Tooltip.js.map +1 -1
  5. package/lib/components/Tooltip/Tooltip.js +5 -6
  6. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  7. package/lib/components/Tooltip/Tooltip.types.js +1 -1
  8. package/lib/components/Tooltip/Tooltip.types.js.map +1 -1
  9. package/lib/components/Tooltip/index.js +5 -5
  10. package/lib/components/Tooltip/index.js.map +1 -1
  11. package/lib/components/Tooltip/private/constants.js +2 -1
  12. package/lib/components/Tooltip/private/constants.js.map +1 -1
  13. package/lib/components/Tooltip/renderTooltip.js +6 -4
  14. package/lib/components/Tooltip/renderTooltip.js.map +1 -1
  15. package/lib/components/Tooltip/useTooltip.js +35 -33
  16. package/lib/components/Tooltip/useTooltip.js.map +1 -1
  17. package/lib/components/Tooltip/useTooltipStyles.js +6 -6
  18. package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
  19. package/lib/index.js +1 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib-commonjs/Tooltip.js +4 -5
  22. package/lib-commonjs/Tooltip.js.map +1 -1
  23. package/lib-commonjs/components/Tooltip/Tooltip.js +21 -20
  24. package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
  25. package/lib-commonjs/components/Tooltip/Tooltip.types.js +2 -5
  26. package/lib-commonjs/components/Tooltip/Tooltip.types.js.map +1 -1
  27. package/lib-commonjs/components/Tooltip/index.js +8 -9
  28. package/lib-commonjs/components/Tooltip/index.js.map +1 -1
  29. package/lib-commonjs/components/Tooltip/private/constants.js +16 -17
  30. package/lib-commonjs/components/Tooltip/private/constants.js.map +1 -1
  31. package/lib-commonjs/components/Tooltip/renderTooltip.js +24 -19
  32. package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
  33. package/lib-commonjs/components/Tooltip/useTooltip.js +194 -189
  34. package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
  35. package/lib-commonjs/components/Tooltip/useTooltipStyles.js +92 -200
  36. package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
  37. package/lib-commonjs/index.js +33 -16
  38. package/lib-commonjs/index.js.map +1 -1
  39. package/package.json +11 -10
  40. package/.swcrc +0 -39
package/CHANGELOG.json CHANGED
@@ -2,9 +2,9 @@
2
2
  "name": "@fluentui/react-tooltip",
3
3
  "entries": [
4
4
  {
5
- "date": "Fri, 17 Mar 2023 15:00:08 GMT",
6
- "tag": "@fluentui/react-tooltip_v0.0.0-nightly-20230317-1454.1",
7
- "version": "0.0.0-nightly-20230317-1454.1",
5
+ "date": "Tue, 21 Mar 2023 04:49:47 GMT",
6
+ "tag": "@fluentui/react-tooltip_v0.0.0-nightly-20230321-0440.1",
7
+ "version": "0.0.0-nightly-20230321-0440.1",
8
8
  "comments": {
9
9
  "prerelease": [
10
10
  {
@@ -16,44 +16,44 @@
16
16
  {
17
17
  "author": "beachball",
18
18
  "package": "@fluentui/react-tooltip",
19
- "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1",
20
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
19
+ "comment": "Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230321-0440.1",
20
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
21
21
  },
22
22
  {
23
23
  "author": "beachball",
24
24
  "package": "@fluentui/react-tooltip",
25
- "comment": "Bump @fluentui/react-portal to v0.0.0-nightly-20230317-1454.1",
26
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
25
+ "comment": "Bump @fluentui/react-portal to v0.0.0-nightly-20230321-0440.1",
26
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
27
27
  },
28
28
  {
29
29
  "author": "beachball",
30
30
  "package": "@fluentui/react-tooltip",
31
- "comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-20230317-1454.1",
32
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
31
+ "comment": "Bump @fluentui/react-positioning to v0.0.0-nightly-20230321-0440.1",
32
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
33
33
  },
34
34
  {
35
35
  "author": "beachball",
36
36
  "package": "@fluentui/react-tooltip",
37
- "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230317-1454.1",
38
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
37
+ "comment": "Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230321-0440.1",
38
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
39
39
  },
40
40
  {
41
41
  "author": "beachball",
42
42
  "package": "@fluentui/react-tooltip",
43
- "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230317-1454.1",
44
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
43
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20230321-0440.1",
44
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
45
45
  },
46
46
  {
47
47
  "author": "beachball",
48
48
  "package": "@fluentui/react-tooltip",
49
- "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230317-1454.1",
50
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
49
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20230321-0440.1",
50
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
51
51
  },
52
52
  {
53
53
  "author": "beachball",
54
54
  "package": "@fluentui/react-tooltip",
55
- "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230317-1454.1",
56
- "commit": "636275472966fa37b1efc14ac2e70ad32bd39b86"
55
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230321-0440.1",
56
+ "commit": "e913db5700c77cb74564f4422c775d52ef302e91"
57
57
  }
58
58
  ]
59
59
  }
package/CHANGELOG.md CHANGED
@@ -1,24 +1,24 @@
1
1
  # Change Log - @fluentui/react-tooltip
2
2
 
3
- This log was last generated on Fri, 17 Mar 2023 15:00:08 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 21 Mar 2023 04:49:47 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
- ## [0.0.0-nightly-20230317-1454.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v0.0.0-nightly-20230317-1454.1)
7
+ ## [0.0.0-nightly-20230321-0440.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v0.0.0-nightly-20230321-0440.1)
8
8
 
9
- Fri, 17 Mar 2023 15:00:08 GMT
10
- [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.2.4..@fluentui/react-tooltip_v0.0.0-nightly-20230317-1454.1)
9
+ Tue, 21 Mar 2023 04:49:47 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tooltip_v9.2.4..@fluentui/react-tooltip_v0.0.0-nightly-20230321-0440.1)
11
11
 
12
12
  ### Changes
13
13
 
14
14
  - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by fluentui-internal@service.microsoft.com)
15
- - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
16
- - Bump @fluentui/react-portal to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
17
- - Bump @fluentui/react-positioning to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
18
- - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
19
- - Bump @fluentui/react-theme to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
20
- - Bump @fluentui/react-utilities to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
21
- - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230317-1454.1 ([commit](https://github.com/microsoft/fluentui/commit/636275472966fa37b1efc14ac2e70ad32bd39b86) by beachball)
15
+ - Bump @fluentui/keyboard-keys to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
16
+ - Bump @fluentui/react-portal to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
17
+ - Bump @fluentui/react-positioning to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
18
+ - Bump @fluentui/react-shared-contexts to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
19
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
20
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
21
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20230321-0440.1 ([commit](https://github.com/microsoft/fluentui/commit/e913db5700c77cb74564f4422c775d52ef302e91) by beachball)
22
22
 
23
23
  ## [9.2.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-tooltip_v9.2.4)
24
24
 
package/lib/Tooltip.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./components/Tooltip/index";
1
+ export * from './components/Tooltip/index';
2
2
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/Tooltip.ts"],"sourcesContent":["export * from './components/Tooltip/index';\n"],"mappings":"AAAA,cAAc"}
1
+ {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-tooltip/src/Tooltip.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC","sourcesContent":["export * from './components/Tooltip/index';\n"]}
@@ -1,8 +1,7 @@
1
- import * as React from "react";
2
- import { useTooltip_unstable } from "./useTooltip";
3
- import { renderTooltip_unstable } from "./renderTooltip";
4
- import { useCustomStyleHooks_unstable } from "@fluentui/react-shared-contexts";
5
- import { useTooltipStyles_unstable } from "./useTooltipStyles";
1
+ import { useTooltip_unstable } from './useTooltip';
2
+ import { renderTooltip_unstable } from './renderTooltip';
3
+ import { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';
4
+ import { useTooltipStyles_unstable } from './useTooltipStyles';
6
5
  /**
7
6
  * A tooltip provides light weight contextual information on top of its target element.
8
7
  */
@@ -15,7 +14,7 @@ export const Tooltip = props => {
15
14
  useCustomStyles(state);
16
15
  return renderTooltip_unstable(state);
17
16
  };
18
- Tooltip.displayName = "Tooltip";
17
+ Tooltip.displayName = 'Tooltip';
19
18
  // type casting here is required to ensure internal type FluentTriggerComponent is not leaked
20
19
  Tooltip.isFluentTriggerComponent = true;
21
20
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useTooltip_unstable","renderTooltip_unstable","useCustomStyleHooks_unstable","useTooltipStyles_unstable","Tooltip","props","state","useCustomStyles","displayName","isFluentTriggerComponent"],"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\nimport { useTooltipStyles_unstable } from './useTooltipStyles';\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 const { useTooltipStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(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"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,4BAA4B,QAAQ;AAC7C,SAASC,yBAAyB,QAAQ;AAI1C;;;AAGA,OAAO,MAAMC,OAAA,GAAkCC,KAAA,IAAS;EACtD,MAAMC,KAAA,GAAQN,mBAAA,CAAoBK,KAAA;EAElCF,yBAAA,CAA0BG,KAAA;EAE1B,MAAM;IAAEH,yBAAA,EAA2BI;EAAe,CAAE,GAAGL,4BAAA;EACvDK,eAAA,CAAgBD,KAAA;EAEhB,OAAOL,sBAAA,CAAuBK,KAAA;AAChC;AAEAF,OAAA,CAAQI,WAAW,GAAG;AACtB;AACCJ,OAAA,CAAmCK,wBAAwB,GAAG,IAAI"}
1
+ {"version":3,"names":["useTooltip_unstable","renderTooltip_unstable","useCustomStyleHooks_unstable","useTooltipStyles_unstable","Tooltip","props","state","useCustomStyles","displayName","isFluentTriggerComponent"],"sources":["../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useTooltip_unstable } from './useTooltip';\nimport { renderTooltip_unstable } from './renderTooltip';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\nimport { useTooltipStyles_unstable } from './useTooltipStyles';\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 const { useTooltipStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(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"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAc;AAClD,SAASC,sBAAsB,QAAQ,iBAAiB;AACxD,SAASC,4BAA4B,QAAQ,iCAAiC;AAC9E,SAASC,yBAAyB,QAAQ,oBAAoB;AAI9D;;;AAGA,OAAO,MAAMC,OAAO,GAA2BC,KAAK,IAAG;EACrD,MAAMC,KAAK,GAAGN,mBAAmB,CAACK,KAAK,CAAC;EAExCF,yBAAyB,CAACG,KAAK,CAAC;EAEhC,MAAM;IAAEH,yBAAyB,EAAEI;EAAe,CAAE,GAAGL,4BAA4B,EAAE;EACrFK,eAAe,CAACD,KAAK,CAAC;EAEtB,OAAOL,sBAAsB,CAACK,KAAK,CAAC;AACtC,CAAC;AAEDF,OAAO,CAACI,WAAW,GAAG,SAAS;AAC/B;AACCJ,OAAkC,CAACK,wBAAwB,GAAG,IAAI"}
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ export {};
2
2
  //# sourceMappingURL=Tooltip.types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React"],"sources":["../../../src/components/Tooltip/Tooltip.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState, 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' | 'aria-label' | 'aria-labelledby' | 'onBlur' | 'onFocus' | 'onPointerEnter' | 'onPointerLeave'\n>;\n\n/**\n * Data for the Tooltip's onVisibleChange event.\n */\nexport type OnVisibleChangeData = {\n visible: boolean;\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 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\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?: React.ReactElement | null;\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"],"mappings":"AAAA,YAAYA,KAAA,MAAW"}
1
+ {"version":3,"file":"Tooltip.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/Tooltip.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState, 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' | 'aria-label' | 'aria-labelledby' | 'onBlur' | 'onFocus' | 'onPointerEnter' | 'onPointerLeave'\n>;\n\n/**\n * Data for the Tooltip's onVisibleChange event.\n */\nexport type OnVisibleChangeData = {\n visible: boolean;\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 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\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?: React.ReactElement | null;\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"]}
@@ -1,6 +1,6 @@
1
- export * from "./Tooltip";
2
- export * from "./Tooltip.types";
3
- export * from "./renderTooltip";
4
- export * from "./useTooltip";
5
- export * from "./useTooltipStyles";
1
+ export * from './Tooltip';
2
+ export * from './Tooltip.types';
3
+ export * from './renderTooltip';
4
+ export * from './useTooltip';
5
+ export * from './useTooltipStyles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/components/Tooltip/index.ts"],"sourcesContent":["export * from './Tooltip';\nexport * from './Tooltip.types';\nexport * from './renderTooltip';\nexport * from './useTooltip';\nexport * from './useTooltipStyles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC","sourcesContent":["export * from './Tooltip';\nexport * from './Tooltip.types';\nexport * from './renderTooltip';\nexport * from './useTooltip';\nexport * from './useTooltipStyles';\n"]}
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * The height of the tooltip's arrow in pixels.
3
- */export const arrowHeight = 6;
3
+ */
4
+ export const arrowHeight = 6;
4
5
  /**
5
6
  * The default value of the tooltip's border radius (borderRadiusMedium).
6
7
  *
@@ -1 +1 @@
1
- {"version":3,"names":["arrowHeight","tooltipBorderRadius"],"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"],"mappings":"AAAA;;GAGA,OAAO,MAAMA,WAAA,GAAc;AAE3B;;;;;;;AAOA,OAAO,MAAMC,mBAAA,GAAsB"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/private/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAE7B;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC","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"]}
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- import { Portal } from "@fluentui/react-portal";
3
- import { getSlots } from "@fluentui/react-utilities";
1
+ import * as React from 'react';
2
+ import { Portal } from '@fluentui/react-portal';
3
+ import { getSlots } from '@fluentui/react-utilities';
4
4
  /**
5
5
  * Render the final JSX of Tooltip
6
6
  */
@@ -11,7 +11,9 @@ export const renderTooltip_unstable = state => {
11
11
  } = getSlots(state);
12
12
  return /*#__PURE__*/React.createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/React.createElement(Portal, {
13
13
  mountNode: state.mountNode
14
- }, /*#__PURE__*/React.createElement(slots.content, slotProps.content, state.withArrow && /*#__PURE__*/React.createElement("div", {
14
+ }, /*#__PURE__*/React.createElement(slots.content, {
15
+ ...slotProps.content
16
+ }, state.withArrow && /*#__PURE__*/React.createElement("div", {
15
17
  ref: state.arrowRef,
16
18
  className: state.arrowClassName
17
19
  }), state.content.children)));
@@ -1 +1 @@
1
- {"version":3,"names":["React","Portal","getSlots","renderTooltip_unstable","state","slots","slotProps","createElement","Fragment","children","shouldRenderTooltip","mountNode","content","withArrow","ref","arrowRef","className","arrowClassName"],"sources":["../../../src/components/Tooltip/renderTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\n\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = (state: TooltipState) => {\n const { slots, slotProps } = getSlots<TooltipSlots>(state);\n\n return (\n <>\n {state.children}\n {state.shouldRenderTooltip && (\n <Portal mountNode={state.mountNode}>\n <slots.content {...slotProps.content}>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.content.children}\n </slots.content>\n </Portal>\n )}\n </>\n );\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,QAAQ,QAAQ;AAGzB;;;AAGA,OAAO,MAAMC,sBAAA,GAA0BC,KAAA,IAAwB;EAC7D,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,QAAA,CAAuBE,KAAA;EAEpD,oBACEJ,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACGJ,KAAA,CAAMK,QAAQ,EACdL,KAAA,CAAMM,mBAAmB,iBACxBV,KAAA,CAAAO,aAAA,CAACN,MAAA;IAAOU,SAAA,EAAWP,KAAA,CAAMO;kBACvBX,KAAA,CAAAO,aAAA,CAACF,KAAA,CAAMO,OAAO,EAAKN,SAAA,CAAUM,OAAO,EACjCR,KAAA,CAAMS,SAAS,iBAAIb,KAAA,CAAAO,aAAA,CAAC;IAAIO,GAAA,EAAKV,KAAA,CAAMW,QAAQ;IAAEC,SAAA,EAAWZ,KAAA,CAAMa;MAC9Db,KAAA,CAAMQ,OAAO,CAACH,QAAQ;AAMnC"}
1
+ {"version":3,"names":["React","Portal","getSlots","renderTooltip_unstable","state","slots","slotProps","createElement","Fragment","children","shouldRenderTooltip","mountNode","content","withArrow","ref","arrowRef","className","arrowClassName"],"sources":["../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/renderTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Portal } from '@fluentui/react-portal';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TooltipSlots, TooltipState } from './Tooltip.types';\n\n/**\n * Render the final JSX of Tooltip\n */\nexport const renderTooltip_unstable = (state: TooltipState) => {\n const { slots, slotProps } = getSlots<TooltipSlots>(state);\n\n return (\n <>\n {state.children}\n {state.shouldRenderTooltip && (\n <Portal mountNode={state.mountNode}>\n <slots.content {...slotProps.content}>\n {state.withArrow && <div ref={state.arrowRef} className={state.arrowClassName} />}\n {state.content.children}\n </slots.content>\n </Portal>\n )}\n </>\n );\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,MAAM,QAAQ,wBAAwB;AAC/C,SAASC,QAAQ,QAAQ,2BAA2B;AAGpD;;;AAGA,OAAO,MAAMC,sBAAsB,GAAIC,KAAmB,IAAI;EAC5D,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGJ,QAAQ,CAAeE,KAAK,CAAC;EAE1D,oBACEJ,KAAA,CAAAO,aAAA,CAAAP,KAAA,CAAAQ,QAAA,QACGJ,KAAK,CAACK,QAAQ,EACdL,KAAK,CAACM,mBAAmB,iBACxBV,KAAA,CAAAO,aAAA,CAACN,MAAM;IAACU,SAAS,EAAEP,KAAK,CAACO;EAAS,gBAChCX,KAAA,CAAAO,aAAA,CAACF,KAAK,CAACO,OAAO;IAAA,GAAKN,SAAS,CAACM;EAAO,GACjCR,KAAK,CAACS,SAAS,iBAAIb,KAAA,CAAAO,aAAA;IAAKO,GAAG,EAAEV,KAAK,CAACW,QAAQ;IAAEC,SAAS,EAAEZ,KAAK,CAACa;EAAc,EAAI,EAChFb,KAAK,CAACQ,OAAO,CAACH,QAAQ,CACT,CAEnB,CACA;AAEP,CAAC"}
@@ -1,9 +1,9 @@
1
- import * as React from "react";
2
- import { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from "@fluentui/react-positioning";
3
- import { useTooltipVisibility_unstable as useTooltipVisibility, useFluent_unstable as useFluent } from "@fluentui/react-shared-contexts";
4
- import { applyTriggerPropsToChildren, resolveShorthand, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback } from "@fluentui/react-utilities";
5
- import { arrowHeight, tooltipBorderRadius } from "./private/constants";
6
- import { Escape } from "@fluentui/keyboard-keys";
1
+ import * as React from 'react';
2
+ import { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';
3
+ import { useTooltipVisibility_unstable as useTooltipVisibility, useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
4
+ import { applyTriggerPropsToChildren, resolveShorthand, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild, mergeCallbacks, useEventCallback } from '@fluentui/react-utilities';
5
+ import { arrowHeight, tooltipBorderRadius } from './private/constants';
6
+ import { Escape } from '@fluentui/keyboard-keys';
7
7
  /**
8
8
  * Create the state required to render Tooltip.
9
9
  *
@@ -13,6 +13,7 @@ import { Escape } from "@fluentui/keyboard-keys";
13
13
  * @param props - props from this instance of Tooltip
14
14
  */
15
15
  export const useTooltip_unstable = props => {
16
+ var _a, _b, _c, _d;
16
17
  const context = useTooltipVisibility();
17
18
  const isServerSideRender = useIsSSR();
18
19
  const {
@@ -20,11 +21,11 @@ export const useTooltip_unstable = props => {
20
21
  } = useFluent();
21
22
  const [setDelayTimeout, clearDelayTimeout] = useTimeout();
22
23
  const {
23
- appearance = "normal",
24
+ appearance = 'normal',
24
25
  children,
25
26
  content,
26
27
  withArrow = false,
27
- positioning = "above",
28
+ positioning = 'above',
28
29
  onVisibleChange,
29
30
  relationship,
30
31
  showDelay = 250,
@@ -39,7 +40,7 @@ export const useTooltip_unstable = props => {
39
40
  clearDelayTimeout();
40
41
  setVisibleInternal(oldVisible => {
41
42
  if (newVisible !== oldVisible) {
42
- onVisibleChange?.(ev, {
43
+ onVisibleChange === null || onVisibleChange === void 0 ? void 0 : onVisibleChange(ev, {
43
44
  visible: newVisible
44
45
  });
45
46
  }
@@ -58,21 +59,21 @@ export const useTooltip_unstable = props => {
58
59
  mountNode,
59
60
  // Slots
60
61
  components: {
61
- content: "div"
62
+ content: 'div'
62
63
  },
63
64
  content: resolveShorthand(content, {
64
65
  defaultProps: {
65
- role: "tooltip"
66
+ role: 'tooltip'
66
67
  },
67
68
  required: true
68
69
  })
69
70
  };
70
- state.content.id = useId("tooltip-", state.content.id);
71
+ state.content.id = useId('tooltip-', state.content.id);
71
72
  const positioningOptions = {
72
73
  enabled: state.visible,
73
74
  arrowPadding: 2 * tooltipBorderRadius,
74
- position: "above",
75
- align: "center",
75
+ position: 'above',
76
+ align: 'center',
76
77
  offset: 4,
77
78
  ...resolvePositioningShorthand(state.positioning)
78
79
  };
@@ -90,11 +91,12 @@ export const useTooltip_unstable = props => {
90
91
  // as the visibleTooltip with the TooltipContext.
91
92
  // Also add a listener on document to hide the tooltip if Escape is pressed
92
93
  useIsomorphicLayoutEffect(() => {
94
+ var _a;
93
95
  if (visible) {
94
96
  const thisTooltip = {
95
97
  hide: () => setVisible(false)
96
98
  };
97
- context.visibleTooltip?.hide();
99
+ (_a = context.visibleTooltip) === null || _a === void 0 ? void 0 : _a.hide();
98
100
  context.visibleTooltip = thisTooltip;
99
101
  const onDocumentKeyDown = ev => {
100
102
  if (ev.key === Escape) {
@@ -104,7 +106,7 @@ export const useTooltip_unstable = props => {
104
106
  ev.stopPropagation();
105
107
  }
106
108
  };
107
- targetDocument?.addEventListener("keydown", onDocumentKeyDown, {
109
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {
108
110
  // As this event is added at targeted document,
109
111
  // we need to capture the event to be sure keydown handling from tooltip happens first
110
112
  capture: true
@@ -113,7 +115,7 @@ export const useTooltip_unstable = props => {
113
115
  if (context.visibleTooltip === thisTooltip) {
114
116
  context.visibleTooltip = undefined;
115
117
  }
116
- targetDocument?.removeEventListener("keydown", onDocumentKeyDown, {
118
+ targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
117
119
  capture: true
118
120
  });
119
121
  };
@@ -127,7 +129,7 @@ export const useTooltip_unstable = props => {
127
129
  const ignoreNextFocusEventRef = React.useRef(false);
128
130
  // Listener for onPointerEnter and onFocus on the trigger element
129
131
  const onEnterTrigger = React.useCallback(ev => {
130
- if (ev.type === "focus" && ignoreNextFocusEventRef.current) {
132
+ if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {
131
133
  ignoreNextFocusEventRef.current = false;
132
134
  return;
133
135
  }
@@ -141,10 +143,10 @@ export const useTooltip_unstable = props => {
141
143
  // Listener for onPointerLeave and onBlur on the trigger element
142
144
  const onLeaveTrigger = React.useCallback(ev => {
143
145
  let delay = state.hideDelay;
144
- if (ev.type === "blur") {
146
+ if (ev.type === 'blur') {
145
147
  // Hide immediately when losing focus
146
148
  delay = 0;
147
- ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;
149
+ ignoreNextFocusEventRef.current = (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === ev.target;
148
150
  }
149
151
  setDelayTimeout(() => {
150
152
  setVisible(false, ev);
@@ -159,17 +161,17 @@ export const useTooltip_unstable = props => {
159
161
  state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);
160
162
  const child = getTriggerChild(children);
161
163
  const triggerAriaProps = {};
162
- if (relationship === "label") {
164
+ if (relationship === 'label') {
163
165
  // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
164
- if (typeof state.content.children === "string") {
165
- triggerAriaProps["aria-label"] = state.content.children;
166
+ if (typeof state.content.children === 'string') {
167
+ triggerAriaProps['aria-label'] = state.content.children;
166
168
  } else {
167
- triggerAriaProps["aria-labelledby"] = state.content.id;
169
+ triggerAriaProps['aria-labelledby'] = state.content.id;
168
170
  // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
169
171
  state.shouldRenderTooltip = true;
170
172
  }
171
- } else if (relationship === "description") {
172
- triggerAriaProps["aria-describedby"] = state.content.id;
173
+ } else if (relationship === 'description') {
174
+ triggerAriaProps['aria-describedby'] = state.content.id;
173
175
  // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
174
176
  state.shouldRenderTooltip = true;
175
177
  }
@@ -177,17 +179,17 @@ export const useTooltip_unstable = props => {
177
179
  if (isServerSideRender) {
178
180
  state.shouldRenderTooltip = false;
179
181
  }
180
- const childTargetRef = useMergedRefs(child?.ref, targetRef);
182
+ const childTargetRef = useMergedRefs(child === null || child === void 0 ? void 0 : child.ref, targetRef);
181
183
  // Apply the trigger props to the child, either by calling the render function, or cloning with the new props
182
184
  state.children = applyTriggerPropsToChildren(children, {
183
185
  ...triggerAriaProps,
184
- ...child?.props,
186
+ ...(child === null || child === void 0 ? void 0 : child.props),
185
187
  // If the target prop is not provided, attach targetRef to the trigger element's ref prop
186
- ref: positioningOptions.target === undefined ? childTargetRef : child?.ref,
187
- onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),
188
- onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),
189
- onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),
190
- onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger))
188
+ ref: positioningOptions.target === undefined ? childTargetRef : child === null || child === void 0 ? void 0 : child.ref,
189
+ onPointerEnter: useEventCallback(mergeCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger)),
190
+ onPointerLeave: useEventCallback(mergeCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger)),
191
+ onFocus: useEventCallback(mergeCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger)),
192
+ onBlur: useEventCallback(mergeCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger))
191
193
  });
192
194
  return state;
193
195
  };
@@ -1 +1 @@
1
- {"version":3,"names":["React","mergeArrowOffset","resolvePositioningShorthand","usePositioning","useTooltipVisibility_unstable","useTooltipVisibility","useFluent_unstable","useFluent","applyTriggerPropsToChildren","resolveShorthand","useControllableState","useId","useIsomorphicLayoutEffect","useIsSSR","useMergedRefs","useTimeout","getTriggerChild","mergeCallbacks","useEventCallback","arrowHeight","tooltipBorderRadius","Escape","useTooltip_unstable","props","context","isServerSideRender","targetDocument","setDelayTimeout","clearDelayTimeout","appearance","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","visible","setVisibleInternal","state","initialState","setVisible","useCallback","newVisible","ev","oldVisible","shouldRenderTooltip","components","defaultProps","role","required","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","ref","thisTooltip","hide","visibleTooltip","onDocumentKeyDown","key","stopPropagation","addEventListener","capture","undefined","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","onPointerLeave","onFocus","onBlur","child","triggerAriaProps","childTargetRef"],"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport {\n useTooltipVisibility_unstable as useTooltipVisibility,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport {\n applyTriggerPropsToChildren,\n resolveShorthand,\n useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipChildProps } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */\nexport const useTooltip_unstable = (props: TooltipProps): TooltipState => {\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n const {\n appearance = 'normal',\n children,\n content,\n withArrow = false,\n positioning = 'above',\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\n mountNode,\n } = props;\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const setVisible = React.useCallback(\n (newVisible: boolean, ev?: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (newVisible !== oldVisible) {\n onVisibleChange?.(ev, { visible: newVisible });\n }\n return newVisible;\n });\n },\n [clearDelayTimeout, setVisibleInternal, onVisibleChange],\n );\n\n const state: TooltipState = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\n appearance,\n mountNode,\n // Slots\n components: {\n content: 'div',\n },\n content: resolveShorthand(content, {\n defaultProps: {\n role: 'tooltip',\n },\n required: true,\n }),\n };\n\n state.content.id = useId('tooltip-', state.content.id);\n\n const positioningOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above' as const,\n align: 'center' as const,\n offset: 4,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);\n }\n\n const {\n targetRef,\n containerRef,\n arrowRef,\n }: {\n targetRef: React.MutableRefObject<unknown>;\n containerRef: React.MutableRefObject<HTMLDivElement>;\n arrowRef: React.MutableRefObject<HTMLDivElement>;\n } = usePositioning(positioningOptions);\n\n state.content.ref = useMergedRefs(state.content.ref, containerRef);\n state.arrowRef = arrowRef;\n\n // When this tooltip is visible, hide any other tooltips, and register it\n // as the visibleTooltip with the TooltipContext.\n // Also add a listener on document to hide the tooltip if Escape is pressed\n useIsomorphicLayoutEffect(() => {\n if (visible) {\n const thisTooltip = { hide: () => setVisible(false) };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true,\n });\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [context, targetDocument, visible, setVisible]);\n\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement.\n // See https://github.com/microsoft/fluentui/issues/13541\n const ignoreNextFocusEventRef = React.useRef(false);\n\n // Listener for onPointerEnter and onFocus on the trigger element\n const onEnterTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {\n ignoreNextFocusEventRef.current = false;\n return;\n }\n\n // Show immediately if another tooltip is already visible\n const delay = context.visibleTooltip ? 0 : state.showDelay;\n\n setDelayTimeout(() => {\n setVisible(true, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.showDelay, context],\n );\n\n // Listener for onPointerLeave and onBlur on the trigger element\n const onLeaveTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n let delay = state.hideDelay;\n\n if (ev.type === 'blur') {\n // Hide immediately when losing focus\n delay = 0;\n\n ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;\n }\n\n setDelayTimeout(() => {\n setVisible(false, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.hideDelay, targetDocument],\n );\n\n // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.\n // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);\n\n const child = getTriggerChild(children);\n\n const triggerAriaProps: Pick<TooltipChildProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> = {};\n\n if (relationship === 'label') {\n // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.\n if (typeof state.content.children === 'string') {\n triggerAriaProps['aria-label'] = state.content.children;\n } else {\n triggerAriaProps['aria-labelledby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n } else if (relationship === 'description') {\n triggerAriaProps['aria-describedby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n\n // Don't render the Tooltip in SSR to avoid hydration errors\n if (isServerSideRender) {\n state.shouldRenderTooltip = false;\n }\n\n const childTargetRef = useMergedRefs(child?.ref, targetRef);\n\n // Apply the trigger props to the child, either by calling the render function, or cloning with the new props\n state.children = applyTriggerPropsToChildren(children, {\n ...triggerAriaProps,\n ...child?.props,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : child?.ref,\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger)),\n });\n\n return state;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,gBAAgB,EAAEC,2BAA2B,EAAEC,cAAc,QAAQ;AAC9E,SACEC,6BAAA,IAAiCC,oBAAoB,EACrDC,kBAAA,IAAsBC,SAAS,QAC1B;AACP,SACEC,2BAA2B,EAC3BC,gBAAgB,EAChBC,oBAAoB,EACpBC,KAAK,EACLC,yBAAyB,EACzBC,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,eAAe,EACfC,cAAc,EACdC,gBAAgB,QACX;AAEP,SAASC,WAAW,EAAEC,mBAAmB,QAAQ;AACjD,SAASC,MAAM,QAAQ;AAEvB;;;;;;;;AAQA,OAAO,MAAMC,mBAAA,GAAuBC,KAAA,IAAsC;EACxE,MAAMC,OAAA,GAAUnB,oBAAA;EAChB,MAAMoB,kBAAA,GAAqBZ,QAAA;EAC3B,MAAM;IAAEa;EAAc,CAAE,GAAGnB,SAAA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K;IACf;IACAwC,GAAA,EAAKT,kBAAA,CAAmB6B,MAAM,KAAKX,SAAA,GAAYkB,cAAA,GAAiBF,KAAA,EAAOzB,GAAG;IAC1EqB,cAAA,EAAgBlE,gBAAA,CAAiBD,cAAA,CAAeuE,KAAA,EAAOjE,KAAA,EAAO6D,cAAA,EAAgBR,cAAA;IAC9ES,cAAA,EAAgBnE,gBAAA,CAAiBD,cAAA,CAAeuE,KAAA,EAAOjE,KAAA,EAAO8D,cAAA,EAAgBJ,cAAA;IAC9EK,OAAA,EAASpE,gBAAA,CAAiBD,cAAA,CAAeuE,KAAA,EAAOjE,KAAA,EAAO+D,OAAA,EAASV,cAAA;IAChEW,MAAA,EAAQrE,gBAAA,CAAiBD,cAAA,CAAeuE,KAAA,EAAOjE,KAAA,EAAOgE,MAAA,EAAQN,cAAA;EAChE;EAEA,OAAOxC,KAAA;AACT"}
1
+ {"version":3,"names":["React","mergeArrowOffset","resolvePositioningShorthand","usePositioning","useTooltipVisibility_unstable","useTooltipVisibility","useFluent_unstable","useFluent","applyTriggerPropsToChildren","resolveShorthand","useControllableState","useId","useIsomorphicLayoutEffect","useIsSSR","useMergedRefs","useTimeout","getTriggerChild","mergeCallbacks","useEventCallback","arrowHeight","tooltipBorderRadius","Escape","useTooltip_unstable","props","context","isServerSideRender","targetDocument","setDelayTimeout","clearDelayTimeout","appearance","children","content","withArrow","positioning","onVisibleChange","relationship","showDelay","hideDelay","mountNode","visible","setVisibleInternal","state","initialState","setVisible","useCallback","newVisible","ev","oldVisible","shouldRenderTooltip","components","defaultProps","role","required","id","positioningOptions","enabled","arrowPadding","position","align","offset","targetRef","containerRef","arrowRef","ref","thisTooltip","hide","_a","visibleTooltip","onDocumentKeyDown","key","stopPropagation","addEventListener","capture","undefined","removeEventListener","ignoreNextFocusEventRef","useRef","onEnterTrigger","type","current","delay","persist","onLeaveTrigger","activeElement","target","onPointerEnter","onPointerLeave","onFocus","onBlur","child","triggerAriaProps","childTargetRef","_b","_c","_d"],"sources":["../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx"],"sourcesContent":["import * as React from 'react';\nimport { mergeArrowOffset, resolvePositioningShorthand, usePositioning } from '@fluentui/react-positioning';\nimport {\n useTooltipVisibility_unstable as useTooltipVisibility,\n useFluent_unstable as useFluent,\n} from '@fluentui/react-shared-contexts';\nimport {\n applyTriggerPropsToChildren,\n resolveShorthand,\n useControllableState,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n mergeCallbacks,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipChildProps } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\nimport { Escape } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render Tooltip.\n *\n * The returned state can be modified with hooks such as useTooltipStyles_unstable,\n * before being passed to renderTooltip_unstable.\n *\n * @param props - props from this instance of Tooltip\n */\nexport const useTooltip_unstable = (props: TooltipProps): TooltipState => {\n const context = useTooltipVisibility();\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n const {\n appearance = 'normal',\n children,\n content,\n withArrow = false,\n positioning = 'above',\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\n mountNode,\n } = props;\n\n const [visible, setVisibleInternal] = useControllableState({ state: props.visible, initialState: false });\n const setVisible = React.useCallback(\n (newVisible: boolean, ev?: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n clearDelayTimeout();\n setVisibleInternal(oldVisible => {\n if (newVisible !== oldVisible) {\n onVisibleChange?.(ev, { visible: newVisible });\n }\n return newVisible;\n });\n },\n [clearDelayTimeout, setVisibleInternal, onVisibleChange],\n );\n\n const state: TooltipState = {\n withArrow,\n positioning,\n showDelay,\n hideDelay,\n relationship,\n visible,\n shouldRenderTooltip: visible,\n appearance,\n mountNode,\n // Slots\n components: {\n content: 'div',\n },\n content: resolveShorthand(content, {\n defaultProps: {\n role: 'tooltip',\n },\n required: true,\n }),\n };\n\n state.content.id = useId('tooltip-', state.content.id);\n\n const positioningOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above' as const,\n align: 'center' as const,\n offset: 4,\n ...resolvePositioningShorthand(state.positioning),\n };\n\n if (state.withArrow) {\n positioningOptions.offset = mergeArrowOffset(positioningOptions.offset, arrowHeight);\n }\n\n const {\n targetRef,\n containerRef,\n arrowRef,\n }: {\n targetRef: React.MutableRefObject<unknown>;\n containerRef: React.MutableRefObject<HTMLDivElement>;\n arrowRef: React.MutableRefObject<HTMLDivElement>;\n } = usePositioning(positioningOptions);\n\n state.content.ref = useMergedRefs(state.content.ref, containerRef);\n state.arrowRef = arrowRef;\n\n // When this tooltip is visible, hide any other tooltips, and register it\n // as the visibleTooltip with the TooltipContext.\n // Also add a listener on document to hide the tooltip if Escape is pressed\n useIsomorphicLayoutEffect(() => {\n if (visible) {\n const thisTooltip = { hide: () => setVisible(false) };\n\n context.visibleTooltip?.hide();\n context.visibleTooltip = thisTooltip;\n\n const onDocumentKeyDown = (ev: KeyboardEvent) => {\n if (ev.key === Escape) {\n thisTooltip.hide();\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover, Menu\n ev.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, {\n // As this event is added at targeted document,\n // we need to capture the event to be sure keydown handling from tooltip happens first\n capture: true,\n });\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [context, targetDocument, visible, setVisible]);\n\n // The focused element gets a blur event when the document loses focus\n // (e.g. switching tabs in the browser), but we don't want to show the\n // tooltip again when the document gets focus back. Handle this case by\n // checking if the blurred element is still the document's activeElement.\n // See https://github.com/microsoft/fluentui/issues/13541\n const ignoreNextFocusEventRef = React.useRef(false);\n\n // Listener for onPointerEnter and onFocus on the trigger element\n const onEnterTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n if (ev.type === 'focus' && ignoreNextFocusEventRef.current) {\n ignoreNextFocusEventRef.current = false;\n return;\n }\n\n // Show immediately if another tooltip is already visible\n const delay = context.visibleTooltip ? 0 : state.showDelay;\n\n setDelayTimeout(() => {\n setVisible(true, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.showDelay, context],\n );\n\n // Listener for onPointerLeave and onBlur on the trigger element\n const onLeaveTrigger = React.useCallback(\n (ev: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement>) => {\n let delay = state.hideDelay;\n\n if (ev.type === 'blur') {\n // Hide immediately when losing focus\n delay = 0;\n\n ignoreNextFocusEventRef.current = targetDocument?.activeElement === ev.target;\n }\n\n setDelayTimeout(() => {\n setVisible(false, ev);\n }, delay);\n\n ev.persist(); // Persist the event since the setVisible call will happen asynchronously\n },\n [setDelayTimeout, setVisible, state.hideDelay, targetDocument],\n );\n\n // Cancel the hide timer when the mouse or focus enters the tooltip, and restart it when the mouse or focus leaves.\n // This keeps the tooltip visible when the mouse is moved over it, or it has focus within.\n state.content.onPointerEnter = mergeCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = mergeCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n state.content.onFocus = mergeCallbacks(state.content.onFocus, clearDelayTimeout);\n state.content.onBlur = mergeCallbacks(state.content.onBlur, onLeaveTrigger);\n\n const child = getTriggerChild(children);\n\n const triggerAriaProps: Pick<TooltipChildProps, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> = {};\n\n if (relationship === 'label') {\n // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.\n if (typeof state.content.children === 'string') {\n triggerAriaProps['aria-label'] = state.content.children;\n } else {\n triggerAriaProps['aria-labelledby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n } else if (relationship === 'description') {\n triggerAriaProps['aria-describedby'] = state.content.id;\n // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element\n state.shouldRenderTooltip = true;\n }\n\n // Don't render the Tooltip in SSR to avoid hydration errors\n if (isServerSideRender) {\n state.shouldRenderTooltip = false;\n }\n\n const childTargetRef = useMergedRefs(child?.ref, targetRef);\n\n // Apply the trigger props to the child, either by calling the render function, or cloning with the new props\n state.children = applyTriggerPropsToChildren(children, {\n ...triggerAriaProps,\n ...child?.props,\n // If the target prop is not provided, attach targetRef to the trigger element's ref prop\n ref: positioningOptions.target === undefined ? childTargetRef : child?.ref,\n onPointerEnter: useEventCallback(mergeCallbacks(child?.props?.onPointerEnter, onEnterTrigger)),\n onPointerLeave: useEventCallback(mergeCallbacks(child?.props?.onPointerLeave, onLeaveTrigger)),\n onFocus: useEventCallback(mergeCallbacks(child?.props?.onFocus, onEnterTrigger)),\n onBlur: useEventCallback(mergeCallbacks(child?.props?.onBlur, onLeaveTrigger)),\n });\n\n return state;\n};\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,EAAEC,2BAA2B,EAAEC,cAAc,QAAQ,6BAA6B;AAC3G,SACEC,6BAA6B,IAAIC,oBAAoB,EACrDC,kBAAkB,IAAIC,SAAS,QAC1B,iCAAiC;AACxC,SACEC,2BAA2B,EAC3BC,gBAAgB,EAChBC,oBAAoB,EACpBC,KAAK,EACLC,yBAAyB,EACzBC,QAAQ,EACRC,aAAa,EACbC,UAAU,EACVC,eAAe,EACfC,cAAc,EACdC,gBAAgB,QACX,2BAA2B;AAElC,SAASC,WAAW,EAAEC,mBAAmB,QAAQ,qBAAqB;AACtE,SAASC,MAAM,QAAQ,yBAAyB;AAEhD;;;;;;;;AAQA,OAAO,MAAMC,mBAAmB,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GAAAJ,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAElE,KAAK,cAAAsE,EAAA,uBAAAA,EAAA,CAAEN,OAAO,EAAEV,cAAc,CAAC,CAAC;IAChFW,MAAM,EAAEtE,gBAAgB,CAACD,cAAc,CAAC,CAAA6E,EAAA,GAAAL,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAElE,KAAK,cAAAuE,EAAA,uBAAAA,EAAA,CAAEN,MAAM,EAAEN,cAAc,CAAC;GAC9E,CAAC;EAEF,OAAOzC,KAAK;AACd,CAAC"}
@@ -1,9 +1,9 @@
1
- import { shorthands, __styles, mergeClasses } from "@griffel/react";
2
- import { createArrowStyles } from "@fluentui/react-positioning";
3
- import { tokens } from "@fluentui/react-theme";
4
- import { arrowHeight } from "./private/constants";
1
+ import { shorthands, __styles, mergeClasses } from '@griffel/react';
2
+ import { createArrowStyles } from '@fluentui/react-positioning';
3
+ import { tokens } from '@fluentui/react-theme';
4
+ import { arrowHeight } from './private/constants';
5
5
  export const tooltipClassNames = {
6
- content: "fui-Tooltip__content"
6
+ content: 'fui-Tooltip__content'
7
7
  };
8
8
  /**
9
9
  * Styles for the tooltip
@@ -87,7 +87,7 @@ const useStyles = /*#__PURE__*/__styles({
87
87
  */
88
88
  export const useTooltipStyles_unstable = state => {
89
89
  const styles = useStyles();
90
- state.content.className = mergeClasses(tooltipClassNames.content, styles.root, state.appearance === "inverted" && styles.inverted, state.visible && styles.visible, state.content.className);
90
+ state.content.className = mergeClasses(tooltipClassNames.content, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.content.className);
91
91
  state.arrowClassName = styles.arrow;
92
92
  return state;
93
93
  };
@@ -1 +1 @@
1
- {"version":3,"names":["shorthands","__styles","mergeClasses","createArrowStyles","tokens","arrowHeight","tooltipClassNames","content","useStyles","root","mc9l5x","B7ck84d","B2u0y6b","Bceei9c","Bahqtrf","Be2twd7","Bg96gwp","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","z8tnut","z189sj","Byoj8tv","uwmqm3","De3pzq","sj55zd","Bhu2qc9","visible","inverted","arrow","qhf8xq","Bcdw1i0","Bj3rh1h","a9b677","Bqenvij","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","useTooltipStyles_unstable","state","styles","className","appearance","arrowClassName"],"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"sourcesContent":["import { shorthands, 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\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n ...shorthands.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 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 state.content.className = mergeClasses(\n tooltipClassNames.content,\n styles.root,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.content.className,\n );\n\n state.arrowClassName = styles.arrow;\n\n return state;\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAAC,QAAA,EAAcC,YAAY,QAAQ;AACrD,SAASC,iBAAiB,QAAQ;AAClC,SAASC,MAAM,QAAQ;AACvB,SAASC,WAAW,QAAQ;AAI5B,OAAO,MAAMC,iBAAA,GAAkD;EAC7DC,OAAA,EAAS;AACX;AAEA;;;AAGA,MAAMC,SAAA,gBAAYP,QAAA;EAAAQ,IAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,OAAA;IAAA9B,MAAA;EAAA;EAAA+B,QAAA;IAAAJ,MAAA;IAAAC,MAAA;EAAA;EAAAI,KAAA;IAAAC,MAAA;IAAAN,MAAA;IAAAO,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAgClB;AAEA;;;AAGA,OAAO,MAAMC,yBAAA,GAA6BC,KAAA,IAAsC;EAC9E,MAAMC,MAAA,GAASlE,SAAA;EAEfiE,KAAA,CAAMlE,OAAO,CAACoE,SAAS,GAAGzE,YAAA,CACxBI,iBAAA,CAAkBC,OAAO,EACzBmE,MAAA,CAAOjE,IAAI,EACXgE,KAAA,CAAMG,UAAU,KAAK,cAAcF,MAAA,CAAOjC,QAAQ,EAClDgC,KAAA,CAAMjC,OAAO,IAAIkC,MAAA,CAAOlC,OAAO,EAC/BiC,KAAA,CAAMlE,OAAO,CAACoE,SAAS;EAGzBF,KAAA,CAAMI,cAAc,GAAGH,MAAA,CAAOhC,KAAK;EAEnC,OAAO+B,KAAA;AACT"}
1
+ {"version":3,"names":["shorthands","__styles","mergeClasses","createArrowStyles","tokens","arrowHeight","tooltipClassNames","content","useStyles","root","mc9l5x","B7ck84d","B2u0y6b","Bceei9c","Bahqtrf","Be2twd7","Bg96gwp","Bbmb7ep","Beyfa6y","B7oj6ja","Btl43ni","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","z8tnut","z189sj","Byoj8tv","uwmqm3","De3pzq","sj55zd","Bhu2qc9","visible","inverted","arrow","qhf8xq","Bcdw1i0","Bj3rh1h","a9b677","Bqenvij","Ftih45","B1puzpu","Brfgrao","Bcvre1j","Ccq8qp","Baz25je","cmx5o7","B4f6apu","m598lv","Bk5zm6e","y0oebl","qa3bma","Bqjgrrk","Budzafs","Hv9wc6","hl6cv3","Bh2vraf","yayu3t","wedwtw","rhl9o9","Bu8t5uz","B6q6orb","Bwwlvwl","d","useTooltipStyles_unstable","state","styles","className","appearance","arrowClassName"],"sources":["../../../../../../../../../packages/react-components/react-tooltip/src/components/Tooltip/useTooltipStyles.ts"],"sourcesContent":["import { shorthands, 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\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n ...shorthands.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 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 state.content.className = mergeClasses(\n tooltipClassNames.content,\n styles.root,\n state.appearance === 'inverted' && styles.inverted,\n state.visible && styles.visible,\n state.content.className,\n );\n\n state.arrowClassName = styles.arrow;\n\n return state;\n};\n"],"mappings":"AAAA,SAASA,UAAU,EAAAC,QAAA,EAAcC,YAAY,QAAQ,gBAAgB;AACrE,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,SAASC,MAAM,QAAQ,uBAAuB;AAC9C,SAASC,WAAW,QAAQ,qBAAqB;AAIjD,OAAO,MAAMC,iBAAiB,GAAiC;EAC7DC,OAAO,EAAE;CACV;AAED;;;AAGA,MAAMC,SAAS,gBAAGP,QAAA;EAAAQ,IAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;EAAAC,OAAA;IAAA9B,MAAA;EAAA;EAAA+B,QAAA;IAAAJ,MAAA;IAAAC,MAAA;EAAA;EAAAI,KAAA;IAAAC,MAAA;IAAAN,MAAA;IAAAO,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAgChB;AAEF;;;AAGA,OAAO,MAAMC,yBAAyB,GAAIC,KAAmB,IAAkB;EAC7E,MAAMC,MAAM,GAAGlE,SAAS,EAAE;EAE1BiE,KAAK,CAAClE,OAAO,CAACoE,SAAS,GAAGzE,YAAY,CACpCI,iBAAiB,CAACC,OAAO,EACzBmE,MAAM,CAACjE,IAAI,EACXgE,KAAK,CAACG,UAAU,KAAK,UAAU,IAAIF,MAAM,CAACjC,QAAQ,EAClDgC,KAAK,CAACjC,OAAO,IAAIkC,MAAM,CAAClC,OAAO,EAC/BiC,KAAK,CAAClE,OAAO,CAACoE,SAAS,CACxB;EAEDF,KAAK,CAACI,cAAc,GAAGH,MAAM,CAAChC,KAAK;EAEnC,OAAO+B,KAAK;AACd,CAAC"}
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { Tooltip, renderTooltip_unstable, tooltipClassNames, useTooltipStyles_unstable, useTooltip_unstable } from "./Tooltip";
1
+ export { Tooltip, renderTooltip_unstable, tooltipClassNames, useTooltipStyles_unstable, useTooltip_unstable } from './Tooltip';
2
2
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Tooltip","renderTooltip_unstable","tooltipClassNames","useTooltipStyles_unstable","useTooltip_unstable"],"sources":["../src/index.ts"],"sourcesContent":["export {\n Tooltip,\n renderTooltip_unstable,\n tooltipClassNames,\n useTooltipStyles_unstable,\n useTooltip_unstable,\n} from './Tooltip';\nexport type {\n OnVisibleChangeData,\n TooltipProps,\n TooltipSlots,\n TooltipState,\n TooltipChildProps as TooltipTriggerProps,\n} from './Tooltip';\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,QACd"}
1
+ {"version":3,"names":["Tooltip","renderTooltip_unstable","tooltipClassNames","useTooltipStyles_unstable","useTooltip_unstable"],"sources":["../../../../../../../packages/react-components/react-tooltip/src/index.ts"],"sourcesContent":["export {\n Tooltip,\n renderTooltip_unstable,\n tooltipClassNames,\n useTooltipStyles_unstable,\n useTooltip_unstable,\n} from './Tooltip';\nexport type {\n OnVisibleChangeData,\n TooltipProps,\n TooltipSlots,\n TooltipState,\n TooltipChildProps as TooltipTriggerProps,\n} from './Tooltip';\n"],"mappings":"AAAA,SACEA,OAAO,EACPC,sBAAsB,EACtBC,iBAAiB,EACjBC,yBAAyB,EACzBC,mBAAmB,QACd,WAAW"}