@fluentui/react-tooltip 0.0.0-nightlyebf02572f720211207.1 → 0.0.0-nightlyf3017f159620220222.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. package/CHANGELOG.json +234 -24
  2. package/CHANGELOG.md +59 -14
  3. package/MIGRATION.md +51 -43
  4. package/Spec.md +201 -337
  5. package/dist/react-tooltip.d.ts +38 -48
  6. package/lib/Tooltip.js.map +1 -1
  7. package/lib/components/Tooltip/Tooltip.d.ts +3 -2
  8. package/lib/components/Tooltip/Tooltip.js +9 -9
  9. package/lib/components/Tooltip/Tooltip.js.map +1 -1
  10. package/lib/components/Tooltip/Tooltip.types.d.ts +32 -39
  11. package/lib/components/Tooltip/Tooltip.types.js.map +1 -1
  12. package/lib/components/Tooltip/index.js.map +1 -1
  13. package/lib/components/Tooltip/private/constants.d.ts +12 -0
  14. package/lib/components/Tooltip/private/constants.js +14 -0
  15. package/lib/components/Tooltip/private/constants.js.map +1 -0
  16. package/lib/components/Tooltip/renderTooltip.d.ts +1 -1
  17. package/lib/components/Tooltip/renderTooltip.js +5 -4
  18. package/lib/components/Tooltip/renderTooltip.js.map +1 -1
  19. package/lib/components/Tooltip/useTooltip.d.ts +3 -6
  20. package/lib/components/Tooltip/useTooltip.js +44 -65
  21. package/lib/components/Tooltip/useTooltip.js.map +1 -1
  22. package/lib/components/Tooltip/useTooltipStyles.d.ts +1 -1
  23. package/lib/components/Tooltip/useTooltipStyles.js +38 -25
  24. package/lib/components/Tooltip/useTooltipStyles.js.map +1 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib-commonjs/Tooltip.js.map +1 -1
  27. package/lib-commonjs/components/Tooltip/Tooltip.d.ts +3 -2
  28. package/lib-commonjs/components/Tooltip/Tooltip.js +8 -7
  29. package/lib-commonjs/components/Tooltip/Tooltip.js.map +1 -1
  30. package/lib-commonjs/components/Tooltip/Tooltip.types.d.ts +32 -39
  31. package/lib-commonjs/components/Tooltip/Tooltip.types.js.map +1 -1
  32. package/lib-commonjs/components/Tooltip/index.js.map +1 -1
  33. package/lib-commonjs/components/Tooltip/private/constants.d.ts +12 -0
  34. package/lib-commonjs/components/Tooltip/private/constants.js +21 -0
  35. package/lib-commonjs/components/Tooltip/private/constants.js.map +1 -0
  36. package/lib-commonjs/components/Tooltip/renderTooltip.d.ts +1 -1
  37. package/lib-commonjs/components/Tooltip/renderTooltip.js +7 -6
  38. package/lib-commonjs/components/Tooltip/renderTooltip.js.map +1 -1
  39. package/lib-commonjs/components/Tooltip/useTooltip.d.ts +3 -6
  40. package/lib-commonjs/components/Tooltip/useTooltip.js +49 -69
  41. package/lib-commonjs/components/Tooltip/useTooltip.js.map +1 -1
  42. package/lib-commonjs/components/Tooltip/useTooltipStyles.d.ts +1 -1
  43. package/lib-commonjs/components/Tooltip/useTooltipStyles.js +43 -28
  44. package/lib-commonjs/components/Tooltip/useTooltipStyles.js.map +1 -1
  45. package/lib-commonjs/index.js.map +1 -1
  46. package/package.json +9 -11
@@ -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,41 @@ 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)
178
-
179
- 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)
184
- }; // If the target prop is not provided, attach targetRef to the trigger element's ref prop
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;
173
+ const triggerAriaProps = {};
185
174
 
