@fluentui/react-tooltip 0.0.0-nightlyd514b3e0ee20220121.1 → 0.0.0-nightlyd80c90385320220216.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/CHANGELOG.json +147 -42
  2. package/CHANGELOG.md +38 -14
  3. package/dist/react-tooltip.d.ts +23 -38
  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 +17 -30
  8. package/lib/components/Tooltip/renderTooltip.d.ts +1 -1
  9. package/lib/components/Tooltip/renderTooltip.js +3 -3
  10. package/lib/components/Tooltip/renderTooltip.js.map +1 -1
  11. package/lib/components/Tooltip/useTooltip.d.ts +3 -5
  12. package/lib/components/Tooltip/useTooltip.js +42 -57
  13. package/lib/components/Tooltip/useTooltip.js.map +1 -1
  14. package/lib/components/Tooltip/useTooltipStyles.d.ts +1 -1
  15. package/lib/components/Tooltip/useTooltipStyles.js +3 -3
  16. package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
  17. package/lib-commonjs/components/Tooltip/Tooltip.d.ts +3 -2
  18. package/lib-commonjs/components/Tooltip/Tooltip.js +8 -7
  19. package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
  20. package/lib-commonjs/components/Tooltip/Tooltip.types.d.ts +17 -30
  21. package/lib-commonjs/components/Tooltip/renderTooltip.d.ts +1 -1
  22. package/lib-commonjs/components/Tooltip/renderTooltip.js +5 -5
  23. package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
  24. package/lib-commonjs/components/Tooltip/useTooltip.d.ts +3 -5
  25. package/lib-commonjs/components/Tooltip/useTooltip.js +43 -58
  26. package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
  27. package/lib-commonjs/components/Tooltip/useTooltipStyles.d.ts +1 -1
  28. package/lib-commonjs/components/Tooltip/useTooltipStyles.js +6 -6
  29. package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
  30. package/package.json +8 -10
@@ -5,15 +5,15 @@ import { getSlots } from '@fluentui/react-utilities';
5
5
  * Render the final JSX of Tooltip
6
6
  */
7
7
 
8
- export const renderTooltip = state => {
8
+ export const renderTooltip_unstable = state => {
9
9
  const {
10
10
  slots,
11
11
  slotProps
12
12
  } = getSlots(state);
13
- return /*#__PURE__*/React.createElement(React.Fragment, null, state.root.children, state.shouldRenderTooltip && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
13
+ return /*#__PURE__*/React.createElement(React.Fragment, null, state.children, state.shouldRenderTooltip && /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.content, { ...slotProps.content
14
14
  }, state.withArrow && /*#__PURE__*/React.createElement("div", {
15
15
  ref: state.arrowRef,
16
16
  className: state.arrowClassName
17
- }), state.content)));
17
+ }), state.content.children)));
18
18
  };
19
19
  //# sourceMappingURL=renderTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/renderTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,aAAa,GAAI,KAAD,IAAwB;AACnD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,KAAK,CAAC,IAAN,CAAW,QADd,EAEG,KAAK,CAAC,mBAAN,iBACC,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO,IAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,EACG,KAAK,CAAC,SAAN,iBAAmB,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","sourceRoot":""}
