@fluentui-copilot/react-reference 0.15.4 → 0.15.5-hotfix.1
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 +31 -1
- package/CHANGELOG.md +19 -1
- package/lib/Citation.js +0 -1
- package/lib/Reference.js +0 -1
- package/lib/ReferenceGroupToggle.js +0 -1
- package/lib/ReferenceList.js +0 -1
- package/lib/ReferenceListV2.js +0 -1
- package/lib/ReferenceOverflowButton.js +0 -1
- package/lib/ReferenceV2.js +0 -1
- package/lib/components/Citation/Citation.js +5 -6
- package/lib/components/Citation/Citation.types.js +1 -2
- package/lib/components/Citation/index.js +0 -1
- package/lib/components/Citation/renderCitation.js +4 -6
- package/lib/components/Citation/useCitation.js +22 -28
- package/lib/components/Citation/useCitationStyles.styles.js +1 -1
- package/lib/components/Citation/useCitationStyles.styles.js.map +1 -1
- package/lib/components/Citation/useCitationStyles.styles.raw.js +69 -0
- package/lib/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib/components/Reference/Reference.js +5 -7
- package/lib/components/Reference/Reference.types.js +1 -2
- package/lib/components/Reference/index.js +0 -1
- package/lib/components/Reference/renderReference.js +27 -12
- package/lib/components/Reference/useReference.js +173 -172
- package/lib/components/Reference/useReferenceStyles.styles.raw.js +197 -0
- package/lib/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.js +4 -6
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js +1 -2
- package/lib/components/ReferenceGroupToggle/index.js +0 -1
- package/lib/components/ReferenceGroupToggle/renderReferenceGroupToggle.js +9 -8
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggle.js +26 -30
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js +44 -0
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js.map +1 -0
- package/lib/components/ReferenceList/ReferenceList.js +5 -7
- package/lib/components/ReferenceList/ReferenceList.types.js +1 -2
- package/lib/components/ReferenceList/index.js +0 -1
- package/lib/components/ReferenceList/renderReferenceList.js +4 -6
- package/lib/components/ReferenceList/useReferenceList.js +15 -17
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js +27 -0
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/Reference/Reference.js +4 -5
- package/lib/components/reference-v2/Reference/Reference.types.js +1 -2
- package/lib/components/reference-v2/Reference/index.js +0 -1
- package/lib/components/reference-v2/Reference/renderReference.js +20 -17
- package/lib/components/reference-v2/Reference/useReference.js +53 -59
- package/lib/components/reference-v2/Reference/useReferenceStyles.styles.raw.js +110 -0
- package/lib/components/reference-v2/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.js +5 -6
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js +1 -2
- package/lib/components/reference-v2/ReferenceList/index.js +0 -1
- package/lib/components/reference-v2/ReferenceList/renderReferenceList.js +17 -17
- package/lib/components/reference-v2/ReferenceList/useReferenceList.js +70 -80
- package/lib/components/reference-v2/ReferenceList/useReferenceListContextValues.js +13 -21
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js +47 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +4 -5
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +1 -2
- package/lib/components/reference-v2/ReferenceOverflowButton/index.js +0 -1
- package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +9 -14
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +77 -77
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +45 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/index.js +0 -1
- package/lib/contexts/ReferenceGroupContext.js +5 -6
- package/lib/contexts/reference-v2/index.js +0 -1
- package/lib/contexts/reference-v2/referenceListContext.js +11 -12
- package/lib/index.js +0 -1
- package/lib/utilities/index.js +0 -1
- package/lib/utilities/reference-v2/generateReferenceCitationPreview.js +75 -86
- package/lib/utilities/reference-v2/index.js +0 -1
- package/lib/utilities/reference-v2/useReferenceCitationPreview.js +5 -5
- package/lib/utilities/useReferenceCitationPreview.js +123 -114
- package/lib/utilities/useReferenceGroup.js +28 -32
- package/lib/utilities/useReferenceGroup.js.map +1 -1
- package/lib/utilities/useReferenceGroup.styles.js +9 -0
- package/lib/utilities/useReferenceGroup.styles.js.map +1 -0
- package/lib/utilities/useReferenceGroup.styles.raw.js +6 -0
- package/lib/utilities/useReferenceGroup.styles.raw.js.map +1 -0
- package/lib-commonjs/Citation.js +0 -1
- package/lib-commonjs/Reference.js +0 -1
- package/lib-commonjs/ReferenceGroupToggle.js +0 -1
- package/lib-commonjs/ReferenceList.js +0 -1
- package/lib-commonjs/ReferenceListV2.js +0 -1
- package/lib-commonjs/ReferenceOverflowButton.js +0 -1
- package/lib-commonjs/ReferenceV2.js +0 -1
- package/lib-commonjs/components/Citation/Citation.js +1 -1
- package/lib-commonjs/components/Citation/Citation.js.map +1 -1
- package/lib-commonjs/components/Citation/Citation.types.js +0 -1
- package/lib-commonjs/components/Citation/index.js +0 -1
- package/lib-commonjs/components/Citation/renderCitation.js +1 -1
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitation.js +1 -1
- package/lib-commonjs/components/Citation/useCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitationStyles.styles.js +7 -7
- package/lib-commonjs/components/Citation/useCitationStyles.styles.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js +85 -0
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Reference/Reference.js +1 -1
- package/lib-commonjs/components/Reference/Reference.js.map +1 -1
- package/lib-commonjs/components/Reference/Reference.types.js +0 -1
- package/lib-commonjs/components/Reference/index.js +0 -1
- package/lib-commonjs/components/Reference/renderReference.js +1 -1
- package/lib-commonjs/components/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReference.js +1 -1
- package/lib-commonjs/components/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js +214 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.js +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js +0 -1
- package/lib-commonjs/components/ReferenceGroupToggle/index.js +0 -1
- package/lib-commonjs/components/ReferenceGroupToggle/renderReferenceGroupToggle.js +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/renderReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggle.js +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js +60 -0
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/ReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js +0 -1
- package/lib-commonjs/components/ReferenceList/index.js +0 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js +44 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js +0 -1
- package/lib-commonjs/components/reference-v2/Reference/index.js +0 -1
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.styles.raw.js +132 -0
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/index.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js +63 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/index.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +61 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/index.js +0 -1
- package/lib-commonjs/contexts/ReferenceGroupContext.js +1 -1
- package/lib-commonjs/contexts/ReferenceGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/reference-v2/index.js +0 -1
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js +1 -1
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js.map +1 -1
- package/lib-commonjs/index.js +0 -1
- package/lib-commonjs/utilities/index.js +0 -1
- package/lib-commonjs/utilities/reference-v2/generateReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/reference-v2/generateReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/reference-v2/index.js +0 -1
- package/lib-commonjs/utilities/reference-v2/useReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/reference-v2/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/useReferenceGroup.js +3 -11
- package/lib-commonjs/utilities/useReferenceGroup.js.map +1 -1
- package/lib-commonjs/utilities/useReferenceGroup.styles.js +20 -0
- package/lib-commonjs/utilities/useReferenceGroup.styles.js.map +1 -0
- package/lib-commonjs/utilities/useReferenceGroup.styles.raw.js +16 -0
- package/lib-commonjs/utilities/useReferenceGroup.styles.raw.js.map +1 -0
- package/package.json +7 -11
|
@@ -5,18 +5,20 @@ import { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';
|
|
|
5
5
|
import { Citation } from '../../Citation';
|
|
6
6
|
import { Reference } from '../../ReferenceV2';
|
|
7
7
|
// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.
|
|
8
|
-
const CitationCloseButton = citationCloseButtonProps
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
const CitationCloseButton = (citationCloseButtonProps)=>{
|
|
9
|
+
const setPopoverOpen = usePopoverContext_unstable((context)=>context.setOpen);
|
|
10
|
+
const onPopoverCloseClick = React.useCallback((ev)=>{
|
|
11
|
+
setPopoverOpen(ev, false);
|
|
12
|
+
// Don't navigate
|
|
13
|
+
ev.preventDefault();
|
|
14
|
+
}, [
|
|
15
|
+
setPopoverOpen
|
|
16
|
+
]);
|
|
17
|
+
const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);
|
|
18
|
+
return /*#__PURE__*/ React.createElement(Citation, {
|
|
19
|
+
...citationCloseButtonProps,
|
|
20
|
+
onClick: onCitationCloseButtonClick
|
|
21
|
+
});
|
|
20
22
|
};
|
|
21
23
|
/**
|
|
22
24
|
* Function to generate a Citation - Reference pair with correctly wired props.
|
|
@@ -29,79 +31,66 @@ const CitationCloseButton = citationCloseButtonProps => {
|
|
|
29
31
|
* `generateReferenceCitationPreview` directly.
|
|
30
32
|
*
|
|
31
33
|
* @returns A Citation - Reference pair with correctly wired props.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
citation: /*#__PURE__*/React.createElement(CitationCloseButton, {
|
|
60
|
-
"aria-label": `Close Reference ${index}`,
|
|
61
|
-
referenceHref: "#",
|
|
62
|
-
tabIndex: -1
|
|
63
|
-
}, index),
|
|
64
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic
|
|
65
|
-
}, referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children), /*#__PURE__*/React.createElement(PreviewMetadata, {
|
|
66
|
-
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
67
|
-
primaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.primaryText,
|
|
68
|
-
secondaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.secondaryText,
|
|
69
|
-
tertiaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.tertiaryText
|
|
70
|
-
}), sensitivityLabelProps && /*#__PURE__*/React.createElement(SensitivityLabel, sensitivityLabelProps), (_previewContentProps_content = previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.content) !== null && _previewContentProps_content !== void 0 ? _previewContentProps_content : citationPreviewProps === null || citationPreviewProps === void 0 ? void 0 : citationPreviewProps.children)));
|
|
71
|
-
};
|
|
72
|
-
const ReferenceWithPreview = props => {
|
|
73
|
-
const mergedReferenceProps = {
|
|
74
|
-
citation: index,
|
|
75
|
-
...referenceProps,
|
|
76
|
-
...props
|
|
34
|
+
*/ export const generateReferenceCitationPreview = (props)=>{
|
|
35
|
+
const { citationPreviewProps, citationPreviewSurfaceProps, citationProps, index, previewContentProps, previewHeaderProps, referencePreviewProps, referencePreviewSurfaceProps, referenceProps, sensitivityLabelProps } = props;
|
|
36
|
+
const CitationWithPreview = (props)=>{
|
|
37
|
+
var _previewContentProps_content;
|
|
38
|
+
return /*#__PURE__*/ React.createElement(Preview, {
|
|
39
|
+
closeOnScroll: true,
|
|
40
|
+
positioning: "above",
|
|
41
|
+
size: "small",
|
|
42
|
+
trapFocus: true,
|
|
43
|
+
withArrow: true,
|
|
44
|
+
...citationPreviewProps
|
|
45
|
+
}, /*#__PURE__*/ React.createElement(PreviewTrigger, null, /*#__PURE__*/ React.createElement(Citation, {
|
|
46
|
+
...citationProps,
|
|
47
|
+
...props
|
|
48
|
+
}, index)), /*#__PURE__*/ React.createElement(PreviewSurface, citationPreviewSurfaceProps, /*#__PURE__*/ React.createElement(PreviewContent, null, /*#__PURE__*/ React.createElement(PreviewHeader, {
|
|
49
|
+
citation: /*#__PURE__*/ React.createElement(CitationCloseButton, {
|
|
50
|
+
"aria-label": `Close Reference ${index}`,
|
|
51
|
+
referenceHref: "#",
|
|
52
|
+
tabIndex: -1
|
|
53
|
+
}, index),
|
|
54
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic
|
|
55
|
+
}, referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children), /*#__PURE__*/ React.createElement(PreviewMetadata, {
|
|
56
|
+
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
57
|
+
primaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.primaryText,
|
|
58
|
+
secondaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.secondaryText,
|
|
59
|
+
tertiaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.tertiaryText
|
|
60
|
+
}), sensitivityLabelProps && /*#__PURE__*/ React.createElement(SensitivityLabel, sensitivityLabelProps), (_previewContentProps_content = previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.content) !== null && _previewContentProps_content !== void 0 ? _previewContentProps_content : citationPreviewProps === null || citationPreviewProps === void 0 ? void 0 : citationPreviewProps.children)));
|
|
77
61
|
};
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
62
|
+
const ReferenceWithPreview = (props)=>{
|
|
63
|
+
const mergedReferenceProps = {
|
|
64
|
+
citation: index,
|
|
65
|
+
...referenceProps,
|
|
66
|
+
...props
|
|
67
|
+
};
|
|
68
|
+
var _previewHeaderProps_children, _previewContentProps_content;
|
|
69
|
+
return /*#__PURE__*/ React.createElement(Preview, {
|
|
70
|
+
closeOnScroll: true,
|
|
71
|
+
positioning: "above",
|
|
72
|
+
size: "small",
|
|
73
|
+
trapFocus: true,
|
|
74
|
+
withArrow: true,
|
|
75
|
+
...referencePreviewProps
|
|
76
|
+
}, /*#__PURE__*/ React.createElement(PreviewTrigger, null, /*#__PURE__*/ React.createElement(Reference, mergedReferenceProps)), /*#__PURE__*/ React.createElement(PreviewSurface, referencePreviewSurfaceProps, /*#__PURE__*/ React.createElement(PreviewContent, null, /*#__PURE__*/ React.createElement(PreviewHeader, {
|
|
77
|
+
citation: /*#__PURE__*/ React.createElement(CitationCloseButton, {
|
|
78
|
+
"aria-label": `Close Reference ${index}`,
|
|
79
|
+
referenceHref: "#",
|
|
80
|
+
tabIndex: -1
|
|
81
|
+
}, index),
|
|
82
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
83
|
+
...previewHeaderProps
|
|
84
|
+
}, (_previewHeaderProps_children = previewHeaderProps === null || previewHeaderProps === void 0 ? void 0 : previewHeaderProps.children) !== null && _previewHeaderProps_children !== void 0 ? _previewHeaderProps_children : referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children), /*#__PURE__*/ React.createElement(PreviewMetadata, {
|
|
85
|
+
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
86
|
+
primaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.primaryText,
|
|
87
|
+
secondaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.secondaryText,
|
|
88
|
+
tertiaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.tertiaryText
|
|
89
|
+
}), sensitivityLabelProps && /*#__PURE__*/ React.createElement(SensitivityLabel, sensitivityLabelProps), (_previewContentProps_content = previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.content) !== null && _previewContentProps_content !== void 0 ? _previewContentProps_content : referencePreviewProps === null || referencePreviewProps === void 0 ? void 0 : referencePreviewProps.children)));
|
|
90
|
+
};
|
|
91
|
+
const components = {
|
|
92
|
+
Citation: CitationWithPreview,
|
|
93
|
+
Reference: ReferenceWithPreview
|
|
94
|
+
};
|
|
95
|
+
return components;
|
|
106
96
|
};
|
|
107
|
-
//# sourceMappingURL=generateReferenceCitationPreview.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { generateReferenceCitationPreview } from './generateReferenceCitationPreview';
|
|
3
3
|
/**
|
|
4
4
|
* Hook to generate a Citation - Reference pair with correctly wired props.
|
|
@@ -11,8 +11,8 @@ import { generateReferenceCitationPreview } from './generateReferenceCitationPre
|
|
|
11
11
|
* `generateReferenceCitationPreview` directly.
|
|
12
12
|
*
|
|
13
13
|
* @returns A Citation - Reference pair with correctly wired props.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
*/ export const useReferenceCitationPreview = (props)=>{
|
|
15
|
+
return React.useMemo(()=>generateReferenceCitationPreview(props), [
|
|
16
|
+
props
|
|
17
|
+
]);
|
|
17
18
|
};
|
|
18
|
-
//# sourceMappingURL=useReferenceCitationPreview.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Caption1, assertSlots, mergeCallbacks, slot, useId, usePopoverContext_unstable } from '@fluentui/react-components';
|
|
4
4
|
import { Preview, PreviewContent, PreviewHeader, PreviewMetadata, PreviewSurface, PreviewTrigger } from '@fluentui-copilot/react-preview';
|
|
@@ -6,18 +6,20 @@ import { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';
|
|
|
6
6
|
import { Citation } from '../Citation';
|
|
7
7
|
import { Reference } from '../Reference';
|
|
8
8
|
// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.
|
|
9
|
-
const CitationCloseButton = citationCloseButtonProps
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
const CitationCloseButton = (citationCloseButtonProps)=>{
|
|
10
|
+
const setPopoverOpen = usePopoverContext_unstable((context)=>context.setOpen);
|
|
11
|
+
const onPopoverCloseClick = React.useCallback((ev)=>{
|
|
12
|
+
setPopoverOpen(ev, false);
|
|
13
|
+
// Don't navigate
|
|
14
|
+
ev.preventDefault();
|
|
15
|
+
}, [
|
|
16
|
+
setPopoverOpen
|
|
17
|
+
]);
|
|
18
|
+
const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);
|
|
19
|
+
return /*#__PURE__*/ _jsx(Citation, {
|
|
20
|
+
...citationCloseButtonProps,
|
|
21
|
+
onClick: onCitationCloseButtonClick
|
|
22
|
+
});
|
|
21
23
|
};
|
|
22
24
|
/**
|
|
23
25
|
* Hook to package a `Citation` and `Reference` together in an
|
|
@@ -25,105 +27,112 @@ const CitationCloseButton = citationCloseButtonProps => {
|
|
|
25
27
|
*
|
|
26
28
|
* When using citations and references, prefer using them via this
|
|
27
29
|
* hook to ensure props are wired up correctly.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
30
|
+
*/ export const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationId: propsCiteId, citationProps, referenceProps, previewHeaderProps, previewProps, previewSurfaceProps, sensitivityLabelProps })=>{
|
|
31
|
+
const refId = useId();
|
|
32
|
+
const citeId = useId();
|
|
33
|
+
const referenceId = propsRefId !== null && propsRefId !== void 0 ? propsRefId : refId;
|
|
34
|
+
const citationId = propsCiteId !== null && propsCiteId !== void 0 ? propsCiteId : citeId;
|
|
35
|
+
const components = React.useMemo(()=>{
|
|
36
|
+
const citationHref = `#${citationId}`;
|
|
37
|
+
const PackagedReference = (props)=>{
|
|
38
|
+
var _props_index, _ref;
|
|
39
|
+
const referenceIndex = (_ref = (_props_index = props.index) !== null && _props_index !== void 0 ? _props_index : referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.index) !== null && _ref !== void 0 ? _ref : index;
|
|
40
|
+
return /*#__PURE__*/ _jsx(Reference, {
|
|
41
|
+
...referenceProps,
|
|
42
|
+
index: referenceIndex,
|
|
43
|
+
referenceId: referenceId,
|
|
44
|
+
citationHref: citationHref,
|
|
45
|
+
...props
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const CitationWithPreview = (props)=>{
|
|
49
|
+
// We assert content as a slot to use it with its resolved props object and the correct defaults below.
|
|
50
|
+
const content = slot.always(referenceProps ? referenceProps.content : undefined, {
|
|
51
|
+
defaultProps: {
|
|
52
|
+
children: (referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.excerpt) && /*#__PURE__*/ _jsx(Caption1, {
|
|
53
|
+
children: referenceProps.excerpt
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
elementType: 'div'
|
|
57
|
+
});
|
|
58
|
+
const citationWithPreviewState = {
|
|
59
|
+
components: {
|
|
60
|
+
content: 'div'
|
|
61
|
+
},
|
|
62
|
+
content
|
|
63
|
+
};
|
|
64
|
+
assertSlots(citationWithPreviewState);
|
|
65
|
+
// We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.
|
|
66
|
+
const sensitivity = slot.optional(referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.sensitivity, {
|
|
67
|
+
elementType: 'span'
|
|
68
|
+
});
|
|
69
|
+
const title = slot.optional(referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.label, {
|
|
70
|
+
elementType: 'div'
|
|
71
|
+
});
|
|
72
|
+
var _previewHeaderProps_children, _sensitivityLabelProps_description, _previewSurfaceProps_children;
|
|
73
|
+
return /*#__PURE__*/ _jsxs(Preview, {
|
|
74
|
+
closeOnScroll: true,
|
|
75
|
+
positioning: "above",
|
|
76
|
+
size: "small",
|
|
77
|
+
trapFocus: true,
|
|
78
|
+
withArrow: true,
|
|
79
|
+
...previewProps,
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsx(PreviewTrigger, {
|
|
82
|
+
children: /*#__PURE__*/ _jsx(Citation, {
|
|
83
|
+
...citationProps,
|
|
84
|
+
id: citationId,
|
|
85
|
+
...props,
|
|
86
|
+
children: index
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ _jsx(PreviewSurface, {
|
|
90
|
+
...previewSurfaceProps,
|
|
91
|
+
children: /*#__PURE__*/ _jsxs(PreviewContent, {
|
|
92
|
+
children: [
|
|
93
|
+
/*#__PURE__*/ _jsx(PreviewHeader, {
|
|
94
|
+
citation: /*#__PURE__*/ _jsx(CitationCloseButton, {
|
|
95
|
+
"aria-label": `Close Reference ${index}`,
|
|
96
|
+
referenceHref: "#",
|
|
97
|
+
tabIndex: -1,
|
|
98
|
+
children: index
|
|
99
|
+
}),
|
|
100
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.media,
|
|
101
|
+
...previewHeaderProps,
|
|
102
|
+
children: (_previewHeaderProps_children = previewHeaderProps === null || previewHeaderProps === void 0 ? void 0 : previewHeaderProps.children) !== null && _previewHeaderProps_children !== void 0 ? _previewHeaderProps_children : title === null || title === void 0 ? void 0 : title.children
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ _jsx(PreviewMetadata, {
|
|
105
|
+
icon: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.icon,
|
|
106
|
+
primaryText: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.primaryText,
|
|
107
|
+
secondaryText: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.secondaryText,
|
|
108
|
+
tertiaryText: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.tertiaryText
|
|
109
|
+
}),
|
|
110
|
+
sensitivity && /*#__PURE__*/ _jsx(SensitivityLabel, {
|
|
111
|
+
description: (_sensitivityLabelProps_description = sensitivityLabelProps === null || sensitivityLabelProps === void 0 ? void 0 : sensitivityLabelProps.description) !== null && _sensitivityLabelProps_description !== void 0 ? _sensitivityLabelProps_description : '',
|
|
112
|
+
children: sensitivity.children
|
|
113
|
+
}),
|
|
114
|
+
/*#__PURE__*/ _jsx(citationWithPreviewState.content, {}),
|
|
115
|
+
(_previewSurfaceProps_children = previewSurfaceProps === null || previewSurfaceProps === void 0 ? void 0 : previewSurfaceProps.children) !== null && _previewSurfaceProps_children !== void 0 ? _previewSurfaceProps_children : previewProps === null || previewProps === void 0 ? void 0 : previewProps.children
|
|
116
|
+
]
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
Citation: CitationWithPreview,
|
|
124
|
+
Reference: PackagedReference
|
|
125
|
+
};
|
|
126
|
+
}, [
|
|
127
|
+
index,
|
|
128
|
+
referenceId,
|
|
129
|
+
citationId,
|
|
130
|
+
referenceProps,
|
|
131
|
+
citationProps,
|
|
132
|
+
previewHeaderProps,
|
|
133
|
+
previewProps,
|
|
134
|
+
previewSurfaceProps,
|
|
135
|
+
sensitivityLabelProps
|
|
136
|
+
]);
|
|
137
|
+
return components;
|
|
128
138
|
};
|
|
129
|
-
//# sourceMappingURL=useReferenceCitationPreview.js.map
|
|
@@ -1,40 +1,36 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
hidden: {
|
|
5
|
-
mc9l5x: "fjseox"
|
|
6
|
-
}
|
|
7
|
-
}, {
|
|
8
|
-
d: [".fjseox{display:none;}"]
|
|
9
|
-
});
|
|
2
|
+
import { useId } from '@fluentui/react-components';
|
|
3
|
+
import { useStyles } from './useReferenceGroup.styles';
|
|
10
4
|
/**
|
|
11
5
|
* Hook to package a `ReferenceGroupToggle` and `ReferenceList` together and
|
|
12
6
|
* maintain their `isOpen` state.
|
|
13
7
|
*
|
|
14
8
|
* When rendering a group of references, prefer to use this hook
|
|
15
9
|
* hook to ensure state is maintained correctly
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
10
|
+
*/ export const useReferenceGroup = (props)=>{
|
|
11
|
+
const [isOpen, setIsOpen] = React.useState(false);
|
|
12
|
+
const styles = useStyles();
|
|
13
|
+
const referenceListId = useId('reference-list', props.referenceListId);
|
|
14
|
+
return React.useMemo(()=>{
|
|
15
|
+
const handleClick = ()=>{
|
|
16
|
+
setIsOpen((isOpen)=>!isOpen);
|
|
17
|
+
};
|
|
18
|
+
const referenceGroupToggleProps = {
|
|
19
|
+
'aria-controls': referenceListId,
|
|
20
|
+
isOpen,
|
|
21
|
+
onClick: handleClick
|
|
22
|
+
};
|
|
23
|
+
const referenceListProps = {
|
|
24
|
+
className: isOpen ? undefined : styles.hidden,
|
|
25
|
+
id: referenceListId
|
|
26
|
+
};
|
|
27
|
+
return {
|
|
28
|
+
referenceGroupToggleProps,
|
|
29
|
+
referenceListProps
|
|
30
|
+
};
|
|
31
|
+
}, [
|
|
32
|
+
isOpen,
|
|
33
|
+
referenceListId,
|
|
34
|
+
styles.hidden
|
|
35
|
+
]);
|
|
39
36
|
};
|
|
40
|
-
//# sourceMappingURL=useReferenceGroup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["useReferenceGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useId } from '@fluentui/react-components';\nimport type { ReferenceListProps } from '../ReferenceList';\nimport type { ReferenceGroupToggleProps } from '../ReferenceGroupToggle';\nimport { useStyles } from './useReferenceGroup.styles';\n\nexport type UseReferenceGroupProps = { referenceListId?: string };\nexport type UseReferenceGroup = (props: UseReferenceGroupProps) => {\n referenceGroupToggleProps: ReferenceGroupToggleProps;\n referenceListProps: ReferenceListProps;\n};\n\n/**\n * Hook to package a `ReferenceGroupToggle` and `ReferenceList` together and\n * maintain their `isOpen` state.\n *\n * When rendering a group of references, prefer to use this hook\n * hook to ensure state is maintained correctly\n */\nexport const useReferenceGroup: UseReferenceGroup = props => {\n const [isOpen, setIsOpen] = React.useState(false);\n const styles = useStyles();\n const referenceListId = useId('reference-list', props.referenceListId);\n\n return React.useMemo(() => {\n const handleClick = () => {\n setIsOpen(isOpen => !isOpen);\n };\n\n const referenceGroupToggleProps = {\n 'aria-controls': referenceListId,\n isOpen,\n onClick: handleClick,\n };\n\n const referenceListProps = {\n className: isOpen ? undefined : styles.hidden,\n id: referenceListId,\n };\n\n return { referenceGroupToggleProps, referenceListProps };\n }, [isOpen, referenceListId, styles.hidden]);\n};\n"],"names":["React","useId","useStyles","useReferenceGroup","props","isOpen","setIsOpen","useState","styles","referenceListId","useMemo","handleClick","referenceGroupToggleProps","onClick","referenceListProps","className","undefined","hidden","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,KAAK,QAAQ,6BAA6B;AAGnD,SAASC,SAAS,QAAQ,6BAA6B;AAQvD;;;;;;CAMC,GACD,OAAO,MAAMC,oBAAuCC,CAAAA;IAClD,MAAM,CAACC,QAAQC,UAAU,GAAGN,MAAMO,QAAQ,CAAC;IAC3C,MAAMC,SAASN;IACf,MAAMO,kBAAkBR,MAAM,kBAAkBG,MAAMK,eAAe;IAErE,OAAOT,MAAMU,OAAO,CAAC;QACnB,MAAMC,cAAc;YAClBL,UAAUD,CAAAA,SAAU,CAACA;QACvB;QAEA,MAAMO,4BAA4B;YAChC,iBAAiBH;YACjBJ;YACAQ,SAASF;QACX;QAEA,MAAMG,qBAAqB;YACzBC,WAAWV,SAASW,YAAYR,OAAOS,MAAM;YAC7CC,IAAIT;QACN;QAEA,OAAO;YAAEG;YAA2BE;QAAmB;IACzD,GAAG;QAACT;QAAQI;QAAiBD,OAAOS,MAAM;KAAC;AAC7C,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceGroup.styles.ts"],"sourcesContent":["import { makeStyles } from '@fluentui/react-components';\n\nexport const useStyles = makeStyles({\n hidden: {\n display: 'none',\n },\n});\n"],"names":["makeStyles","useStyles","hidden","display"],"rangeMappings":";;;;;","mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AAExD,OAAO,MAAMC,YAAYD,WAAW;IAClCE,QAAQ;QACNC,SAAS;IACX;AACF,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceGroup.styles.ts"],"sourcesContent":["import { makeStyles } from '@fluentui/react-components';\n\nexport const useStyles = makeStyles({\n hidden: {\n display: 'none',\n },\n});\n"],"names":["makeStyles","useStyles","hidden","display"],"rangeMappings":";;;;;","mappings":"AAAA,SAASA,UAAU,QAAQ,6BAA6B;AAExD,OAAO,MAAMC,YAAYD,WAAW;IAClCE,QAAQ;QACNC,SAAS;IACX;AACF,GAAG"}
|
package/lib-commonjs/Citation.js
CHANGED