186
- const childWithRef = child;
187
- const childTargetRef = react_utilities_1.useMergedRefs(childWithRef === null || childWithRef === void 0 ? void 0 : childWithRef.ref, targetRef);
175
+ if (relationship === 'label') {
176
+ // aria-label only works if the content is a string. Otherwise, need to use aria-labelledby.
177
+ if (typeof state.content.children === 'string') {
178
+ triggerAriaProps['aria-label'] = state.content.children;
179
+ } else if (!isServerSideRender) {
180
+ triggerAriaProps['aria-labelledby'] = state.content.id; // Always render the tooltip even if hidden, so that aria-labelledby refers to a valid element
188
181
 
189
- if (popperOptions.target === undefined) {
190
- triggerProps.ref = childTargetRef;
191
- }
182
+ state.shouldRenderTooltip = true;
183
+ }
184
+ } else if (relationship === 'description') {
185
+ if (!isServerSideRender) {
186
+ triggerAriaProps['aria-describedby'] = state.content.id; // Always render the tooltip even if hidden, so that aria-describedby refers to a valid element
192
187
 
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';
188
+ state.shouldRenderTooltip = true;
199
189
  }
200
190
  }
201
191
 
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
192
+ const childTargetRef = react_utilities_1.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
204
193
 
205
- state.shouldRenderTooltip = true;
206
- } else if (state.triggerAriaAttribute === 'describedby' && !isServerSideRender) {
207
- triggerProps['aria-describedby'] = state.root.id;
208
- state.shouldRenderTooltip = true;
209
- } // Apply the trigger props to the child, either by calling the render function, or cloning with the new props
210
-
211
-
212
- state.root.children = react_utilities_1.applyTriggerPropsToChildren(state.root.children, triggerProps);
194
+ state.children = react_utilities_1.applyTriggerPropsToChildren(children, { ...triggerAriaProps,
195
+ ...(child === null || child === void 0 ? void 0 : child.props),
196
+ // If the target prop is not provided, attach targetRef to the trigger element's ref prop
197
+ ref: popperOptions.target === undefined ? childTargetRef : child === null || child === void 0 ? void 0 : child.ref,
198
+ onPointerEnter: react_utilities_1.useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onPointerEnter, onEnterTrigger),
199
+ onPointerLeave: react_utilities_1.useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onPointerLeave, onLeaveTrigger),
200
+ onFocus: react_utilities_1.useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onFocus, onEnterTrigger),
201
+ onBlur: react_utilities_1.useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onBlur, onLeaveTrigger)
202
+ });
213
203
  return state;
214
204
  };
