@fluentui-copilot/react-reference 0.16.2 → 0.16.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +16 -1
- package/CHANGELOG.md +11 -2
- package/lib/Citation.js +0 -1
- package/lib/Reference.js +0 -1
- package/lib/ReferenceList.js +0 -1
- package/lib/ReferenceOverflowButton.js +0 -1
- package/lib/components/Citation/Citation.js +5 -6
- package/lib/components/Citation/Citation.types.js +1 -2
- package/lib/components/Citation/index.js +0 -1
- package/lib/components/Citation/renderCitation.js +4 -6
- package/lib/components/Citation/useCitation.js +22 -28
- package/lib/components/Citation/useCitationStyles.styles.raw.js +69 -0
- package/lib/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib/components/Reference/Reference.js +4 -5
- package/lib/components/Reference/Reference.types.js +1 -2
- package/lib/components/Reference/index.js +0 -1
- package/lib/components/Reference/renderReference.js +20 -17
- package/lib/components/Reference/useReference.js +53 -59
- 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 +5 -6
- package/lib/components/ReferenceList/ReferenceList.types.js +1 -2
- package/lib/components/ReferenceList/index.js +0 -1
- package/lib/components/ReferenceList/renderReferenceList.js +17 -17
- package/lib/components/ReferenceList/useReferenceList.js +70 -80
- package/lib/components/ReferenceList/useReferenceListContextValues.js +13 -21
- 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 +4 -5
- package/lib/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js +1 -2
- package/lib/components/ReferenceOverflowButton/index.js +0 -1
- package/lib/components/ReferenceOverflowButton/renderReferenceOverflowButton.js +9 -14
- package/lib/components/ReferenceOverflowButton/useReferenceOverflowButton.js +77 -77
- 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 +0 -1
- package/lib/contexts/referenceListContext.js +11 -12
- package/lib/index.js +12 -25
- package/lib/utilities/generateReferenceCitationPreview.js +75 -86
- package/lib/utilities/index.js +0 -1
- package/lib/utilities/useReferenceCitationPreview.js +5 -5
- package/lib-commonjs/Citation.js +0 -1
- package/lib-commonjs/Reference.js +0 -1
- package/lib-commonjs/ReferenceList.js +0 -1
- package/lib-commonjs/ReferenceOverflowButton.js +0 -1
- package/lib-commonjs/components/Citation/Citation.js +1 -1
- package/lib-commonjs/components/Citation/Citation.js.map +1 -1
- package/lib-commonjs/components/Citation/Citation.types.js +0 -1
- package/lib-commonjs/components/Citation/index.js +0 -1
- package/lib-commonjs/components/Citation/renderCitation.js +1 -1
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitation.js +1 -1
- package/lib-commonjs/components/Citation/useCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js +85 -0
- package/lib-commonjs/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Reference/Reference.js +1 -1
- package/lib-commonjs/components/Reference/Reference.js.map +1 -1
- package/lib-commonjs/components/Reference/Reference.types.js +0 -1
- package/lib-commonjs/components/Reference/index.js +0 -1
- package/lib-commonjs/components/Reference/renderReference.js +1 -1
- package/lib-commonjs/components/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReference.js +1 -1
- package/lib-commonjs/components/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js +132 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ReferenceList/ReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/ReferenceList.types.js +0 -1
- package/lib-commonjs/components/ReferenceList/index.js +0 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceList.js.map +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListContextValues.js +1 -1
- package/lib-commonjs/components/ReferenceList/useReferenceListContextValues.js.map +1 -1
- 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 +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/ReferenceOverflowButton.types.js +0 -1
- package/lib-commonjs/components/ReferenceOverflowButton/index.js +0 -1
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -1
- 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 +0 -1
- package/lib-commonjs/contexts/referenceListContext.js +1 -1
- package/lib-commonjs/contexts/referenceListContext.js.map +1 -1
- package/lib-commonjs/index.js +0 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/generateReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/index.js +0 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
referenceClassNames: function() {
|
|
13
|
+
return referenceClassNames;
|
|
14
|
+
},
|
|
15
|
+
referenceExtraClassNames: function() {
|
|
16
|
+
return referenceExtraClassNames;
|
|
17
|
+
},
|
|
18
|
+
useReferenceStyles_unstable: function() {
|
|
19
|
+
return useReferenceStyles_unstable;
|
|
20
|
+
},
|
|
21
|
+
useRootStyles: function() {
|
|
22
|
+
return useRootStyles;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
26
|
+
const _tokens = require("@fluentui-copilot/tokens");
|
|
27
|
+
const referenceClassNames = {
|
|
28
|
+
root: 'fai-Reference',
|
|
29
|
+
citation: 'fai-Reference__citation',
|
|
30
|
+
divider: 'fai-Reference__divider',
|
|
31
|
+
graphic: 'fai-Reference__graphic',
|
|
32
|
+
content: 'fai-Reference__content'
|
|
33
|
+
};
|
|
34
|
+
const referenceExtraClassNames = {
|
|
35
|
+
graphicChild: 'fai-Reference__graphicChild'
|
|
36
|
+
};
|
|
37
|
+
const GRAPHIC_SIZE = '16px';
|
|
38
|
+
const useRootBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground3,
|
|
41
|
+
border: `${_tokens.tokens.strokeWidthThin} solid ${_tokens.tokens.colorNeutralStroke2}`,
|
|
42
|
+
borderRadius: _tokens.tokens.borderRadiusMedium,
|
|
43
|
+
boxSizing: 'border-box',
|
|
44
|
+
color: _tokens.tokens.colorNeutralForeground2,
|
|
45
|
+
columnGap: _tokens.tokens.spacingHorizontalXXS,
|
|
46
|
+
display: 'inline-flex',
|
|
47
|
+
flexShrink: 0,
|
|
48
|
+
justifyContent: 'center',
|
|
49
|
+
maxWidth: '100%',
|
|
50
|
+
minHeight: '24px',
|
|
51
|
+
padding: `${_tokens.tokens.spacingVerticalXXS} ${_tokens.tokens.spacingHorizontalS}`,
|
|
52
|
+
textDecoration: 'none',
|
|
53
|
+
':hover': {
|
|
54
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground3Hover,
|
|
55
|
+
borderColor: _tokens.tokens.colorNeutralStroke1Hover,
|
|
56
|
+
color: _tokens.tokens.colorNeutralForeground2Hover,
|
|
57
|
+
[`& .${referenceClassNames.divider}`]: {
|
|
58
|
+
backgroundColor: _tokens.tokens.colorNeutralStroke1Hover
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
':hover:active': {
|
|
62
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground3Pressed,
|
|
63
|
+
borderColor: _tokens.tokens.colorNeutralStroke1Pressed,
|
|
64
|
+
color: _tokens.tokens.colorNeutralForeground2Pressed,
|
|
65
|
+
[`& .${referenceClassNames.divider}`]: {
|
|
66
|
+
backgroundColor: _tokens.tokens.colorNeutralStroke1Pressed
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
const useRootStyles = (0, _reactcomponents.makeStyles)({
|
|
71
|
+
overflow: {
|
|
72
|
+
maxWidth: '100%',
|
|
73
|
+
width: '100%'
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const useRootNextStyles = (0, _reactcomponents.makeStyles)({
|
|
77
|
+
root: {
|
|
78
|
+
borderRadius: _tokens.tokens.borderRadiusXLarge
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
const useCitationBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
82
|
+
..._tokens.typographyStyles.caption2Strong
|
|
83
|
+
});
|
|
84
|
+
const useDividerBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
85
|
+
backgroundColor: _tokens.tokens.colorNeutralStroke2,
|
|
86
|
+
height: '16px',
|
|
87
|
+
margin: `${_tokens.tokens.spacingVerticalNone} ${_tokens.tokens.spacingHorizontalXS}`,
|
|
88
|
+
width: '1px'
|
|
89
|
+
});
|
|
90
|
+
const useGraphicBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
91
|
+
display: 'inline-flex',
|
|
92
|
+
fontSize: GRAPHIC_SIZE,
|
|
93
|
+
height: GRAPHIC_SIZE,
|
|
94
|
+
lineHeight: GRAPHIC_SIZE,
|
|
95
|
+
width: GRAPHIC_SIZE,
|
|
96
|
+
[`> .${referenceExtraClassNames.graphicChild}`]: {
|
|
97
|
+
height: GRAPHIC_SIZE,
|
|
98
|
+
width: GRAPHIC_SIZE
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const useContentBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
102
|
+
alignItems: 'center',
|
|
103
|
+
columnGap: _tokens.tokens.spacingHorizontalSNudge,
|
|
104
|
+
display: 'inline-flex',
|
|
105
|
+
textAlign: 'start',
|
|
106
|
+
wordBreak: 'break-word',
|
|
107
|
+
..._tokens.typographyStyles.caption1
|
|
108
|
+
});
|
|
109
|
+
const useReferenceStyles_unstable = (state)=>{
|
|
110
|
+
'use no memo';
|
|
111
|
+
const { designVersion } = state;
|
|
112
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
113
|
+
const rootNextStyles = useRootNextStyles();
|
|
114
|
+
const citationBaseClassName = useCitationBaseClassName();
|
|
115
|
+
const dividerBaseClassName = useDividerBaseClassName();
|
|
116
|
+
const contentBaseClassName = useContentBaseClassName();
|
|
117
|
+
const graphicBaseClassName = useGraphicBaseClassName();
|
|
118
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.root, rootBaseClassName, designVersion === 'next' && rootNextStyles.root, state.root.className);
|
|
119
|
+
if (state.citation) {
|
|
120
|
+
state.citation.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.citation, citationBaseClassName, state.citation.className);
|
|
121
|
+
}
|
|
122
|
+
if (state.divider) {
|
|
123
|
+
state.divider.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.divider, dividerBaseClassName, state.divider.className);
|
|
124
|
+
}
|
|
125
|
+
if (state.content) {
|
|
126
|
+
state.content.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
127
|
+
}
|
|
128
|
+
if (state.graphic) {
|
|
129
|
+
state.graphic.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.graphic, graphicBaseClassName, state.graphic.className);
|
|
130
|
+
}
|
|
131
|
+
return state;
|
|
132
|
+
};
|
|
@@ -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":["referenceClassNames","referenceExtraClassNames","useReferenceStyles_unstable","useRootStyles","root","citation","divider","graphic","content","graphicChild","GRAPHIC_SIZE","useRootBaseClassName","makeResetStyles","alignItems","backgroundColor","tokens","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","makeStyles","overflow","width","useRootNextStyles","borderRadiusXLarge","useCitationBaseClassName","typographyStyles","caption2Strong","useDividerBaseClassName","height","margin","spacingVerticalNone","spacingHorizontalXS","useGraphicBaseClassName","fontSize","lineHeight","useContentBaseClassName","spacingHorizontalSNudge","textAlign","wordBreak","caption1","state","designVersion","rootBaseClassName","rootNextStyles","citationBaseClassName","dividerBaseClassName","contentBaseClassName","graphicBaseClassName","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,mBAAAA;eAAAA;;IAQAC,wBAAAA;eAAAA;;IAwFAC,2BAAAA;eAAAA;;IA7CAC,aAAAA;eAAAA;;;iCAxD6C;wBACjB;AAIlC,MAAMH,sBAAsD;IACjEI,MAAM;IACNC,UAAU;IACVC,SAAS;IACTC,SAAS;IACTC,SAAS;AACX;AAEO,MAAMP,2BAA2B;IACtCQ,cAAc;AAChB;AAEA,MAAMC,eAAe;AAErB,MAAMC,uBAAuBC,IAAAA,gCAAAA,EAAgB;IAC3CC,YAAY;IACZC,iBAAiBC,cAAAA,CAAOC,uBAAuB;IAC/CC,QAAQ,CAAC,EAAEF,cAAAA,CAAOG,eAAe,CAAC,OAAO,EAAEH,cAAAA,CAAOI,mBAAmB,CAAC,CAAC;IACvEC,cAAcL,cAAAA,CAAOM,kBAAkB;IACvCC,WAAW;IACXC,OAAOR,cAAAA,CAAOS,uBAAuB;IACrCC,WAAWV,cAAAA,CAAOW,oBAAoB;IACtCC,SAAS;IACTC,YAAY;IACZC,gBAAgB;IAChBC,UAAU;IACVC,WAAW;IACXC,SAAS,CAAC,EAAEjB,cAAAA,CAAOkB,kBAAkB,CAAC,CAAC,EAAElB,cAAAA,CAAOmB,kBAAkB,CAAC,CAAC;IACpEC,gBAAgB;IAEhB,UAAU;QACRrB,iBAAiBC,cAAAA,CAAOqB,4BAA4B;QACpDC,aAAatB,cAAAA,CAAOuB,wBAAwB;QAC5Cf,OAAOR,cAAAA,CAAOwB,4BAA4B;QAE1C,CAAC,CAAC,GAAG,EAAEvC,oBAAoBM,O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
|
|
20
20
|
(0, _useReferenceListStylesstyles.useReferenceListStyles_unstable)(state);
|
|
21
21
|
return (0, _renderReferenceList.renderReferenceList_unstable)(state, referenceListContextValues);
|
|
22
22
|
});
|
|
23
|
-
ReferenceList.displayName = 'ReferenceList';
|
|
23
|
+
ReferenceList.displayName = 'ReferenceList';
|
|
@@ -1 +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":["ReferenceList","React","forwardRef","props","state","useReferenceList_unstable","referenceListContextValues","useReferenceListContextValues_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;qCAEsB;kCACH;8CACM;+CACO;AAGhD,MAAMA,gBAAAA,WAAAA,
|
|
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":["ReferenceList","React","forwardRef","props","ref","state","useReferenceList_unstable","referenceListContextValues","useReferenceListContextValues_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;qCAEsB;kCACH;8CACM;+CACO;AAGhD,MAAMA,gBAAAA,WAAAA,GAAyDC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC7F,MAAMC,QAAQC,IAAAA,2CAAAA,EAA0BH,OAAOC;IAC/C,MAAMG,6BAA6BC,IAAAA,qEAAAA,EAAuCH;IAE1EI,IAAAA,6DAAAA,EAAgCJ;IAEhC,OAAOK,IAAAA,iDAAAA,EAA6BL,OAAOE;AAC7C;AAEAP,cAAcW,WAAW,GAAG"}
|
|
@@ -29,4 +29,3 @@ const _ReferenceList = require("./ReferenceList");
|
|
|
29
29
|
const _renderReferenceList = require("./renderReferenceList");
|
|
30
30
|
const _useReferenceList = require("./useReferenceList");
|
|
31
31
|
const _useReferenceListStylesstyles = require("./useReferenceListStyles.styles");
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState, contextValues: ReferenceListContextValues) => {\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":["
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceListState, ReferenceListSlots, ReferenceListContextValues } from './ReferenceList.types';\nimport { ReferenceListContextProvider } from '../../contexts/referenceListContext';\n\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state: ReferenceListState, contextValues: ReferenceListContextValues) => {\n assertSlots<ReferenceListSlots>(state);\n\n const { minVisibleReferences } = state;\n\n return (\n <ReferenceListContextProvider value={contextValues.referenceList}>\n <Overflow minimumVisible={minVisibleReferences}>\n <state.root>\n <state.arrowableRegion />\n {state.showMoreButton && <state.showMoreButton />}\n {state.showLessButton && <state.showLessButton />}\n </state.root>\n </Overflow>\n </ReferenceListContextProvider>\n );\n};\n"],"names":["renderReferenceList_unstable","state","contextValues","assertSlots","minVisibleReferences","_jsx","ReferenceListContextProvider","value","referenceList","Overflow","minimumVisible","_jsxs","root","arrowableRegion","showMoreButton","showLessButton"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;iCAEsC;sCAEO;AAKtC,MAAMA,+BAA+B,CAACC,OAA2BC;IACtEC,IAAAA,4BAAAA,EAAgCF;IAEhC,MAAM,EAAEG,oBAAoB,EAAE,GAAGH;IAEjC,OAAA,WAAA,GACEI,IAAAA,eAAA,EAACC,kDAAAA,EAAAA;QAA6BC,OAAOL,cAAcM,aAAa;kBAC9D,WAAA,GAAAH,IAAAA,eAAA,EAACI,yBAAAA,EAAAA;YAASC,gBAAgBN;sBACxB,WAAA,GAAAO,IAAAA,gBAAA,EAACV,MAAMW,IAAI,EAAA;;kCACTP,IAAAA,eAAA,EAACJ,MAAMY,eAAe,EAAA,CAAA;oBACrBZ,MAAMa,cAAc,IAAA,WAAA,GAAIT,IAAAA,eAAA,EAACJ,MAAMa,cAAc,EAAA,CAAA;oBAC7Cb,MAAMc,cAAc,IAAA,WAAA,GAAIV,IAAAA,eAAA,EAACJ,MAAMc,cAAc,EAAA,CAAA;;;;;AAKxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useArrowNavigationGroup,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport { useOverflowMaxVisibleItems } from '@fluentui-copilot/react-utilities';\nimport { useRootStyles } from '../Reference/useReferenceStyles.styles';\nimport type { ReferenceListProps, ReferenceListState } from './ReferenceList.types';\n\n/**\n * Create the state required to render ReferenceList.\n *\n * The returned state can be modified with hooks such as useReferenceListStyles_unstable,\n * before being passed to renderReferenceList_unstable.\n *\n * @param props - props from this instance of ReferenceList\n * @param ref - reference to root HTMLElement of ReferenceList\n */\nexport const useReferenceList_unstable = (\n props: ReferenceListProps,\n ref: React.Ref<HTMLDivElement>,\n): ReferenceListState => {\n const {\n arrowableRegion,\n children,\n maxVisibleReferences,\n minVisibleReferences,\n showLessButton,\n showMoreButton,\n ...rest\n } = props;\n\n const [areReferencesExpanded, setAreReferencesExpanded] = React.useState(false);\n const referenceListRef = React.useRef<HTMLDivElement>(null);\n\n const totalReferencesCount = React.Children.count(children);\n const styles = useRootStyles();\n const resolvedChildren = useOverflowMaxVisibleItems({\n additionalCondition: !areReferencesExpanded,\n children,\n maxVisibleItems: maxVisibleReferences,\n minVisibleItems: minVisibleReferences,\n overflowClassName: styles.overflow,\n });\n\n // We keep track of whether we are interacting with the overflow button via keyboard or not.\n const overflowButtonTriggeredViaKeyboard = React.useRef(false);\n\n const focusAttributes = useArrowNavigationGroup({\n axis: 'both',\n circular: true,\n memorizeCurrent: true,\n });\n\n const onShowMoreButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(true);\n }, []);\n\n const onShowLessButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(false);\n }, []);\n\n const shouldUseOverflow =\n (minVisibleReferences === undefined || minVisibleReferences < totalReferencesCount) &&\n maxVisibleReferences !== undefined &&\n !areReferencesExpanded;\n\n // Since the overflow button is an OverflowItem that's always visible, we need to account for it.\n const minVisibleOverflowItems = minVisibleReferences ? minVisibleReferences + 1 : 1;\n\n const state: ReferenceListState = {\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n maxVisibleReferences,\n minVisibleReferences: minVisibleOverflowItems,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n\n components: {\n root: 'div',\n arrowableRegion: 'div',\n showMoreButton: 'span',\n showLessButton: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, referenceListRef),\n ...rest,\n }),\n { elementType: 'div' },\n ),\n arrowableRegion: slot.always(arrowableRegion, {\n defaultProps: { ...focusAttributes, children: resolvedChildren },\n elementType: 'div',\n }),\n showMoreButton: shouldUseOverflow ? slot.optional(showMoreButton, { elementType: 'span' }) : undefined,\n showLessButton: areReferencesExpanded ? slot.optional(showLessButton, { elementType: 'span' }) : undefined,\n };\n\n if (state.showMoreButton) {\n state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);\n }\n\n if (state.showLessButton) {\n state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);\n }\n\n return state;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["useReferenceList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useArrowNavigationGroup,\n useMergedRefs,\n} from '@fluentui/react-components';\nimport { useOverflowMaxVisibleItems } from '@fluentui-copilot/react-utilities';\nimport { useRootStyles } from '../Reference/useReferenceStyles.styles';\nimport type { ReferenceListProps, ReferenceListState } from './ReferenceList.types';\n\n/**\n * Create the state required to render ReferenceList.\n *\n * The returned state can be modified with hooks such as useReferenceListStyles_unstable,\n * before being passed to renderReferenceList_unstable.\n *\n * @param props - props from this instance of ReferenceList\n * @param ref - reference to root HTMLElement of ReferenceList\n */\nexport const useReferenceList_unstable = (\n props: ReferenceListProps,\n ref: React.Ref<HTMLDivElement>,\n): ReferenceListState => {\n const {\n arrowableRegion,\n children,\n maxVisibleReferences,\n minVisibleReferences,\n showLessButton,\n showMoreButton,\n ...rest\n } = props;\n\n const [areReferencesExpanded, setAreReferencesExpanded] = React.useState(false);\n const referenceListRef = React.useRef<HTMLDivElement>(null);\n\n const totalReferencesCount = React.Children.count(children);\n const styles = useRootStyles();\n const resolvedChildren = useOverflowMaxVisibleItems({\n additionalCondition: !areReferencesExpanded,\n children,\n maxVisibleItems: maxVisibleReferences,\n minVisibleItems: minVisibleReferences,\n overflowClassName: styles.overflow,\n });\n\n // We keep track of whether we are interacting with the overflow button via keyboard or not.\n const overflowButtonTriggeredViaKeyboard = React.useRef(false);\n\n const focusAttributes = useArrowNavigationGroup({\n axis: 'both',\n circular: true,\n memorizeCurrent: true,\n });\n\n const onShowMoreButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(true);\n }, []);\n\n const onShowLessButtonClick = React.useCallback<React.MouseEventHandler<HTMLButtonElement>>(() => {\n setAreReferencesExpanded(false);\n }, []);\n\n const shouldUseOverflow =\n (minVisibleReferences === undefined || minVisibleReferences < totalReferencesCount) &&\n maxVisibleReferences !== undefined &&\n !areReferencesExpanded;\n\n // Since the overflow button is an OverflowItem that's always visible, we need to account for it.\n const minVisibleOverflowItems = minVisibleReferences ? minVisibleReferences + 1 : 1;\n\n const state: ReferenceListState = {\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n maxVisibleReferences,\n minVisibleReferences: minVisibleOverflowItems,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n\n components: {\n root: 'div',\n arrowableRegion: 'div',\n showMoreButton: 'span',\n showLessButton: 'span',\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref: useMergedRefs(ref, referenceListRef),\n ...rest,\n }),\n { elementType: 'div' },\n ),\n arrowableRegion: slot.always(arrowableRegion, {\n defaultProps: { ...focusAttributes, children: resolvedChildren },\n elementType: 'div',\n }),\n showMoreButton: shouldUseOverflow ? slot.optional(showMoreButton, { elementType: 'span' }) : undefined,\n showLessButton: areReferencesExpanded ? slot.optional(showLessButton, { elementType: 'span' }) : undefined,\n };\n\n if (state.showMoreButton) {\n state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);\n }\n\n if (state.showLessButton) {\n state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);\n }\n\n return state;\n};\n"],"names":["useReferenceList_unstable","props","ref","arrowableRegion","children","maxVisibleReferences","minVisibleReferences","showLessButton","showMoreButton","rest","areReferencesExpanded","setAreReferencesExpanded","React","useState","referenceListRef","useRef","totalReferencesCount","Children","count","styles","useRootStyles","resolvedChildren","useOverflowMaxVisibleItems","additionalCondition","maxVisibleItems","minVisibleItems","overflowClassName","overflow","overflowButtonTriggeredViaKeyboard","focusAttributes","useArrowNavigationGroup","axis","circular","memorizeCurrent","onShowMoreButtonClick","useCallback","onShowLessButtonClick","shouldUseOverflow","undefined","minVisibleOverflowItems","state","components","root","slot","always","getIntrinsicElementProps","useMergedRefs","elementType","defaultProps","optional","onClick","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAgB;YAChBD,gBAAgB;QAClB;QACAmC,MAAMC,qBAAAA,CAAKC,MAAM,CACfC,IAAAA,yCAAAA,EAAyB,OAAO;YAC9B3C,KAAK4C,IAAAA,8BAAAA,EAAc5C,KAAKY;YACxB,GAAGL,IAAI;QACT,IACA;YAAEsC,aAAa;QAAM;QAEvB5C,iBAAiBwC,qBAAAA,CAAKC,MAAM,CAACzC,iBAAiB;YAC5C6C,cAAc;gBAAE,GAAGnB,eAAe;gBAAEzB,UAAUiB;YAAiB;YAC/D0B,aAAa;QACf;QACAvC,gBAAgB6B,oBAAoBM,qBAAAA,CAAKM,QAAQ,CAACzC,gBAAgB;YAAEuC,aAAa;QAAO,KAAKT;QAC7F/B,gBAAgBG,wBAAwBiC,qBAAAA,CAAKM,QAAQ,CAAC1C,gBAAgB;YAAEwC,aAAa;QAAO,KAAKT;IACnG;IAEA,IAAIE,MAAMhC,cAAc,EAAE;QACxBgC,MAAMhC,cAAc,CAAC0C,OAAO,GAAGC,IAAAA,+BAAAA,EAAejB,uBAAuBM,MAAMhC,cAAc,CAAC0C,OAAO;IACnG;IAEA,IAAIV,MAAMjC,cAAc,EAAE;QACxBiC,MAAMjC,cAAc,CAAC2C,OAAO,GAAGC,IAAAA,+BAAAA,EAAef,uBAAuBI,MAAMjC,cAAc,CAAC2C,OAAO;IACnG;IAEA,OAAOV;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceListContextValues.ts"],"sourcesContent":["import type { ReferenceListState, ReferenceListContextValues } from './ReferenceList.types';\n\nexport function useReferenceListContextValues_unstable(state: ReferenceListState): ReferenceListContextValues {\n const {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const referenceList = {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n };\n\n return { referenceList };\n}\n"],"names":["useReferenceListContextValues_unstable","state","areReferencesExpanded","maxVisibleReferences","
|
|
1
|
+
{"version":3,"sources":["useReferenceListContextValues.ts"],"sourcesContent":["import type { ReferenceListState, ReferenceListContextValues } from './ReferenceList.types';\n\nexport function useReferenceListContextValues_unstable(state: ReferenceListState): ReferenceListContextValues {\n const {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const referenceList = {\n areReferencesExpanded,\n maxVisibleReferences,\n overflowButtonTriggeredViaKeyboard,\n referenceListRef,\n shouldUseOverflow,\n totalReferencesCount,\n };\n\n return { referenceList };\n}\n"],"names":["useReferenceListContextValues_unstable","state","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","referenceListRef","shouldUseOverflow","totalReferencesCount","referenceList"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,uCAAuCC,KAAyB;IAC9E,MAAM,EACJC,qBAAqB,EACrBC,oBAAoB,EACpBC,kCAAkC,EAClCC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACrB,GAAGN;IAEJ,mGAAmG;IACnG,MAAMO,gBAAgB;QACpBN;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,OAAO;QAAEC;IAAc;AACzB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
referenceListClassNames: function() {
|
|
13
|
+
return referenceListClassNames;
|
|
14
|
+
},
|
|
15
|
+
useReferenceListStyles_unstable: function() {
|
|
16
|
+
return useReferenceListStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
20
|
+
const _tokens = require("@fluentui-copilot/tokens");
|
|
21
|
+
const referenceListClassNames = {
|
|
22
|
+
root: 'fai-ReferenceList',
|
|
23
|
+
arrowableRegion: 'fai-ReferenceList__arrowableRegion',
|
|
24
|
+
showMoreButton: 'fai-ReferenceList__showMoreButton',
|
|
25
|
+
showLessButton: 'fai-ReferenceList__showLessButton'
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Styles for the root slot
|
|
29
|
+
*/ const useRootBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
gap: `${_tokens.tokens.spacingVerticalXS} ${_tokens.tokens.spacingHorizontalXS}`
|
|
33
|
+
});
|
|
34
|
+
const useRootStyles = (0, _reactcomponents.makeStyles)({
|
|
35
|
+
referencesExpanded: {
|
|
36
|
+
flexWrap: 'wrap'
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
const useArrowableRegionBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
40
|
+
display: 'contents',
|
|
41
|
+
maxWidth: '100%'
|
|
42
|
+
});
|
|
43
|
+
const useOverflowButtonBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
44
|
+
display: 'inline-flex',
|
|
45
|
+
flexShrink: 0
|
|
46
|
+
});
|
|
47
|
+
const useReferenceListStyles_unstable = (state)=>{
|
|
48
|
+
'use no memo';
|
|
49
|
+
const { areReferencesExpanded, shouldUseOverflow } = state;
|
|
50
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
51
|
+
const arrowableRegionBaseClassName = useArrowableRegionBaseClassName();
|
|
52
|
+
const overflowButtonBaseClassName = useOverflowButtonBaseClassName();
|
|
53
|
+
const rootStyles = useRootStyles();
|
|
54
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.root, rootBaseClassName, (areReferencesExpanded || !shouldUseOverflow) && rootStyles.referencesExpanded, state.root.className);
|
|
55
|
+
state.arrowableRegion.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.arrowableRegion, arrowableRegionBaseClassName, state.arrowableRegion.className);
|
|
56
|
+
if (state.showMoreButton) {
|
|
57
|
+
state.showMoreButton.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.showMoreButton, overflowButtonBaseClassName, state.showMoreButton.className);
|
|
58
|
+
}
|
|
59
|
+
if (state.showLessButton) {
|
|
60
|
+
state.showLessButton.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.showLessButton, overflowButtonBaseClassName, state.showLessButton.className);
|
|
61
|
+
}
|
|
62
|
+
return state;
|
|
63
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceListStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens } from '@fluentui-copilot/tokens';\nimport type { ReferenceListSlots, ReferenceListState } from './ReferenceList.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceListClassNames: SlotClassNames<ReferenceListSlots> = {\n root: 'fai-ReferenceList',\n arrowableRegion: 'fai-ReferenceList__arrowableRegion',\n showMoreButton: 'fai-ReferenceList__showMoreButton',\n showLessButton: 'fai-ReferenceList__showLessButton',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n display: 'flex',\n flexDirection: 'row',\n gap: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalXS}`,\n});\n\nconst useRootStyles = makeStyles({\n referencesExpanded: {\n flexWrap: 'wrap',\n },\n});\n\nconst useArrowableRegionBaseClassName = makeResetStyles({\n display: 'contents',\n maxWidth: '100%',\n});\n\nconst useOverflowButtonBaseClassName = makeResetStyles({\n display: 'inline-flex',\n flexShrink: 0,\n});\n\n/**\n * Apply styling to the ReferenceList slots based on the state\n */\nexport const useReferenceListStyles_unstable = (state: ReferenceListState): ReferenceListState => {\n 'use no memo';\n\n const { areReferencesExpanded, shouldUseOverflow } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const arrowableRegionBaseClassName = useArrowableRegionBaseClassName();\n const overflowButtonBaseClassName = useOverflowButtonBaseClassName();\n const rootStyles = useRootStyles();\n\n state.root.className = mergeClasses(\n referenceListClassNames.root,\n rootBaseClassName,\n (areReferencesExpanded || !shouldUseOverflow) && rootStyles.referencesExpanded,\n state.root.className,\n );\n\n state.arrowableRegion.className = mergeClasses(\n referenceListClassNames.arrowableRegion,\n arrowableRegionBaseClassName,\n state.arrowableRegion.className,\n );\n\n if (state.showMoreButton) {\n state.showMoreButton.className = mergeClasses(\n referenceListClassNames.showMoreButton,\n overflowButtonBaseClassName,\n state.showMoreButton.className,\n );\n }\n\n if (state.showLessButton) {\n state.showLessButton.className = mergeClasses(\n referenceListClassNames.showLessButton,\n overflowButtonBaseClassName,\n state.showLessButton.className,\n );\n }\n\n return state;\n};\n"],"names":["referenceListClassNames","useReferenceListStyles_unstable","root","arrowableRegion","showMoreButton","showLessButton","useRootBaseClassName","makeResetStyles","display","flexDirection","gap","tokens","spacingVerticalXS","spacingHorizontalXS","useRootStyles","makeStyles","referencesExpanded","flexWrap","useArrowableRegionBaseClassName","maxWidth","useOverflowButtonBaseClassName","flexShrink","state","areReferencesExpanded","shouldUseOverflow","rootBaseClassName","arrowableRegionBaseClassName","overflowButtonBaseClassName","rootStyles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAKaA,uBAAAA;eAAAA;;IAmCAC,+BAAAA;eAAAA;;;iCAxC6C;wBACnC;AAI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QACxBiB,MAAMjB,cAAc,CAACwB,SAAS,GAAGC,IAAAA,6BAAAA,EAC/B9B,wBAAwBK,cAAc,EACtCsB,6BACAL,MAAMjB,cAAc,CAACwB,SAAS;IAElC;IAEA,OAAOP;AACT"}
|
|
@@ -18,4 +18,4 @@ const ReferenceOverflowButton = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
|
18
18
|
(0, _useReferenceOverflowButtonStylesstyles.useReferenceOverflowButtonStyles_unstable)(state);
|
|
19
19
|
return (0, _renderReferenceOverflowButton.renderReferenceOverflowButton_unstable)(state);
|
|
20
20
|
});
|
|
21
|
-
ReferenceOverflowButton.displayName = 'ReferenceOverflowButton';
|
|
21
|
+
ReferenceOverflowButton.displayName = 'ReferenceOverflowButton';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["ReferenceOverflowButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceOverflowButton_unstable } from './useReferenceOverflowButton';\nimport { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';\nimport { useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles.styles';\nimport type { ReferenceOverflowButtonProps } from './ReferenceOverflowButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// ReferenceOverflowButton component - TODO: add more docs\nexport const ReferenceOverflowButton: ForwardRefComponent<ReferenceOverflowButtonProps> = React.forwardRef(\n (props, ref) => {\n const state = useReferenceOverflowButton_unstable(props, ref);\n\n useReferenceOverflowButtonStyles_unstable(state);\n return renderReferenceOverflowButton_unstable(state);\n },\n);\n\nReferenceOverflowButton.displayName = 'ReferenceOverflowButton';\n"],"names":["ReferenceOverflowButton","React","forwardRef","props","state","useReferenceOverflowButton_unstable","useReferenceOverflowButtonStyles_unstable","renderReferenceOverflowButton_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;4CAC6B;+CACG;wDACG;AAKnD,MAAMA,0BAAAA,WAAAA,
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceOverflowButton_unstable } from './useReferenceOverflowButton';\nimport { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';\nimport { useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles.styles';\nimport type { ReferenceOverflowButtonProps } from './ReferenceOverflowButton.types';\nimport type { ForwardRefComponent } from '@fluentui/react-components';\n\n// ReferenceOverflowButton component - TODO: add more docs\nexport const ReferenceOverflowButton: ForwardRefComponent<ReferenceOverflowButtonProps> = React.forwardRef(\n (props, ref) => {\n const state = useReferenceOverflowButton_unstable(props, ref);\n\n useReferenceOverflowButtonStyles_unstable(state);\n return renderReferenceOverflowButton_unstable(state);\n },\n);\n\nReferenceOverflowButton.displayName = 'ReferenceOverflowButton';\n"],"names":["ReferenceOverflowButton","React","forwardRef","props","ref","state","useReferenceOverflowButton_unstable","useReferenceOverflowButtonStyles_unstable","renderReferenceOverflowButton_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;4CAC6B;+CACG;wDACG;AAKnD,MAAMA,0BAAAA,WAAAA,GAA6EC,OAAMC,UAAU,CACxG,CAACC,OAAOC;IACN,MAAMC,QAAQC,IAAAA,+DAAAA,EAAoCH,OAAOC;IAEzDG,IAAAA,iFAAAA,EAA0CF;IAC1C,OAAOG,IAAAA,qEAAAA,EAAuCH;AAChD;AAGFL,wBAAwBS,WAAW,GAAG"}
|
|
@@ -29,4 +29,3 @@ const _ReferenceOverflowButton = require("./ReferenceOverflowButton");
|
|
|
29
29
|
const _renderReferenceOverflowButton = require("./renderReferenceOverflowButton");
|
|
30
30
|
const _useReferenceOverflowButton = require("./useReferenceOverflowButton");
|
|
31
31
|
const _useReferenceOverflowButtonStylesstyles = require("./useReferenceOverflowButtonStyles.styles");
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
package/lib-commonjs/components/ReferenceOverflowButton/renderReferenceOverflowButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState) => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["renderReferenceOverflowButton.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { OverflowItem, assertSlots } from '@fluentui/react-components';\nimport type { ReferenceOverflowButtonState, ReferenceOverflowButtonSlots } from './ReferenceOverflowButton.types';\n\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = (state: ReferenceOverflowButtonState) => {\n assertSlots<ReferenceOverflowButtonSlots>(state);\n const { id, shouldRenderOverflowButton } = state;\n\n return shouldRenderOverflowButton ? (\n <OverflowItem key={id} id={id} priority={1}>\n <state.root />\n </OverflowItem>\n ) : null;\n};\n"],"names":["renderReferenceOverflowButton_unstable","state","assertSlots","id","shouldRenderOverflowButton","_jsx","OverflowItem","priority","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;iCAE0C;AAMnC,MAAMA,yCAAyC,CAACC;IACrDC,IAAAA,4BAAAA,EAA0CD;IAC1C,MAAM,EAAEE,EAAE,EAAEC,0BAA0B,EAAE,GAAGH;IAE3C,OAAOG,6BAAAA,WAAAA,GACLC,IAAAA,eAAA,EAACC,6BAAAA,EAAAA;QAAsBH,IAAIA;QAAII,UAAU;kBACvC,WAAA,GAAAF,IAAAA,eAAA,EAACJ,MAAMO,IAAI,EAAA,CAAA;OADML,MAGjB;AACN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceOverflowButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useFocusFinders,\n useId,\n useMergedRefs,\n useOverflowMenu,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport { useReferenceListContext_unstable } from '../../contexts/referenceListContext';\nimport type { ReferenceOverflowButtonProps, ReferenceOverflowButtonState } from './ReferenceOverflowButton.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render ReferenceOverflowButton.\n *\n * The returned state can be modified with hooks such as useReferenceOverflowButtonStyles_unstable,\n * before being passed to renderReferenceOverflowButton_unstable.\n *\n * @param props - props from this instance of ReferenceOverflowButton\n * @param ref - reference to root HTMLElement of ReferenceOverflowButton\n */\nexport const useReferenceOverflowButton_unstable = (\n props: ReferenceOverflowButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): ReferenceOverflowButtonState => {\n 'use no memo';\n\n const { children, id, text } = props;\n const designVersion = useDesignVersion(props.designVersion);\n\n const rootRef = React.useRef<HTMLButtonElement>(null);\n\n const [setTimeout] = useTimeout();\n\n const referenceOverflowButtonId = useId('reference-overflow-button-', id);\n\n const areReferencesExpanded = useReferenceListContext_unstable(ctx => ctx.areReferencesExpanded);\n const maxVisibleReferences = useReferenceListContext_unstable(ctx => ctx.maxVisibleReferences);\n const referenceListRef = useReferenceListContext_unstable(ctx => ctx.referenceListRef);\n const totalReferencesCount = useReferenceListContext_unstable(ctx => ctx.totalReferencesCount);\n const triggeredViaKeyboard = useReferenceListContext_unstable(ctx => ctx.overflowButtonTriggeredViaKeyboard);\n\n const { isOverflowing, overflowCount } = useOverflowMenu();\n\n const processedText = children ?? (typeof text === 'function' ? text(overflowCount) : text);\n\n const { findFirstFocusable, findNextFocusable } = useFocusFinders();\n const onKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLButtonElement>>(\n ev => {\n if (ev.key === Enter || ev.key === Space) {\n triggeredViaKeyboard.current = true;\n }\n },\n [triggeredViaKeyboard],\n );\n\n // We keep track of the previous overflow count to help determine the element to move focus to when expanding the references via keyboard.\n const previousOverflow = React.useRef(0);\n\n // When the references are expanded or collapsed via keyboard, we need to move focus to the appropriate element.\n React.useEffect(() => {\n // We only try to move focus if maxVisibleReferences is set and the overflow button was triggered via keyboard.\n if (maxVisibleReferences !== undefined && triggeredViaKeyboard.current) {\n let elementToFocus: HTMLElement | null | undefined;\n\n // If the references are collapsed, we move focus to the overflow button.\n if (!areReferencesExpanded) {\n elementToFocus = rootRef.current;\n previousOverflow.current = overflowCount;\n }\n // If the references are expanded, we move focus to the first reference that was hidden when they were collapsed.\n // We do this by moving focus according to the following heuristics:\n // - If maxVisibleReferences is what determines what overflows, focus is moved to the element that is in the maxVisibleReferences position of the ReferenceList's children.\n // - If the space available is what is determines what overflows, focus is moved to the element that is in the (totalReferencesCount - overflowCount) position of the ReferenceList's children.\n else if (rootRef.current && referenceListRef.current) {\n const positionToFocus =\n maxVisibleReferences < totalReferencesCount - previousOverflow.current\n ? maxVisibleReferences\n : totalReferencesCount - previousOverflow.current;\n\n let currentElement: HTMLElement | null | undefined = findFirstFocusable(referenceListRef.current);\n for (let i = 0; i < positionToFocus && currentElement; i++) {\n currentElement = findNextFocusable(currentElement);\n }\n\n elementToFocus = currentElement;\n }\n\n // We focus on the element and reset the triggeredViaKeyboard flag after a timeout to ensure that this is pushed at the end of the event queue.\n setTimeout(() => {\n elementToFocus?.focus();\n triggeredViaKeyboard.current = false;\n }, 0);\n }\n }, [\n areReferencesExpanded,\n findFirstFocusable,\n findNextFocusable,\n isOverflowing,\n maxVisibleReferences,\n overflowCount,\n referenceListRef,\n setTimeout,\n totalReferencesCount,\n triggeredViaKeyboard,\n ]);\n\n const state: ReferenceOverflowButtonState = {\n designVersion,\n id: referenceOverflowButtonId,\n shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,\n\n components: {\n root: 'button',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref: useMergedRefs(rootRef, ref),\n ...props,\n }),\n {\n defaultProps: {\n children: processedText,\n },\n elementType: 'button',\n },\n ),\n };\n\n state.root.onKeyDown = mergeCallbacks(onKeyDown, props.onKeyDown);\n\n return state;\n};\n"],"names":["useReferenceOverflowButton_unstable","props","ref","children","
|
|
1
|
+
{"version":3,"sources":["useReferenceOverflowButton.ts"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport {\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useFocusFinders,\n useId,\n useMergedRefs,\n useOverflowMenu,\n} from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport { useReferenceListContext_unstable } from '../../contexts/referenceListContext';\nimport type { ReferenceOverflowButtonProps, ReferenceOverflowButtonState } from './ReferenceOverflowButton.types';\nimport { useDesignVersion } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render ReferenceOverflowButton.\n *\n * The returned state can be modified with hooks such as useReferenceOverflowButtonStyles_unstable,\n * before being passed to renderReferenceOverflowButton_unstable.\n *\n * @param props - props from this instance of ReferenceOverflowButton\n * @param ref - reference to root HTMLElement of ReferenceOverflowButton\n */\nexport const useReferenceOverflowButton_unstable = (\n props: ReferenceOverflowButtonProps,\n ref: React.Ref<HTMLButtonElement>,\n): ReferenceOverflowButtonState => {\n 'use no memo';\n\n const { children, id, text } = props;\n const designVersion = useDesignVersion(props.designVersion);\n\n const rootRef = React.useRef<HTMLButtonElement>(null);\n\n const [setTimeout] = useTimeout();\n\n const referenceOverflowButtonId = useId('reference-overflow-button-', id);\n\n const areReferencesExpanded = useReferenceListContext_unstable(ctx => ctx.areReferencesExpanded);\n const maxVisibleReferences = useReferenceListContext_unstable(ctx => ctx.maxVisibleReferences);\n const referenceListRef = useReferenceListContext_unstable(ctx => ctx.referenceListRef);\n const totalReferencesCount = useReferenceListContext_unstable(ctx => ctx.totalReferencesCount);\n const triggeredViaKeyboard = useReferenceListContext_unstable(ctx => ctx.overflowButtonTriggeredViaKeyboard);\n\n const { isOverflowing, overflowCount } = useOverflowMenu();\n\n const processedText = children ?? (typeof text === 'function' ? text(overflowCount) : text);\n\n const { findFirstFocusable, findNextFocusable } = useFocusFinders();\n const onKeyDown = React.useCallback<React.KeyboardEventHandler<HTMLButtonElement>>(\n ev => {\n if (ev.key === Enter || ev.key === Space) {\n triggeredViaKeyboard.current = true;\n }\n },\n [triggeredViaKeyboard],\n );\n\n // We keep track of the previous overflow count to help determine the element to move focus to when expanding the references via keyboard.\n const previousOverflow = React.useRef(0);\n\n // When the references are expanded or collapsed via keyboard, we need to move focus to the appropriate element.\n React.useEffect(() => {\n // We only try to move focus if maxVisibleReferences is set and the overflow button was triggered via keyboard.\n if (maxVisibleReferences !== undefined && triggeredViaKeyboard.current) {\n let elementToFocus: HTMLElement | null | undefined;\n\n // If the references are collapsed, we move focus to the overflow button.\n if (!areReferencesExpanded) {\n elementToFocus = rootRef.current;\n previousOverflow.current = overflowCount;\n }\n // If the references are expanded, we move focus to the first reference that was hidden when they were collapsed.\n // We do this by moving focus according to the following heuristics:\n // - If maxVisibleReferences is what determines what overflows, focus is moved to the element that is in the maxVisibleReferences position of the ReferenceList's children.\n // - If the space available is what is determines what overflows, focus is moved to the element that is in the (totalReferencesCount - overflowCount) position of the ReferenceList's children.\n else if (rootRef.current && referenceListRef.current) {\n const positionToFocus =\n maxVisibleReferences < totalReferencesCount - previousOverflow.current\n ? maxVisibleReferences\n : totalReferencesCount - previousOverflow.current;\n\n let currentElement: HTMLElement | null | undefined = findFirstFocusable(referenceListRef.current);\n for (let i = 0; i < positionToFocus && currentElement; i++) {\n currentElement = findNextFocusable(currentElement);\n }\n\n elementToFocus = currentElement;\n }\n\n // We focus on the element and reset the triggeredViaKeyboard flag after a timeout to ensure that this is pushed at the end of the event queue.\n setTimeout(() => {\n elementToFocus?.focus();\n triggeredViaKeyboard.current = false;\n }, 0);\n }\n }, [\n areReferencesExpanded,\n findFirstFocusable,\n findNextFocusable,\n isOverflowing,\n maxVisibleReferences,\n overflowCount,\n referenceListRef,\n setTimeout,\n totalReferencesCount,\n triggeredViaKeyboard,\n ]);\n\n const state: ReferenceOverflowButtonState = {\n designVersion,\n id: referenceOverflowButtonId,\n shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,\n\n components: {\n root: 'button',\n },\n\n root: slot.always(\n getIntrinsicElementProps('button', {\n ref: useMergedRefs(rootRef, ref),\n ...props,\n }),\n {\n defaultProps: {\n children: processedText,\n },\n elementType: 'button',\n },\n ),\n };\n\n state.root.onKeyDown = mergeCallbacks(onKeyDown, props.onKeyDown);\n\n return state;\n};\n"],"names":["useReferenceOverflowButton_unstable","props","ref","children","id","text","designVersion","useDesignVersion","rootRef","React","useRef","setTimeout","useTimeout","referenceOverflowButtonId","useId","areReferencesExpanded","useReferenceListContext_unstable","ctx","maxVisibleReferences","referenceListRef","totalReferencesCount","triggeredViaKeyboard","overflowButtonTriggeredViaKeyboard","isOverflowing","overflowCount","useOverflowMenu","processedText","findFirstFocusable","findNextFocusable","useFocusFinders","onKeyDown","useCallback","ev","key","Enter","Space","current","previousOverflow","useEffect","undefined","elementToFocus","positionToFocus","currentElement","i","focus","state","shouldRenderOverflowButton","components","root","slot","always","getIntrinsicElementProps","useMergedRefs","defaultProps","elementType","mergeCallbacks"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;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ezB,WAAW7B,MAAM6B,SAAS;IAEhE,OAAOe;AACT"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
referenceOverflowButtonClassNames: function() {
|
|
13
|
+
return referenceOverflowButtonClassNames;
|
|
14
|
+
},
|
|
15
|
+
useReferenceOverflowButtonStyles_unstable: function() {
|
|
16
|
+
return useReferenceOverflowButtonStyles_unstable;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
20
|
+
const _tokens = require("@fluentui-copilot/tokens");
|
|
21
|
+
const referenceOverflowButtonClassNames = {
|
|
22
|
+
root: 'fai-ReferenceOverflowButton'
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Styles for the root slot
|
|
26
|
+
*/ const useRootBaseClassName = (0, _reactcomponents.makeResetStyles)({
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground3,
|
|
29
|
+
border: `${_tokens.tokens.strokeWidthThin} solid ${_tokens.tokens.colorNeutralStroke2}`,
|
|
30
|
+
borderRadius: _tokens.tokens.borderRadiusMedium,
|
|
31
|
+
color: _tokens.tokens.colorNeutralForeground2,
|
|
32
|
+
cursor: 'pointer',
|
|
33
|
+
display: 'inline-flex',
|
|
34
|
+
justifyContent: 'center',
|
|
35
|
+
minHeight: '24px',
|
|
36
|
+
padding: `${_tokens.tokens.spacingVerticalXXS} ${_tokens.tokens.spacingHorizontalS}`,
|
|
37
|
+
..._tokens.typographyStyles.caption1,
|
|
38
|
+
':hover': {
|
|
39
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground3Hover,
|
|
40
|
+
borderColor: _tokens.tokens.colorNeutralStroke1Hover,
|
|
41
|
+
color: _tokens.tokens.colorNeutralForeground2Hover
|
|
42
|
+
},
|
|
43
|
+
':hover:active': {
|
|
44
|
+
backgroundColor: _tokens.tokens.colorNeutralBackground3Pressed,
|
|
45
|
+
borderColor: _tokens.tokens.colorNeutralStroke1Pressed,
|
|
46
|
+
color: _tokens.tokens.colorNeutralForeground2Pressed
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
const useNextStyles = (0, _reactcomponents.makeStyles)({
|
|
50
|
+
root: {
|
|
51
|
+
borderRadius: _tokens.tokens.borderRadiusXLarge
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const useReferenceOverflowButtonStyles_unstable = (state)=>{
|
|
55
|
+
'use no memo';
|
|
56
|
+
const { designVersion } = state;
|
|
57
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
58
|
+
const nextStyles = useNextStyles();
|
|
59
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(referenceOverflowButtonClassNames.root, rootBaseClassName, designVersion === 'next' && nextStyles.root, state.root.className);
|
|
60
|
+
return state;
|
|
61
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceOverflowButtonStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';\nimport { tokens, typographyStyles } from '@fluentui-copilot/tokens';\nimport type { ReferenceOverflowButtonSlots, ReferenceOverflowButtonState } from './ReferenceOverflowButton.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceOverflowButtonClassNames: SlotClassNames<ReferenceOverflowButtonSlots> = {\n root: 'fai-ReferenceOverflowButton',\n};\n\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = makeResetStyles({\n alignItems: 'center',\n backgroundColor: tokens.colorNeutralBackground3,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n borderRadius: tokens.borderRadiusMedium,\n color: tokens.colorNeutralForeground2,\n cursor: 'pointer',\n display: 'inline-flex',\n justifyContent: 'center',\n minHeight: '24px',\n padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,\n ...typographyStyles.caption1,\n\n ':hover': {\n backgroundColor: tokens.colorNeutralBackground3Hover,\n borderColor: tokens.colorNeutralStroke1Hover,\n color: tokens.colorNeutralForeground2Hover,\n },\n\n ':hover:active': {\n backgroundColor: tokens.colorNeutralBackground3Pressed,\n borderColor: tokens.colorNeutralStroke1Pressed,\n color: tokens.colorNeutralForeground2Pressed,\n },\n});\n\nconst useNextStyles = makeStyles({ root: { borderRadius: tokens.borderRadiusXLarge } });\n\n/**\n * Apply styling to the ReferenceOverflowButton slots based on the state\n */\nexport const useReferenceOverflowButtonStyles_unstable = (\n state: ReferenceOverflowButtonState,\n): ReferenceOverflowButtonState => {\n 'use no memo';\n\n const { designVersion } = state;\n\n const rootBaseClassName = useRootBaseClassName();\n const nextStyles = useNextStyles();\n\n state.root.className = mergeClasses(\n referenceOverflowButtonClassNames.root,\n rootBaseClassName,\n designVersion === 'next' && nextStyles.root,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["referenceOverflowButtonClassNames","useReferenceOverflowButtonStyles_unstable","root","useRootBaseClassName","makeResetStyles","alignItems","backgroundColor","tokens","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","color","colorNeutralForeground2","cursor","display","justifyContent","minHeight","padding","spacingVerticalXXS","spacingHorizontalS","typographyStyles","caption1","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useNextStyles","makeStyles","borderRadiusXLarge","state","designVersion","rootBaseClassName","nextStyles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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CmC,mBACAD,kBAAkB,UAAUE,WAAWpC,IAAI,EAC3CiC,MAAMjC,IAAI,CAACqC,SAAS;IAGtB,OAAOJ;AACT"}
|
|
@@ -34,4 +34,4 @@ const referenceListContextDefaultValue = {
|
|
|
34
34
|
totalReferencesCount: 0
|
|
35
35
|
};
|
|
36
36
|
const ReferenceListContextProvider = ReferenceListContext.Provider;
|
|
37
|
-
const useReferenceListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(ReferenceListContext, (ctx = referenceListContextDefaultValue)=>selector(ctx));
|
|
37
|
+
const useReferenceListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(ReferenceListContext, (ctx = referenceListContextDefaultValue)=>selector(ctx));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>) =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","createContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiBaA,oBAAAA;eAAAA;;IAaAC,4BAAAA;eAAAA;;IAEAC,gCAAAA;eAAAA;;;sCAhCqC;AAiB3C,MAAMF,uBAA2DG,IAAAA,mCAAAA,EAEtEC;AAEF,MAAMC,mCAA8D;
|
|
1
|
+
{"version":3,"sources":["referenceListContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { Context, ContextSelector } from '@fluentui/react-context-selector';\nimport type { ReferenceListState } from '../ReferenceList';\n\n/**\n * Context shared between ReferenceList and its children components\n */\nexport type ReferenceListContextValue = Pick<\n ReferenceListState,\n | 'areReferencesExpanded'\n | 'maxVisibleReferences'\n | 'overflowButtonTriggeredViaKeyboard'\n | 'referenceListRef'\n | 'shouldUseOverflow'\n | 'totalReferencesCount'\n>;\n\nexport const ReferenceListContext: Context<ReferenceListContextValue> = createContext<\n ReferenceListContextValue | undefined\n>(undefined) as Context<ReferenceListContextValue>;\n\nconst referenceListContextDefaultValue: ReferenceListContextValue = {\n areReferencesExpanded: false,\n maxVisibleReferences: undefined,\n overflowButtonTriggeredViaKeyboard: { current: false },\n referenceListRef: { current: null },\n shouldUseOverflow: false,\n totalReferencesCount: 0,\n};\n\nexport const ReferenceListContextProvider = ReferenceListContext.Provider;\n\nexport const useReferenceListContext_unstable = <T>(selector: ContextSelector<ReferenceListContextValue, T>) =>\n useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue) => selector(ctx));\n"],"names":["ReferenceListContext","ReferenceListContextProvider","useReferenceListContext_unstable","createContext","undefined","referenceListContextDefaultValue","areReferencesExpanded","maxVisibleReferences","overflowButtonTriggeredViaKeyboard","current","referenceListRef","shouldUseOverflow","totalReferencesCount","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAiBaA,oBAAAA;eAAAA;;IAaAC,4BAAAA;eAAAA;;IAEAC,gCAAAA;eAAAA;;;sCAhCqC;AAiB3C,MAAMF,uBAA2DG,IAAAA,mCAAAA,EAEtEC;AAEF,MAAMC,mCAA8D;IAClEC,uBAAuB;IACvBC,sBAAsBH;IACtBI,oCAAoC;QAAEC,SAAS;IAAM;IACrDC,kBAAkB;QAAED,SAAS;IAAK;IAClCE,mBAAmB;IACnBC,sBAAsB;AACxB;AAEO,MAAMX,+BAA+BD,qBAAqBa,QAAQ;AAElE,MAAMX,mCAAmC,CAAIY,WAClDC,IAAAA,wCAAAA,EAAmBf,sBAAsB,CAACgB,MAAMX,gCAAgC,GAAKS,SAASE"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -142,4 +142,3 @@ const _contexts = require("./contexts");
|
|
|
142
142
|
/** @deprecated use useReferenceListStyles_unstable */ const useReferenceListV2Styles_unstable = _ReferenceList.useReferenceListStyles_unstable;
|
|
143
143
|
/** @deprecated use useReferenceList_unstable */ const useReferenceListV2_unstable = _ReferenceList.useReferenceList_unstable;
|
|
144
144
|
/** @deprecated use useReferenceCitationPreview */ const useReferenceCitationPreviewV2 = _utilities.useReferenceCitationPreview;
|
|
145
|
-
//# sourceMappingURL=index.js.map
|