@fluentui-copilot/react-preview 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.json +57 -1
  2. package/CHANGELOG.md +23 -2
  3. package/lib/components/Preview/usePreview.js +10 -0
  4. package/lib/components/Preview/usePreview.js.map +1 -1
  5. package/lib/components/PreviewContent/PreviewContent.js +1 -1
  6. package/lib/components/PreviewContent/PreviewContent.js.map +1 -1
  7. package/lib/components/PreviewContent/index.js +1 -1
  8. package/lib/components/PreviewContent/index.js.map +1 -1
  9. package/lib/components/PreviewContent/{usePreviewContentStyles.js → usePreviewContentStyles.styles.js} +3 -1
  10. package/lib/components/PreviewContent/usePreviewContentStyles.styles.js.map +1 -0
  11. package/lib/components/PreviewHeader/PreviewHeader.js +1 -1
  12. package/lib/components/PreviewHeader/PreviewHeader.js.map +1 -1
  13. package/lib/components/PreviewHeader/index.js +1 -1
  14. package/lib/components/PreviewHeader/index.js.map +1 -1
  15. package/lib/components/PreviewHeader/usePreviewHeader.js +1 -1
  16. package/lib/components/PreviewHeader/usePreviewHeader.js.map +1 -1
  17. package/lib/components/PreviewHeader/{usePreviewHeaderStyles.js → usePreviewHeaderStyles.styles.js} +4 -2
  18. package/lib/components/PreviewHeader/usePreviewHeaderStyles.styles.js.map +1 -0
  19. package/lib/components/PreviewMetadata/PreviewMetadata.js +1 -1
  20. package/lib/components/PreviewMetadata/PreviewMetadata.js.map +1 -1
  21. package/lib/components/PreviewMetadata/index.js +1 -1
  22. package/lib/components/PreviewMetadata/index.js.map +1 -1
  23. package/lib/components/PreviewMetadata/{usePreviewMetadataStyles.js → usePreviewMetadataStyles.styles.js} +3 -1
  24. package/lib/components/PreviewMetadata/usePreviewMetadataStyles.styles.js.map +1 -0
  25. package/lib/components/PreviewSurface/PreviewSurface.js +1 -1
  26. package/lib/components/PreviewSurface/PreviewSurface.js.map +1 -1
  27. package/lib/components/PreviewSurface/index.js +1 -1
  28. package/lib/components/PreviewSurface/index.js.map +1 -1
  29. package/lib/components/PreviewSurface/{usePreviewSurfaceStyles.js → usePreviewSurfaceStyles.styles.js} +3 -1
  30. package/lib/components/PreviewSurface/usePreviewSurfaceStyles.styles.js.map +1 -0
  31. package/lib-commonjs/components/Preview/usePreview.js +10 -0
  32. package/lib-commonjs/components/Preview/usePreview.js.map +1 -1
  33. package/lib-commonjs/components/PreviewContent/PreviewContent.js +2 -2
  34. package/lib-commonjs/components/PreviewContent/PreviewContent.js.map +1 -1
  35. package/lib-commonjs/components/PreviewContent/index.js +1 -1
  36. package/lib-commonjs/components/PreviewContent/index.js.map +1 -1
  37. package/lib-commonjs/components/PreviewContent/{usePreviewContentStyles.js → usePreviewContentStyles.styles.js} +2 -1
  38. package/lib-commonjs/components/PreviewContent/usePreviewContentStyles.styles.js.map +1 -0
  39. package/lib-commonjs/components/PreviewHeader/PreviewHeader.js +2 -2
  40. package/lib-commonjs/components/PreviewHeader/PreviewHeader.js.map +1 -1
  41. package/lib-commonjs/components/PreviewHeader/index.js +1 -1
  42. package/lib-commonjs/components/PreviewHeader/index.js.map +1 -1
  43. package/lib-commonjs/components/PreviewHeader/usePreviewHeader.js +2 -2
  44. package/lib-commonjs/components/PreviewHeader/usePreviewHeader.js.map +1 -1
  45. package/lib-commonjs/components/PreviewHeader/{usePreviewHeaderStyles.js → usePreviewHeaderStyles.styles.js} +4 -3
  46. package/lib-commonjs/components/PreviewHeader/usePreviewHeaderStyles.styles.js.map +1 -0
  47. package/lib-commonjs/components/PreviewMetadata/PreviewMetadata.js +2 -2
  48. package/lib-commonjs/components/PreviewMetadata/PreviewMetadata.js.map +1 -1
  49. package/lib-commonjs/components/PreviewMetadata/index.js +1 -1
  50. package/lib-commonjs/components/PreviewMetadata/index.js.map +1 -1
  51. package/lib-commonjs/components/PreviewMetadata/{usePreviewMetadataStyles.js → usePreviewMetadataStyles.styles.js} +2 -1
  52. package/lib-commonjs/components/PreviewMetadata/usePreviewMetadataStyles.styles.js.map +1 -0
  53. package/lib-commonjs/components/PreviewSurface/PreviewSurface.js +2 -2
  54. package/lib-commonjs/components/PreviewSurface/PreviewSurface.js.map +1 -1
  55. package/lib-commonjs/components/PreviewSurface/index.js +1 -1
  56. package/lib-commonjs/components/PreviewSurface/index.js.map +1 -1
  57. package/lib-commonjs/components/PreviewSurface/{usePreviewSurfaceStyles.js → usePreviewSurfaceStyles.styles.js} +2 -1
  58. package/lib-commonjs/components/PreviewSurface/usePreviewSurfaceStyles.styles.js.map +1 -0
  59. package/package.json +5 -5
  60. package/lib/components/PreviewContent/usePreviewContentStyles.js.map +0 -1
  61. package/lib/components/PreviewHeader/usePreviewHeaderStyles.js.map +0 -1
  62. package/lib/components/PreviewMetadata/usePreviewMetadataStyles.js.map +0 -1
  63. package/lib/components/PreviewSurface/usePreviewSurfaceStyles.js.map +0 -1
  64. package/lib-commonjs/components/PreviewContent/usePreviewContentStyles.js.map +0 -1
  65. package/lib-commonjs/components/PreviewHeader/usePreviewHeaderStyles.js.map +0 -1
  66. package/lib-commonjs/components/PreviewMetadata/usePreviewMetadataStyles.js.map +0 -1
  67. package/lib-commonjs/components/PreviewSurface/usePreviewSurfaceStyles.js.map +0 -1
package/CHANGELOG.json CHANGED
@@ -2,7 +2,63 @@
2
2
  "name": "@fluentui-copilot/react-preview",