215
205
 
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
- };
206
+ exports.useTooltip_unstable = useTooltip_unstable;
227
207
  //# sourceMappingURL=useTooltip.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/useTooltip.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,MAAA,uBAAA,gBAAA,OAAA,CAAA,iCAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA,C,CAYA;;;AACA,MAAM,mBAAmB,GAAG,CAA5B,C,CAA+B;;AAC/B,MAAM,WAAW,GAAG,CAApB,C,CAAuB;;AAEvB;;;;;;;;;AASG;;AACI,MAAM,UAAU,GAAG,CAAC,KAAD,EAAsB,GAAtB,KAAsE;;;AAC9F,QAAM,OAAO,GAAG,KAAK,CAAC,UAAN,CAAiB,uBAAA,CAAA,cAAjB,CAAhB;AACA,QAAM,kBAAkB,GAAG,iBAAA,CAAA,QAAA,EAA3B;AACA,QAAM;AAAE,IAAA;AAAF,MAAqB,uBAAA,CAAA,SAAA,EAA3B;AACA,QAAM,CAAC,eAAD,EAAkB,iBAAlB,IAAuC,iBAAA,CAAA,UAAA,EAA7C;AAEA,QAAM;AACJ,IAAA,OADI;AAEJ,IAAA,QAFI;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,iBAAA,CAAA,oBAAA,CAAqB;AAAE,IAAA,KAAK,EAAE,KAAK,CAAC,OAAf;AAAwB,IAAA,YAAY,EAAE;AAAtC,GAArB,CAAtC;AACA,QAAM,UAAU,GAAG,KAAK,CAAC,WAAN,CACjB,CAAC,UAAD,EAAsB,EA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,KAAA,CAAL,GAAA,KAAK,CAAE,KAAP,MAAY,IAAZ,IAAY,EAAA,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAY,EAAA,CAAE,MAAtC,EAA8C,cAA9C;AARkE,GAA3D,CAAjB;AAWA,SAAO,KAAP;AACD,CAvMM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB","sourcesContent":["import * as React from 'react';\nimport { mergeArrowOffset, resolvePositioningShorthand, usePopper } from '@fluentui/react-positioning';\nimport { TooltipContext, useFluent } from '@fluentui/react-shared-contexts';\nimport {\n applyTriggerPropsToChildren,\n resolveShorthand,\n useControllableState,\n useMergedEventCallbacks,\n useId,\n useIsomorphicLayoutEffect,\n useIsSSR,\n useMergedRefs,\n useTimeout,\n getTriggerChild,\n} from '@fluentui/react-utilities';\nimport type { TooltipProps, TooltipState, TooltipTriggerProps } from './Tooltip.types';\nimport { arrowHeight, tooltipBorderRadius } from './private/constants';\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 = React.useContext(TooltipContext);\n const isServerSideRender = useIsSSR();\n const { targetDocument } = useFluent();\n const [setDelayTimeout, clearDelayTimeout] = useTimeout();\n\n const {\n appearance,\n children,\n content,\n withArrow,\n positioning,\n onVisibleChange,\n relationship,\n showDelay = 250,\n hideDelay = 250,\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\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 popperOptions = {\n enabled: state.visible,\n arrowPadding: 2 * tooltipBorderRadius,\n position: 'above' as const,\n align: 'center' as const,\n offset: [0, 4] as [number, number],\n ...resolvePositioningShorthand(state.positioning),\n };\n\n if (state.withArrow) {\n popperOptions.offset = mergeArrowOffset(popperOptions.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 } = usePopper(popperOptions);\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' || ev.key === 'Esc') {\n thisTooltip.hide();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown);\n\n return () => {\n if (context.visibleTooltip === thisTooltip) {\n context.visibleTooltip = undefined;\n }\n\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown);\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 pointer enters the tooltip, and restart it when the mouse leaves.\n // This keeps the tooltip visible when the pointer is moved over it.\n state.content.onPointerEnter = useMergedEventCallbacks(state.content.onPointerEnter, clearDelayTimeout);\n state.content.onPointerLeave = useMergedEventCallbacks(state.content.onPointerLeave, onLeaveTrigger);\n\n const child = React.isValidElement(children) ? getTriggerChild(children) : undefined;\n\n const triggerAriaProps: Pick<TooltipTriggerProps, '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 if (!isServerSideRender) {\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 if (!isServerSideRender) {\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\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<TooltipTriggerProps>(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: popperOptions.target === undefined ? childTargetRef : child?.ref,\n onPointerEnter: useMergedEventCallbacks(child?.props?.onPointerEnter, onEnterTrigger),\n onPointerLeave: useMergedEventCallbacks(child?.props?.onPointerLeave, onLeaveTrigger),\n onFocus: useMergedEventCallbacks(child?.props?.onFocus, onEnterTrigger),\n onBlur: useMergedEventCallbacks(child?.props?.onBlur, onLeaveTrigger),\n });\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -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;
@@ -3,24 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.useTooltipStyles = exports.tooltipClassName = void 0;
6
+ exports.useTooltipStyles_unstable = exports.tooltipClassName = void 0;
7
7
 
8
- const react_make_styles_1 = /*#__PURE__*/require("@fluentui/react-make-styles");
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
9
 
10
10
  const react_positioning_1 = /*#__PURE__*/require("@fluentui/react-positioning");
11
11
 
12
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
13
+
14
+ const constants_1 = /*#__PURE__*/require("./private/constants");
15
+
12
16
  exports.tooltipClassName = 'fui-Tooltip';
13
17
  /**
14
18
  * Styles for the tooltip
15
19
  */
16
20
 