1
+ {"version":3,"sources":["../../../src/components/Tooltip/renderTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,MAAT,QAAuB,wBAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,sBAAsB,GAAI,KAAD,IAAwB;AAC5D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAe,KAAf,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EACG,KAAK,CAAC,QADT,EAEG,KAAK,CAAC,mBAAN,iBACC,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO,IAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,OAAP,EAAc,EAAA,GAAK,SAAS,CAAC;AAAf,GAAd,EACG,KAAK,CAAC,SAAN,iBAAmB,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","sourceRoot":""}
@@ -1,12 +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
9
  */
12
- export declare const useTooltip: (props: TooltipProps, ref: React.Ref<HTMLDivElement>) => TooltipState;
10
+ export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;
@@ -1,19 +1,18 @@
1
1
  import * as React from 'react';
2
2
  import { mergeArrowOffset, resolvePositioningShorthand, usePopper } from '@fluentui/react-positioning';
3
3
  import { TooltipContext, useFluent } from '@fluentui/react-shared-contexts';
4
- import { applyTriggerPropsToChildren, getNativeElementProps, useControllableState, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout } from '@fluentui/react-utilities';
4
+ import { applyTriggerPropsToChildren, resolveShorthand, useControllableState, useMergedEventCallbacks, useId, useIsomorphicLayoutEffect, useIsSSR, useMergedRefs, useTimeout, getTriggerChild } from '@fluentui/react-utilities';
5
5
  import { arrowHeight, tooltipBorderRadius } from './private/constants';
6
6
  /**
7
7
  * Create the state required to render Tooltip.
8
8
  *
9
- * The returned state can be modified with hooks such as useTooltipStyles,
10
- * before being passed to renderTooltip.
9
+ * The returned state can be modified with hooks such as useTooltipStyles_unstable,
10
+ * before being passed to renderTooltip_unstable.
11
11
  *
12
12
  * @param props - props from this instance of Tooltip
13
- * @param ref - reference to root HTMLElement of Tooltip
14
13
  */
15
14
 
16
- export const useTooltip = (props, ref) => {
15
+ export const useTooltip_unstable = props => {
17
16
  var _a, _b, _c, _d;
18
17
 
19
18
  const context = React.useContext(TooltipContext);
@@ -23,12 +22,13 @@ export const useTooltip = (props, ref) => {
23
22
  } = useFluent();
24
23
  const [setDelayTimeout, clearDelayTimeout] = useTimeout();
25
24
  const {
26
- content,
27
25
  appearance,
26
+ children,
27
+ content,
28
28
  withArrow,
29
29
  positioning,
30
30
  onVisibleChange,
31
- triggerAriaAttribute = 'label',
31
+ relationship,
32
32
  showDelay = 250,
33
33
  hideDelay = 250
34
34
  } = props;
@@ -49,26 +49,26 @@ export const useTooltip = (props, ref) => {
49
49
  });
50
50
  }, [clearDelayTimeout, setVisibleInternal, onVisibleChange]);
51
51
  const state = {
52
- content,
53
52
  withArrow,
54
53
  positioning,
55
54
  showDelay,
56
55
  hideDelay,
57
- triggerAriaAttribute,
56
+ relationship,
58
57
  visible,
59
58
  shouldRenderTooltip: visible,
60
59
  appearance,
61
60
  // Slots
62
61
  components: {
63
- root: 'div'
62
+ content: 'div'
64
63
  },
65
- root: getNativeElementProps('div', {
66
- role: 'tooltip',
67
- ...props,
68
- ref,
69
- id: useId('tooltip-', props.id)
64
+ content: resolveShorthand(content, {
65
+ defaultProps: {
66
+ role: 'tooltip'
67
+ },
68
+ required: true
70
69
  })
71
70
  };
71
+ state.content.id = useId('tooltip-', state.content.id);
72
72
  const popperOptions = {
73
73
  enabled: state.visible,
74
74
  arrowPadding: 2 * tooltipBorderRadius,
@@ -87,7 +87,7 @@ export const useTooltip = (props, ref) => {
87
87
  containerRef,
88
88
  arrowRef
89
89
  } = usePopper(popperOptions);
90
- state.root.ref = useMergedRefs(state.root.ref, containerRef);
90
+ state.content.ref = useMergedRefs(state.content.ref, containerRef);
91
91
  state.arrowRef = arrowRef; // When this tooltip is visible, hide any other tooltips, and register it
92
92
  // as the visibleTooltip with the TooltipContext.
93
93
  // Also add a listener on document to hide the tooltip if Escape is pressed
@@ -155,54 +155,39 @@ export const useTooltip = (props, ref) => {
155
155
  }, [setDelayTimeout, setVisible, state.hideDelay, targetDocument]); // Cancel the hide timer when the pointer enters the tooltip, and restart it when the mouse leaves.
156
156
  // This keeps the tooltip visible when the pointer is moved over it.
157
157
 
158
- state.root.onPointerEnter = useMergedCallbacks(state.root.onPointerEnter, clearDelayTimeout);
159
- state.root.onPointerLeave = useMergedCallbacks(state.root.onPointerLeave, onLeaveTrigger);
160
- const child = /*#__PURE__*/React.isValidElement(state.root.children) ? state.root.children : undefined; // The props to add to the trigger element (child)
161
-
162
- const triggerProps = {
163
- onPointerEnter: useMergedCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger),
164
- onPointerLeave: useMergedCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger),
165
- onFocus: useMergedCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger),
166
- onBlur: useMergedCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger)
167
- }; // If the target prop is not provided, attach targetRef to the trigger element's ref prop
158
+ state.content.onPointerEnter = useMergedEventCallbacks(state.content.onPointerEnter, clearDelayTimeout);
159
+ state.content.onPointerLeave = useMergedEventCallbacks(state.content.onPointerLeave, onLeaveTrigger);
160
+ const child = /*#__PURE__*/React.isValidElement(children) ? getTriggerChild(children) : undefined;
161
+ const triggerAriaProps = {};
168
162
 
