@fluentui-copilot/react-reference 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +42 -1
- package/CHANGELOG.md +13 -2
- package/dist/index.d.ts +41 -0
- package/lib/ReferenceListV2.js +1 -1
- package/lib/ReferenceListV2.js.map +1 -1
- package/lib/ReferenceOverflowButton.js +1 -1
- package/lib/ReferenceOverflowButton.js.map +1 -1
- package/lib/ReferenceV2.js +1 -1
- package/lib/ReferenceV2.js.map +1 -1
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js.map +1 -1
- package/lib/components/reference-v2/Reference/Reference.types.js.map +1 -1
- package/lib/components/reference-v2/Reference/useReference.js +11 -4
- package/lib/components/reference-v2/Reference/useReference.js.map +1 -1
- package/lib/components/reference-v2/Reference/useReferenceStyles.styles.js +1 -1
- package/lib/components/reference-v2/Reference/useReferenceStyles.styles.js.map +1 -1
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js.map +1 -1
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -1
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js +9 -7
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -1
- package/lib/hooks/useReferenceCitationPreview.js +6 -4
- package/lib/hooks/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/ReferenceListV2.js +1 -1
- package/lib-commonjs/ReferenceListV2.js.map +1 -1
- package/lib-commonjs/ReferenceOverflowButton.js +1 -1
- package/lib-commonjs/ReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/ReferenceV2.js +1 -1
- package/lib-commonjs/ReferenceV2.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReference.js +11 -5
- package/lib-commonjs/components/reference-v2/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.styles.js +6 -6
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.styles.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -1
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js +9 -7
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/hooks/useReferenceCitationPreview.js +6 -4
- package/lib-commonjs/hooks/useReferenceCitationPreview.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,48 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 13 Jun 2024 21:00:14 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-reference_v0.11.4",
|
|
7
|
+
"version": "0.11.4",
|
|
8
|
+
"comments": {
|
|
9
|
+
"none": [
|
|
10
|
+
{
|
|
11
|
+
"author": "estebanmu@microsoft.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-reference",
|
|
13
|
+
"commit": "f17f78e440c2dc6b0cd7ac5ac998ccf7f5c475d0",
|
|
14
|
+
"comment": "chore: Disable typecheck for ssr-tests."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "humbertomakotomorimoto@gmail.com",
|
|
18
|
+
"package": "@fluentui-copilot/react-reference",
|
|
19
|
+
"commit": "17abeb1551c78c1c6cabce04f8482172a4b1b667",
|
|
20
|
+
"comment": "chore: Path cleanup on exports and docs."
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"patch": [
|
|
24
|
+
{
|
|
25
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
26
|
+
"package": "@fluentui-copilot/react-reference",
|
|
27
|
+
"commit": "74388025459a4141f03e1053e377509df397f4b0",
|
|
28
|
+
"comment": "fix: Fixing Reference anchor behavior and improving reference-v2 docs."
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"author": "humbertomakotomorimoto@gmail.com",
|
|
32
|
+
"package": "@fluentui-copilot/react-reference",
|
|
33
|
+
"commit": "eff11b64e31fb776ddf9d7941da7c7bcd7bea170",
|
|
34
|
+
"comment": "chore: Allow PreviewHeader props to be modified in useReferenceCitationPreview hooks."
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
38
|
+
"package": "@fluentui-copilot/react-reference",
|
|
39
|
+
"commit": "c8d54cf5a0b9f000a1b90fd647c4559d76153f32",
|
|
40
|
+
"comment": "fix: Fixing PreviewHeader styles, taking previewSurfaceProps.children into account in hook, and improving docs."
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"date": "Fri, 31 May 2024 18:42:53 GMT",
|
|
6
47
|
"tag": "@fluentui-copilot/react-reference_v0.11.3",
|
|
7
48
|
"version": "0.11.3",
|
|
8
49
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-reference
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 13 Jun 2024 21:00:14 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.11.4](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.11.4)
|
|
8
|
+
|
|
9
|
+
Thu, 13 Jun 2024 21:00:14 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.11.3..@fluentui-copilot/react-reference_v0.11.4)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix: Fixing Reference anchor behavior and improving reference-v2 docs. ([PR #1698](https://github.com/microsoft/fluentai/pull/1698) by Humberto.Morimoto@microsoft.com)
|
|
15
|
+
- chore: Allow PreviewHeader props to be modified in useReferenceCitationPreview hooks. ([PR #1727](https://github.com/microsoft/fluentai/pull/1727) by humbertomakotomorimoto@gmail.com)
|
|
16
|
+
- fix: Fixing PreviewHeader styles, taking previewSurfaceProps.children into account in hook, and improving docs. ([PR #1702](https://github.com/microsoft/fluentai/pull/1702) by Humberto.Morimoto@microsoft.com)
|
|
17
|
+
|
|
7
18
|
## [0.11.3](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.11.3)
|
|
8
19
|
|
|
9
|
-
Fri, 31 May 2024 18:42:
|
|
20
|
+
Fri, 31 May 2024 18:42:53 GMT
|
|
10
21
|
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.11.2..@fluentui-copilot/react-reference_v0.11.3)
|
|
11
22
|
|
|
12
23
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -88,6 +88,31 @@ export declare type PackagedReferenceV2 = React_2.FC<ReferenceV2Props>;
|
|
|
88
88
|
|
|
89
89
|
declare type PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* PreviewHeader Props
|
|
93
|
+
*/
|
|
94
|
+
declare type PreviewHeaderProps = ComponentProps<Partial<PreviewHeaderSlots>>;
|
|
95
|
+
|
|
96
|
+
declare type PreviewHeaderSlots = {
|
|
97
|
+
root: NonNullable<Slot<'div'>>;
|
|
98
|
+
/**
|
|
99
|
+
* Actions slot.
|
|
100
|
+
*/
|
|
101
|
+
actions: Slot<'div'>;
|
|
102
|
+
/**
|
|
103
|
+
* Citation slot. Displays a `Citation`. Set to `null` to hide the citation.
|
|
104
|
+
*/
|
|
105
|
+
citation: Slot<'span'>;
|
|
106
|
+
/**
|
|
107
|
+
* Label slot. Primary description of the preview.
|
|
108
|
+
*/
|
|
109
|
+
label: NonNullable<Slot<'span'>>;
|
|
110
|
+
/**
|
|
111
|
+
* Media slot. Used to display Avatars, Icons, etc.
|
|
112
|
+
*/
|
|
113
|
+
media: Slot<'div'>;
|
|
114
|
+
};
|
|
115
|
+
|
|
91
116
|
/**
|
|
92
117
|
* PreviewMetadata Props
|
|
93
118
|
*/
|
|
@@ -139,6 +164,7 @@ export declare type ReferenceCitationData = {
|
|
|
139
164
|
citationId?: string;
|
|
140
165
|
citationProps?: PackagedCitationProps;
|
|
141
166
|
referenceProps?: PackagedReferenceProps;
|
|
167
|
+
previewHeaderProps?: PreviewHeaderProps;
|
|
142
168
|
previewProps?: PreviewProps;
|
|
143
169
|
previewSurfaceProps?: PreviewSurfaceProps;
|
|
144
170
|
sensitivityLabelProps?: SensitivityLabelProps;
|
|
@@ -216,8 +242,11 @@ export declare type ReferenceListV2Props = ComponentProps<ReferenceListV2Slots>
|
|
|
216
242
|
};
|
|
217
243
|
|
|
218
244
|
export declare type ReferenceListV2Slots = {
|
|
245
|
+
/** The root of the component that contains the list of references. */
|
|
219
246
|
root: NonNullable<Slot<'div'>>;
|
|
247
|
+
/** A space containing a button that expands the list of references. This slot is only rendered when the list of references is collapsed. */
|
|
220
248
|
showMoreButton?: Slot<'span'>;
|
|
249
|
+
/** A space containing a button that collapses the list of references. This slot is only rendered when the list of references is expanded. */
|
|
221
250
|
showLessButton?: Slot<'span'>;
|
|
222
251
|
};
|
|
223
252
|
|
|
@@ -237,10 +266,16 @@ export declare const referenceOverflowButtonClassNames: SlotClassNames<Reference
|
|
|
237
266
|
* ReferenceOverflowButton Props
|
|
238
267
|
*/
|
|
239
268
|
export declare type ReferenceOverflowButtonProps = ComponentProps<ReferenceOverflowButtonSlots> & {
|
|
269
|
+
/**
|
|
270
|
+
* The text that is displayed inside of the overflow button. This text is only displayed when `children` has not been passed to the component.
|
|
271
|
+
* If a string is passed, that is what is rendered verbatim.
|
|
272
|
+
* If a callback is passed, the callback is called with the number of items that are overflowing, and the result of the callback is rendered.
|
|
273
|
+
*/
|
|
240
274
|
text?: string | ((overflowCount: number) => React.ReactNode);
|
|
241
275
|
};
|
|
242
276
|
|
|
243
277
|
export declare type ReferenceOverflowButtonSlots = {
|
|
278
|
+
/** The root of the component that renders the overflow button. */
|
|
244
279
|
root: Slot<'button'>;
|
|
245
280
|
};
|
|
246
281
|
|
|
@@ -353,10 +388,15 @@ export declare const referenceV2ExtraClassNames: {
|
|
|
353
388
|
export declare type ReferenceV2Props = ComponentProps<Partial<ReferenceV2Slots>> & {};
|
|
354
389
|
|
|
355
390
|
export declare type ReferenceV2Slots = {
|
|
391
|
+
/** The root of the component that renders the reference as either a button or an anchor element. */
|
|
356
392
|
root: NonNullable<Slot<'button', 'a'>>;
|
|
393
|
+
/** The number of the citation this reference corresponds to. */
|
|
357
394
|
citation?: Slot<'span'>;
|
|
395
|
+
/** A divider that visually separates the citation from the content of the reference. */
|
|
358
396
|
divider?: Slot<'span'>;
|
|
397
|
+
/** A space containing the content of the reference, which goes into an ellipsis if it overflows. */
|
|
359
398
|
content?: Slot<'span'>;
|
|
399
|
+
/** A space within the content slot where a graphic such as an icon or an image can be displayed before the rest of the content. */
|
|
360
400
|
graphic?: Slot<'span'>;
|
|
361
401
|
};
|
|
362
402
|
|
|
@@ -478,6 +518,7 @@ export declare type UseReferenceCitationPreviewV2Props = {
|
|
|
478
518
|
citationProps?: CitationProps;
|
|
479
519
|
index: number;
|
|
480
520
|
previewContentProps?: PackagedPreviewContentV2Props;
|
|
521
|
+
previewHeaderProps?: PreviewHeaderProps;
|
|
481
522
|
referencePreviewProps?: PreviewProps;
|
|
482
523
|
referencePreviewSurfaceProps?: PreviewSurfaceProps;
|
|
483
524
|
referenceProps?: ReferenceV2Props;
|
package/lib/ReferenceListV2.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/reference-v2/ReferenceList';
|
|
1
|
+
export * from './components/reference-v2/ReferenceList/index';
|
|
2
2
|
//# sourceMappingURL=ReferenceListV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceListV2.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceList';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["ReferenceListV2.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceList/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,gDAAgD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/reference-v2/ReferenceOverflowButton';
|
|
1
|
+
export * from './components/reference-v2/ReferenceOverflowButton/index';
|
|
2
2
|
//# sourceMappingURL=ReferenceOverflowButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceOverflowButton.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceOverflowButton';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceOverflowButton/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,0DAA0D"}
|
package/lib/ReferenceV2.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/reference-v2/Reference';
|
|
1
|
+
export * from './components/reference-v2/Reference/index';
|
|
2
2
|
//# sourceMappingURL=ReferenceV2.js.map
|
package/lib/ReferenceV2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceV2.ts"],"sourcesContent":["export * from './components/reference-v2/Reference';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"sources":["ReferenceV2.ts"],"sourcesContent":["export * from './components/reference-v2/Reference/index';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,4CAA4C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceGroupToggle.types.ts"],"sourcesContent":["import { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceGroupToggleSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n};\n\n/**\n * ReferenceGroupToggle Props\n */\nexport type ReferenceGroupToggleProps = ComponentProps<ReferenceGroupToggleSlots> &\n CopilotMode & {\n isOpen?: boolean;\n };\n\n/**\n * State used in rendering ReferenceGroupToggle\n */\nexport type ReferenceGroupToggleState = ComponentState<ReferenceGroupToggleSlots> &\n Required<Pick<ReferenceGroupToggleProps, 'isOpen' | 'mode'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAgBA;;CAEC,GACD,WAC+D"}
|
|
1
|
+
{"version":3,"sources":["ReferenceGroupToggle.types.ts"],"sourcesContent":["import type { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceGroupToggleSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n};\n\n/**\n * ReferenceGroupToggle Props\n */\nexport type ReferenceGroupToggleProps = ComponentProps<ReferenceGroupToggleSlots> &\n CopilotMode & {\n isOpen?: boolean;\n };\n\n/**\n * State used in rendering ReferenceGroupToggle\n */\nexport type ReferenceGroupToggleState = ComponentState<ReferenceGroupToggleSlots> &\n Required<Pick<ReferenceGroupToggleProps, 'isOpen' | 'mode'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAgBA;;CAEC,GACD,WAC+D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button', 'a'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":"
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n /** The root of the component that renders the reference as either a button or an anchor element. */\n root: NonNullable<Slot<'button', 'a'>>;\n\n /** The number of the citation this reference corresponds to. */\n citation?: Slot<'span'>;\n\n /** A divider that visually separates the citation from the content of the reference. */\n divider?: Slot<'span'>;\n\n /** A space containing the content of the reference, which goes into an ellipsis if it overflows. */\n content?: Slot<'span'>;\n\n /** A space within the content slot where a graphic such as an icon or an image can be displayed before the rest of the content. */\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":"AAsBA,WAEgD"}
|
|
@@ -13,11 +13,19 @@ import { referenceExtraClassNames } from './useReferenceStyles.styles';
|
|
|
13
13
|
*/
|
|
14
14
|
export const useReference_unstable = (props, ref) => {
|
|
15
15
|
const {
|
|
16
|
+
as,
|
|
16
17
|
children,
|
|
17
18
|
id
|
|
18
19
|
} = props;
|
|
19
20
|
const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);
|
|
20
21
|
const referenceId = useId('reference-', id);
|
|
22
|
+
const elementType = as || (props.href ? 'a' : 'button');
|
|
23
|
+
const propsWithAssignedAs = {
|
|
24
|
+
type: elementType === 'button' ? 'button' : undefined,
|
|
25
|
+
...props,
|
|
26
|
+
as: elementType,
|
|
27
|
+
id: referenceId
|
|
28
|
+
};
|
|
21
29
|
const citation = slot.optional(props.citation, {
|
|
22
30
|
elementType: 'span'
|
|
23
31
|
});
|
|
@@ -42,12 +50,11 @@ export const useReference_unstable = (props, ref) => {
|
|
|
42
50
|
graphic: 'span',
|
|
43
51
|
content: 'span'
|
|
44
52
|
},
|
|
45
|
-
root: slot.always(getIntrinsicElementProps(
|
|
53
|
+
root: slot.always(getIntrinsicElementProps(elementType, {
|
|
46
54
|
ref,
|
|
47
|
-
...
|
|
48
|
-
id: referenceId
|
|
55
|
+
...propsWithAssignedAs
|
|
49
56
|
}), {
|
|
50
|
-
elementType
|
|
57
|
+
elementType
|
|
51
58
|
}),
|
|
52
59
|
citation,
|
|
53
60
|
divider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { children, id } = props;\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(
|
|
1
|
+
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { as, children, id } = props;\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const elementType = as || ((props as JSX.IntrinsicElements['a']).href ? 'a' : 'button');\n const propsWithAssignedAs = {\n type: elementType === 'button' ? 'button' : undefined,\n ...props,\n as: elementType,\n id: referenceId,\n } as ReferenceProps;\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n ...propsWithAssignedAs,\n }),\n { elementType },\n ),\n citation,\n divider,\n content,\n graphic,\n };\n\n if (state.graphic && React.isValidElement<HTMLElement>(state.graphic.children)) {\n state.graphic.children = React.cloneElement(state.graphic.children, {\n className: mergeClasses(state.graphic.children.props.className, referenceExtraClassNames.graphicChild),\n });\n }\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeClasses","slot","useId","useReferenceListContext_unstable","referenceExtraClassNames","useReference_unstable","props","ref","as","children","id","shouldUseOverflow","ctx","referenceId","elementType","href","propsWithAssignedAs","type","undefined","citation","optional","graphic","content","renderByDefault","divider","state","components","root","always","isValidElement","cloneElement","className","graphicChild"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,IAAI,EAAEC,KAAK,QAAQ,6BAA6B;AACjG,SAASC,gCAAgC,QAAQ,sDAAsD;AACvG,SAASC,wBAAwB,QAAQ,8BAA8B;AAGvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CACnCC,OACAC;IAEA,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,EAAE,EAAE,GAAGJ;IAE7B,MAAMK,oBAAoBR,iCAAiCS,CAAAA,MAAOA,IAAID,iBAAiB;IAEvF,MAAME,cAAcX,MAAM,cAAcQ;IAExC,MAAMI,cAAcN,MAAO,CAAA,AAACF,MAAqCS,IAAI,GAAG,MAAM,QAAO;IACrF,MAAMC,sBAAsB;QAC1BC,MAAMH,gBAAgB,WAAW,WAAWI;QAC5C,GAAGZ,KAAK;QACRE,IAAIM;QACJJ,IAAIG;IACN;IAEA,MAAMM,WAAWlB,KAAKmB,QAAQ,CAACd,MAAMa,QAAQ,EAAE;QAAEL,aAAa;IAAO;IACrE,MAAMO,UAAUpB,KAAKmB,QAAQ,CAACd,MAAMe,OAAO,EAAE;QAAEP,aAAa;IAAO;IACnE,MAAMQ,UAAUrB,KAAKmB,QAAQ,CAACd,MAAMgB,OAAO,EAAE;QAC3CR,aAAa;QACbS,iBAAiBF,YAAYH,aAAa,CAAC,CAACT;IAC9C;IACA,MAAMe,UAAUvB,KAAKmB,QAAQ,CAACd,MAAMkB,OAAO,EAAE;QAC3CV,aAAa;QACbS,iBAAiBJ,aAAaD,aAAaI,YAAYJ;IACzD;IAEA,MAAMO,QAAwB;QAC5Bf,IAAIG;QACJF;QAEAe,YAAY;YACVC,MAAM;YACNR,UAAU;YACVK,SAAS;YACTH,SAAS;YACTC,SAAS;QACX;QAEAK,MAAM1B,KAAK2B,MAAM,CACf7B,yBAAyBe,aAAa;YACpCP;YACA,GAAGS,mBAAmB;QACxB,IACA;YAAEF;QAAY;QAEhBK;QACAK;QACAF;QACAD;IACF;IAEA,IAAII,MAAMJ,OAAO,IAAIvB,MAAM+B,cAAc,CAAcJ,MAAMJ,OAAO,CAACZ,QAAQ,GAAG;QAC9EgB,MAAMJ,OAAO,CAACZ,QAAQ,GAAGX,MAAMgC,YAAY,CAACL,MAAMJ,OAAO,CAACZ,QAAQ,EAAE;YAClEsB,WAAW/B,aAAayB,MAAMJ,OAAO,CAACZ,QAAQ,CAACH,KAAK,CAACyB,SAAS,EAAE3B,yBAAyB4B,YAAY;QACvG;IACF;IAEA,OAAOP;AACT,EAAE"}
|
|
@@ -10,7 +10,7 @@ export const referenceExtraClassNames = {
|
|
|
10
10
|
graphicChild: 'fai-Reference__graphicChild'
|
|
11
11
|
};
|
|
12
12
|
const GRAPHIC_SIZE = '16px';
|
|
13
|
-
const useRootBaseClassName = __resetStyles("
|
|
13
|
+
const useRootBaseClassName = __resetStyles("rtvjomn", null, [".rtvjomn{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;max-width:max-content;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);text-decoration:none;}", ".rtvjomn:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}", ".rtvjomn:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}", ".rtvjomn:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}", ".rtvjomn:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}"]);
|
|
14
14
|
export const useRootStyles = __styles({
|
|
15
15
|
overflow: {
|
|
16
16
|
a9b677: "fly5x3f"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n graphic: 'fai-Reference__graphic',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n graphicChild: 'fai-Reference__graphicChild',\n};\n\nconst GRAPHIC_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n fontSize: GRAPHIC_SIZE,\n height: GRAPHIC_SIZE,\n lineHeight: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n\n [`> .${referenceExtraClassNames.graphicChild}`]: {\n height: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, state.divider.className);\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","referenceClassNames","root","citation","divider","graphic","content","referenceExtraClassNames","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","alignItems","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","boxSizing","color","colorNeutralForeground2","columnGap","spacingHorizontalXXS","display","flexShrink","justifyContent","padding","spacingVerticalXXS","spacingHorizontalS","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useRootStyles","overflow","width","useCitationBaseClassName","caption2Strong","useDividerBaseClassName","height","margin","spacingVerticalNone","spacingHorizontalXS","useGraphicBaseClassName","fontSize","lineHeight","useContentBaseClassName","spacingHorizontalSNudge","caption1","useReferenceStyles_unstable","state","rootBaseClassName","citationBaseClassName","dividerBaseClassName","contentBaseClassName","graphicBaseClassName","className"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n graphic: 'fai-Reference__graphic',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n graphicChild: 'fai-Reference__graphicChild',\n};\n\nconst GRAPHIC_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n maxWidth: 'max-content',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n textDecoration: 'none',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n fontSize: GRAPHIC_SIZE,\n height: GRAPHIC_SIZE,\n lineHeight: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n\n [`> .${referenceExtraClassNames.graphicChild}`]: {\n height: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, state.divider.className);\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","referenceClassNames","root","citation","divider","graphic","content","referenceExtraClassNames","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","alignItems","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","boxSizing","color","colorNeutralForeground2","columnGap","spacingHorizontalXXS","display","flexShrink","justifyContent","maxWidth","padding","spacingVerticalXXS","spacingHorizontalS","textDecoration","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useRootStyles","overflow","width","useCitationBaseClassName","caption2Strong","useDividerBaseClassName","height","margin","spacingVerticalNone","spacingHorizontalXS","useGraphicBaseClassName","fontSize","lineHeight","useContentBaseClassName","spacingHorizontalSNudge","caption1","useReferenceStyles_unstable","state","rootBaseClassName","citationBaseClassName","dividerBaseClassName","contentBaseClassName","graphicBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BG,OAAO,EAAEuD,sBAAsBH,MAAMpD,OAAO,CAAC0D,SAAS;IACnH;IAEA,IAAIN,MAAMlD,OAAO,EAAE;QACjBkD,MAAMlD,OAAO,CAACwD,SAAS,GAAGhE,aAAaG,oBAAoBK,OAAO,EAAEsD,sBAAsBJ,MAAMlD,OAAO,CAACwD,SAAS;IACnH;IAEA,IAAIN,MAAMnD,OAAO,EAAE;QACjBmD,MAAMnD,OAAO,CAACyD,SAAS,GAAGhE,aAAaG,oBAAoBI,OAAO,EAAEwD,sBAAsBL,MAAMnD,OAAO,CAACyD,SAAS;IACnH;IAEA,OAAON;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../../contexts/reference-v2/referenceListContext';\n\nexport type ReferenceListSlots = {\n root: NonNullable<Slot<'div'>>;\n showMoreButton?: Slot<'span'>;\n showLessButton?: Slot<'span'>;\n};\n\nexport type ReferenceListProps = ComponentProps<ReferenceListSlots> & {\n /**\n * The maximum number of references to display before the overflow button is shown even if there is\n * enough space available to show more.\n * If not set, the overflow functionality will be disabled.\n * @default undefined\n */\n maxVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences'> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n referenceListRef: React.RefObject<HTMLDivElement>;\n shouldUseOverflow: boolean;\n totalReferencesCount: number;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":"
|
|
1
|
+
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../../contexts/reference-v2/referenceListContext';\n\nexport type ReferenceListSlots = {\n /** The root of the component that contains the list of references. */\n root: NonNullable<Slot<'div'>>;\n\n /** A space containing a button that expands the list of references. This slot is only rendered when the list of references is collapsed. */\n showMoreButton?: Slot<'span'>;\n\n /** A space containing a button that collapses the list of references. This slot is only rendered when the list of references is expanded. */\n showLessButton?: Slot<'span'>;\n};\n\nexport type ReferenceListProps = ComponentProps<ReferenceListSlots> & {\n /**\n * The maximum number of references to display before the overflow button is shown even if there is\n * enough space available to show more.\n * If not set, the overflow functionality will be disabled.\n * @default undefined\n */\n maxVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences'> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n referenceListRef: React.RefObject<HTMLDivElement>;\n shouldUseOverflow: boolean;\n totalReferencesCount: number;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":"AAiCA,WAEE"}
|
package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceOverflowButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceOverflowButtonSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * ReferenceOverflowButton Props\n */\nexport type ReferenceOverflowButtonProps = ComponentProps<ReferenceOverflowButtonSlots> & {\n text?: string | ((overflowCount: number) => React.ReactNode);\n};\n\n/**\n * State used in rendering ReferenceOverflowButton\n */\nexport type ReferenceOverflowButtonState = ComponentState<ReferenceOverflowButtonSlots> & {\n shouldRenderOverflowButton: boolean;\n};\n"],"names":[],"rangeMappings":";;","mappings":"
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceOverflowButtonSlots = {\n /** The root of the component that renders the overflow button. */\n root: Slot<'button'>;\n};\n\n/**\n * ReferenceOverflowButton Props\n */\nexport type ReferenceOverflowButtonProps = ComponentProps<ReferenceOverflowButtonSlots> & {\n /**\n * The text that is displayed inside of the overflow button. This text is only displayed when `children` has not been passed to the component.\n * If a string is passed, that is what is rendered verbatim.\n * If a callback is passed, the callback is called with the number of items that are overflowing, and the result of the callback is rendered.\n */\n text?: string | ((overflowCount: number) => React.ReactNode);\n};\n\n/**\n * State used in rendering ReferenceOverflowButton\n */\nexport type ReferenceOverflowButtonState = ComponentState<ReferenceOverflowButtonSlots> & {\n shouldRenderOverflowButton: boolean;\n};\n"],"names":[],"rangeMappings":";;","mappings":"AAmBA;;CAEC,GACD,WAEE"}
|
|
@@ -26,13 +26,14 @@ export const useReferenceCitationPreview = props => {
|
|
|
26
26
|
citationProps,
|
|
27
27
|
index,
|
|
28
28
|
previewContentProps,
|
|
29
|
+
previewHeaderProps,
|
|
29
30
|
referencePreviewProps,
|
|
30
31
|
referencePreviewSurfaceProps,
|
|
31
32
|
referenceProps,
|
|
32
33
|
sensitivityLabelProps
|
|
33
34
|
} = props;
|
|
34
35
|
const components = React.useMemo(() => {
|
|
35
|
-
const
|
|
36
|
+
const CitationWithPreview = props => {
|
|
36
37
|
var _previewContentProps_content;
|
|
37
38
|
return /*#__PURE__*/_jsxs(Preview, {
|
|
38
39
|
closeOnScroll: true,
|
|
@@ -71,13 +72,13 @@ export const useReferenceCitationPreview = props => {
|
|
|
71
72
|
})]
|
|
72
73
|
});
|
|
73
74
|
};
|
|
74
|
-
const
|
|
75
|
+
const ReferenceWithPreview = props => {
|
|
75
76
|
const mergedReferenceProps = {
|
|
76
77
|
citation: index,
|
|
77
78
|
...referenceProps,
|
|
78
79
|
...props
|
|
79
80
|
};
|
|
80
|
-
var _previewContentProps_content;
|
|
81
|
+
var _previewHeaderProps_children, _previewContentProps_content;
|
|
81
82
|
return /*#__PURE__*/_jsxs(Preview, {
|
|
82
83
|
closeOnScroll: true,
|
|
83
84
|
positioning: "below",
|
|
@@ -100,7 +101,8 @@ export const useReferenceCitationPreview = props => {
|
|
|
100
101
|
children: index
|
|
101
102
|
}),
|
|
102
103
|
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
103
|
-
|
|
104
|
+
...previewHeaderProps,
|
|
105
|
+
children: (_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
|
|
104
106
|
}), /*#__PURE__*/_jsx(PreviewMetadata, {
|
|
105
107
|
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
106
108
|
primaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.primaryText,
|
|
@@ -114,10 +116,10 @@ export const useReferenceCitationPreview = props => {
|
|
|
114
116
|
});
|
|
115
117
|
};
|
|
116
118
|
return {
|
|
117
|
-
Citation:
|
|
118
|
-
Reference:
|
|
119
|
+
Citation: CitationWithPreview,
|
|
120
|
+
Reference: ReferenceWithPreview
|
|
119
121
|
};
|
|
120
|
-
}, [citationPreviewProps, citationPreviewSurfaceProps, citationProps, index, referencePreviewProps, referencePreviewSurfaceProps, referenceProps, previewContentProps, sensitivityLabelProps]);
|
|
122
|
+
}, [citationPreviewProps, citationPreviewSurfaceProps, citationProps, index, previewHeaderProps, referencePreviewProps, referencePreviewSurfaceProps, referenceProps, previewContentProps, sensitivityLabelProps]);
|
|
121
123
|
return components;
|
|
122
124
|
};
|
|
123
125
|
//# sourceMappingURL=useReferenceCitationPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const citationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const referenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: citationWithPreview,\n Reference: referenceWithPreview,\n };\n }, [\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n previewContentProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","mergeCallbacks","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","components","useMemo","citationWithPreview","closeOnScroll","positioning","size","trapFocus","withArrow","citation","aria-label","referenceHref","tabIndex","media","graphic","children","icon","primaryText","secondaryText","tertiaryText","content","referenceWithPreview","mergedReferenceProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAE/B,SAASC,cAAc,EAAEC,0BAA0B,QAAQ,6BAA6B;AAExF,SACEC,OAAO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AA,0CAAAA,oBAAqBqB,WAAW;oCAC7CC,aAAa,EAAEtB,gCAAAA,0CAAAA,oBAAqBsB,aAAa;oCACjDC,YAAY,EAAEvB,gCAAAA,0CAAAA,oBAAqBuB,YAAY;;gCAEhDnB,uCAAyB,KAACxB;oCAAkB,GAAGwB,qBAAqB;;gCACpEJ,CAAAA,+BAAAA,gCAAAA,0CAAAA,oBAAqBwB,OAAO,cAA5BxB,0CAAAA,+BAAgCC,kCAAAA,4CAAAA,sBAAuBkB,QAAQ;;;;;;QAK1E;QAEA,OAAO;YACLtC,UAAU0B;YACVzB,WAAW2C;QACb;IACF,GAAG;QACD7B;QACAC;QACAC;QACAC;QACAE;QACAC;QACAC;QACAH;QACAI;KACD;IAED,OAAOC;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n previewHeaderProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const ReferenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n {...previewHeaderProps}\n >\n {previewHeaderProps?.children ?? referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\n };\n }, [\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewHeaderProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n previewContentProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","mergeCallbacks","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","previewHeaderProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","components","useMemo","CitationWithPreview","closeOnScroll","positioning","size","trapFocus","withArrow","citation","aria-label","referenceHref","tabIndex","media","graphic","children","icon","primaryText","secondaryText","tertiaryText","content","ReferenceWithPreview","mergedReferenceProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAE/B,SAASC,cAAc,EAAEC,0BAA0B,QAAQ,6BAA6B;AAExF,SACEC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,cAAc,QACT,kCAAkC;AACzC,SAASC,gBAAgB,QAAQ,4CAA4C;AAS7E,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAiC9C,6IAA6I;AAC7I,MAAMC,sBAAsB,CAACC;IAC3B,MAAMC,iBAAiBZ,2BAA2Ba,CAAAA,UAAWA,QAAQC,OAAO;IAE5E,MAAMC,sBAAsBjB,MAAMkB,WAAW,CAC3CC,CAAAA;QACEL,eAAeK,IAAI;QAEnB,iBAAiB;QACjBA,GAAGC,cAAc;IACnB,GACA;QAACN;KAAe;IAGlB,MAAMO,6BAA6BpB,eAAegB,qBAAqBJ,yBAAyBS,OAAO;IAEvG,qBAAO,KAACZ;QAAU,GAAG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QACAC;QACAC;QACAC;QACAE;QACAC;QACAC;QACAC;QACAJ;QACAK;KACD;IAED,OAAOC;AACT,EAAE"}
|
|
@@ -32,6 +32,7 @@ export const useReferenceCitationPreview = ({
|
|
|
32
32
|
citationId: propsCiteId,
|
|
33
33
|
citationProps,
|
|
34
34
|
referenceProps,
|
|
35
|
+
previewHeaderProps,
|
|
35
36
|
previewProps,
|
|
36
37
|
previewSurfaceProps,
|
|
37
38
|
sensitivityLabelProps
|
|
@@ -77,7 +78,7 @@ export const useReferenceCitationPreview = ({
|
|
|
77
78
|
const title = slot.optional(referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.label, {
|
|
78
79
|
elementType: 'div'
|
|
79
80
|
});
|
|
80
|
-
var _sensitivityLabelProps_description;
|
|
81
|
+
var _previewHeaderProps_children, _sensitivityLabelProps_description, _previewSurfaceProps_children;
|
|
81
82
|
return /*#__PURE__*/_jsxs(Preview, {
|
|
82
83
|
closeOnScroll: true,
|
|
83
84
|
positioning: "below",
|
|
@@ -103,7 +104,8 @@ export const useReferenceCitationPreview = ({
|
|
|
103
104
|
children: index
|
|
104
105
|
}),
|
|
105
106
|
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.media,
|
|
106
|
-
|
|
107
|
+
...previewHeaderProps,
|
|
108
|
+
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
|
|
107
109
|
}), /*#__PURE__*/_jsx(PreviewMetadata, {
|
|
108
110
|
icon: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.icon,
|
|
109
111
|
primaryText: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.primaryText,
|
|
@@ -112,7 +114,7 @@ export const useReferenceCitationPreview = ({
|
|
|
112
114
|
}), sensitivity && /*#__PURE__*/_jsx(SensitivityLabel, {
|
|
113
115
|
description: (_sensitivityLabelProps_description = sensitivityLabelProps === null || sensitivityLabelProps === void 0 ? void 0 : sensitivityLabelProps.description) !== null && _sensitivityLabelProps_description !== void 0 ? _sensitivityLabelProps_description : '',
|
|
114
116
|
children: sensitivity.children
|
|
115
|
-
}), /*#__PURE__*/_jsx(citationWithPreviewState.content, {}), previewProps === null || previewProps === void 0 ? void 0 : previewProps.children]
|
|
117
|
+
}), /*#__PURE__*/_jsx(citationWithPreviewState.content, {}), (_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
118
|
})
|
|
117
119
|
})]
|
|
118
120
|
});
|
|
@@ -121,7 +123,7 @@ export const useReferenceCitationPreview = ({
|
|
|
121
123
|
Citation: CitationWithPreview,
|
|
122
124
|
Reference: PackagedReference
|
|
123
125
|
};
|
|
124
|
-
}, [index, referenceId, citationId, referenceProps, citationProps, previewProps, previewSurfaceProps, sensitivityLabelProps]);
|
|
126
|
+
}, [index, referenceId, citationId, referenceProps, citationProps, previewHeaderProps, previewProps, previewSurfaceProps, sensitivityLabelProps]);
|
|
125
127
|
return components;
|
|
126
128
|
};
|
|
127
129
|
//# sourceMappingURL=useReferenceCitationPreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport {\n Caption1,\n assertSlots,\n mergeCallbacks,\n slot,\n useId,\n usePopoverContext_unstable,\n} from '@fluentui/react-components';\nimport type { Slot } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type { PreviewProps, PreviewSurfaceProps } from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../Citation';\nimport { Reference } from '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\n\n/**\n * Props for a \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> &\n Partial<Pick<CitationProps, 'referenceHref'>>;\n\n/**\n * A \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitation = React.FC<PackagedCitationProps>;\n\ntype PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';\n\n/**\n * Props for a \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> &\n Partial<Pick<ReferenceProps, PartialReferenceProps>>;\n\n/**\n * A \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReference = React.FC<PackagedReferenceProps>;\n\n/**\n * Data used to package a `Citation` and `Reference` together with\n * the `useReferenceCitation` hook.\n */\nexport type ReferenceCitationData = {\n index: number;\n referenceId?: string;\n citationId?: string;\n citationProps?: PackagedCitationProps;\n referenceProps?: PackagedReferenceProps;\n previewProps?: PreviewProps;\n previewSurfaceProps?: PreviewSurfaceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (data: ReferenceCitationData) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\ntype PreviewExtraSlots = {\n content: Slot<'div'>;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\n/**\n * Hook to package a `Citation` and `Reference` together in an\n * accessibly by default manner.\n *\n * When using citations and references, prefer using them via this\n * hook to ensure props are wired up correctly.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = ({\n index,\n referenceId: propsRefId,\n citationId: propsCiteId,\n citationProps,\n referenceProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n}) => {\n const refId = useId();\n const citeId = useId();\n\n const referenceId = propsRefId ?? refId;\n const citationId = propsCiteId ?? citeId;\n\n const components = React.useMemo(() => {\n const citationHref = `#${citationId}`;\n\n const PackagedReference: PackagedReference = props => {\n const referenceIndex = props.index ?? referenceProps?.index ?? index;\n\n return (\n <Reference\n {...referenceProps}\n index={referenceIndex}\n referenceId={referenceId}\n citationHref={citationHref}\n {...props}\n />\n );\n };\n\n const CitationWithPreview: PackagedCitation = props => {\n // We assert content as a slot to use it with its resolved props object and the correct defaults below.\n const content = slot.always(referenceProps ? referenceProps.content : undefined, {\n defaultProps: {\n children: referenceProps?.excerpt && <Caption1>{referenceProps.excerpt}</Caption1>,\n },\n elementType: 'div',\n });\n const citationWithPreviewState = {\n components: {\n content: 'div',\n },\n content,\n };\n assertSlots<PreviewExtraSlots>(citationWithPreviewState);\n\n // We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.\n const sensitivity = slot.optional(referenceProps?.sensitivity, { elementType: 'span' });\n const title = slot.optional(referenceProps?.label, { elementType: 'div' });\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...previewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} id={citationId} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...previewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media}\n >\n {title?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={referenceProps?.icon}\n primaryText={referenceProps?.primaryText}\n secondaryText={referenceProps?.secondaryText}\n tertiaryText={referenceProps?.tertiaryText}\n />\n {sensitivity && (\n <SensitivityLabel description={sensitivityLabelProps?.description ?? ''}>\n {sensitivity.children}\n </SensitivityLabel>\n )}\n <citationWithPreviewState.content />\n {previewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: PackagedReference,\n };\n }, [\n index,\n referenceId,\n citationId,\n referenceProps,\n citationProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","Caption1","assertSlots","mergeCallbacks","slot","useId","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","index","referenceId","propsRefId","citationId","propsCiteId","citationProps","referenceProps","previewProps","previewSurfaceProps","sensitivityLabelProps","refId","citeId","components","useMemo","citationHref","PackagedReference","props","referenceIndex","CitationWithPreview","content","always","undefined","defaultProps","children","excerpt","elementType","citationWithPreviewState","sensitivity","optional","title","label","closeOnScroll","positioning","size","trapFocus","withArrow","id","citation","aria-label","referenceHref","tabIndex","media","icon","primaryText","secondaryText","tertiaryText","description"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EtC,MAAM,OAAO,CAAC;wCAAEuC,eAAc;wCAAIC,UAAU,CAAC;kDACxFxC;;oCAGLyC,KAAK,EAAEnC,2BAAAA,qCAAAA,eAAgBmC,KAAK;8CAE3BZ,kBAAAA,4BAAAA,MAAON,QAAQ;;8CAElB,KAACzC;oCACC4D,IAAI,EAAEpC,2BAAAA,qCAAAA,eAAgBoC,IAAI;oCAC1BC,WAAW,EAAErC,2BAAAA,qCAAAA,eAAgBqC,WAAW;oCACxCC,aAAa,EAAEtC,2BAAAA,qCAAAA,eAAgBsC,aAAa;oCAC5CC,YAAY,EAAEvC,2BAAAA,qCAAAA,eAAgBuC,YAAY;;gCAE3ClB,6BACC,KAAC1C;oCAAiB6D,aAAarC,CAAAA,qCAAAA,kCAAAA,4CAAAA,sBAAuBqC,WAAW,cAAlCrC,gDAAAA,qCAAsC;8CAClEkB,YAAYJ,QAAQ;;8CAGzB,KAACG,yBAAyBP,OAAO;gCAChCZ,yBAAAA,mCAAAA,aAAcgB,QAAQ;;;;;;QAKjC;QAEA,OAAO;YACLrC,UAAUgC;YACV/B,WAAW4B;QACb;IACF,GAAG;QACDf;QACAC;QACAE;QACAG;QACAD;QACAE;QACAC;QACAC;KACD;IAED,OAAOG;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport {\n Caption1,\n assertSlots,\n mergeCallbacks,\n slot,\n useId,\n usePopoverContext_unstable,\n} from '@fluentui/react-components';\nimport type { Slot } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type { PreviewHeaderProps, PreviewProps, PreviewSurfaceProps } from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../Citation';\nimport { Reference } from '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\n\n/**\n * Props for a \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> &\n Partial<Pick<CitationProps, 'referenceHref'>>;\n\n/**\n * A \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitation = React.FC<PackagedCitationProps>;\n\ntype PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';\n\n/**\n * Props for a \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> &\n Partial<Pick<ReferenceProps, PartialReferenceProps>>;\n\n/**\n * A \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReference = React.FC<PackagedReferenceProps>;\n\n/**\n * Data used to package a `Citation` and `Reference` together with\n * the `useReferenceCitation` hook.\n */\nexport type ReferenceCitationData = {\n index: number;\n referenceId?: string;\n citationId?: string;\n citationProps?: PackagedCitationProps;\n referenceProps?: PackagedReferenceProps;\n previewHeaderProps?: PreviewHeaderProps;\n previewProps?: PreviewProps;\n previewSurfaceProps?: PreviewSurfaceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (data: ReferenceCitationData) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\ntype PreviewExtraSlots = {\n content: Slot<'div'>;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\n/**\n * Hook to package a `Citation` and `Reference` together in an\n * accessibly by default manner.\n *\n * When using citations and references, prefer using them via this\n * hook to ensure props are wired up correctly.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = ({\n index,\n referenceId: propsRefId,\n citationId: propsCiteId,\n citationProps,\n referenceProps,\n previewHeaderProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n}) => {\n const refId = useId();\n const citeId = useId();\n\n const referenceId = propsRefId ?? refId;\n const citationId = propsCiteId ?? citeId;\n\n const components = React.useMemo(() => {\n const citationHref = `#${citationId}`;\n\n const PackagedReference: PackagedReference = props => {\n const referenceIndex = props.index ?? referenceProps?.index ?? index;\n\n return (\n <Reference\n {...referenceProps}\n index={referenceIndex}\n referenceId={referenceId}\n citationHref={citationHref}\n {...props}\n />\n );\n };\n\n const CitationWithPreview: PackagedCitation = props => {\n // We assert content as a slot to use it with its resolved props object and the correct defaults below.\n const content = slot.always(referenceProps ? referenceProps.content : undefined, {\n defaultProps: {\n children: referenceProps?.excerpt && <Caption1>{referenceProps.excerpt}</Caption1>,\n },\n elementType: 'div',\n });\n const citationWithPreviewState = {\n components: {\n content: 'div',\n },\n content,\n };\n assertSlots<PreviewExtraSlots>(citationWithPreviewState);\n\n // We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.\n const sensitivity = slot.optional(referenceProps?.sensitivity, { elementType: 'span' });\n const title = slot.optional(referenceProps?.label, { elementType: 'div' });\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...previewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} id={citationId} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...previewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media}\n {...previewHeaderProps}\n >\n {previewHeaderProps?.children ?? title?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={referenceProps?.icon}\n primaryText={referenceProps?.primaryText}\n secondaryText={referenceProps?.secondaryText}\n tertiaryText={referenceProps?.tertiaryText}\n />\n {sensitivity && (\n <SensitivityLabel description={sensitivityLabelProps?.description ?? ''}>\n {sensitivity.children}\n </SensitivityLabel>\n )}\n <citationWithPreviewState.content />\n {previewSurfaceProps?.children ?? previewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: PackagedReference,\n };\n }, [\n index,\n referenceId,\n citationId,\n referenceProps,\n citationProps,\n previewHeaderProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","Caption1","assertSlots","mergeCallbacks","slot","useId","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","index","referenceId","propsRefId","citationId","propsCiteId","citationProps","referenceProps","previewHeaderProps","previewProps","previewSurfaceProps","sensitivityLabelProps","refId","citeId","components","useMemo","citationHref","PackagedReference","props","referenceIndex","CitationWithPreview","content","always","undefined","defaultProps","children","excerpt","elementType","citationWithPreviewState","sensitivity","optional","title","label","closeOnScroll","positioning","size","trapFocus","withArrow","id","citation","aria-label","referenceHref","tabIndex","media","icon","primaryText","secondaryText","tertiaryText","description"],"rangeMappings":";;;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;kCACrC,cAAA,MAAC7B;;8CACC,KAACC;oCACCyD,wBACE,KAAClD;wCAAoBmD,cAAY,CAAC,UAAU,EAAEvC,MAAM,OAAO,CAAC;wCAAEwC,eAAc;wCAAIC,UAAU,CAAC;kDACxFzC;;oCAGL0C,KAAK,EAAEpC,2BAAAA,qCAAAA,eAAgBoC,KAAK;oCAC3B,GAAGnC,kBAAkB;8CAErBA,CAAAA,+BAAAA,+BAAAA,yCAAAA,mBAAoBiB,QAAQ,cAA5BjB,0CAAAA,+BAAgCuB,kBAAAA,4BAAAA,MAAON,QAAQ;;8CAElD,KAAC1C;oCACC6D,IAAI,EAAErC,2BAAAA,qCAAAA,eAAgBqC,IAAI;oCAC1BC,WAAW,EAAEtC,2BAAAA,qCAAAA,eAAgBsC,WAAW;oCACxCC,aAAa,EAAEvC,2BAAAA,qCAAAA,eAAgBuC,aAAa;oCAC5CC,YAAY,EAAExC,2BAAAA,qCAAAA,eAAgBwC,YAAY;;gCAE3ClB,6BACC,KAAC3C;oCAAiB8D,aAAarC,CAAAA,qCAAAA,kCAAAA,4CAAAA,sBAAuBqC,WAAW,cAAlCrC,gDAAAA,qCAAsC;8CAClEkB,YAAYJ,QAAQ;;8CAGzB,KAACG,yBAAyBP,OAAO;gCAChCX,CAAAA,gCAAAA,gCAAAA,0CAAAA,oBAAqBe,QAAQ,cAA7Bf,2CAAAA,gCAAiCD,yBAAAA,mCAAAA,aAAcgB,QAAQ;;;;;;QAKlE;QAEA,OAAO;YACLtC,UAAUiC;YACVhC,WAAW6B;QACb;IACF,GAAG;QACDhB;QACAC;QACAE;QACAG;QACAD;QACAE;QACAC;QACAC;QACAC;KACD;IAED,OAAOG;AACT,EAAE"}
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
-
_export_star._(require("./components/reference-v2/ReferenceList"), exports);
|
|
6
|
+
_export_star._(require("./components/reference-v2/ReferenceList/index"), exports);
|
|
7
7
|
//# sourceMappingURL=ReferenceListV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceListV2.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceList';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
1
|
+
{"version":3,"sources":["ReferenceListV2.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceList/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
-
_export_star._(require("./components/reference-v2/ReferenceOverflowButton"), exports);
|
|
6
|
+
_export_star._(require("./components/reference-v2/ReferenceOverflowButton/index"), exports);
|
|
7
7
|
//# sourceMappingURL=ReferenceOverflowButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceOverflowButton.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceOverflowButton';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.ts"],"sourcesContent":["export * from './components/reference-v2/ReferenceOverflowButton/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
-
_export_star._(require("./components/reference-v2/Reference"), exports);
|
|
6
|
+
_export_star._(require("./components/reference-v2/Reference/index"), exports);
|
|
7
7
|
//# sourceMappingURL=ReferenceV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceV2.ts"],"sourcesContent":["export * from './components/reference-v2/Reference';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
1
|
+
{"version":3,"sources":["ReferenceV2.ts"],"sourcesContent":["export * from './components/reference-v2/Reference/index';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceGroupToggle.types.ts"],"sourcesContent":["import { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceGroupToggleSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n};\n\n/**\n * ReferenceGroupToggle Props\n */\nexport type ReferenceGroupToggleProps = ComponentProps<ReferenceGroupToggleSlots> &\n CopilotMode & {\n isOpen?: boolean;\n };\n\n/**\n * State used in rendering ReferenceGroupToggle\n */\nexport type ReferenceGroupToggleState = ComponentState<ReferenceGroupToggleSlots> &\n Required<Pick<ReferenceGroupToggleProps, 'isOpen' | 'mode'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAgBA;;CAEC"}
|
|
1
|
+
{"version":3,"sources":["ReferenceGroupToggle.types.ts"],"sourcesContent":["import type { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceGroupToggleSlots = {\n root: NonNullable<Slot<'button'>>;\n icon?: Slot<'span'>;\n};\n\n/**\n * ReferenceGroupToggle Props\n */\nexport type ReferenceGroupToggleProps = ComponentProps<ReferenceGroupToggleSlots> &\n CopilotMode & {\n isOpen?: boolean;\n };\n\n/**\n * State used in rendering ReferenceGroupToggle\n */\nexport type ReferenceGroupToggleState = ComponentState<ReferenceGroupToggleSlots> &\n Required<Pick<ReferenceGroupToggleProps, 'isOpen' | 'mode'>>;\n"],"names":[],"rangeMappings":";;","mappings":"AAgBA;;CAEC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button', 'a'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n /** The root of the component that renders the reference as either a button or an anchor element. */\n root: NonNullable<Slot<'button', 'a'>>;\n\n /** The number of the citation this reference corresponds to. */\n citation?: Slot<'span'>;\n\n /** A divider that visually separates the citation from the content of the reference. */\n divider?: Slot<'span'>;\n\n /** A space containing the content of the reference, which goes into an ellipsis if it overflows. */\n content?: Slot<'span'>;\n\n /** A space within the content slot where a graphic such as an icon or an image can be displayed before the rest of the content. */\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -14,9 +14,16 @@ const _reactcomponents = require("@fluentui/react-components");
|
|
|
14
14
|
const _referenceListContext = require("../../../contexts/reference-v2/referenceListContext");
|
|
15
15
|
const _useReferenceStylesstyles = require("./useReferenceStyles.styles");
|
|
16
16
|
const useReference_unstable = (props, ref)=>{
|
|
17
|
-
const { children, id } = props;
|
|
17
|
+
const { as, children, id } = props;
|
|
18
18
|
const shouldUseOverflow = (0, _referenceListContext.useReferenceListContext_unstable)((ctx)=>ctx.shouldUseOverflow);
|
|
19
19
|
const referenceId = (0, _reactcomponents.useId)('reference-', id);
|
|
20
|
+
const elementType = as || (props.href ? 'a' : 'button');
|
|
21
|
+
const propsWithAssignedAs = {
|
|
22
|
+
type: elementType === 'button' ? 'button' : undefined,
|
|
23
|
+
...props,
|
|
24
|
+
as: elementType,
|
|
25
|
+
id: referenceId
|
|
26
|
+
};
|
|
20
27
|
const citation = _reactcomponents.slot.optional(props.citation, {
|
|
21
28
|
elementType: 'span'
|
|
22
29
|
});
|
|
@@ -41,12 +48,11 @@ const useReference_unstable = (props, ref)=>{
|
|
|
41
48
|
graphic: 'span',
|
|
42
49
|
content: 'span'
|
|
43
50
|
},
|
|
44
|
-
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)(
|
|
51
|
+
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)(elementType, {
|
|
45
52
|
ref,
|
|
46
|
-
...
|
|
47
|
-
id: referenceId
|
|
53
|
+
...propsWithAssignedAs
|
|
48
54
|
}), {
|
|
49
|
-
elementType
|
|
55
|
+
elementType
|
|
50
56
|
}),
|
|
51
57
|
citation,
|
|
52
58
|
divider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { children, id } = props;\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(
|
|
1
|
+
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { as, children, id } = props;\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const elementType = as || ((props as JSX.IntrinsicElements['a']).href ? 'a' : 'button');\n const propsWithAssignedAs = {\n type: elementType === 'button' ? 'button' : undefined,\n ...props,\n as: elementType,\n id: referenceId,\n } as ReferenceProps;\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(elementType, {\n ref,\n ...propsWithAssignedAs,\n }),\n { elementType },\n ),\n citation,\n divider,\n content,\n graphic,\n };\n\n if (state.graphic && React.isValidElement<HTMLElement>(state.graphic.children)) {\n state.graphic.children = React.cloneElement(state.graphic.children, {\n className: mergeClasses(state.graphic.children.props.className, referenceExtraClassNames.graphicChild),\n });\n }\n\n return state;\n};\n"],"names":["as","props","children","elementType","id","shouldUseOverflow","useReferenceListContext_unstable","ctx","referenceId","propsWithAssignedAs","type","citation","optional","slot","content","renderByDefault","graphic","undefined","ref","always","getIntrinsicElementProps","divider","state","React","cloneElement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBUA;;;eAAAA;;;;iEAnBa;iCAC6C;sCACnB;0CACR;AAgBvC,MAAQA,wBAAqBC,CAAAA,OAAAA;UAE7B,EAEAD,EAAA,EAEAE,QAAMC,EACNC,EAAA;UAEEC,oBAAQC,IAAAA,sDAAA,EAAAC,CAAAA,MAAAA,IAAAF,iBAAA;UACRL,cAAIG,IAAAA,sBAAAA,EAAAA,cAAAA;UACJC,cAAII,MAAAA,CAAAA,MAAAA,IAAAA,GAAAA,MAAAA,QAAAA;UACNC,sBAAA;QAEAC,MAAMC,gBAAgBC,WAASX,WAAMU;gBAAYR;QAAoBH,IAAAG;QACrEC,IAAAI;;UAAmEG,WAAAE,qBAAA,CAAAD,QAAA,CAAAX,MAAAU,QAAA,EAAA;QACnER,aAAMW;;UAEJC,UAAAA,qBAAAA,CAAAA,QAAiBC,CAAAA,MAAYC,OAAAA,EAAAA;QAC/Bd,aAAA;;UAEEA,UAAAA,qBAAa,CAAAS,QAAA,CAAAX,MAAAa,OAAA,EAAA;qBACbC;QACFA,iBAAAC,YAAAC,aAAA,CAAA,CAAAf;;UAGEE,UAAII,qBAAAA,CAAAA,QAAAA,CAAAA,MAAAA,OAAAA,EAAAA;qBACJH;yBAEYM,aAAAM,aAAAH,YAAAG;;kBAEVN;;;oBAGAG;kBACF;sBAEMD;qBAEFK;qBACGT;qBAEL;;cAAcI,qBAAA,CAAAM,MAAA,CAAAC,IAAAA,yCAAA,EAAAjB,aAAA;;eAGhBkB,mBAAAA;YACAP;;QAEF;QAEAH;;;;;QAMAW,MAAOA,OAAAA,kBAAAA,OAAAA,cAAAA,CAAAA,MAAAA,OAAAA,CAAAA,QAAAA,GAAAA;QACPA,MAAAN,OAAA,CAAAd,QAAA,iBAAAqB,OAAAC,YAAA,CAAAF,MAAAN,OAAA,CAAAd,QAAA,EAAA"}
|
|
@@ -34,12 +34,12 @@ const referenceExtraClassNames = {
|
|
|
34
34
|
graphicChild: 'fai-Reference__graphicChild'
|
|
35
35
|
};
|
|
36
36
|
const GRAPHIC_SIZE = '16px';
|
|
37
|
-
const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("
|
|
38
|
-
".
|
|
39
|
-
".
|
|
40
|
-
".
|
|
41
|
-
".
|
|
42
|
-
".
|
|
37
|
+
const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("rtvjomn", null, [
|
|
38
|
+
".rtvjomn{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;max-width:max-content;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);text-decoration:none;}",
|
|
39
|
+
".rtvjomn:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}",
|
|
40
|
+
".rtvjomn:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}",
|
|
41
|
+
".rtvjomn:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}",
|
|
42
|
+
".rtvjomn:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}"
|
|
43
43
|
]);
|
|
44
44
|
const useRootStyles = (0, _reactcomponents.__styles)({
|
|
45
45
|
overflow: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n graphic: 'fai-Reference__graphic',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n graphicChild: 'fai-Reference__graphicChild',\n};\n\nconst GRAPHIC_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n fontSize: GRAPHIC_SIZE,\n height: GRAPHIC_SIZE,\n lineHeight: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n\n [`> .${referenceExtraClassNames.graphicChild}`]: {\n height: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, state.divider.className);\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["referenceClassNames","referenceExtraClassNames","
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, tokens, typographyStyles } from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n graphic: 'fai-Reference__graphic',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n graphicChild: 'fai-Reference__graphicChild',\n};\n\nconst GRAPHIC_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n maxWidth: 'max-content',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n textDecoration: 'none',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n fontSize: GRAPHIC_SIZE,\n height: GRAPHIC_SIZE,\n lineHeight: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n\n [`> .${referenceExtraClassNames.graphicChild}`]: {\n height: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n 'use no memo';\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, state.root.className);\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, state.divider.className);\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["referenceClassNames","referenceExtraClassNames","backgroundColor","colorNeutralBackground3Hover","alignItems","root","citation","divider","graphic","content","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","makeResetStyles","__styles","border","color","colorNeutralForeground2","display","__resetStyles","flexShrink","justifyContent","maxWidth","rootBaseClassName","tokens","dividerBaseClassName","useDividerBaseClassName","contentBaseClassName","useContentBaseClassName","graphicBaseClassName","useGraphicBaseClassName","colorNeutralBackground3Pressed","state","className","borderColor","colorNeutralForeground2Pressed","citationBaseClassName","mergeClasses","useRootStyles","makeStyles","width","useCitationBaseClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAIaA,mBAAAA;eAAAA;;IAQAC,wBAAAA;eAAAA;;IAsBTC,2BAAwBC;eAAxBD;;IAfFE,aAAY;eAAZA;;;iCAnB0E;AAIrE,MAAMJ,sBAAsD;UACjEK;cACAC;aACAC;aACAC;aACAC;AACF;AAEO,MAAMR,2BAA2B;kBACtCS;AACF;AAEA,MAAMC,eAAe;AAErB,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,WAAgB,MAAA;IAAA;IAAA;IAAA;IAAA;IAAA;CAAA;AAC3CT,MAAAA,gBAAYU,IAAAA,yBAAA,EAAA;cACZZ;QACAa,QAAQ;;;OAGRC;QAAAA;KAAcC;;MAEdC,2BAASC,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;CAAA;MACTC,0BAAYD,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MACZE,0BAAgBF,IAAAA,8BAAA,EAAA,WAAA,MAAA;IAAA;IAAA;CAAA;MAChBG,0BAAUH,IAAAA,8BAAA,EAAA,YAAA,MAAA;IAAA;CAAA;MAKRjB,8BAAwBC,CAAAA;;UAIxBoB,oBAAOvB;kCACYwB;UACnBC,uBAAAC;UACFC,uBAAAC;UAEAC,uBAAiBC;UACf5B,IAAAA,CAAAA,SAAAA,GAAiBsB,IAAAA,6BAAOO,EAAAA,oBAAAA,IAA8B,EAAAR,mBAAAS,MAAA3B,IAAA,CAAA4B,SAAA;cACtDC,QAAAA,EAAaV;cACbR,QAAOQ,CAAAA,SAAOW,GAAAA,IAAAA,6BAAAA,EAAAA,oBAA8B7B,QAAA,EAAA8B,uBAAAJ,MAAA1B,QAAA,CAAA2B,SAAA;;cAG1C/B,OAAAA,EAAAA;cACFK,OAAA,CAAA0B,SAAA,GAAAI,IAAAA,6BAAA,EAAArC,oBAAAO,OAAA,EAAAkB,sBAAAO,MAAAzB,OAAA,CAAA0B,SAAA;;IAEJ,IAAAD,MAAAvB,OAAA,EAAA;QAEAuB,MAAOvB,OAAM6B,CAAAA,SAAAA,GAAgBC,IAAAA,6BAAW,EAAAvC,oBAAAS,OAAA,EAAAkB,sBAAAK,MAAAvB,OAAA,CAAAwB,SAAA;;cAEpCO,OAAO,EAAA;QACTR,MAAAxB,OAAA,CAAAyB,SAAA,GAAAI,IAAAA,6BAAA,EAAArC,oBAAAQ,OAAA,EAAAqB,sBAAAG,MAAAxB,OAAA,CAAAyB,SAAA;IACF;IAEA,OAAMQ;GAEN,qDAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../../contexts/reference-v2/referenceListContext';\n\nexport type ReferenceListSlots = {\n root: NonNullable<Slot<'div'>>;\n showMoreButton?: Slot<'span'>;\n showLessButton?: Slot<'span'>;\n};\n\nexport type ReferenceListProps = ComponentProps<ReferenceListSlots> & {\n /**\n * The maximum number of references to display before the overflow button is shown even if there is\n * enough space available to show more.\n * If not set, the overflow functionality will be disabled.\n * @default undefined\n */\n maxVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences'> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n referenceListRef: React.RefObject<HTMLDivElement>;\n shouldUseOverflow: boolean;\n totalReferencesCount: number;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
1
|
+
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../../contexts/reference-v2/referenceListContext';\n\nexport type ReferenceListSlots = {\n /** The root of the component that contains the list of references. */\n root: NonNullable<Slot<'div'>>;\n\n /** A space containing a button that expands the list of references. This slot is only rendered when the list of references is collapsed. */\n showMoreButton?: Slot<'span'>;\n\n /** A space containing a button that collapses the list of references. This slot is only rendered when the list of references is expanded. */\n showLessButton?: Slot<'span'>;\n};\n\nexport type ReferenceListProps = ComponentProps<ReferenceListSlots> & {\n /**\n * The maximum number of references to display before the overflow button is shown even if there is\n * enough space available to show more.\n * If not set, the overflow functionality will be disabled.\n * @default undefined\n */\n maxVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences'> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n referenceListRef: React.RefObject<HTMLDivElement>;\n shouldUseOverflow: boolean;\n totalReferencesCount: number;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceOverflowButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceOverflowButtonSlots = {\n root: Slot<'button'>;\n};\n\n/**\n * ReferenceOverflowButton Props\n */\nexport type ReferenceOverflowButtonProps = ComponentProps<ReferenceOverflowButtonSlots> & {\n text?: string | ((overflowCount: number) => React.ReactNode);\n};\n\n/**\n * State used in rendering ReferenceOverflowButton\n */\nexport type ReferenceOverflowButtonState = ComponentState<ReferenceOverflowButtonSlots> & {\n shouldRenderOverflowButton: boolean;\n};\n"],"names":[],"rangeMappings":";;","mappings":"
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceOverflowButtonSlots = {\n /** The root of the component that renders the overflow button. */\n root: Slot<'button'>;\n};\n\n/**\n * ReferenceOverflowButton Props\n */\nexport type ReferenceOverflowButtonProps = ComponentProps<ReferenceOverflowButtonSlots> & {\n /**\n * The text that is displayed inside of the overflow button. This text is only displayed when `children` has not been passed to the component.\n * If a string is passed, that is what is rendered verbatim.\n * If a callback is passed, the callback is called with the number of items that are overflowing, and the result of the callback is rendered.\n */\n text?: string | ((overflowCount: number) => React.ReactNode);\n};\n\n/**\n * State used in rendering ReferenceOverflowButton\n */\nexport type ReferenceOverflowButtonState = ComponentState<ReferenceOverflowButtonSlots> & {\n shouldRenderOverflowButton: boolean;\n};\n"],"names":[],"rangeMappings":";;","mappings":"AAmBA;;CAEC"}
|
|
@@ -33,9 +33,9 @@ const CitationCloseButton = (citationCloseButtonProps)=>{
|
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
const useReferenceCitationPreview = (props)=>{
|
|
36
|
-
const { citationPreviewProps, citationPreviewSurfaceProps, citationProps, index, previewContentProps, referencePreviewProps, referencePreviewSurfaceProps, referenceProps, sensitivityLabelProps } = props;
|
|
36
|
+
const { citationPreviewProps, citationPreviewSurfaceProps, citationProps, index, previewContentProps, previewHeaderProps, referencePreviewProps, referencePreviewSurfaceProps, referenceProps, sensitivityLabelProps } = props;
|
|
37
37
|
const components = _react.useMemo(()=>{
|
|
38
|
-
const
|
|
38
|
+
const CitationWithPreview = (props)=>{
|
|
39
39
|
var _previewContentProps_content;
|
|
40
40
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactpreview.Preview, {
|
|
41
41
|
closeOnScroll: true,
|
|
@@ -82,13 +82,13 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
82
82
|
]
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
-
const
|
|
85
|
+
const ReferenceWithPreview = (props)=>{
|
|
86
86
|
const mergedReferenceProps = {
|
|
87
87
|
citation: index,
|
|
88
88
|
...referenceProps,
|
|
89
89
|
...props
|
|
90
90
|
};
|
|
91
|
-
var _previewContentProps_content;
|
|
91
|
+
var _previewHeaderProps_children, _previewContentProps_content;
|
|
92
92
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactpreview.Preview, {
|
|
93
93
|
closeOnScroll: true,
|
|
94
94
|
positioning: "below",
|
|
@@ -114,7 +114,8 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
114
114
|
children: index
|
|
115
115
|
}),
|
|
116
116
|
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
117
|
-
|
|
117
|
+
...previewHeaderProps,
|
|
118
|
+
children: (_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
|
|
118
119
|
}),
|
|
119
120
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpreview.PreviewMetadata, {
|
|
120
121
|
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
@@ -133,14 +134,15 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
133
134
|
});
|
|
134
135
|
};
|
|
135
136
|
return {
|
|
136
|
-
Citation:
|
|
137
|
-
Reference:
|
|
137
|
+
Citation: CitationWithPreview,
|
|
138
|
+
Reference: ReferenceWithPreview
|
|
138
139
|
};
|
|
139
140
|
}, [
|
|
140
141
|
citationPreviewProps,
|
|
141
142
|
citationPreviewSurfaceProps,
|
|
142
143
|
citationProps,
|
|
143
144
|
index,
|
|
145
|
+
previewHeaderProps,
|
|
144
146
|
referencePreviewProps,
|
|
145
147
|
referencePreviewSurfaceProps,
|
|
146
148
|
referenceProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n previewHeaderProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const ReferenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n {...previewHeaderProps}\n >\n {previewHeaderProps?.children ?? referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\n };\n }, [\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewHeaderProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n previewContentProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","_jsx","Citation","onCitationCloseButtonClick","onClick","citationPreviewProps","useReferenceCitationPreview","citationPreviewSurfaceProps","citationProps","components","previewContentProps","closeOnScroll","size","referenceHref","tabIndex","index","media","referenceProps","secondaryText","tertiaryText","sensitivityLabelProps","SensitivityLabel","primaryText","mergedReferenceProps","Preview","positioning","withArrow","referencePreviewProps","PreviewTrigger","Reference","PreviewSurface","referencePreviewSurfaceProps","PreviewHeader","PreviewContent","graphic","children","_previewHeaderProps_children","previewHeaderProps","PreviewMetadata","_previewContentProps_content"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;4BACA;iEAEuB;iCAEoC;8BASpD;uCAC0B;0BASR;6BACC;AAiC1B,6IAA6I;AAC7I,MAAMA,sBAAsBC,CAAAA;UAC1BC,iBAAMA,IAAAA,2CAAiBC,EAAAA,CAAAA,UAA2BC,QAAWA,OAAQC;UAErEC,sBAAMA,OAAsBC,WAAMC,CAAAA,CAAAA;uBAE9BN,IAAeO;yBAEf;yBACGC;OACL;QAAAR;KACA;UAACA,6BAAAA,IAAAA,+BAAAA,EAAAA,qBAAAA,yBAAAA,OAAAA;WAAe,WAAA,GAAAS,IAAAA,eAAA,EAAAC,kBAAA,EAAA;QAGlB,GAAAX,wBAAMY;QAENC,SAAAD;;;;IACF,MAAA,EAEAE,oBAAaC,EACXC,2BACEF,EAYFG,aAAMC,OACJ,qBA2BWC,oBA1BT,uBACWC,8BAA0B,gBAAQC,uBAAsB;uBAAeP,OAAAA,OAAAA,CAAAA;;;4EAE5E,EAAA;;;;;;;;+BAIkBE,GAAAA,IAAAA,eAAAA,EAAAA,4BAAAA,EAAAA;mEAClB,EAAAL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O5B,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAAA,YAAAA;;yDACNY,WAAaZ,GAAAA,IAAAA,eAAAA,EAAAA,uCAAAA,EAAAA;4DACbQ;;gEACYR,wBAAEA,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAAA,OAAqBS,MAAAA,QAAYoB,iCAAA,KAAA,IAAAA,+BAAAZ,0BAAA,QAAAA,0BAAA,KAAA,IAAA,KAAA,IAAAA,sBAAAQ,QAAA;6BAAA;;;;;;;;;;;;;;;;;;;;;;;0DAUpD"}
|
|
@@ -32,7 +32,7 @@ const CitationCloseButton = (citationCloseButtonProps)=>{
|
|
|
32
32
|
onClick: onCitationCloseButtonClick
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
-
const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationId: propsCiteId, citationProps, referenceProps, previewProps, previewSurfaceProps, sensitivityLabelProps })=>{
|
|
35
|
+
const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationId: propsCiteId, citationProps, referenceProps, previewHeaderProps, previewProps, previewSurfaceProps, sensitivityLabelProps })=>{
|
|
36
36
|
const refId = (0, _reactcomponents.useId)();
|
|
37
37
|
const citeId = (0, _reactcomponents.useId)();
|
|
38
38
|
const referenceId = propsRefId !== null && propsRefId !== void 0 ? propsRefId : refId;
|
|
@@ -74,7 +74,7 @@ const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationI
|
|
|
74
74
|
const title = _reactcomponents.slot.optional(referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.label, {
|
|
75
75
|
elementType: 'div'
|
|
76
76
|
});
|
|
77
|
-
var _sensitivityLabelProps_description;
|
|
77
|
+
var _previewHeaderProps_children, _sensitivityLabelProps_description, _previewSurfaceProps_children;
|
|
78
78
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactpreview.Preview, {
|
|
79
79
|
closeOnScroll: true,
|
|
80
80
|
positioning: "below",
|
|
@@ -103,7 +103,8 @@ const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationI
|
|
|
103
103
|
children: index
|
|
104
104
|
}),
|
|
105
105
|
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.media,
|
|
106
|
-
|
|
106
|
+
...previewHeaderProps,
|
|
107
|
+
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
|
|
107
108
|
}),
|
|
108
109
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpreview.PreviewMetadata, {
|
|
109
110
|
icon: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.icon,
|
|
@@ -116,7 +117,7 @@ const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationI
|
|
|
116
117
|
children: sensitivity.children
|
|
117
118
|
}),
|
|
118
119
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(citationWithPreviewState.content, {}),
|
|
119
|
-
previewProps === null || previewProps === void 0 ? void 0 : previewProps.children
|
|
120
|
+
(_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
|
|
120
121
|
]
|
|
121
122
|
})
|
|
122
123
|
})
|
|
@@ -133,6 +134,7 @@ const useReferenceCitationPreview = ({ index, referenceId: propsRefId, citationI
|
|
|
133
134
|
citationId,
|
|
134
135
|
referenceProps,
|
|
135
136
|
citationProps,
|
|
137
|
+
previewHeaderProps,
|
|
136
138
|
previewProps,
|
|
137
139
|
previewSurfaceProps,
|
|
138
140
|
sensitivityLabelProps
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport {\n Caption1,\n assertSlots,\n mergeCallbacks,\n slot,\n useId,\n usePopoverContext_unstable,\n} from '@fluentui/react-components';\nimport type { Slot } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type { PreviewProps, PreviewSurfaceProps } from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../Citation';\nimport { Reference } from '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\n\n/**\n * Props for a \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> &\n Partial<Pick<CitationProps, 'referenceHref'>>;\n\n/**\n * A \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitation = React.FC<PackagedCitationProps>;\n\ntype PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';\n\n/**\n * Props for a \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> &\n Partial<Pick<ReferenceProps, PartialReferenceProps>>;\n\n/**\n * A \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReference = React.FC<PackagedReferenceProps>;\n\n/**\n * Data used to package a `Citation` and `Reference` together with\n * the `useReferenceCitation` hook.\n */\nexport type ReferenceCitationData = {\n index: number;\n referenceId?: string;\n citationId?: string;\n citationProps?: PackagedCitationProps;\n referenceProps?: PackagedReferenceProps;\n previewProps?: PreviewProps;\n previewSurfaceProps?: PreviewSurfaceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (data: ReferenceCitationData) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\ntype PreviewExtraSlots = {\n content: Slot<'div'>;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\n/**\n * Hook to package a `Citation` and `Reference` together in an\n * accessibly by default manner.\n *\n * When using citations and references, prefer using them via this\n * hook to ensure props are wired up correctly.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = ({\n index,\n referenceId: propsRefId,\n citationId: propsCiteId,\n citationProps,\n referenceProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n}) => {\n const refId = useId();\n const citeId = useId();\n\n const referenceId = propsRefId ?? refId;\n const citationId = propsCiteId ?? citeId;\n\n const components = React.useMemo(() => {\n const citationHref = `#${citationId}`;\n\n const PackagedReference: PackagedReference = props => {\n const referenceIndex = props.index ?? referenceProps?.index ?? index;\n\n return (\n <Reference\n {...referenceProps}\n index={referenceIndex}\n referenceId={referenceId}\n citationHref={citationHref}\n {...props}\n />\n );\n };\n\n const CitationWithPreview: PackagedCitation = props => {\n // We assert content as a slot to use it with its resolved props object and the correct defaults below.\n const content = slot.always(referenceProps ? referenceProps.content : undefined, {\n defaultProps: {\n children: referenceProps?.excerpt && <Caption1>{referenceProps.excerpt}</Caption1>,\n },\n elementType: 'div',\n });\n const citationWithPreviewState = {\n components: {\n content: 'div',\n },\n content,\n };\n assertSlots<PreviewExtraSlots>(citationWithPreviewState);\n\n // We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.\n const sensitivity = slot.optional(referenceProps?.sensitivity, { elementType: 'span' });\n const title = slot.optional(referenceProps?.label, { elementType: 'div' });\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...previewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} id={citationId} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...previewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media}\n >\n {title?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={referenceProps?.icon}\n primaryText={referenceProps?.primaryText}\n secondaryText={referenceProps?.secondaryText}\n tertiaryText={referenceProps?.tertiaryText}\n />\n {sensitivity && (\n <SensitivityLabel description={sensitivityLabelProps?.description ?? ''}>\n {sensitivity.children}\n </SensitivityLabel>\n )}\n <citationWithPreviewState.content />\n {previewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: PackagedReference,\n };\n }, [\n index,\n referenceId,\n citationId,\n referenceProps,\n citationProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","_jsx","Citation","onCitationCloseButtonClick","onClick","index","refId","useId","citeId","referenceId","citationId","components","citationHref","PackagedReference","referenceIndex","referenceProps","propsRefId","props","_ref","_props_index","CitationWithPreview","defaultProps","children","content","citationWithPreviewState","undefined","excerpt","Caption1","assertSlots","optional","elementType","sensitivityLabelProps","Preview","closeOnScroll","sensitivity","positioning","trapFocus","label","withArrow","PreviewTrigger","PreviewSurface","previewSurfaceProps","aria-label","primaryText","secondaryText","SensitivityLabel","description","tertiaryText","_sensitivityLabelProps_description","previewProps","citationProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;4BACA;iEAEuB;iCAQhB;8BAUA;uCAC0B;0BAIR;2BACC;AAwD1B,6IAA6I;AAC7I,MAAMA,sBAAsBC,CAAAA;UAC1BC,iBAAMA,IAAAA,2CAAiBC,EAAAA,CAAAA,UAA2BC,QAAWA,OAAQC;UAErEC,sBAAMA,OAAsBC,WAAMC,CAAAA,CAAAA;uBAE9BN,IAAeO;yBAEf;yBACGC;OACL;QAAAR;KACA;UAACA,6BAAAA,IAAAA,+BAAAA,EAAAA,qBAAAA,yBAAAA,OAAAA;WAAe,WAAA,GAAAS,IAAAA,eAAA,EAAAC,kBAAA,EAAA;QAGlB,GAAAX,wBAAMY;QAENC,SAAAD;;;uCASDE,KACD,eAUQC,UAAQC,cACRC,WAASD,eAETE,gBACAC,cAEAC,qBACEC,uBAEAC;kBACJN,IAAAA,sBAAMO;mBAENP,IAAAA,sBAAA;wBAEQQ,eAAc,QAAAC,eAAA,KAAA,IAAAA,aAAAV;uBAClBD,gBAAOS,QAAAA,gBAAAA,KAAAA,IAAAA,cAAAA;uBACPL,OAAAA,OAAaA,CAAAA;6BACbG,CAAAA,CAAAA,EAAAA,WAAcA,CAAAA;kCACLK,CAAAA;;kBAGfH,iBAAA,AAAAI,CAAAA,OAAA,AAAAC,CAAAA,eAAAF,MAAAZ,KAAA,MAAA,QAAAc,iBAAA,KAAA,IAAAA,eAAAJ,mBAAA,QAAAA,mBAAA,KAAA,IAAA,KAAA,IAAAA,eA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uFAGxBvB,0BAAgC,QAAAO,0BAAA,KAAA,IAAA,KAAA,IAAAA,sBAAAe,WAAA,MAAA,QAAAE,uCAAA,KAAA,IAAAA,qCAAA;0DAChCC,QAAAA;;;;;;;;;;eAKX;sBAEO7B;uBACLlB;;;;QAEFO;QAAAC;QAAAK;QAAAmC;QAAAD;QAAAR;QAAAV;KAAA;WACCpB;0DAEDF"}
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\nimport {\n Caption1,\n assertSlots,\n mergeCallbacks,\n slot,\n useId,\n usePopoverContext_unstable,\n} from '@fluentui/react-components';\nimport type { Slot } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type { PreviewHeaderProps, PreviewProps, PreviewSurfaceProps } from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../Citation';\nimport { Reference } from '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\n\n/**\n * Props for a \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> &\n Partial<Pick<CitationProps, 'referenceHref'>>;\n\n/**\n * A \"packaged Citation\". A packaged Citation is a `Citation` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedCitation = React.FC<PackagedCitationProps>;\n\ntype PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';\n\n/**\n * Props for a \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> &\n Partial<Pick<ReferenceProps, PartialReferenceProps>>;\n\n/**\n * A \"packaged Reference\". A packaged Reference is a `Reference` that is\n * pre-packaged with props set by the `useReferenceCitation` hook.\n */\nexport type PackagedReference = React.FC<PackagedReferenceProps>;\n\n/**\n * Data used to package a `Citation` and `Reference` together with\n * the `useReferenceCitation` hook.\n */\nexport type ReferenceCitationData = {\n index: number;\n referenceId?: string;\n citationId?: string;\n citationProps?: PackagedCitationProps;\n referenceProps?: PackagedReferenceProps;\n previewHeaderProps?: PreviewHeaderProps;\n previewProps?: PreviewProps;\n previewSurfaceProps?: PreviewSurfaceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (data: ReferenceCitationData) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\ntype PreviewExtraSlots = {\n content: Slot<'div'>;\n};\n\n// 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.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\n/**\n * Hook to package a `Citation` and `Reference` together in an\n * accessibly by default manner.\n *\n * When using citations and references, prefer using them via this\n * hook to ensure props are wired up correctly.\n */\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = ({\n index,\n referenceId: propsRefId,\n citationId: propsCiteId,\n citationProps,\n referenceProps,\n previewHeaderProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n}) => {\n const refId = useId();\n const citeId = useId();\n\n const referenceId = propsRefId ?? refId;\n const citationId = propsCiteId ?? citeId;\n\n const components = React.useMemo(() => {\n const citationHref = `#${citationId}`;\n\n const PackagedReference: PackagedReference = props => {\n const referenceIndex = props.index ?? referenceProps?.index ?? index;\n\n return (\n <Reference\n {...referenceProps}\n index={referenceIndex}\n referenceId={referenceId}\n citationHref={citationHref}\n {...props}\n />\n );\n };\n\n const CitationWithPreview: PackagedCitation = props => {\n // We assert content as a slot to use it with its resolved props object and the correct defaults below.\n const content = slot.always(referenceProps ? referenceProps.content : undefined, {\n defaultProps: {\n children: referenceProps?.excerpt && <Caption1>{referenceProps.excerpt}</Caption1>,\n },\n elementType: 'div',\n });\n const citationWithPreviewState = {\n components: {\n content: 'div',\n },\n content,\n };\n assertSlots<PreviewExtraSlots>(citationWithPreviewState);\n\n // We resolve the slots' objects for sensitivity and title here so that we can use the information from their children below.\n const sensitivity = slot.optional(referenceProps?.sensitivity, { elementType: 'span' });\n const title = slot.optional(referenceProps?.label, { elementType: 'div' });\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...previewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} id={citationId} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...previewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media}\n {...previewHeaderProps}\n >\n {previewHeaderProps?.children ?? title?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={referenceProps?.icon}\n primaryText={referenceProps?.primaryText}\n secondaryText={referenceProps?.secondaryText}\n tertiaryText={referenceProps?.tertiaryText}\n />\n {sensitivity && (\n <SensitivityLabel description={sensitivityLabelProps?.description ?? ''}>\n {sensitivity.children}\n </SensitivityLabel>\n )}\n <citationWithPreviewState.content />\n {previewSurfaceProps?.children ?? previewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: CitationWithPreview,\n Reference: PackagedReference,\n };\n }, [\n index,\n referenceId,\n citationId,\n referenceProps,\n citationProps,\n previewHeaderProps,\n previewProps,\n previewSurfaceProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","_jsx","Citation","onCitationCloseButtonClick","onClick","index","refId","useId","citeId","referenceId","citationId","components","citationHref","PackagedReference","props","referenceProps","referenceIndex","_props_index","_ref","CitationWithPreview","Reference","content","children","undefined","excerpt","Caption1","title","citationWithPreviewState","positioning","optional","sensitivity","size","withArrow","label","previewProps","PreviewTrigger","PreviewSurface","previewSurfaceProps","referenceHref","media","previewHeaderProps","primaryText","_previewHeaderProps_children","SensitivityLabel","description","sensitivityLabelProps","secondaryText","citationProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;4BACA;iEAEuB;iCAQhB;8BAUA;uCAC0B;0BAIR;2BACC;AAyD1B,6IAA6I;AAC7I,MAAMA,sBAAsBC,CAAAA;UAC1BC,iBAAMA,IAAAA,2CAAiBC,EAAAA,CAAAA,UAA2BC,QAAWA,OAAQC;UAErEC,sBAAMA,OAAsBC,WAAMC,CAAAA,CAAAA;uBAE9BN,IAAeO;yBAEf;yBACGC;OACL;QAAAR;KACA;UAACA,6BAAAA,IAAAA,+BAAAA,EAAAA,qBAAAA,yBAAAA,OAAAA;WAAe,WAAA,GAAAS,IAAAA,eAAA,EAAAC,kBAAA,EAAA;QAGlB,GAAAX,wBAAMY;QAENC,SAAAD;;;uCASDE,KACD,eAWQC,UAAQC,cACRC,WAASD,eAETE,gBACA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;;;;;;;mFAI+BC,EAAAA;;kGAC3DjC,EAAAA;;;4DAGLkC,IAAAA,eAAK,EAAAjD,qBAAEyB;iEACHyB,EAAAA,MAAAA,OAAAA,CAAkB;;;;;8DAMtBC,QAAW1B,mBAAEA,KAAAA,IAAAA,KAAAA,IAAAA,eAAAA,KAAAA;;8EAECA,uBAAAA,QAAAA,uBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,mBAA4BO,QAAA,MAAA,QAAAoB,iCAAA,KAAA,IAAAA,+BAAAhB,UAAA,QAAAA,UAAA,KAAA,IAAA,KAAA,IAAAA,MAAAJ,QAAA;;;6DAE3CQ,QAAAA,mBACEa,KAAAA,IAAAA,KAAAA,IAAAA,eAAAA,IAAAA;oEAAiBC,QAAaC,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAAA,WAAAA;sEAC5Bf,QAAAA,mBAAoB,KAAA,IAAA,KAAA,IAAAf,eAAA+B,aAAA;;;gFAGzB,EAAAH,uCAAChB,EAAAA;uFACAU,0BAAAA,QAAAA,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAqBf,WAAQ,MAA7Be,QAAAA,uCAAAA,KAAAA,IAAAA,qCAAiCH;;;;;;;;;;;eAO5C;sBACEhC;uBACAkB;;OAEJ;QAAAf;QAAGI;QAAAC;QAAAK;QAAAgC;QAAAP;QAAAN;QAAAG;QAAAQ;KAAA;WACDxC;0DAEAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"description": "Fluent AI controls for citations and references",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/react-preview": "^0.4.
|
|
15
|
+
"@fluentui-copilot/react-preview": "^0.4.4",
|
|
16
16
|
"@fluentui-copilot/react-provider": "^0.8.3",
|
|
17
|
-
"@fluentui-copilot/react-sensitivity-label": "^0.4.
|
|
17
|
+
"@fluentui-copilot/react-sensitivity-label": "^0.4.4",
|
|
18
18
|
"@swc/helpers": "^0.5.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|