17
- const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
21
+ const useStyles = /*#__PURE__*/react_1.__styles({
18
22
  "root": {
19
23
  "mc9l5x": "fjseox",
20
- "z8tnut": "f1sbtcvk",
21
- "z189sj": ["f11qrl6u", "fjlbh76"],
22
- "Byoj8tv": "fy7v416",
23
- "uwmqm3": ["fjlbh76", "f11qrl6u"],
24
+ "B7ck84d": "f1ewtqcl",
24
25
  "B2u0y6b": "f132xexn",
25
26
  "Bceei9c": "f158kwzp",
26
27
  "Bahqtrf": "fk6fouc",
@@ -30,6 +31,22 @@ const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
30
31
  "Beyfa6y": ["f16jpd5f", "f1aa9q02"],
31
32
  "B7oj6ja": ["f1jar5jt", "fyu767a"],
32
33
  "Btl43ni": ["fyu767a", "f1jar5jt"],
34
+ "B4j52fo": "f5ogflp",
35
+ "Bekrc4i": ["f1hqa2wf", "finvdd3"],
36
+ "Bn0qgzm": "f1f09k3d",
37
+ "ibv6hh": ["finvdd3", "f1hqa2wf"],
38
+ "icvyot": "fzkkow9",
39
+ "vrafjx": ["fcdblym", "fjik90z"],
40
+ "oivjwe": "fg706s2",
41
+ "wvpqe5": ["fjik90z", "fcdblym"],
42
+ "g2u3we": "fghlq4f",
43
+ "h3c5rm": ["f1gn591s", "fjscplz"],
44
+ "B9xav0g": "fb073pr",
45
+ "zhjwy3": ["fjscplz", "f1gn591s"],
46
+ "z8tnut": "f10ra9hq",
47
+ "z189sj": ["fd9xhir", "f1jlaasf"],
48
+ "Byoj8tv": "f1d7kygh",
49
+ "uwmqm3": ["f1jlaasf", "fd9xhir"],
33
50
  "De3pzq": "fxugw4r",
34
51
  "sj55zd": "f19n0e5",
35
52
  "Bhu2qc9": "fxeb0a7"
@@ -46,48 +63,46 @@ const useStyles = /*#__PURE__*/react_make_styles_1.__styles({
46
63
  "De3pzq": "f1u2r49w",
47
64
  "Bcdw1i0": "fd7fpy0",
48
65
  "Bj3rh1h": "f1bsuimh",
49
- "Bubjx69": "f9ikmtg",
50
- "a9b677": "fpkirms",
66
+ "a9b677": "f1ekdpwm",
67
+ "Bqenvij": "f83vc9z",
51
68
  "rurcny": "fuzzvh5",
52
- "px8gyy": ["f5bg3dr", "f1rfdd74"],
53
- "B5c9fhp": ["fijcjxk", "f11y671q"],
54
- "Bhe99jt": ["f1vtdej5", "f7y375m"],
55
- "B2r1szc": ["f7y375m", "f1vtdej5"],
69
+ "Bex5imi": "fkk33zh",
56
70
  "xx9plb": "fxf9f1y",
71
+ "Bmqnesq": "f170vdtw",
57
72
  "Bdn98qo": "f103af6e",
58
73
  "Bbc2r3f": "f15umuo5",
59
74
  "B1dvbpk": "f3wpjpt",
60
- "Bex5imi": "fkk33zh",
75
+ "D4ky5z": "f1k3tce7",
76
+ "cqycoz": "f1dkdgqi",
77
+ "I89eb": "f5ghsz",
78
+ "k1i1uq": "fyqop9u",
79
+ "Epwjcz": "f1m5ya7j",
80
+ "Bp1vogq": "f3sp63x",
81
+ "px8gyy": ["f5bg3dr", "f1rfdd74"],
61
82
  "h6z6rw": "fzd2j21",
62
- "Iykf4b": ["feexxpo", "f7s5fvx"],
63
- "F42hee": ["f1jq8eg5", "f12n7c5j"],
64
- "Blxsnla": ["f1wv7y6t", "fi4qyh6"],
65
- "t2scew": "fcvru7r",
66
- "Emsed9": "f7ybgnc",
67
- "E11wbp": "f16xtfle",
68
- "hl6cv3": "fotnskf",
83
+ "hl6cv3": "f1773hnp",
69
84
  "Bh2vraf": "f1n8855c",
70
- "yayu3t": "fwwuk3n",
85
+ "yayu3t": "f1v7783n",
71
86
  "wedwtw": "fsw6im5",
72
- "rhl9o9": "ftghsr9",
87
+ "rhl9o9": "fh2hsk5",
73
88
  "Bu8t5uz": "f159pzir",
74
- "B6q6orb": "fwghsev",
89
+ "B6q6orb": "f11yvu4",
75
90
  "Bwwlvwl": "fm1ycve"
76
91
  }
77
92
  }, {
78
- "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);}", ".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);}", ".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;}", ".f9ikmtg{aspect-ratio:1;}", ".fpkirms{width:8.485px;}", ".fuzzvh5:before{content:\"\";}", ".f5bg3dr:before{border-bottom-right-radius:var(--borderRadiusSmall);}", ".f1rfdd74:before{border-bottom-left-radius:var(--borderRadiusSmall);}", ".fijcjxk:before{border-bottom-left-radius:4px;}", ".f11y671q:before{border-bottom-right-radius:4px;}", ".f1vtdej5:before{border-top-right-radius:4px;}", ".f7y375m:before{border-top-left-radius:4px;}", ".fxf9f1y:before{position:absolute;}", ".f103af6e:before{width:inherit;}", ".f15umuo5:before{height:inherit;}", ".f3wpjpt:before{background-color:inherit;}", ".fkk33zh:before{visibility:visible;}", ".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] .feexxpo:before{border-right-width:1px;}", "[data-popper-placement] .f7s5fvx:before{border-left-width:1px;}", "[data-popper-placement] .f1jq8eg5:before{border-right-style:solid;}", "[data-popper-placement] .f12n7c5j:before{border-left-style:solid;}", "[data-popper-placement] .f1wv7y6t:before{border-right-color:transparent;}", "[data-popper-placement] .fi4qyh6:before{border-left-color:transparent;}", "[data-popper-placement] .fcvru7r:before{border-bottom-width:1px;}", "[data-popper-placement] .f7ybgnc:before{border-bottom-style:solid;}", "[data-popper-placement] .f16xtfle:before{border-bottom-color:transparent;}", "[data-popper-placement^=\"top\"] .fotnskf{bottom:0;}", "[data-popper-placement^=\"top\"] .f1n8855c{--angle:0;}", "[data-popper-placement^=\"right\"] .fwwuk3n{left: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\"] .fwghsev{right:0;}", "[data-popper-placement^=\"left\"] .fm1ycve{--angle:270deg;}"]
93
+ "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;}"]
79
94
  });
