@fluentui/react-tooltip 0.0.0-nightlyfbae36b19b20211111.1 → 0.0.0-nightlyfc5cfdc52420220215.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. package/CHANGELOG.json +323 -22
  2. package/CHANGELOG.md +78 -14
  3. package/dist/react-tooltip.d.ts +28 -47
  4. package/lib/components/Tooltip/Tooltip.d.ts +3 -2
  5. package/lib/components/Tooltip/Tooltip.js +9 -9
  6. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  7. package/lib/components/Tooltip/Tooltip.types.d.ts +22 -38
  8. package/lib/components/Tooltip/private/constants.d.ts +12 -0
  9. package/lib/components/Tooltip/private/constants.js +14 -0
  10. package/lib/components/Tooltip/private/constants.js.map +1 -0
  11. package/lib/components/Tooltip/renderTooltip.d.ts +1 -1
  12. package/lib/components/Tooltip/renderTooltip.js +5 -4
  13. package/lib/components/Tooltip/renderTooltip.js.map +1 -1
  14. package/lib/components/Tooltip/useTooltip.d.ts +3 -6
  15. package/lib/components/Tooltip/useTooltip.js +45 -57
  16. package/lib/components/Tooltip/useTooltip.js.map +1 -1
  17. package/lib/components/Tooltip/useTooltipStyles.d.ts +1 -1
  18. package/lib/components/Tooltip/useTooltipStyles.js +47 -21
  19. package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
  20. package/lib-commonjs/components/Tooltip/Tooltip.d.ts +3 -2
  21. package/lib-commonjs/components/Tooltip/Tooltip.js +8 -7
  22. package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
  23. package/lib-commonjs/components/Tooltip/Tooltip.types.d.ts +22 -38
  24. package/lib-commonjs/components/Tooltip/private/constants.d.ts +12 -0
  25. package/lib-commonjs/components/Tooltip/private/constants.js +21 -0
  26. package/lib-commonjs/components/Tooltip/private/constants.js.map +1 -0
  27. package/lib-commonjs/components/Tooltip/renderTooltip.d.ts +1 -1
  28. package/lib-commonjs/components/Tooltip/renderTooltip.js +7 -6
  29. package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
  30. package/lib-commonjs/components/Tooltip/useTooltip.d.ts +3 -6
  31. package/lib-commonjs/components/Tooltip/useTooltip.js +50 -61
  32. package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
  33. package/lib-commonjs/components/Tooltip/useTooltipStyles.d.ts +1 -1
  34. package/lib-commonjs/components/Tooltip/useTooltipStyles.js +53 -24
  35. package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
  36. package/package.json +12 -14
  37. package/lib/common/isConformant.d.ts +0 -4
  38. package/lib/common/isConformant.js +0 -11
  39. package/lib/common/isConformant.js.map +0 -1
  40. package/lib-commonjs/common/isConformant.d.ts +0 -4
  41. package/lib-commonjs/common/isConformant.js +0 -22
  42. package/lib-commonjs/common/isConformant.js.map +0 -1
@@ -1,4 +1,7 @@
1
- import { __styles, mergeClasses } from '@fluentui/react-make-styles';
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';
2
5
  export const tooltipClassName = 'fui-Tooltip';
