@fluentui-copilot/react-reference 0.0.0-nightly-20240520-0407-55b74dbd.1 → 0.0.0-nightly-20240523-0404-0f9673a1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +9 -9
- package/CHANGELOG.md +7 -7
- package/dist/index.d.ts +4 -4
- package/lib/components/reference-v2/Reference/Reference.types.js.map +1 -1
- package/lib/components/reference-v2/Reference/renderReference.js +1 -1
- package/lib/components/reference-v2/Reference/renderReference.js.map +1 -1
- package/lib/components/reference-v2/Reference/useReference.js +7 -7
- package/lib/components/reference-v2/Reference/useReference.js.map +1 -1
- package/lib/components/reference-v2/Reference/useReferenceStyles.js +7 -7
- package/lib/components/reference-v2/Reference/useReferenceStyles.js.map +1 -1
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js +8 -5
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReference.js +7 -7
- package/lib-commonjs/components/reference-v2/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.js +9 -9
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.js.map +1 -1
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js +8 -5
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -1
- package/package.json +10 -10
package/CHANGELOG.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
6
|
-
"tag": "@fluentui-copilot/react-reference_v0.0.0-nightly-
|
|
7
|
-
"version": "0.0.0-nightly-
|
|
5
|
+
"date": "Thu, 23 May 2024 04:10:37 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-reference_v0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
7
|
+
"version": "0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
8
8
|
"comments": {
|
|
9
9
|
"prerelease": [
|
|
10
10
|
{
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
{
|
|
17
17
|
"author": "beachball",
|
|
18
18
|
"package": "@fluentui-copilot/react-reference",
|
|
19
|
-
"comment": "Bump @fluentui-copilot/react-preview to v0.0.0-nightly-
|
|
20
|
-
"commit": "
|
|
19
|
+
"comment": "Bump @fluentui-copilot/react-preview to v0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
20
|
+
"commit": "a5e07def327b056a91073e1e8cb4f833588faeee"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"author": "beachball",
|
|
24
24
|
"package": "@fluentui-copilot/react-reference",
|
|
25
|
-
"comment": "Bump @fluentui-copilot/react-provider to v0.0.0-nightly-
|
|
26
|
-
"commit": "
|
|
25
|
+
"comment": "Bump @fluentui-copilot/react-provider to v0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
26
|
+
"commit": "a5e07def327b056a91073e1e8cb4f833588faeee"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"author": "beachball",
|
|
30
30
|
"package": "@fluentui-copilot/react-reference",
|
|
31
|
-
"comment": "Bump @fluentui-copilot/react-sensitivity-label to v0.0.0-nightly-
|
|
32
|
-
"commit": "
|
|
31
|
+
"comment": "Bump @fluentui-copilot/react-sensitivity-label to v0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
32
|
+
"commit": "a5e07def327b056a91073e1e8cb4f833588faeee"
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-reference
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 23 May 2024 04:10:37 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## [0.0.0-nightly-
|
|
7
|
+
## [0.0.0-nightly-20240523-0404-0f9673a1.1](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.0.0-nightly-20240523-0404-0f9673a1.1)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.11.2..@fluentui-copilot/react-reference_v0.0.0-nightly-
|
|
9
|
+
Thu, 23 May 2024 04:10:37 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.11.2..@fluentui-copilot/react-reference_v0.0.0-nightly-20240523-0404-0f9673a1.1)
|
|
11
11
|
|
|
12
12
|
### Changes
|
|
13
13
|
|
|
14
14
|
- Release nightly ([commit](https://github.com/microsoft/fluentai/commit/not available) by fluentui-internal@service.microsoft.com)
|
|
15
|
-
- Bump @fluentui-copilot/react-preview to v0.0.0-nightly-
|
|
16
|
-
- Bump @fluentui-copilot/react-provider to v0.0.0-nightly-
|
|
17
|
-
- Bump @fluentui-copilot/react-sensitivity-label to v0.0.0-nightly-
|
|
15
|
+
- Bump @fluentui-copilot/react-preview to v0.0.0-nightly-20240523-0404-0f9673a1.1 ([commit](https://github.com/microsoft/fluentai/commit/a5e07def327b056a91073e1e8cb4f833588faeee) by beachball)
|
|
16
|
+
- Bump @fluentui-copilot/react-provider to v0.0.0-nightly-20240523-0404-0f9673a1.1 ([commit](https://github.com/microsoft/fluentai/commit/a5e07def327b056a91073e1e8cb4f833588faeee) by beachball)
|
|
17
|
+
- Bump @fluentui-copilot/react-sensitivity-label to v0.0.0-nightly-20240523-0404-0f9673a1.1 ([commit](https://github.com/microsoft/fluentai/commit/a5e07def327b056a91073e1e8cb4f833588faeee) by beachball)
|
|
18
18
|
|
|
19
19
|
## [0.11.2](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.11.2)
|
|
20
20
|
|
package/dist/index.d.ts
CHANGED
|
@@ -356,7 +356,7 @@ export declare const ReferenceV2: ForwardRefComponent<ReferenceV2Props>;
|
|
|
356
356
|
export declare const referenceV2ClassNames: SlotClassNames<ReferenceV2Slots>;
|
|
357
357
|
|
|
358
358
|
export declare const referenceV2ExtraClassNames: {
|
|
359
|
-
|
|
359
|
+
graphicChild: string;
|
|
360
360
|
};
|
|
361
361
|
|
|
362
362
|
export declare type ReferenceV2Props = ComponentProps<Partial<ReferenceV2Slots>> & {
|
|
@@ -368,11 +368,11 @@ export declare type ReferenceV2Props = ComponentProps<Partial<ReferenceV2Slots>>
|
|
|
368
368
|
};
|
|
369
369
|
|
|
370
370
|
export declare type ReferenceV2Slots = {
|
|
371
|
-
root: NonNullable<Slot<'button'>>;
|
|
371
|
+
root: NonNullable<Slot<'button', 'a'>>;
|
|
372
372
|
citation?: Slot<'span'>;
|
|
373
373
|
divider?: Slot<'span'>;
|
|
374
374
|
content?: Slot<'span'>;
|
|
375
|
-
|
|
375
|
+
graphic?: Slot<'span'>;
|
|
376
376
|
};
|
|
377
377
|
|
|
378
378
|
export declare type ReferenceV2State = ComponentState<ReferenceV2Slots> & Required<Pick<ReferenceV2Props, 'appearance' | 'id'>> & Pick<ReferenceListV2State, 'shouldUseOverflow'>;
|
|
@@ -602,6 +602,6 @@ export declare const useReferenceStylesV2_unstable: (state: ReferenceV2State) =>
|
|
|
602
602
|
* @param props - props from this instance of Reference
|
|
603
603
|
* @param ref - reference to root HTMLElement of Reference
|
|
604
604
|
*/
|
|
605
|
-
export declare const useReferenceV2_unstable: (props: ReferenceV2Props, ref: React_2.Ref<HTMLButtonElement>) => ReferenceV2State;
|
|
605
|
+
export declare const useReferenceV2_unstable: (props: ReferenceV2Props, ref: React_2.Ref<HTMLButtonElement | HTMLAnchorElement>) => ReferenceV2State;
|
|
606
606
|
|
|
607
607
|
export { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button', 'a'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {\n /**\n * The appearance of the reference.\n * @default 'lighter'\n */\n appearance?: 'lighter' | 'darker';\n};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'appearance' | 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":"AAmBA,WAEgD"}
|
|
@@ -8,7 +8,7 @@ export const renderReference_unstable = state => {
|
|
|
8
8
|
} = state;
|
|
9
9
|
const reference = /*#__PURE__*/_jsxs(state.root, {
|
|
10
10
|
children: [state.citation && /*#__PURE__*/_jsx(state.citation, {}), state.divider && /*#__PURE__*/_jsx(state.divider, {}), state.content && /*#__PURE__*/_jsxs(state.content, {
|
|
11
|
-
children: [state.
|
|
11
|
+
children: [state.graphic && /*#__PURE__*/_jsx(state.graphic, {}), state.root.children]
|
|
12
12
|
})]
|
|
13
13
|
});
|
|
14
14
|
return shouldUseOverflow ? /*#__PURE__*/_jsx(OverflowItem, {
|
|
@@ -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.
|
|
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;AAGvE,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"}
|
|
@@ -28,12 +28,12 @@ export const useReference_unstable = (props, ref) => {
|
|
|
28
28
|
const citation = slot.optional(props.citation, {
|
|
29
29
|
elementType: 'span'
|
|
30
30
|
});
|
|
31
|
-
const
|
|
31
|
+
const graphic = slot.optional(props.graphic, {
|
|
32
32
|
elementType: 'span'
|
|
33
33
|
});
|
|
34
34
|
const content = slot.optional(props.content, {
|
|
35
35
|
elementType: 'span',
|
|
36
|
-
renderByDefault:
|
|
36
|
+
renderByDefault: graphic !== undefined || !!children
|
|
37
37
|
});
|
|
38
38
|
const divider = slot.optional(props.divider, {
|
|
39
39
|
elementType: 'span',
|
|
@@ -47,7 +47,7 @@ export const useReference_unstable = (props, ref) => {
|
|
|
47
47
|
root: 'button',
|
|
48
48
|
citation: 'span',
|
|
49
49
|
divider: 'span',
|
|
50
|
-
|
|
50
|
+
graphic: 'span',
|
|
51
51
|
content: 'span'
|
|
52
52
|
},
|
|
53
53
|
root: slot.always(getIntrinsicElementProps('button', {
|
|
@@ -60,11 +60,11 @@ export const useReference_unstable = (props, ref) => {
|
|
|
60
60
|
citation,
|
|
61
61
|
divider,
|
|
62
62
|
content,
|
|
63
|
-
|
|
63
|
+
graphic
|
|
64
64
|
};
|
|
65
|
-
if (state.
|
|
66
|
-
state.
|
|
67
|
-
className: mergeClasses(state.
|
|
65
|
+
if (state.graphic && React.isValidElement(state.graphic.children)) {
|
|
66
|
+
state.graphic.children = React.cloneElement(state.graphic.children, {
|
|
67
|
+
className: mergeClasses(state.graphic.children.props.className, referenceExtraClassNames.graphicChild)
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
return state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (props: ReferenceProps
|
|
1
|
+
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { children, id } = props;\n\n const { ctxAppearance, shouldUseOverflow } = useReferenceListContext_unstable(ctx => ({\n ctxAppearance: ctx.appearance,\n shouldUseOverflow: ctx.shouldUseOverflow,\n }));\n const appearance = props.appearance || ctxAppearance;\n\n const referenceId = useId('reference-', id);\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n appearance,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n ...props,\n id: referenceId,\n }),\n { elementType: 'button' },\n ),\n citation,\n divider,\n content,\n graphic,\n };\n\n if (state.graphic && React.isValidElement<HTMLElement>(state.graphic.children)) {\n state.graphic.children = React.cloneElement(state.graphic.children, {\n className: mergeClasses(state.graphic.children.props.className, referenceExtraClassNames.graphicChild),\n });\n }\n\n return state;\n};\n"],"names":["React","getIntrinsicElementProps","mergeClasses","slot","useId","useReferenceListContext_unstable","referenceExtraClassNames","useReference_unstable","props","ref","children","id","ctxAppearance","shouldUseOverflow","ctx","appearance","referenceId","citation","optional","elementType","graphic","content","renderByDefault","undefined","divider","state","components","root","always","isValidElement","cloneElement","className","graphicChild"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,IAAI,EAAEC,KAAK,QAAQ,6BAA6B;AACjG,SAASC,gCAAgC,QAAQ,sDAAsD;AACvG,SAASC,wBAAwB,QAAQ,uBAAuB;AAGhE;;;;;;;;CAQC,GACD,OAAO,MAAMC,wBAAwB,CACnCC,OACAC;IAEA,MAAM,EAAEC,QAAQ,EAAEC,EAAE,EAAE,GAAGH;IAEzB,MAAM,EAAEI,aAAa,EAAEC,iBAAiB,EAAE,GAAGR,iCAAiCS,CAAAA,MAAQ,CAAA;YACpFF,eAAeE,IAAIC,UAAU;YAC7BF,mBAAmBC,IAAID,iBAAiB;QAC1C,CAAA;IACA,MAAME,aAAaP,MAAMO,UAAU,IAAIH;IAEvC,MAAMI,cAAcZ,MAAM,cAAcO;IAExC,MAAMM,WAAWd,KAAKe,QAAQ,CAACV,MAAMS,QAAQ,EAAE;QAAEE,aAAa;IAAO;IACrE,MAAMC,UAAUjB,KAAKe,QAAQ,CAACV,MAAMY,OAAO,EAAE;QAAED,aAAa;IAAO;IACnE,MAAME,UAAUlB,KAAKe,QAAQ,CAACV,MAAMa,OAAO,EAAE;QAC3CF,aAAa;QACbG,iBAAiBF,YAAYG,aAAa,CAAC,CAACb;IAC9C;IACA,MAAMc,UAAUrB,KAAKe,QAAQ,CAACV,MAAMgB,OAAO,EAAE;QAC3CL,aAAa;QACbG,iBAAiBL,aAAaM,aAAaF,YAAYE;IACzD;IAEA,MAAME,QAAwB;QAC5BV;QACAJ,IAAIK;QACJH;QAEAa,YAAY;YACVC,MAAM;YACNV,UAAU;YACVO,SAAS;YACTJ,SAAS;YACTC,SAAS;QACX;QAEAM,MAAMxB,KAAKyB,MAAM,CACf3B,yBAAyB,UAAU;YACjCQ;YACA,GAAGD,KAAK;YACRG,IAAIK;QACN,IACA;YAAEG,aAAa;QAAS;QAE1BF;QACAO;QACAH;QACAD;IACF;IAEA,IAAIK,MAAML,OAAO,IAAIpB,MAAM6B,cAAc,CAAcJ,MAAML,OAAO,CAACV,QAAQ,GAAG;QAC9Ee,MAAML,OAAO,CAACV,QAAQ,GAAGV,MAAM8B,YAAY,CAACL,MAAML,OAAO,CAACV,QAAQ,EAAE;YAClEqB,WAAW7B,aAAauB,MAAML,OAAO,CAACV,QAAQ,CAACF,KAAK,CAACuB,SAAS,EAAEzB,yBAAyB0B,YAAY;QACvG;IACF;IAEA,OAAOP;AACT,EAAE"}
|
|
@@ -3,13 +3,13 @@ export const referenceClassNames = {
|
|
|
3
3
|
root: 'fai-Reference',
|
|
4
4
|
citation: 'fai-Reference__citation',
|
|
5
5
|
divider: 'fai-Reference__divider',
|
|
6
|
-
|
|
6
|
+
graphic: 'fai-Reference__graphic',
|
|
7
7
|
content: 'fai-Reference__content'
|
|
8
8
|
};
|
|
9
9
|
export const referenceExtraClassNames = {
|
|
10
|
-
|
|
10
|
+
graphicChild: 'fai-Reference__graphicChild'
|
|
11
11
|
};
|
|
12
|
-
const
|
|
12
|
+
const GRAPHIC_SIZE = '16px';
|
|
13
13
|
const useRootBaseClassName = __resetStyles("r1aeqif9", null, [".r1aeqif9{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);}", ".r1aeqif9:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}", ".r1aeqif9:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}", ".r1aeqif9:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}", ".r1aeqif9:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}"]);
|
|
14
14
|
export const useRootStyles = __styles({
|
|
15
15
|
darker: {
|
|
@@ -37,7 +37,7 @@ const useDividerStyles = __styles({
|
|
|
37
37
|
}, {
|
|
38
38
|
d: [".f1d3jkam{background-color:var(--colorNeutralStroke1);}"]
|
|
39
39
|
});
|
|
40
|
-
const
|
|
40
|
+
const useGraphicBaseClassName = __resetStyles("rjrtsj7", null, [".rjrtsj7{font-size:16px;height:16px;line-height:16px;width:16px;}", ".rjrtsj7>.fai-Reference__graphicChild{height:16px;width:16px;}"]);
|
|
41
41
|
const useContentBaseClassName = __resetStyles("r1yvxokd", null, [".r1yvxokd{column-gap:var(--spacingHorizontalSNudge);display:inline-flex;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"]);
|
|
42
42
|
/**
|
|
43
43
|
* Apply styling to the Reference slots based on the state
|
|
@@ -50,7 +50,7 @@ export const useReferenceStyles_unstable = state => {
|
|
|
50
50
|
const citationBaseClassName = useCitationBaseClassName();
|
|
51
51
|
const dividerBaseClassName = useDividerBaseClassName();
|
|
52
52
|
const contentBaseClassName = useContentBaseClassName();
|
|
53
|
-
const
|
|
53
|
+
const graphicBaseClassName = useGraphicBaseClassName();
|
|
54
54
|
const rootStyles = useRootStyles();
|
|
55
55
|
const dividerStyles = useDividerStyles();
|
|
56
56
|
state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, appearance === 'darker' && rootStyles.darker, state.root.className);
|
|
@@ -63,8 +63,8 @@ export const useReferenceStyles_unstable = state => {
|
|
|
63
63
|
if (state.content) {
|
|
64
64
|
state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
65
65
|
}
|
|
66
|
-
if (state.
|
|
67
|
-
state.
|
|
66
|
+
if (state.graphic) {
|
|
67
|
+
state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);
|
|
68
68
|
}
|
|
69
69
|
return state;
|
|
70
70
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n graphic: 'fai-Reference__graphic',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n graphicChild: 'fai-Reference__graphicChild',\n};\n\nconst GRAPHIC_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n darker: {\n backgroundColor: tokens.colorNeutralBackground5,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground5Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground5Pressed,\n },\n },\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useDividerStyles = makeStyles({\n darker: {\n backgroundColor: tokens.colorNeutralStroke1,\n },\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n fontSize: GRAPHIC_SIZE,\n height: GRAPHIC_SIZE,\n lineHeight: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n\n [`> .${referenceExtraClassNames.graphicChild}`]: {\n height: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n const { appearance } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n const rootStyles = useRootStyles();\n const dividerStyles = useDividerStyles();\n\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootBaseClassName,\n appearance === 'darker' && rootStyles.darker,\n state.root.className,\n );\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(\n referenceClassNames.divider,\n dividerBaseClassName,\n appearance === 'darker' && dividerStyles.darker,\n state.divider.className,\n );\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","referenceClassNames","root","citation","divider","graphic","content","referenceExtraClassNames","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","alignItems","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","boxSizing","color","colorNeutralForeground2","columnGap","spacingHorizontalXXS","display","flexShrink","justifyContent","padding","spacingVerticalXXS","spacingHorizontalS","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useRootStyles","darker","colorNeutralBackground5","colorNeutralStroke1","colorNeutralBackground5Hover","colorNeutralBackground5Pressed","overflow","width","useCitationBaseClassName","caption2Strong","useDividerBaseClassName","height","margin","spacingVerticalNone","spacingHorizontalXS","useDividerStyles","useGraphicBaseClassName","fontSize","lineHeight","useContentBaseClassName","spacingHorizontalSNudge","caption1","useReferenceStyles_unstable","state","appearance","rootBaseClassName","citationBaseClassName","dividerBaseClassName","contentBaseClassName","graphicBaseClassName","rootStyles","dividerStyles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,UAAU;IACVC,SAAS;IACTC,SAAS;IACTC,SAAS;AACX,EAAE;AAEF,OAAO,MAAMC,2BAA2B;IACtCC,cAAc;AAChB,EAAE;AAEF,MAAMC,eAAe;AAErB,MAAMC,uBAAuBf,gBAAgB;IAC3CgB,YAAY;IACZC,iBAAiBb,OAAOc,uBAAuB;IAC/CC,QAAQ,CAAC,EAAEf,OAAOgB,eAAe,CAAC,OAAO,EAAEhB,OAAOiB,mBAAmB,CAAC,CAAC;IACvEC,cAAclB,OAAOmB,kBAAkB;IACvCC,WAAW;IACXC,OAAOrB,OAAOsB,uBAAuB;IACrCC,WAAWvB,OAAOwB,oBAAoB;IACtCC,SAAS;IACTC,YAAY;IACZC,gBAAgB;IACh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,IAAIT,MAAMvD,OAAO,EAAE;QACjBuD,MAAMvD,OAAO,CAACgE,SAAS,GAAGxE,aAAaI,oBAAoBI,OAAO,EAAE6D,sBAAsBN,MAAMvD,OAAO,CAACgE,SAAS;IACnH;IAEA,OAAOT;AACT,EAAE"}
|
|
@@ -57,7 +57,7 @@ export const useReferenceCitationPreview = props => {
|
|
|
57
57
|
tabIndex: -1,
|
|
58
58
|
children: index
|
|
59
59
|
}),
|
|
60
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.
|
|
60
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
61
61
|
children: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children
|
|
62
62
|
}), /*#__PURE__*/_jsx(PreviewMetadata, {
|
|
63
63
|
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
@@ -72,6 +72,11 @@ export const useReferenceCitationPreview = props => {
|
|
|
72
72
|
});
|
|
73
73
|
};
|
|
74
74
|
const referenceWithPreview = props => {
|
|
75
|
+
const mergedReferenceProps = {
|
|
76
|
+
citation: index,
|
|
77
|
+
...referenceProps,
|
|
78
|
+
...props
|
|
79
|
+
};
|
|
75
80
|
var _previewContentProps_content;
|
|
76
81
|
return /*#__PURE__*/_jsxs(Preview, {
|
|
77
82
|
closeOnScroll: true,
|
|
@@ -82,9 +87,7 @@ export const useReferenceCitationPreview = props => {
|
|
|
82
87
|
...referencePreviewProps,
|
|
83
88
|
children: [/*#__PURE__*/_jsx(PreviewTrigger, {
|
|
84
89
|
children: /*#__PURE__*/_jsx(Reference, {
|
|
85
|
-
|
|
86
|
-
...referenceProps,
|
|
87
|
-
...props
|
|
90
|
+
...mergedReferenceProps
|
|
88
91
|
})
|
|
89
92
|
}), /*#__PURE__*/_jsx(PreviewSurface, {
|
|
90
93
|
...referencePreviewSurfaceProps,
|
|
@@ -96,7 +99,7 @@ export const useReferenceCitationPreview = props => {
|
|
|
96
99
|
tabIndex: -1,
|
|
97
100
|
children: index
|
|
98
101
|
}),
|
|
99
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.
|
|
102
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
100
103
|
children: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children
|
|
101
104
|
}), /*#__PURE__*/_jsx(PreviewMetadata, {
|
|
102
105
|
icon: previewContentProps === null || previewContentProps === void 0 ? void 0 : previewContentProps.icon,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const citationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media 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 return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference citation={index} {...referenceProps} {...props} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.media as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: citationWithPreview,\n Reference: referenceWithPreview,\n };\n }, [\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n previewContentProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","mergeCallbacks","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","components","useMemo","citationWithPreview","closeOnScroll","positioning","size","trapFocus","withArrow","citation","aria-label","referenceHref","tabIndex","media","children","icon","primaryText","secondaryText","tertiaryText","content","referenceWithPreview"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAE/B,SAASC,cAAc,EAAEC,0BAA0B,QAAQ,6BAA6B;AAExF,SACEC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,cAAc,QACT,kCAAkC;AACzC,SAASC,gBAAgB,QAAQ,4CAA4C;AAS7E,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAgC9C,6IAA6I;AAC7I,MAAMC,sBAAsB,CAACC;IAC3B,MAAMC,iBAAiBZ,2BAA2Ba,CAAAA,UAAWA,QAAQC,OAAO;IAE5E,MAAMC,sBAAsBjB,MAAMkB,WAAW,CAC3CC,CAAAA;QACEL,eAAeK,IAAI;QAEnB,iBAAiB;QACjBA,GAAGC,cAAc;IACnB,GACA;QAACN;KAAe;IAGlB,MAAMO,6BAA6BpB,eAAegB,qBAAqBJ,yBAAyBS,OAAO;IAEvG,qBAAO,KAACZ;QAAU,GAAGG,wBAAwB;QAAES,SAASD;;AAC1D;AAEA,OAAO,MAAME,8BAA2DC,CAAAA;IACtE,MAAM,EACJC,oBAAoB,EACpBC,2BAA2B,EAC3BC,aAAa,EACbC,KAAK,EACLC,mBAAmB,EACnBC,qBAAqB,EACrBC,4BAA4B,EAC5BC,cAAc,EACdC,qBAAqB,EACtB,GAAGT;IAEJ,MAAMU,aAAalC,MAAMmC,OAAO,CAAC;QAC/B,MAAMC,sBAAwCZ,CAAAA;gBA2BnCK;YA1BT,qBACE,MAAC1B;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ACC,KAACC;oCACCqC,wBACE,KAAC9B;wCAAoB+B,cAAY,CAAC,UAAU,EAAEf,MAAM,OAAO,CAAC;wCAAEgB,eAAc;wCAAIC,UAAU,CAAC;kDACxFjB;;oCAGLkB,KAAK,EAAEd,2BAAAA,qCAAAA,eAAgBc,KAAK;8CAE3Bd,2BAAAA,qCAAAA,eAAgBe,QAAQ;;8CAE3B,KAACzC;oCACC0C,IAAI,EAAEnB,gCAAAA,0CAAAA,oBAAqBmB,IAAI;oCAC/BC,WAAW,EAAEpB,gCAAAA,0CAAAA,oBAAqBoB,WAAW;oCAC7CC,aAAa,EAAErB,gCAAAA,0CAAAA,oBAAqBqB,aAAa;oCACjDC,YAAY,EAAEtB,gCAAAA,0CAAAA,oBAAqBsB,YAAY;;gCAEhDlB,uCAAyB,KAACxB;oCAAkB,GAAGwB,qBAAqB;;gCACpEJ,CAAAA,+BAAAA,gCAAAA,0CAAAA,oBAAqBuB,OAAO,cAA5BvB,0CAAAA,+BAAgCC,kCAAAA,4CAAAA,sBAAuBiB,QAAQ;;;;;;QAK1E;QAEA,OAAO;YACLrC,UAAU0B;YACVzB,WAAW0C;QACb;IACF,GAAG;QACD5B;QACAC;QACAC;QACAC;QACAE;QACAC;QACAC;QACAH;QACAI;KACD;IAED,OAAOC;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const citationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const referenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: citationWithPreview,\n Reference: referenceWithPreview,\n };\n }, [\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n previewContentProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["React","mergeCallbacks","usePopoverContext_unstable","Preview","PreviewContent","PreviewHeader","PreviewMetadata","PreviewSurface","PreviewTrigger","SensitivityLabel","Citation","Reference","CitationCloseButton","citationCloseButtonProps","setPopoverOpen","context","setOpen","onPopoverCloseClick","useCallback","ev","preventDefault","onCitationCloseButtonClick","onClick","useReferenceCitationPreview","props","citationPreviewProps","citationPreviewSurfaceProps","citationProps","index","previewContentProps","referencePreviewProps","referencePreviewSurfaceProps","referenceProps","sensitivityLabelProps","components","useMemo","citationWithPreview","closeOnScroll","positioning","size","trapFocus","withArrow","citation","aria-label","referenceHref","tabIndex","media","graphic","children","icon","primaryText","secondaryText","tertiaryText","content","referenceWithPreview","mergedReferenceProps"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,YAAYA,WAAW,QAAQ;AAE/B,SAASC,cAAc,EAAEC,0BAA0B,QAAQ,6BAA6B;AAExF,SACEC,OAAO,EACPC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,cAAc,EACdC,cAAc,QACT,kCAAkC;AACzC,SAASC,gBAAgB,QAAQ,4CAA4C;AAS7E,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAgC9C,6IAA6I;AAC7I,MAAMC,sBAAsB,CAACC;IAC3B,MAAMC,iBAAiBZ,2BAA2Ba,CAAAA,UAAWA,QAAQC,OAAO;IAE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AAAA,sBAAuBkB,QAAQ;;;;;;QAK1E;QAEA,OAAO;YACLtC,UAAU0B;YACVzB,WAAW2C;QACb;IACF,GAAG;QACD7B;QACAC;QACAC;QACAC;QACAE;QACAC;QACAC;QACAH;QACAI;KACD;IAED,OAAOC;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n root: NonNullable<Slot<'button', 'a'>>;\n citation?: Slot<'span'>;\n divider?: Slot<'span'>;\n content?: Slot<'span'>;\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & {\n /**\n * The appearance of the reference.\n * @default 'lighter'\n */\n appearance?: 'lighter' | 'darker';\n};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'appearance' | 'id'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -19,7 +19,7 @@ const renderReference_unstable = (state)=>{
|
|
|
19
19
|
state.divider && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.divider, {}),
|
|
20
20
|
state.content && /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.content, {
|
|
21
21
|
children: [
|
|
22
|
-
state.
|
|
22
|
+
state.graphic && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.graphic, {}),
|
|
23
23
|
state.root.children
|
|
24
24
|
]
|
|
25
25
|
})
|
|
@@ -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.
|
|
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","divider","_jsxs","root","content","_jsx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAMaA;;;eAAAA;;;4BALb;iCAE0C;AAGnC,MAAMA,2BAA2BC,CAAAA;oCACtCC,EAAAA;UAEA,EAEAC,EAAA;sBAGWC,WAAO,GAAAC,IAAAA,gBAAA,EAAAJ,MAAIK,IAACL,EAAAA;kBAClBA;YAAAA,MAAMM,QAAO,IAAA,WACZ,GAAAC,IAAAA,eAACP,EAAAA,MAAMM,QAAO,EAAA,CAAA;YAAAN,MAAAG,OAAA,IAAA,WAAA,GAAAI,IAAAA,eAAA,EAAAP,MAAAG,OAAA,EAAA,CAAA;YAAAH,MAAAM,OAAA,IAAA,WAAA,GAAAF,IAAAA,gBAAA,EAAAJ,MAAAM,OAAA,EAAA;;;;;;;;;;;;8CASSJ"}
|
|
@@ -24,12 +24,12 @@ const useReference_unstable = (props, ref)=>{
|
|
|
24
24
|
const citation = _reactcomponents.slot.optional(props.citation, {
|
|
25
25
|
elementType: 'span'
|
|
26
26
|
});
|
|
27
|
-
const
|
|
27
|
+
const graphic = _reactcomponents.slot.optional(props.graphic, {
|
|
28
28
|
elementType: 'span'
|
|
29
29
|
});
|
|
30
30
|
const content = _reactcomponents.slot.optional(props.content, {
|
|
31
31
|
elementType: 'span',
|
|
32
|
-
renderByDefault:
|
|
32
|
+
renderByDefault: graphic !== undefined || !!children
|
|
33
33
|
});
|
|
34
34
|
const divider = _reactcomponents.slot.optional(props.divider, {
|
|
35
35
|
elementType: 'span',
|
|
@@ -43,7 +43,7 @@ const useReference_unstable = (props, ref)=>{
|
|
|
43
43
|
root: 'button',
|
|
44
44
|
citation: 'span',
|
|
45
45
|
divider: 'span',
|
|
46
|
-
|
|
46
|
+
graphic: 'span',
|
|
47
47
|
content: 'span'
|
|
48
48
|
},
|
|
49
49
|
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('button', {
|
|
@@ -56,11 +56,11 @@ const useReference_unstable = (props, ref)=>{
|
|
|
56
56
|
citation,
|
|
57
57
|
divider,
|
|
58
58
|
content,
|
|
59
|
-
|
|
59
|
+
graphic
|
|
60
60
|
};
|
|
61
|
-
if (state.
|
|
62
|
-
state.
|
|
63
|
-
className: (0, _reactcomponents.mergeClasses)(state.
|
|
61
|
+
if (state.graphic && /*#__PURE__*/ _react.isValidElement(state.graphic.children)) {
|
|
62
|
+
state.graphic.children = /*#__PURE__*/ _react.cloneElement(state.graphic.children, {
|
|
63
|
+
className: (0, _reactcomponents.mergeClasses)(state.graphic.children.props.className, _useReferenceStyles.referenceExtraClassNames.graphicChild)
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
return state;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (props: ReferenceProps
|
|
1
|
+
{"version":3,"sources":["useReference.ts"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (\n props: ReferenceProps,\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>,\n): ReferenceState => {\n const { children, id } = props;\n\n const { ctxAppearance, shouldUseOverflow } = useReferenceListContext_unstable(ctx => ({\n ctxAppearance: ctx.appearance,\n shouldUseOverflow: ctx.shouldUseOverflow,\n }));\n const appearance = props.appearance || ctxAppearance;\n\n const referenceId = useId('reference-', id);\n\n const citation = slot.optional(props.citation, { elementType: 'span' });\n const graphic = slot.optional(props.graphic, { elementType: 'span' });\n const content = slot.optional(props.content, {\n elementType: 'span',\n renderByDefault: graphic !== undefined || !!children,\n });\n const divider = slot.optional(props.divider, {\n elementType: 'span',\n renderByDefault: citation !== undefined && content !== undefined,\n });\n\n const state: ReferenceState = {\n appearance,\n id: referenceId,\n shouldUseOverflow,\n\n components: {\n root: 'button',\n citation: 'span',\n divider: 'span',\n graphic: 'span',\n content: 'span',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref,\n ...props,\n id: referenceId,\n }),\n { elementType: 'button' },\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":["children","props","ctxAppearance","referenceId","shouldUseOverflow","slot","ctx","appearance","optional","graphic","content","elementType","citation","renderByDefault","divider","state","components","undefined","ref","id"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAmBUA;;;eAAAA;;;;iEAnBa;iCAC6C;sCACnB;oCACR;AAgBvC,MAAQA,wBAAiBC,CAAAA,OAAAA;UAEzB,UACEC;UAGF,EAEAA,aAAMC,EAENC,iBAAiBC,+DAA6C,EAAAC,CAAAA,MAAA,CAAA;YAAOJ,eAAAI,IAAAC,UAAA;YACrEH,mBAAgBC,IAAKG,iBAAeC;;UAA+BF,aAAAN,MAAAM,UAAA,IAAAL;UACnEC,cAAgBE,IAAAA,sBAAKG,EAAAA,cAAeE;UAClCC,WAAAA,qBAAa,CAAAH,QAAA,CAAAP,MAAAW,QAAA,EAAA;qBACbC;;UAEFJ,UAAMK,qBAAUT,CAAAA,QAAKG,CAAAA,MAASP,OAAMa,EAAO;qBACzCH;;UAEFD,UAAAL,qBAAA,CAAAG,QAAA,CAAAP,MAAAS,OAAA,EAAA;QAEAC,aAAMI;yBACJR,YAAAA,aAAAA,CAAAA,CAAAA;;UAEAH,UAAAA,qBAAAA,CAAAA,QAAAA,CAAAA,MAAAA,OAAAA,EAAAA;qBAEAY;yBACQJ,aAAAK,aAAAP,YAAAO;;kBAENH;;;;oBAKIT;kBAEFa;sBACGjB;qBACHkB;qBAEF;qBAAER;;cAEJC,qBAAAA,CAAAA,MAAAA,CAAAA,IAAAA,yCAAAA,EAAAA,UAAAA;;eAEAF,KAAAA;gBACAD;QACF,IAAA;YAEAE,aAAUF;;;;QAIVC;QAEAD;IACA"}
|
|
@@ -27,13 +27,13 @@ const referenceClassNames = {
|
|
|
27
27
|
root: 'fai-Reference',
|
|
28
28
|
citation: 'fai-Reference__citation',
|
|
29
29
|
divider: 'fai-Reference__divider',
|
|
30
|
-
|
|
30
|
+
graphic: 'fai-Reference__graphic',
|
|
31
31
|
content: 'fai-Reference__content'
|
|
32
32
|
};
|
|
33
33
|
const referenceExtraClassNames = {
|
|
34
|
-
|
|
34
|
+
graphicChild: 'fai-Reference__graphicChild'
|
|
35
35
|
};
|
|
36
|
-
const
|
|
36
|
+
const GRAPHIC_SIZE = '16px';
|
|
37
37
|
const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r1aeqif9", null, [
|
|
38
38
|
".r1aeqif9{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);}",
|
|
39
39
|
".r1aeqif9:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}",
|
|
@@ -89,9 +89,9 @@ const useDividerStyles = (0, _reactcomponents.__styles)({
|
|
|
89
89
|
".f1d3jkam{background-color:var(--colorNeutralStroke1);}"
|
|
90
90
|
]
|
|
91
91
|
});
|
|
92
|
-
const
|
|
93
|
-
".
|
|
94
|
-
".
|
|
92
|
+
const useGraphicBaseClassName = (0, _reactcomponents.__resetStyles)("rjrtsj7", null, [
|
|
93
|
+
".rjrtsj7{font-size:16px;height:16px;line-height:16px;width:16px;}",
|
|
94
|
+
".rjrtsj7>.fai-Reference__graphicChild{height:16px;width:16px;}"
|
|
95
95
|
]);
|
|
96
96
|
const useContentBaseClassName = (0, _reactcomponents.__resetStyles)("r1yvxokd", null, [
|
|
97
97
|
".r1yvxokd{column-gap:var(--spacingHorizontalSNudge);display:inline-flex;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
|
|
@@ -102,7 +102,7 @@ const useReferenceStyles_unstable = (state)=>{
|
|
|
102
102
|
const citationBaseClassName = useCitationBaseClassName();
|
|
103
103
|
const dividerBaseClassName = useDividerBaseClassName();
|
|
104
104
|
const contentBaseClassName = useContentBaseClassName();
|
|
105
|
-
const
|
|
105
|
+
const graphicBaseClassName = useGraphicBaseClassName();
|
|
106
106
|
const rootStyles = useRootStyles();
|
|
107
107
|
const dividerStyles = useDividerStyles();
|
|
108
108
|
state.root.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.root, rootBaseClassName, appearance === 'darker' && rootStyles.darker, state.root.className);
|
|
@@ -115,8 +115,8 @@ const useReferenceStyles_unstable = (state)=>{
|
|
|
115
115
|
if (state.content) {
|
|
116
116
|
state.content.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
117
117
|
}
|
|
118
|
-
if (state.
|
|
119
|
-
state.
|
|
118
|
+
if (state.graphic) {
|
|
119
|
+
state.graphic.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);
|
|
120
120
|
}
|
|
121
121
|
return state;
|
|
122
122
|
}; //# sourceMappingURL=useReferenceStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n graphic: 'fai-Reference__graphic',\n content: 'fai-Reference__content',\n};\n\nexport const referenceExtraClassNames = {\n graphicChild: 'fai-Reference__graphicChild',\n};\n\nconst GRAPHIC_SIZE = '16px';\n\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n boxSizing: 'border-box',\n color: tokens.colorNeutralForeground2,\n columnGap: tokens.spacingHorizontalXXS,\n display: 'flex',\n flexShrink: 0,\n justifyContent: 'center',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n darker: {\n backgroundColor: tokens.colorNeutralBackground5,\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground5Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground5Pressed,\n },\n },\n overflow: {\n width: '100%',\n },\n});\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useDividerStyles = makeStyles({\n darker: {\n backgroundColor: tokens.colorNeutralStroke1,\n },\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n fontSize: GRAPHIC_SIZE,\n height: GRAPHIC_SIZE,\n lineHeight: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n\n [`> .${referenceExtraClassNames.graphicChild}`]: {\n height: GRAPHIC_SIZE,\n width: GRAPHIC_SIZE,\n },\n});\n\nconst useContentBaseClassName = makeResetStyles({\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n const { appearance } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n const rootStyles = useRootStyles();\n const dividerStyles = useDividerStyles();\n\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootBaseClassName,\n appearance === 'darker' && rootStyles.darker,\n state.root.className,\n );\n\n if (state.citation) {\n state.citation.className = mergeClasses(\n referenceClassNames.citation,\n citationBaseClassName,\n state.citation.className,\n );\n }\n\n if (state.divider) {\n state.divider.className = mergeClasses(\n referenceClassNames.divider,\n dividerBaseClassName,\n appearance === 'darker' && dividerStyles.darker,\n state.divider.className,\n );\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["referenceClassNames","referenceExtraClassNames","shorthands","tokens","alignItems","root","citation","divider","graphic","content","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","makeResetStyles","__styles","backgroundColor","border","borderRadius","boxSizing","color","columnGap","spacingHorizontalXXS","display","flexShrink","padding","a9b677","__resetStyles","useDividerBaseClassName","useDividerStyles","borderColor","useGraphicBaseClassName","useContentBaseClassName","colorNeutralStroke1","rootBaseClassName","dividerBaseClassName","contentBaseClassName","overflow","width","useRootStyles","dividerStyles","state","className","mergeClasses","appearance","rootStyles","darker","useCitationBaseClassName","typographyStyles","caption2Strong","citationBaseClassName","colorNeutralStroke2","margin","graphicBaseClassName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAWaA,mBAAAA;eAAAA;;IAQAC,wBAAAA;eAAAA;;IA2CNC,2BAAuBC;eAAvBD;;IApCLE,aAAY;eAAZA;;;iCApBgB;AAKX,MAAMJ,sBAAsD;UACjEK;cACAC;aACAC;aACAC;aACAC;AACF;AAEO,MAAMR,2BAA2B;kBACtCS;AACF;AAEA,MAAMC,eAAe;AAErB,MAAMC,uBAAuBC,IAAAA,8BAAAA,EAAAA,YAAgB,MAAA;IAAA;IAAA;IAAA;IAAA;IAAA;CAAA;AAC3CT,MAAAA,gBAAYU,IAAAA,yBAAA,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AGN,EAAAA;QACXkC,MAAAA,OAAO,CAAAI,SAAA,GAAAC,IAAAA,6BAAA,EAAA1C,oBAAAS,OAAA,EAAA0B,sBAAAK,MAAA/B,OAAA,CAAAgC,SAAA;IACT;IAEA,IAAMb,MAAAA,OAAAA,EAAAA;QACJiB,MAAAA,OAAQ,CAAAJ,SAAA,GAAAC,IAAAA,6BAAA,EAAA1C,oBAAAQ,OAAA,EAAA4C,sBAAAZ,MAAAhC,OAAA,CAAAiC,SAAA;;WAERD;AACF,GAEA,8CAAgC3B"}
|
|
@@ -63,7 +63,7 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
63
63
|
tabIndex: -1,
|
|
64
64
|
children: index
|
|
65
65
|
}),
|
|
66
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.
|
|
66
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
67
67
|
children: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children
|
|
68
68
|
}),
|
|
69
69
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpreview.PreviewMetadata, {
|
|
@@ -83,6 +83,11 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
85
|
const referenceWithPreview = (props)=>{
|
|
86
|
+
const mergedReferenceProps = {
|
|
87
|
+
citation: index,
|
|
88
|
+
...referenceProps,
|
|
89
|
+
...props
|
|
90
|
+
};
|
|
86
91
|
var _previewContentProps_content;
|
|
87
92
|
return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_reactpreview.Preview, {
|
|
88
93
|
closeOnScroll: true,
|
|
@@ -94,9 +99,7 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
94
99
|
children: [
|
|
95
100
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpreview.PreviewTrigger, {
|
|
96
101
|
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_ReferenceV2.Reference, {
|
|
97
|
-
|
|
98
|
-
...referenceProps,
|
|
99
|
-
...props
|
|
102
|
+
...mergedReferenceProps
|
|
100
103
|
})
|
|
101
104
|
}),
|
|
102
105
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpreview.PreviewSurface, {
|
|
@@ -110,7 +113,7 @@ const useReferenceCitationPreview = (props)=>{
|
|
|
110
113
|
tabIndex: -1,
|
|
111
114
|
children: index
|
|
112
115
|
}),
|
|
113
|
-
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.
|
|
116
|
+
media: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.graphic,
|
|
114
117
|
children: referenceProps === null || referenceProps === void 0 ? void 0 : referenceProps.children
|
|
115
118
|
}),
|
|
116
119
|
/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactpreview.PreviewMetadata, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const citationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.
|
|
1
|
+
{"version":3,"sources":["useReferenceCitationPreview.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport * as React from 'react';\n\nimport { mergeCallbacks, usePopoverContext_unstable } from '@fluentui/react-components';\n\nimport {\n Preview,\n PreviewContent,\n PreviewHeader,\n PreviewMetadata,\n PreviewSurface,\n PreviewTrigger,\n} from '@fluentui-copilot/react-preview';\nimport { SensitivityLabel } from '@fluentui-copilot/react-sensitivity-label';\nimport type {\n PreviewHeaderProps,\n PreviewMetadataProps,\n PreviewProps,\n PreviewSurfaceProps,\n} from '@fluentui-copilot/react-preview';\nimport type { SensitivityLabelProps } from '@fluentui-copilot/react-sensitivity-label';\n\nimport { Citation } from '../../Citation';\nimport { Reference } from '../../ReferenceV2';\nimport type { CitationProps } from '../../Citation';\nimport type { ReferenceProps } from '../../ReferenceV2';\n\nexport type PackagedCitation = React.FC<CitationProps>;\n\nexport type PackagedReference = React.FC<ReferenceProps>;\n\nexport type PackagedPreviewContentProps = Pick<\n PreviewMetadataProps,\n 'icon' | 'primaryText' | 'secondaryText' | 'tertiaryText'\n> & {\n content?: React.ReactNode;\n};\n\nexport type UseReferenceCitationPreviewProps = {\n citationPreviewProps?: PreviewProps;\n citationPreviewSurfaceProps?: PreviewSurfaceProps;\n citationProps?: CitationProps;\n index: number;\n previewContentProps?: PackagedPreviewContentProps;\n referencePreviewProps?: PreviewProps;\n referencePreviewSurfaceProps?: PreviewSurfaceProps;\n referenceProps?: ReferenceProps;\n sensitivityLabelProps?: SensitivityLabelProps;\n};\n\nexport type UseReferenceCitationPreview = (props: UseReferenceCitationPreviewProps) => {\n Citation: PackagedCitation;\n Reference: PackagedReference;\n};\n\n// Abstract the citation that serves as the close button of the Preview into its own component so that we have access to the popover context.\nconst CitationCloseButton = (citationCloseButtonProps: CitationProps) => {\n const setPopoverOpen = usePopoverContext_unstable(context => context.setOpen);\n\n const onPopoverCloseClick = React.useCallback<NonNullable<CitationProps['onClick']>>(\n ev => {\n setPopoverOpen(ev, false);\n\n // Don't navigate\n ev.preventDefault();\n },\n [setPopoverOpen],\n );\n\n const onCitationCloseButtonClick = mergeCallbacks(onPopoverCloseClick, citationCloseButtonProps.onClick);\n\n return <Citation {...citationCloseButtonProps} onClick={onCitationCloseButtonClick} />;\n};\n\nexport const useReferenceCitationPreview: UseReferenceCitationPreview = props => {\n const {\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n previewContentProps,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n sensitivityLabelProps,\n } = props;\n\n const components = React.useMemo(() => {\n const citationWithPreview: PackagedCitation = props => {\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...citationPreviewProps}>\n <PreviewTrigger>\n <Citation {...citationProps} {...props}>\n {index}\n </Citation>\n </PreviewTrigger>\n <PreviewSurface {...citationPreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? citationPreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n const referenceWithPreview: PackagedReference = props => {\n const mergedReferenceProps = {\n citation: index,\n ...referenceProps,\n ...props,\n } as ReferenceProps;\n\n return (\n <Preview closeOnScroll positioning=\"below\" size=\"small\" trapFocus withArrow {...referencePreviewProps}>\n <PreviewTrigger>\n <Reference {...mergedReferenceProps} />\n </PreviewTrigger>\n <PreviewSurface {...referencePreviewSurfaceProps}>\n <PreviewContent>\n <PreviewHeader\n citation={\n <CitationCloseButton aria-label={`Reference ${index}, close`} referenceHref=\"#\" tabIndex={-1}>\n {index}\n </CitationCloseButton>\n }\n media={referenceProps?.graphic as PreviewHeaderProps['media']}\n >\n {referenceProps?.children}\n </PreviewHeader>\n <PreviewMetadata\n icon={previewContentProps?.icon}\n primaryText={previewContentProps?.primaryText}\n secondaryText={previewContentProps?.secondaryText}\n tertiaryText={previewContentProps?.tertiaryText}\n />\n {sensitivityLabelProps && <SensitivityLabel {...sensitivityLabelProps} />}\n {previewContentProps?.content ?? referencePreviewProps?.children}\n </PreviewContent>\n </PreviewSurface>\n </Preview>\n );\n };\n\n return {\n Citation: citationWithPreview,\n Reference: referenceWithPreview,\n };\n }, [\n citationPreviewProps,\n citationPreviewSurfaceProps,\n citationProps,\n index,\n referencePreviewProps,\n referencePreviewSurfaceProps,\n referenceProps,\n previewContentProps,\n sensitivityLabelProps,\n ]);\n\n return components;\n};\n"],"names":["CitationCloseButton","citationCloseButtonProps","setPopoverOpen","usePopoverContext_unstable","context","setOpen","onPopoverCloseClick","React","useCallback","ev","preventDefault","_jsx","Citation","onCitationCloseButtonClick","onClick","citationPreviewProps","useReferenceCitationPreview","citationPreviewSurfaceProps","citationProps","components","previewContentProps","positioning","withArrow","useMemo","PreviewTrigger","PreviewSurface","aria-label","referenceHref","index","referenceProps","primaryText","secondaryText","sensitivityLabelProps","SensitivityLabel","referenceWithPreview","mergedReferenceProps","citation","_jsxs","Preview","closeOnScroll","trapFocus","referencePreviewProps","Reference","referencePreviewSurfaceProps","PreviewContent","tabIndex","graphic","children","PreviewMetadata","_previewContentProps_content"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;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AAA,EAAAC,qBACGA,EAAAA;+BAAQC;6BAAclB;;2BAAiCmB;2BAAUlB;wCAAcmB;;;mEAC9E,EAAAC,sBAAClB,EAAAA;mDACC;;;;;oEAEF,EAACC,4BAAAA,EAAAA;;2CAAmBkB,GAAAA,IAAAA,eAAAA,EAAAA,2BAAAA,EAA4B;yDAC9C,GAAAhC,IAAAA,eAAA,EAAAX,qBAAC4C;;;;;;8DAGqFC,QAAAA,mBAAW,KAAA,IAAA,KAAA,IAAAhB,eAAAiB,OAAA;yEACxFlB,mBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,eAAAA,QAAAA;;;kEAGEC,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAAA,IAAAA;yEAENA,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAAA,WAAgBkB;;0EAElBC,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAAA,YAAAA;;yDACK,WAAE5B,GAAAA,IAAAA,eAAAA,EAAAA,uCAAAA,EAAAA;4DACNU;;gEACAC,wBAAeX,QAAAA,wBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,oBAAAA,OAAqBW,MAAAA,QAAakB,iCAAA,KAAA,IAAAA,+BAAAR,0BAAA,QAAAA,0BAAA,KAAA,IAAA,KAAA,IAAAA,sBAAAM,QAAA;6BAAA;;;;;;;;;;;;;;;;;;;;;;0DAS7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
|
-
"version": "0.0.0-nightly-
|
|
3
|
+
"version": "0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
4
4
|
"description": "Fluent AI controls for citations and references",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@fluentui-copilot/react-preview": "0.0.0-nightly-
|
|
16
|
-
"@fluentui-copilot/react-provider": "0.0.0-nightly-
|
|
17
|
-
"@fluentui-copilot/react-sensitivity-label": "0.0.0-nightly-
|
|
15
|
+
"@fluentui-copilot/react-preview": "0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
16
|
+
"@fluentui-copilot/react-provider": "0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
17
|
+
"@fluentui-copilot/react-sensitivity-label": "0.0.0-nightly-20240523-0404-0f9673a1.1",
|
|
18
18
|
"@swc/helpers": "^0.5.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@fluentui/keyboard-keys": ">=9.0.7 <10.0.0",
|
|
22
|
-
"@fluentui/react-components": ">=9.
|
|
23
|
-
"@fluentui/react-context-selector": ">=9.1.
|
|
24
|
-
"@fluentui/react-icons": ">=2.0.
|
|
25
|
-
"@fluentui/react-jsx-runtime": ">=9.0.
|
|
26
|
-
"@fluentui/react-shared-contexts": ">=9.
|
|
27
|
-
"@fluentui/react-utilities": ">=9.18.
|
|
22
|
+
"@fluentui/react-components": ">=9.52.0 <10.0.0",
|
|
23
|
+
"@fluentui/react-context-selector": ">=9.1.60 <10.0.0",
|
|
24
|
+
"@fluentui/react-icons": ">=2.0.240 <3.0.0",
|
|
25
|
+
"@fluentui/react-jsx-runtime": ">=9.0.38 <10.0.0",
|
|
26
|
+
"@fluentui/react-shared-contexts": ">=9.19.0 <10.0.0",
|
|
27
|
+
"@fluentui/react-utilities": ">=9.18.9 <10.0.0",
|
|
28
28
|
"@types/react": ">=16.14.0 <19.0.0",
|
|
29
29
|
"@types/react-dom": ">=16.9.8 <19.0.0",
|
|
30
30
|
"react": ">=16.14.0 <19.0.0",
|