169
- const childWithRef = child;
170
- const childTargetRef = useMergedRefs(childWithRef === null || childWithRef === void 0 ? void 0 : childWithRef.ref, targetRef);
163
+ if (relationship === 'label') {
164
+ // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
165
+ if (typeof state.content.children === 'string') {
166
+ triggerAriaProps['aria-label'] = state.content.children;
167
+ } else if (!isServerSideRender) {
168
+ triggerAriaProps['aria-labelledby'] = state.content.id; // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
171
169
 
172
- if (popperOptions.target === undefined) {
173
- triggerProps.ref = childTargetRef;
174
- }
170
+ state.shouldRenderTooltip = true;
171
+ }
172
+ } else if (relationship === 'description') {
173
+ if (!isServerSideRender) {
174
+ triggerAriaProps['aria-describedby'] = state.content.id; // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
175
175
 
176
- if (state.triggerAriaAttribute === 'label') {
177
- // aria-label only works if the content is a string. Otherwise, need to use labelledby.
178
- if (typeof state.content === 'string') {
179
- triggerProps['aria-label'] = state.content;
180
- } else {
181
- state.triggerAriaAttribute = 'labelledby';
176
+ state.shouldRenderTooltip = true;
182
177
  }
183
178
  }
184
179
 
185
- if (state.triggerAriaAttribute === 'labelledby' && !isServerSideRender) {
186
- triggerProps['aria-labelledby'] = state.root.id; // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
187
-
188
- state.shouldRenderTooltip = true;
189
- } else if (state.triggerAriaAttribute === 'describedby' && !isServerSideRender) {
190
- triggerProps['aria-describedby'] = state.root.id;
191
- state.shouldRenderTooltip = true;
192
- } // Apply the trigger props to the child, either by calling the render function, or cloning with the new props
180
+ const childTargetRef = useMergedRefs(child === null || child === void 0 ? void 0 : child.ref, targetRef); // Apply the trigger props to the child, either by calling the render function, or cloning with the new props
193
181
 
194
-
195
- state.root.children = applyTriggerPropsToChildren(state.root.children, triggerProps);
182
+ state.children = applyTriggerPropsToChildren(children, { ...triggerAriaProps,
183
+ ...(child === null || child === void 0 ? void 0 : child.props),
184
+ // If the target prop is not provided, attach targetRef to the trigger element's ref prop
185
+ ref: popperOptions.target === undefined ? childTargetRef : child === null || child === void 0 ? void 0 : child.ref,
186
+ onPointerEnter: useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger),
187
+ onPointerLeave: useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger),
188
+ onFocus: useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger),
189
+ onBlur: useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger)
190
+ });
196
191
  return state;