80
95
  /**
81
96
  * Apply styling to the Tooltip slots based on the state
82
97
  */
83
98
 
84
99
 
85
- const useTooltipStyles = state => {
100
+ const useTooltipStyles_unstable = state => {
86
101
  const styles = useStyles();
87
- state.root.className = react_make_styles_1.mergeClasses(exports.tooltipClassName, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.root.className);
102
+ state.content.className = react_1.mergeClasses(exports.tooltipClassName, styles.root, state.appearance === 'inverted' && styles.inverted, state.visible && styles.visible, state.content.className);
88
103
  state.arrowClassName = styles.arrow;
89
104
  return state;
90
105
  };
91
106
 
92
- exports.useTooltipStyles = useTooltipStyles;
107
+ exports.useTooltipStyles_unstable = useTooltipStyles_unstable;
93
108
  //# sourceMappingURL=useTooltipStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Tooltip/useTooltipStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,mBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;;AACA,M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AAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AAGa,OAAA,CAAA,gBAAA,GAAmB,aAAnB;AAEb;;AAEG;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;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;;;AACI,MAAM,yBAAyB,GAAI,KAAD,IAAsC;AAC7E,QAAM,MAAM,GAAG,SAAS,EAAxB;AAEA,EAAA,KAAK,CAAC,OAAN,CAAc,SAAd,GAA0B,OAAA,CAAA,YAAA,CACxB,OAAA,CAAA,gBADwB,EAExB,MAAM,CAAC,IAFiB,EAGxB,KAAK,CAAC,UAAN,KAAqB,UAArB,IAAmC,MAAM,CAAC,QAHlB,EAIxB,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,OAJA,EAKxB,KAAK,CAAC,OAAN,CAAc,SALU,CAA1B;AAQA,EAAA,KAAK,CAAC,cAAN,GAAuB,MAAM,CAAC,KAA9B;AAEA,SAAO,KAAP;AACD,CAdM;;AAAM,OAAA,CAAA,yBAAA,GAAyB,yBAAzB","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 { TooltipState } from './Tooltip.types';\n\nexport const tooltipClassName = 'fui-Tooltip';\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.colorNeutralBackgroundInverted,\n color: tokens.colorNeutralForegroundInverted,\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 tooltipClassName,\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"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA","sourceRoot":""}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Tooltip';\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-tooltip",
3
- "version": "0.0.0-nightlyebf02572f720211207.1",
3
+ "version": "0.0.0-nightlyf3017f159620220222.1",
4
4
  "description": "React components for building web experiences",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -22,15 +22,13 @@
22
22
  "test": "jest --passWithNoTests",
23
23
  "docs": "api-extractor run --config=config/api-extractor.local.json --local",
24
24
  "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-tooltip/src && yarn docs",
25
- "storybook": "start-storybook",
25
+ "storybook": "node ../../scripts/storybook/runner",
26
26
  "type-check": "tsc -b tsconfig.json"
27
27
  },
