@fluentui-copilot/react-preview 0.5.1 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,49 @@
2
2
  "name": "@fluentui-copilot/react-preview",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 23 Jul 2024 00:55:17 GMT",
5
+ "date": "Fri, 23 Aug 2024 01:04:50 GMT",
6
+ "tag": "@fluentui-copilot/react-preview_v0.5.3",
7
+ "version": "0.5.3",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "makotom@microsoft.com",
12
+ "package": "@fluentui-copilot/react-preview",
13
+ "commit": "32a2c49c4a177e9348d522b4700644d16c535007",
14
+ "comment": "feat: Setting autoSize to true by default for Preview."
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Wed, 21 Aug 2024 00:26:06 GMT",
21
+ "tag": "@fluentui-copilot/react-preview_v0.5.2",
22
+ "version": "0.5.2",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "Humberto.Morimoto@microsoft.com",
27
+ "package": "@fluentui-copilot/react-preview",
28
+ "commit": "6ce23774f5f2055977299510e8df454d86a1a313",
29
+ "comment": "chore: Removing shorthands' usage now that griffel supports them."
30
+ },
31
+ {
32
+ "author": "ololubek@microsoft.com",
33
+ "package": "@fluentui-copilot/react-preview",
34
+ "commit": "0a6327b6b174fc99abed7fa70ed0542e698bcf40",
35
+ "comment": "chore: bump react-components version to 9.54.10."
36
+ },
37
+ {
38
+ "author": "Humberto.Morimoto@microsoft.com",
39
+ "package": "@fluentui-copilot/react-preview",
40
+ "commit": "907c63c4da894b41cad4601b30e0df6d9f269056",
41
+ "comment": "chore: Bumping versions of @fluentui/* and @griffel/* packages to latest (corresponding to version 9.54.8 of @fluentui/react-components)."
42
+ }
43
+ ]
44
+ }
45
+ },
46
+ {
47
+ "date": "Tue, 23 Jul 2024 00:56:26 GMT",
6
48
  "tag": "@fluentui-copilot/react-preview_v0.5.1",
7
49
  "version": "0.5.1",
8
50
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,32 @@
1
1
  # Change Log - @fluentui-copilot/react-preview
2
2
 
3
- This log was last generated on Tue, 23 Jul 2024 00:55:17 GMT and should not be manually modified.
3
+ This log was last generated on Fri, 23 Aug 2024 01:04:50 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.5.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.5.3)
8
+
9
+ Fri, 23 Aug 2024 01:04:50 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.5.2..@fluentui-copilot/react-preview_v0.5.3)
11
+
12
+ ### Patches
13
+
14
+ - feat: Setting autoSize to true by default for Preview. ([PR #2083](https://github.com/microsoft/fluentai/pull/2083) by makotom@microsoft.com)
15
+
16
+ ## [0.5.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.5.2)
17
+
18
+ Wed, 21 Aug 2024 00:26:06 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.5.1..@fluentui-copilot/react-preview_v0.5.2)
20
+
21
+ ### Patches
22
+
23
+ - chore: Removing shorthands' usage now that griffel supports them. ([PR #1994](https://github.com/microsoft/fluentai/pull/1994) by Humberto.Morimoto@microsoft.com)
24
+ - chore: bump react-components version to 9.54.10. ([PR #2018](https://github.com/microsoft/fluentai/pull/2018) by ololubek@microsoft.com)
25
+ - chore: Bumping versions of @fluentui/* and @griffel/* packages to latest (corresponding to version 9.54.8 of @fluentui/react-components). ([PR #1993](https://github.com/microsoft/fluentai/pull/1993) by Humberto.Morimoto@microsoft.com)
26
+
7
27
  ## [0.5.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.5.1)
8
28
 
9
- Tue, 23 Jul 2024 00:55:17 GMT
29
+ Tue, 23 Jul 2024 00:56:26 GMT
10
30
  [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.5.0..@fluentui-copilot/react-preview_v0.5.1)
11
31
 
12
32
  ### Patches
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { Enter, Escape } from '@fluentui/keyboard-keys';
3
- import { mergeCallbacks, useFluent, useId, useIsomorphicLayoutEffect, usePopover_unstable } from '@fluentui/react-components';
3
+ import { mergeCallbacks, resolvePositioningShorthand, useFluent, useId, useIsomorphicLayoutEffect, usePopover_unstable } from '@fluentui/react-components';
4
4
  import { useTimeout } from '@fluentui/react-utilities';
5
5
  import { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';
6
6
  const POPOVER_MOUSE_HIDE_DELAY = 500;
@@ -24,6 +24,7 @@ export const usePreview_unstable = props => {
24
24
  const {
25
25
  onOpenChange,
26
26
  open,
27
+ positioning,
27
28
  unstable_disableAutoFocus
28
29
  } = props;
29
30
  const children = React.Children.toArray(props.children);
@@ -240,6 +241,13 @@ export const usePreview_unstable = props => {
240
241
  children: resolvedChildren,
241
242
  onOpenChange: onPopoverOpenChange,
242
243
  open: open !== null && open !== void 0 ? open : isPopoverOpen,
244
+ positioning: typeof positioning === 'string' ? {
245
+ autoSize: true,
246
+ ...resolvePositioningShorthand(positioning)
247
+ } : {
248
+ autoSize: true,
249
+ ...positioning
250
+ },
243
251
  unstable_disableAutoFocus: unstable_disableAutoFocus !== null && unstable_disableAutoFocus !== void 0 ? unstable_disableAutoFocus : disableAutoFocus
244
252
  });
245
253
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreview.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Enter, Escape } from '@fluentui/keyboard-keys';\nimport {\n mergeCallbacks,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n usePopover_unstable,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\n\nimport { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';\nimport type { PreviewProps, PreviewState } from './Preview.types';\n\ntype PreviewInternalState = {\n openByClick: boolean;\n openByHoverOverTrigger: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_HIDE_DELAY = 500;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return POPOVER_MOUSE_HIDE_DELAY;\n};\n\ntype TargetEvent<T> = React.MouseEvent<T> | React.FocusEvent<T>;\n\n/**\n * Create the state required to render Preview.\n *\n * The returned state can be modified with hooks such as usePreviewStyles_unstable,\n * before being passed to renderPreview_unstable.\n *\n * @param props - props from this instance of Preview\n * @param ref - reference to root HTMLElement of Preview\n */\nexport const usePreview_unstable = (props: PreviewProps): PreviewState => {\n const { onOpenChange, open, unstable_disableAutoFocus } = props;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n const { targetDocument } = useFluent();\n const [setTimeout, clearTimeout] = useTimeout();\n\n const [disableAutoFocus, setDisableAutoFocus] = React.useState(true);\n\n const { current: previewInternalState } = React.useRef<PreviewInternalState>({\n openByClick: false,\n openByHoverOverTrigger: false,\n openByHoverOverPopover: false,\n openByKeyboard: false,\n });\n const triggerMousedOver = React.useRef(false);\n\n const isOpen = () => {\n return (\n previewInternalState.openByClick ||\n previewInternalState.openByHoverOverTrigger ||\n previewInternalState.openByHoverOverPopover ||\n previewInternalState.openByKeyboard\n );\n };\n\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\n const preventDefaultClose = React.useRef(false);\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const popoverSurfaceId = useId('preview-surface', popoverSurface?.props.id);\n\n const closeCallback = () => {\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n setIsPopoverOpen(isOpen());\n };\n\n React.useEffect(() => {\n return () => {\n // Remove all instances of the current popover from the openedByHoverPreviewManager when the component is unmounted.\n removeOpenedByHoverPreview(popoverSurfaceId);\n };\n }, [popoverSurfaceId]);\n\n if (popoverSurface && popoverTrigger) {\n const handleTriggerTargetEnter = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = true;\n triggerMousedOver.current = true;\n\n // We want to disable auto focus only if the popover is being opened by hovering over the trigger\n if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {\n setDisableAutoFocus(true);\n onOpenChange?.(e, { open: true });\n closeAllOpenedByHoverPreviews(popoverSurfaceId);\n addOpenedByHoverPreview(popoverSurfaceId, closeCallback);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = false;\n triggerMousedOver.current = false;\n\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the trigger\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverPopover &&\n isPopoverOpen\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n const handleTriggerClick = (e: TargetEvent<HTMLSpanElement>): void => {\n // Setting preventDefaultClose so that onPopoverOpenChange does not apply its logic when click is on the trigger as we want to control that behavior.\n preventDefaultClose.current = true;\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via click.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByKeyboard is true, then the popover was already opened via keyboard and we always want to close it.\n previewInternalState.openByClick = previewInternalState.openByKeyboard\n ? false\n : !previewInternalState.openByClick;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n\n // We set triggerMousedOver to false when clicking, since we just interacted with the trigger via click, and not hover.\n if (triggerMousedOver.current) {\n previewInternalState.openByClick = false;\n triggerMousedOver.current = false;\n }\n // If it was not moused over, we want to prevent the default click action from opening a link, so the preview can open first\n else {\n e.preventDefault();\n }\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByClick });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>): void => {\n if (e.key === Enter) {\n clearTimeout();\n\n // Setting default prevented so that Enter key does not trigger a click event or onPopoverOpenChange.\n e.preventDefault();\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via keyboard.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByClick is true, then the popover was already opened via click and we always want to close it.\n previewInternalState.openByKeyboard = previewInternalState.openByClick\n ? false\n : !previewInternalState.openByKeyboard;\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByKeyboard });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n }\n };\n\n const handlePopoverTargetEnter = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = true;\n setIsPopoverOpen(isOpen());\n };\n\n const handlePopoverTargetLeave = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = false;\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the popover\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverTrigger\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n popoverTrigger = React.cloneElement(popoverTrigger, {\n ...popoverTrigger.props,\n children: React.cloneElement(popoverTrigger.props.children as React.ReactElement, {\n ...popoverTrigger.props.children.props,\n onBlur: mergeCallbacks(popoverTrigger.props.children.props.onBlur, handleTriggerTargetLeave),\n onClick: mergeCallbacks(popoverTrigger.props.children.props.onClick, handleTriggerClick),\n onKeyDown: mergeCallbacks(popoverTrigger.props.children.props.onKeyDown, handleTriggerKeyDown),\n onMouseEnter: mergeCallbacks(popoverTrigger.props.children.props.onMouseEnter, handleTriggerTargetEnter),\n onMouseLeave: mergeCallbacks(popoverTrigger.props.children.props.onMouseLeave, handleTriggerTargetLeave),\n }),\n });\n\n popoverSurface = React.cloneElement(popoverSurface, {\n ...popoverSurface.props,\n 'aria-labelledby':\n popoverSurface.props['aria-labelledby'] ?? popoverSurface.props['aria-label'] ? undefined : popoverSurfaceId,\n id: popoverSurfaceId,\n onMouseEnter: mergeCallbacks(popoverSurface.props.onMouseEnter, handlePopoverTargetEnter),\n onMouseLeave: mergeCallbacks(popoverSurface.props.onMouseLeave, handlePopoverTargetLeave),\n onFocus: mergeCallbacks(popoverSurface.props.onFocus, handlePopoverTargetEnter),\n });\n }\n\n // Hitting Escape key should close the popover if it was opened by hover.\n // This is necessary to attach to the document because focus is likely not within the trigger or popover.\n useIsomorphicLayoutEffect(() => {\n if (isPopoverOpen) {\n const onDocumentKeyDown = (e: KeyboardEvent) => {\n const openedByHover = !previewInternalState.openByClick && !previewInternalState.openByKeyboard;\n\n if (openedByHover && e.key === Escape) {\n clearTimeout();\n\n // We set state back to its default if the Escape key has been pressed\n setDisableAutoFocus(true);\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n\n onOpenChange?.(e as unknown as OpenPopoverEvents, { open: false });\n\n e.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, { capture: true });\n\n return () => {\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [targetDocument, isPopoverOpen]);\n\n const onPopoverOpenChange = (e: OpenPopoverEvents, data: OnOpenChangeData): void => {\n if (!preventDefaultClose.current) {\n // We set all open state to false if preventDefaultClose was not set to true and the popover is closing.\n if (!data.open) {\n clearTimeout();\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n onOpenChange?.(e, data);\n }\n\n preventDefaultClose.current = false;\n };\n\n let resolvedChildren = children as [JSX.Element, JSX.Element] | JSX.Element;\n if (popoverSurface) {\n if (popoverTrigger) {\n resolvedChildren = [popoverTrigger, popoverSurface];\n } else {\n resolvedChildren = popoverSurface;\n }\n }\n\n const popoverState = usePopover_unstable({\n ...props,\n children: resolvedChildren,\n onOpenChange: onPopoverOpenChange,\n open: open ?? isPopoverOpen,\n unstable_disableAutoFocus: unstable_disableAutoFocus ?? disableAutoFocus,\n });\n\n return {\n ...popoverState,\n isPreviewLocked: previewInternalState.openByClick || previewInternalState.openByKeyboard,\n };\n};\n"],"names":["React","Enter","Escape","mergeCallbacks","useFluent","useId","useIsomorphicLayoutEffect","usePopover_unstable","useTimeout","addOpenedByHoverPreview","closeAllOpenedByHoverPreviews","removeOpenedByHoverPreview","POPOVER_MOUSE_HIDE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","usePreview_unstable","props","onOpenChange","open","unstable_disableAutoFocus","children","Children","toArray","targetDocument","setTimeout","clearTimeout","disableAutoFocus","setDisableAutoFocus","useState","current","previewInternalState","useRef","openByClick","openByHoverOverTrigger","openByHoverOverPopover","openByKeyboard","triggerMousedOver","isOpen","isPopoverOpen","setIsPopoverOpen","preventDefaultClose","popoverTrigger","undefined","popoverSurface","length","popoverSurfaceId","id","closeCallback","useEffect","handleTriggerTargetEnter","e","handleTriggerTargetLeave","handleTriggerClick","tmpOpenByHoverOverTrigger","preventDefault","handleTriggerKeyDown","key","handlePopoverTargetEnter","handlePopoverTargetLeave","cloneElement","onBlur","onClick","onKeyDown","onMouseEnter","onMouseLeave","onFocus","onDocumentKeyDown","openedByHover","stopPropagation","addEventListener","capture","removeEventListener","onPopoverOpenChange","data","resolvedChildren","popoverState","isPreviewLocked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACxD,SACEC,cAAc,EACdC,SAAS,EACTC,KAAK,EACLC,yBAAyB,EACzBC,mBAAmB,QACd,6BAA6B;AACpC,SAASC,UAAU,QAAQ,4BAA4B;AAGvD,SAASC,uBAAuB,EAAEC,6BAA6B,EAAEC,0BAA0B,QAAQ,cAAc;AAUjH,MAAMC,2BAA2B;AACjC,MAAMC,8BAA8B;AAEpC,MAAMC,WAAW,CAACC;IAChB,IAAIA,SAAS,WAAWA,SAAS,QAAQ;QACvC,OAAOF;IACT;IAEA,OAAOD;AACT;AAIA;;;;;;;;CAQC,GACD,OAAO,MAAMI,sBAAsB,CAACC;IAClC,MAAM,EAAEC,YAAY,EAAEC,IAAI,EAAEC,yBAAyB,EAAE,GAAGH;IAE1D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Enter, Escape } from '@fluentui/keyboard-keys';\nimport {\n mergeCallbacks,\n resolvePositioningShorthand,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n usePopover_unstable,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\n\nimport { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';\nimport type { PreviewProps, PreviewState } from './Preview.types';\n\ntype PreviewInternalState = {\n openByClick: boolean;\n openByHoverOverTrigger: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_HIDE_DELAY = 500;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return POPOVER_MOUSE_HIDE_DELAY;\n};\n\ntype TargetEvent<T> = React.MouseEvent<T> | React.FocusEvent<T>;\n\n/**\n * Create the state required to render Preview.\n *\n * The returned state can be modified with hooks such as usePreviewStyles_unstable,\n * before being passed to renderPreview_unstable.\n *\n * @param props - props from this instance of Preview\n * @param ref - reference to root HTMLElement of Preview\n */\nexport const usePreview_unstable = (props: PreviewProps): PreviewState => {\n const { onOpenChange, open, positioning, unstable_disableAutoFocus } = props;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n const { targetDocument } = useFluent();\n const [setTimeout, clearTimeout] = useTimeout();\n\n const [disableAutoFocus, setDisableAutoFocus] = React.useState(true);\n\n const { current: previewInternalState } = React.useRef<PreviewInternalState>({\n openByClick: false,\n openByHoverOverTrigger: false,\n openByHoverOverPopover: false,\n openByKeyboard: false,\n });\n const triggerMousedOver = React.useRef(false);\n\n const isOpen = () => {\n return (\n previewInternalState.openByClick ||\n previewInternalState.openByHoverOverTrigger ||\n previewInternalState.openByHoverOverPopover ||\n previewInternalState.openByKeyboard\n );\n };\n\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\n const preventDefaultClose = React.useRef(false);\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const popoverSurfaceId = useId('preview-surface', popoverSurface?.props.id);\n\n const closeCallback = () => {\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n setIsPopoverOpen(isOpen());\n };\n\n React.useEffect(() => {\n return () => {\n // Remove all instances of the current popover from the openedByHoverPreviewManager when the component is unmounted.\n removeOpenedByHoverPreview(popoverSurfaceId);\n };\n }, [popoverSurfaceId]);\n\n if (popoverSurface && popoverTrigger) {\n const handleTriggerTargetEnter = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = true;\n triggerMousedOver.current = true;\n\n // We want to disable auto focus only if the popover is being opened by hovering over the trigger\n if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {\n setDisableAutoFocus(true);\n onOpenChange?.(e, { open: true });\n closeAllOpenedByHoverPreviews(popoverSurfaceId);\n addOpenedByHoverPreview(popoverSurfaceId, closeCallback);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = false;\n triggerMousedOver.current = false;\n\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the trigger\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverPopover &&\n isPopoverOpen\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n const handleTriggerClick = (e: TargetEvent<HTMLSpanElement>): void => {\n // Setting preventDefaultClose so that onPopoverOpenChange does not apply its logic when click is on the trigger as we want to control that behavior.\n preventDefaultClose.current = true;\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via click.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByKeyboard is true, then the popover was already opened via keyboard and we always want to close it.\n previewInternalState.openByClick = previewInternalState.openByKeyboard\n ? false\n : !previewInternalState.openByClick;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n\n // We set triggerMousedOver to false when clicking, since we just interacted with the trigger via click, and not hover.\n if (triggerMousedOver.current) {\n previewInternalState.openByClick = false;\n triggerMousedOver.current = false;\n }\n // If it was not moused over, we want to prevent the default click action from opening a link, so the preview can open first\n else {\n e.preventDefault();\n }\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByClick });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>): void => {\n if (e.key === Enter) {\n clearTimeout();\n\n // Setting default prevented so that Enter key does not trigger a click event or onPopoverOpenChange.\n e.preventDefault();\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via keyboard.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByClick is true, then the popover was already opened via click and we always want to close it.\n previewInternalState.openByKeyboard = previewInternalState.openByClick\n ? false\n : !previewInternalState.openByKeyboard;\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByKeyboard });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n }\n };\n\n const handlePopoverTargetEnter = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = true;\n setIsPopoverOpen(isOpen());\n };\n\n const handlePopoverTargetLeave = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = false;\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the popover\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverTrigger\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n popoverTrigger = React.cloneElement(popoverTrigger, {\n ...popoverTrigger.props,\n children: React.cloneElement(popoverTrigger.props.children as React.ReactElement, {\n ...popoverTrigger.props.children.props,\n onBlur: mergeCallbacks(popoverTrigger.props.children.props.onBlur, handleTriggerTargetLeave),\n onClick: mergeCallbacks(popoverTrigger.props.children.props.onClick, handleTriggerClick),\n onKeyDown: mergeCallbacks(popoverTrigger.props.children.props.onKeyDown, handleTriggerKeyDown),\n onMouseEnter: mergeCallbacks(popoverTrigger.props.children.props.onMouseEnter, handleTriggerTargetEnter),\n onMouseLeave: mergeCallbacks(popoverTrigger.props.children.props.onMouseLeave, handleTriggerTargetLeave),\n }),\n });\n\n popoverSurface = React.cloneElement(popoverSurface, {\n ...popoverSurface.props,\n 'aria-labelledby':\n popoverSurface.props['aria-labelledby'] ?? popoverSurface.props['aria-label'] ? undefined : popoverSurfaceId,\n id: popoverSurfaceId,\n onMouseEnter: mergeCallbacks(popoverSurface.props.onMouseEnter, handlePopoverTargetEnter),\n onMouseLeave: mergeCallbacks(popoverSurface.props.onMouseLeave, handlePopoverTargetLeave),\n onFocus: mergeCallbacks(popoverSurface.props.onFocus, handlePopoverTargetEnter),\n });\n }\n\n // Hitting Escape key should close the popover if it was opened by hover.\n // This is necessary to attach to the document because focus is likely not within the trigger or popover.\n useIsomorphicLayoutEffect(() => {\n if (isPopoverOpen) {\n const onDocumentKeyDown = (e: KeyboardEvent) => {\n const openedByHover = !previewInternalState.openByClick && !previewInternalState.openByKeyboard;\n\n if (openedByHover && e.key === Escape) {\n clearTimeout();\n\n // We set state back to its default if the Escape key has been pressed\n setDisableAutoFocus(true);\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n\n onOpenChange?.(e as unknown as OpenPopoverEvents, { open: false });\n\n e.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, { capture: true });\n\n return () => {\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [targetDocument, isPopoverOpen]);\n\n const onPopoverOpenChange = (e: OpenPopoverEvents, data: OnOpenChangeData): void => {\n if (!preventDefaultClose.current) {\n // We set all open state to false if preventDefaultClose was not set to true and the popover is closing.\n if (!data.open) {\n clearTimeout();\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n onOpenChange?.(e, data);\n }\n\n preventDefaultClose.current = false;\n };\n\n let resolvedChildren = children as [JSX.Element, JSX.Element] | JSX.Element;\n if (popoverSurface) {\n if (popoverTrigger) {\n resolvedChildren = [popoverTrigger, popoverSurface];\n } else {\n resolvedChildren = popoverSurface;\n }\n }\n\n const popoverState = usePopover_unstable({\n ...props,\n children: resolvedChildren,\n onOpenChange: onPopoverOpenChange,\n open: open ?? isPopoverOpen,\n positioning:\n typeof positioning === 'string'\n ? { autoSize: true, ...resolvePositioningShorthand(positioning) }\n : { autoSize: true, ...positioning },\n unstable_disableAutoFocus: unstable_disableAutoFocus ?? disableAutoFocus,\n });\n\n return {\n ...popoverState,\n isPreviewLocked: previewInternalState.openByClick || previewInternalState.openByKeyboard,\n };\n};\n"],"names":["React","Enter","Escape","mergeCallbacks","resolvePositioningShorthand","useFluent","useId","useIsomorphicLayoutEffect","usePopover_unstable","useTimeout","addOpenedByHoverPreview","closeAllOpenedByHoverPreviews","removeOpenedByHoverPreview","POPOVER_MOUSE_HIDE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","usePreview_unstable","props","onOpenChange","open","positioning","unstable_disableAutoFocus","children","Children","toArray","targetDocument","setTimeout","clearTimeout","disableAutoFocus","setDisableAutoFocus","useState","current","previewInternalState","useRef","openByClick","openByHoverOverTrigger","openByHoverOverPopover","openByKeyboard","triggerMousedOver","isOpen","isPopoverOpen","setIsPopoverOpen","preventDefaultClose","popoverTrigger","undefined","popoverSurface","length","popoverSurfaceId","id","closeCallback","useEffect","handleTriggerTargetEnter","e","handleTriggerTargetLeave","handleTriggerClick","tmpOpenByHoverOverTrigger","preventDefault","handleTriggerKeyDown","key","handlePopoverTargetEnter","handlePopoverTargetLeave","cloneElement","onBlur","onClick","onKeyDown","onMouseEnter","onMouseLeave","onFocus","onDocumentKeyDown","openedByHover","stopPropagation","addEventListener","capture","removeEventListener","onPopoverOpenChange","data","resolvedChildren","popoverState","autoSize","isPreviewLocked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACxD,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,SAAS,EACTC,KAAK,EACLC,yBAAyB,EACzBC,mBAAmB,QACd,6BAA6B;AACpC,SAASC,UAAU,QAAQ,4BAA4B;AAGvD,SAASC,uBAAuB,EAAE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AetE,oBAAoB;QACvC,GAAGU,KAAK;QACRK,UAAUsD;QACV1D,cAAcwD;QACdvD,MAAMA,iBAAAA,kBAAAA,OAAQqB;QACdpB,aACE,OAAOA,gBAAgB,WACnB;YAAE0D,UAAU;YAAM,GAAG3E,4BAA4BiB,YAAY;QAAC,IAC9D;YAAE0D,UAAU;YAAM,GAAG1D,WAAW;QAAC;QACvCC,2BAA2BA,sCAAAA,uCAAAA,4BAA6BO;IAC1D;IAEA,OAAO;QACL,GAAGiD,YAAY;QACfE,iBAAiB/C,qBAAqBE,WAAW,IAAIF,qBAAqBK,cAAc;IAC1F;AACF,EAAE"}
@@ -1,11 +1,11 @@
1
- import { __resetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';
1
+ import { __resetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';
2
2
  export const previewContentClassNames = {
3
3
  root: 'fai-PreviewContent'
4
4
  };
5
5
  /**
6
6
  * Styles for the root slot
7
7
  */
8
- const useRootBaseClassName = __resetStyles("r3uexl1", "rbb2gfj", [".r3uexl1{color:var(--colorNeutralForeground3);display:flex;flex-direction:column;padding-top:var(--spacingVerticalS);padding-right:var(--spacingHorizontalS);padding-bottom:var(--spacingVerticalS);padding-left:var(--spacingHorizontalS);row-gap:var(--spacingVerticalXS);word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}", ".rbb2gfj{color:var(--colorNeutralForeground3);display:flex;flex-direction:column;padding-top:var(--spacingVerticalS);padding-left:var(--spacingHorizontalS);padding-bottom:var(--spacingVerticalS);padding-right:var(--spacingHorizontalS);row-gap:var(--spacingVerticalXS);word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"]);
8
+ const useRootBaseClassName = __resetStyles("r1jbsjc3", null, [".r1jbsjc3{color:var(--colorNeutralForeground3);display:flex;flex-direction:column;padding:var(--spacingVerticalS) var(--spacingHorizontalS);row-gap:var(--spacingVerticalXS);word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"]);
9
9
  /**
10
10
  * Apply styling to the PreviewContent slots based on the state
11
11
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreviewContentStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { PreviewContentSlots, PreviewContentState } from './PreviewContent.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewContentClassNames: SlotClassNames<PreviewContentSlots> = {\n root: 'fai-PreviewContent',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n color: tokens.colorNeutralForeground3,\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n rowGap: tokens.spacingVerticalXS,\n wordBreak: 'break-word',\n\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the PreviewContent slots based on the state\n */\nexport const usePreviewContentStyles_unstable = (state: PreviewContentState): PreviewContentState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n\n state.root.className = mergeClasses(previewContentClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","shorthands","tokens","typographyStyles","previewContentClassNames","root","useRootBaseClassName","color","colorNeutralForeground3","display","flexDirection","padding","spacingVerticalS","spacingHorizontalS","rowGap","spacingVerticalXS","wordBreak","caption1","usePreviewContentStyles_unstable","state","rootBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,UAAU,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIjH,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,uBAAuBP,gBAAgB;IAC3CQ,OAAOL,OAAOM,uBAAuB;IACrCC,SAAS;IACTC,eAAe;IACf,GAAGT,WAAWU,OAAO,CAACT,OAAOU,gBAAgB,EAAEV,OAAOW,kBAAkB,CAAC;IACzEC,QAAQZ,OAAOa,iBAAiB;IAChCC,WAAW;IAEX,GAAGb,iBAAiBc,QAAQ;AAC9B;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,oBAAoBd;IAE1Ba,MAAMd,IAAI,CAACgB,SAAS,GAAGrB,aAAaI,yBAAyBC,IAAI,EAAEe,mBAAmBD,MAAMd,IAAI,CAACgB,SAAS;IAE1G,OAAOF;AACT,EAAE"}
1
+ {"version":3,"sources":["usePreviewContentStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { PreviewContentSlots, PreviewContentState } from './PreviewContent.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewContentClassNames: SlotClassNames<PreviewContentSlots> = {\n root: 'fai-PreviewContent',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n color: tokens.colorNeutralForeground3,\n display: 'flex',\n flexDirection: 'column',\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n rowGap: tokens.spacingVerticalXS,\n wordBreak: 'break-word',\n\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the PreviewContent slots based on the state\n */\nexport const usePreviewContentStyles_unstable = (state: PreviewContentState): PreviewContentState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n\n state.root.className = mergeClasses(previewContentClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","tokens","typographyStyles","previewContentClassNames","root","useRootBaseClassName","color","colorNeutralForeground3","display","flexDirection","padding","spacingVerticalS","spacingHorizontalS","rowGap","spacingVerticalXS","wordBreak","caption1","usePreviewContentStyles_unstable","state","rootBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIrG,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,uBAAuBN,gBAAgB;IAC3CO,OAAOL,OAAOM,uBAAuB;IACrCC,SAAS;IACTC,eAAe;IACfC,SAAS,CAAC,EAAET,OAAOU,gBAAgB,CAAC,CAAC,EAAEV,OAAOW,kBAAkB,CAAC,CAAC;IAClEC,QAAQZ,OAAOa,iBAAiB;IAChCC,WAAW;IAEX,GAAGb,iBAAiBc,QAAQ;AAC9B;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,oBAAoBd;IAE1Ba,MAAMd,IAAI,CAACgB,SAAS,GAAGpB,aAAaG,yBAAyBC,IAAI,EAAEe,mBAAmBD,MAAMd,IAAI,CAACgB,SAAS;IAE1G,OAAOF;AACT,EAAE"}
@@ -1,4 +1,4 @@
1
- import { __styles, mergeClasses, shorthands, tokens, usePopoverSurfaceStyles_unstable } from '@fluentui/react-components';
1
+ import { __styles, mergeClasses, tokens, usePopoverSurfaceStyles_unstable } from '@fluentui/react-components';
2
2
  export const previewSurfaceClassNames = {
3
3
  root: 'fai-PreviewSurface'
4
4
  };
@@ -8,13 +8,16 @@ export const previewSurfaceClassNames = {
8
8
  const useRootStyles = __styles({
9
9
  base: {
10
10
  B2u0y6b: "f2rbwfs",
11
- z8tnut: "f1ywm7hm",
12
- z189sj: ["f7x41pl", "fruq291"],
13
- Byoj8tv: "f14wxoun",
14
- uwmqm3: ["fruq291", "f7x41pl"]
11
+ Byoj8tv: 0,
12
+ uwmqm3: 0,
13
+ z189sj: 0,
14
+ z8tnut: 0,
15
+ B0ocmuz: "f16d74zd"
15
16
  }
16
17
  }, {
17
- d: [".f2rbwfs{max-width:256px;}", ".f1ywm7hm{padding-top:var(--spacingVerticalXS);}", ".f7x41pl{padding-right:var(--spacingHorizontalXS);}", ".fruq291{padding-left:var(--spacingHorizontalXS);}", ".f14wxoun{padding-bottom:var(--spacingVerticalXS);}"]
18
+ d: [".f2rbwfs{max-width:256px;}", [".f16d74zd{padding:var(--spacingVerticalXS) var(--spacingHorizontalXS);}", {
19
+ p: -1
20
+ }]]
18
21
  });
19
22
  /**
20
23
  * Apply styling to the PreviewSurface slots based on the state
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreviewSurfaceStyles.styles.ts"],"sourcesContent":["import {\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n usePopoverSurfaceStyles_unstable,\n} from '@fluentui/react-components';\nimport type { PreviewSurfaceSlots, PreviewSurfaceState } from './PreviewSurface.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewSurfaceClassNames: SlotClassNames<PreviewSurfaceSlots> = {\n root: 'fai-PreviewSurface',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n maxWidth: '256px',\n ...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalXS),\n },\n});\n\n/**\n * Apply styling to the PreviewSurface slots based on the state\n */\nexport const usePreviewSurfaceStyles_unstable = (state: PreviewSurfaceState): PreviewSurfaceState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n\n state.root.className = mergeClasses(previewSurfaceClassNames.root, rootStyles.base, state.root.className);\n\n usePopoverSurfaceStyles_unstable(state);\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","shorthands","tokens","usePopoverSurfaceStyles_unstable","previewSurfaceClassNames","root","useRootStyles","base","maxWidth","padding","spacingVerticalXS","spacingHorizontalXS","usePreviewSurfaceStyles_unstable","state","rootStyles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gCAAgC,QAC3B,6BAA6B;AAIpC,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAgBP,WAAW;IAC/BQ,MAAM;QACJC,UAAU;QACV,GAAGP,WAAWQ,OAAO,CAACP,OAAOQ,iBAAiB,EAAER,OAAOS,mBAAmB,CAAC;IAC7E;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,aAAaR;IAEnBO,MAAMR,IAAI,CAACU,SAAS,GAAGf,aAAaI,yBAAyBC,IAAI,EAAES,WAAWP,IAAI,EAAEM,MAAMR,IAAI,CAACU,SAAS;IAExGZ,iCAAiCU;IAEjC,OAAOA;AACT,EAAE"}
1
+ {"version":3,"sources":["usePreviewSurfaceStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, tokens, usePopoverSurfaceStyles_unstable } from '@fluentui/react-components';\nimport type { PreviewSurfaceSlots, PreviewSurfaceState } from './PreviewSurface.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewSurfaceClassNames: SlotClassNames<PreviewSurfaceSlots> = {\n root: 'fai-PreviewSurface',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n maxWidth: '256px',\n padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalXS}`,\n },\n});\n\n/**\n * Apply styling to the PreviewSurface slots based on the state\n */\nexport const usePreviewSurfaceStyles_unstable = (state: PreviewSurfaceState): PreviewSurfaceState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n\n state.root.className = mergeClasses(previewSurfaceClassNames.root, rootStyles.base, state.root.className);\n\n usePopoverSurfaceStyles_unstable(state);\n\n return state;\n};\n"],"names":["makeStyles","mergeClasses","tokens","usePopoverSurfaceStyles_unstable","previewSurfaceClassNames","root","useRootStyles","base","maxWidth","padding","spacingVerticalXS","spacingHorizontalXS","usePreviewSurfaceStyles_unstable","state","rootStyles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,EAAEC,MAAM,EAAEC,gCAAgC,QAAQ,6BAA6B;AAIhH,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,gBAAgBN,WAAW;IAC/BO,MAAM;QACJC,UAAU;QACVC,SAAS,CAAC,EAAEP,OAAOQ,iBAAiB,CAAC,CAAC,EAAER,OAAOS,mBAAmB,CAAC,CAAC;IACtE;AACF;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,aAAaR;IAEnBO,MAAMR,IAAI,CAACU,SAAS,GAAGd,aAAaG,yBAAyBC,IAAI,EAAES,WAAWP,IAAI,EAAEM,MAAMR,IAAI,CAACU,SAAS;IAExGZ,iCAAiCU;IAEjC,OAAOA;AACT,EAAE"}
@@ -23,7 +23,7 @@ const getDelay = (type)=>{
23
23
  return POPOVER_MOUSE_HIDE_DELAY;
24
24
  };
25
25
  const usePreview_unstable = (props)=>{
26
- const { onOpenChange, open, unstable_disableAutoFocus } = props;
26
+ const { onOpenChange, open, positioning, unstable_disableAutoFocus } = props;
27
27
  const children = _react.Children.toArray(props.children);
28
28
  const { targetDocument } = (0, _reactcomponents.useFluent)();
29
29
  const [setTimeout, clearTimeout] = (0, _reactutilities.useTimeout)();
@@ -242,6 +242,13 @@ const usePreview_unstable = (props)=>{
242
242
  children: resolvedChildren,
243
243
  onOpenChange: onPopoverOpenChange,
244
244
  open: open !== null && open !== void 0 ? open : isPopoverOpen,
245
+ positioning: typeof positioning === 'string' ? {
246
+ autoSize: true,
247
+ ...(0, _reactcomponents.resolvePositioningShorthand)(positioning)
248
+ } : {
249
+ autoSize: true,
250
+ ...positioning
251
+ },
245
252
  unstable_disableAutoFocus: unstable_disableAutoFocus !== null && unstable_disableAutoFocus !== void 0 ? unstable_disableAutoFocus : disableAutoFocus
246
253
  });
247
254
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreview.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Enter, Escape } from '@fluentui/keyboard-keys';\nimport {\n mergeCallbacks,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n usePopover_unstable,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\n\nimport { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';\nimport type { PreviewProps, PreviewState } from './Preview.types';\n\ntype PreviewInternalState = {\n openByClick: boolean;\n openByHoverOverTrigger: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_HIDE_DELAY = 500;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return POPOVER_MOUSE_HIDE_DELAY;\n};\n\ntype TargetEvent<T> = React.MouseEvent<T> | React.FocusEvent<T>;\n\n/**\n * Create the state required to render Preview.\n *\n * The returned state can be modified with hooks such as usePreviewStyles_unstable,\n * before being passed to renderPreview_unstable.\n *\n * @param props - props from this instance of Preview\n * @param ref - reference to root HTMLElement of Preview\n */\nexport const usePreview_unstable = (props: PreviewProps): PreviewState => {\n const { onOpenChange, open, unstable_disableAutoFocus } = props;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n const { targetDocument } = useFluent();\n const [setTimeout, clearTimeout] = useTimeout();\n\n const [disableAutoFocus, setDisableAutoFocus] = React.useState(true);\n\n const { current: previewInternalState } = React.useRef<PreviewInternalState>({\n openByClick: false,\n openByHoverOverTrigger: false,\n openByHoverOverPopover: false,\n openByKeyboard: false,\n });\n const triggerMousedOver = React.useRef(false);\n\n const isOpen = () => {\n return (\n previewInternalState.openByClick ||\n previewInternalState.openByHoverOverTrigger ||\n previewInternalState.openByHoverOverPopover ||\n previewInternalState.openByKeyboard\n );\n };\n\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\n const preventDefaultClose = React.useRef(false);\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const popoverSurfaceId = useId('preview-surface', popoverSurface?.props.id);\n\n const closeCallback = () => {\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n setIsPopoverOpen(isOpen());\n };\n\n React.useEffect(() => {\n return () => {\n // Remove all instances of the current popover from the openedByHoverPreviewManager when the component is unmounted.\n removeOpenedByHoverPreview(popoverSurfaceId);\n };\n }, [popoverSurfaceId]);\n\n if (popoverSurface && popoverTrigger) {\n const handleTriggerTargetEnter = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = true;\n triggerMousedOver.current = true;\n\n // We want to disable auto focus only if the popover is being opened by hovering over the trigger\n if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {\n setDisableAutoFocus(true);\n onOpenChange?.(e, { open: true });\n closeAllOpenedByHoverPreviews(popoverSurfaceId);\n addOpenedByHoverPreview(popoverSurfaceId, closeCallback);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = false;\n triggerMousedOver.current = false;\n\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the trigger\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverPopover &&\n isPopoverOpen\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n const handleTriggerClick = (e: TargetEvent<HTMLSpanElement>): void => {\n // Setting preventDefaultClose so that onPopoverOpenChange does not apply its logic when click is on the trigger as we want to control that behavior.\n preventDefaultClose.current = true;\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via click.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByKeyboard is true, then the popover was already opened via keyboard and we always want to close it.\n previewInternalState.openByClick = previewInternalState.openByKeyboard\n ? false\n : !previewInternalState.openByClick;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n\n // We set triggerMousedOver to false when clicking, since we just interacted with the trigger via click, and not hover.\n if (triggerMousedOver.current) {\n previewInternalState.openByClick = false;\n triggerMousedOver.current = false;\n }\n // If it was not moused over, we want to prevent the default click action from opening a link, so the preview can open first\n else {\n e.preventDefault();\n }\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByClick });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>): void => {\n if (e.key === Enter) {\n clearTimeout();\n\n // Setting default prevented so that Enter key does not trigger a click event or onPopoverOpenChange.\n e.preventDefault();\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via keyboard.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByClick is true, then the popover was already opened via click and we always want to close it.\n previewInternalState.openByKeyboard = previewInternalState.openByClick\n ? false\n : !previewInternalState.openByKeyboard;\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByKeyboard });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n }\n };\n\n const handlePopoverTargetEnter = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = true;\n setIsPopoverOpen(isOpen());\n };\n\n const handlePopoverTargetLeave = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = false;\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the popover\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverTrigger\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n popoverTrigger = React.cloneElement(popoverTrigger, {\n ...popoverTrigger.props,\n children: React.cloneElement(popoverTrigger.props.children as React.ReactElement, {\n ...popoverTrigger.props.children.props,\n onBlur: mergeCallbacks(popoverTrigger.props.children.props.onBlur, handleTriggerTargetLeave),\n onClick: mergeCallbacks(popoverTrigger.props.children.props.onClick, handleTriggerClick),\n onKeyDown: mergeCallbacks(popoverTrigger.props.children.props.onKeyDown, handleTriggerKeyDown),\n onMouseEnter: mergeCallbacks(popoverTrigger.props.children.props.onMouseEnter, handleTriggerTargetEnter),\n onMouseLeave: mergeCallbacks(popoverTrigger.props.children.props.onMouseLeave, handleTriggerTargetLeave),\n }),\n });\n\n popoverSurface = React.cloneElement(popoverSurface, {\n ...popoverSurface.props,\n 'aria-labelledby':\n popoverSurface.props['aria-labelledby'] ?? popoverSurface.props['aria-label'] ? undefined : popoverSurfaceId,\n id: popoverSurfaceId,\n onMouseEnter: mergeCallbacks(popoverSurface.props.onMouseEnter, handlePopoverTargetEnter),\n onMouseLeave: mergeCallbacks(popoverSurface.props.onMouseLeave, handlePopoverTargetLeave),\n onFocus: mergeCallbacks(popoverSurface.props.onFocus, handlePopoverTargetEnter),\n });\n }\n\n // Hitting Escape key should close the popover if it was opened by hover.\n // This is necessary to attach to the document because focus is likely not within the trigger or popover.\n useIsomorphicLayoutEffect(() => {\n if (isPopoverOpen) {\n const onDocumentKeyDown = (e: KeyboardEvent) => {\n const openedByHover = !previewInternalState.openByClick && !previewInternalState.openByKeyboard;\n\n if (openedByHover && e.key === Escape) {\n clearTimeout();\n\n // We set state back to its default if the Escape key has been pressed\n setDisableAutoFocus(true);\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n\n onOpenChange?.(e as unknown as OpenPopoverEvents, { open: false });\n\n e.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, { capture: true });\n\n return () => {\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [targetDocument, isPopoverOpen]);\n\n const onPopoverOpenChange = (e: OpenPopoverEvents, data: OnOpenChangeData): void => {\n if (!preventDefaultClose.current) {\n // We set all open state to false if preventDefaultClose was not set to true and the popover is closing.\n if (!data.open) {\n clearTimeout();\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n onOpenChange?.(e, data);\n }\n\n preventDefaultClose.current = false;\n };\n\n let resolvedChildren = children as [JSX.Element, JSX.Element] | JSX.Element;\n if (popoverSurface) {\n if (popoverTrigger) {\n resolvedChildren = [popoverTrigger, popoverSurface];\n } else {\n resolvedChildren = popoverSurface;\n }\n }\n\n const popoverState = usePopover_unstable({\n ...props,\n children: resolvedChildren,\n onOpenChange: onPopoverOpenChange,\n open: open ?? isPopoverOpen,\n unstable_disableAutoFocus: unstable_disableAutoFocus ?? disableAutoFocus,\n });\n\n return {\n ...popoverState,\n isPreviewLocked: previewInternalState.openByClick || previewInternalState.openByKeyboard,\n };\n};\n"],"names":["onOpenChange","POPOVER_MOUSE_HIDE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","unstable_disableAutoFocus","targetDocument","open","setDisableAutoFocus","props","openByClick","Children","toArray","children","openByHoverOverTrigger","openByHoverOverPopover","openByKeyboard","setTimeout","clearTimeout","useTimeout","disableAutoFocus","triggerMousedOver","React","useState","previewInternalState","useRef","isPopoverOpen","preventDefaultClose","undefined","popoverSurface","popoverTrigger","setIsPopoverOpen","useId","closeCallback","isOpen","popoverSurfaceId","id","removeOpenedByHoverPreview","useEffect","handleTriggerTargetEnter","e","closeAllOpenedByHoverPreviews","handleTriggerTargetLeave","current","handleTriggerClick","tmpOpenByHoverOverTrigger","preventDefault","Enter","handlePopoverTargetLeave","cloneElement","onClick","onMouseEnter","mergeCallbacks","onMouseLeave","onKeyDown","handleTriggerKeyDown","_popoverSurface_props_arialabelledby","useIsomorphicLayoutEffect","handlePopoverTargetEnter","onDocumentKeyDown","key","Escape","addEventListener","capture","resolvedChildren","popoverState","usePopover_unstable","isPreviewLocked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA8CUA;;;eAAAA;;;;iEA9Ca;8BAEO;iCAOvB;gCACoB;uBAGwE;AAUnG,MAAMC,2BAA2B;AACjC,MAAMC,8BAA8B;AAEpC,MAAMC,WAAWC,CAAAA;QACfA,SAAIA,WAASA,SAAWA,QAAS;eAC/BF;;WAGFD;AACF;AAcE,MAAQD,sBAAoBK,CAAAA;UAE5B,EAEAL,YAAQM,EACRC,IAAA,EAEAF,yBAAyBG,KAEzBC;UACEC,WAAAA,OAAaC,QAAA,CAAAC,OAAA,CAAAH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A,QAAAA,SAA2BA,KAAAA,IAAAA,OAAAA;QAC7BA,2BAAAA,8BAAA,QAAAA,8BAAA,KAAA,IAAAA,4BAAAe;;WAGE;uBACA+C;QACFA,iBAAA3C,qBAAAd,WAAA,IAAAc,qBAAAR,cAAA;IACA"}
1
+ {"version":3,"sources":["usePreview.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Enter, Escape } from '@fluentui/keyboard-keys';\nimport {\n mergeCallbacks,\n resolvePositioningShorthand,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n usePopover_unstable,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\n\nimport { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';\nimport type { PreviewProps, PreviewState } from './Preview.types';\n\ntype PreviewInternalState = {\n openByClick: boolean;\n openByHoverOverTrigger: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_HIDE_DELAY = 500;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return POPOVER_MOUSE_HIDE_DELAY;\n};\n\ntype TargetEvent<T> = React.MouseEvent<T> | React.FocusEvent<T>;\n\n/**\n * Create the state required to render Preview.\n *\n * The returned state can be modified with hooks such as usePreviewStyles_unstable,\n * before being passed to renderPreview_unstable.\n *\n * @param props - props from this instance of Preview\n * @param ref - reference to root HTMLElement of Preview\n */\nexport const usePreview_unstable = (props: PreviewProps): PreviewState => {\n const { onOpenChange, open, positioning, unstable_disableAutoFocus } = props;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n const { targetDocument } = useFluent();\n const [setTimeout, clearTimeout] = useTimeout();\n\n const [disableAutoFocus, setDisableAutoFocus] = React.useState(true);\n\n const { current: previewInternalState } = React.useRef<PreviewInternalState>({\n openByClick: false,\n openByHoverOverTrigger: false,\n openByHoverOverPopover: false,\n openByKeyboard: false,\n });\n const triggerMousedOver = React.useRef(false);\n\n const isOpen = () => {\n return (\n previewInternalState.openByClick ||\n previewInternalState.openByHoverOverTrigger ||\n previewInternalState.openByHoverOverPopover ||\n previewInternalState.openByKeyboard\n );\n };\n\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\n const preventDefaultClose = React.useRef(false);\n\n let popoverTrigger: React.ReactElement | undefined = undefined;\n let popoverSurface: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n popoverTrigger = children[0];\n popoverSurface = children[1];\n } else if (children.length === 1) {\n popoverSurface = children[0];\n }\n\n const popoverSurfaceId = useId('preview-surface', popoverSurface?.props.id);\n\n const closeCallback = () => {\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n setIsPopoverOpen(isOpen());\n };\n\n React.useEffect(() => {\n return () => {\n // Remove all instances of the current popover from the openedByHoverPreviewManager when the component is unmounted.\n removeOpenedByHoverPreview(popoverSurfaceId);\n };\n }, [popoverSurfaceId]);\n\n if (popoverSurface && popoverTrigger) {\n const handleTriggerTargetEnter = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = true;\n triggerMousedOver.current = true;\n\n // We want to disable auto focus only if the popover is being opened by hovering over the trigger\n if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {\n setDisableAutoFocus(true);\n onOpenChange?.(e, { open: true });\n closeAllOpenedByHoverPreviews(popoverSurfaceId);\n addOpenedByHoverPreview(popoverSurfaceId, closeCallback);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = false;\n triggerMousedOver.current = false;\n\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the trigger\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverPopover &&\n isPopoverOpen\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n const handleTriggerClick = (e: TargetEvent<HTMLSpanElement>): void => {\n // Setting preventDefaultClose so that onPopoverOpenChange does not apply its logic when click is on the trigger as we want to control that behavior.\n preventDefaultClose.current = true;\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via click.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByKeyboard is true, then the popover was already opened via keyboard and we always want to close it.\n previewInternalState.openByClick = previewInternalState.openByKeyboard\n ? false\n : !previewInternalState.openByClick;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n previewInternalState.openByKeyboard = false;\n\n // We set triggerMousedOver to false when clicking, since we just interacted with the trigger via click, and not hover.\n if (triggerMousedOver.current) {\n previewInternalState.openByClick = false;\n triggerMousedOver.current = false;\n }\n // If it was not moused over, we want to prevent the default click action from opening a link, so the preview can open first\n else {\n e.preventDefault();\n }\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByClick });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleTriggerKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>): void => {\n if (e.key === Enter) {\n clearTimeout();\n\n // Setting default prevented so that Enter key does not trigger a click event or onPopoverOpenChange.\n e.preventDefault();\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via keyboard.\n setDisableAutoFocus(false);\n\n const tmpOpenByHoverOverTrigger = previewInternalState.openByHoverOverTrigger;\n\n // If openByClick is true, then the popover was already opened via click and we always want to close it.\n previewInternalState.openByKeyboard = previewInternalState.openByClick\n ? false\n : !previewInternalState.openByKeyboard;\n previewInternalState.openByClick = false;\n previewInternalState.openByHoverOverTrigger = false;\n previewInternalState.openByHoverOverPopover = false;\n\n if (!tmpOpenByHoverOverTrigger) {\n onOpenChange?.(e, { open: previewInternalState.openByKeyboard });\n }\n\n if (!isOpen()) {\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n setIsPopoverOpen(isOpen());\n }\n };\n\n const handlePopoverTargetEnter = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = true;\n setIsPopoverOpen(isOpen());\n };\n\n const handlePopoverTargetLeave = (e: TargetEvent<HTMLDivElement>): void => {\n previewInternalState.openByHoverOverPopover = false;\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n\n // We want to call onOpenChange only if the popover is actually closing when leaving the popover\n if (\n !previewInternalState.openByClick &&\n !previewInternalState.openByKeyboard &&\n !previewInternalState.openByHoverOverTrigger\n ) {\n onOpenChange?.(e, { open: false });\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n }, getDelay(e.type));\n };\n\n popoverTrigger = React.cloneElement(popoverTrigger, {\n ...popoverTrigger.props,\n children: React.cloneElement(popoverTrigger.props.children as React.ReactElement, {\n ...popoverTrigger.props.children.props,\n onBlur: mergeCallbacks(popoverTrigger.props.children.props.onBlur, handleTriggerTargetLeave),\n onClick: mergeCallbacks(popoverTrigger.props.children.props.onClick, handleTriggerClick),\n onKeyDown: mergeCallbacks(popoverTrigger.props.children.props.onKeyDown, handleTriggerKeyDown),\n onMouseEnter: mergeCallbacks(popoverTrigger.props.children.props.onMouseEnter, handleTriggerTargetEnter),\n onMouseLeave: mergeCallbacks(popoverTrigger.props.children.props.onMouseLeave, handleTriggerTargetLeave),\n }),\n });\n\n popoverSurface = React.cloneElement(popoverSurface, {\n ...popoverSurface.props,\n 'aria-labelledby':\n popoverSurface.props['aria-labelledby'] ?? popoverSurface.props['aria-label'] ? undefined : popoverSurfaceId,\n id: popoverSurfaceId,\n onMouseEnter: mergeCallbacks(popoverSurface.props.onMouseEnter, handlePopoverTargetEnter),\n onMouseLeave: mergeCallbacks(popoverSurface.props.onMouseLeave, handlePopoverTargetLeave),\n onFocus: mergeCallbacks(popoverSurface.props.onFocus, handlePopoverTargetEnter),\n });\n }\n\n // Hitting Escape key should close the popover if it was opened by hover.\n // This is necessary to attach to the document because focus is likely not within the trigger or popover.\n useIsomorphicLayoutEffect(() => {\n if (isPopoverOpen) {\n const onDocumentKeyDown = (e: KeyboardEvent) => {\n const openedByHover = !previewInternalState.openByClick && !previewInternalState.openByKeyboard;\n\n if (openedByHover && e.key === Escape) {\n clearTimeout();\n\n // We set state back to its default if the Escape key has been pressed\n setDisableAutoFocus(true);\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n\n onOpenChange?.(e as unknown as OpenPopoverEvents, { open: false });\n\n e.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, { capture: true });\n\n return () => {\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [targetDocument, isPopoverOpen]);\n\n const onPopoverOpenChange = (e: OpenPopoverEvents, data: OnOpenChangeData): void => {\n if (!preventDefaultClose.current) {\n // We set all open state to false if preventDefaultClose was not set to true and the popover is closing.\n if (!data.open) {\n clearTimeout();\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n onOpenChange?.(e, data);\n }\n\n preventDefaultClose.current = false;\n };\n\n let resolvedChildren = children as [JSX.Element, JSX.Element] | JSX.Element;\n if (popoverSurface) {\n if (popoverTrigger) {\n resolvedChildren = [popoverTrigger, popoverSurface];\n } else {\n resolvedChildren = popoverSurface;\n }\n }\n\n const popoverState = usePopover_unstable({\n ...props,\n children: resolvedChildren,\n onOpenChange: onPopoverOpenChange,\n open: open ?? isPopoverOpen,\n positioning:\n typeof positioning === 'string'\n ? { autoSize: true, ...resolvePositioningShorthand(positioning) }\n : { autoSize: true, ...positioning },\n unstable_disableAutoFocus: unstable_disableAutoFocus ?? disableAutoFocus,\n });\n\n return {\n ...popoverState,\n isPreviewLocked: previewInternalState.openByClick || previewInternalState.openByKeyboard,\n };\n};\n"],"names":["onOpenChange","POPOVER_MOUSE_HIDE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","positioning","targetDocument","open","disableAutoFocus","unstable_disableAutoFocus","previewInternalState","openByHoverOverTrigger","toArray","props","children","openByHoverOverPopover","openByKeyboard","useFluent","setTimeout","triggerMousedOver","React","useRef","setDisableAutoFocus","useState","current","isPopoverOpen","openByClick","preventDefaultClose","undefined","length","popoverSurface","isOpen","popoverSurfaceId","setIsPopoverOpen","useId","id","removeOpenedByHoverPreview","e","closeAllOpenedByHoverPreviews","addOpenedByHoverPreview","handleTriggerTargetLeave","handleTriggerClick","preventDefault","tmpOpenByHoverOverTrigger","handleTriggerKeyDown","popoverTrigger","cloneElement","mergeCallbacks","onKeyDown","onMouseLeave","onBlur","onClick","onMouseEnter","handlePopoverTargetEnter","_popoverSurface_props_arialabelledby","useIsomorphicLayoutEffect","onDocumentKeyDown","openedByHover","closeCallback","key","Escape","capture","addEventListener","removeEventListener","onPopoverOpenChange","clearTimeout","data","resolvedChildren","autoSize","resolvePositioningShorthand","isPreviewLocked","popoverState"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA+CUA;;;eAAAA;;;;iEA/Ca;8BAEO;iCAQvB;gCACoB;uBAGwE;AAU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A,iCAAA,EAAAJ;YAEA;YACAhC,iBAAI8B,QAAgB9B,iBAAA,KAAA,IAAA,KAAA,IAAAA,aAAAqC,GAAA6B;;4BAEhBC,OAAmB,GAAA;;2BAAiBrC;wBAAe;YACrDe,gBAAO;+BACLsB;gBAAAA;gBAAmBrC;aAAAA;eACrB;YACFqC,mBAAArC;QAEA;;UAEEhB,eAAUqD,IAAAA,oCAAAA,EAAAA;gBACVnE;kBACMO;sBACNF;uBAEQ+D,QAAU7D,SAAA,KAAA,IAAAA,OAAAkB;qBAAS4C,OAAAA,gBAAAA,WAA4BhE;sBACjD;+DAAY,EAAAA,YAAA;;sBAAqB;eACvCI,WAAAA;QACF;QAEAA,2BAAOA,8BAAA,QAAAA,8BAAA,KAAA,IAAAA,4BAAAD;;WAEL8D;QACF,GAAAC,YAAA;QACAD,iBAAA5D,qBAAAgB,WAAA,IAAAhB,qBAAAM,cAAA"}
@@ -22,9 +22,8 @@ const previewContentClassNames = {
22
22
  };
23
23
  /**
24
24
  * Styles for the root slot
25
- */ const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r3uexl1", "rbb2gfj", [
26
- ".r3uexl1{color:var(--colorNeutralForeground3);display:flex;flex-direction:column;padding-top:var(--spacingVerticalS);padding-right:var(--spacingHorizontalS);padding-bottom:var(--spacingVerticalS);padding-left:var(--spacingHorizontalS);row-gap:var(--spacingVerticalXS);word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}",
27
- ".rbb2gfj{color:var(--colorNeutralForeground3);display:flex;flex-direction:column;padding-top:var(--spacingVerticalS);padding-left:var(--spacingHorizontalS);padding-bottom:var(--spacingVerticalS);padding-right:var(--spacingHorizontalS);row-gap:var(--spacingVerticalXS);word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
25
+ */ const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r1jbsjc3", null, [
26
+ ".r1jbsjc3{color:var(--colorNeutralForeground3);display:flex;flex-direction:column;padding:var(--spacingVerticalS) var(--spacingHorizontalS);row-gap:var(--spacingVerticalXS);word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
28
27
  ]);
29
28
  const usePreviewContentStyles_unstable = (state)=>{
30
29
  'use no memo';
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreviewContentStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { PreviewContentSlots, PreviewContentState } from './PreviewContent.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewContentClassNames: SlotClassNames<PreviewContentSlots> = {\n root: 'fai-PreviewContent',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n color: tokens.colorNeutralForeground3,\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.padding(tokens.spacingVerticalS, tokens.spacingHorizontalS),\n rowGap: tokens.spacingVerticalXS,\n wordBreak: 'break-word',\n\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the PreviewContent slots based on the state\n */\nexport const usePreviewContentStyles_unstable = (state: PreviewContentState): PreviewContentState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n\n state.root.className = mergeClasses(previewContentClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["previewContentClassNames","tokens","root","color","colorNeutralForeground3","rowGap","state","rootBaseClassName","useRootBaseClassName","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAYHC,gCAAwB;eAAxBA;;;iCAhBkE;AAIrE,MAAMD,2BAAgE;UAC3EE;AACF;AAEA;;CAEC,SAECC,uBAAcC,IAAAA,8BAAuB,EAAA,WAAA,WAAA;IAAA;IAAA;CAAA;AAIrCC,MAAQJ,mCAAwBK,CAAAA;;IAIlC,MAAAC,oBAAAC;IAEAF,MAAAJ,IAAA,CAAAO,SAAA,GAAAC,IAAAA,6BAAA,EAAAV,yBAAAE,IAAA,EAAAK,mBAAAD,MAAAJ,IAAA,CAAAO,SAAA;;6DAIE"}
1
+ {"version":3,"sources":["usePreviewContentStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { PreviewContentSlots, PreviewContentState } from './PreviewContent.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewContentClassNames: SlotClassNames<PreviewContentSlots> = {\n root: 'fai-PreviewContent',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n color: tokens.colorNeutralForeground3,\n display: 'flex',\n flexDirection: 'column',\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n rowGap: tokens.spacingVerticalXS,\n wordBreak: 'break-word',\n\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the PreviewContent slots based on the state\n */\nexport const usePreviewContentStyles_unstable = (state: PreviewContentState): PreviewContentState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n\n state.root.className = mergeClasses(previewContentClassNames.root, rootBaseClassName, state.root.className);\n\n return state;\n};\n"],"names":["previewContentClassNames","tokens","root","color","colorNeutralForeground3","rowGap","state","rootBaseClassName","useRootBaseClassName","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;IAYHC,gCAAwB;eAAxBA;;;iCAhBsD;AAIzD,MAAMD,2BAAgE;UAC3EE;AACF;AAEA;;CAEC,SAECC,uBAAcC,IAAAA,8BAAuB,EAAA,YAAA,MAAA;IAAA;CAAA;AAIrCC,MAAQJ,mCAAwBK,CAAAA;;IAIlC,MAAAC,oBAAAC;IAEAF,MAAAJ,IAAA,CAAAO,SAAA,GAAAC,IAAAA,6BAAA,EAAAV,yBAAAE,IAAA,EAAAK,mBAAAD,MAAAJ,IAAA,CAAAO,SAAA;;6DAIE"}
@@ -25,24 +25,21 @@ const previewSurfaceClassNames = {
25
25
  */ const useRootStyles = (0, _reactcomponents.__styles)({
26
26
  base: {
27
27
  B2u0y6b: "f2rbwfs",
28
- z8tnut: "f1ywm7hm",
29
- z189sj: [
30
- "f7x41pl",
31
- "fruq291"
32
- ],
33
- Byoj8tv: "f14wxoun",
34
- uwmqm3: [
35
- "fruq291",
36
- "f7x41pl"
37
- ]
28
+ Byoj8tv: 0,
29
+ uwmqm3: 0,
30
+ z189sj: 0,
31
+ z8tnut: 0,
32
+ B0ocmuz: "f16d74zd"
38
33
  }
39
34
  }, {
40
35
  d: [
41
36
  ".f2rbwfs{max-width:256px;}",
42
- ".f1ywm7hm{padding-top:var(--spacingVerticalXS);}",
43
- ".f7x41pl{padding-right:var(--spacingHorizontalXS);}",
44
- ".fruq291{padding-left:var(--spacingHorizontalXS);}",
45
- ".f14wxoun{padding-bottom:var(--spacingVerticalXS);}"
37
+ [
38
+ ".f16d74zd{padding:var(--spacingVerticalXS) var(--spacingHorizontalXS);}",
39
+ {
40
+ p: -1
41
+ }
42
+ ]
46
43
  ]
47
44
  });
48
45
  const usePreviewSurfaceStyles_unstable = (state)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreviewSurfaceStyles.styles.ts"],"sourcesContent":["import {\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n usePopoverSurfaceStyles_unstable,\n} from '@fluentui/react-components';\nimport type { PreviewSurfaceSlots, PreviewSurfaceState } from './PreviewSurface.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewSurfaceClassNames: SlotClassNames<PreviewSurfaceSlots> = {\n root: 'fai-PreviewSurface',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n maxWidth: '256px',\n ...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalXS),\n },\n});\n\n/**\n * Apply styling to the PreviewSurface slots based on the state\n */\nexport const usePreviewSurfaceStyles_unstable = (state: PreviewSurfaceState): PreviewSurfaceState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n\n state.root.className = mergeClasses(previewSurfaceClassNames.root, rootStyles.base, state.root.className);\n\n usePopoverSurfaceStyles_unstable(state);\n\n return state;\n};\n"],"names":["previewSurfaceClassNames","root","base","__styles","maxWidth","shorthands","z8tnut","z189sj","Byoj8tv","useRootStyles"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAUaA,wBAAAA;eAAAA;;;;;;iCALqB;AAK3B,MAAMA,2BAAgE;UAC3EC;AACF;AAEA;;CAEC,SAECC,gBAAMC,IAAAA,yBAAA,EAAA;UACJC;iBACGC;QACLC,QAAA;QACFC,QAAA;YAAA;YAAA;SAAA;QAEAC,SAAA;;;;;IAEC;;OAIC;QAAA;QAAmBC;QAAAA;QAAAA;QAAAA;KAAAA"}
1
+ {"version":3,"sources":["usePreviewSurfaceStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, tokens, usePopoverSurfaceStyles_unstable } from '@fluentui/react-components';\nimport type { PreviewSurfaceSlots, PreviewSurfaceState } from './PreviewSurface.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewSurfaceClassNames: SlotClassNames<PreviewSurfaceSlots> = {\n root: 'fai-PreviewSurface',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootStyles = makeStyles({\n base: {\n maxWidth: '256px',\n padding: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalXS}`,\n },\n});\n\n/**\n * Apply styling to the PreviewSurface slots based on the state\n */\nexport const usePreviewSurfaceStyles_unstable = (state: PreviewSurfaceState): PreviewSurfaceState => {\n 'use no memo';\n\n const rootStyles = useRootStyles();\n\n state.root.className = mergeClasses(previewSurfaceClassNames.root, rootStyles.base, state.root.className);\n\n usePopoverSurfaceStyles_unstable(state);\n\n return state;\n};\n"],"names":["previewSurfaceClassNames","root","base","__styles","maxWidth","padding","Byoj8tv","uwmqm3","z189sj","B0ocmuz","state","mergeClasses","usePopoverSurfaceStyles_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,wBAAAA;eAAAA;;;;;;iCAJ8D;AAIpE,MAAMA,2BAAgE;UAC3EC;AACF;AAEA;;CAEC,SAECC,gBAAMC,IAAAA,yBAAA,EAAA;UACJC;iBACAC;QACFC,SAAA;QACFC,QAAA;QAEAC,QAAA;;QAGAC,SAAO;;;OAKLC;QAAAA;QAAuBC;YAAAA;YAAiF;gBAExGC,GAAAA,CAAAA;;SAEA;KAAA;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-copilot/react-preview",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Preview components.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -16,10 +16,10 @@
16
16
  },
17
17
  "peerDependencies": {
18
18
  "@fluentui/keyboard-keys": ">=9.0.7 <10.0.0",
19
- "@fluentui/react-components": ">=9.54.4 <10.0.0",
20
- "@fluentui/react-context-selector": ">=9.1.63 <10.0.0",
21
- "@fluentui/react-jsx-runtime": ">=9.0.40 <10.0.0",
22
- "@fluentui/react-utilities": ">=9.18.11 <10.0.0",
19
+ "@fluentui/react-components": ">=9.54.10 <10.0.0",
20
+ "@fluentui/react-context-selector": ">=9.1.65 <10.0.0",
21
+ "@fluentui/react-jsx-runtime": ">=9.0.42 <10.0.0",
22
+ "@fluentui/react-utilities": ">=9.18.13 <10.0.0",
23
23
  "@types/react": ">=16.14.0 <19.0.0",
24
24
  "@types/react-dom": ">=16.9.8 <19.0.0",
25
25
  "react": ">=16.14.0 <19.0.0",