197
192
  };
198
- /**
199
- * Combine up to two event callbacks into a single function that calls them in order
200
- */
201
-
202
- const useMergedCallbacks = (callback1, callback2) => {
203
- return React.useCallback(ev => {
204
- callback1 === null || callback1 === void 0 ? void 0 : callback1(ev);
205
- callback2 === null || callback2 === void 0 ? void 0 : callback2(ev);
206
- }, [callback1, callback2]);
207
- };
208
193
  //# sourceMappingURL=useTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,EAA2B,2BAA3B,EAAwD,SAAxD,QAAyE,6BAAzE;AACA,SAAS,cAAT,EAAyB,SAAzB,QAA0C,iCAA1C;AACA,SACE,2BADF,EAEE,qBAFF,EAGE,oBAHF,EAIE,KAJF,EAKE,yBALF,EAME,QANF,EAOE,aAPF,EAQE,UARF,QASO,2BATP;AAWA,SAAS,WAAT,EAAsB,mBAAtB,QAAiD,qBAAjD;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,UAAU,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAsE;;;AAC9F,QAAM,OAAO,GAAG,KAAK,CAAC,UAAN,CAAiB,cAAjB,CAAhB;AACA,QAAM,kBAAkB,GAAG,QAAQ,EAAnC;AACA,QAAM;AAAE,IAAA;AAAF,MAAqB,SAAS,EAApC;AACA,QAAM,CAAC,eAAD,EAAkB,iBAAlB,IAAuC,UAAU,EAAvD;AAEA,QAAM;AACJ,IAAA,OADI;AAEJ,IAAA,UAFI;AAGJ,IAAA,SAHI;AAIJ,IAAA,WAJI;AAKJ,IAAA,eALI;AAMJ,IAAA,oBAAoB,GAAG,OANnB;AAOJ,IAAA,SAAS,GAAG,GAPR;AAQJ,IAAA,SAAS,GAAG;AARR,MASF,KATJ;AAWA,QAAM,CAAC,OAAD,EAAU,kBAAV,IAAgC,oBAAoB,CAAC;AAAE,IAAA,KAAK,EAAE,KAAK,CAAC,OAAf;AAAwB,IAAA,YAAY,EAAE;AAAtC,GAAD,CAA1D;AACA,QAAM,UAAU,GAAG,KAAK,CAAC,WAAN,CACjB,CAAC,UAAD,EA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KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,cAAf,EAA+B,cAA/B,CALmC;AAM1E,IAAA,cAAc,EAAE,uBAAuB,CAAC,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,cAAf,EAA+B,cAA/B,CANmC;AAO1E,IAAA,OAAO,EAAE,uBAAuB,CAAC,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,OAAf,EAAwB,cAAxB,CAP0C;AAQ1E,IAAA,MAAM,EAAE,uBAAuB,CAAC,CAAA,EAAA,GAAA,KAAK,KAAA,IAAL,IAAA,KAAK,KAAA,KAAA,CAAL,GAAK,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,MAAf,EAAuB,cAAvB;AAR2C,GAAhC,CAA5C;AAWA,SAAO,KAAP;AACD,CAvMM","sourceRoot":""}
@@ -3,4 +3,4 @@ export declare const tooltipClassName = "fui-Tooltip";
3
3
  /**
4
4
  * Apply styling to the Tooltip slots based on the state
5
5
  */
6
- export declare const useTooltipStyles: (state: TooltipState) => TooltipState;
6
+ export declare const useTooltipStyles_unstable: (state: TooltipState) => TooltipState;
@@ -1,4 +1,4 @@
1
- import { shorthands, __styles, mergeClasses } from '@fluentui/react-make-styles';
1
+ import { shorthands, __styles, mergeClasses } from '@griffel/react';
2
2
  import { createArrowStyles } from '@fluentui/react-positioning';
3
3
  import { tokens } from '@fluentui/react-theme';