28
28
  "devDependencies": {
29
- "@fluentui/babel-make-styles": "0.0.0-nightlyebf02572f720211207.1",
30
29
  "@fluentui/eslint-plugin": "*",
31
- "@fluentui/jest-serializer-make-styles": "0.0.0-nightlyebf02572f720211207.1",
32
30
  "@fluentui/react-conformance": "*",
33
- "@fluentui/react-conformance-make-styles": "0.0.0-nightlyebf02572f720211207.1",
31
+ "@fluentui/react-conformance-griffel": "0.0.0-nightlyf3017f159620220222.1",
34
32
  "@fluentui/scripts": "^1.0.0",
35
33
  "@types/enzyme": "3.10.3",
36
34
  "@types/enzyme-adapter-react-16": "1.0.3",
@@ -44,12 +42,12 @@
44
42
  "react-test-renderer": "^16.3.0"
45
43
  },
46
44
  "dependencies": {
47
- "@fluentui/react-make-styles": "0.0.0-nightlyebf02572f720211207.1",
48
- "@fluentui/react-portal": "0.0.0-nightlyebf02572f720211207.1",
49
- "@fluentui/react-positioning": "0.0.0-nightlyebf02572f720211207.1",
50
- "@fluentui/react-shared-contexts": "0.0.0-nightlyebf02572f720211207.1",
51
- "@fluentui/react-theme": "0.0.0-nightlyebf02572f720211207.1",
52
- "@fluentui/react-utilities": "0.0.0-nightlyebf02572f720211207.1",
45
+ "@fluentui/react-portal": "0.0.0-nightlyf3017f159620220222.1",
46
+ "@fluentui/react-positioning": "0.0.0-nightlyf3017f159620220222.1",
47
+ "@fluentui/react-shared-contexts": "0.0.0-nightlyf3017f159620220222.1",
48
+ "@fluentui/react-theme": "0.0.0-nightlyf3017f159620220222.1",
49
+ "@fluentui/react-utilities": "0.0.0-nightlyf3017f159620220222.1",
50
+ "@griffel/react": "1.0.0",
53
51
  "tslib": "^2.1.0"
54
52
  },
55
53
  "peerDependencies": {