3
6
  /**
4
7
  * Styles for the tooltip
@@ -7,17 +10,33 @@ export const tooltipClassName = 'fui-Tooltip';
7
10
  const useStyles = /*#__PURE__*/__styles({
8
11
  "root": {
9
12
  "mc9l5x": "fjseox",
10
- "z8tnut": "f1sbtcvk",
11
- "z189sj": ["f11qrl6u", "fjlbh76"],
12
- "Byoj8tv": "fy7v416",
13
- "uwmqm3": ["fjlbh76", "f11qrl6u"],
13
+ "B7ck84d": "f1ewtqcl",
14
14
  "B2u0y6b": "f132xexn",
15
15
  "Bceei9c": "f158kwzp",
16
16
  "Bahqtrf": "fk6fouc",
17
17
  "Be2twd7": "fy9rknc",
18
18
  "Bg96gwp": "fwrc4pm",
19
- "Dimara": "ft85np5",
20
- "ayd6f0": "fcm7iae",
19
+ "Bbmb7ep": ["f1aa9q02", "f16jpd5f"],
20
+ "Beyfa6y": ["f16jpd5f", "f1aa9q02"],
21
+ "B7oj6ja": ["f1jar5jt", "fyu767a"],
22
+ "Btl43ni": ["fyu767a", "f1jar5jt"],
23
+ "B4j52fo": "f5ogflp",
24
+ "Bekrc4i": ["f1hqa2wf", "finvdd3"],
25
+ "Bn0qgzm": "f1f09k3d",
26
+ "ibv6hh": ["finvdd3", "f1hqa2wf"],
27
+ "icvyot": "fzkkow9",
28
+ "vrafjx": ["fcdblym", "fjik90z"],
29
+ "oivjwe": "fg706s2",
30
+ "wvpqe5": ["fjik90z", "fcdblym"],
31
+ "g2u3we": "fghlq4f",
32
+ "h3c5rm": ["f1gn591s", "fjscplz"],
33
+ "B9xav0g": "fb073pr",
34
+ "zhjwy3": ["fjscplz", "f1gn591s"],
35
+ "z8tnut": "f10ra9hq",
36
+ "z189sj": ["fd9xhir", "f1jlaasf"],
37
+ "Byoj8tv": "f1d7kygh",
38
+ "uwmqm3": ["f1jlaasf", "fd9xhir"],
39
+ "De3pzq": "fxugw4r",
21
40
  "sj55zd": "f19n0e5",
22
41
  "Bhu2qc9": "fxeb0a7"
23
42
  },
@@ -25,44 +44,51 @@ const useStyles = /*#__PURE__*/__styles({
25
44
  "mc9l5x": "ftgm304"
26
45
  },
27
46
  "inverted": {
28
- "ayd6f0": "fdr7u1v",
47
+ "De3pzq": "f5pduvr",
29
48
  "sj55zd": "fqpbvvt"
30
49
  },
31
50
  "arrow": {
32
51
  "qhf8xq": "f1euv43f",
33
- "a9b677": "fpkirms",
34
- "Bqenvij": "ftt2rgf",
35
- "ayd6f0": "f1uo6wrk",
52
+ "De3pzq": "f1u2r49w",
36
53
  "Bcdw1i0": "fd7fpy0",
37
54
  "Bj3rh1h": "f1bsuimh",
55
+ "a9b677": "f1ekdpwm",
56
+ "Bqenvij": "f83vc9z",
38
57
  "rurcny": "fuzzvh5",
58
+ "Bex5imi": "fkk33zh",
39
59
  "xx9plb": "fxf9f1y",
60
+ "Bmqnesq": "f170vdtw",
40
61
  "Bdn98qo": "f103af6e",
41
62
  "Bbc2r3f": "f15umuo5",
42
- "B4zgs9e": "ffo048g",
43
- "Bex5imi": "fkk33zh",
63
+ "B1dvbpk": "f3wpjpt",
64
+ "D4ky5z": "f1k3tce7",
65
+ "cqycoz": "f1dkdgqi",
66
+ "I89eb": "f5ghsz",
67
+ "k1i1uq": "fyqop9u",
68
+ "Epwjcz": "f1m5ya7j",
69
+ "Bp1vogq": "f3sp63x",
44
70
  "px8gyy": ["f5bg3dr", "f1rfdd74"],
45
- "h6z6rw": ["fzd2j21", "f2549he"],
46
- "hl6cv3": "fotnskf",
71
+ "h6z6rw": "fzd2j21",
72
+ "hl6cv3": "f1773hnp",
47
73
  "Bh2vraf": "f1n8855c",
48
- "yayu3t": ["f1nq055x", "f13ohf3"],
74
+ "yayu3t": "f1v7783n",
49
75
  "wedwtw": "fsw6im5",
50
- "rhl9o9": "ftghsr9",
76
+ "rhl9o9": "fh2hsk5",
51
77
  "Bu8t5uz": "f159pzir",
52
- "B6q6orb": ["f1l8vbt4", "fsxzh25"],
78
+ "B6q6orb": "f11yvu4",
53
79
  "Bwwlvwl": "fm1ycve"
54
80
  }
55
81
  }, {
56
- "d": [".fjseox{display:none;}", ".f1sbtcvk{padding-top:5px;}", ".f11qrl6u{padding-right:12px;}", ".fjlbh76{padding-left:12px;}", ".fy7v416{padding-bottom:7px;}", ".f132xexn{max-width:240px;}", ".f158kwzp{cursor:default;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".ft85np5{border-radius:var(--borderRadiusMedium);}", ".fcm7iae{background:var(--colorNeutralBackground1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxeb0a7{-webkit-filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));}", ".ftgm304{display:block;}", ".fdr7u1v{background:var(--colorNeutralForeground2);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".f1euv43f{position:absolute;}", ".fpkirms{width:8.485px;}", ".ftt2rgf{height:8.485px;}", ".f1uo6wrk{background:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".fuzzvh5:before{content:\"\";}", ".fxf9f1y:before{position:absolute;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".ffo048g:before{background:inherit;}", ".fkk33zh:before{visibility:visible;}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", ".f2549he:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(-45deg);}", "[data-popper-placement^=\"top\"] .fotnskf{bottom:0;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1nq055x{left:0;}", "[data-popper-placement^=\"right\"] .f13ohf3{right:0;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .ftghsr9{top:0;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f1l8vbt4{right:0;}", "[data-popper-placement^=\"left\"] .fsxzh25{left:0;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
82
+ "d": [".fjseox{display:none;}", ".f1ewtqcl{box-sizing:border-box;}", ".f132xexn{max-width:240px;}", ".f158kwzp{cursor:default;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f5ogflp{border-top-width:1px;}", ".f1hqa2wf{border-right-width:1px;}", ".finvdd3{border-left-width:1px;}", ".f1f09k3d{border-bottom-width:1px;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".fghlq4f{border-top-color:var(--colorTransparentStroke);}", ".f1gn591s{border-right-color:var(--colorTransparentStroke);}", ".fjscplz{border-left-color:var(--colorTransparentStroke);}", ".fb073pr{border-bottom-color:var(--colorTransparentStroke);}", ".f10ra9hq{padding-top:4px;}", ".fd9xhir{padding-right:11px;}", ".f1jlaasf{padding-left:11px;}", ".f1d7kygh{padding-bottom:6px;}", ".fxugw4r{background-color:var(--colorNeutralBackground1);}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fxeb0a7{-webkit-filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));filter:drop-shadow(0 0 2px var(--colorNeutralShadowAmbient)) drop-shadow(0 4px 8px var(--colorNeutralShadowKey));}", ".ftgm304{display:block;}", ".f5pduvr{background-color:var(--colorNeutralBackgroundInverted);}", ".fqpbvvt{color:var(--colorNeutralForegroundInverted);}", ".f1euv43f{position:absolute;}", ".f1u2r49w{background-color:inherit;}", ".fd7fpy0{visibility:hidden;}", ".f1bsuimh{z-index:-1;}", ".f1ekdpwm{width:8.484px;}", ".f83vc9z{height:8.484px;}", ".fuzzvh5:before{content:\"\";}", ".fkk33zh:before{visibility:visible;}", ".fxf9f1y:before{position:absolute;}", ".f170vdtw:before{box-sizing:border-box;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".f3wpjpt:before{background-color:inherit;}", ".f1k3tce7:before{border-right-width:1px;}", ".f1dkdgqi:before{border-right-style:solid;}", ".f5ghsz:before{border-right-color:var(--colorTransparentStroke);}", ".fyqop9u:before{border-bottom-width:1px;}", ".f1m5ya7j:before{border-bottom-style:solid;}", ".f3sp63x:before{border-bottom-color:var(--colorTransparentStroke);}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fzd2j21:before{-webkit-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-moz-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);-ms-transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);transform:rotate(var(--angle)) translate(0, 50%) rotate(45deg);}", "[data-popper-placement^=\"top\"] .f1773hnp{bottom:-1px;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .f1v7783n{left:-1px;}", "[data-popper-placement^=\"right\"] .fsw6im5{--angle:90deg;}", "[data-popper-placement^=\"bottom\"] .fh2hsk5{top:-1px;}", "[data-popper-placement^=\"bottom\"] .f159pzir{--angle:180deg;}", "[data-popper-placement^=\"left\"] .f11yvu4{right:-1px;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
57
83
  });
58
84
  /**
59
85
  * Apply styling to the Tooltip slots based on the state
60
86
  */
61
87
 
62
88
 
63
- export const useTooltipStyles = state => {
89
+ export const useTooltipStyles_unstable = state => {
64
90
  const styles = useStyles();
65
- state.root.className = mergeClasses(tooltipClassName, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.root.className);
91
+ state.content.className = mergeClasses(tooltipClassName, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.content.className);
66
92
  state.arrowClassName = styles.arrow;
67
93
  return state;
68
94
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AAGA,OAAO,MAAM,gBAAgB,GAAG,aAAzB;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAwDA;;AAEG;;;AACH,OAAO,MAAM,gBAAgB,GAAI,KAAD,IAAsC;AACpE,QAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,gBADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QAHT,EAIjC,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAJS,EAKjC,KAAK,CAAC,IAAN,CAAW,SALsB,CAAnC;AAQA,EAAA,KAAK,CAAC,cAAN,GAAuB,MAAM,CAAC,KAA9B;AAEA,SAAO,KAAP;AACD,CAdM","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,gBAArD;AACA,SAAS,iBAAT,QAAkC,6BAAlC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,WAAT,QAA4B,qBAA5B;AAGA,OAAO,MAAM,gBAAgB,GAAG,aAAzB;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAkCA;;AAEG;;;AACH,OAAO,MAAM,yBAAyB,GAAI,KAAD,IAAsC;AAC7E,QAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,OAAN,CAAc,SAAd,GAA0B,YAAY,CACpC,gBADoC,EAEpC,MAAM,CAAC,IAF6B,EAGpC,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QAHN,EAIpC,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAJY,EAKpC,KAAK,CAAC,OAAN,CAAc,SALsB,CAAtC;AAQA,EAAA,KAAK,CAAC,cAAN,GAAuB,MAAM,CAAC,KAA9B;AAEA,SAAO,KAAP;AACD,CAdM","sourceRoot":""}
@@ -1,6 +1,7 @@
1
+ import * as React from 'react';
1
2
  import type { TooltipProps } from './Tooltip.types';
2
- import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
3
4
  /**
4
5
  * A tooltip provides light weight contextual information on top of its target element.
5
6
  */
6
- export declare const Tooltip: ForwardRefComponent<TooltipProps>;
7
+ export declare const Tooltip: React.FC<TooltipProps> & FluentTriggerComponent;
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Tooltip = void 0;
7
7
 
8
- const React = /*#__PURE__*/require("react");
9
-
10
8
  const useTooltip_1 = /*#__PURE__*/require("./useTooltip");
11
9
 
12
10
  const renderTooltip_1 = /*#__PURE__*/require("./renderTooltip");
@@ -17,10 +15,13 @@ const useTooltipStyles_1 = /*#__PURE__*/require("./useTooltipStyles");
17
15
  */
18
16
 
19
17
 
20
- exports.Tooltip = /*#__PURE__*/React.forwardRef((props, ref) => {
21
- const state = useTooltip_1.useTooltip(props, ref);
22
- useTooltipStyles_1.useTooltipStyles(state);
23
- return renderTooltip_1.renderTooltip(state);
24
- });
18
+ const Tooltip = props => {
19
+ const state = useTooltip_1.useTooltip_unstable(props);
20
+ useTooltipStyles_1.useTooltipStyles_unstable(state);
21
+ return renderTooltip_1.renderTooltip_unstable(state);
22
+ };
23
+
24
+ exports.Tooltip = Tooltip;
25
25
  exports.Tooltip.displayName = 'Tooltip';
26
+ exports.Tooltip.isFluentTriggerComponent = true;
26
27
  //# sourceMappingURL=Tooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,OAAA,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACxF,QAAM,KAAK,GAAG,YAAA,CAAA,UAAA,CAAW,KAAX,EAAkB,GAAlB,CAAd;AAEA,EAAA,kBAAA,CAAA,gBAAA,CAAiB,KAAjB;AACA,SAAO,eAAA,CAAA,aAAA,CAAc,KAAd,CAAP;AACD,CALyD,CAA7C;AAOb,OAAA,CAAA,OAAA,CAAQ,WAAR,GAAsB,SAAtB","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":";;;;;;;AACA,MAAA,YAAA,gBAAA,OAAA,CAAA,cAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,iBAAA,CAAA;;AACA,MAAA,kBAAA,gBAAA,OAAA,CAAA,oBAAA,CAAA;AAIA;;AAEG;;;AACI,MAAM,OAAO,GAAoD,KAAK,IAAG;AAC9E,QAAM,KAAK,GAAG,YAAA,CAAA,mBAAA,CAAoB,KAApB,CAAd;AAEA,EAAA,kBAAA,CAAA,yBAAA,CAA0B,KAA1B;AACA,SAAO,eAAA,CAAA,sBAAA,CAAuB,KAAvB,CAAP;AACD,CALM;;AAAM,OAAA,CAAA,OAAA,GAAO,OAAP;AAOb,OAAA,CAAA,OAAA,CAAQ,WAAR,GAAsB,SAAtB;AACA,OAAA,CAAA,OAAA,CAAQ,wBAAR,GAAmC,IAAnC","sourceRoot":""}
@@ -1,41 +1,24 @@
1
1
  import * as React from 'react';
2
2
  import type { PositioningShorthand } from '@fluentui/react-positioning';
3
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
3
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
4
4
  /**
5
5
  * Slot properties for Tooltip
6
6
  */
7
7
  export declare type TooltipSlots = {
8
- root: Omit<IntrinsicShorthandProps<'div'>, 'children'> & {
9
- /**
10
- * The child is the element that triggers the Tooltip. It will have additional properties added,
11
- * including events and aria properties.
12
- * Alternatively, children can be a render function that takes the props and adds
13
- * them to the appropriate elements.
14
- */
15
- children?: (React.ReactElement<React.HTMLAttributes<HTMLElement>> & {
16
- ref?: React.Ref<unknown>;
17
- }) | ((props: TooltipTriggerProps) => React.ReactNode) | null;
18
- };
8
+ content: NonNullable<Slot<'div'>>;
19
9
  };
20
10
  /**
21
11
  * Properties and state for Tooltip
22
12
  */
23
- export declare type TooltipCommons = {
13
+ declare type TooltipCommons = {
24
14
  /**
25
- * A tooltip can appear with the default appearance or inverted.
26
- * When not specified, the default appearance is used.
27
- */
28
- appearance?: 'inverted';
29
- /**
30
- * The content displayed inside the tooltip.
31
- */
32
- content: React.ReactNode;
33
- /**
34
- * Color variant with inverted colors
15
+ * The tooltip's visual appearance.
16
+ * * `normal` - Uses the theme's background and text colors.
17
+ * * `inverted` - Higher contrast variant that uses the theme's inverted colors.
35
18
  *
36
- * @defaultvalue false
19
+ * @defaultvalue normal
37
20
  */
38
- inverted?: boolean;
21
+ appearance?: 'normal' | 'inverted';
39
22
  /**
40
23
  * Render an arrow pointing to the target element
41
24
  *
@@ -62,15 +45,15 @@ export declare type TooltipCommons = {
62
45
  */
63
46
  onVisibleChange?: (event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => void;
64
47
  /**
65
- * Specifies which aria attribute to set on the trigger element.
66
- * * `label` - Set aria-label to the tooltip's content. Requires content to be a string; if not, uses `labelledby`.
67
- * * `labelledby` - Set aria-labelledby to the tooltip's id. The id is generated if not provided.
68
- * * `describedby` - Set aria-describedby to the tooltip's id. The id is generated if not provided.
69
- * * null - Do not set any aria attributes on the trigger element.
48
+ * (Required) Specifies whether this tooltip is acting as the description or label of its trigger element.
70
49
  *
71
- * @defaultvalue label
50
+ * * `label` - The tooltip sets the trigger's aria-label or aria-labelledby attribute. This is useful for buttons
51
+ * displaying only an icon, for example.
52
+ * * `description` - The tooltip sets the trigger's aria-description or aria-describedby attribute.
53
+ * * `inaccessible` - No aria attributes are set on the trigger. This makes the tooltip's content inaccessible to
54
+ * screen readers, and should only be used if the tooltip's text is available by some other means.
72
55
  */
73
- triggerAriaAttribute: 'label' | 'labelledby' | 'describedby' | null;
56
+ relationship: 'label' | 'description' | 'inaccessible';
74
57
  /**
75
58
  * Delay before the tooltip is shown, in milliseconds.
76
59
  *
@@ -99,18 +82,18 @@ export declare type OnVisibleChangeData = {
99
82
  /**
100
83
  * Properties for Tooltip
101
84
  */
102
- export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'content'>> & Pick<TooltipCommons, 'content'>;
85
+ export declare type TooltipProps = ComponentProps<TooltipSlots> & Partial<Omit<TooltipCommons, 'relationship'>> & Pick<TooltipCommons, 'relationship'> & {
86
+ children?: (React.ReactElement & {
87
+ ref?: React.Ref<unknown>;
88
+ }) | ((props: TooltipTriggerProps) => React.ReactElement | null) | null;
89
+ };
103
90
  /**
104
91
  * State used in rendering Tooltip
105
92
  */
106
93
  export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons & {
94
+ children?: React.ReactElement | null;
107
95
  /**
108
96
  * Whether the tooltip should be rendered to the DOM.
109
- *
110
- * Normally the tooltip will only be rendered when visible. However, if
111
- * triggerAriaAttribute is labelledby or describedby, the tooltip will
112
- * always be rendered even when hidden so that those aria attributes
113
- * to always refer to a valid DOM element.
114
97
  */
115
98
  shouldRenderTooltip?: boolean;
116
99
  /**
@@ -122,3 +105,4 @@ export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons
122
105
  */
123
106
  arrowClassName?: string;
124
107
  };
108
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * The height of the tooltip's arrow in pixels.
3
+ */
4
+ export declare const arrowHeight = 6;
5
+ /**
6
+ * The default value of the tooltip's border radius (borderRadiusMedium).
7
+ *
8
+ * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
9
+ * While we could use getComputedStyle, that adds a performance penalty for something that
10
+ * will likely never change.
11
+ */
12
+ export declare const tooltipBorderRadius = 4;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.tooltipBorderRadius = exports.arrowHeight = void 0;
7
+ /**
8
+ * The height of the tooltip's arrow in pixels.
9
+ */
10
+
11
+ exports.arrowHeight = 6;
12
+ /**
13
+ * The default value of the tooltip's border radius (borderRadiusMedium).
14
+ *
15
+ * Unfortunately, Popper requires it to be specified as a variable instead of using CSS.
16
+ * While we could use getComputedStyle, that adds a performance penalty for something that
17
+ * will likely never change.
18
+ */
19
+
20
+ exports.tooltipBorderRadius = 4;
21
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/components/Tooltip/private/constants.ts"],"names":[],"mappings":";;;;;;AAAA;;AAEG;;AACU,OAAA,CAAA,WAAA,GAAc,CAAd;AAEb;;;;;;AAMG;;AACU,OAAA,CAAA,mBAAA,GAAsB,CAAtB","sourceRoot":""}
@@ -2,4 +2,4 @@ import type { TooltipState } from './Tooltip.types';
2
2
  /**
3
3
  * Render the final JSX of Tooltip
4
4
  */
5
- export declare const renderTooltip: (state: TooltipState) => JSX.Element;
5
+ export declare const renderTooltip_unstable: (state: TooltipState) => JSX.Element;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.renderTooltip = void 0;
6
+ exports.renderTooltip_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -15,16 +15,17 @@ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
15
15
  */
16
16
 
17
17
 
18
- const renderTooltip = state => {
18
+ const renderTooltip_unstable = state => {
19
19
  const {
20
20
  slots,
21
21
  slotProps
22
- } = react_utilities_1.getSlots(state, ['root']);
23
- return React.createElement(React.Fragment, null, state.root.children, state.shouldRenderTooltip && React.createElement(react_portal_1.Portal, null, React.createElement(slots.root, Object.assign({}, slotProps.root), state.withArrow && React.createElement("div", {
22
+ } = react_utilities_1.getSlots(state);
23
+ return React.createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && React.createElement(react_portal_1.Portal, null, React.createElement(slots.content, { ...slotProps.content
24
+ }, state.withArrow && React.createElement("div", {
24
25
  ref: state.arrowRef,
25
26
  className: state.arrowClassName
26
- }), state.content)));
27
+ }), state.content.children)));
27
28
  };
28
29
 
29
- exports.renderTooltip = renderTooltip;
30
+ exports.renderTooltip_unstable = renderTooltip_unstable;
30
31
  //# sourceMappingURL=renderTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/renderTooltip.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,aAAa,GAAI,KAAD,IAAwB;AACnD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAuB,KAAvB,EAA8B,CAAC,MAAD,CAA9B,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,KAAK,CAAC,IAAN,CAAW,QADd,EAEG,KAAK,CAAC,mBAAN,IACC,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,MAAD,EAAO,IAAP,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,SAAS,CAAC,IAAf,CAAX,EACG,KAAK,CAAC,SAAN,IAAmB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADtB,EAEG,KAAK,CAAC,OAFT,CADF,CAHJ,CADF;AAaD,CAhBM;;AAAM,OAAA,CAAA,aAAA,GAAa,aAAb","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/Tooltip/renderTooltip.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAuB,KAAvB,CAA7B;AAEA,SACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,mBAAN,IACC,KAAA,CAAA,aAAA,CAAC,cAAA,CAAA,MAAD,EAAO,IAAP,EACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,EACG,KAAK,CAAC,SAAN,IAAmB,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,GAAG,EAAE,KAAK,CAAC,QAAhB;AAA0B,IAAA,SAAS,EAAE,KAAK,CAAC;AAA3C,GAAA,CADtB,EAEG,KAAK,CAAC,OAAN,CAAc,QAFjB,CADF,CAHJ,CADF;AAaD,CAhBM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","sourceRoot":""}
@@ -1,13 +1,10 @@
1
- import * as React from 'react';
2
1
  import type { TooltipProps, TooltipState } from './Tooltip.types';
3
2
  /**
4
3
  * Create the state required to render Tooltip.
5
4
  *
6
- * The returned state can be modified with hooks such as useTooltipStyles,
7
- * before being passed to renderTooltip.
5
+ * The returned state can be modified with hooks such as useTooltipStyles_unstable,
6
+ * before being passed to renderTooltip_unstable.
8
7
  *
9
8
  * @param props - props from this instance of Tooltip
10
- * @param ref - reference to root HTMLElement of Tooltip
11
- * @param defaultProps - (optional) default prop values provided by the implementing type
12
9
  */
13
- export declare const useTooltip: (props: TooltipProps, ref: React.Ref<HTMLDivElement>) => TooltipState;
10
+ export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useTooltip = void 0;
6
+ exports.useTooltip_unstable = void 0;
7
7
 
8
8
  const React = /*#__PURE__*/require("react");
9
9
 
@@ -11,25 +11,20 @@ const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
11
11
 
12
12
  const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
13
13
 
14
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities"); // Style values that are required for popper to properly position the tooltip
15
-
16
-
17
- const tooltipBorderRadius = 4; // Update the root's borderRadius in useTooltipStyles.ts if this changes
18
-
19
- const arrowHeight = 6; // Update the arrow's width/height in useTooltipStyles.ts if this changes
14
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
20
15
 
16
+ const constants_1 = /*#__PURE__*/require("./private/constants");
21
17
  /**
22
18
  * Create the state required to render Tooltip.
23
19
  *
24
- * The returned state can be modified with hooks such as useTooltipStyles,
25
- * before being passed to renderTooltip.
20
+ * The returned state can be modified with hooks such as useTooltipStyles_unstable,
21
+ * before being passed to renderTooltip_unstable.
26
22
  *
27
23
  * @param props - props from this instance of Tooltip
28
- * @param ref - reference to root HTMLElement of Tooltip
29
- * @param defaultProps - (optional) default prop values provided by the implementing type
30
24
  */
31
25
 
32
- const useTooltip = (props, ref) => {
26
+
27
+ const useTooltip_unstable = props => {
33
28
  var _a, _b, _c, _d;
34
29
 
35
30
  const context = React.useContext(react_shared_contexts_1.TooltipContext);
@@ -39,12 +34,13 @@ const useTooltip = (props, ref) => {
39
34
  } = react_shared_contexts_1.useFluent();
40
35
  const [setDelayTimeout, clearDelayTimeout] = react_utilities_1.useTimeout();
41
36
  const {
37
+ appearance,
38
+ children,
42
39
  content,
43
- inverted,
44
40
  withArrow,
45
41
  positioning,
46
42
  onVisibleChange,
47
- triggerAriaAttribute = 'label',
43
+ relationship,
48
44
  showDelay = 250,
49
45
  hideDelay = 250
50
46
  } = props;
@@ -65,30 +61,29 @@ const useTooltip = (props, ref) => {
65
61
  });
66
62
  }, [clearDelayTimeout, setVisibleInternal, onVisibleChange]);
67
63
  const state = {
68
- content,
69
- inverted,
70
64
  withArrow,
71
65
  positioning,
72
66
  showDelay,
73
67
  hideDelay,
74
- triggerAriaAttribute,
68
+ relationship,
75
69
  visible,
76
70
  shouldRenderTooltip: visible,
77
- appearance: props.appearance,
71
+ appearance,
78
72
  // Slots
79
73
  components: {
80
- root: 'div'
74
+ content: 'div'
81
75
  },
82
- root: react_utilities_1.getNativeElementProps('div', {
83
- role: 'tooltip',
84
- ...props,
85
- ref,
86
- id: react_utilities_1.useId('tooltip-', props.id)
76
+ content: react_utilities_1.resolveShorthand(content, {
77
+ defaultProps: {
78
+ role: 'tooltip'
79
+ },
80
+ required: true
87
81
  })
88
82
  };
83
+ state.content.id = react_utilities_1.useId('tooltip-', state.content.id);
89
84
  const popperOptions = {
90
85
  enabled: state.visible,
91
- arrowPadding: 2 * tooltipBorderRadius,
86
+ arrowPadding: 2 * constants_1.tooltipBorderRadius,
92
87
  position: 'above',
93
88
  align: 'center',
94
89
  offset: [0, 4],
@@ -96,7 +91,7 @@ const useTooltip = (props, ref) => {
96
91
  };
97
92
 
98
93
  if (state.withArrow) {
99
- popperOptions.offset = react_positioning_1.mergeArrowOffset(popperOptions.offset, arrowHeight);
94
+ popperOptions.offset = react_positioning_1.mergeArrowOffset(popperOptions.offset, constants_1.arrowHeight);
100
95
  }
101
96
 
102
97
  const {
@@ -104,7 +99,7 @@ const useTooltip = (props, ref) => {
104
99
  containerRef,
105
100
  arrowRef
106
101
  } = react_positioning_1.usePopper(popperOptions);
107
- state.root.ref = react_utilities_1.useMergedRefs(state.root.ref, containerRef);
102
+ state.content.ref = react_utilities_1.useMergedRefs(state.content.ref, containerRef);
108
103
  state.arrowRef = arrowRef; // When this tooltip is visible, hide any other tooltips, and register it
109
104
  // as the visibleTooltip with the TooltipContext.
110
105
  // Also add a listener on document to hide the tooltip if Escape is pressed
@@ -172,56 +167,50 @@ const useTooltip = (props, ref) => {
172
167
  }, [setDelayTimeout, setVisible, state.hideDelay, targetDocument]); // Cancel the hide timer when the pointer enters the tooltip, and restart it when the mouse leaves.
173
168
  // This keeps the tooltip visible when the pointer is moved over it.
174
169
 
175
- state.root.onPointerEnter = useMergedCallbacks(state.root.onPointerEnter, clearDelayTimeout);
176
- state.root.onPointerLeave = useMergedCallbacks(state.root.onPointerLeave, onLeaveTrigger);
177
- const child = React.isValidElement(state.root.children) ? state.root.children : undefined; // The props to add to the trigger element (child)
170
+ state.content.onPointerEnter = react_utilities_1.useMergedEventCallbacks(state.content.onPointerEnter, clearDelayTimeout);
171
+ state.content.onPointerLeave = react_utilities_1.useMergedEventCallbacks(state.content.onPointerLeave, onLeaveTrigger);
172
+ const child = React.isValidElement(children) ? react_utilities_1.getTriggerChild(children) : undefined; // The props to add to the trigger element (child)
178
173
 
179
174
  const triggerProps = {
180
- onPointerEnter: useMergedCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger),
181
- onPointerLeave: useMergedCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger),
182
- onFocus: useMergedCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger),
183
- onBlur: useMergedCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger)
175
+ onPointerEnter: react_utilities_1.useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger),
176
+ onPointerLeave: react_utilities_1.useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger),
177
+ onFocus: react_utilities_1.useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger),
178
+ onBlur: react_utilities_1.useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger)
184
179
  }; // If the target prop is not provided, attach targetRef to the trigger element's ref prop
185
180
 
186
- const childWithRef = child;
187
- const childTargetRef = react_utilities_1.useMergedRefs(childWithRef === null || childWithRef === void 0 ? void 0 : childWithRef.ref, targetRef);
181
+ const childTargetRef = react_utilities_1.useMergedRefs(child === null || child === void 0 ? void 0 : child.ref, targetRef);
188
182
 
189
183
  if (popperOptions.target === undefined) {
190
184
  triggerProps.ref = childTargetRef;
191
185
  }
192
186
 
193
- if (state.triggerAriaAttribute === 'label') {
194
- // aria-label only works if the content is a string. Otherwise, need to use labelledby.
195
- if (typeof state.content === 'string') {
196
- triggerProps['aria-label'] = state.content;
197
- } else {
198
- state.triggerAriaAttribute = 'labelledby';
187
+ if (relationship === 'label') {
188
+ const hasLabel = (child === null || child === void 0 ? void 0 : child.props) && ('aria-label' in child.props || 'aria-labelledby' in child.props);
189
+
190
+ if (!hasLabel) {
191
+ // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
192
+ if (typeof state.content.children === 'string') {
193
+ triggerProps['aria-label'] = state.content.children;
194
+ } else if (!isServerSideRender) {
195
+ triggerProps['aria-labelledby'] = state.content.id; // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
196
+
197
+ state.shouldRenderTooltip = true;
198
+ }
199
199
  }
200
- }
200
+ } else if (relationship === 'description') {
201
+ const hasDescription = (child === null || child === void 0 ? void 0 : child.props) && ('aria-description' in child.props || 'aria-describedby' in child.props);
201
202
 
202
- if (state.triggerAriaAttribute === 'labelledby' && !isServerSideRender) {
203
- triggerProps['aria-labelledby'] = state.root.id; // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
203
+ if (!hasDescription && !isServerSideRender) {
204
+ triggerProps['aria-describedby'] = state.content.id; // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
204
205
 
205
- state.shouldRenderTooltip = true;
206
- } else if (state.triggerAriaAttribute === 'describedby' && !isServerSideRender) {
207
- triggerProps['aria-describedby'] = state.root.id;
208
- state.shouldRenderTooltip = true;
206
+ state.shouldRenderTooltip = true;
207
+ }
209
208
  } // Apply the trigger props to the child, either by calling the render function, or cloning with the new props
210
209
 
211
210
 
212
- state.root.children = react_utilities_1.applyTriggerPropsToChildren(state.root.children, triggerProps);
211
+ state.children = react_utilities_1.applyTriggerPropsToChildren(children, triggerProps);
213
212
  return state;
214
213
  };
215
214
 
216
- exports.useTooltip = useTooltip;
217
- /**
218
- * Combine up to two event callbacks into a single function that calls them in order
219
- */
220
-
221
- const useMergedCallbacks = (callback1, callback2) => {
222
- return React.useCallback(ev => {
223
- callback1 === null || callback1 === void 0 ? void 0 : callback1(ev);
224
- callback2 === null || callback2 === void 0 ? void 0 : callback2(ev);
225
- }, [callback1, callback2]);
226
- };
215
+ exports.useTooltip_unstable = useTooltip_unstable;
227
216
  //# sourceMappingURL=useTooltip.js.map