@fluentui-copilot/react-preview 0.4.1 → 0.4.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 +49 -1
- package/CHANGELOG.md +23 -2
- package/lib/components/Preview/usePreview.js +10 -0
- package/lib/components/Preview/usePreview.js.map +1 -1
- package/lib/components/PreviewContent/PreviewContent.js +1 -1
- package/lib/components/PreviewContent/PreviewContent.js.map +1 -1
- package/lib/components/PreviewContent/index.js +1 -1
- package/lib/components/PreviewContent/index.js.map +1 -1
- package/lib/components/PreviewContent/{usePreviewContentStyles.js → usePreviewContentStyles.styles.js} +3 -1
- package/lib/components/PreviewContent/usePreviewContentStyles.styles.js.map +1 -0
- package/lib/components/PreviewHeader/PreviewHeader.js +1 -1
- package/lib/components/PreviewHeader/PreviewHeader.js.map +1 -1
- package/lib/components/PreviewHeader/index.js +1 -1
- package/lib/components/PreviewHeader/index.js.map +1 -1
- package/lib/components/PreviewHeader/usePreviewHeader.js +1 -1
- package/lib/components/PreviewHeader/usePreviewHeader.js.map +1 -1
- package/lib/components/PreviewHeader/{usePreviewHeaderStyles.js → usePreviewHeaderStyles.styles.js} +3 -1
- package/lib/components/PreviewHeader/usePreviewHeaderStyles.styles.js.map +1 -0
- package/lib/components/PreviewMetadata/PreviewMetadata.js +1 -1
- package/lib/components/PreviewMetadata/PreviewMetadata.js.map +1 -1
- package/lib/components/PreviewMetadata/index.js +1 -1
- package/lib/components/PreviewMetadata/index.js.map +1 -1
- package/lib/components/PreviewMetadata/{usePreviewMetadataStyles.js → usePreviewMetadataStyles.styles.js} +3 -1
- package/lib/components/PreviewMetadata/usePreviewMetadataStyles.styles.js.map +1 -0
- package/lib/components/PreviewSurface/PreviewSurface.js +1 -1
- package/lib/components/PreviewSurface/PreviewSurface.js.map +1 -1
- package/lib/components/PreviewSurface/index.js +1 -1
- package/lib/components/PreviewSurface/index.js.map +1 -1
- package/lib/components/PreviewSurface/{usePreviewSurfaceStyles.js → usePreviewSurfaceStyles.styles.js} +3 -1
- package/lib/components/PreviewSurface/usePreviewSurfaceStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Preview/usePreview.js +10 -0
- package/lib-commonjs/components/Preview/usePreview.js.map +1 -1
- package/lib-commonjs/components/PreviewContent/PreviewContent.js +2 -2
- package/lib-commonjs/components/PreviewContent/PreviewContent.js.map +1 -1
- package/lib-commonjs/components/PreviewContent/index.js +1 -1
- package/lib-commonjs/components/PreviewContent/index.js.map +1 -1
- package/lib-commonjs/components/PreviewContent/{usePreviewContentStyles.js → usePreviewContentStyles.styles.js} +2 -1
- package/lib-commonjs/components/PreviewContent/usePreviewContentStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PreviewHeader/PreviewHeader.js +2 -2
- package/lib-commonjs/components/PreviewHeader/PreviewHeader.js.map +1 -1
- package/lib-commonjs/components/PreviewHeader/index.js +1 -1
- package/lib-commonjs/components/PreviewHeader/index.js.map +1 -1
- package/lib-commonjs/components/PreviewHeader/usePreviewHeader.js +2 -2
- package/lib-commonjs/components/PreviewHeader/usePreviewHeader.js.map +1 -1
- package/lib-commonjs/components/PreviewHeader/{usePreviewHeaderStyles.js → usePreviewHeaderStyles.styles.js} +2 -1
- package/lib-commonjs/components/PreviewHeader/usePreviewHeaderStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PreviewMetadata/PreviewMetadata.js +2 -2
- package/lib-commonjs/components/PreviewMetadata/PreviewMetadata.js.map +1 -1
- package/lib-commonjs/components/PreviewMetadata/index.js +1 -1
- package/lib-commonjs/components/PreviewMetadata/index.js.map +1 -1
- package/lib-commonjs/components/PreviewMetadata/{usePreviewMetadataStyles.js → usePreviewMetadataStyles.styles.js} +2 -1
- package/lib-commonjs/components/PreviewMetadata/usePreviewMetadataStyles.styles.js.map +1 -0
- package/lib-commonjs/components/PreviewSurface/PreviewSurface.js +2 -2
- package/lib-commonjs/components/PreviewSurface/PreviewSurface.js.map +1 -1
- package/lib-commonjs/components/PreviewSurface/index.js +1 -1
- package/lib-commonjs/components/PreviewSurface/index.js.map +1 -1
- package/lib-commonjs/components/PreviewSurface/{usePreviewSurfaceStyles.js → usePreviewSurfaceStyles.styles.js} +2 -1
- package/lib-commonjs/components/PreviewSurface/usePreviewSurfaceStyles.styles.js.map +1 -0
- package/package.json +5 -5
- package/lib/components/PreviewContent/usePreviewContentStyles.js.map +0 -1
- package/lib/components/PreviewHeader/usePreviewHeaderStyles.js.map +0 -1
- package/lib/components/PreviewMetadata/usePreviewMetadataStyles.js.map +0 -1
- package/lib/components/PreviewSurface/usePreviewSurfaceStyles.js.map +0 -1
- package/lib-commonjs/components/PreviewContent/usePreviewContentStyles.js.map +0 -1
- package/lib-commonjs/components/PreviewHeader/usePreviewHeaderStyles.js.map +0 -1
- package/lib-commonjs/components/PreviewMetadata/usePreviewMetadataStyles.js.map +0 -1
- package/lib-commonjs/components/PreviewSurface/usePreviewSurfaceStyles.js.map +0 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,55 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-preview",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Fri, 31 May 2024 18:42:05 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-preview_v0.4.3",
|
|
7
|
+
"version": "0.4.3",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-preview",
|
|
13
|
+
"commit": "dbd9212bded202a2b958699fdaacf75e864b3dbb",
|
|
14
|
+
"comment": "feat: Enabling new model where mouse over before a click on triggers navigates to links while touch still opens Preview component."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "seanmonahan@microsoft.com",
|
|
18
|
+
"package": "@fluentui-copilot/react-preview",
|
|
19
|
+
"commit": "c2e14c44cafafbdc10f52b9855384748a7524a63",
|
|
20
|
+
"comment": "chore: add eslint-plugin-react-compiler"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "tristan.watanabe@gmail.com",
|
|
24
|
+
"package": "@fluentui-copilot/react-preview",
|
|
25
|
+
"commit": "7583464747aec7a8a79a8c79eaeff85d749025e4",
|
|
26
|
+
"comment": "chore: bump @fluentui dependencies to latest 9.52.0."
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "tristan.watanabe@gmail.com",
|
|
30
|
+
"package": "@fluentui-copilot/react-preview",
|
|
31
|
+
"commit": "6df44dbcd267772e1b62426d14abe54a0b35bb97",
|
|
32
|
+
"comment": "chore: useStyle hook files now properly contain .styles. within filename."
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"date": "Wed, 08 May 2024 22:10:20 GMT",
|
|
39
|
+
"tag": "@fluentui-copilot/react-preview_v0.4.2",
|
|
40
|
+
"version": "0.4.2",
|
|
41
|
+
"comments": {
|
|
42
|
+
"patch": [
|
|
43
|
+
{
|
|
44
|
+
"author": "sarah.higley@microsoft.com",
|
|
45
|
+
"package": "@fluentui-copilot/react-preview",
|
|
46
|
+
"commit": "44f1da0736caf911d7d9f2d7a30b4e983a5a8b2e",
|
|
47
|
+
"comment": "chore: bump @fluentui/react-components to latest, 9.49.2"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"date": "Tue, 30 Apr 2024 20:55:43 GMT",
|
|
6
54
|
"tag": "@fluentui-copilot/react-preview_v0.4.1",
|
|
7
55
|
"version": "0.4.1",
|
|
8
56
|
"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
|
|
3
|
+
This log was last generated on Fri, 31 May 2024 18:42:05 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.4.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.4.3)
|
|
8
|
+
|
|
9
|
+
Fri, 31 May 2024 18:42:05 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.4.2..@fluentui-copilot/react-preview_v0.4.3)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- 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)
|
|
15
|
+
- chore: add eslint-plugin-react-compiler ([PR #1642](https://github.com/microsoft/fluentai/pull/1642) by seanmonahan@microsoft.com)
|
|
16
|
+
- chore: bump @fluentui dependencies to latest 9.52.0. ([PR #1657](https://github.com/microsoft/fluentai/pull/1657) by tristan.watanabe@gmail.com)
|
|
17
|
+
- chore: useStyle hook files now properly contain .styles. within filename. ([PR #1671](https://github.com/microsoft/fluentai/pull/1671) by tristan.watanabe@gmail.com)
|
|
18
|
+
|
|
19
|
+
## [0.4.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.4.2)
|
|
20
|
+
|
|
21
|
+
Wed, 08 May 2024 22:10:20 GMT
|
|
22
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.4.1..@fluentui-copilot/react-preview_v0.4.2)
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- chore: bump @fluentui/react-components to latest, 9.49.2 ([PR #1614](https://github.com/microsoft/fluentai/pull/1614) by sarah.higley@microsoft.com)
|
|
27
|
+
|
|
7
28
|
## [0.4.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.4.1)
|
|
8
29
|
|
|
9
|
-
Tue, 30 Apr 2024 20:
|
|
30
|
+
Tue, 30 Apr 2024 20:55:43 GMT
|
|
10
31
|
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.4.0..@fluentui-copilot/react-preview_v0.4.1)
|
|
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,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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;QACv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AAO;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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,QAAQ,6BAA6B;AACjG,SAASC,4BAA4B,QAAQ,
|
|
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"}
|
package/lib/components/PreviewHeader/{usePreviewHeaderStyles.js → usePreviewHeaderStyles.styles.js}
RENAMED
|
@@ -20,6 +20,8 @@ const useRootBaseClassName = __resetStyles("r1p46sa7", null, [".r1p46sa7{align-i
|
|
|
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 16px 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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f;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,
|
|
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,
|
|
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,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,4BAAkE;IAC7EC,MAAM;IACNC,MAAM;IACNC,aAAa;IACb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AAW,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,
|
|
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,
|
|
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
|
|
@@ -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":["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","React","useState","current","previewInternalState","isPopoverOpen","preventDefaultClose","undefined","length","popoverSurface","setIsPopoverOpen","useId","useRef","popoverTrigger","closeCallback","isOpen","popoverSurfaceId","id","removeOpenedByHoverPreview","useEffect","handleTriggerTargetEnter","e","closeAllOpenedByHoverPreviews","handleTriggerTargetLeave","handleTriggerClick","tmpOpenByHoverOverTrigger","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,OAA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R,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 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,MAAAI,QAAA;UACbC,gBACA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IAAAA,OAAAA;QAC7BA,2BAAAA,8BAAA,QAAAA,8BAAA,KAAA,IAAAA,4BAAAe;;WAGE;uBACA+C;QACFA,iBAAA3C,qBAAAd,WAAA,IAAAc,qBAAAR,cAAA;IACA"}
|
|
@@ -12,10 +12,10 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _usePreviewContent = require("./usePreviewContent");
|
|
14
14
|
const _renderPreviewContent = require("./renderPreviewContent");
|
|
15
|
-
const
|
|
15
|
+
const _usePreviewContentStylesstyles = require("./usePreviewContentStyles.styles");
|
|
16
16
|
const PreviewContent = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
17
|
const state = (0, _usePreviewContent.usePreviewContent_unstable)(props, ref);
|
|
18
|
-
(0,
|
|
18
|
+
(0, _usePreviewContentStylesstyles.usePreviewContentStyles_unstable)(state);
|
|
19
19
|
return (0, _renderPreviewContent.renderPreviewContent_unstable)(state);
|
|
20
20
|
});
|
|
21
21
|
PreviewContent.displayName = 'PreviewContent'; //# sourceMappingURL=PreviewContent.js.map
|
|
@@ -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":["PreviewContent","React","forwardRef","props","state","usePreviewContent_unstable","usePreviewContentStyles_unstable","renderPreviewContent_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;mCACoB;sCACG;
|
|
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":["PreviewContent","React","forwardRef","props","state","usePreviewContent_unstable","usePreviewContentStyles_unstable","renderPreviewContent_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;mCACoB;sCACG;+CACG;AAI1C,MAAMA,iBAAAA,WAAAA,GAAAA,OAA2DC,UAAMC,CAAU,CAACC,OAACA;UACxFC,QAAMA,IAAAA,6CAAQC,EAAAA,OAA2BF;uEAEzCG,EAAAA;WACAC,IAAAA,mDAAOA,EAAAA;AACT;AAEAP,eAAeQ,WAAW,GAAG"}
|
|
@@ -7,5 +7,5 @@ _export_star._(require("./PreviewContent"), exports);
|
|
|
7
7
|
_export_star._(require("./PreviewContent.types"), exports);
|
|
8
8
|
_export_star._(require("./renderPreviewContent"), exports);
|
|
9
9
|
_export_star._(require("./usePreviewContent"), exports);
|
|
10
|
-
_export_star._(require("./usePreviewContentStyles"), exports);
|
|
10
|
+
_export_star._(require("./usePreviewContentStyles.styles"), exports);
|
|
11
11
|
//# 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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -27,7 +27,8 @@ const previewContentClassNames = {
|
|
|
27
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);}"
|
|
28
28
|
]);
|
|
29
29
|
const usePreviewContentStyles_unstable = (state)=>{
|
|
30
|
+
'use no memo';
|
|
30
31
|
const rootBaseClassName = useRootBaseClassName();
|
|
31
32
|
state.root.className = (0, _reactcomponents.mergeClasses)(previewContentClassNames.root, rootBaseClassName, state.root.className);
|
|
32
33
|
return state;
|
|
33
|
-
}; //# sourceMappingURL=usePreviewContentStyles.js.map
|
|
34
|
+
}; //# 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":["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"}
|
|
@@ -12,10 +12,10 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _usePreviewHeader = require("./usePreviewHeader");
|
|
14
14
|
const _renderPreviewHeader = require("./renderPreviewHeader");
|
|
15
|
-
const
|
|
15
|
+
const _usePreviewHeaderStylesstyles = require("./usePreviewHeaderStyles.styles");
|
|
16
16
|
const PreviewHeader = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
17
|
const state = (0, _usePreviewHeader.usePreviewHeader_unstable)(props, ref);
|
|
18
|
-
(0,
|
|
18
|
+
(0, _usePreviewHeaderStylesstyles.usePreviewHeaderStyles_unstable)(state);
|
|
19
19
|
return (0, _renderPreviewHeader.renderPreviewHeader_unstable)(state);
|
|
20
20
|
});
|
|
21
21
|
PreviewHeader.displayName = 'PreviewHeader'; //# sourceMappingURL=PreviewHeader.js.map
|
|
@@ -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":["PreviewHeader","React","forwardRef","props","state","usePreviewHeader_unstable","usePreviewHeaderStyles_unstable","renderPreviewHeader_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;kCACmB;qCACG;
|
|
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":["PreviewHeader","React","forwardRef","props","state","usePreviewHeader_unstable","usePreviewHeaderStyles_unstable","renderPreviewHeader_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;kCACmB;qCACG;8CACG;AAIzC,MAAMA,gBAAAA,WAAAA,GAAAA,OAAyDC,UAAMC,CAAU,CAACC,OAACA;UACtFC,QAAMA,IAAAA,2CAAQC,EAAAA,OAA0BF;qEAExCG,EAAAA;WACAC,IAAAA,iDAAOA,EAAAA;AACT;AAEAP,cAAcQ,WAAW,GAAG"}
|
|
@@ -7,5 +7,5 @@ _export_star._(require("./PreviewHeader"), exports);
|
|
|
7
7
|
_export_star._(require("./PreviewHeader.types"), exports);
|
|
8
8
|
_export_star._(require("./renderPreviewHeader"), exports);
|
|
9
9
|
_export_star._(require("./usePreviewHeader"), exports);
|
|
10
|
-
_export_star._(require("./usePreviewHeaderStyles"), exports);
|
|
10
|
+
_export_star._(require("./usePreviewHeaderStyles.styles"), exports);
|
|
11
11
|
//# 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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "usePreviewHeader_unstable", {
|
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _reactcomponents = require("@fluentui/react-components");
|
|
14
|
-
const
|
|
14
|
+
const _usePreviewHeaderStylesstyles = require("./usePreviewHeaderStyles.styles");
|
|
15
15
|
const usePreviewHeader_unstable = (props, ref)=>{
|
|
16
16
|
var _state_media;
|
|
17
17
|
const { actions, children, citation, label, media } = props;
|
|
@@ -56,7 +56,7 @@ const usePreviewHeader_unstable = (props, ref)=>{
|
|
|
56
56
|
}
|
|
57
57
|
if (state.media && /*#__PURE__*/ _react.isValidElement(state.media.children)) {
|
|
58
58
|
state.media.children = /*#__PURE__*/ _react.cloneElement(state.media.children, {
|
|
59
|
-
className: (0, _reactcomponents.mergeClasses)(state.media.children.props.className,
|
|
59
|
+
className: (0, _reactcomponents.mergeClasses)(state.media.children.props.className, _usePreviewHeaderStylesstyles.previewHeaderExtraClassNames.mediaChild)
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
return state;
|
|
@@ -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":["state","_state_media","actions","components","root","media","slot","ref","props","elementType","citation","defaultProps","children","mediaId","className","mergeClasses","previewHeaderExtraClassNames","_state_label_ariadescribedby","_state_label_ariadescribedby_concat","label"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqDMA;;;eAAAA;;;;iEArDiB;iCAC6C;
|
|
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":["state","_state_media","actions","components","root","media","slot","ref","props","elementType","citation","defaultProps","children","mediaId","className","mergeClasses","previewHeaderExtraClassNames","_state_label_ariadescribedby","_state_label_ariadescribedby_concat","label"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAqDMA;;;eAAAA;;;;iEArDiB;iCAC6C;8CACvB;MAmDvCA,4BAAAA,CAAAA,OAAAA;QAnCJC;UAEA,EAEAC,OAAMF,UACJG,UACEC;oBAIAC,IAAAA,sBAAO,EAAA;UACTL,QAAA;oBACMM;kBAEFC;qBACGC;sBAEL;mBAAEC;mBAAmB;;mCAEWA,CAAAA,MAAAA,CAAAA,IAAAA,yCAAa,EAAA,OAAA;;eAC/CC,KAAAA;;yBAAwD;;iBAEtDC,qBAAAA,CAAAA,QAAc,CAAAT,SAAA;yBACZU;;kBAEFH,qBAAAA,CAAAA,QAAa,CAAAC,UAAA;yBACf;;oCAEEC,CAAAA,MAAAA,CAAAA,OAAc;0BACRE;;;yBAGR;QACF;QAEAR,OAAIL,qBAAAA,CAAAA,QAAAA,CAAAA,OAAMK;0BAC0BL;oBAAAA;;YACpCS,aAAA;QAEA;;wBAEIK,MAAWC,KAAAA,MAAaf,QAAWC,iBAAgBa,KAAAA,IAAS,KAAEE,IAAAA,aAAAA,EAAAA,EAAAA;YAChEC;QACF,IAAAC;QAEAlB,MAAAmB,KAAOnB,CAAAA,mBAAAA,GAAAA,CAAAA,sCAAAA,CAAAA,+BAAAA,MAAAA,KAAAA,CAAAA,mBAAAA,MAAAA,QAAAA,iCAAAA,KAAAA,IAAAA,KAAAA,IAAAA,6BAAAA,MAAAA,CAAAA,MAAAA,KAAAA,CAAAA,EAAAA,CAAAA,MAAAA,QAAAA,wCAAAA,KAAAA,IAAAA,sCAAAA,MAAAA,KAAAA,CAAAA,EAAAA;IACP"}
|
|
@@ -49,6 +49,7 @@ const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r1p46sa7", nul
|
|
|
49
49
|
".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;}"
|
|
50
50
|
]);
|
|
51
51
|
const usePreviewHeaderStyles_unstable = (state)=>{
|
|
52
|
+
'use no memo';
|
|
52
53
|
const actionsBaseClassName = useActionsBaseClassName();
|
|
53
54
|
const citationBaseClassName = useCitationBaseClassName();
|
|
54
55
|
const labelBaseClassName = useLabelBaseClassName();
|
|
@@ -66,4 +67,4 @@ const usePreviewHeaderStyles_unstable = (state)=>{
|
|
|
66
67
|
state.media.className = (0, _reactcomponents.mergeClasses)(previewHeaderClassNames.media, mediaBaseClassName, state.media.className);
|
|
67
68
|
}
|
|
68
69
|
return state;
|
|
69
|
-
}; //# sourceMappingURL=usePreviewHeaderStyles.js.map
|
|
70
|
+
}; //# 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 16px 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":["previewHeaderClassNames","previewHeaderExtraClassNames","alignSelf","root","actions","citation","label","media","mediaChild","labelFontSize","typographyStyles","caption1Strong","fontSize","labelLineHeight","lineHeight","useActionsBaseClassName","makeResetStyles","gridArea","__resetStyles","justifySelf","useMediaBaseClassName","useCitationBaseClassName","state","overflowY","citationBaseClassName","paddingTop","useLabelBaseClassName","wordBreak","rootBaseClassName","useRootBaseClassName","className","mergeClasses","actionsBaseClassName","height","width","labelBaseClassName","mediaBaseClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,uBAAAA;eAAAA;;IAQAC,4BAAAA;eAAAA;;IAiBXC,+BAAW;eAAXA;;;iCA7B8D;AAIzD,MAAMF,0BAA8D;UACzEG;aACAC;cACAC;WACAC;WACAC;AACF;AAEO,MAAMN,+BAA+B;gBAC1CO;AACF;AAEA,MAAMC,gBAAgBC,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AAA;;WAEVR;AACF,GAEA,yDAA6C"}
|
|
@@ -12,10 +12,10 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _usePreviewMetadata = require("./usePreviewMetadata");
|
|
14
14
|
const _renderPreviewMetadata = require("./renderPreviewMetadata");
|
|
15
|
-
const
|
|
15
|
+
const _usePreviewMetadataStylesstyles = require("./usePreviewMetadataStyles.styles");
|
|
16
16
|
const PreviewMetadata = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
17
|
const state = (0, _usePreviewMetadata.usePreviewMetadata_unstable)(props, ref);
|
|
18
|
-
(0,
|
|
18
|
+
(0, _usePreviewMetadataStylesstyles.usePreviewMetadataStyles_unstable)(state);
|
|
19
19
|
return (0, _renderPreviewMetadata.renderPreviewMetadata_unstable)(state);
|
|
20
20
|
});
|
|
21
21
|
PreviewMetadata.displayName = 'PreviewMetadata'; //# sourceMappingURL=PreviewMetadata.js.map
|
|
@@ -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":["PreviewMetadata","React","forwardRef","props","state","usePreviewMetadata_unstable","usePreviewMetadataStyles_unstable","renderPreviewMetadata_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;oCACqB;uCACG;
|
|
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":["PreviewMetadata","React","forwardRef","props","state","usePreviewMetadata_unstable","usePreviewMetadataStyles_unstable","renderPreviewMetadata_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;oCACqB;uCACG;gDACG;AAI3C,MAAMA,kBAAAA,WAAAA,GAAAA,OAA6DC,UAAMC,CAAU,CAACC,OAACA;UAC1FC,QAAMA,IAAAA,+CAAQC,EAAAA,OAA4BF;yEAE1CG,EAAAA;WACAC,IAAAA,qDAAOA,EAAAA;AACT;AAEAP,gBAAgBQ,WAAW,GAAG"}
|
|
@@ -7,5 +7,5 @@ _export_star._(require("./PreviewMetadata"), exports);
|
|
|
7
7
|
_export_star._(require("./PreviewMetadata.types"), exports);
|
|
8
8
|
_export_star._(require("./renderPreviewMetadata"), exports);
|
|
9
9
|
_export_star._(require("./usePreviewMetadata"), exports);
|
|
10
|
-
_export_star._(require("./usePreviewMetadataStyles"), exports);
|
|
10
|
+
_export_star._(require("./usePreviewMetadataStyles.styles"), exports);
|
|
11
11
|
//# 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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -81,6 +81,7 @@ const useTextStyles = (0, _reactcomponents.__styles)({
|
|
|
81
81
|
]
|
|
82
82
|
});
|
|
83
83
|
const usePreviewMetadataStyles_unstable = (state)=>{
|
|
84
|
+
'use no memo';
|
|
84
85
|
const rootBaseClassName = useRootBaseClassName();
|
|
85
86
|
const iconBaseClassName = useIconBaseClassName();
|
|
86
87
|
const textStyles = useTextStyles();
|
|
@@ -101,4 +102,4 @@ const usePreviewMetadataStyles_unstable = (state)=>{
|
|
|
101
102
|
state.tertiaryText.className = (0, _reactcomponents.mergeClasses)(previewMetadataClassNames.tertiaryText, isSubsequentAfterText && textStyles.subsequentText, state.tertiaryText.className);
|
|
102
103
|
}
|
|
103
104
|
return state;
|
|
104
|
-
}; //# sourceMappingURL=usePreviewMetadataStyles.js.map
|
|
105
|
+
}; //# 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":["previewMetadataClassNames","usePreviewMetadataStyles_unstable","root","icon","primaryText","secondaryText","tertiaryText","useRootBaseClassName","makeResetStyles","useIconBaseClassName","caption2","useTextStyles","__styles","subsequentText","marginLeft","spacingHorizontalSNudge","verticalAlign","uvfttm","Bbv0w2i","makeStyles","position","shorthands","borderLeft","content","display","state","rootBaseClassName","iconBaseClassName","textStyles","className","mergeClasses","isSubsequentAfterText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAWaA,yBAAAA;eAAAA;;IAkCbC,iCAAA;eAAAA;;;iCAvCkB;AAKX,MAAMD,4BAAkE;UAC7EE;UACAC;iBACAC;mBACAC;kBACAC;AACF;AAEA,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,WAAgB,MAAA;IAAA;CAAA;MAC3CC,uBAAoBC,IAAAA,8BAAQ,EAAA,WAAA,WAAA;IAAA;IAAA;CAAA;AAC9B,MAAAC,gBAAAC,IAAAA,yBAAA,EAAA;IAEAC,gBAAMJ;QACJK,QAAAA;YAAAA;YAAmBC;SAAAA;QACnBC,QAAAA;QACFC,QAAA;YAAA;YAAA;SAAA;QAEAC,SAAMP;YAAAA;YAAgBQ;SAAW;QAC/BN,SAAAA;YAAAA;YAAgB;SAAA;gBACdC;iBACAM;iBAEA;gBACE;YAAA;YAAGC;SAAWC;iBACdC;iBACAC;;;;;QAGU;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;;AAMhB,MAAAvB,oCAAAwB,CAAAA;;UAIEC,oBAAAnB;UAEAoB,oBAAMD;UACNE,aAAMD;UACNzB,IAAM0B,CAAAA,SAAAA,GAAajB,IAAAA,6BAAAA,EAAAA,0BAAAA,IAAAA,EAAAA,mBAAAA,MAAAA,IAAAA,CAAAA,SAAAA;QAEnBc,MAAMvB,IAAK2B,EAAAA;QAEXJ,MAAIA,IAAMtB,CAAAA,SAAM,GAAA2B,IAAAA,6BAAA,EAAA9B,0BAAAG,IAAA,EAAAwB,mBAAAF,MAAAtB,IAAA,CAAA0B,SAAA;;QAEhBE,wBAAA;QAEAN,MAAIM,WAAAA,EAAAA;QAEJN,MAAIA,WAAMrB,CAAAA,SAAa,GAAA0B,IAAAA,6BAAA,EAAA9B,0BAAAI,WAAA,EAAAqB,MAAArB,WAAA,CAAAyB,SAAA;gCACHA;;QAEpBJ,MAAApB,aAAA,EAAA;QAEAoB,MAAIA,aAAMpB,CAAAA,SAAe,GAAAyB,IAAAA,6BAAA,EAAA9B,0BAAAK,aAAA,EAAA0B,yBAAAH,WAAAf,cAAA,EAAAY,MAAApB,aAAA,CAAAwB,SAAA;gCACHA;;QAMtBJ,MAAAnB,YAAA,EAAA;QAEAmB,MAAIA,YAAMnB,CAAAA,SAAc,GAAAwB,IAAAA,6BAAA,EAAA9B,0BAAAM,YAAA,EAAAyB,yBAAAH,WAAAf,cAAA,EAAAY,MAAAnB,YAAA,CAAAuB,SAAA;;WAMxBJ;GAGF,2DAAE"}
|
|
@@ -12,10 +12,10 @@ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildc
|
|
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
13
|
const _usePreviewSurface = require("./usePreviewSurface");
|
|
14
14
|
const _renderPreviewSurface = require("./renderPreviewSurface");
|
|
15
|
-
const
|
|
15
|
+
const _usePreviewSurfaceStylesstyles = require("./usePreviewSurfaceStyles.styles");
|
|
16
16
|
const PreviewSurface = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
17
|
const state = (0, _usePreviewSurface.usePreviewSurface_unstable)(props, ref);
|
|
18
|
-
(0,
|
|
18
|
+
(0, _usePreviewSurfaceStylesstyles.usePreviewSurfaceStyles_unstable)(state);
|
|
19
19
|
return (0, _renderPreviewSurface.renderPreviewSurface_unstable)(state);
|
|
20
20
|
});
|
|
21
21
|
PreviewSurface.displayName = 'PreviewSurface'; //# sourceMappingURL=PreviewSurface.js.map
|
|
@@ -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":["PreviewSurface","React","forwardRef","props","state","usePreviewSurface_unstable","usePreviewSurfaceStyles_unstable","renderPreviewSurface_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;mCACoB;sCACG;
|
|
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":["PreviewSurface","React","forwardRef","props","state","usePreviewSurface_unstable","usePreviewSurfaceStyles_unstable","renderPreviewSurface_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;;iEAPU;mCACoB;sCACG;+CACG;AAI1C,MAAMA,iBAAAA,WAAAA,GAAAA,OAA2DC,UAAMC,CAAU,CAACC,OAACA;UACxFC,QAAMA,IAAAA,6CAAQC,EAAAA,OAA2BF;uEAEzCG,EAAAA;WAEAC,IAAAA,mDAAOA,EAAAA;AACT;AAEAP,eAAeQ,WAAW,GAAG"}
|
|
@@ -7,5 +7,5 @@ _export_star._(require("./PreviewSurface"), exports);
|
|
|
7
7
|
_export_star._(require("./PreviewSurface.types"), exports);
|
|
8
8
|
_export_star._(require("./renderPreviewSurface"), exports);
|
|
9
9
|
_export_star._(require("./usePreviewSurface"), exports);
|
|
10
|
-
_export_star._(require("./usePreviewSurfaceStyles"), exports);
|
|
10
|
+
_export_star._(require("./usePreviewSurfaceStyles.styles"), exports);
|
|
11
11
|
//# 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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
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":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA"}
|
|
@@ -46,8 +46,9 @@ const previewSurfaceClassNames = {
|
|
|
46
46
|
]
|
|
47
47
|
});
|
|
48
48
|
const usePreviewSurfaceStyles_unstable = (state)=>{
|
|
49
|
+
'use no memo';
|
|
49
50
|
const rootStyles = useRootStyles();
|
|
50
51
|
state.root.className = (0, _reactcomponents.mergeClasses)(previewSurfaceClassNames.root, rootStyles.base, state.root.className);
|
|
51
52
|
(0, _reactcomponents.usePopoverSurfaceStyles_unstable)(state);
|
|
52
53
|
return state;
|
|
53
|
-
}; //# sourceMappingURL=usePreviewSurfaceStyles.js.map
|
|
54
|
+
}; //# 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":["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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-preview",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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.
|
|
20
|
-
"@fluentui/react-context-selector": ">=9.1.
|
|
21
|
-
"@fluentui/react-jsx-runtime": ">=9.0.
|
|
22
|
-
"@fluentui/react-utilities": ">=9.18.
|
|
19
|
+
"@fluentui/react-components": ">=9.52.0 <10.0.0",
|
|
20
|
+
"@fluentui/react-context-selector": ">=9.1.60 <10.0.0",
|
|
21
|
+
"@fluentui/react-jsx-runtime": ">=9.0.38 <10.0.0",
|
|
22
|
+
"@fluentui/react-utilities": ">=9.18.9 <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",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewContentStyles.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 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,MAAMC,oBAAoBd;IAE1Ba,MAAMd,IAAI,CAACgB,SAAS,GAAGrB,aAAaI,yBAAyBC,IAAI,EAAEe,mBAAmBD,MAAMd,IAAI,CAACgB,SAAS;IAE1G,OAAOF;AACT,EAAE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewHeaderStyles.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 16px 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 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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I,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewMetadataStyles.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 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,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,4BAAkE;IAC7EC,MAAM;IACNC,MAAM;IACNC,aAAa;IACbC,eAAe;IACfC,cAAc;AAChB,EAAE;AAEF,MAAMC,uBAAuBZ,gBAAgB;IAC3C,GAAGK,iBAAiBQ,QAAQ;AAC9B;AAEA,MAAMC,uBAAuBd,gBAAgB;IAC3Ce,YAAYX,OAAOY,uBAAuB;IAC1CC,eAAe;AACjB;AAEA,MAAMC,gBAAgBjB,WAAW;IAC/BkB,gBAAgB;QACdJ,YAAY,CAAC,KAAK,EAAEX,OAAOY,uBAAuB,CAAC,KAAK,CAAC;QACzDI,UAAU;QAEV,aAAa;YACX,GAAGjB,WAAWkB,UAAU,CAACjB,OAAOkB,eAAe,EAAE,SAASlB,OAAOmB,mBAAmB,CAAC;YACrFC,SAAS;YACTC,SAAS;YACTC,QAAQrB,iBAAiBQ,QAAQ,CAACc,QAAQ;YAC1CC,MAAM,CAAC,UAAU,EAAExB,OAAOY,uBAAuB,CAAC,CAAC,CAAC;YACpDI,UAAU;YACVS,KAAK,CAAC,MAAM,EAAExB,iBAAiBQ,QAAQ,CAACiB,UAAU,CAAC,GAAG,EAAEzB,iBAAiBQ,QAAQ,CAACc,QAAQ,CAAC,MAAM,CAAC;QACpG;IACF;AACF;AAEA;;CAEC,GACD,OAAO,MAAMI,oCAAoC,CAACC;IAChD,MAAMC,oBAAoBrB;IAC1B,MAAMsB,oBAAoBpB;IAC1B,MAAMqB,aAAajB;IAEnBc,MAAMzB,IAAI,CAAC6B,SAAS,GAAGlC,aAAaI,0BAA0BC,IAAI,EAAE0B,mBAAmBD,MAAMzB,IAAI,CAAC6B,SAAS;IAE3G,IAAIJ,MAAMxB,IAAI,EAAE;QACdwB,MAAMxB,IAAI,CAAC4B,SAAS,GAAGlC,aAAaI,0BAA0BE,IAAI,EAAE0B,mBAAmBF,MAAMxB,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewSurfaceStyles.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 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,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewContentStyles.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 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","wordBreak","useRootBaseClassName","typographyStyles","caption1","rootBaseClassName","className"],"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;UAChCC,oBAAWC;UAERC,IAAAA,CAAAA,SAAAA,GAAiBC,IAAAA,6BAAQ,EAAAV,yBAAAE,IAAA,EAAAS,mBAAAL,MAAAJ,IAAA,CAAAU,SAAA;IAC9B,OAAAN;AAEA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewHeaderStyles.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 16px 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 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":["previewHeaderClassNames","previewHeaderExtraClassNames","alignSelf","root","actions","citation","label","media","mediaChild","labelFontSize","typographyStyles","caption1Strong","fontSize","labelLineHeight","lineHeight","useActionsBaseClassName","makeResetStyles","gridArea","__resetStyles","justifySelf","useMediaBaseClassName","useCitationBaseClassName","state","display","overflowY","useLabelBaseClassName","mediaBaseClassName","paddingTop","useRootBaseClassName","wordBreak","mergeClasses","rootBaseClassName","className","actionsBaseClassName","citationBaseClassName","height","labelBaseClassName","width"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,uBAAAA;eAAAA;;IAQAC,4BAAAA;eAAAA;;IAiBXC,+BAAW;eAAXA;;;iCA7B8D;AAIzD,MAAMF,0BAA8D;UACzEG;aACAC;cACAC;WACAC;WACAC;AACF;AAEO,MAAMN,+BAA+B;gBAC1CO;AACF;AAEA,MAAMC,gBAAgBC,iCAAAA,CAAiBC,cAAc,CAACC,QAAQ;AAC9D,MAAMC,kBAAkBH,iCAAAA,CAAiBC,cAAc,CAACG,UAAU;AAElE,MAAMC,0BAA0BC,IAAAA,8BAAAA,EAAAA,YAAgB,MAAA;IAAA;CAAA;MAC9CC,2BAAUC,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MACVC,wBAAaD,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;CAAA;AACf,MAAAE,wBAAAF,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;IAAA;CAAA;AAEA,MAAMG,uBAAAA,IAAAA,8BAA2BL,EAAAA,YAAgB,MAAA;IAAA;CAAA;AAK/Cd,MAAAA,kCAAWoB,CAAAA;UACXC,uBAASR;UACTE,wBAAUI;UACVG,qBAAWC;UACXC,qBAAAN;UACAO,oBAAaC;UACbC,IAAAA,CAAAA,SAAW,GAAAC,IAAAA,6BAAA,EAAA9B,wBAAAG,IAAA,EAAA4B,mBAAAT,MAAAnB,IAAA,CAAA6B,SAAA;QAEXV,MAAAlB,OAAA,EAAA;QACAkB,MAAAlB,OAAA,CAAA4B,SAAsB,GAAAF,IAAAA,6BAAA,EAAA9B,wBAAAI,OAAA,EAAA6B,sBAAAX,MAAAlB,OAAA,CAAA4B,SAAA;;IAGxB,IAAAV,MAAAjB,QAAA,EAAA;QAEAiB,MAAMF,QAAAA,CAAAA,SAAAA,GAAwBJ,IAAAA,6BAAAA,EAAAA,wBAAgBX,QAAA,EAAA6B,uBAAAZ,MAAAjB,QAAA,CAAA2B,SAAA;;UAE5CG,KAAQ,CAAAH,SAAA,GAAAF,IAAAA,6BAAA,EAAA9B,wBAAAM,KAAA,EAAA8B,oBAAAd,MAAAhB,KAAA,CAAA0B,SAAA;QACRlB,MAAAA,KAAY,EAAA;QACZuB,MAAAA,KAAO,CAAAL,SAAA,GAAAF,IAAAA,6BAAA,EAAA9B,wBAAAO,KAAA,EAAAmB,oBAAAJ,MAAAf,KAAA,CAAAyB,SAAA;;WAGLG;qDAEF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewMetadataStyles.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 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":["previewMetadataClassNames","usePreviewMetadataStyles_unstable","root","icon","primaryText","secondaryText","tertiaryText","useRootBaseClassName","makeResetStyles","useIconBaseClassName","caption2","useTextStyles","__styles","subsequentText","marginLeft","spacingHorizontalSNudge","verticalAlign","uvfttm","Bbv0w2i","makeStyles","position","shorthands","borderLeft","content","display","state","iconBaseClassName","textStyles","rootBaseClassName","className","mergeClasses","isSubsequentAfterText"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAWaA,yBAAAA;eAAAA;;IAkCbC,iCAAA;eAAAA;;;iCAvCkB;AAKX,MAAMD,4BAAkE;UAC7EE;UACAC;iBACAC;mBACAC;kBACAC;AACF;AAEA,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,WAAgB,MAAA;IAAA;CAAA;MAC3CC,uBAAoBC,IAAAA,8BAAQ,EAAA,WAAA,WAAA;IAAA;IAAA;CAAA;AAC9B,MAAAC,gBAAAC,IAAAA,yBAAA,EAAA;IAEAC,gBAAMJ;QACJK,QAAAA;YAAAA;YAAmBC;SAAAA;QACnBC,QAAAA;QACFC,QAAA;YAAA;YAAA;SAAA;QAEAC,SAAMP;YAAAA;YAAgBQ;SAAW;QAC/BN,SAAAA;YAAAA;YAAgB;SAAA;gBACdC;iBACAM;iBAEA;gBACE;YAAA;YAAGC;SAAWC;iBACdC;iBACAC;;;;;QAGU;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;QAAA;KAAA;;AAMhB,MAAAvB,oCAAAwB,CAAAA;;IAEC,MACDC,oBAAazB;UACX0B,aAAMC;UACN1B,IAAMwB,CAAAA,SAAAA,GAAAA,IAAAA,6BAAoBjB,EAAAA,0BAAAA,IAAAA,EAAAA,mBAAAA,MAAAA,IAAAA,CAAAA,SAAAA;QAC1BgB,MAAME,IAAAA,EAAAA;QAENF,MAAMvB,IAAI,CAAC2B,SAAS,GAAGC,IAAAA,6BAAAA,EAAa9B,0BAA0BE,IAAI,EAAE0B,mBAAmBH,MAAMvB,IAAI,CAAC2B,SAAS;;gCAGrF;QACtBJ,MAAArB,WAAA,EAAA;QAEAqB,MAAIM,WAAAA,CAAAA,SAAAA,GAAwBD,IAAAA,6BAAA,EAAA9B,0BAAAI,WAAA,EAAAqB,MAAArB,WAAA,CAAAyB,SAAA;QAE5BE,wBAAuB;;cAErBA,aAAAA,EAAAA;QACFN,MAAApB,aAAA,CAAAwB,SAAA,GAAAC,IAAAA,6BAAA,EAAA9B,0BAAAK,aAAA,EAAA0B,yBAAAJ,WAAAd,cAAA,EAAAY,MAAApB,aAAA,CAAAwB,SAAA;QAEAE,wBAAuB;;cAMrBA,YAAAA,EAAAA;QACFN,MAAAnB,YAAA,CAAAuB,SAAA,GAAAC,IAAAA,6BAAA,EAAA9B,0BAAAM,YAAA,EAAAyB,yBAAAJ,WAAAd,cAAA,EAAAY,MAAAnB,YAAA,CAAAuB,SAAA;;WAGEJ;uDAOKA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewSurfaceStyles.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 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","state","mergeClasses"],"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;;OAICC;QAAAA;QAAuBC;QAA6DD;QAAoB;QAAA;KAAA"}
|