@fluentui-copilot/react-reference 0.0.0-nightly-20251010-0406-7df7c6d1.1 → 0.0.0-nightly-20251014-0405-d8d3e89c.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 +54 -3
- package/CHANGELOG.md +19 -4
- package/dist/index.d.ts +382 -0
- package/lib/Citation.js +1 -0
- package/lib/Citation.js.map +1 -0
- package/lib/Reference.js +1 -0
- package/lib/Reference.js.map +1 -0
- package/lib/ReferenceList.js +1 -0
- package/lib/ReferenceList.js.map +1 -0
- package/lib/ReferenceOverflowButton.js +1 -0
- package/lib/ReferenceOverflowButton.js.map +1 -0
- package/lib/components/Citation/Citation.js +13 -0
- package/lib/components/Citation/Citation.js.map +1 -0
- package/lib/components/Citation/Citation.types.js +3 -0
- package/lib/components/Citation/Citation.types.js.map +1 -0
- package/lib/components/Citation/index.js +4 -0
- package/lib/components/Citation/index.js.map +1 -0
- package/lib/components/Citation/renderCitation.js +8 -0
- package/lib/components/Citation/renderCitation.js.map +1 -0
- package/lib/components/Citation/useCitation.js +34 -0
- package/lib/components/Citation/useCitation.js.map +1 -0
- package/lib/components/Citation/useCitationStyles.styles.js +59 -0
- package/lib/components/Citation/useCitationStyles.styles.js.map +1 -0
- package/lib/components/Citation/useCitationStyles.styles.raw.js +69 -0
- package/lib/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib/components/Reference/Reference.js +10 -0
- package/lib/components/Reference/Reference.js.map +1 -0
- package/lib/components/Reference/Reference.types.js +1 -0
- package/lib/components/Reference/Reference.types.js.map +1 -0
- package/lib/components/Reference/index.js +4 -0
- package/lib/components/Reference/index.js.map +1 -0
- package/lib/components/Reference/renderReference.js +22 -0
- package/lib/components/Reference/renderReference.js.map +1 -0
- package/lib/components/Reference/useReference.js +71 -0
- package/lib/components/Reference/useReference.js.map +1 -0
- package/lib/components/Reference/useReferenceStyles.styles.js +70 -0
- package/lib/components/Reference/useReferenceStyles.styles.js.map +1 -0
- package/lib/components/Reference/useReferenceStyles.styles.raw.js +110 -0
- package/lib/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib/components/ReferenceList/ReferenceList.js +12 -0
- package/lib/components/ReferenceList/ReferenceList.js.map +1 -0
- package/lib/components/ReferenceList/ReferenceList.types.js +1 -0
- package/lib/components/ReferenceList/ReferenceList.types.js.map +1 -0
- package/lib/components/ReferenceList/index.js +4 -0
- package/lib/components/ReferenceList/index.js.map +1 -0
- package/lib/components/ReferenceList/renderReferenceList.js +22 -0
- package/lib/components/ReferenceList/renderReferenceList.js.map +1 -0
- package/lib/components/ReferenceList/useReferenceList.js +83 -0
- package/lib/components/ReferenceList/useReferenceList.js.map +1 -0
- package/lib/components/ReferenceList/useReferenceListContextValues.js +15 -0
- package/lib/components/ReferenceList/useReferenceListContextValues.js.map +1 -0
- package/lib/components/ReferenceList/useReferenceListStyles.styles.js +46 -0
- package/lib/components/ReferenceList/useReferenceListStyles.styles.js.map +1 -0
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js +47 -0
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.js +11 -0
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js +3 -0
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/index.js +4 -0
- package/lib/components/ReferenceOverflowButton/index.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/renderReferenceOverflowButton.js +13 -0
- package/lib/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButton.js +93 -0
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.js +37 -0
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.js.map +1 -0
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +45 -0
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +1 -0
- package/lib/contexts/index.js +1 -0
- package/lib/contexts/index.js.map +1 -0
- package/lib/contexts/referenceListContext.js +16 -0
- package/lib/contexts/referenceListContext.js.map +1 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/utilities/generateReferenceCitationPreview.js +103 -0
- package/lib/utilities/generateReferenceCitationPreview.js.map +1 -0
- package/lib/utilities/index.js +2 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib/utilities/useReferenceCitationPreview.js +18 -0
- package/lib/utilities/useReferenceCitationPreview.js.map +1 -0
- package/lib-commonjs/Citation.js +28 -0
- package/lib-commonjs/Citation.js.map +1 -0
- package/lib-commonjs/Reference.js +31 -0
- package/lib-commonjs/Reference.js.map +1 -0
- package/lib-commonjs/ReferenceList.js +28 -0
- package/lib-commonjs/ReferenceList.js.map +1 -0
- package/lib-commonjs/ReferenceOverflowButton.js +28 -0
- package/lib-commonjs/ReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/Citation/Citation.js +23 -0
- package/lib-commonjs/components/Citation/Citation.js.map +1 -0
- package/lib-commonjs/components/Citation/Citation.types.js +6 -0
- package/lib-commonjs/components/Citation/Citation.types.js.map +1 -0
- package/lib-commonjs/components/Citation/index.js +31 -0
- package/lib-commonjs/components/Citation/index.js.map +1 -0
- package/lib-commonjs/components/Citation/renderCitation.js +16 -0
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -0
- package/lib-commonjs/components/Citation/useCitation.js +36 -0
- package/lib-commonjs/components/Citation/useCitation.js.map +1 -0
- package/lib-commonjs/components/Citation/useCitationStyles.styles.js +116 -0
- package/lib-commonjs/components/Citation/useCitationStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js +85 -0
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Reference/Reference.js +21 -0
- package/lib-commonjs/components/Reference/Reference.js.map +1 -0
- package/lib-commonjs/components/Reference/Reference.types.js +4 -0
- package/lib-commonjs/components/Reference/Reference.types.js.map +1 -0
- package/lib-commonjs/components/Reference/index.js +34 -0
- package/lib-commonjs/components/Reference/index.js.map +1 -0
- package/lib-commonjs/components/Reference/renderReference.js +32 -0
- package/lib-commonjs/components/Reference/renderReference.js.map +1 -0
- package/lib-commonjs/components/Reference/useReference.js +73 -0
- package/lib-commonjs/components/Reference/useReference.js.map +1 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.js +109 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js +132 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/ReferenceList.js +23 -0
- package/lib-commonjs/components/ReferenceList/ReferenceList.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js +4 -0
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/index.js +31 -0
- package/lib-commonjs/components/ReferenceList/index.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js +30 -0
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/useReferenceList.js +86 -0
- package/lib-commonjs/components/ReferenceList/useReferenceList.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListContextValues.js +25 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListContextValues.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.js +62 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js +63 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.js +21 -0
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js +6 -0
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/index.js +31 -0
- package/lib-commonjs/components/ReferenceOverflowButton/index.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js +21 -0
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButton.js +96 -0
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.js +55 -0
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +61 -0
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/contexts/index.js +22 -0
- package/lib-commonjs/contexts/index.js.map +1 -0
- package/lib-commonjs/contexts/referenceListContext.js +37 -0
- package/lib-commonjs/contexts/referenceListContext.js.map +1 -0
- package/lib-commonjs/index.js +144 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js +103 -0
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js.map +1 -0
- package/lib-commonjs/utilities/index.js +20 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/lib-commonjs/utilities/useReferenceCitationPreview.js +18 -0
- package/lib-commonjs/utilities/useReferenceCitationPreview.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { __resetStyles, __styles, mergeClasses, shorthands } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const citationClassNames = {
|
|
4
|
+
root: 'fai-Citation'
|
|
5
|
+
};
|
|
6
|
+
const useCitationBaseClassName = __resetStyles("r1jm3di4", "r6zn0t3", [".r1jm3di4{display:inline-flex;justify-content:center;box-sizing:border-box;align-items:center;cursor:pointer;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightBold);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);color:var(--colorNeutralForeground2);min-width:14px;height:14px;vertical-align:calc((var(--lineHeightBase200) - var(--fontSizeBase100)) / 2);padding-inline:var(--spacingHorizontalXXS);border-radius:var(--borderRadiusMedium);text-decoration:none;margin-left:var(--spacingHorizontalXXS);margin-right:var(--spacingHorizontalXXS);}", ".r1jm3di4:hover{cursor:pointer;color:var(--colorBrandForeground2Hover);border-color:var(--colorBrandStroke2Hover);background-color:var(--colorBrandBackground2Hover);}", ".r1jm3di4:hover:active{cursor:pointer;color:var(--colorBrandForeground2Pressed);border-color:var(--colorBrandStroke2Pressed);background-color:var(--colorBrandBackground2Pressed);}", ".r6zn0t3{display:inline-flex;justify-content:center;box-sizing:border-box;align-items:center;cursor:pointer;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightBold);line-height:var(--lineHeightBase200);background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);color:var(--colorNeutralForeground2);min-width:14px;height:14px;vertical-align:calc((var(--lineHeightBase200) - var(--fontSizeBase100)) / 2);padding-inline:var(--spacingHorizontalXXS);border-radius:var(--borderRadiusMedium);text-decoration:none;margin-right:var(--spacingHorizontalXXS);margin-left:var(--spacingHorizontalXXS);}", ".r6zn0t3:hover{cursor:pointer;color:var(--colorBrandForeground2Hover);border-color:var(--colorBrandStroke2Hover);background-color:var(--colorBrandBackground2Hover);}", ".r6zn0t3:hover:active{cursor:pointer;color:var(--colorBrandForeground2Pressed);border-color:var(--colorBrandStroke2Pressed);background-color:var(--colorBrandBackground2Pressed);}"]);
|
|
7
|
+
const useCitationRootStyles = __styles({
|
|
8
|
+
isBlock: {
|
|
9
|
+
mc9l5x: "f22iagw",
|
|
10
|
+
Frg6f3: ["f1tyq0we", "f11qmguv"],
|
|
11
|
+
t21cq0: ["f11qmguv", "f1tyq0we"]
|
|
12
|
+
},
|
|
13
|
+
isPopoverLocked: {
|
|
14
|
+
sj55zd: "fkjhhq2",
|
|
15
|
+
g2u3we: "f1nbqb3e",
|
|
16
|
+
h3c5rm: ["fah3j9v", "f56crja"],
|
|
17
|
+
B9xav0g: "fef4ti1",
|
|
18
|
+
zhjwy3: ["f56crja", "fah3j9v"],
|
|
19
|
+
De3pzq: "f16xkysk",
|
|
20
|
+
Bi91k9c: "fbszb7v",
|
|
21
|
+
Bgoe8wy: "ftxwbyd",
|
|
22
|
+
Bwzppfd: ["f1p7dilp", "f15x2k42"],
|
|
23
|
+
oetu4i: "fegdlwn",
|
|
24
|
+
gg5e9n: ["f15x2k42", "f1p7dilp"],
|
|
25
|
+
Jwef8y: "f121v1wq"
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
d: [".f22iagw{display:flex;}", ".f1tyq0we{margin-left:0;}", ".f11qmguv{margin-right:0;}", ".fkjhhq2{color:var(--colorBrandForeground2Pressed);}", ".f1nbqb3e{border-top-color:var(--colorBrandStroke2Pressed);}", ".fah3j9v{border-right-color:var(--colorBrandStroke2Pressed);}", ".f56crja{border-left-color:var(--colorBrandStroke2Pressed);}", ".fef4ti1{border-bottom-color:var(--colorBrandStroke2Pressed);}", ".f16xkysk{background-color:var(--colorBrandBackground2);}"],
|
|
29
|
+
h: [".fbszb7v:hover{color:var(--colorBrandForeground2Pressed);}", ".ftxwbyd:hover{border-top-color:var(--colorBrandStroke2Pressed);}", ".f1p7dilp:hover{border-right-color:var(--colorBrandStroke2Pressed);}", ".f15x2k42:hover{border-left-color:var(--colorBrandStroke2Pressed);}", ".fegdlwn:hover{border-bottom-color:var(--colorBrandStroke2Pressed);}", ".f121v1wq:hover{background-color:var(--colorBrandBackground2);}"]
|
|
30
|
+
});
|
|
31
|
+
const useNextStyles = __styles({
|
|
32
|
+
root: {
|
|
33
|
+
Beyfa6y: 0,
|
|
34
|
+
Bbmb7ep: 0,
|
|
35
|
+
Btl43ni: 0,
|
|
36
|
+
B7oj6ja: 0,
|
|
37
|
+
Dimara: "f1kijzfu"
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
d: [[".f1kijzfu{border-radius:var(--borderRadiusXLarge);}", {
|
|
41
|
+
p: -1
|
|
42
|
+
}]]
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Apply styling to the Citation slots based on the state
|
|
46
|
+
*/
|
|
47
|
+
export const useCitationStyles_unstable = state => {
|
|
48
|
+
'use no memo';
|
|
49
|
+
|
|
50
|
+
const {
|
|
51
|
+
designVersion
|
|
52
|
+
} = state;
|
|
53
|
+
const rootBaseClassName = useCitationBaseClassName();
|
|
54
|
+
const rootStyles = useCitationRootStyles();
|
|
55
|
+
const nextStyles = useNextStyles();
|
|
56
|
+
state.root.className = mergeClasses(citationClassNames.root, state.isPopoverLocked && rootStyles.isPopoverLocked, state.block && rootStyles.isBlock, rootBaseClassName, designVersion === 'next' && nextStyles.root, state.root.className);
|
|
57
|
+
return state;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=useCitationStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useCitationStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { CitationSlots, CitationState } from './Citation.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const citationClassNames: SlotClassNames<CitationSlots> = {\n root: 'fai-Citation',\n};\n\nconst useCitationBaseClassName = makeResetStyles({\n display: 'inline-flex',\n justifyContent: 'center',\n boxSizing: 'border-box',\n alignItems: 'center',\n cursor: 'pointer',\n ...typographyStyles.caption2Strong,\n\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n color: tokens.colorNeutralForeground2,\n\n minWidth: '14px',\n height: '14px',\n verticalAlign: `calc((${typographyStyles.caption2Strong.lineHeight} - ${typographyStyles.caption2Strong.fontSize}) / 2)`,\n paddingInline: tokens.spacingHorizontalXXS,\n\n borderRadius: tokens.borderRadiusMedium,\n\n textDecoration: 'none',\n\n marginLeft: tokens.spacingHorizontalXXS,\n marginRight: tokens.spacingHorizontalXXS,\n\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Hover,\n borderColor: tokens.colorBrandStroke2Hover,\n backgroundColor: tokens.colorBrandBackground2Hover,\n },\n\n ':hover:active': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Pressed,\n borderColor: tokens.colorBrandStroke2Pressed,\n backgroundColor: tokens.colorBrandBackground2Pressed,\n },\n});\n\nconst useCitationRootStyles = makeStyles({\n isBlock: {\n display: 'flex',\n marginLeft: 0,\n marginRight: 0,\n },\n isPopoverLocked: {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n ':hover': {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n },\n },\n});\n\nconst useNextStyles = makeStyles({ root: { borderRadius: tokens.borderRadiusXLarge } });\n\n/**\n * Apply styling to the Citation slots based on the state\n */\nexport const useCitationStyles_unstable = (state: CitationState): CitationState => {\n 'use no memo';\n\n const { designVersion } = state;\n\n const rootBaseClassName = useCitationBaseClassName();\n const rootStyles = useCitationRootStyles();\n const nextStyles = useNextStyles();\n\n state.root.className = mergeClasses(\n citationClassNames.root,\n state.isPopoverLocked && rootStyles.isPopoverLocked,\n state.block && rootStyles.isBlock,\n rootBaseClassName,\n designVersion === 'next' && nextStyles.root,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","citationClassNames","root","useCitationBaseClassName","display","justifyContent","boxSizing","alignItems","cursor","caption2Strong","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","color","colorNeutralForeground2","minWidth","height","verticalAlign","lineHeight","fontSize","paddingInline","spacingHorizontalXXS","borderRadius","borderRadiusMedium","textDecoration","marginLeft","marginRight","colorBrandForeground2Hover","borderColor","colorBrandStroke2Hover","colorBrandBackground2Hover","colorBrandForeground2Pressed","colorBrandStroke2Pressed","colorBrandBackground2Pressed","useCitationRootStyles","isBlock","isPopoverLocked","colorBrandBackground2","useNextStyles","borderRadiusXLarge","useCitationStyles_unstable","state","designVersion","rootBaseClassName","rootStyles","nextStyles","className","block"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,6BAA6B;AACnG,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,OAAO,MAAMC,qBAAoD;IAC/DC,MAAM;AACR,EAAE;AAEF,MAAMC,2BAA2BR,gBAAgB;IAC/CS,SAAS;IACTC,gBAAgB;IAChBC,WAAW;IACXC,YAAY;IACZC,QAAQ;IACR,GAAGR,iBAAiBS,cAAc;IAElCC,iBAAiBX,OAAOY,uBAAu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A,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,MAAME,oBAAoB1C;IAC1B,MAAM2C,aAAaV;IACnB,MAAMW,aAAaP;IAEnBG,MAAMzC,IAAI,CAAC8C,SAAS,GAAGnD,aACrBI,mBAAmBC,IAAI,EACvByC,MAAML,eAAe,IAAIQ,WAAWR,eAAe,EACnDK,MAAMM,KAAK,IAAIH,WAAWT,OAAO,EACjCQ,mBACAD,kBAAkB,UAAUG,WAAW7C,IAAI,EAC3CyC,MAAMzC,IAAI,CAAC8C,SAAS;IAGtB,OAAOL;AACT,EAAE"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const citationClassNames = {
|
|
4
|
+
root: 'fai-Citation'
|
|
5
|
+
};
|
|
6
|
+
const useCitationBaseClassName = makeResetStyles({
|
|
7
|
+
display: 'inline-flex',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
boxSizing: 'border-box',
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
cursor: 'pointer',
|
|
12
|
+
...typographyStyles.caption2Strong,
|
|
13
|
+
backgroundColor: tokens.colorNeutralBackground3,
|
|
14
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,
|
|
15
|
+
color: tokens.colorNeutralForeground2,
|
|
16
|
+
minWidth: '14px',
|
|
17
|
+
height: '14px',
|
|
18
|
+
verticalAlign: `calc((${typographyStyles.caption2Strong.lineHeight} - ${typographyStyles.caption2Strong.fontSize}) / 2)`,
|
|
19
|
+
paddingInline: tokens.spacingHorizontalXXS,
|
|
20
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
21
|
+
textDecoration: 'none',
|
|
22
|
+
marginLeft: tokens.spacingHorizontalXXS,
|
|
23
|
+
marginRight: tokens.spacingHorizontalXXS,
|
|
24
|
+
':hover': {
|
|
25
|
+
cursor: 'pointer',
|
|
26
|
+
color: tokens.colorBrandForeground2Hover,
|
|
27
|
+
borderColor: tokens.colorBrandStroke2Hover,
|
|
28
|
+
backgroundColor: tokens.colorBrandBackground2Hover
|
|
29
|
+
},
|
|
30
|
+
':hover:active': {
|
|
31
|
+
cursor: 'pointer',
|
|
32
|
+
color: tokens.colorBrandForeground2Pressed,
|
|
33
|
+
borderColor: tokens.colorBrandStroke2Pressed,
|
|
34
|
+
backgroundColor: tokens.colorBrandBackground2Pressed
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const useCitationRootStyles = makeStyles({
|
|
38
|
+
isBlock: {
|
|
39
|
+
display: 'flex',
|
|
40
|
+
marginLeft: 0,
|
|
41
|
+
marginRight: 0
|
|
42
|
+
},
|
|
43
|
+
isPopoverLocked: {
|
|
44
|
+
color: tokens.colorBrandForeground2Pressed,
|
|
45
|
+
...shorthands.borderColor(tokens.colorBrandStroke2Pressed),
|
|
46
|
+
backgroundColor: tokens.colorBrandBackground2,
|
|
47
|
+
':hover': {
|
|
48
|
+
color: tokens.colorBrandForeground2Pressed,
|
|
49
|
+
...shorthands.borderColor(tokens.colorBrandStroke2Pressed),
|
|
50
|
+
backgroundColor: tokens.colorBrandBackground2
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const useNextStyles = makeStyles({
|
|
55
|
+
root: {
|
|
56
|
+
borderRadius: tokens.borderRadiusXLarge
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Apply styling to the Citation slots based on the state
|
|
61
|
+
*/ export const useCitationStyles_unstable = (state)=>{
|
|
62
|
+
'use no memo';
|
|
63
|
+
const { designVersion } = state;
|
|
64
|
+
const rootBaseClassName = useCitationBaseClassName();
|
|
65
|
+
const rootStyles = useCitationRootStyles();
|
|
66
|
+
const nextStyles = useNextStyles();
|
|
67
|
+
state.root.className = mergeClasses(citationClassNames.root, state.isPopoverLocked && rootStyles.isPopoverLocked, state.block && rootStyles.isBlock, rootBaseClassName, designVersion === 'next' && nextStyles.root, state.root.className);
|
|
68
|
+
return state;
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useCitationStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, shorthands } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { CitationSlots, CitationState } from './Citation.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const citationClassNames: SlotClassNames<CitationSlots> = {\n root: 'fai-Citation',\n};\n\nconst useCitationBaseClassName = makeResetStyles({\n display: 'inline-flex',\n justifyContent: 'center',\n boxSizing: 'border-box',\n alignItems: 'center',\n cursor: 'pointer',\n ...typographyStyles.caption2Strong,\n\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n color: tokens.colorNeutralForeground2,\n\n minWidth: '14px',\n height: '14px',\n verticalAlign: `calc((${typographyStyles.caption2Strong.lineHeight} - ${typographyStyles.caption2Strong.fontSize}) / 2)`,\n paddingInline: tokens.spacingHorizontalXXS,\n\n borderRadius: tokens.borderRadiusMedium,\n\n textDecoration: 'none',\n\n marginLeft: tokens.spacingHorizontalXXS,\n marginRight: tokens.spacingHorizontalXXS,\n\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Hover,\n borderColor: tokens.colorBrandStroke2Hover,\n backgroundColor: tokens.colorBrandBackground2Hover,\n },\n\n ':hover:active': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Pressed,\n borderColor: tokens.colorBrandStroke2Pressed,\n backgroundColor: tokens.colorBrandBackground2Pressed,\n },\n});\n\nconst useCitationRootStyles = makeStyles({\n isBlock: {\n display: 'flex',\n marginLeft: 0,\n marginRight: 0,\n },\n isPopoverLocked: {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n ':hover': {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n },\n },\n});\n\nconst useNextStyles = makeStyles({ root: { borderRadius: tokens.borderRadiusXLarge } });\n\n/**\n * Apply styling to the Citation slots based on the state\n */\nexport const useCitationStyles_unstable = (state: CitationState): CitationState => {\n 'use no memo';\n\n const { designVersion } = state;\n\n const rootBaseClassName = useCitationBaseClassName();\n const rootStyles = useCitationRootStyles();\n const nextStyles = useNextStyles();\n\n state.root.className = mergeClasses(\n citationClassNames.root,\n state.isPopoverLocked && rootStyles.isPopoverLocked,\n state.block && rootStyles.isBlock,\n rootBaseClassName,\n designVersion === 'next' && nextStyles.root,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","citationClassNames","root","useCitationBaseClassName","display","justifyContent","boxSizing","alignItems","cursor","caption2Strong","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","color","colorNeutralForeground2","minWidth","height","verticalAlign","lineHeight","fontSize","paddingInline","spacingHorizontalXXS","borderRadius","borderRadiusMedium","textDecoration","marginLeft","marginRight","colorBrandForeground2Hover","borderColor","colorBrandStroke2Hover","colorBrandBackground2Hover","colorBrandForeground2Pressed","colorBrandStroke2Pressed","colorBrandBackground2Pressed","useCitationRootStyles","isBlock","isPopoverLocked","colorBrandBackground2","useNextStyles","borderRadiusXLarge","useCitationStyles_unstable","state","designVersion","rootBaseClassName","rootStyles","nextStyles","className","block"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,6BAA6B;AACnG,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B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,wBAAwB,CAAC;YAC1DxB,iBAAiBX,OAAOwC,qBAAqB;QAC/C;IACF;AACF;AAEA,MAAMC,gBAAgB5C,WAAW;IAAEM,MAAM;QAAEsB,cAAczB,OAAO0C,kBAAkB;IAAC;AAAE;AAErF;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC;IACzC;IAEA,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,MAAME,oBAAoB1C;IAC1B,MAAM2C,aAAaV;IACnB,MAAMW,aAAaP;IAEnBG,MAAMzC,IAAI,CAAC8C,SAAS,GAAGnD,aACrBI,mBAAmBC,IAAI,EACvByC,MAAML,eAAe,IAAIQ,WAAWR,eAAe,EACnDK,MAAMM,KAAK,IAAIH,WAAWT,OAAO,EACjCQ,mBACAD,kBAAkB,UAAUG,WAAW7C,IAAI,EAC3CyC,MAAMzC,IAAI,CAAC8C,SAAS;IAGtB,OAAOL;AACT,EAAE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useReference_unstable } from './useReference';
|
|
3
|
+
import { renderReference_unstable } from './renderReference';
|
|
4
|
+
import { useReferenceStyles_unstable } from './useReferenceStyles.styles';
|
|
5
|
+
export const Reference = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
6
|
+
const state = useReference_unstable(props, ref);
|
|
7
|
+
useReferenceStyles_unstable(state);
|
|
8
|
+
return renderReference_unstable(state);
|
|
9
|
+
});
|
|
10
|
+
Reference.displayName = 'Reference';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Reference.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReference_unstable } from './useReference';\nimport { renderReference_unstable } from './renderReference';\nimport { useReferenceStyles_unstable } from './useReferenceStyles.styles';\nimport type { ReferenceProps } from './Reference.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\nexport const Reference: ForwardRefComponent<ReferenceProps> = React.forwardRef((props, ref) => {\n const state = useReference_unstable(props, ref);\n\n useReferenceStyles_unstable(state);\n return renderReference_unstable(state);\n});\n\nReference.displayName = 'Reference';\n"],"names":["React","useReference_unstable","renderReference_unstable","useReferenceStyles_unstable","Reference","forwardRef","props","ref","state","displayName"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,2BAA2B,QAAQ,8BAA8B;AAI1E,OAAO,MAAMC,0BAAiDJ,MAAMK,UAAU,CAAC,CAACC,OAAOC;IACrF,MAAMC,QAAQP,sBAAsBK,OAAOC;IAE3CJ,4BAA4BK;IAC5B,OAAON,yBAAyBM;AAClC,GAAG;AAEHJ,UAAUK,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { DesignVersion } from '@fluentui-copilot/react-provider';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\nimport type { ReferenceListState } from '../ReferenceList';\n\nexport type ReferenceSlots = {\n /** The root of the component that renders the reference as either a button or an anchor element. */\n root: NonNullable<Slot<'button', 'a'>>;\n\n /** The number of the citation this reference corresponds to. */\n citation?: Slot<'span'>;\n\n /** A divider that visually separates the citation from the content of the reference. */\n divider?: Slot<'span'>;\n\n /** A space containing the content of the reference, which goes into an ellipsis if it overflows. */\n content?: Slot<'span'>;\n\n /** A space within the content slot where a graphic such as an icon or an image can be displayed before the rest of the content. */\n graphic?: Slot<'span'>;\n};\n\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & DesignVersion & {};\n\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'id' | 'designVersion'>> &\n Pick<ReferenceListState, 'shouldUseOverflow'>;\n"],"names":[],"rangeMappings":"","mappings":"AAuBA,WAEgD"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Reference } from './Reference';
|
|
2
|
+
export { renderReference_unstable } from './renderReference';
|
|
3
|
+
export { useReference_unstable } from './useReference';
|
|
4
|
+
export { referenceClassNames, referenceExtraClassNames, useReferenceStyles_unstable } from './useReferenceStyles.styles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { Reference } from './Reference';\nexport type { ReferenceProps, ReferenceSlots, ReferenceState } from './Reference.types';\nexport { renderReference_unstable } from './renderReference';\nexport { useReference_unstable } from './useReference';\nexport {\n referenceClassNames,\n referenceExtraClassNames,\n useReferenceStyles_unstable,\n} from './useReferenceStyles.styles';\n"],"names":["Reference","renderReference_unstable","useReference_unstable","referenceClassNames","referenceExtraClassNames","useReferenceStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc;AAExC,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SACEC,mBAAmB,EACnBC,wBAAwB,EACxBC,2BAA2B,QACtB,8BAA8B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { OverflowItem, assertSlots } from '@fluentui/react-components';
|
|
3
|
+
export const renderReference_unstable = (state)=>{
|
|
4
|
+
assertSlots(state);
|
|
5
|
+
const { id, shouldUseOverflow } = state;
|
|
6
|
+
const reference = /*#__PURE__*/ _jsxs(state.root, {
|
|
7
|
+
children: [
|
|
8
|
+
state.citation && /*#__PURE__*/ _jsx(state.citation, {}),
|
|
9
|
+
state.divider && /*#__PURE__*/ _jsx(state.divider, {}),
|
|
10
|
+
state.content && /*#__PURE__*/ _jsxs(state.content, {
|
|
11
|
+
children: [
|
|
12
|
+
state.graphic && /*#__PURE__*/ _jsx(state.graphic, {}),
|
|
13
|
+
state.root.children
|
|
14
|
+
]
|
|
15
|
+
})
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
return shouldUseOverflow ? /*#__PURE__*/ _jsx(OverflowItem, {
|
|
19
|
+
id: id,
|
|
20
|
+
children: reference
|
|
21
|
+
}, id) : reference;
|
|
22
|
+
};
|
|
@@ -0,0 +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';\nimport type { JSXElement } from '@fluentui/react-components';\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"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getIntrinsicElementProps, mergeClasses, slot, useId } from '@fluentui/react-components';
|
|
3
|
+
import { useReferenceListContext_unstable } from '../../contexts/referenceListContext';
|
|
4
|
+
import { referenceExtraClassNames } from './useReferenceStyles.styles';
|
|
5
|
+
import { useDesignVersion } from '@fluentui-copilot/react-provider';
|
|
6
|
+
/**
|
|
7
|
+
* Create the state required to render Reference.
|
|
8
|
+
*
|
|
9
|
+
* The returned state can be modified with hooks such as useReferenceStyles_unstable,
|
|
10
|
+
* before being passed to renderReference_unstable.
|
|
11
|
+
*
|
|
12
|
+
* @param props - props from this instance of Reference
|
|
13
|
+
* @param ref - reference to root HTMLElement of Reference
|
|
14
|
+
*/ export const useReference_unstable = (props, ref)=>{
|
|
15
|
+
const { as, children, id } = props;
|
|
16
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
17
|
+
const shouldUseOverflow = useReferenceListContext_unstable((ctx)=>ctx.shouldUseOverflow);
|
|
18
|
+
const referenceId = useId('reference-', id);
|
|
19
|
+
const elementType = as || (props.href ? 'a' : 'button');
|
|
20
|
+
const propsWithAssignedAs = {
|
|
21
|
+
type: elementType === 'button' ? 'button' : undefined,
|
|
22
|
+
...props,
|
|
23
|
+
as: elementType,
|
|
24
|
+
id: referenceId
|
|
25
|
+
};
|
|
26
|
+
const citation = slot.optional(props.citation, {
|
|
27
|
+
elementType: 'span'
|
|
28
|
+
});
|
|
29
|
+
const graphic = slot.optional(props.graphic, {
|
|
30
|
+
elementType: 'span'
|
|
31
|
+
});
|
|
32
|
+
const content = slot.optional(props.content, {
|
|
33
|
+
elementType: 'span',
|
|
34
|
+
renderByDefault: graphic !== undefined || !!children
|
|
35
|
+
});
|
|
36
|
+
const divider = slot.optional(props.divider, {
|
|
37
|
+
elementType: 'span',
|
|
38
|
+
renderByDefault: citation !== undefined && content !== undefined
|
|
39
|
+
});
|
|
40
|
+
const state = {
|
|
41
|
+
designVersion,
|
|
42
|
+
id: referenceId,
|
|
43
|
+
shouldUseOverflow,
|
|
44
|
+
components: {
|
|
45
|
+
root: elementType,
|
|
46
|
+
citation: 'span',
|
|
47
|
+
divider: 'span',
|
|
48
|
+
graphic: 'span',
|
|
49
|
+
content: 'span'
|
|
50
|
+
},
|
|
51
|
+
root: slot.always(getIntrinsicElementProps(elementType, {
|
|
52
|
+
ref,
|
|
53
|
+
...propsWithAssignedAs
|
|
54
|
+
}, // `content` is a slot and it's type clashes with the HTMLElement `content` attribute
|
|
55
|
+
[
|
|
56
|
+
'content'
|
|
57
|
+
]), {
|
|
58
|
+
elementType
|
|
59
|
+
}),
|
|
60
|
+
citation,
|
|
61
|
+
divider,
|
|
62
|
+
content,
|
|
63
|
+
graphic
|
|
64
|
+
};
|
|
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
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return state;
|
|
71
|
+
};
|
|
@@ -0,0 +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';\nimport type { JSXIntrinsicElement } from '@fluentui/react-components';\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","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AAwB;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"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { __resetStyles, __styles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const referenceClassNames = {
|
|
4
|
+
root: 'fai-Reference',
|
|
5
|
+
citation: 'fai-Reference__citation',
|
|
6
|
+
divider: 'fai-Reference__divider',
|
|
7
|
+
graphic: 'fai-Reference__graphic',
|
|
8
|
+
content: 'fai-Reference__content'
|
|
9
|
+
};
|
|
10
|
+
export const referenceExtraClassNames = {
|
|
11
|
+
graphicChild: 'fai-Reference__graphicChild'
|
|
12
|
+
};
|
|
13
|
+
const GRAPHIC_SIZE = '16px';
|
|
14
|
+
const useRootBaseClassName = __resetStyles("r5aus6y", null, [".r5aus6y{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:inline-flex;flex-shrink:0;justify-content:center;max-width:100%;min-height:24px;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);text-decoration:none;}", ".r5aus6y:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}", ".r5aus6y:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}", ".r5aus6y:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}", ".r5aus6y:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}"]);
|
|
15
|
+
export const useRootStyles = __styles({
|
|
16
|
+
overflow: {
|
|
17
|
+
B2u0y6b: "f6dzj5z",
|
|
18
|
+
a9b677: "fly5x3f"
|
|
19
|
+
}
|
|
20
|
+
}, {
|
|
21
|
+
d: [".f6dzj5z{max-width:100%;}", ".fly5x3f{width:100%;}"]
|
|
22
|
+
});
|
|
23
|
+
const useRootNextStyles = __styles({
|
|
24
|
+
root: {
|
|
25
|
+
Beyfa6y: 0,
|
|
26
|
+
Bbmb7ep: 0,
|
|
27
|
+
Btl43ni: 0,
|
|
28
|
+
B7oj6ja: 0,
|
|
29
|
+
Dimara: "f1kijzfu"
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
32
|
+
d: [[".f1kijzfu{border-radius:var(--borderRadiusXLarge);}", {
|
|
33
|
+
p: -1
|
|
34
|
+
}]]
|
|
35
|
+
});
|
|
36
|
+
const useCitationBaseClassName = __resetStyles("r342rk1", null, [".r342rk1{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightBold);line-height:var(--lineHeightBase200);}"]);
|
|
37
|
+
const useDividerBaseClassName = __resetStyles("r1eyqaw5", null, [".r1eyqaw5{background-color:var(--colorNeutralStroke2);height:16px;margin:var(--spacingVerticalNone) var(--spacingHorizontalXS);width:1px;}"]);
|
|
38
|
+
const useGraphicBaseClassName = __resetStyles("rpyrgl4", null, [".rpyrgl4{display:inline-flex;font-size:16px;height:16px;line-height:16px;width:16px;}", ".rpyrgl4>.fai-Reference__graphicChild{height:16px;width:16px;}"]);
|
|
39
|
+
const useContentBaseClassName = __resetStyles("r1ycou3l", null, [".r1ycou3l{align-items:center;column-gap:var(--spacingHorizontalSNudge);display:inline-flex;text-align:start;word-break:break-word;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"]);
|
|
40
|
+
/**
|
|
41
|
+
* Apply styling to the Reference slots based on the state
|
|
42
|
+
*/
|
|
43
|
+
export const useReferenceStyles_unstable = state => {
|
|
44
|
+
'use no memo';
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
designVersion
|
|
48
|
+
} = state;
|
|
49
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
50
|
+
const rootNextStyles = useRootNextStyles();
|
|
51
|
+
const citationBaseClassName = useCitationBaseClassName();
|
|
52
|
+
const dividerBaseClassName = useDividerBaseClassName();
|
|
53
|
+
const contentBaseClassName = useContentBaseClassName();
|
|
54
|
+
const graphicBaseClassName = useGraphicBaseClassName();
|
|
55
|
+
state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, designVersion === 'next' && rootNextStyles.root, state.root.className);
|
|
56
|
+
if (state.citation) {
|
|
57
|
+
state.citation.className = mergeClasses(referenceClassNames.citation, citationBaseClassName, state.citation.className);
|
|
58
|
+
}
|
|
59
|
+
if (state.divider) {
|
|
60
|
+
state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, state.divider.className);
|
|
61
|
+
}
|
|
62
|
+
if (state.content) {
|
|
63
|
+
state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
64
|
+
}
|
|
65
|
+
if (state.graphic) {
|
|
66
|
+
state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);
|
|
67
|
+
}
|
|
68
|
+
return state;
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=useReferenceStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\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: 'inline-flex',\n flexShrink: 0,\n justifyContent: 'center',\n maxWidth: '100%',\n minHeight: '24px',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n textDecoration: 'none',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n overflow: {\n maxWidth: '100%',\n width: '100%',\n },\n});\n\nconst useRootNextStyles = makeStyles({ root: { borderRadius: tokens.borderRadiusXLarge } });\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n display: 'inline-flex',\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 alignItems: 'center',\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n textAlign: 'start',\n wordBreak: 'break-word',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n 'use no memo';\n\n const { designVersion } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootNextStyles = useRootNextStyles();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootBaseClassName,\n designVersion === 'next' && rootNextStyles.root,\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(referenceClassNames.divider, dividerBaseClassName, state.divider.className);\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","referenceClassNames","root","citation","divider","graphic","content","referenceExtraClassNames","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","alignItems","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","boxSizing","color","colorNeutralForeground2","columnGap","spacingHorizontalXXS","display","flexShrink","justifyContent","maxWidth","minHeight","padding","spacingVerticalXXS","spacingHorizontalS","textDecoration","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useRootStyles","overflow","width","useRootNextStyles","borderRadiusXLarge","useCitationBaseClassName","caption2Strong","useDividerBaseClassName","height","margin","spacingVerticalNone","spacingHorizontalXS","useGraphicBaseClassName","fontSize","lineHeight","useContentBaseClassName","spacingHorizontalSNudge","textAlign","wordBreak","caption1","useReferenceStyles_unstable","state","designVersion","rootBaseClassName","rootNextStyles","citationBaseClassName","dividerBaseClassName","contentBaseClassName","graphicBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACvF,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,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,uBAAuBd,gBAAg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uD,MAAMvD,OAAO,CAAC+D,SAAS,GAAGvE,aAAaG,oBAAoBK,OAAO,EAAE6D,sBAAsBN,MAAMvD,OAAO,CAAC+D,SAAS;IACnH;IAEA,IAAIR,MAAMxD,OAAO,EAAE;QACjBwD,MAAMxD,OAAO,CAACgE,SAAS,GAAGvE,aAAaG,oBAAoBI,OAAO,EAAE+D,sBAAsBP,MAAMxD,OAAO,CAACgE,SAAS;IACnH;IAEA,OAAOR;AACT,EAAE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const referenceClassNames = {
|
|
4
|
+
root: 'fai-Reference',
|
|
5
|
+
citation: 'fai-Reference__citation',
|
|
6
|
+
divider: 'fai-Reference__divider',
|
|
7
|
+
graphic: 'fai-Reference__graphic',
|
|
8
|
+
content: 'fai-Reference__content'
|
|
9
|
+
};
|
|
10
|
+
export const referenceExtraClassNames = {
|
|
11
|
+
graphicChild: 'fai-Reference__graphicChild'
|
|
12
|
+
};
|
|
13
|
+
const GRAPHIC_SIZE = '16px';
|
|
14
|
+
const useRootBaseClassName = makeResetStyles({
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
backgroundColor: tokens.colorNeutralBackground3,
|
|
17
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,
|
|
18
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
19
|
+
boxSizing: 'border-box',
|
|
20
|
+
color: tokens.colorNeutralForeground2,
|
|
21
|
+
columnGap: tokens.spacingHorizontalXXS,
|
|
22
|
+
display: 'inline-flex',
|
|
23
|
+
flexShrink: 0,
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
maxWidth: '100%',
|
|
26
|
+
minHeight: '24px',
|
|
27
|
+
padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,
|
|
28
|
+
textDecoration: 'none',
|
|
29
|
+
':hover': {
|
|
30
|
+
backgroundColor: tokens.colorNeutralBackground3Hover,
|
|
31
|
+
borderColor: tokens.colorNeutralStroke1Hover,
|
|
32
|
+
color: tokens.colorNeutralForeground2Hover,
|
|
33
|
+
[`& .${referenceClassNames.divider}`]: {
|
|
34
|
+
backgroundColor: tokens.colorNeutralStroke1Hover
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
':hover:active': {
|
|
38
|
+
backgroundColor: tokens.colorNeutralBackground3Pressed,
|
|
39
|
+
borderColor: tokens.colorNeutralStroke1Pressed,
|
|
40
|
+
color: tokens.colorNeutralForeground2Pressed,
|
|
41
|
+
[`& .${referenceClassNames.divider}`]: {
|
|
42
|
+
backgroundColor: tokens.colorNeutralStroke1Pressed
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
export const useRootStyles = makeStyles({
|
|
47
|
+
overflow: {
|
|
48
|
+
maxWidth: '100%',
|
|
49
|
+
width: '100%'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
const useRootNextStyles = makeStyles({
|
|
53
|
+
root: {
|
|
54
|
+
borderRadius: tokens.borderRadiusXLarge
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const useCitationBaseClassName = makeResetStyles({
|
|
58
|
+
...typographyStyles.caption2Strong
|
|
59
|
+
});
|
|
60
|
+
const useDividerBaseClassName = makeResetStyles({
|
|
61
|
+
backgroundColor: tokens.colorNeutralStroke2,
|
|
62
|
+
height: '16px',
|
|
63
|
+
margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,
|
|
64
|
+
width: '1px'
|
|
65
|
+
});
|
|
66
|
+
const useGraphicBaseClassName = makeResetStyles({
|
|
67
|
+
display: 'inline-flex',
|
|
68
|
+
fontSize: GRAPHIC_SIZE,
|
|
69
|
+
height: GRAPHIC_SIZE,
|
|
70
|
+
lineHeight: GRAPHIC_SIZE,
|
|
71
|
+
width: GRAPHIC_SIZE,
|
|
72
|
+
[`> .${referenceExtraClassNames.graphicChild}`]: {
|
|
73
|
+
height: GRAPHIC_SIZE,
|
|
74
|
+
width: GRAPHIC_SIZE
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
const useContentBaseClassName = makeResetStyles({
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
columnGap: tokens.spacingHorizontalSNudge,
|
|
80
|
+
display: 'inline-flex',
|
|
81
|
+
textAlign: 'start',
|
|
82
|
+
wordBreak: 'break-word',
|
|
83
|
+
...typographyStyles.caption1
|
|
84
|
+
});
|
|
85
|
+
/**
|
|
86
|
+
* Apply styling to the Reference slots based on the state
|
|
87
|
+
*/ export const useReferenceStyles_unstable = (state)=>{
|
|
88
|
+
'use no memo';
|
|
89
|
+
const { designVersion } = state;
|
|
90
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
91
|
+
const rootNextStyles = useRootNextStyles();
|
|
92
|
+
const citationBaseClassName = useCitationBaseClassName();
|
|
93
|
+
const dividerBaseClassName = useDividerBaseClassName();
|
|
94
|
+
const contentBaseClassName = useContentBaseClassName();
|
|
95
|
+
const graphicBaseClassName = useGraphicBaseClassName();
|
|
96
|
+
state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, designVersion === 'next' && rootNextStyles.root, state.root.className);
|
|
97
|
+
if (state.citation) {
|
|
98
|
+
state.citation.className = mergeClasses(referenceClassNames.citation, citationBaseClassName, state.citation.className);
|
|
99
|
+
}
|
|
100
|
+
if (state.divider) {
|
|
101
|
+
state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, state.divider.className);
|
|
102
|
+
}
|
|
103
|
+
if (state.content) {
|
|
104
|
+
state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
105
|
+
}
|
|
106
|
+
if (state.graphic) {
|
|
107
|
+
state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);
|
|
108
|
+
}
|
|
109
|
+
return state;
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\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: 'inline-flex',\n flexShrink: 0,\n justifyContent: 'center',\n maxWidth: '100%',\n minHeight: '24px',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n textDecoration: 'none',\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Hover,\n },\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n\n [`& .${referenceClassNames.divider}`]: {\n backgroundColor: tokens.colorNeutralStroke1Pressed,\n },\n },\n});\n\nexport const useRootStyles = makeStyles({\n overflow: {\n maxWidth: '100%',\n width: '100%',\n },\n});\n\nconst useRootNextStyles = makeStyles({ root: { borderRadius: tokens.borderRadiusXLarge } });\n\nconst useCitationBaseClassName = makeResetStyles({\n ...typographyStyles.caption2Strong,\n});\n\nconst useDividerBaseClassName = makeResetStyles({\n backgroundColor: tokens.colorNeutralStroke2,\n height: '16px',\n margin: `${tokens.spacingVerticalNone} ${tokens.spacingHorizontalXS}`,\n width: '1px',\n});\n\nconst useGraphicBaseClassName = makeResetStyles({\n display: 'inline-flex',\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 alignItems: 'center',\n columnGap: tokens.spacingHorizontalSNudge,\n display: 'inline-flex',\n textAlign: 'start',\n wordBreak: 'break-word',\n ...typographyStyles.caption1,\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n 'use no memo';\n\n const { designVersion } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const rootNextStyles = useRootNextStyles();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const graphicBaseClassName = useGraphicBaseClassName();\n\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootBaseClassName,\n designVersion === 'next' && rootNextStyles.root,\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(referenceClassNames.divider, dividerBaseClassName, state.divider.className);\n }\n\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n\n if (state.graphic) {\n state.graphic.className = mergeClasses(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);\n }\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","tokens","typographyStyles","referenceClassNames","root","citation","divider","graphic","content","referenceExtraClassNames","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","alignItems","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","boxSizing","color","colorNeutralForeground2","columnGap","spacingHorizontalXXS","display","flexShrink","justifyContent","maxWidth","minHeight","padding","spacingVerticalXXS","spacingHorizontalS","textDecoration","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useRootStyles","overflow","width","useRootNextStyles","borderRadiusXLarge","useCitationBaseClassName","caption2Strong","useDividerBaseClassName","height","margin","spacingVerticalNone","spacingHorizontalXS","useGraphicBaseClassName","fontSize","lineHeight","useContentBaseClassName","spacingHorizontalSNudge","textAlign","wordBreak","caption1","useReferenceStyles_unstable","state","designVersion","rootBaseClassName","rootNextStyles","citationBaseClassName","dividerBaseClassName","contentBaseClassName","graphicBaseClassName","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACvF,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,2BAA2B;AAIpE,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,uBAAuBd,gBAAgB;IAC3Ce,YAAY;IACZC,iBAAiBb,OAAOc,uBAAuB;IAC/CC,QAAQ,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AAE6D,sBAAsBN,MAAMvD,OAAO,CAAC+D,SAAS;IACnH;IAEA,IAAIR,MAAMxD,OAAO,EAAE;QACjBwD,MAAMxD,OAAO,CAACgE,SAAS,GAAGvE,aAAaG,oBAAoBI,OAAO,EAAE+D,sBAAsBP,MAAMxD,OAAO,CAACgE,SAAS;IACnH;IAEA,OAAOR;AACT,EAAE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { renderReferenceList_unstable } from './renderReferenceList';
|
|
3
|
+
import { useReferenceList_unstable } from './useReferenceList';
|
|
4
|
+
import { useReferenceListStyles_unstable } from './useReferenceListStyles.styles';
|
|
5
|
+
import { useReferenceListContextValues_unstable } from './useReferenceListContextValues';
|
|
6
|
+
export const ReferenceList = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
7
|
+
const state = useReferenceList_unstable(props, ref);
|
|
8
|
+
const referenceListContextValues = useReferenceListContextValues_unstable(state);
|
|
9
|
+
useReferenceListStyles_unstable(state);
|
|
10
|
+
return renderReferenceList_unstable(state, referenceListContextValues);
|
|
11
|
+
});
|
|
12
|
+
ReferenceList.displayName = 'ReferenceList';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceList.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\nimport { renderReferenceList_unstable } from './renderReferenceList';\nimport { useReferenceList_unstable } from './useReferenceList';\nimport { useReferenceListStyles_unstable } from './useReferenceListStyles.styles';\nimport { useReferenceListContextValues_unstable } from './useReferenceListContextValues';\nimport type { ReferenceListProps } from './ReferenceList.types';\n\nexport const ReferenceList: ForwardRefComponent<ReferenceListProps> = React.forwardRef((props, ref) => {\n const state = useReferenceList_unstable(props, ref);\n const referenceListContextValues = useReferenceListContextValues_unstable(state);\n\n useReferenceListStyles_unstable(state);\n\n return renderReferenceList_unstable(state, referenceListContextValues);\n});\n\nReferenceList.displayName = 'ReferenceList';\n"],"names":["React","renderReferenceList_unstable","useReferenceList_unstable","useReferenceListStyles_unstable","useReferenceListContextValues_unstable","ReferenceList","forwardRef","props","ref","state","referenceListContextValues","displayName"],"rangeMappings":";;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,+BAA+B,QAAQ,kCAAkC;AAClF,SAASC,sCAAsC,QAAQ,kCAAkC;AAGzF,OAAO,MAAMC,8BAAyDL,MAAMM,UAAU,CAAC,CAACC,OAAOC;IAC7F,MAAMC,QAAQP,0BAA0BK,OAAOC;IAC/C,MAAME,6BAA6BN,uCAAuCK;IAE1EN,gCAAgCM;IAEhC,OAAOR,6BAA6BQ,OAAOC;AAC7C,GAAG;AAEHL,cAAcM,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +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 | null>;\n shouldUseOverflow: boolean;\n totalReferencesCount: number;\n };\n\nexport type ReferenceListContextValues = {\n referenceList: ReferenceListContextValue;\n};\n"],"names":[],"rangeMappings":"","mappings":"AA6CA,WAEE"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ReferenceList } from './ReferenceList';
|
|
2
|
+
export { renderReferenceList_unstable } from './renderReferenceList';
|
|
3
|
+
export { useReferenceList_unstable } from './useReferenceList';
|
|
4
|
+
export { referenceListClassNames, useReferenceListStyles_unstable } from './useReferenceListStyles.styles';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export { ReferenceList } from './ReferenceList';\nexport type { ReferenceListContextValues, ReferenceListProps, ReferenceListSlots, ReferenceListState } from './ReferenceList.types';\nexport { renderReferenceList_unstable } from './renderReferenceList';\nexport { useReferenceList_unstable } from './useReferenceList';\nexport { referenceListClassNames, useReferenceListStyles_unstable } from './useReferenceListStyles.styles';\n"],"names":["ReferenceList","renderReferenceList_unstable","useReferenceList_unstable","referenceListClassNames","useReferenceListStyles_unstable"],"rangeMappings":";;;","mappings":"AAAA,SAASA,aAAa,QAAQ,kBAAkB;AAEhD,SAASC,4BAA4B,QAAQ,wBAAwB;AACrE,SAASC,yBAAyB,QAAQ,qBAAqB;AAC/D,SAASC,uBAAuB,EAAEC,+BAA+B,QAAQ,kCAAkC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { Overflow, assertSlots } from '@fluentui/react-components';
|
|
3
|
+
import { ReferenceListContextProvider } from '../../contexts/referenceListContext';
|
|
4
|
+
/**
|
|
5
|
+
* Render the final JSX of ReferenceList
|
|
6
|
+
*/ export const renderReferenceList_unstable = (state, contextValues)=>{
|
|
7
|
+
assertSlots(state);
|
|
8
|
+
const { minVisibleReferences } = state;
|
|
9
|
+
return /*#__PURE__*/ _jsx(ReferenceListContextProvider, {
|
|
10
|
+
value: contextValues.referenceList,
|
|
11
|
+
children: /*#__PURE__*/ _jsx(Overflow, {
|
|
12
|
+
minimumVisible: minVisibleReferences,
|
|
13
|
+
children: /*#__PURE__*/ _jsxs(state.root, {
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ _jsx(state.arrowableRegion, {}),
|
|
16
|
+
state.showMoreButton && /*#__PURE__*/ _jsx(state.showMoreButton, {}),
|
|
17
|
+
state.showLessButton && /*#__PURE__*/ _jsx(state.showLessButton, {})
|
|
18
|
+
]
|
|
19
|
+
})
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
};
|
|
@@ -0,0 +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';\nimport type { JSXElement } from '@fluentui/react-components';\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"}
|