4
4
  import { arrowHeight } from './private/constants';
@@ -86,9 +86,9 @@ const useStyles = /*#__PURE__*/__styles({
86
86
  */
87
87
 
88
88
 
89
- export const useTooltipStyles = state => {
89
+ export const useTooltipStyles_unstable = state => {
90
90
  const styles = useStyles();
91
- 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);
92
92
  state.arrowClassName = styles.arrow;
93
93
  return state;
94
94
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,YAAiC,YAAjC,QAAqD,6BAArD;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;AAA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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,26 +1,16 @@
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
15
  * The tooltip's visual appearance.
26
16
  * * `normal` - Uses the theme's background and text colors.
@@ -29,10 +19,6 @@ export declare type TooltipCommons = {
29
19
  * @defaultvalue normal
30
20
  */
31
21
  appearance?: 'normal' | 'inverted';
32
- /**
33
- * The content displayed inside the tooltip.
34
- */
35
- content: React.ReactNode;
36
22
  /**
37
23
  * Render an arrow pointing to the target element
38
24
  *
@@ -59,15 +45,15 @@ export declare type TooltipCommons = {
59
45
  */
60
46
  onVisibleChange?: (event: React.PointerEvent<HTMLElement> | React.FocusEvent<HTMLElement> | undefined, data: OnVisibleChangeData) => void;
61
47
  /**
62
- * Specifies which aria attribute to set on the trigger element.
63
- * * `label` - Set aria-label to the tooltip's content. Requires content to be a string; if not, uses `labelledby`.
64
- * * `labelledby` - Set aria-labelledby to the tooltip's id. The id is generated if not provided.
65
- * * `describedby` - Set aria-describedby to the tooltip's id. The id is generated if not provided.
66
- * * 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.
67
49
  *
68
- * @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.
69
55
  */
70
- triggerAriaAttribute: 'label' | 'labelledby' | 'describedby' | null;
56
+ relationship: 'label' | 'description' | 'inaccessible';
71
57
  /**
72
58
  * Delay before the tooltip is shown, in milliseconds.
73
59
  *
@@ -96,18 +82,18 @@ export declare type OnVisibleChangeData = {
96
82
  /**
97
83
  * Properties for Tooltip
98
84
  */
99
- 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
+ };
100
90
  /**
101
91
  * State used in rendering Tooltip
102
92
  */
103
93
  export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons & {
94
+ children?: React.ReactElement | null;
104
95
  /**
105
96
  * Whether the tooltip should be rendered to the DOM.
106
- *
107
- * Normally the tooltip will only be rendered when visible. However, if
108
- * triggerAriaAttribute is labelledby or describedby, the tooltip will
109
- * always be rendered even when hidden so that those aria attributes
110
- * to always refer to a valid DOM element.
111
97
  */
112
98
  shouldRenderTooltip?: boolean;
113
99
  /**
@@ -119,3 +105,4 @@ export declare type TooltipState = ComponentState<TooltipSlots> & TooltipCommons
119
105
  */
120
106
  arrowClassName?: string;
121
107
  };
108
+ export {};
@@ -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,17 +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
22
  } = react_utilities_1.getSlots(state);
23
- return React.createElement(React.Fragment, null, state.root.children, state.shouldRenderTooltip && React.createElement(react_portal_1.Portal, null, React.createElement(slots.root, { ...slotProps.root
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
24
  }, state.withArrow && React.createElement("div", {
25
25
  ref: state.arrowRef,
26
26
  className: state.arrowClassName
27
- }), state.content)));
27
+ }), state.content.children)));
28
28
  };
29
29
 
30
- exports.renderTooltip = renderTooltip;
30
+ exports.renderTooltip_unstable = renderTooltip_unstable;
31
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,iBA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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,12 +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
9
  */
12
- export declare const useTooltip: (props: TooltipProps, ref: React.Ref<HTMLDivElement>) => TooltipState;
10
+ export declare const useTooltip_unstable: (props: TooltipProps) => TooltipState;