@fluentui-copilot/react-preview 0.5.7 → 0.6.0
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 +43 -1
- package/CHANGELOG.md +22 -2
- package/dist/index.d.ts +3 -2
- package/lib/Preview.js +1 -1
- package/lib/Preview.js.map +1 -1
- package/lib/PreviewContent.js +1 -1
- package/lib/PreviewContent.js.map +1 -1
- package/lib/PreviewHeader.js +1 -1
- package/lib/PreviewHeader.js.map +1 -1
- package/lib/PreviewMetadata.js +1 -1
- package/lib/PreviewMetadata.js.map +1 -1
- package/lib/PreviewSurface.js +1 -1
- package/lib/PreviewSurface.js.map +1 -1
- package/lib/PreviewTrigger.js +1 -1
- package/lib/PreviewTrigger.js.map +1 -1
- package/lib/components/Preview/index.js +3 -4
- package/lib/components/Preview/index.js.map +1 -1
- package/lib/components/Preview/usePreview.js +6 -4
- package/lib/components/Preview/usePreview.js.map +1 -1
- package/lib/components/PreviewContent/index.js +4 -5
- package/lib/components/PreviewContent/index.js.map +1 -1
- package/lib/components/PreviewContent/usePreviewContentStyles.styles.js +2 -1
- package/lib/components/PreviewContent/usePreviewContentStyles.styles.js.map +1 -1
- package/lib/components/PreviewHeader/index.js +4 -5
- package/lib/components/PreviewHeader/index.js.map +1 -1
- package/lib/components/PreviewHeader/usePreviewHeaderStyles.styles.js +2 -1
- package/lib/components/PreviewHeader/usePreviewHeaderStyles.styles.js.map +1 -1
- package/lib/components/PreviewMetadata/index.js +4 -5
- package/lib/components/PreviewMetadata/index.js.map +1 -1
- package/lib/components/PreviewMetadata/usePreviewMetadataStyles.styles.js +2 -1
- package/lib/components/PreviewMetadata/usePreviewMetadataStyles.styles.js.map +1 -1
- package/lib/components/PreviewSurface/PreviewSurface.types.js.map +1 -1
- package/lib/components/PreviewSurface/index.js +4 -5
- package/lib/components/PreviewSurface/index.js.map +1 -1
- package/lib/components/PreviewSurface/usePreviewSurface.js +6 -1
- package/lib/components/PreviewSurface/usePreviewSurface.js.map +1 -1
- package/lib/components/PreviewSurface/usePreviewSurfaceStyles.styles.js +20 -2
- package/lib/components/PreviewSurface/usePreviewSurfaceStyles.styles.js.map +1 -1
- package/lib/components/PreviewTrigger/index.js +3 -4
- package/lib/components/PreviewTrigger/index.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib-commonjs/Preview.js +18 -2
- package/lib-commonjs/Preview.js.map +1 -1
- package/lib-commonjs/PreviewContent.js +24 -2
- package/lib-commonjs/PreviewContent.js.map +1 -1
- package/lib-commonjs/PreviewHeader.js +27 -2
- package/lib-commonjs/PreviewHeader.js.map +1 -1
- package/lib-commonjs/PreviewMetadata.js +24 -2
- package/lib-commonjs/PreviewMetadata.js.map +1 -1
- package/lib-commonjs/PreviewSurface.js +24 -2
- package/lib-commonjs/PreviewSurface.js.map +1 -1
- package/lib-commonjs/PreviewTrigger.js +18 -2
- package/lib-commonjs/PreviewTrigger.js.map +1 -1
- package/lib-commonjs/components/Preview/index.js +20 -5
- package/lib-commonjs/components/Preview/index.js.map +1 -1
- package/lib-commonjs/components/Preview/usePreview.js +6 -4
- package/lib-commonjs/components/Preview/usePreview.js.map +1 -1
- package/lib-commonjs/components/PreviewContent/index.js +27 -6
- package/lib-commonjs/components/PreviewContent/index.js.map +1 -1
- package/lib-commonjs/components/PreviewContent/usePreviewContentStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PreviewHeader/index.js +30 -6
- package/lib-commonjs/components/PreviewHeader/index.js.map +1 -1
- package/lib-commonjs/components/PreviewHeader/usePreviewHeaderStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PreviewMetadata/index.js +27 -6
- package/lib-commonjs/components/PreviewMetadata/index.js.map +1 -1
- package/lib-commonjs/components/PreviewMetadata/usePreviewMetadataStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PreviewSurface/PreviewSurface.types.js.map +1 -1
- package/lib-commonjs/components/PreviewSurface/index.js +27 -6
- package/lib-commonjs/components/PreviewSurface/index.js.map +1 -1
- package/lib-commonjs/components/PreviewSurface/usePreviewSurface.js +6 -1
- package/lib-commonjs/components/PreviewSurface/usePreviewSurface.js.map +1 -1
- package/lib-commonjs/components/PreviewSurface/usePreviewSurfaceStyles.styles.js +21 -1
- package/lib-commonjs/components/PreviewSurface/usePreviewSurfaceStyles.styles.js.map +1 -1
- package/lib-commonjs/components/PreviewTrigger/index.js +20 -5
- package/lib-commonjs/components/PreviewTrigger/index.js.map +1 -1
- package/lib-commonjs/utils/index.js +18 -2
- package/lib-commonjs/utils/index.js.map +1 -1
- package/package.json +3 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,49 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-preview",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 20 Mar 2025 16:59:12 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-preview_v0.6.0",
|
|
7
|
+
"version": "0.6.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "makotom@microsoft.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-preview",
|
|
13
|
+
"commit": "9958f308833b5b38dd8afdaf5505f87aca5d3961",
|
|
14
|
+
"comment": "chore: Updating imports of tokens to be imported from @fluentui-copilot/tokens instead of from @fluentui/react-components."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "owcampbe@microsoft.com",
|
|
18
|
+
"package": "@fluentui-copilot/react-preview",
|
|
19
|
+
"commit": "4a9638ac88d3060188019bbdb2b6cde1406bbfb8",
|
|
20
|
+
"comment": "feat: Add designVersion=next styles for Preview."
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Wed, 18 Dec 2024 08:55:42 GMT",
|
|
27
|
+
"tag": "@fluentui-copilot/react-preview_v0.5.8",
|
|
28
|
+
"version": "0.5.8",
|
|
29
|
+
"comments": {
|
|
30
|
+
"patch": [
|
|
31
|
+
{
|
|
32
|
+
"author": "makotom@microsoft.com",
|
|
33
|
+
"package": "@fluentui-copilot/react-preview",
|
|
34
|
+
"commit": "cc179462507d13546b93c6330be325014286998c",
|
|
35
|
+
"comment": "chore: Banning * exports."
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"author": "makotom@microsoft.com",
|
|
39
|
+
"package": "@fluentui-copilot/react-preview",
|
|
40
|
+
"commit": "3e3e5f1dffd8e37b35b1b58d36e5ea91d54b3a69",
|
|
41
|
+
"comment": "fix: Making onOpenChange callback respect showDelay prop."
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"date": "Tue, 10 Dec 2024 20:22:06 GMT",
|
|
6
48
|
"tag": "@fluentui-copilot/react-preview_v0.5.7",
|
|
7
49
|
"version": "0.5.7",
|
|
8
50
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-preview
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 20 Mar 2025 16:59:12 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.6.0](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.6.0)
|
|
8
|
+
|
|
9
|
+
Thu, 20 Mar 2025 16:59:12 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.5.8..@fluentui-copilot/react-preview_v0.6.0)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: Updating imports of tokens to be imported from @fluentui-copilot/tokens instead of from @fluentui/react-components. ([PR #2745](https://github.com/microsoft/fluentai/pull/2745) by makotom@microsoft.com)
|
|
15
|
+
- feat: Add designVersion=next styles for Preview. ([PR #2806](https://github.com/microsoft/fluentai/pull/2806) by owcampbe@microsoft.com)
|
|
16
|
+
|
|
17
|
+
## [0.5.8](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.5.8)
|
|
18
|
+
|
|
19
|
+
Wed, 18 Dec 2024 08:55:42 GMT
|
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.5.7..@fluentui-copilot/react-preview_v0.5.8)
|
|
21
|
+
|
|
22
|
+
### Patches
|
|
23
|
+
|
|
24
|
+
- chore: Banning * exports. ([PR #2477](https://github.com/microsoft/fluentai/pull/2477) by makotom@microsoft.com)
|
|
25
|
+
- fix: Making onOpenChange callback respect showDelay prop. ([PR #2473](https://github.com/microsoft/fluentai/pull/2473) by makotom@microsoft.com)
|
|
26
|
+
|
|
7
27
|
## [0.5.7](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-preview_v0.5.7)
|
|
8
28
|
|
|
9
|
-
Tue, 10 Dec 2024 20:
|
|
29
|
+
Tue, 10 Dec 2024 20:22:06 GMT
|
|
10
30
|
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-preview_v0.5.6..@fluentui-copilot/react-preview_v0.5.7)
|
|
11
31
|
|
|
12
32
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ComponentProps } from '@fluentui/react-components';
|
|
|
4
4
|
import type { ComponentState } from '@fluentui/react-components';
|
|
5
5
|
import type { Context } from '@fluentui/react-context-selector';
|
|
6
6
|
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
7
|
+
import type { DesignVersion } from '@fluentui-copilot/react-provider';
|
|
7
8
|
import { FC } from 'react';
|
|
8
9
|
import type { ForwardRefComponent } from '@fluentui/react-components';
|
|
9
10
|
import { JSXElementConstructor } from 'react';
|
|
@@ -149,14 +150,14 @@ export declare const previewSurfaceClassNames: SlotClassNames<PreviewSurfaceSlot
|
|
|
149
150
|
/**
|
|
150
151
|
* PreviewSurface Props
|
|
151
152
|
*/
|
|
152
|
-
export declare type PreviewSurfaceProps = ComponentProps<PreviewSurfaceSlots> & PopoverSurfaceProps & {};
|
|
153
|
+
export declare type PreviewSurfaceProps = ComponentProps<PreviewSurfaceSlots> & PopoverSurfaceProps & DesignVersion & {};
|
|
153
154
|
|
|
154
155
|
export declare type PreviewSurfaceSlots = PopoverSurfaceSlots & {};
|
|
155
156
|
|
|
156
157
|
/**
|
|
157
158
|
* State used in rendering PreviewSurface
|
|
158
159
|
*/
|
|
159
|
-
export declare type PreviewSurfaceState = ComponentState<PreviewSurfaceSlots> & PopoverSurfaceState & {};
|
|
160
|
+
export declare type PreviewSurfaceState = ComponentState<PreviewSurfaceSlots> & PopoverSurfaceState & Pick<Required<PreviewSurfaceProps>, 'designVersion'> & {};
|
|
160
161
|
|
|
161
162
|
export declare const PreviewTrigger: React_2.FC<PreviewTriggerProps>;
|
|
162
163
|
|
package/lib/Preview.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Preview, renderPreview_unstable, usePreview_unstable } from './components/Preview/index';
|
|
2
2
|
//# sourceMappingURL=Preview.js.map
|
package/lib/Preview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Preview.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["Preview.ts"],"sourcesContent":["export type { PreviewProps, PreviewState } from './components/Preview/index';\nexport { Preview, renderPreview_unstable, usePreview_unstable } from './components/Preview/index';\n"],"names":["Preview","renderPreview_unstable","usePreview_unstable"],"rangeMappings":"","mappings":"AACA,SAASA,OAAO,EAAEC,sBAAsB,EAAEC,mBAAmB,QAAQ,6BAA6B"}
|
package/lib/PreviewContent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PreviewContent, previewContentClassNames, renderPreviewContent_unstable, usePreviewContentStyles_unstable, usePreviewContent_unstable } from './components/PreviewContent/index';
|
|
2
2
|
//# sourceMappingURL=PreviewContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PreviewContent.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["PreviewContent.ts"],"sourcesContent":["export type { PreviewContentProps, PreviewContentSlots, PreviewContentState } from './components/PreviewContent/index';\nexport { PreviewContent, previewContentClassNames, renderPreviewContent_unstable, usePreviewContentStyles_unstable, usePreviewContent_unstable } from './components/PreviewContent/index';\n"],"names":["PreviewContent","previewContentClassNames","renderPreviewContent_unstable","usePreviewContentStyles_unstable","usePreviewContent_unstable"],"rangeMappings":"","mappings":"AACA,SAASA,cAAc,EAAEC,wBAAwB,EAAEC,6BAA6B,EAAEC,gCAAgC,EAAEC,0BAA0B,QAAQ,oCAAoC"}
|
package/lib/PreviewHeader.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PreviewHeader, previewHeaderClassNames, previewHeaderExtraClassNames, renderPreviewHeader_unstable, usePreviewHeaderStyles_unstable, usePreviewHeader_unstable } from './components/PreviewHeader/index';
|
|
2
2
|
//# sourceMappingURL=PreviewHeader.js.map
|
package/lib/PreviewHeader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PreviewHeader.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["PreviewHeader.ts"],"sourcesContent":["export type { PreviewHeaderProps, PreviewHeaderSlots, PreviewHeaderState } from './components/PreviewHeader/index';\nexport { PreviewHeader, previewHeaderClassNames, previewHeaderExtraClassNames, renderPreviewHeader_unstable, usePreviewHeaderStyles_unstable, usePreviewHeader_unstable } from './components/PreviewHeader/index';\n"],"names":["PreviewHeader","previewHeaderClassNames","previewHeaderExtraClassNames","renderPreviewHeader_unstable","usePreviewHeaderStyles_unstable","usePreviewHeader_unstable"],"rangeMappings":"","mappings":"AACA,SAASA,aAAa,EAAEC,uBAAuB,EAAEC,4BAA4B,EAAEC,4BAA4B,EAAEC,+BAA+B,EAAEC,yBAAyB,QAAQ,mCAAmC"}
|
package/lib/PreviewMetadata.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PreviewMetadata, previewMetadataClassNames, renderPreviewMetadata_unstable, usePreviewMetadataStyles_unstable, usePreviewMetadata_unstable } from './components/PreviewMetadata/index';
|
|
2
2
|
//# sourceMappingURL=PreviewMetadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PreviewMetadata.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["PreviewMetadata.ts"],"sourcesContent":["export type { PreviewMetadataProps, PreviewMetadataSlots, PreviewMetadataState } from './components/PreviewMetadata/index';\nexport { PreviewMetadata, previewMetadataClassNames, renderPreviewMetadata_unstable, usePreviewMetadataStyles_unstable, usePreviewMetadata_unstable } from './components/PreviewMetadata/index';\n"],"names":["PreviewMetadata","previewMetadataClassNames","renderPreviewMetadata_unstable","usePreviewMetadataStyles_unstable","usePreviewMetadata_unstable"],"rangeMappings":"","mappings":"AACA,SAASA,eAAe,EAAEC,yBAAyB,EAAEC,8BAA8B,EAAEC,iCAAiC,EAAEC,2BAA2B,QAAQ,qCAAqC"}
|
package/lib/PreviewSurface.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PreviewSurface, previewSurfaceClassNames, renderPreviewSurface_unstable, usePreviewSurfaceStyles_unstable, usePreviewSurface_unstable } from './components/PreviewSurface/index';
|
|
2
2
|
//# sourceMappingURL=PreviewSurface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PreviewSurface.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["PreviewSurface.ts"],"sourcesContent":["export type { PreviewSurfaceProps, PreviewSurfaceSlots, PreviewSurfaceState } from './components/PreviewSurface/index';\nexport { PreviewSurface, previewSurfaceClassNames, renderPreviewSurface_unstable, usePreviewSurfaceStyles_unstable, usePreviewSurface_unstable } from './components/PreviewSurface/index';\n"],"names":["PreviewSurface","previewSurfaceClassNames","renderPreviewSurface_unstable","usePreviewSurfaceStyles_unstable","usePreviewSurface_unstable"],"rangeMappings":"","mappings":"AACA,SAASA,cAAc,EAAEC,wBAAwB,EAAEC,6BAA6B,EAAEC,gCAAgC,EAAEC,0BAA0B,QAAQ,oCAAoC"}
|
package/lib/PreviewTrigger.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PreviewTrigger, renderPreviewTrigger_unstable, usePreviewTrigger_unstable } from './components/PreviewTrigger/index';
|
|
2
2
|
//# sourceMappingURL=PreviewTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["PreviewTrigger.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["PreviewTrigger.ts"],"sourcesContent":["export type { PreviewTriggerChildProps, PreviewTriggerProps, PreviewTriggerState } from './components/PreviewTrigger/index';\nexport { PreviewTrigger, renderPreviewTrigger_unstable, usePreviewTrigger_unstable } from './components/PreviewTrigger/index';\n"],"names":["PreviewTrigger","renderPreviewTrigger_unstable","usePreviewTrigger_unstable"],"rangeMappings":"","mappings":"AACA,SAASA,cAAc,EAAEC,6BAA6B,EAAEC,0BAA0B,QAAQ,oCAAoC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export * from './usePreview';
|
|
1
|
+
export { Preview } from './Preview';
|
|
2
|
+
export { renderPreview_unstable } from './renderPreview';
|
|
3
|
+
export { usePreview_unstable } from './usePreview';
|
|
5
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { Preview } from './Preview';\nexport type { PreviewProps, PreviewState } from './Preview.types';\nexport { renderPreview_unstable } from './renderPreview';\nexport { usePreview_unstable } from './usePreview';\n"],"names":["Preview","renderPreview_unstable","usePreview_unstable"],"rangeMappings":";;","mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AAEpC,SAASC,sBAAsB,QAAQ,kBAAkB;AACzD,SAASC,mBAAmB,QAAQ,eAAe"}
|
|
@@ -80,13 +80,15 @@ export const usePreview_unstable = props => {
|
|
|
80
80
|
// We want to disable auto focus only if the popover is being opened by hovering over the trigger
|
|
81
81
|
if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen) {
|
|
82
82
|
setDisableAutoFocus(true);
|
|
83
|
-
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
|
|
84
|
-
open: true
|
|
85
|
-
});
|
|
86
83
|
closeAllOpenedByHoverPreviews(popoverSurfaceId);
|
|
87
|
-
addOpenedByHoverPreview(popoverSurfaceId, closeCallback);
|
|
88
84
|
}
|
|
89
85
|
setEnterTimeout(() => {
|
|
86
|
+
if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen && isOpen()) {
|
|
87
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(e, {
|
|
88
|
+
open: true
|
|
89
|
+
});
|
|
90
|
+
addOpenedByHoverPreview(popoverSurfaceId, closeCallback);
|
|
91
|
+
}
|
|
90
92
|
setIsPopoverOpen(isOpen());
|
|
91
93
|
}, showDelay);
|
|
92
94
|
};
|
|
@@ -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 resolvePositioningShorthand,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n usePopover_unstable,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\n\nimport { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';\nimport type { PreviewProps, PreviewState } from './Preview.types';\n\ntype PreviewInternalState = {\n openByClick: boolean;\n openByHoverOverTrigger: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_DELAY = 250;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string, popoverMouseHideDelay: number): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return popoverMouseHideDelay;\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 {\n hideDelay = POPOVER_MOUSE_DELAY,\n onOpenChange,\n open,\n positioning,\n showDelay = POPOVER_MOUSE_DELAY,\n unstable_disableAutoFocus,\n } = props;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n const { targetDocument } = useFluent();\n const [setEnterTimeout, clearEnterTimeout] = useTimeout();\n const [setLeaveTimeout, clearLeaveTimeout] = 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 clearEnterTimeout();\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 setEnterTimeout(() => {\n setIsPopoverOpen(isOpen());\n }, showDelay);\n };\n\n const handleTriggerTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = false;\n triggerMousedOver.current = false;\n\n setLeaveTimeout(() => {\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, hideDelay));\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 clearLeaveTimeout();\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 setLeaveTimeout(() => {\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, hideDelay));\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 clearLeaveTimeout();\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 clearLeaveTimeout();\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n onOpenChange?.(e, data);\n }\n\n preventDefaultClose.current = false;\n };\n\n let resolvedChildren = children as [JSX.Element, JSX.Element] | JSX.Element;\n if (popoverSurface) {\n if (popoverTrigger) {\n resolvedChildren = [popoverTrigger, popoverSurface];\n } else {\n resolvedChildren = popoverSurface;\n }\n }\n\n const popoverState = usePopover_unstable({\n ...props,\n children: resolvedChildren,\n onOpenChange: onPopoverOpenChange,\n open: open ?? isPopoverOpen,\n positioning:\n typeof positioning === 'string'\n ? { autoSize: true, ...resolvePositioningShorthand(positioning) }\n : { autoSize: true, ...positioning },\n unstable_disableAutoFocus: unstable_disableAutoFocus ?? disableAutoFocus,\n });\n\n return {\n ...popoverState,\n isPreviewLocked: previewInternalState.openByClick || previewInternalState.openByKeyboard,\n };\n};\n"],"names":["React","Enter","Escape","mergeCallbacks","resolvePositioningShorthand","useFluent","useId","useIsomorphicLayoutEffect","usePopover_unstable","useTimeout","addOpenedByHoverPreview","closeAllOpenedByHoverPreviews","removeOpenedByHoverPreview","POPOVER_MOUSE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","popoverMouseHideDelay","usePreview_unstable","props","hideDelay","onOpenChange","open","positioning","showDelay","unstable_disableAutoFocus","children","Children","toArray","targetDocument","setEnterTimeout","clearEnterTimeout","setLeaveTimeout","clearLeaveTimeout","disableAutoFocus","setDisableAutoFocus","useState","current","previewInternalState","useRef","openByClick","openByHoverOverTrigger","openByHoverOverPopover","openByKeyboard","triggerMousedOver","isOpen","isPopoverOpen","setIsPopoverOpen","preventDefaultClose","popoverTrigger","undefined","popoverSurface","length","popoverSurfaceId","id","closeCallback","useEffect","handleTriggerTargetEnter","e","handleTriggerTargetLeave","handleTriggerClick","tmpOpenByHoverOverTrigger","preventDefault","handleTriggerKeyDown","key","handlePopoverTargetEnter","handlePopoverTargetLeave","cloneElement","onBlur","onClick","onKeyDown","onMouseEnter","onMouseLeave","onFocus","onDocumentKeyDown","openedByHover","stopPropagation","addEventListener","capture","removeEventListener","onPopoverOpenChange","data","resolvedChildren","popoverState","autoSize","isPreviewLocked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACxD,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,SAAS,EACTC,KAAK,EACLC,yBAAyB,EACzB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AAA,aAAeqC,GAAGuB;QACpB;QAEAjC,oBAAoBX,OAAO,GAAG;IAChC;IAEA,IAAI6C,mBAAmBxD;IACvB,IAAIyB,gBAAgB;QAClB,IAAIF,gBAAgB;YAClBiC,mBAAmB;gBAACjC;gBAAgBE;aAAe;QACrD,OAAO;YACL+B,mBAAmB/B;QACrB;IACF;IAEA,MAAMgC,eAAe3E,oBAAoB;QACvC,GAAGW,KAAK;QACRO,UAAUwD;QACV7D,cAAc2D;QACd1D,MAAMA,iBAAAA,kBAAAA,OAAQwB;QACdvB,aACE,OAAOA,gBAAgB,WACnB;YAAE6D,UAAU;YAAM,GAAGhF,4BAA4BmB,YAAY;QAAC,IAC9D;YAAE6D,UAAU;YAAM,GAAG7D,WAAW;QAAC;QACvCE,2BAA2BA,sCAAAA,uCAAAA,4BAA6BS;IAC1D;IAEA,OAAO;QACL,GAAGiD,YAAY;QACfE,iBAAiB/C,qBAAqBE,WAAW,IAAIF,qBAAqBK,cAAc;IAC1F;AACF,EAAE"}
|
|
1
|
+
{"version":3,"sources":["usePreview.ts"],"sourcesContent":["import * as React from 'react';\n\nimport { Enter, Escape } from '@fluentui/keyboard-keys';\nimport {\n mergeCallbacks,\n resolvePositioningShorthand,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n usePopover_unstable,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\n\nimport { addOpenedByHoverPreview, closeAllOpenedByHoverPreviews, removeOpenedByHoverPreview } from '../../utils';\nimport type { PreviewProps, PreviewState } from './Preview.types';\n\ntype PreviewInternalState = {\n openByClick: boolean;\n openByHoverOverTrigger: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_DELAY = 250;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string, popoverMouseHideDelay: number): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return popoverMouseHideDelay;\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 {\n hideDelay = POPOVER_MOUSE_DELAY,\n onOpenChange,\n open,\n positioning,\n showDelay = POPOVER_MOUSE_DELAY,\n unstable_disableAutoFocus,\n } = props;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n const { targetDocument } = useFluent();\n const [setEnterTimeout, clearEnterTimeout] = useTimeout();\n const [setLeaveTimeout, clearLeaveTimeout] = 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 clearEnterTimeout();\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 closeAllOpenedByHoverPreviews(popoverSurfaceId);\n }\n\n setEnterTimeout(() => {\n if (!previewInternalState.openByClick && !previewInternalState.openByKeyboard && !isPopoverOpen && isOpen()) {\n onOpenChange?.(e, { open: true });\n addOpenedByHoverPreview(popoverSurfaceId, closeCallback);\n }\n setIsPopoverOpen(isOpen());\n }, showDelay);\n };\n\n const handleTriggerTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n previewInternalState.openByHoverOverTrigger = false;\n triggerMousedOver.current = false;\n\n setLeaveTimeout(() => {\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, hideDelay));\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 clearLeaveTimeout();\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 setLeaveTimeout(() => {\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, hideDelay));\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 clearLeaveTimeout();\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 clearLeaveTimeout();\n closeCallback();\n removeOpenedByHoverPreview(popoverSurfaceId);\n }\n\n onOpenChange?.(e, data);\n }\n\n preventDefaultClose.current = false;\n };\n\n let resolvedChildren = children as [JSX.Element, JSX.Element] | JSX.Element;\n if (popoverSurface) {\n if (popoverTrigger) {\n resolvedChildren = [popoverTrigger, popoverSurface];\n } else {\n resolvedChildren = popoverSurface;\n }\n }\n\n const popoverState = usePopover_unstable({\n ...props,\n children: resolvedChildren,\n onOpenChange: onPopoverOpenChange,\n open: open ?? isPopoverOpen,\n positioning:\n typeof positioning === 'string'\n ? { autoSize: true, ...resolvePositioningShorthand(positioning) }\n : { autoSize: true, ...positioning },\n unstable_disableAutoFocus: unstable_disableAutoFocus ?? disableAutoFocus,\n });\n\n return {\n ...popoverState,\n isPreviewLocked: previewInternalState.openByClick || previewInternalState.openByKeyboard,\n };\n};\n"],"names":["React","Enter","Escape","mergeCallbacks","resolvePositioningShorthand","useFluent","useId","useIsomorphicLayoutEffect","usePopover_unstable","useTimeout","addOpenedByHoverPreview","closeAllOpenedByHoverPreviews","removeOpenedByHoverPreview","POPOVER_MOUSE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","popoverMouseHideDelay","usePreview_unstable","props","hideDelay","onOpenChange","open","positioning","showDelay","unstable_disableAutoFocus","children","Children","toArray","targetDocument","setEnterTimeout","clearEnterTimeout","setLeaveTimeout","clearLeaveTimeout","disableAutoFocus","setDisableAutoFocus","useState","current","previewInternalState","useRef","openByClick","openByHoverOverTrigger","openByHoverOverPopover","openByKeyboard","triggerMousedOver","isOpen","isPopoverOpen","setIsPopoverOpen","preventDefaultClose","popoverTrigger","undefined","popoverSurface","length","popoverSurfaceId","id","closeCallback","useEffect","handleTriggerTargetEnter","e","handleTriggerTargetLeave","handleTriggerClick","tmpOpenByHoverOverTrigger","preventDefault","handleTriggerKeyDown","key","handlePopoverTargetEnter","handlePopoverTargetLeave","cloneElement","onBlur","onClick","onKeyDown","onMouseEnter","onMouseLeave","onFocus","onDocumentKeyDown","openedByHover","stopPropagation","addEventListener","capture","removeEventListener","onPopoverOpenChange","data","resolvedChildren","popoverState","autoSize","isPreviewLocked"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACxD,SACEC,cAAc,EACdC,2BAA2B,EAC3BC,SAAS,EACTC,KAAK,EACLC,yBAAyB,EACzBC,mBAAmB,QACd,6BAA6B;AACpC,SAASC,UAAU,QAAQ,4BAA4B;AAGvD,SAASC,uBAAuB,EAAEC,6BAA6B,EAAEC,0BAA0B,QAAQ,cAAc;AAUjH,MAAMC,sBAAsB;AAC5B,MAAMC,8BAA8B;AAEpC,MAAMC,WAAW,CAACC,MAAcC;IAC9B,IAAID,SAAS,WAAWA,SAAS,QAAQ;QACvC,OAAOF;IACT;IAEA,OAAOG;AACT;AAIA;;;;;;;;CAQC,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/B;QACrB;IACF;IAEA,MAAMgC,eAAe3E,oBAAoB;QACvC,GAAGW,KAAK;QACRO,UAAUwD;QACV7D,cAAc2D;QACd1D,MAAMA,iBAAAA,kBAAAA,OAAQwB;QACdvB,aACE,OAAOA,gBAAgB,WACnB;YAAE6D,UAAU;YAAM,GAAGhF,4BAA4BmB,YAAY;QAAC,IAC9D;YAAE6D,UAAU;YAAM,GAAG7D,WAAW;QAAC;QACvCE,2BAA2BA,sCAAAA,uCAAAA,4BAA6BS;IAC1D;IAEA,OAAO;QACL,GAAGiD,YAAY;QACfE,iBAAiB/C,qBAAqBE,WAAW,IAAIF,qBAAqBK,cAAc;IAC1F;AACF,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './usePreviewContentStyles.styles';
|
|
1
|
+
export { PreviewContent } from './PreviewContent';
|
|
2
|
+
export { renderPreviewContent_unstable } from './renderPreviewContent';
|
|
3
|
+
export { usePreviewContent_unstable } from './usePreviewContent';
|
|
4
|
+
export { previewContentClassNames, usePreviewContentStyles_unstable } from './usePreviewContentStyles.styles';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { PreviewContent } from './PreviewContent';\nexport type { PreviewContentProps, PreviewContentSlots, PreviewContentState } from './PreviewContent.types';\nexport { renderPreviewContent_unstable } from './renderPreviewContent';\nexport { usePreviewContent_unstable } from './usePreviewContent';\nexport { previewContentClassNames, usePreviewContentStyles_unstable } from './usePreviewContentStyles.styles';\n"],"names":["PreviewContent","renderPreviewContent_unstable","usePreviewContent_unstable","previewContentClassNames","usePreviewContentStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAElD,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,wBAAwB,EAAEC,gCAAgC,QAAQ,mCAAmC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { __resetStyles, mergeClasses,
|
|
1
|
+
import { __resetStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
2
3
|
export const previewContentClassNames = {
|
|
3
4
|
root: 'fai-PreviewContent'
|
|
4
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewContentStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses,
|
|
1
|
+
{"version":3,"sources":["usePreviewContentStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\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 maxWidth: `calc(256px - ${tokens.spacingHorizontalXS} * 2)`,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n rowGap: tokens.spacingVerticalXS,\n wordBreak: 'break-word',\n boxSizing: 'border-box',\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","typographyStyles","tokens","previewContentClassNames","root","useRootBaseClassName","color","colorNeutralForeground3","display","flexDirection","maxWidth","spacingHorizontalXS","padding","spacingVerticalS","spacingHorizontalS","rowGap","spacingVerticalXS","wordBreak","boxSizing","caption1","usePreviewContentStyles_unstable","state","rootBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,YAAY,EAAEC,gBAAgB,QAAQ,6BAA6B;AAC7F,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,2BAAgE;IAC3EC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,uBAAuBN,gBAAgB;IAC3CO,OAAOJ,OAAOK,uBAAuB;IACrCC,SAAS;IACTC,eAAe;IACfC,UAAU,CAAC,aAAa,EAAER,OAAOS,mBAAmB,CAAC,KAAK,CAAC;IAC3DC,SAAS,CAAC,EAAEV,OAAOW,gBAAgB,CAAC,CAAC,EAAEX,OAAOY,kBAAkB,CAAC,CAAC;IAClEC,QAAQb,OAAOc,iBAAiB;IAChCC,WAAW;IACXC,WAAW;IACX,GAAGjB,iBAAiBkB,QAAQ;AAC9B;AAEA;;CAEC,GACD,OAAO,MAAMC,mCAAmC,CAACC;IAC/C;IAEA,MAAMC,oBAAoBjB;IAE1BgB,MAAMjB,IAAI,CAACmB,SAAS,GAAGvB,aAAaG,yBAAyBC,IAAI,EAAEkB,mBAAmBD,MAAMjB,IAAI,CAACmB,SAAS;IAE1G,OAAOF;AACT,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './usePreviewHeaderStyles.styles';
|
|
1
|
+
export { PreviewHeader } from './PreviewHeader';
|
|
2
|
+
export { renderPreviewHeader_unstable } from './renderPreviewHeader';
|
|
3
|
+
export { usePreviewHeader_unstable } from './usePreviewHeader';
|
|
4
|
+
export { previewHeaderClassNames, previewHeaderExtraClassNames, usePreviewHeaderStyles_unstable } from './usePreviewHeaderStyles.styles';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { PreviewHeader } from './PreviewHeader';\nexport type { PreviewHeaderProps, PreviewHeaderSlots, PreviewHeaderState } from './PreviewHeader.types';\nexport { renderPreviewHeader_unstable } from './renderPreviewHeader';\nexport { usePreviewHeader_unstable } from './usePreviewHeader';\nexport { previewHeaderClassNames, previewHeaderExtraClassNames, usePreviewHeaderStyles_unstable } from './usePreviewHeaderStyles.styles';\n"],"names":["PreviewHeader","renderPreviewHeader_unstable","usePreviewHeader_unstable","previewHeaderClassNames","previewHeaderExtraClassNames","usePreviewHeaderStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,aAAa,QAAQ,kBAAkB;AAEhD,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,uBAAuB,EAAEC,4BAA4B,EAAEC,+BAA+B,QAAQ,kCAAkC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { __resetStyles, __styles, mergeClasses,
|
|
1
|
+
import { __resetStyles, __styles, mergeClasses, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
2
3
|
export const previewHeaderClassNames = {
|
|
3
4
|
root: 'fai-PreviewHeader',
|
|
4
5
|
actions: 'fai-PreviewHeader__actions',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewHeaderStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses,
|
|
1
|
+
{"version":3,"sources":["usePreviewHeaderStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\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 gridRow: 1,\n justifySelf: 'end',\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n gridRow: 1,\n});\n\nconst useLabelBaseClassName = makeResetStyles({\n alignSelf: 'start',\n display: '-webkit-box',\n gridRow: '1 / 3',\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 gridRow: 1,\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 gridTemplateRows: '24px',\n});\n\n// Since the grid track that needs to grow is not always guaranteed to be the first or the last, but can change positions\n// based on the slots present, we need to conditionally set the grid template columns based on the slots present.\nconst useRootStyles = makeStyles({\n onlyLabel: {\n gridTemplateColumns: '1fr',\n },\n previousAndLabel: {\n gridTemplateColumns: 'min-content 1fr',\n },\n labelAndActions: {\n gridTemplateColumns: '1fr min-content',\n },\n citationMediaLabel: {\n gridTemplateColumns: 'min-content min-content 1fr',\n },\n previousLabelActions: {\n gridTemplateColumns: 'min-content 1fr min-content',\n },\n all: {\n gridTemplateColumns: 'min-content min-content 1fr min-content',\n },\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 const rootStyles = useRootStyles();\n\n let actionsPresent = false;\n if (state.actions) {\n actionsPresent = true;\n state.actions.className = mergeClasses(\n previewHeaderClassNames.actions,\n actionsBaseClassName,\n state.actions.className,\n );\n }\n\n let citationPresent = false;\n if (state.citation) {\n citationPresent = true;\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 let mediaPresent = false;\n if (state.media) {\n mediaPresent = true;\n state.media.className = mergeClasses(previewHeaderClassNames.media, mediaBaseClassName, state.media.className);\n }\n\n state.root.className = mergeClasses(\n previewHeaderClassNames.root,\n rootBaseClassName,\n !citationPresent && !mediaPresent && !actionsPresent && rootStyles.onlyLabel,\n ((citationPresent && !mediaPresent) || (mediaPresent && !citationPresent)) &&\n !actionsPresent &&\n rootStyles.previousAndLabel,\n !citationPresent && !mediaPresent && actionsPresent && rootStyles.labelAndActions,\n citationPresent && mediaPresent && !actionsPresent && rootStyles.citationMediaLabel,\n ((citationPresent && !mediaPresent) || (mediaPresent && !citationPresent)) &&\n actionsPresent &&\n rootStyles.previousLabelActions,\n citationPresent && mediaPresent && actionsPresent && rootStyles.all,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","typographyStyles","tokens","previewHeaderClassNames","root","actions","citation","label","media","previewHeaderExtraClassNames","mediaChild","labelFontSize","caption1Strong","fontSize","labelLineHeight","lineHeight","useActionsBaseClassName","gridRow","justifySelf","useCitationBaseClassName","useLabelBaseClassName","alignSelf","display","overflowY","paddingTop","wordBreak","useMediaBaseClassName","height","width","useRootBaseClassName","alignItems","columnGap","spacingHorizontalXS","gridTemplateRows","useRootStyles","onlyLabel","gridTemplateColumns","previousAndLabel","labelAndActions","citationMediaLabel","previousLabelActions","all","usePreviewHeaderStyles_unstable","state","actionsBaseClassName","citationBaseClassName","labelBaseClassName","mediaBaseClassName","rootBaseClassName","rootStyles","actionsPresent","className","citationPresent","mediaPresent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,EAAEC,gBAAgB,QAAQ,6BAA6B;AACzG,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,0BAA8D;IACzEC,MAAM;IACNC,SAAS;IACTC,UAAU;IACVC,OAAO;IACPC,OAAO;AACT,EAAE;AAEF,OAAO,MAAMC,+BAA+B;IAC1CC,YAAY;AACd,EAAE;AAEF,MAAMC,gBAAgBV,iBAAiBW,cAAc,CAACC,QAAQ;AAC9D,MAAMC,kBAAkBb,iBAAiBW,cAAc,CAACG,UAAU;AAElE,MAAMC,0BAA0BlB,gBAAgB;IAC9CmB,SAAS;IACTC,aAAa;AACf;AAEA,MAAMC,2BAA2BrB,gBAAgB;IAC/CmB,SAAS;AACX;AAEA,MAAMG,wBAAwBtB,gBAAgB;IAC5CuB,WAAW;IACXC,SAAS;IACTL,SAAS;IACTM,WAAW;IACX,sEAAsE;IACtEC,YAAY,CAAC,mBAAmB,EAAEV,gBAAgB,GAAG,EAAEH,cAAc,EAAE,CAAC;IACxEc,WAAW;IAEX,sBAAsB;IACtB,sBAAsB;IAEtB,GAAGxB,iBAAiBW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GAAGnD,aAAaG,wBAAwBI,KAAK,EAAEuC,oBAAoBH,MAAMpC,KAAK,CAAC4C,SAAS;IAE7G,IAAIE,eAAe;IACnB,IAAIV,MAAMnC,KAAK,EAAE;QACf6C,eAAe;QACfV,MAAMnC,KAAK,CAAC2C,SAAS,GAAGnD,aAAaG,wBAAwBK,KAAK,EAAEuC,oBAAoBJ,MAAMnC,KAAK,CAAC2C,SAAS;IAC/G;IAEAR,MAAMvC,IAAI,CAAC+C,SAAS,GAAGnD,aACrBG,wBAAwBC,IAAI,EAC5B4C,mBACA,CAACI,mBAAmB,CAACC,gBAAgB,CAACH,kBAAkBD,WAAWd,SAAS,EAC5E,AAAC,CAAA,AAACiB,mBAAmB,CAACC,gBAAkBA,gBAAgB,CAACD,eAAe,KACtE,CAACF,kBACDD,WAAWZ,gBAAgB,EAC7B,CAACe,mBAAmB,CAACC,gBAAgBH,kBAAkBD,WAAWX,eAAe,EACjFc,mBAAmBC,gBAAgB,CAACH,kBAAkBD,WAAWV,kBAAkB,EACnF,AAAC,CAAA,AAACa,mBAAmB,CAACC,gBAAkBA,gBAAgB,CAACD,eAAe,KACtEF,kBACAD,WAAWT,oBAAoB,EACjCY,mBAAmBC,gBAAgBH,kBAAkBD,WAAWR,GAAG,EACnEE,MAAMvC,IAAI,CAAC+C,SAAS;IAGtB,OAAOR;AACT,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './usePreviewMetadataStyles.styles';
|
|
1
|
+
export { PreviewMetadata } from './PreviewMetadata';
|
|
2
|
+
export { renderPreviewMetadata_unstable } from './renderPreviewMetadata';
|
|
3
|
+
export { usePreviewMetadata_unstable } from './usePreviewMetadata';
|
|
4
|
+
export { previewMetadataClassNames, usePreviewMetadataStyles_unstable } from './usePreviewMetadataStyles.styles';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { PreviewMetadata } from './PreviewMetadata';\nexport type { PreviewMetadataProps, PreviewMetadataSlots, PreviewMetadataState } from './PreviewMetadata.types';\nexport { renderPreviewMetadata_unstable } from './renderPreviewMetadata';\nexport { usePreviewMetadata_unstable } from './usePreviewMetadata';\nexport { previewMetadataClassNames, usePreviewMetadataStyles_unstable } from './usePreviewMetadataStyles.styles';\n"],"names":["PreviewMetadata","renderPreviewMetadata_unstable","usePreviewMetadata_unstable","previewMetadataClassNames","usePreviewMetadataStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AAEpD,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,2BAA2B,QAAQ,uBAAuB;AACnE,SAASC,yBAAyB,EAAEC,iCAAiC,QAAQ,oCAAoC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { __resetStyles, __styles, mergeClasses, shorthands,
|
|
1
|
+
import { __resetStyles, __styles, mergeClasses, shorthands, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
2
3
|
export const previewMetadataClassNames = {
|
|
3
4
|
root: 'fai-PreviewMetadata',
|
|
4
5
|
icon: 'fai-PreviewMetadata__icon',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewMetadataStyles.styles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n
|
|
1
|
+
{"version":3,"sources":["usePreviewMetadataStyles.styles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n typographyStyles,\n} from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\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","typographyStyles","tokens","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,gBAAgB,QACX,6BAA6B;AACpC,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,4BAAkE;IAC7EC,MAAM;IACNC,MAAM;IACNC,aAAa;IACbC,eAAe;IACfC,cAAc;AAChB,EAAE;AAEF,MAAMC,uBAAuBZ,gBAAgB;IAC3C,GAAGI,iBAAiBS,QAAQ;AAC9B;AAEA,MAAMC,uBAAuBd,gBAAgB;IAC3Ce,YAAYV,OAAOW,uBAAuB;IAC1CC,eAAe;AACjB;AAEA,MAAMC,gBAAgBjB,WAAW;IAC/BkB,gBAAgB;QACdJ,YAAY,CAAC,KAAK,EAAEV,OAAOW,uBAAuB,CAAC,KAAK,CAAC;QACzDI,UAAU;QAEV,aAAa;YACX,GAAGjB,WAAWkB,UAAU,CAAChB,OAAOiB,eAAe,EAAE,SAASjB,OAAOkB,mBAAmB,CAAC;YACrFC,SAAS;YACTC,SAAS;YACTC,QAAQtB,iBAAiBS,QAAQ,CAACc,QAAQ;YAC1CC,MAAM,CAAC,UAAU,EAAEvB,OAAOW,uBAAuB,CAAC,CAAC,CAAC;YACpDI,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ponentState,\n PopoverSurfaceProps,\n PopoverSurfaceSlots,\n PopoverSurfaceState,\n} from '@fluentui/react-components';\n\nexport type PreviewSurfaceSlots = PopoverSurfaceSlots & {};\n\n/**\n * PreviewSurface Props\n */\nexport type PreviewSurfaceProps = ComponentProps<PreviewSurfaceSlots> & PopoverSurfaceProps & {};\n\n/**\n * State used in rendering PreviewSurface\n */\nexport type PreviewSurfaceState = ComponentState<PreviewSurfaceSlots>
|
|
1
|
+
{"version":3,"sources":["PreviewSurface.types.ts"],"sourcesContent":["import type { DesignVersion } from '@fluentui-copilot/react-provider';\nimport type {\n ComponentProps,\n ComponentState,\n PopoverSurfaceProps,\n PopoverSurfaceSlots,\n PopoverSurfaceState,\n} from '@fluentui/react-components';\n\nexport type PreviewSurfaceSlots = PopoverSurfaceSlots & {};\n\n/**\n * PreviewSurface Props\n */\nexport type PreviewSurfaceProps = ComponentProps<PreviewSurfaceSlots> & PopoverSurfaceProps & DesignVersion & {};\n\n/**\n * State used in rendering PreviewSurface\n */\nexport type PreviewSurfaceState = ComponentState<PreviewSurfaceSlots> &\n PopoverSurfaceState &\n Pick<Required<PreviewSurfaceProps>, 'designVersion'> & {};\n"],"names":[],"rangeMappings":";;","mappings":"AAgBA;;CAEC,GACD,WAE4D"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export * from './usePreviewSurfaceStyles.styles';
|
|
1
|
+
export { PreviewSurface } from './PreviewSurface';
|
|
2
|
+
export { renderPreviewSurface_unstable } from './renderPreviewSurface';
|
|
3
|
+
export { usePreviewSurface_unstable } from './usePreviewSurface';
|
|
4
|
+
export { previewSurfaceClassNames, usePreviewSurfaceStyles_unstable } from './usePreviewSurfaceStyles.styles';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { PreviewSurface } from './PreviewSurface';\nexport type { PreviewSurfaceProps, PreviewSurfaceSlots, PreviewSurfaceState } from './PreviewSurface.types';\nexport { renderPreviewSurface_unstable } from './renderPreviewSurface';\nexport { usePreviewSurface_unstable } from './usePreviewSurface';\nexport { previewSurfaceClassNames, usePreviewSurfaceStyles_unstable } from './usePreviewSurfaceStyles.styles';\n"],"names":["PreviewSurface","renderPreviewSurface_unstable","usePreviewSurface_unstable","previewSurfaceClassNames","usePreviewSurfaceStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,cAAc,QAAQ,mBAAmB;AAElD,SAASC,6BAA6B,QAAQ,yBAAyB;AACvE,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,wBAAwB,EAAEC,gCAAgC,QAAQ,mCAAmC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { usePopoverSurface_unstable } from '@fluentui/react-components';
|
|
2
|
+
import { useDesignVersion } from '@fluentui-copilot/react-provider';
|
|
2
3
|
// If you add JSX to this file, be sure to change the file type to .tsx
|
|
3
4
|
/**
|
|
4
5
|
* Create the state required to render PreviewSurface.
|
|
@@ -10,6 +11,10 @@ import { usePopoverSurface_unstable } from '@fluentui/react-components';
|
|
|
10
11
|
* @param ref - reference to root HTMLElement of PreviewSurface
|
|
11
12
|
*/
|
|
12
13
|
export const usePreviewSurface_unstable = (props, ref) => {
|
|
13
|
-
|
|
14
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
15
|
+
return {
|
|
16
|
+
designVersion,
|
|
17
|
+
...usePopoverSurface_unstable(props, ref)
|
|
18
|
+
};
|
|
14
19
|
};
|
|
15
20
|
//# sourceMappingURL=usePreviewSurface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["usePreviewSurface.ts"],"sourcesContent":["import type * as React from 'react';\nimport { usePopoverSurface_unstable } from '@fluentui/react-components';\nimport type { PreviewSurfaceProps, PreviewSurfaceState } from './PreviewSurface.types';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render PreviewSurface.\n *\n * The returned state can be modified with hooks such as usePreviewSurfaceStyles_unstable,\n * before being passed to renderPreviewSurface_unstable.\n *\n * @param props - props from this instance of PreviewSurface\n * @param ref - reference to root HTMLElement of PreviewSurface\n */\nexport const usePreviewSurface_unstable = (\n props: PreviewSurfaceProps,\n ref: React.Ref<HTMLDivElement>,\n): PreviewSurfaceState => {\n return usePopoverSurface_unstable(props, ref);\n};\n"],"names":["usePopoverSurface_unstable","usePreviewSurface_unstable","props","ref"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["usePreviewSurface.ts"],"sourcesContent":["import type * as React from 'react';\nimport { usePopoverSurface_unstable } from '@fluentui/react-components';\nimport type { PreviewSurfaceProps, PreviewSurfaceState } from './PreviewSurface.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n// If you add JSX to this file, be sure to change the file type to .tsx\n\n/**\n * Create the state required to render PreviewSurface.\n *\n * The returned state can be modified with hooks such as usePreviewSurfaceStyles_unstable,\n * before being passed to renderPreviewSurface_unstable.\n *\n * @param props - props from this instance of PreviewSurface\n * @param ref - reference to root HTMLElement of PreviewSurface\n */\nexport const usePreviewSurface_unstable = (\n props: PreviewSurfaceProps,\n ref: React.Ref<HTMLDivElement>,\n): PreviewSurfaceState => {\n const designVersion = useDesignVersion(props.designVersion);\n return { designVersion, ...usePopoverSurface_unstable(props, ref) };\n};\n"],"names":["usePopoverSurface_unstable","useDesignVersion","usePreviewSurface_unstable","props","ref","designVersion"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AACA,SAASA,0BAA0B,QAAQ,6BAA6B;AAExE,SAASC,gBAAgB,QAAQ,mCAAmC;AAEpE,uEAAuE;AAEvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEA,MAAMC,gBAAgBJ,iBAAiBE,MAAME,aAAa;IAC1D,OAAO;QAAEA;QAAe,GAAGL,2BAA2BG,OAAOC,IAAI;IAAC;AACpE,EAAE"}
|