3
3
  "entries": [
4
4
  {
5
- "date": "Wed, 08 May 2024 22:09:00 GMT",
5
+ "date": "Thu, 13 Jun 2024 21:00:14 GMT",
6
+ "tag": "@fluentui-copilot/react-preview_v0.4.4",
7
+ "version": "0.4.4",
8
+ "comments": {
9
+ "none": [
10
+ {
11
+ "author": "estebanmu@microsoft.com",
12
+ "package": "@fluentui-copilot/react-preview",
13
+ "commit": "f17f78e440c2dc6b0cd7ac5ac998ccf7f5c475d0",
14
+ "comment": "chore: Disable typecheck for ssr-tests."
15
+ }
16
+ ],
17
+ "patch": [
18
+ {
19
+ "author": "Humberto.Morimoto@microsoft.com",
20
+ "package": "@fluentui-copilot/react-preview",
21
+ "commit": "c8d54cf5a0b9f000a1b90fd647c4559d76153f32",
22
+ "comment": "fix: Fixing PreviewHeader styles, taking previewSurfaceProps.children into account in hook, and improving docs."
23
+ }
24
+ ]
25
+ }
26
+ },
27
+ {
28
+ "date": "Fri, 31 May 2024 18:42:53 GMT",
29
+ "tag": "@fluentui-copilot/react-preview_v0.4.3",
30
+ "version": "0.4.3",
31
+ "comments": {
32
+ "patch": [
33
+ {
34
+ "author": "Humberto.Morimoto@microsoft.com",
35
+ "package": "@fluentui-copilot/react-preview",
36
+ "commit": "dbd9212bded202a2b958699fdaacf75e864b3dbb",
37
+ "comment": "feat: Enabling new model where mouse over before a click on triggers navigates to links while touch still opens Preview component."
38
+ },
39
+ {
40
+ "author": "seanmonahan@microsoft.com",
41
+ "package": "@fluentui-copilot/react-preview",
42
+ "commit": "c2e14c44cafafbdc10f52b9855384748a7524a63",
43
+ "comment": "chore: add eslint-plugin-react-compiler"
44
+ },
45
+ {
46
+ "author": "tristan.watanabe@gmail.com",
47
+ "package": "@fluentui-copilot/react-preview",
48
+ "commit": "7583464747aec7a8a79a8c79eaeff85d749025e4",
49
+ "comment": "chore: bump @fluentui dependencies to latest 9.52.0."
50
+ },
51
+ {
52
+ "author": "tristan.watanabe@gmail.com",
53
+ "package": "@fluentui-copilot/react-preview",
54
+ "commit": "6df44dbcd267772e1b62426d14abe54a0b35bb97",
55
+ "comment": "chore: useStyle hook files now properly contain .styles. within filename."
56
+ }
57
+ ]
58
+ }
59
+ },
60
+ {
61
+ "date": "Wed, 08 May 2024 22:10:20 GMT",
6
62
  "tag": "@fluentui-copilot/react-preview_v0.4.2",
7
63
  "version": "0.4.2",
8
64
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,33 @@
1
1
  # Change Log - @fluentui-copilot/react-preview
2
2
 
3
- This log was last generated on Wed, 08 May 2024 22:09:00 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 13 Jun 2024 21:00:14 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [0.4.4](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.4.4)
8
+
9
+ Thu, 13 Jun 2024 21:00:14 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.4.3..@fluentui-copilot/react-preview_v0.4.4)
11
+
12
+ ### Patches
13
+
14
+ - fix: Fixing PreviewHeader styles, taking previewSurfaceProps.children into account in hook, and improving docs. ([PR #1702](https://github.com/microsoft/fluentai/pull/1702) by Humberto.Morimoto@microsoft.com)
15
+
16
+ ## [0.4.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.4.3)
17
+
18
+ Fri, 31 May 2024 18:42:53 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.4.2..@fluentui-copilot/react-preview_v0.4.3)
20
+
21
+ ### Patches
22
+
23
+ - feat: Enabling new model where mouse over before a click on triggers navigates to links while touch still opens Preview component. ([PR #1645](https://github.com/microsoft/fluentai/pull/1645) by Humberto.Morimoto@microsoft.com)
24
+ - chore: add eslint-plugin-react-compiler ([PR #1642](https://github.com/microsoft/fluentai/pull/1642) by seanmonahan@microsoft.com)
25
+ - chore: bump @fluentui dependencies to latest 9.52.0. ([PR #1657](https://github.com/microsoft/fluentai/pull/1657) by tristan.watanabe@gmail.com)
26
+ - chore: useStyle hook files now properly contain .styles. within filename. ([PR #1671](https://github.com/microsoft/fluentai/pull/1671) by tristan.watanabe@gmail.com)
27
+
7
28
  ## [0.4.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.4.2)
8
29
 
9
- Wed, 08 May 2024 22:09:00 GMT
30
+ Wed, 08 May 2024 22:10:20 GMT
10
31
  [Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.4.1..@fluentui-copilot/react-preview_v0.4.2)
11
32
 
12
33
  ### Patches
@@ -40,6 +40,7 @@ export const usePreview_unstable = props => {
40
40
  openByHoverOverPopover: false,
41
41
  openByKeyboard: false
42
42
  });
43
+ const triggerMousedOver = React.useRef(false);
43
44
  const isOpen = () => {
44
45
  return previewInternalState.openByClick || previewInternalState.openByHoverOverTrigger || previewInternalState.openByHoverOverPopover || previewInternalState.openByKeyboard;
45
46
  };
@@ -70,6 +71,7 @@ export const usePreview_unstable = props => {
70
71
  if (popoverSurface && popoverTrigger) {
71
72
  const handleTriggerTargetEnter = e => {
72
73
  previewInternalState.openByHoverOverTrigger = true;
74
+ triggerMousedOver.current = true;
73
75
  // We want to disable auto focus only if the popover is being opened by hovering over the trigger
74
76
  if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {
75
77
  setDisableAutoFocus(true);
@@ -83,6 +85,7 @@ export const usePreview_unstable = props => {
83
85
  };
84
86
  const handleTriggerTargetLeave = e => {
85
87
  previewInternalState.openByHoverOverTrigger = false;
88
+ triggerMousedOver.current = false;
86
89
  setTimeout(() => {
87
90
  setIsPopoverOpen(isOpen());
88
91
  // We want to call onOpenChange only if the popover is actually closing when leaving the trigger
@@ -105,6 +108,13 @@ export const usePreview_unstable = props => {
105
108
  previewInternalState.openByHoverOverTrigger = false;
106
109
  previewInternalState.openByHoverOverPopover = false;
107
110
  previewInternalState.openByKeyboard = false;
111
+ // We set triggerMousedOver to false when clicking, since we just interacted with the trigger via click, and not hover.
112
+ if (triggerMousedOver.current) {
113
+ previewInternalState.openByClick = false;
114
+ triggerMousedOver.current = false;
115
+ } else {
116
+ e.preventDefault();
117
+ }
108
118
  if (!tmpOpenByHoverOverTrigger) {
109
119
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
110
120
  open: previewInternalState.openByClick
@@ -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\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\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 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 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","isOpen","isPopoverOpen","setIsPopoverOpen","preventDefaultClose","popoverTrigger","undefined","popoverSurface","length","popoverSurfaceId","id","closeCallback","useEffect","handleTriggerTargetEnter","e","handleTriggerTargetLeave","handleTriggerClick","tmpOpenByHoverOverTrigger","handleTriggerKeyDown","key","preventDefault","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,MAAMI,WAAWrB,MAAMsB,QAAQ,CAACC,OAAO,CAACN,MAAMI,QAAQ;IAEtD,MAAM,EAAEG,cAAc,EAAE,GAAGpB;IAC3B,MAAM,CAACqB,YAAYC,aAAa,GAAGlB;IAEnC,MAAM,CAACmB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ACpF;QACF;IACF,GAAG;QAAC9C;QAAgBc;KAAc;IAElC,MAAMkC,sBAAsB,CAACtB,GAAsBuB;QACjD,IAAI,CAACjC,oBAAoBV,OAAO,EAAE;YAChC,wGAAwG;YACxG,IAAI,CAAC2C,KAAKtD,IAAI,EAAE;gBACdO;gBACAqB;gBACApC,2BAA2BkC;YAC7B;YAEA3B,yBAAAA,mCAAAA,aAAegC,GAAGuB;QACpB;QAEAjC,oBAAoBV,OAAO,GAAG;IAChC;IAEA,IAAI4C,mBAAmBrD;IACvB,IAAIsB,gBAAgB;QAClB,IAAIF,gBAAgB;YAClBiC,mBAAmB;gBAACjC;gBAAgBE;aAAe;QACrD,OAAO;YACL+B,mBAAmB/B;QACrB;IACF;IAEA,MAAMgC,eAAepE,oBAAoB;QACvC,GAAGU,KAAK;QACRI,UAAUqD;QACVxD,cAAcsD;QACdrD,MAAMA,iBAAAA,kBAAAA,OAAQmB;QACdlB,2BAA2BA,sCAAAA,uCAAAA,4BAA6BO;IAC1D;IAEA,OAAO;QACL,GAAGgD,YAAY;QACfC,iBAAiB7C,qBAAqBE,WAAW,IAAIF,qBAAqBK,cAAc;IAC1F;AACF,EAAE"}
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,MAAMI,WAAWrB,MAAMsB,QAAQ,CAACC,OAAO,CAACN,MAAMI,QAAQ;IAEtD,MAAM,EAAEG,cAAc,EAAE,GAAGpB;IAC3B,MAAM,CAACqB,YAAYC,aAAa,GAAGlB;IAEnC,MAAM,CAACmB,kBAAkBC,oBAAoB,GAAG5B,MAAM6B,QAAQ,CAAC;IAE/D,MAAM,EAAEC,SAASC,oBAAoB,EAAE,GAAG/B,MAAMgC,MAAM,C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AgB8C,gBAAgB,CAAC,WAAWH,mBAAmB;gBAAEI,SAAS;YAAK;YAE/E,OAAO;gBACL/C,2BAAAA,qCAAAA,eAAgBgD,mBAAmB,CAAC,WAAWL,mBAAmB;oBAAEI,SAAS;gBAAK;YACpF;QACF;IACF,GAAG;QAAC/C;QAAgBe;KAAc;IAElC,MAAMkC,sBAAsB,CAACtB,GAAsBuB;QACjD,IAAI,CAACjC,oBAAoBX,OAAO,EAAE;YAChC,wGAAwG;YACxG,IAAI,CAAC4C,KAAKvD,IAAI,EAAE;gBACdO;gBACAsB;gBACArC,2BAA2BmC;YAC7B;YAEA5B,yBAAAA,mCAAAA,aAAeiC,GAAGuB;QACpB;QAEAjC,oBAAoBX,OAAO,GAAG;IAChC;IAEA,IAAI6C,mBAAmBtD;IACvB,IAAIuB,gBAAgB;QAClB,IAAIF,gBAAgB;YAClBiC,mBAAmB;gBAACjC;gBAAgBE;aAAe;QACrD,OAAO;YACL+B,mBAAmB/B;QACrB;IACF;IAEA,MAAMgC,eAAerE,oBAAoB;QACvC,GAAGU,KAAK;QACRI,UAAUsD;QACVzD,cAAcuD;QACdtD,MAAMA,iBAAAA,kBAAAA,OAAQoB;QACdnB,2BAA2BA,sCAAAA,uCAAAA,4BAA6BO;IAC1D;IAEA,OAAO;QACL,GAAGiD,YAAY;QACfC,iBAAiB9C,qBAAqBE,WAAW,IAAIF,qBAAqBK,cAAc;IAC1F;AACF,EAAE"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { usePreviewContent_unstable } from './usePreviewContent';
3
3
  import { renderPreviewContent_unstable } from './renderPreviewContent';
4
- import { usePreviewContentStyles_unstable } from './usePreviewContentStyles';
4
+ import { usePreviewContentStyles_unstable } from './usePreviewContentStyles.styles';
5
5
  export const PreviewContent = /*#__PURE__*/React.forwardRef((props, ref) => {
6
6
  const state = usePreviewContent_unstable(props, ref);
7
7
  usePreviewContentStyles_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["PreviewContent.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewContent_unstable } from './usePreviewContent';\nimport { renderPreviewContent_unstable } from './renderPreviewContent';\nimport { usePreviewContentStyles_unstable } from './usePreviewContentStyles';\nimport type { PreviewContentProps } from './PreviewContent.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewContent: ForwardRefComponent<PreviewContentProps> = React.forwardRef((props, ref) => {\n const state = usePreviewContent_unstable(props, ref);\n\n usePreviewContentStyles_unstable(state);\n return renderPreviewContent_unstable(state);\n});\n\nPreviewContent.displayName = 'PreviewContent';\n"],"names":["React","usePreviewContent_unstable","renderPreviewContent_unstable","usePreviewContentStyles_unstable","PreviewContent","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,4BAA4B;AAI7E,OAAO,MAAMC,+BAA2DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQP,2BAA2BK,OAAOC;IAEhDJ,iCAAiCK;IACjC,OAAON,8BAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
1
+ {"version":3,"sources":["PreviewContent.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewContent_unstable } from './usePreviewContent';\nimport { renderPreviewContent_unstable } from './renderPreviewContent';\nimport { usePreviewContentStyles_unstable } from './usePreviewContentStyles.styles';\nimport type { PreviewContentProps } from './PreviewContent.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewContent: ForwardRefComponent<PreviewContentProps> = React.forwardRef((props, ref) => {\n const state = usePreviewContent_unstable(props, ref);\n\n usePreviewContentStyles_unstable(state);\n return renderPreviewContent_unstable(state);\n});\n\nPreviewContent.displayName = 'PreviewContent';\n"],"names":["React","usePreviewContent_unstable","renderPreviewContent_unstable","usePreviewContentStyles_unstable","PreviewContent","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAIpF,OAAO,MAAMC,+BAA2DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQP,2BAA2BK,OAAOC;IAEhDJ,iCAAiCK;IACjC,OAAON,8BAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
@@ -2,5 +2,5 @@ export * from './PreviewContent';
2
2
  export * from './PreviewContent.types';
3
3
  export * from './renderPreviewContent';
4
4
  export * from './usePreviewContent';
5
- export * from './usePreviewContentStyles';
5
+ export * from './usePreviewContentStyles.styles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewContent';\nexport * from './PreviewContent.types';\nexport * from './renderPreviewContent';\nexport * from './usePreviewContent';\nexport * from './usePreviewContentStyles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,4BAA4B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewContent';\nexport * from './PreviewContent.types';\nexport * from './renderPreviewContent';\nexport * from './usePreviewContent';\nexport * from './usePreviewContentStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,mCAAmC"}
@@ -10,8 +10,10 @@ const useRootBaseClassName = __resetStyles("r3uexl1", "rbb2gfj", [".r3uexl1{colo
10
10
  * Apply styling to the PreviewContent slots based on the state
11
11
  */
12
12
  export const usePreviewContentStyles_unstable = state => {
13
+ 'use no memo';
14
+
13
15
  const rootBaseClassName = useRootBaseClassName();
14
16
  state.root.className = mergeClasses(previewContentClassNames.root, rootBaseClassName, state.root.className);
15
17
  return state;
16
18
  };
17
- //# sourceMappingURL=usePreviewContentStyles.js.map
19
+ //# sourceMappingURL=usePreviewContentStyles.styles.js.map
@@ -0,0 +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,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { usePreviewHeader_unstable } from './usePreviewHeader';
3
3
  import { renderPreviewHeader_unstable } from './renderPreviewHeader';
4
- import { usePreviewHeaderStyles_unstable } from './usePreviewHeaderStyles';
4
+ import { usePreviewHeaderStyles_unstable } from './usePreviewHeaderStyles.styles';
5
5
  export const PreviewHeader = /*#__PURE__*/React.forwardRef((props, ref) => {
6
6
  const state = usePreviewHeader_unstable(props, ref);
7
7
  usePreviewHeaderStyles_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["PreviewHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewHeader_unstable } from './usePreviewHeader';\nimport { renderPreviewHeader_unstable } from './renderPreviewHeader';\nimport { usePreviewHeaderStyles_unstable } from './usePreviewHeaderStyles';\nimport type { PreviewHeaderProps } from './PreviewHeader.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewHeader: ForwardRefComponent<PreviewHeaderProps> = React.forwardRef((props, ref) => {\n const state = usePreviewHeader_unstable(props, ref);\n\n usePreviewHeaderStyles_unstable(state);\n return renderPreviewHeader_unstable(state);\n});\n\nPreviewHeader.displayName = 'PreviewHeader';\n"],"names":["React","usePreviewHeader_unstable","renderPreviewHeader_unstable","usePreviewHeaderStyles_unstable","PreviewHeader","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,+BAA+B,QAAQ,2BAA2B;AAI3E,OAAO,MAAMC,8BAAyDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC7F,MAAMC,QAAQP,0BAA0BK,OAAOC;IAE/CJ,gCAAgCK;IAChC,OAAON,6BAA6BM;AACtC,GAAG;AAEHJ,cAAcK,WAAW,GAAG"}
1
+ {"version":3,"sources":["PreviewHeader.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewHeader_unstable } from './usePreviewHeader';\nimport { renderPreviewHeader_unstable } from './renderPreviewHeader';\nimport { usePreviewHeaderStyles_unstable } from './usePreviewHeaderStyles.styles';\nimport type { PreviewHeaderProps } from './PreviewHeader.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewHeader: ForwardRefComponent<PreviewHeaderProps> = React.forwardRef((props, ref) => {\n const state = usePreviewHeader_unstable(props, ref);\n\n usePreviewHeaderStyles_unstable(state);\n return renderPreviewHeader_unstable(state);\n});\n\nPreviewHeader.displayName = 'PreviewHeader';\n"],"names":["React","usePreviewHeader_unstable","renderPreviewHeader_unstable","usePreviewHeaderStyles_unstable","PreviewHeader","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,+BAA+B,QAAQ,kCAAkC;AAIlF,OAAO,MAAMC,8BAAyDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC7F,MAAMC,QAAQP,0BAA0BK,OAAOC;IAE/CJ,gCAAgCK;IAChC,OAAON,6BAA6BM;AACtC,GAAG;AAEHJ,cAAcK,WAAW,GAAG"}
@@ -2,5 +2,5 @@ export * from './PreviewHeader';
2
2
  export * from './PreviewHeader.types';
3
3
  export * from './renderPreviewHeader';
4
4
  export * from './usePreviewHeader';
5
- export * from './usePreviewHeaderStyles';
5
+ export * from './usePreviewHeaderStyles.styles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewHeader';\nexport * from './PreviewHeader.types';\nexport * from './renderPreviewHeader';\nexport * from './usePreviewHeader';\nexport * from './usePreviewHeaderStyles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,2BAA2B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewHeader';\nexport * from './PreviewHeader.types';\nexport * from './renderPreviewHeader';\nexport * from './usePreviewHeader';\nexport * from './usePreviewHeaderStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,kBAAkB;AAChC,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,qBAAqB;AACnC,cAAc,kCAAkC"}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';
3
- import { previewHeaderExtraClassNames } from './usePreviewHeaderStyles';
3
+ import { previewHeaderExtraClassNames } from './usePreviewHeaderStyles.styles';
4
4
  /**
5
5
  * Create the state required to render PreviewHeader.
6
6
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["usePreviewHeader.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { previewHeaderExtraClassNames } from './usePreviewHeaderStyles';\nimport type { PreviewHeaderProps, PreviewHeaderState } from './PreviewHeader.types';\n\n/**\n * Create the state required to render PreviewHeader.\n *\n * The returned state can be modified with hooks such as usePreviewHeaderStyles_unstable,\n * before being passed to renderPreviewHeader_unstable.\n *\n * @param props - props from this instance of PreviewHeader\n * @param ref - reference to root HTMLElement of PreviewHeader\n */\nexport const usePreviewHeader_unstable = (\n props: PreviewHeaderProps,\n ref: React.Ref<HTMLDivElement>,\n): PreviewHeaderState => {\n const { actions, children, citation, label, media } = props;\n\n const mediaId = useId('media');\n\n const state: PreviewHeaderState = {\n components: {\n root: 'div',\n actions: 'div',\n citation: 'span',\n label: 'span',\n media: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n actions: slot.optional(actions, { elementType: 'div' }),\n citation: slot.optional(citation, { elementType: 'span' }),\n label: slot.always(label, {\n defaultProps: {\n children,\n },\n elementType: 'span',\n }),\n media: slot.optional(media, {\n defaultProps: {\n id: mediaId,\n },\n elementType: 'div',\n }),\n };\n\n if (state.media?.id) {\n state.label['aria-describedby'] = state.label['aria-describedby']?.concat(state.media.id) ?? state.media.id;\n }\n\n if (state.media && React.isValidElement<HTMLElement>(state.media.children)) {\n state.media.children = React.cloneElement(state.media.children, {\n className: mergeClasses(state.media.children.props.className, previewHeaderExtraClassNames.mediaChild),\n });\n }\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeClasses","slot","useId","previewHeaderExtraClassNames","usePreviewHeader_unstable","props","ref","state","actions","children","citation","label","media","mediaId","components","root","always","elementType","optional","defaultProps","id","concat","isValidElement","cloneElement","className","mediaChild"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,IAAI,EAAEC,KAAK,Q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EAAE;YAC9De,WAAWxB,aAAaO,MAAMK,KAAK,CAACH,QAAQ,CAACJ,KAAK,CAACmB,SAAS,EAAErB,6BAA6BsB,UAAU;QACvG;IACF;IAEA,OAAOlB;AACT,EAAE"}
1
+ {"version":3,"sources":["usePreviewHeader.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { previewHeaderExtraClassNames } from './usePreviewHeaderStyles.styles';\nimport type { PreviewHeaderProps, PreviewHeaderState } from './PreviewHeader.types';\n\n/**\n * Create the state required to render PreviewHeader.\n *\n * The returned state can be modified with hooks such as usePreviewHeaderStyles_unstable,\n * before being passed to renderPreviewHeader_unstable.\n *\n * @param props - props from this instance of PreviewHeader\n * @param ref - reference to root HTMLElement of PreviewHeader\n */\nexport const usePreviewHeader_unstable = (\n props: PreviewHeaderProps,\n ref: React.Ref<HTMLDivElement>,\n): PreviewHeaderState => {\n const { actions, children, citation, label, media } = props;\n\n const mediaId = useId('media');\n\n const state: PreviewHeaderState = {\n components: {\n root: 'div',\n actions: 'div',\n citation: 'span',\n label: 'span',\n media: 'div',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n ...props,\n }),\n { elementType: 'div' },\n ),\n actions: slot.optional(actions, { elementType: 'div' }),\n citation: slot.optional(citation, { elementType: 'span' }),\n label: slot.always(label, {\n defaultProps: {\n children,\n },\n elementType: 'span',\n }),\n media: slot.optional(media, {\n defaultProps: {\n id: mediaId,\n },\n elementType: 'div',\n }),\n };\n\n if (state.media?.id) {\n state.label['aria-describedby'] = state.label['aria-describedby']?.concat(state.media.id) ?? state.media.id;\n }\n\n if (state.media && React.isValidElement<HTMLElement>(state.media.children)) {\n state.media.children = React.cloneElement(state.media.children, {\n className: mergeClasses(state.media.children.props.className, previewHeaderExtraClassNames.mediaChild),\n });\n }\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeClasses","slot","useId","previewHeaderExtraClassNames","usePreviewHeader_unstable","props","ref","state","actions","children","citation","label","media","mediaId","components","root","always","elementType","optional","defaultProps","id","concat","isValidElement","cloneElement","className","mediaChild"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,IAAI,EAAEC,KAAK,QAAQ,6BAA6B;AACjG,SAASC,4BAA4B,QAAQ,kCAAkC;AAG/E;;;;;;;;CAQC,GACD,OAAO,MAAMC,4BAA4B,CACvCC,OACAC;QAqCIC;IAnCJ,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGP;IAEtD,MAAMQ,UAAUX,MAAM;IAEtB,MAAMK,QAA4B;QAChCO,YAAY;YACVC,MAAM;YACNP,SAAS;YACTE,UAAU;YACVC,OAAO;YACPC,OAAO;QACT;QACAG,MAAMd,KAAKe,MAAM,CACfjB,yBAAyB,OAAO;YAC9BO;YACA,GAAGD,KAAK;QACV,IACA;YAAEY,aAAa;QAAM;QAEvBT,SAASP,KAAKiB,QAAQ,CAACV,SAAS;YAAES,aAAa;QAAM;QACrDP,UAAUT,KAAKiB,QAAQ,CAACR,UAAU;YAAEO,aAAa;QAAO;QACxDN,OAAOV,KAAKe,MAAM,CAACL,OAAO;YACxBQ,cAAc;gBACZV;YACF;YACAQ,aAAa;QACf;QACAL,OAAOX,KAAKiB,QAAQ,CAACN,OAAO;YAC1BO,cAAc;gBACZC,IAAIP;YACN;YACAI,aAAa;QACf;IACF;IAEA,KAAIV,eAAAA,MAAMK,KAAK,cAAXL,mCAAAA,aAAaa,EAAE,EAAE;YACeb;YAAAA;QAAlCA,MAAMI,KAAK,CAAC,mBAAmB,GAAGJ,CAAAA,uCAAAA,+BAAAA,MAAMI,KAAK,CAAC,mBAAmB,cAA/BJ,mDAAAA,6BAAiCc,MAAM,CAACd,MAAMK,KAAK,CAACQ,EAAE,eAAtDb,iDAAAA,sCAA2DA,MAAMK,KAAK,CAACQ,EAAE;IAC7G;IAEA,IAAIb,MAAMK,KAAK,IAAId,MAAMwB,cAAc,CAAcf,MAAMK,KAAK,CAACH,QAAQ,GAAG;QAC1EF,MAAMK,KAAK,CAACH,QAAQ,GAAGX,MAAMyB,YAAY,CAAChB,MAAMK,KAAK,CAACH,QAAQ,EAAE;YAC9De,WAAWxB,aAAaO,MAAMK,KAAK,CAACH,QAAQ,CAACJ,KAAK,CAACmB,SAAS,EAAErB,6BAA6BsB,UAAU;QACvG;IACF;IAEA,OAAOlB;AACT,EAAE"}
@@ -15,11 +15,13 @@ const useActionsBaseClassName = __resetStyles("r1vsmujd", null, [".r1vsmujd{grid
15
15
  const useCitationBaseClassName = __resetStyles("r1ndcjgs", null, [".r1ndcjgs{grid-area:citation;}"]);
16
16
  const useLabelBaseClassName = __resetStyles("rctmm17", null, [".rctmm17{align-self:start;display:-webkit-box;grid-area:label;overflow-y:hidden;padding-top:calc((16px / 2) - (var(--lineHeightBase200) - var(--fontSizeBase200)));word-break:break-word;-webkit-box-orient:vertical;-webkit-line-clamp:2;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightSemibold);line-height:var(--lineHeightBase200);}"]);
17
17
  const useMediaBaseClassName = __resetStyles("rmteimt", null, [".rmteimt{grid-area:media;height:16px;line-height:0;width:16px;}", ".rmteimt>.fai-PreviewHeader__mediaChild{height:16px;width:16px;}"]);
18
- const useRootBaseClassName = __resetStyles("r1p46sa7", null, [".r1p46sa7{align-items:center;column-gap:var(--spacingHorizontalXS);display:grid;grid-template-areas:\"citation media label actions\" \". . label .\";grid-template-columns:min-content 16px 1fr min-content;grid-template-rows:24px auto;}"]);
18
+ const useRootBaseClassName = __resetStyles("r4h7o2l", null, [".r4h7o2l{align-items:center;column-gap:var(--spacingHorizontalXS);display:grid;grid-template-areas:\"citation media label actions\" \". . label .\";grid-template-columns:min-content min-content 1fr min-content;grid-template-rows:24px auto;}"]);
19
19
  /**
20
20
  * Apply styling to the PreviewHeader slots based on the state
21
21
  */
22
22
  export const usePreviewHeaderStyles_unstable = state => {
23
+ 'use no memo';
24
+
23
25
  const actionsBaseClassName = useActionsBaseClassName();
24
26
  const citationBaseClassName = useCitationBaseClassName();
25
27
  const labelBaseClassName = useLabelBaseClassName();
@@ -38,4 +40,4 @@ export const usePreviewHeaderStyles_unstable = state => {
38
40
  }
39
41
  return state;
40
42
  };
41
- //# sourceMappingURL=usePreviewHeaderStyles.js.map
43
+ //# sourceMappingURL=usePreviewHeaderStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["usePreviewHeaderStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { PreviewHeaderSlots, PreviewHeaderState } from './PreviewHeader.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewHeaderClassNames: SlotClassNames<PreviewHeaderSlots> = {\n root: 'fai-PreviewHeader',\n actions: 'fai-PreviewHeader__actions',\n citation: 'fai-PreviewHeader__citation',\n label: 'fai-PreviewHeader__label',\n media: 'fai-PreviewHeader__media',\n};\n\nexport const previewHeaderExtraClassNames = {\n mediaChild: 'fai-PreviewHeader__mediaChild',\n};\n\nconst labelFontSize = typographyStyles.caption1Strong.fontSize;\nconst labelLineHeight = typographyStyles.caption1Strong.lineHeight;\n\nconst useActionsBaseClassName = makeResetStyles({\n gridArea: 'actions',\n justifySelf: 'end',\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n gridArea: 'citation',\n});\n\nconst useLabelBaseClassName = makeResetStyles({\n alignSelf: 'start',\n display: '-webkit-box',\n gridArea: 'label',\n overflowY: 'hidden',\n // 16px is the height of the tallest element within the preview header\n paddingTop: `calc((16px / 2) - (${labelLineHeight} - ${labelFontSize}))`,\n wordBreak: 'break-word',\n\n '-webkit-box-orient': 'vertical',\n '-webkit-line-clamp': '2',\n\n ...typographyStyles.caption1Strong,\n});\n\nconst useMediaBaseClassName = makeResetStyles({\n gridArea: 'media',\n height: '16px',\n lineHeight: 0,\n width: '16px',\n\n [`> .${previewHeaderExtraClassNames.mediaChild}`]: {\n height: '16px',\n width: '16px',\n },\n});\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n columnGap: tokens.spacingHorizontalXS,\n display: 'grid',\n gridTemplateAreas: `\n \"citation media label actions\"\n \". . label .\"\n `,\n gridTemplateColumns: 'min-content min-content 1fr min-content',\n gridTemplateRows: '24px auto',\n});\n\n/**\n * Apply styling to the PreviewHeader slots based on the state\n */\nexport const usePreviewHeaderStyles_unstable = (state: PreviewHeaderState): PreviewHeaderState => {\n 'use no memo';\n\n const actionsBaseClassName = useActionsBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const labelBaseClassName = useLabelBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const rootBaseClassName = useRootBaseClassName();\n\n state.root.className = mergeClasses(previewHeaderClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.actions) {\n state.actions.className = mergeClasses(\n previewHeaderClassNames.actions,\n actionsBaseClassName,\n state.actions.className,\n );\n }\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n previewHeaderClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n state.label.className = mergeClasses(previewHeaderClassNames.label, labelBaseClassName, state.label.className);\n\n if (state.media) {\n state.media.className = mergeClasses(previewHeaderClassNames.media, mediaBaseClassName, state.media.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","mergeClasses","tokens","typographyStyles","previewHeaderClassNames","root","actions","citation","label","media","previewHeaderExtraClassNames","mediaChild","labelFontSize","caption1Strong","fontSize","labelLineHeight","lineHeight","useActionsBaseClassName","gridArea","justifySelf","useCitationBaseClassName","useLabelBaseClassName","alignSelf","display","overflowY","paddingTop","wordBreak","useMediaBaseClassName","height","width","useRootBaseClassName","alignItems","columnGap","spacingHorizontalXS","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","usePreviewHeaderStyles_unstable","state","actionsBaseClassName","citationBaseClassName","labelBaseClassName","mediaBaseClassName","rootBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,MAAM,EAAEC,gBAAgB,QAAQ,6BAA6B;AAIrG,OAAO,MAAMC,0BAA8D;IACzEC,MAAM;IACNC,SAAS;IACTC,UAAU;IACVC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,+BAA+B;IAC1CC,YAAY;AACd,EAAE;AAEF,MAAMC,gBAAgBT,iBAAiBU,cAAc,CAACC,QAAQ;AAC9D,MAAMC,kBAAkBZ,iBAAiBU,cAAc,CAACG,UAAU;AAElE,MAAMC,0BAA0BjB,gBAAgB;IAC9CkB,UAAU;IACVC,aAAa;AACf;AAEA,MAAMC,2BAA2BpB,gBAAgB;IAC/CkB,UAAU;AACZ;AAEA,MAAMG,wBAAwBrB,gBAAgB;IAC5CsB,WAAW;IACXC,SAAS;IACTL,UAAU;IACVM,WAAW;IACX,sEAAsE;IACtEC,YAAY,CAAC,mBAAmB,EAAEV,gBAAgB,GAAG,EAAEH,cAAc,EAAE,CAAC;IACxEc,WAAW;IAEX,sBAAsB;IACtB,sBAAsB;IAEtB,GAAGvB,iBAAiBU,cAAc;AACpC;AAEA,MAAMc,wBAAwB3B,gBAAgB;IAC5CkB,UAAU;IACVU,QAAQ;IACRZ,YAAY;IACZa,OAAO;IAEP,CAAC,CAAC,GAAG,EAAEnB,6BAA6BC,UAAU,CAAC,CAAC,CAAC,EAAE;QACjDiB,QAAQ;QACRC,OAAO;IACT;AACF;AAEA,MAAMC,uBAAuB9B,gBAAgB;IAC3C+B,YAAY;IACZC,WAAW9B,OAAO+B,mBAAmB;IACrCV,SAAS;IACTW,mBAAmB,CAAC;;;IAGlB,CAAC;IACHC,qBAAqB;IACrBC,kBAAkB;AACpB;AAEA;;CAEC,GACD,OAAO,MAAMC,kCAAkC,CAACC;IAC9C;IAEA,MAAMC,uBAAuBtB;IAC7B,MAAMuB,wBAAwBpB;IAC9B,MAAMqB,qBAAqBpB;IAC3B,MAAMqB,qBAAqBf;IAC3B,MAAMgB,oBAAoBb;IAE1BQ,MAAMjC,IAAI,CAACuC,SAAS,GAAG3C,aAAaG,wBAAwBC,IAAI,EAAEsC,mBAAmBL,MAAMjC,IAAI,CAACuC,SAAS;IAEzG,IAAIN,MAAMhC,OAAO,EAAE;QACjBgC,MAAMhC,OAAO,CAACsC,SAAS,GAAG3C,aACxBG,wBAAwBE,OAAO,EAC/BiC,sBACAD,MAAMhC,OAAO,CAACsC,SAAS;IAE3B;IAEA,IAAIN,MAAM/B,QAAQ,EAAE;QAClB+B,MAAM/B,QAAQ,CAACqC,SAAS,GAAG3C,aACzBG,wBAAwBG,QAAQ,EAChCiC,uBACAF,MAAM/B,QAAQ,CAACqC,SAAS;IAE5B;IAEAN,MAAM9B,KAAK,CAACoC,SAAS,GAAG3C,aAAaG,wBAAwBI,KAAK,EAAEiC,oBAAoBH,MAAM9B,KAAK,CAACoC,SAAS;IAE7G,IAAIN,MAAM7B,KAAK,EAAE;QACf6B,MAAM7B,KAAK,CAACmC,SAAS,GAAG3C,aAAaG,wBAAwBK,KAAK,EAAEiC,oBAAoBJ,MAAM7B,KAAK,CAACmC,SAAS;IAC/G;IAEA,OAAON;AACT,EAAE"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { usePreviewMetadata_unstable } from './usePreviewMetadata';
3
3
  import { renderPreviewMetadata_unstable } from './renderPreviewMetadata';
4
- import { usePreviewMetadataStyles_unstable } from './usePreviewMetadataStyles';
4
+ import { usePreviewMetadataStyles_unstable } from './usePreviewMetadataStyles.styles';
5
5
  export const PreviewMetadata = /*#__PURE__*/React.forwardRef((props, ref) => {
6
6
  const state = usePreviewMetadata_unstable(props, ref);
7
7
  usePreviewMetadataStyles_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["PreviewMetadata.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewMetadata_unstable } from './usePreviewMetadata';\nimport { renderPreviewMetadata_unstable } from './renderPreviewMetadata';\nimport { usePreviewMetadataStyles_unstable } from './usePreviewMetadataStyles';\nimport type { PreviewMetadataProps } from './PreviewMetadata.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewMetadata: ForwardRefComponent<PreviewMetadataProps> = React.forwardRef((props, ref) => {\n const state = usePreviewMetadata_unstable(props, ref);\n\n usePreviewMetadataStyles_unstable(state);\n return renderPreviewMetadata_unstable(state);\n});\n\nPreviewMetadata.displayName = 'PreviewMetadata';\n"],"names":["React","usePreviewMetadata_unstable","renderPreviewMetadata_unstable","usePreviewMetadataStyles_unstable","PreviewMetadata","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,QAAQ,uBAAuB;AACnE,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,iCAAiC,QAAQ,6BAA6B;AAI/E,OAAO,MAAMC,gCAA6DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACjG,MAAMC,QAAQP,4BAA4BK,OAAOC;IAEjDJ,kCAAkCK;IAClC,OAAON,+BAA+BM;AACxC,GAAG;AAEHJ,gBAAgBK,WAAW,GAAG"}
1
+ {"version":3,"sources":["PreviewMetadata.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewMetadata_unstable } from './usePreviewMetadata';\nimport { renderPreviewMetadata_unstable } from './renderPreviewMetadata';\nimport { usePreviewMetadataStyles_unstable } from './usePreviewMetadataStyles.styles';\nimport type { PreviewMetadataProps } from './PreviewMetadata.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewMetadata: ForwardRefComponent<PreviewMetadataProps> = React.forwardRef((props, ref) => {\n const state = usePreviewMetadata_unstable(props, ref);\n\n usePreviewMetadataStyles_unstable(state);\n return renderPreviewMetadata_unstable(state);\n});\n\nPreviewMetadata.displayName = 'PreviewMetadata';\n"],"names":["React","usePreviewMetadata_unstable","renderPreviewMetadata_unstable","usePreviewMetadataStyles_unstable","PreviewMetadata","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,2BAA2B,QAAQ,uBAAuB;AACnE,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,iCAAiC,QAAQ,oCAAoC;AAItF,OAAO,MAAMC,gCAA6DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACjG,MAAMC,QAAQP,4BAA4BK,OAAOC;IAEjDJ,kCAAkCK;IAClC,OAAON,+BAA+BM;AACxC,GAAG;AAEHJ,gBAAgBK,WAAW,GAAG"}
@@ -2,5 +2,5 @@ export * from './PreviewMetadata';
2
2
  export * from './PreviewMetadata.types';
3
3
  export * from './renderPreviewMetadata';
4
4
  export * from './usePreviewMetadata';
5
- export * from './usePreviewMetadataStyles';
5
+ export * from './usePreviewMetadataStyles.styles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewMetadata';\nexport * from './PreviewMetadata.types';\nexport * from './renderPreviewMetadata';\nexport * from './usePreviewMetadata';\nexport * from './usePreviewMetadataStyles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,0BAA0B;AACxC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB;AACrC,cAAc,6BAA6B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewMetadata';\nexport * from './PreviewMetadata.types';\nexport * from './renderPreviewMetadata';\nexport * from './usePreviewMetadata';\nexport * from './usePreviewMetadataStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,0BAA0B;AACxC,cAAc,0BAA0B;AACxC,cAAc,uBAAuB;AACrC,cAAc,oCAAoC"}
@@ -29,6 +29,8 @@ const useTextStyles = __styles({
29
29
  * Apply styling to the PreviewMetadata slots based on the state
30
30
  */
31
31
  export const usePreviewMetadataStyles_unstable = state => {
32
+ 'use no memo';
33
+
32
34
  const rootBaseClassName = useRootBaseClassName();
33
35
  const iconBaseClassName = useIconBaseClassName();
34
36
  const textStyles = useTextStyles();
@@ -50,4 +52,4 @@ export const usePreviewMetadataStyles_unstable = state => {
50
52
  }
51
53
  return state;
52
54
  };
53
- //# sourceMappingURL=usePreviewMetadataStyles.js.map
55
+ //# sourceMappingURL=usePreviewMetadataStyles.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["usePreviewMetadataStyles.styles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { PreviewMetadataSlots, PreviewMetadataState } from './PreviewMetadata.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const previewMetadataClassNames: SlotClassNames<PreviewMetadataSlots> = {\n root: 'fai-PreviewMetadata',\n icon: 'fai-PreviewMetadata__icon',\n primaryText: 'fai-PreviewMetadata__primaryText',\n secondaryText: 'fai-PreviewMetadata__secondaryText',\n tertiaryText: 'fai-PreviewMetadata__tertiaryText',\n};\n\nconst useRootBaseClassName = makeResetStyles({\n ...typographyStyles.caption2,\n});\n\nconst useIconBaseClassName = makeResetStyles({\n marginLeft: tokens.spacingHorizontalSNudge,\n verticalAlign: 'middle',\n});\n\nconst useTextStyles = makeStyles({\n subsequentText: {\n marginLeft: `calc(${tokens.spacingHorizontalSNudge} * 2)`,\n position: 'relative',\n\n '&::before': {\n ...shorthands.borderLeft(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n content: '\"\"',\n display: 'block',\n height: typographyStyles.caption2.fontSize,\n left: `calc(-1 * ${tokens.spacingHorizontalSNudge})`,\n position: 'absolute',\n top: `calc((${typographyStyles.caption2.lineHeight} - ${typographyStyles.caption2.fontSize}) / 2)`,\n },\n },\n});\n\n/**\n * Apply styling to the PreviewMetadata slots based on the state\n */\nexport const usePreviewMetadataStyles_unstable = (state: PreviewMetadataState): PreviewMetadataState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const iconBaseClassName = useIconBaseClassName();\n const textStyles = useTextStyles();\n\n state.root.className = mergeClasses(previewMetadataClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.icon) {\n state.icon.className = mergeClasses(previewMetadataClassNames.icon, iconBaseClassName, state.icon.className);\n }\n\n let isSubsequentAfterText = false;\n\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(previewMetadataClassNames.primaryText, state.primaryText.className);\n isSubsequentAfterText = true;\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n previewMetadataClassNames.secondaryText,\n isSubsequentAfterText && textStyles.subsequentText,\n state.secondaryText.className,\n );\n isSubsequentAfterText = true;\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n previewMetadataClassNames.tertiaryText,\n isSubsequentAfterText && textStyles.subsequentText,\n state.tertiaryText.className,\n );\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","previewMetadataClassNames","root","icon","primaryText","secondaryText","tertiaryText","useRootBaseClassName","caption2","useIconBaseClassName","marginLeft","spacingHorizontalSNudge","verticalAlign","useTextStyles","subsequentText","position","borderLeft","strokeWidthThin","colorNeutralStroke2","content","display","height","fontSize","left","top","lineHeight","usePreviewMetadataStyles_unstable","state","rootBaseClassName","iconBaseClassName","textStyles","className","isSubsequentAfterText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,e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xB,IAAI,CAAC4B,SAAS;IAC7G;IAEA,IAAIC,wBAAwB;IAE5B,IAAIL,MAAMvB,WAAW,EAAE;QACrBuB,MAAMvB,WAAW,CAAC2B,SAAS,GAAGlC,aAAaI,0BAA0BG,WAAW,EAAEuB,MAAMvB,WAAW,CAAC2B,SAAS;QAC7GC,wBAAwB;IAC1B;IAEA,IAAIL,MAAMtB,aAAa,EAAE;QACvBsB,MAAMtB,aAAa,CAAC0B,SAAS,GAAGlC,aAC9BI,0BAA0BI,aAAa,EACvC2B,yBAAyBF,WAAWhB,cAAc,EAClDa,MAAMtB,aAAa,CAAC0B,SAAS;QAE/BC,wBAAwB;IAC1B;IAEA,IAAIL,MAAMrB,YAAY,EAAE;QACtBqB,MAAMrB,YAAY,CAACyB,SAAS,GAAGlC,aAC7BI,0BAA0BK,YAAY,EACtC0B,yBAAyBF,WAAWhB,cAAc,EAClDa,MAAMrB,YAAY,CAACyB,SAAS;IAEhC;IAEA,OAAOJ;AACT,EAAE"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { usePreviewSurface_unstable } from './usePreviewSurface';
3
3
  import { renderPreviewSurface_unstable } from './renderPreviewSurface';
4
- import { usePreviewSurfaceStyles_unstable } from './usePreviewSurfaceStyles';
4
+ import { usePreviewSurfaceStyles_unstable } from './usePreviewSurfaceStyles.styles';
5
5
  export const PreviewSurface = /*#__PURE__*/React.forwardRef((props, ref) => {
6
6
  const state = usePreviewSurface_unstable(props, ref);
7
7
  usePreviewSurfaceStyles_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["PreviewSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewSurface_unstable } from './usePreviewSurface';\nimport { renderPreviewSurface_unstable } from './renderPreviewSurface';\nimport { usePreviewSurfaceStyles_unstable } from './usePreviewSurfaceStyles';\nimport type { PreviewSurfaceProps } from './PreviewSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewSurface: ForwardRefComponent<PreviewSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePreviewSurface_unstable(props, ref);\n\n usePreviewSurfaceStyles_unstable(state);\n\n return renderPreviewSurface_unstable(state);\n});\n\nPreviewSurface.displayName = 'PreviewSurface';\n"],"names":["React","usePreviewSurface_unstable","renderPreviewSurface_unstable","usePreviewSurfaceStyles_unstable","PreviewSurface","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,4BAA4B;AAI7E,OAAO,MAAMC,+BAA2DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQP,2BAA2BK,OAAOC;IAEhDJ,iCAAiCK;IAEjC,OAAON,8BAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
1
+ {"version":3,"sources":["PreviewSurface.tsx"],"sourcesContent":["import * as React from 'react';\nimport { usePreviewSurface_unstable } from './usePreviewSurface';\nimport { renderPreviewSurface_unstable } from './renderPreviewSurface';\nimport { usePreviewSurfaceStyles_unstable } from './usePreviewSurfaceStyles.styles';\nimport type { PreviewSurfaceProps } from './PreviewSurface.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const PreviewSurface: ForwardRefComponent<PreviewSurfaceProps> = React.forwardRef((props, ref) => {\n const state = usePreviewSurface_unstable(props, ref);\n\n usePreviewSurfaceStyles_unstable(state);\n\n return renderPreviewSurface_unstable(state);\n});\n\nPreviewSurface.displayName = 'PreviewSurface';\n"],"names":["React","usePreviewSurface_unstable","renderPreviewSurface_unstable","usePreviewSurfaceStyles_unstable","PreviewSurface","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,gCAAgC,QAAQ,mCAAmC;AAIpF,OAAO,MAAMC,+BAA2DJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IAC/F,MAAMC,QAAQP,2BAA2BK,OAAOC;IAEhDJ,iCAAiCK;IAEjC,OAAON,8BAA8BM;AACvC,GAAG;AAEHJ,eAAeK,WAAW,GAAG"}
@@ -2,5 +2,5 @@ export * from './PreviewSurface';
2
2
  export * from './PreviewSurface.types';
3
3
  export * from './renderPreviewSurface';
4
4
  export * from './usePreviewSurface';
5
- export * from './usePreviewSurfaceStyles';
5
+ export * from './usePreviewSurfaceStyles.styles';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewSurface';\nexport * from './PreviewSurface.types';\nexport * from './renderPreviewSurface';\nexport * from './usePreviewSurface';\nexport * from './usePreviewSurfaceStyles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,4BAA4B"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './PreviewSurface';\nexport * from './PreviewSurface.types';\nexport * from './renderPreviewSurface';\nexport * from './usePreviewSurface';\nexport * from './usePreviewSurfaceStyles.styles';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,mBAAmB;AACjC,cAAc,yBAAyB;AACvC,cAAc,yBAAyB;AACvC,cAAc,sBAAsB;AACpC,cAAc,mCAAmC"}
@@ -20,9 +20,11 @@ const useRootStyles = __styles({
20
20
  * Apply styling to the PreviewSurface slots based on the state
21
21
  */
22
22
  export const usePreviewSurfaceStyles_unstable = state => {
23
+ 'use no memo';
24
+
23
25
  const rootStyles = useRootStyles();
24
26
  state.root.className = mergeClasses(previewSurfaceClassNames.root, rootStyles.base, state.root.className);
25
27
  usePopoverSurfaceStyles_unstable(state);
26
28
  return state;
27
29
  };
28
- //# sourceMappingURL=usePreviewSurfaceStyles.js.map
30
+ //# sourceMappingURL=usePreviewSurfaceStyles.styles.js.map
@@ -0,0 +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"}
@@ -34,6 +34,7 @@ const usePreview_unstable = (props)=>{
34
34
  openByHoverOverPopover: false,
35
35
  openByKeyboard: false
36
36
  });
37
+ const triggerMousedOver = _react.useRef(false);
37
38
  const isOpen = ()=>{
38
39
  return previewInternalState.openByClick || previewInternalState.openByHoverOverTrigger || previewInternalState.openByHoverOverPopover || previewInternalState.openByKeyboard;
39
40
  };
@@ -66,6 +67,7 @@ const usePreview_unstable = (props)=>{
66
67
  if (popoverSurface && popoverTrigger) {
67
68
  const handleTriggerTargetEnter = (e)=>{
68
69
  previewInternalState.openByHoverOverTrigger = true;
70
+ triggerMousedOver.current = true;
69
71
  // We want to disable auto focus only if the popover is being opened by hovering over the trigger
70
72
  if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {
71
73
  setDisableAutoFocus(true);
@@ -79,6 +81,7 @@ const usePreview_unstable = (props)=>{
79
81
  };
80
82
  const handleTriggerTargetLeave = (e)=>{
81
83
  previewInternalState.openByHoverOverTrigger = false;
84
+ triggerMousedOver.current = false;
82
85
  setTimeout(()=>{
83
86
  setIsPopoverOpen(isOpen());
84
87
  // We want to call onOpenChange only if the popover is actually closing when leaving the trigger
@@ -101,6 +104,13 @@ const usePreview_unstable = (props)=>{
101
104
  previewInternalState.openByHoverOverTrigger = false;
102
105
  previewInternalState.openByHoverOverPopover = false;
103
106
  previewInternalState.openByKeyboard = false;
107
+ // We set triggerMousedOver to false when clicking, since we just interacted with the trigger via click, and not hover.
108
+ if (triggerMousedOver.current) {
109
+ previewInternalState.openByClick = false;
110
+ triggerMousedOver.current = false;
111
+ } else {
112
+ e.preventDefault();
113
+ }
104
114
  if (!tmpOpenByHoverOverTrigger) {
105
115
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
106
116
  open: previewInternalState.openByClick