@fluentui-copilot/react-reference 0.16.5 → 0.16.7
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 +88 -1
- package/CHANGELOG.md +27 -2
- package/dist/index.d.ts +8 -7
- package/lib/components/Citation/renderCitation.js.map +1 -1
- package/lib/components/Reference/renderReference.js.map +1 -1
- package/lib/components/Reference/useReference.js.map +1 -1
- package/lib/components/ReferenceList/ReferenceList.types.js.map +1 -1
- package/lib/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -1
- package/lib/contexts/referenceListContext.js.map +1 -1
- package/lib/utilities/generateReferenceCitationPreview.js +10 -3
- package/lib/utilities/generateReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -1
- package/lib-commonjs/components/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/contexts/referenceListContext.js.map +1 -1
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js +10 -3
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js.map +1 -1
- package/package.json +15 -15
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,94 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 08 Nov 2025 02:19:18 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-reference_v0.16.7",
|
|
7
|
+
"version": "0.16.7",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "jiangemma@microsoft.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-reference",
|
|
13
|
+
"commit": "5a476ef39eeaf2f6bebaab0f8fd82de38dd58702",
|
|
14
|
+
"comment": "chore: Update all imports of JSXElement and JSXIntrinsicElement to be from @fluentui/react-utilities"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "jiangemma@microsoft.com",
|
|
18
|
+
"package": "@fluentui-copilot/react-reference",
|
|
19
|
+
"commit": "c044470bcc807f0a174ca3278a1f5d6b3df22fe6",
|
|
20
|
+
"comment": "chore: Update @fluentui/react-components and @fluentui/react-utilities peer dependencies"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Wed, 22 Oct 2025 17:51:31 GMT",
|
|
27
|
+
"tag": "@fluentui-copilot/react-reference_v0.16.6",
|
|
28
|
+
"version": "0.16.6",
|
|
29
|
+
"comments": {
|
|
30
|
+
"none": [
|
|
31
|
+
{
|
|
32
|
+
"author": "hochelmartin@gmail.com",
|
|
33
|
+
"package": "@fluentui-copilot/react-reference",
|
|
34
|
+
"commit": "85efb411485b778327290c03aacb479fc9779dab",
|
|
35
|
+
"comment": "chore: migrate to dts generation against public api instead of internal path aliases tsc resolution"
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"date": "Tue, 14 Oct 2025 00:04:48 GMT",
|
|
42
|
+
"tag": "@fluentui-copilot/react-reference_v0.16.6",
|
|
43
|
+
"version": "0.16.6",
|
|
44
|
+
"comments": {
|
|
45
|
+
"patch": [
|
|
46
|
+
{
|
|
47
|
+
"author": "sarah.higley@microsoft.com",
|
|
48
|
+
"package": "@fluentui-copilot/react-reference",
|
|
49
|
+
"commit": "4a1e1045c5e0e568c3a7d5d8dfd236a9e986c96d",
|
|
50
|
+
"comment": "fix: generateReferenceCitationPreview adds tabIndex to PreviewSurface by default"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"author": "twatanabe@microsoft.com",
|
|
54
|
+
"package": "@fluentui-copilot/react-reference",
|
|
55
|
+
"commit": "068a3c71be5da80beeab05640fe768ef631b0c00",
|
|
56
|
+
"comment": "chore: bump @fluentui/react-components peer dep minbar to ^9.70.0."
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"author": "hochelmartin@gmail.com",
|
|
60
|
+
"package": "@fluentui-copilot/react-reference",
|
|
61
|
+
"commit": "da79330fcf3989311e4838ea7cfc6d4b8318102a",
|
|
62
|
+
"comment": "fix: properly specify package dependencies to dedupe in valid semver ranges"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
66
|
+
"package": "@fluentui-copilot/react-reference",
|
|
67
|
+
"commit": "bcb000d8c82725b72d9becb83e18b42cd74ef17c",
|
|
68
|
+
"comment": "fix: Spreading previewHeaderProps in citation preview in generateReferenceCitationPreview."
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"author": "tristan.watanabe@gmail.com",
|
|
72
|
+
"package": "@fluentui-copilot/react-reference",
|
|
73
|
+
"commit": "9a3bf49a3c6302529b2c9b6bc3fc63f549aaf88f",
|
|
74
|
+
"comment": "chore: enforce explicit return types."
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"author": "tristan.watanabe@gmail.com",
|
|
78
|
+
"package": "@fluentui-copilot/react-reference",
|
|
79
|
+
"commit": "74cfcbd7c8afdc8fe3f4b512a9a421613fa32841",
|
|
80
|
+
"comment": "chore: update react peer deps to support React 19."
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"author": "tristan.watanabe@gmail.com",
|
|
84
|
+
"package": "@fluentui-copilot/react-reference",
|
|
85
|
+
"commit": "ced6fa3a284cc90eae5ca16357e15b349f720ca0",
|
|
86
|
+
"comment": "fix: migrate to React 19 compatible JSX and Ref types."
|
|
87
|
+
}
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"date": "Mon, 29 Sep 2025 20:26:51 GMT",
|
|
6
93
|
"tag": "@fluentui-copilot/react-reference_v0.16.5",
|
|
7
94
|
"version": "0.16.5",
|
|
8
95
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-reference
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 08 Nov 2025 02:19:18 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.16.7](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.16.7)
|
|
8
|
+
|
|
9
|
+
Sat, 08 Nov 2025 02:19:18 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.16.6..@fluentui-copilot/react-reference_v0.16.7)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: Update all imports of JSXElement and JSXIntrinsicElement to be from @fluentui/react-utilities ([PR #3432](https://github.com/microsoft/fluentai/pull/3432) by jiangemma@microsoft.com)
|
|
15
|
+
- chore: Update @fluentui/react-components and @fluentui/react-utilities peer dependencies ([PR #3433](https://github.com/microsoft/fluentai/pull/3433) by jiangemma@microsoft.com)
|
|
16
|
+
|
|
17
|
+
## [0.16.6](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.16.6)
|
|
18
|
+
|
|
19
|
+
Tue, 14 Oct 2025 00:04:48 GMT
|
|
20
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.16.5..@fluentui-copilot/react-reference_v0.16.6)
|
|
21
|
+
|
|
22
|
+
### Patches
|
|
23
|
+
|
|
24
|
+
- fix: generateReferenceCitationPreview adds tabIndex to PreviewSurface by default ([PR #3387](https://github.com/microsoft/fluentai/pull/3387) by sarah.higley@microsoft.com)
|
|
25
|
+
- chore: bump @fluentui/react-components peer dep minbar to ^9.70.0. ([PR #3344](https://github.com/microsoft/fluentai/pull/3344) by twatanabe@microsoft.com)
|
|
26
|
+
- fix: properly specify package dependencies to dedupe in valid semver ranges ([PR #3371](https://github.com/microsoft/fluentai/pull/3371) by hochelmartin@gmail.com)
|
|
27
|
+
- fix: Spreading previewHeaderProps in citation preview in generateReferenceCitationPreview. ([PR #3363](https://github.com/microsoft/fluentai/pull/3363) by Humberto.Morimoto@microsoft.com)
|
|
28
|
+
- chore: enforce explicit return types. ([PR #3360](https://github.com/microsoft/fluentai/pull/3360) by tristan.watanabe@gmail.com)
|
|
29
|
+
- chore: update react peer deps to support React 19. ([PR #3361](https://github.com/microsoft/fluentai/pull/3361) by tristan.watanabe@gmail.com)
|
|
30
|
+
- fix: migrate to React 19 compatible JSX and Ref types. ([PR #3355](https://github.com/microsoft/fluentai/pull/3355) by tristan.watanabe@gmail.com)
|
|
31
|
+
|
|
7
32
|
## [0.16.5](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.16.5)
|
|
8
33
|
|
|
9
|
-
Mon, 29 Sep 2025 20:
|
|
34
|
+
Mon, 29 Sep 2025 20:26:51 GMT
|
|
10
35
|
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.16.3..@fluentui-copilot/react-reference_v0.16.5)
|
|
11
36
|
|
|
12
37
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { DesignVersion } from '@fluentui-copilot/react-provider';
|
|
|
8
8
|
import { FC } from 'react';
|
|
9
9
|
import type { ForwardRefComponent } from '@fluentui/react-components';
|
|
10
10
|
import { ForwardRefComponent as ForwardRefComponent_2 } from '@fluentui/react-utilities';
|
|
11
|
+
import { JSXElement } from '@fluentui/react-utilities';
|
|
11
12
|
import type { PreviewHeaderProps } from '@fluentui-copilot/react-preview';
|
|
12
13
|
import type { PreviewMetadataProps } from '@fluentui-copilot/react-preview';
|
|
13
14
|
import type { PreviewProps } from '@fluentui-copilot/react-preview';
|
|
@@ -160,7 +161,7 @@ export declare type ReferenceListSlots = {
|
|
|
160
161
|
export declare type ReferenceListState = ComponentState<ReferenceListSlots> & Pick<ReferenceListProps, 'maxVisibleReferences' | 'minVisibleReferences'> & {
|
|
161
162
|
areReferencesExpanded: boolean;
|
|
162
163
|
overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;
|
|
163
|
-
referenceListRef: React.RefObject<HTMLDivElement>;
|
|
164
|
+
referenceListRef: React.RefObject<HTMLDivElement | null>;
|
|
164
165
|
shouldUseOverflow: boolean;
|
|
165
166
|
totalReferencesCount: number;
|
|
166
167
|
};
|
|
@@ -252,25 +253,25 @@ export declare type ReferenceV2State = ReferenceState;
|
|
|
252
253
|
/**
|
|
253
254
|
* Render the final JSX of Citation
|
|
254
255
|
*/
|
|
255
|
-
export declare const renderCitation_unstable: (state: CitationState) =>
|
|
256
|
+
export declare const renderCitation_unstable: (state: CitationState) => JSXElement;
|
|
256
257
|
|
|
257
|
-
export declare const renderReference_unstable: (state: ReferenceState) =>
|
|
258
|
+
export declare const renderReference_unstable: (state: ReferenceState) => JSXElement;
|
|
258
259
|
|
|
259
260
|
/**
|
|
260
261
|
* Render the final JSX of ReferenceList
|
|
261
262
|
*/
|
|
262
|
-
export declare const renderReferenceList_unstable: (state: ReferenceListState, contextValues: ReferenceListContextValues) =>
|
|
263
|
+
export declare const renderReferenceList_unstable: (state: ReferenceListState, contextValues: ReferenceListContextValues) => JSXElement;
|
|
263
264
|
|
|
264
265
|
/** @deprecated use renderReferenceList_unstable */
|
|
265
|
-
export declare const renderReferenceListV2_unstable: (state: ReferenceListState, contextValues: ReferenceListContextValues) =>
|
|
266
|
+
export declare const renderReferenceListV2_unstable: (state: ReferenceListState, contextValues: ReferenceListContextValues) => JSXElement;
|
|
266
267
|
|
|
267
268
|
/**
|
|
268
269
|
* Render the final JSX of ReferenceOverflowButton
|
|
269
270
|
*/
|
|
270
|
-
export declare const renderReferenceOverflowButton_unstable: (state: ReferenceOverflowButtonState) =>
|
|
271
|
+
export declare const renderReferenceOverflowButton_unstable: (state: ReferenceOverflowButtonState) => JSXElement | null;
|
|
271
272
|
|
|
272
273
|
/** @deprecated use renderReference_unstable */
|
|
273
|
-
export declare const renderReferenceV2_unstable: (state: ReferenceState) =>
|
|
274
|
+
export declare const renderReferenceV2_unstable: (state: ReferenceState) => JSXElement;
|
|
274
275
|
|
|
275
276
|
/**
|
|
276
277
|
* Create the state required to render Citation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { CitationState, CitationSlots } from './Citation.types';\n/**\n * Render the final JSX of Citation\n */\nexport const renderCitation_unstable = (state: CitationState) => {\n assertSlots<CitationSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderCitation_unstable","state","root"],"rangeMappings":";;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { CitationState, CitationSlots } from './Citation.types';\nimport type { JSXElement } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Citation\n */\nexport const renderCitation_unstable = (state: CitationState): JSXElement => {\n assertSlots<CitationSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderCitation_unstable","state","root"],"rangeMappings":";;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAGzD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtCF,YAA2BE;IAE3B,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.graphic && <state.graphic />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["OverflowItem","assertSlots","renderReference_unstable","state","id","shouldUseOverflow","reference","root","citation","divider","content","graphic","children"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,YAAY,EAAEC,WAAW,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nexport const renderReference_unstable = (state: ReferenceState): JSXElement => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.graphic && <state.graphic />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["OverflowItem","assertSlots","renderReference_unstable","state","id","shouldUseOverflow","reference","root","citation","divider","content","graphic","children"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,YAAY,EAAEC,WAAW,QAAQ,6BAA6B;AAIvE,OAAO,MAAMC,2BAA2B,CAACC;IACvCF,YAA4BE;IAE5B,MAAM,EAAEC,EAAE,EAAEC,iBAAiB,EAAE,GAAGF;IAElC,MAAMG,0BACJ,MAACH,MAAMI,IAAI;;YACRJ,MAAMK,QAAQ,kBAAI,KAACL,MAAMK,QAAQ;YACjCL,MAAMM,OAAO,kBAAI,KAACN,MAAMM,OAAO;YAC/BN,MAAMO,OAAO,kBACZ,MAACP,MAAMO,OAAO;;oBACXP,MAAMQ,OAAO,kBAAI,KAACR,MAAMQ,OAAO;oBAC/BR,MAAMI,IAAI,CAACK,QAAQ;;;;;IAM5B,OAAOP,kCACL,KAACL;QAAsBI,IAAIA;kBACxBE;OADgBF,MAInBE;AAEJ,EAAE"}
|
|
@@ -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/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState, ReferenceSlots } from './Reference.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n
|
|
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/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState, ReferenceSlots } from './Reference.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\nimport type { JSXIntrinsicElement } from '@fluentui/react-utilities';\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 designVersion = useDesignVersion(props.designVersion);\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const elementType = as || ((props as JSXIntrinsicElement<'a'>).href ? 'a' : 'button');\n const propsWithAssignedAs = {\n type: elementType === 'button' ? 'button' : undefined,\n ...props,\n as: elementType,\n id: referenceId,\n };\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 as ReferenceSlots['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 designVersion,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: elementType,\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(\n elementType,\n {\n ref,\n ...propsWithAssignedAs,\n },\n // `content` is a slot and it's type clashes with the HTMLElement `content` attribute\n ['content'],\n ) as ReferenceSlots['root'],\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","useDesignVersion","useReference_unstable","props","ref","as","children","id","designVersion","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,sCAAsC;AACvF,SAASC,wBAAwB,QAAQ,8BAA8B;AAEvE,SAASC,gBAAgB,QAAQ,mCAAmC;AAEpE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CACnCC,OACAC;IAEA,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,EAAE,EAAE,GAAGJ;IAE7B,MAAMK,gBAAgBP,iBAAiBE,MAAMK,aAAa;IAE1D,MAAMC,oBAAoBV,iCAAiCW,CAAAA,MAAOA,IAAID,iBAAiB;IAEvF,MAAME,cAAcb,MAAM,cAAcS;IAExC,MAAMK,cAAcP,MAAO,CAAA,AAACF,MAAmCU,IAAI,GAAG,MAAM,QAAO;IACnF,MAAMC,sBAAsB;QAC1BC,MAAMH,gBAAgB,WAAW,WAAWI;QAC5C,GAAGb,KAAK;QACRE,IAAIO;QACJL,IAAII;IACN;IAEA,MAAMM,WAAWpB,KAAKqB,QAAQ,CAACf,MAAMc,QAAQ,EAAE;QAAEL,aAAa;IAAO;IACrE,MAAMO,UAAUtB,KAAKqB,QAAQ,CAACf,MAAMgB,OAAO,EAAE;QAAEP,aAAa;IAAO;IACnE,MAAMQ,UAAUvB,KAAKqB,QAAQ,CAACf,MAAMiB,OAAO,EAA+B;QACxER,aAAa;QACbS,iBAAiBF,YAAYH,aAAa,CAAC,CAACV;IAC9C;IACA,MAAMgB,UAAUzB,KAAKqB,QAAQ,CAACf,MAAMmB,OAAO,EAAE;QAC3CV,aAAa;QACbS,iBAAiBJ,aAAaD,aAAaI,YAAYJ;IACzD;IAEA,MAAMO,QAAwB;QAC5Bf;QACAD,IAAII;QACJF;QAEAe,YAAY;YACVC,MAAMb;YACNK,UAAU;YACVK,SAAS;YACTH,SAAS;YACTC,SAAS;QACX;QAEAK,MAAM5B,KAAK6B,MAAM,CACf/B,yBACEiB,aACA;YACER;YACA,GAAGU,mBAAmB;QACxB,GACA,qFAAqF;QACrF;YAAC;SAAU,GAEb;YAAEF;QAAY;QAEhBK;QACAK;QACAF;QACAD;IACF;IAEA,IAAII,MAAMJ,OAAO,IAAIzB,MAAMiC,cAAc,CAAcJ,MAAMJ,OAAO,CAACb,QAAQ,GAAG;QAC9EiB,MAAMJ,OAAO,CAACb,QAAQ,GAAGZ,MAAMkC,YAAY,CAACL,MAAMJ,OAAO,CAACb,QAAQ,EAAE;YAClEuB,WAAWjC,aAAa2B,MAAMJ,OAAO,CAACb,QAAQ,CAACH,KAAK,CAAC0B,SAAS,EAAE7B,yBAAyB8B,YAAY;QACvG;IACF;IAEA,OAAOP;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/referenceListContext';\n\nexport type ReferenceListSlots = {\n /** The root of the component that contains the list of references. */\n root: NonNullable<Slot<'div'>>;\n\n /** The region that contains the references and is used for arrow navigation. */\n arrowableRegion: 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<Partial<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 * If this value is less than `minVisibleReferences`, then `minVisibleReferences` will take precedence.\n * @default undefined\n */\n maxVisibleReferences?: number;\n\n /**\n * The minimum number of references to always show before overflowing.\n * If this value exceeds the number of references, the overflow functionality will be disabled.\n * If this value is greater than `maxVisibleReferences`, then this will take precedence.\n * @default undefined\n */\n minVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences' | 'minVisibleReferences'> & {\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":"AA6CA,WAEE"}
|
|
1
|
+
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../contexts/referenceListContext';\n\nexport type ReferenceListSlots = {\n /** The root of the component that contains the list of references. */\n root: NonNullable<Slot<'div'>>;\n\n /** The region that contains the references and is used for arrow navigation. */\n arrowableRegion: 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<Partial<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 * If this value is less than `minVisibleReferences`, then `minVisibleReferences` will take precedence.\n * @default undefined\n */\n maxVisibleReferences?: number;\n\n /**\n * The minimum number of references to always show before overflowing.\n * If this value exceeds the number of references, the overflow functionality will be disabled.\n * If this value is greater than `maxVisibleReferences`, then this will take precedence.\n * @default undefined\n */\n minVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences' | 'minVisibleReferences'> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n referenceListRef: React.RefObject<HTMLDivElement | null>;\n shouldUseOverflow: boolean;\n totalReferencesCount: number;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":"AA6CA,WAEE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (\n state: ReferenceListState,\n contextValues: ReferenceListContextValues,\n): JSXElement => {\n assertSlots<ReferenceListSlots>(state);\n\n const { minVisibleReferences } = state;\n\n return (\n <ReferenceListContextProvider value={contextValues.referenceList}>\n <Overflow minimumVisible={minVisibleReferences}>\n <state.root>\n <state.arrowableRegion />\n {state.showMoreButton && <state.showMoreButton />}\n {state.showLessButton && <state.showLessButton />}\n </state.root>\n </Overflow>\n </ReferenceListContextProvider>\n );\n};\n"],"names":["Overflow","assertSlots","ReferenceListContextProvider","renderReferenceList_unstable","state","contextValues","minVisibleReferences","value","referenceList","minimumVisible","root","arrowableRegion","showMoreButton","showLessButton"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,QAAQ,EAAEC,WAAW,QAAQ,6BAA6B;AAEnE,SAASC,4BAA4B,QAAQ,sCAAsC;AAGnF;;CAEC,GACD,OAAO,MAAMC,+BAA+B,CAC1CC,OACAC;IAEAJ,YAAgCG;IAEhC,MAAM,EAAEE,oBAAoB,EAAE,GAAGF;IAEjC,qBACE,KAACF;QAA6BK,OAAOF,cAAcG,aAAa;kBAC9D,cAAA,KAACR;YAASS,gBAAgBH;sBACxB,cAAA,MAACF,MAAMM,IAAI;;kCACT,KAACN,MAAMO,eAAe;oBACrBP,MAAMQ,cAAc,kBAAI,KAACR,MAAMQ,cAAc;oBAC7CR,MAAMS,cAAc,kBAAI,KAACT,MAAMS,cAAc;;;;;AAKxD,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState) => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["OverflowItem","assertSlots","renderReferenceOverflowButton_unstable","state","id","shouldRenderOverflowButton","priority","root"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,YAAY,EAAEC,WAAW,QAAQ,6BAA6B;
|
|
1
|
+
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState): JSXElement | null => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["OverflowItem","assertSlots","renderReferenceOverflowButton_unstable","state","id","shouldRenderOverflowButton","priority","root"],"rangeMappings":";;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,YAAY,EAAEC,WAAW,QAAQ,6BAA6B;AAIvE;;CAEC,GACD,OAAO,MAAMC,yCAAyC,CAACC;IACrDF,YAA0CE;IAC1C,MAAM,EAAEC,EAAE,EAAEC,0BAA0B,EAAE,GAAGF;IAE3C,OAAOE,2CACL,KAACL;QAAsBI,IAAIA;QAAIE,UAAU;kBACvC,cAAA,KAACH,MAAMI,IAAI;OADMH,MAGjB;AACN,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>) =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["createContext","useContextSelector","ReferenceListContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","ReferenceListContextProvider","Provider","useReferenceListContext_unstable","selector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,mCAAmC;AAiBrF,OAAO,MAAMC,uBAA2DF,cAEtEG,WAAiD;AAEnD,MAAMC,mCAA8D;IAClEC,uBAAuB;IACvBC,sBAAsBH;IACtBI,oCAAoC;QAAEC,SAAS;IAAM;IACrDC,kBAAkB;QAAED,SAAS;IAAK;IAClCE,mBAAmB;IACnBC,sBAAsB;AACxB;AAEA,OAAO,MAAMC,+BAA+BV,qBAAqBW,QAAQ,CAAC;AAE1E,OAAO,MAAMC,mCAAmC,CAAIC,WAClDd,mBAAmBC,sBAAsB,CAACc,MAAMZ,gCAAgC,GAAKW,SAASC,MAAM"}
|
|
1
|
+
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>): T =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["createContext","useContextSelector","ReferenceListContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","ReferenceListContextProvider","Provider","useReferenceListContext_unstable","selector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,mCAAmC;AAiBrF,OAAO,MAAMC,uBAA2DF,cAEtEG,WAAiD;AAEnD,MAAMC,mCAA8D;IAClEC,uBAAuB;IACvBC,sBAAsBH;IACtBI,oCAAoC;QAAEC,SAAS;IAAM;IACrDC,kBAAkB;QAAED,SAAS;IAAK;IAClCE,mBAAmB;IACnBC,sBAAsB;AACxB;AAEA,OAAO,MAAMC,+BAA+BV,qBAAqBW,QAAQ,CAAC;AAE1E,OAAO,MAAMC,mCAAmC,CAAIC,WAClDd,mBAAmBC,sBAAsB,CAACc,MAAMZ,gCAAgC,GAAKW,SAASC,MAAM"}
|
|
@@ -45,13 +45,17 @@ const CitationCloseButton = (citationCloseButtonProps)=>{
|
|
|
45
45
|
}, /*#__PURE__*/ React.createElement(PreviewTrigger, null, /*#__PURE__*/ React.createElement(Citation, {
|
|
46
46
|
...citationProps,
|
|
47
47
|
...props
|
|
48
|
-
}, index)), /*#__PURE__*/ React.createElement(PreviewSurface,
|
|
48
|
+
}, index)), /*#__PURE__*/ React.createElement(PreviewSurface, {
|
|
49
|
+
tabIndex: 0,
|
|
50
|
+
...citationPreviewSurfaceProps
|
|
51
|
+
}, /*#__PURE__*/ React.createElement(PreviewContent, null, /*#__PURE__*/ React.createElement(PreviewHeader, {
|
|
49
52
|
citation: /*#__PURE__*/ React.createElement(CitationCloseButton, {
|
|
50
53
|
"aria-label": `Close Reference ${index}`,
|
|
51
54
|
referenceHref: "#",
|
|
52
55
|
tabIndex: -1
|
|
53
56
|
}, index),
|
|
54
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic
|
|
57
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
58
|
+
...previewHeaderProps
|
|
55
59
|
}, referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children), /*#__PURE__*/ React.createElement(PreviewMetadata, {
|
|
56
60
|
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
57
61
|
primaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.primaryText,
|
|
@@ -73,7 +77,10 @@ const CitationCloseButton = (citationCloseButtonProps)=>{
|
|
|
73
77
|
trapFocus: true,
|
|
74
78
|
withArrow: true,
|
|
75
79
|
...referencePreviewProps
|
|
76
|
-
}, /*#__PURE__*/ React.createElement(PreviewTrigger, null, /*#__PURE__*/ React.createElement(Reference, mergedReferenceProps)), /*#__PURE__*/ React.createElement(PreviewSurface,
|
|
80
|
+
}, /*#__PURE__*/ React.createElement(PreviewTrigger, null, /*#__PURE__*/ React.createElement(Reference, mergedReferenceProps)), /*#__PURE__*/ React.createElement(PreviewSurface, {
|
|
81
|
+
tabIndex: 0,
|
|
82
|
+
...referencePreviewSurfaceProps
|
|
83
|
+
}, /*#__PURE__*/ React.createElement(PreviewContent, null, /*#__PURE__*/ React.createElement(PreviewHeader, {
|
|
77
84
|
citation: /*#__PURE__*/ React.createElement(CitationCloseButton, {
|
|
78
85
|
"aria-label": `Close Reference ${index}`,
|
|
79
86
|
referenceHref: "#",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["generateReferenceCitationPreview.tsx"],"sourcesContent":["import * 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 '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\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 ReferenceCitationPreviewGeneratorProps = {\n citationPreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type ReferenceCitationPreviewGenerator = (props: ReferenceCitationPreviewGeneratorProps) => {\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\n/**\n * Function to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the function.\n * Props can either be passed in to the function or applied directly to the generated components in JSX.\n *\n * A `useReferenceCitationPreview` hook exists that calls this function and memoizes its return value based on the props.\n * You should use the hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const generateReferenceCitationPreview: ReferenceCitationPreviewGenerator = 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 CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"above\" 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={`Close Reference ${index}`} 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=\"above\" 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={`Close Reference ${index}`} 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 const components = {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\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","generateReferenceCitationPreview","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","previewHeaderProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","CitationWithPreview","closeOnScroll","positioning","size","trapFocus","withArrow","citation","aria-label","referenceHref","tabIndex","media","graphic","children","icon","primaryText","secondaryText","tertiaryText","content","ReferenceWithPreview","mergedReferenceProps","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,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,cAAc;AACvC,SAASC,SAAS,QAAQ,eAAe;AAiCzC,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,oBAACZ;QAA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C3Bb,UAAUb;YACV,GAAGK,cAAc;YACjB,GAAGT,KAAK;QACV;YAkBWM,8BASFD;QAzBT,qBACE,oBAAC1B;YAAQiC,eAAAA;YAAcC,aAAY;YAAQC,MAAK;YAAQC,WAAAA;YAAUC,WAAAA;YAAW,GAAGT,qBAAqB;yBACnG,oBAACvB,oCACC,oBAACG,WAAc2C,sCAEjB,oBAAC/C,gBAAmByB,4CAClB,oBAAC5B,oCACC,oBAACC;YACCoC,wBACE,oBAAC7B;gBAAoB8B,cAAY,CAAC,gBAAgB,EAAEd,MAAM,CAAC;gBAAEe,eAAc;gBAAIC,UAAU,CAAC;eACvFhB;YAGLiB,KAAK,EAAEZ,2BAAAA,qCAAAA,eAAgBa,OAAO;YAC7B,GAAGhB,kBAAkB;WAErBA,CAAAA,+BAAAA,+BAAAA,yCAAAA,mBAAoBiB,QAAQ,cAA5BjB,0CAAAA,+BAAgCG,2BAAAA,qCAAAA,eAAgBc,QAAQ,iBAE3D,oBAACzC;YACC0C,IAAI,EAAEnB,gCAAAA,0CAAAA,oBAAqBmB,IAAI;YAC/BC,WAAW,EAAEpB,gCAAAA,0CAAAA,oBAAqBoB,WAAW;YAC7CC,aAAa,EAAErB,gCAAAA,0CAAAA,oBAAqBqB,aAAa;YACjDC,YAAY,EAAEtB,gCAAAA,0CAAAA,oBAAqBsB,YAAY;YAEhDjB,uCAAyB,oBAACzB,kBAAqByB,wBAC/CL,CAAAA,+BAAAA,gCAAAA,0CAAAA,oBAAqBuB,OAAO,cAA5BvB,0CAAAA,+BAAgCE,kCAAAA,4CAAAA,sBAAuBgB,QAAQ;IAK1E;IAEA,MAAMQ,aAAa;QACjB7C,UAAUyB;QACVxB,WAAW0C;IACb;IAEA,OAAOE;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["generateReferenceCitationPreview.tsx"],"sourcesContent":["import * 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 '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\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 ReferenceCitationPreviewGeneratorProps = {\n citationPreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type ReferenceCitationPreviewGenerator = (props: ReferenceCitationPreviewGeneratorProps) => {\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\n/**\n * Function to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the function.\n * Props can either be passed in to the function or applied directly to the generated components in JSX.\n *\n * A `useReferenceCitationPreview` hook exists that calls this function and memoizes its return value based on the props.\n * You should use the hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const generateReferenceCitationPreview: ReferenceCitationPreviewGenerator = 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 CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"above\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface tabIndex={0} {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n {...previewHeaderProps}\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=\"above\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface tabIndex={0} {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} 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 const components = {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\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","generateReferenceCitationPreview","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","previewHeaderProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","CitationWithPreview","closeOnScroll","positioning","size","trapFocus","withArrow","tabIndex","citation","aria-label","referenceHref","media","graphic","children","icon","primaryText","secondaryText","tertiaryText","content","ReferenceWithPreview","mergedReferenceProps","components"],"rangeMappings":";;;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AAA,eAAgBa,OAAO;YAC7B,GAAGhB,kBAAkB;WAErBA,CAAAA,+BAAAA,+BAAAA,yCAAAA,mBAAoBiB,QAAQ,cAA5BjB,0CAAAA,+BAAgCG,2BAAAA,qCAAAA,eAAgBc,QAAQ,iBAE3D,oBAACzC;YACC0C,IAAI,EAAEnB,gCAAAA,0CAAAA,oBAAqBmB,IAAI;YAC/BC,WAAW,EAAEpB,gCAAAA,0CAAAA,oBAAqBoB,WAAW;YAC7CC,aAAa,EAAErB,gCAAAA,0CAAAA,oBAAqBqB,aAAa;YACjDC,YAAY,EAAEtB,gCAAAA,0CAAAA,oBAAqBsB,YAAY;YAEhDjB,uCAAyB,oBAACzB,kBAAqByB,wBAC/CL,CAAAA,+BAAAA,gCAAAA,0CAAAA,oBAAqBuB,OAAO,cAA5BvB,0CAAAA,+BAAgCE,kCAAAA,4CAAAA,sBAAuBgB,QAAQ;IAK1E;IAEA,MAAMQ,aAAa;QACjB7C,UAAUyB;QACVxB,WAAW0C;IACb;IAEA,OAAOE;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { CitationState, CitationSlots } from './Citation.types';\n/**\n * Render the final JSX of Citation\n */\nexport const renderCitation_unstable = (state: CitationState) => {\n assertSlots<CitationSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderCitation_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { CitationState, CitationSlots } from './Citation.types';\nimport type { JSXElement } from '@fluentui/react-utilities';\n/**\n * Render the final JSX of Citation\n */\nexport const renderCitation_unstable = (state: CitationState): JSXElement => {\n assertSlots<CitationSlots>(state);\n\n return <state.root />;\n};\n"],"names":["renderCitation_unstable","state","assertSlots","_jsx","root"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;iCAE4B;AAMrB,MAAMA,0BAA0B,CAACC;IACtCC,IAAAA,4BAAAA,EAA2BD;IAE3B,OAAA,WAAA,GAAOE,IAAAA,eAAA,EAACF,MAAMG,IAAI,EAAA,CAAA;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.graphic && <state.graphic />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["renderReference_unstable","state","assertSlots","id","shouldUseOverflow","reference","_jsxs","root","citation","_jsx","divider","content","graphic","children","OverflowItem"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nexport const renderReference_unstable = (state: ReferenceState): JSXElement => {\n assertSlots<ReferenceSlots>(state);\n\n const { id, shouldUseOverflow } = state;\n\n const reference = (\n <state.root>\n {state.citation && <state.citation />}\n {state.divider && <state.divider />}\n {state.content && (\n <state.content>\n {state.graphic && <state.graphic />}\n {state.root.children}\n </state.content>\n )}\n </state.root>\n );\n\n return shouldUseOverflow ? (\n <OverflowItem key={id} id={id}>\n {reference}\n </OverflowItem>\n ) : (\n reference\n );\n};\n"],"names":["renderReference_unstable","state","assertSlots","id","shouldUseOverflow","reference","_jsxs","root","citation","_jsx","divider","content","graphic","children","OverflowItem"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAOaA;;;eAAAA;;;4BANb;iCAE0C;AAInC,MAAMA,2BAA2B,CAACC;IACvCC,IAAAA,4BAAAA,EAA4BD;IAE5B,MAAM,EAAEE,EAAE,EAAEC,iBAAiB,EAAE,GAAGH;IAElC,MAAMI,YAAAA,WAAAA,GACJC,IAAAA,gBAAA,EAACL,MAAMM,IAAI,EAAA;;YACRN,MAAMO,QAAQ,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACR,MAAMO,QAAQ,EAAA,CAAA;YACjCP,MAAMS,OAAO,IAAA,WAAA,GAAID,IAAAA,eAAA,EAACR,MAAMS,OAAO,EAAA,CAAA;YAC/BT,MAAMU,OAAO,IAAA,WAAA,GACZL,IAAAA,gBAAA,EAACL,MAAMU,OAAO,EAAA;;oBACXV,MAAMW,OAAO,IAAA,WAAA,GAAIH,IAAAA,eAAA,EAACR,MAAMW,OAAO,EAAA,CAAA;oBAC/BX,MAAMM,IAAI,CAACM,QAAQ;;;;;IAM5B,OAAOT,oBAAAA,WAAAA,GACLK,IAAAA,eAAA,EAACK,6BAAAA,EAAAA;QAAsBX,IAAIA;kBACxBE;OADgBF,MAInBE;AAEJ"}
|
|
@@ -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/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState, ReferenceSlots } from './Reference.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n
|
|
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/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles.styles';\nimport type { ReferenceProps, ReferenceState, ReferenceSlots } from './Reference.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\nimport type { JSXIntrinsicElement } from '@fluentui/react-utilities';\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 designVersion = useDesignVersion(props.designVersion);\n\n const shouldUseOverflow = useReferenceListContext_unstable(ctx => ctx.shouldUseOverflow);\n\n const referenceId = useId('reference-', id);\n\n const elementType = as || ((props as JSXIntrinsicElement<'a'>).href ? 'a' : 'button');\n const propsWithAssignedAs = {\n type: elementType === 'button' ? 'button' : undefined,\n ...props,\n as: elementType,\n id: referenceId,\n };\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 as ReferenceSlots['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 designVersion,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: elementType,\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps(\n elementType,\n {\n ref,\n ...propsWithAssignedAs,\n },\n // `content` is a slot and it's type clashes with the HTMLElement `content` attribute\n ['content'],\n ) as ReferenceSlots['root'],\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":["useReference_unstable","props","ref","as","children","id","designVersion","useDesignVersion","shouldUseOverflow","useReferenceListContext_unstable","ctx","referenceId","useId","elementType","href","propsWithAssignedAs","type","undefined","citation","slot","optional","graphic","content","renderByDefault","divider","state","components","root","always","getIntrinsicElementProps","React","isValidElement","cloneElement","className","mergeClasses","referenceExtraClassNames","graphicChild"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAgBaA;;;eAAAA;;;;iEAhBU;iCAC6C;sCACnB;0CACR;+BAER;AAW1B,MAAMA,wBAAwB,CACnCC,OACAC;IAEA,MAAM,EAAEC,EAAE,EAAEC,QAAQ,EAAEC,EAAE,EAAE,GAAGJ;IAE7B,MAAMK,gBAAgBC,IAAAA,+BAAAA,EAAiBN,MAAMK,aAAa;IAE1D,MAAME,oBAAoBC,IAAAA,sDAAAA,EAAiCC,CAAAA,MAAOA,IAAIF,iBAAiB;IAEvF,MAAMG,cAAcC,IAAAA,sBAAAA,EAAM,cAAcP;IAExC,MAAMQ,cAAcV,MAAOF,CAAAA,MAAoCa,IAAI,GAAG,MAAM,QAAA;IAC5E,MAAMC,sBAAsB;QAC1BC,MAAMH,gBAAgB,WAAW,WAAWI;QAC5C,GAAGhB,KAAK;QACRE,IAAIU;QACJR,IAAIM;IACN;IAEA,MAAMO,WAAWC,qBAAAA,CAAKC,QAAQ,CAACnB,MAAMiB,QAAQ,EAAE;QAAEL,aAAa;IAAO;IACrE,MAAMQ,UAAUF,qBAAAA,CAAKC,QAAQ,CAACnB,MAAMoB,OAAO,EAAE;QAAER,aAAa;IAAO;IACnE,MAAMS,UAAUH,qBAAAA,CAAKC,QAAQ,CAACnB,MAAMqB,OAAO,EAA+B;QACxET,aAAa;QACbU,iBAAiBF,YAAYJ,aAAa,CAAC,CAACb;IAC9C;IACA,MAAMoB,UAAUL,qBAAAA,CAAKC,QAAQ,CAACnB,MAAMuB,OAAO,EAAE;QAC3CX,aAAa;QACbU,iBAAiBL,aAAaD,aAAaK,YAAYL;IACzD;IAEA,MAAMQ,QAAwB;QAC5BnB;QACAD,IAAIM;QACJH;QAEAkB,YAAY;YACVC,MAAMd;YACNK,UAAU;YACVM,SAAS;YACTH,SAAS;YACTC,SAAS;QACX;QAEAK,MAAMR,qBAAAA,CAAKS,MAAM,CACfC,IAAAA,yCAAAA,EACEhB,aACA;YACEX;YACA,GAAGa,mBAAmB;QACxB,GAEA;YAAC;SAAU,GAEb;YAAEF;QAAY;QAEhBK;QACAM;QACAF;QACAD;IACF;IAEA,IAAII,MAAMJ,OAAO,kBAAIS,OAAMC,cAAc,CAAcN,MAAMJ,OAAO,CAACjB,QAAQ,GAAG;QAC9EqB,MAAMJ,OAAO,CAACjB,QAAQ,iBAAG0B,OAAME,YAAY,CAACP,MAAMJ,OAAO,CAACjB,QAAQ,EAAE;YAClE6B,WAAWC,IAAAA,6BAAAA,EAAaT,MAAMJ,OAAO,CAACjB,QAAQ,CAACH,KAAK,CAACgC,SAAS,EAAEE,kDAAAA,CAAyBC,YAAY;QACvG;IACF;IAEA,OAAOX;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceList.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListContextValue } from '../../contexts/referenceListContext';\n\nexport type ReferenceListSlots = {\n /** The root of the component that contains the list of references. */\n root: NonNullable<Slot<'div'>>;\n\n /** The region that contains the references and is used for arrow navigation. */\n arrowableRegion: 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<Partial<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 * If this value is less than `minVisibleReferences`, then `minVisibleReferences` will take precedence.\n * @default undefined\n */\n maxVisibleReferences?: number;\n\n /**\n * The minimum number of references to always show before overflowing.\n * If this value exceeds the number of references, the overflow functionality will be disabled.\n * If this value is greater than `maxVisibleReferences`, then this will take precedence.\n * @default undefined\n */\n minVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences' | 'minVisibleReferences'> & {\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/referenceListContext';\n\nexport type ReferenceListSlots = {\n /** The root of the component that contains the list of references. */\n root: NonNullable<Slot<'div'>>;\n\n /** The region that contains the references and is used for arrow navigation. */\n arrowableRegion: 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<Partial<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 * If this value is less than `minVisibleReferences`, then `minVisibleReferences` will take precedence.\n * @default undefined\n */\n maxVisibleReferences?: number;\n\n /**\n * The minimum number of references to always show before overflowing.\n * If this value exceeds the number of references, the overflow functionality will be disabled.\n * If this value is greater than `maxVisibleReferences`, then this will take precedence.\n * @default undefined\n */\n minVisibleReferences?: number;\n};\n\nexport type ReferenceListState = ComponentState<ReferenceListSlots> &\n Pick<ReferenceListProps, 'maxVisibleReferences' | 'minVisibleReferences'> & {\n areReferencesExpanded: boolean;\n overflowButtonTriggeredViaKeyboard: React.MutableRefObject<boolean>;\n referenceListRef: React.RefObject<HTMLDivElement | null>;\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":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (\n state: ReferenceListState,\n contextValues: ReferenceListContextValues,\n): JSXElement => {\n assertSlots<ReferenceListSlots>(state);\n\n const { minVisibleReferences } = state;\n\n return (\n <ReferenceListContextProvider value={contextValues.referenceList}>\n <Overflow minimumVisible={minVisibleReferences}>\n <state.root>\n <state.arrowableRegion />\n {state.showMoreButton && <state.showMoreButton />}\n {state.showLessButton && <state.showLessButton />}\n </state.root>\n </Overflow>\n </ReferenceListContextProvider>\n );\n};\n"],"names":["renderReferenceList_unstable","state","contextValues","assertSlots","minVisibleReferences","_jsx","ReferenceListContextProvider","value","referenceList","Overflow","minimumVisible","_jsxs","root","arrowableRegion","showMoreButton","showLessButton"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;4BAVb;iCAEsC;sCAEO;AAMtC,MAAMA,+BAA+B,CAC1CC,OACAC;IAEAC,IAAAA,4BAAAA,EAAgCF;IAEhC,MAAM,EAAEG,oBAAoB,EAAE,GAAGH;IAEjC,OAAA,WAAA,GACEI,IAAAA,eAAA,EAACC,kDAAAA,EAAAA;QAA6BC,OAAOL,cAAcM,aAAa;kBAC9D,WAAA,GAAAH,IAAAA,eAAA,EAACI,yBAAAA,EAAAA;YAASC,gBAAgBN;sBACxB,WAAA,GAAAO,IAAAA,gBAAA,EAACV,MAAMW,IAAI,EAAA;;kCACTP,IAAAA,eAAA,EAACJ,MAAMY,eAAe,EAAA,CAAA;oBACrBZ,MAAMa,cAAc,IAAA,WAAA,GAAIT,IAAAA,eAAA,EAACJ,MAAMa,cAAc,EAAA,CAAA;oBAC7Cb,MAAMc,cAAc,IAAA,WAAA,GAAIV,IAAAA,eAAA,EAACJ,MAAMc,cAAc,EAAA,CAAA;;;;;AAKxD"}
|
package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState) => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["renderReferenceOverflowButton_unstable","state","assertSlots","id","shouldRenderOverflowButton","_jsx","OverflowItem","priority","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState): JSXElement | null => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["renderReferenceOverflowButton_unstable","state","assertSlots","id","shouldRenderOverflowButton","_jsx","OverflowItem","priority","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;iCAE0C;AAOnC,MAAMA,yCAAyC,CAACC;IACrDC,IAAAA,4BAAAA,EAA0CD;IAC1C,MAAM,EAAEE,EAAE,EAAEC,0BAA0B,EAAE,GAAGH;IAE3C,OAAOG,6BAAAA,WAAAA,GACLC,IAAAA,eAAA,EAACC,6BAAAA,EAAAA;QAAsBH,IAAIA;QAAII,UAAU;kBACvC,WAAA,GAAAF,IAAAA,eAAA,EAACJ,MAAMO,IAAI,EAAA,CAAA;OADML,MAGjB;AACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>) =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","createContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiBaA,oBAAAA;eAAAA;;IAaAC,4BAAAA;eAAAA;;IAEAC,gCAAAA;eAAAA;;;sCAhCqC;AAiB3C,MAAMF,uBAA2DG,IAAAA,mCAAAA,EAEtEC;AAEF,MAAMC,mCAA8D;IAClEC,uBAAuB;IACvBC,sBAAsBH;IACtBI,oCAAoC;QAAEC,SAAS;IAAM;IACrDC,kBAAkB;QAAED,SAAS;IAAK;IAClCE,mBAAmB;IACnBC,sBAAsB;AACxB;AAEO,MAAMX,+BAA+BD,qBAAqBa,QAAQ;AAElE,MAAMX,mCAAmC,CAAIY,WAClDC,IAAAA,wCAAAA,EAAmBf,sBAAsB,CAACgB,MAAMX,gCAAgC,GAAKS,SAASE"}
|
|
1
|
+
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>): T =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","createContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiBaA,oBAAAA;eAAAA;;IAaAC,4BAAAA;eAAAA;;IAEAC,gCAAAA;eAAAA;;;sCAhCqC;AAiB3C,MAAMF,uBAA2DG,IAAAA,mCAAAA,EAEtEC;AAEF,MAAMC,mCAA8D;IAClEC,uBAAuB;IACvBC,sBAAsBH;IACtBI,oCAAoC;QAAEC,SAAS;IAAM;IACrDC,kBAAkB;QAAED,SAAS;IAAK;IAClCE,mBAAmB;IACnBC,sBAAsB;AACxB;AAEO,MAAMX,+BAA+BD,qBAAqBa,QAAQ;AAElE,MAAMX,mCAAmC,CAAIY,WAClDC,IAAAA,wCAAAA,EAAmBf,sBAAsB,CAACgB,MAAMX,gCAAgC,GAAKS,SAASE"}
|
|
@@ -45,13 +45,17 @@ const generateReferenceCitationPreview = (props)=>{
|
|
|
45
45
|
}, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewTrigger, null, /*#__PURE__*/ _react.createElement(_Citation.Citation, {
|
|
46
46
|
...citationProps,
|
|
47
47
|
...props
|
|
48
|
-
}, index)), /*#__PURE__*/ _react.createElement(_reactpreview.PreviewSurface,
|
|
48
|
+
}, index)), /*#__PURE__*/ _react.createElement(_reactpreview.PreviewSurface, {
|
|
49
|
+
tabIndex: 0,
|
|
50
|
+
...citationPreviewSurfaceProps
|
|
51
|
+
}, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewContent, null, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewHeader, {
|
|
49
52
|
citation: /*#__PURE__*/ _react.createElement(CitationCloseButton, {
|
|
50
53
|
"aria-label": `Close Reference ${index}`,
|
|
51
54
|
referenceHref: "#",
|
|
52
55
|
tabIndex: -1
|
|
53
56
|
}, index),
|
|
54
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic
|
|
57
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
58
|
+
...previewHeaderProps
|
|
55
59
|
}, referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children), /*#__PURE__*/ _react.createElement(_reactpreview.PreviewMetadata, {
|
|
56
60
|
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
57
61
|
primaryText: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.primaryText,
|
|
@@ -73,7 +77,10 @@ const generateReferenceCitationPreview = (props)=>{
|
|
|
73
77
|
trapFocus: true,
|
|
74
78
|
withArrow: true,
|
|
75
79
|
...referencePreviewProps
|
|
76
|
-
}, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewTrigger, null, /*#__PURE__*/ _react.createElement(_Reference.Reference, mergedReferenceProps)), /*#__PURE__*/ _react.createElement(_reactpreview.PreviewSurface,
|
|
80
|
+
}, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewTrigger, null, /*#__PURE__*/ _react.createElement(_Reference.Reference, mergedReferenceProps)), /*#__PURE__*/ _react.createElement(_reactpreview.PreviewSurface, {
|
|
81
|
+
tabIndex: 0,
|
|
82
|
+
...referencePreviewSurfaceProps
|
|
83
|
+
}, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewContent, null, /*#__PURE__*/ _react.createElement(_reactpreview.PreviewHeader, {
|
|
77
84
|
citation: /*#__PURE__*/ _react.createElement(CitationCloseButton, {
|
|
78
85
|
"aria-label": `Close Reference ${index}`,
|
|
79
86
|
referenceHref: "#",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["generateReferenceCitationPreview.tsx"],"sourcesContent":["import * 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 '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\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 ReferenceCitationPreviewGeneratorProps = {\n citationPreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type ReferenceCitationPreviewGenerator = (props: ReferenceCitationPreviewGeneratorProps) => {\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\n/**\n * Function to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the function.\n * Props can either be passed in to the function or applied directly to the generated components in JSX.\n *\n * A `useReferenceCitationPreview` hook exists that calls this function and memoizes its return value based on the props.\n * You should use the hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const generateReferenceCitationPreview: ReferenceCitationPreviewGenerator = 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 CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"above\" 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={`Close Reference ${index}`} 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=\"above\" 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={`Close Reference ${index}`} 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 const components = {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\n };\n\n return components;\n};\n"],"names":["generateReferenceCitationPreview","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","onCitationCloseButtonClick","mergeCallbacks","onClick","createElement","Citation","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","previewHeaderProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","CitationWithPreview","Preview","closeOnScroll","positioning","size","trapFocus","withArrow","PreviewTrigger","PreviewSurface","PreviewContent","PreviewHeader","citation","aria-label","referenceHref","tabIndex","media","graphic","children","PreviewMetadata","icon","primaryText","secondaryText","tertiaryText","SensitivityLabel","content","ReferenceWithPreview","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AAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAqB2B,aAAa;YACjDC,cAAc5B,wBAAAA,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAqB4B,YAAY;YAEhDvB,yBAAAA,WAAAA,GAAyBnB,OAAAO,aAAA,CAACoC,uCAAAA,EAAqBxB,wBAC/CL,CAAAA,+BAAAA,wBAAAA,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAqB8B,OAAO,AAAPA,MAAO,QAA5B9B,iCAAAA,KAAAA,IAAAA,+BAAgCE,0BAAAA,QAAAA,0BAAAA,KAAAA,IAAAA,KAAAA,IAAAA,sBAAuBqB,QAAQ;IAK1E;IAEA,MAAMW,aAAa;QACjBxC,UAAUY;QACV2B,WAAWF;IACb;IAEA,OAAOG;AACT"}
|
|
1
|
+
{"version":3,"sources":["generateReferenceCitationPreview.tsx"],"sourcesContent":["import * 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 '../Reference';\nimport type { CitationProps } from '../Citation';\nimport type { ReferenceProps } from '../Reference';\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 ReferenceCitationPreviewGeneratorProps = {\n citationPreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n previewHeaderProps?: PreviewHeaderProps;\n referencePreviewProps?: Omit<PreviewProps, 'children'> & Partial<Pick<PreviewProps, 'children'>>;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type ReferenceCitationPreviewGenerator = (props: ReferenceCitationPreviewGeneratorProps) => {\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\n/**\n * Function to generate a Citation - Reference pair with correctly wired props.\n * Both the Citation and the Reference act as trigger components to Previews that are also correctly wired by the function.\n * Props can either be passed in to the function or applied directly to the generated components in JSX.\n *\n * A `useReferenceCitationPreview` hook exists that calls this function and memoizes its return value based on the props.\n * You should use the hook when the props used to generate the Citation - Reference pair can change dynamically.\n * If they are static, or in case you wanted to generate multiple pairs within a cycle, you should call\n * `generateReferenceCitationPreview` directly.\n *\n * @returns A Citation - Reference pair with correctly wired props.\n */\nexport const generateReferenceCitationPreview: ReferenceCitationPreviewGenerator = 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 CitationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"above\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface tabIndex={0} {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n {...previewHeaderProps}\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=\"above\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface tabIndex={0} {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Close Reference ${index}`} 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 const components = {\n Citation: CitationWithPreview,\n Reference: ReferenceWithPreview,\n };\n\n return components;\n};\n"],"names":["generateReferenceCitationPreview","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","onCitationCloseButtonClick","mergeCallbacks","onClick","createElement","Citation","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","previewHeaderProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","CitationWithPreview","Preview","closeOnScroll","positioning","size","trapFocus","withArrow","PreviewTrigger","PreviewSurface","tabIndex","PreviewContent","PreviewHeader","citation","aria-label","referenceHref","media","graphic","children","PreviewMetadata","icon","primaryText","secondaryText","tertiaryText","SensitivityLabel","content","ReferenceWithPreview","mergedReferenceProps","Reference","components"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAsFaA;;;eAAAA;;;;iEAtFU;iCAEoC;8BASpD;uCAC0B;0BASR;2BACC;AAiC1B,6IAA6I;AAC7I,MAAMC,sBAAsB,CAACC;IAC3B,MAAMC,iBAAiBC,IAAAA,2CAAAA,EAA2BC,CAAAA,UAAWA,QAAQC,OAAO;IAE5E,MAAMC,sBAAsBC,OAAMC,WAAW,CAC3CC,CAAAA;QACEP,eAAeO,IAAI;QAEnB,iBAAiB;QACjBA,GAAGC,cAAc;IACnB,GACA;QAACR;KAAe;IAGlB,MAAMS,6BAA6BC,IAAAA,+BAAAA,EAAeN,qBAAqBL,yBAAyBY,OAAO;IAEvG,OAAA,WAAA,GAAON,OAAAO,aA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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.7",
|
|
4
4
|
"description": "Fluent AI controls for citations and references",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,25 +12,25 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/react-preview": "^0.8.
|
|
16
|
-
"@fluentui-copilot/react-provider": "^0.12.
|
|
17
|
-
"@fluentui-copilot/react-sensitivity-label": "^0.8.
|
|
18
|
-
"@fluentui-copilot/react-utilities": "
|
|
19
|
-
"@fluentui-copilot/tokens": "^0.3.
|
|
15
|
+
"@fluentui-copilot/react-preview": "^0.8.7",
|
|
16
|
+
"@fluentui-copilot/react-provider": "^0.12.7",
|
|
17
|
+
"@fluentui-copilot/react-sensitivity-label": "^0.8.7",
|
|
18
|
+
"@fluentui-copilot/react-utilities": "~0.0.12",
|
|
19
|
+
"@fluentui-copilot/tokens": "^0.3.15",
|
|
20
20
|
"@swc/helpers": "^0.5.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@fluentui/keyboard-keys": ">=9.0.8 <10.0.0",
|
|
24
|
-
"@fluentui/react-components": ">=9.
|
|
25
|
-
"@fluentui/react-context-selector": ">=9.2.
|
|
24
|
+
"@fluentui/react-components": ">=9.69.0 <10.0.0",
|
|
25
|
+
"@fluentui/react-context-selector": ">=9.2.7 <10.0.0",
|
|
26
26
|
"@fluentui/react-icons": ">=2.0.303 <3.0.0",
|
|
27
|
-
"@fluentui/react-jsx-runtime": ">=9.
|
|
28
|
-
"@fluentui/react-shared-contexts": ">=9.
|
|
29
|
-
"@fluentui/react-utilities": ">=9.
|
|
30
|
-
"@types/react": ">=16.14.0 <
|
|
31
|
-
"@types/react-dom": ">=16.9.8 <
|
|
32
|
-
"react": ">=16.14.0 <
|
|
33
|
-
"react-dom": ">=16.14.0 <
|
|
27
|
+
"@fluentui/react-jsx-runtime": ">=9.2.0 <10.0.0",
|
|
28
|
+
"@fluentui/react-shared-contexts": ">=9.25.1 <10.0.0",
|
|
29
|
+
"@fluentui/react-utilities": ">=9.24.1 <10.0.0",
|
|
30
|
+
"@types/react": ">=16.14.0 <20.0.0",
|
|
31
|
+
"@types/react-dom": ">=16.9.8 <20.0.0",
|
|
32
|
+
"react": ">=16.14.0 <20.0.0",
|
|
33
|
+
"react-dom": ">=16.14.0 <20.0.0"
|
|
34
34
|
},
|
|
35
35
|
"beachball": {
|
|
36
36
|
"disallowedChangeTypes": [
|