@fluentui-copilot/react-reference 0.0.0-nightly-20240423-0407-d55bcc74.1 → 0.0.0-nightly-20240426-0405-4698d75c.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +9 -9
- package/CHANGELOG.md +7 -7
- package/dist/index.d.ts +219 -0
- package/lib/ReferenceListV2.js +2 -0
- package/lib/ReferenceListV2.js.map +1 -0
- package/lib/ReferenceOverflowButton.js +2 -0
- package/lib/ReferenceOverflowButton.js.map +1 -0
- package/lib/ReferenceV2.js +2 -0
- package/lib/ReferenceV2.js.map +1 -0
- package/lib/components/Reference/useReference.js +1 -1
- package/lib/components/Reference/useReference.js.map +1 -1
- package/lib/components/reference-v2/Reference/Reference.js +11 -0
- package/lib/components/reference-v2/Reference/Reference.js.map +1 -0
- package/lib/components/reference-v2/Reference/Reference.types.js +2 -0
- package/lib/components/reference-v2/Reference/Reference.types.js.map +1 -0
- package/lib/components/reference-v2/Reference/index.js +6 -0
- package/lib/components/reference-v2/Reference/index.js.map +1 -0
- package/lib/components/reference-v2/Reference/renderReference.js +19 -0
- package/lib/components/reference-v2/Reference/renderReference.js.map +1 -0
- package/lib/components/reference-v2/Reference/useReference.js +72 -0
- package/lib/components/reference-v2/Reference/useReference.js.map +1 -0
- package/lib/components/reference-v2/Reference/useReferenceStyles.js +71 -0
- package/lib/components/reference-v2/Reference/useReferenceStyles.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.js +13 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js +2 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/index.js +6 -0
- package/lib/components/reference-v2/ReferenceList/index.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/renderReferenceList.js +18 -0
- package/lib/components/reference-v2/ReferenceList/renderReferenceList.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceList.js +94 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceList.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListContextValues.js +21 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.js +39 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +12 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +2 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/index.js +6 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/index.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +10 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +91 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js +35 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js.map +1 -0
- package/lib/components/reference-v2/index.js +4 -0
- package/lib/components/reference-v2/index.js.map +1 -0
- package/lib/contexts/reference-v2/index.js +2 -0
- package/lib/contexts/reference-v2/index.js.map +1 -0
- package/lib/contexts/reference-v2/referenceListContext.js +16 -0
- package/lib/contexts/reference-v2/referenceListContext.js.map +1 -0
- package/lib/hooks/reference-v2/index.js +2 -0
- package/lib/hooks/reference-v2/index.js.map +1 -0
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js +120 -0
- package/lib/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -0
- package/lib/index.js +5 -0
- package/lib/index.js.map +1 -1
- package/lib-commonjs/ReferenceListV2.js +7 -0
- package/lib-commonjs/ReferenceListV2.js.map +1 -0
- package/lib-commonjs/ReferenceOverflowButton.js +7 -0
- package/lib-commonjs/ReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/ReferenceV2.js +7 -0
- package/lib-commonjs/ReferenceV2.js.map +1 -0
- package/lib-commonjs/components/Reference/useReference.js +1 -1
- package/lib-commonjs/components/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.js +21 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js +5 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/index.js +28 -0
- package/lib-commonjs/components/reference-v2/Reference/index.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js +32 -0
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/useReference.js +67 -0
- package/lib-commonjs/components/reference-v2/Reference/useReference.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.js +122 -0
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js +23 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js +5 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/index.js +11 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/index.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js +28 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js +93 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js +24 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.js +55 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +21 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +5 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/index.js +11 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/index.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +16 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +84 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js +65 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.js.map +1 -0
- package/lib-commonjs/components/reference-v2/index.js +9 -0
- package/lib-commonjs/components/reference-v2/index.js.map +1 -0
- package/lib-commonjs/contexts/reference-v2/index.js +7 -0
- package/lib-commonjs/contexts/reference-v2/index.js.map +1 -0
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js +36 -0
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js.map +1 -0
- package/lib-commonjs/hooks/reference-v2/index.js +7 -0
- package/lib-commonjs/hooks/reference-v2/index.js.map +1 -0
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js +148 -0
- package/lib-commonjs/hooks/reference-v2/useReferenceCitationPreview.js.map +1 -0
- package/lib-commonjs/index.js +65 -0
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +4 -4
- /package/lib/{context → contexts}/ReferenceGroupContext.js +0 -0
- /package/lib/{context → contexts}/ReferenceGroupContext.js.map +0 -0
- /package/lib-commonjs/{context → contexts}/ReferenceGroupContext.js +0 -0
- /package/lib-commonjs/{context → contexts}/ReferenceGroupContext.js.map +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
useRootStyles: function() {
|
|
19
|
+
return useRootStyles;
|
|
20
|
+
},
|
|
21
|
+
useReferenceStyles_unstable: function() {
|
|
22
|
+
return useReferenceStyles_unstable;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
26
|
+
const referenceClassNames = {
|
|
27
|
+
root: 'fai-Reference',
|
|
28
|
+
citation: 'fai-Reference__citation',
|
|
29
|
+
divider: 'fai-Reference__divider',
|
|
30
|
+
media: 'fai-Reference__media',
|
|
31
|
+
content: 'fai-Reference__content'
|
|
32
|
+
};
|
|
33
|
+
const referenceExtraClassNames = {
|
|
34
|
+
mediaChild: 'fai-Reference__mediaChild'
|
|
35
|
+
};
|
|
36
|
+
const MEDIA_SIZE = '16px';
|
|
37
|
+
const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("r1aeqif9", null, [
|
|
38
|
+
".r1aeqif9{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);}",
|
|
39
|
+
".r1aeqif9:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}",
|
|
40
|
+
".r1aeqif9:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}",
|
|
41
|
+
".r1aeqif9:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}",
|
|
42
|
+
".r1aeqif9:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}"
|
|
43
|
+
]);
|
|
44
|
+
const useRootStyles = (0, _reactcomponents.__styles)({
|
|
45
|
+
darker: {
|
|
46
|
+
De3pzq: "f3vzo32",
|
|
47
|
+
g2u3we: "fj3muxo",
|
|
48
|
+
h3c5rm: [
|
|
49
|
+
"f1akhkt",
|
|
50
|
+
"f1lxtadh"
|
|
51
|
+
],
|
|
52
|
+
B9xav0g: "f1aperda",
|
|
53
|
+
zhjwy3: [
|
|
54
|
+
"f1lxtadh",
|
|
55
|
+
"f1akhkt"
|
|
56
|
+
],
|
|
57
|
+
Jwef8y: "f14vf7cg",
|
|
58
|
+
iro3zm: "fho4vwd"
|
|
59
|
+
},
|
|
60
|
+
overflow: {
|
|
61
|
+
a9b677: "fly5x3f"
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
d: [
|
|
65
|
+
".f3vzo32{background-color:var(--colorNeutralBackground5);}",
|
|
66
|
+
".fj3muxo{border-top-color:var(--colorNeutralStroke1);}",
|
|
67
|
+
".f1akhkt{border-right-color:var(--colorNeutralStroke1);}",
|
|
68
|
+
".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}",
|
|
69
|
+
".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}",
|
|
70
|
+
".fly5x3f{width:100%;}"
|
|
71
|
+
],
|
|
72
|
+
h: [
|
|
73
|
+
".f14vf7cg:hover{background-color:var(--colorNeutralBackground5Hover);}",
|
|
74
|
+
".fho4vwd:hover:active{background-color:var(--colorNeutralBackground5Pressed);}"
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
const useCitationBaseClassName = (0, _reactcomponents.__resetStyles)("rzdip90", null, [
|
|
78
|
+
".rzdip90{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightSemibold);line-height:var(--lineHeightBase100);}"
|
|
79
|
+
]);
|
|
80
|
+
const useDividerBaseClassName = (0, _reactcomponents.__resetStyles)("r1eyqaw5", null, [
|
|
81
|
+
".r1eyqaw5{background-color:var(--colorNeutralStroke2);height:16px;margin:var(--spacingVerticalNone) var(--spacingHorizontalXS);width:1px;}"
|
|
82
|
+
]);
|
|
83
|
+
const useDividerStyles = (0, _reactcomponents.__styles)({
|
|
84
|
+
darker: {
|
|
85
|
+
De3pzq: "f1d3jkam"
|
|
86
|
+
}
|
|
87
|
+
}, {
|
|
88
|
+
d: [
|
|
89
|
+
".f1d3jkam{background-color:var(--colorNeutralStroke1);}"
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
const useMediaBaseClassName = (0, _reactcomponents.__resetStyles)("r4nw7iy", null, [
|
|
93
|
+
".r4nw7iy{font-size:16px;height:16px;line-height:16px;width:16px;}",
|
|
94
|
+
".r4nw7iy>.fai-Reference__mediaChild{height:16px;width:16px;}"
|
|
95
|
+
]);
|
|
96
|
+
const useContentBaseClassName = (0, _reactcomponents.__resetStyles)("r1yvxokd", null, [
|
|
97
|
+
".r1yvxokd{column-gap:var(--spacingHorizontalSNudge);display:inline-flex;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}"
|
|
98
|
+
]);
|
|
99
|
+
const useReferenceStyles_unstable = (state)=>{
|
|
100
|
+
const { appearance } = state;
|
|
101
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
102
|
+
const citationBaseClassName = useCitationBaseClassName();
|
|
103
|
+
const dividerBaseClassName = useDividerBaseClassName();
|
|
104
|
+
const contentBaseClassName = useContentBaseClassName();
|
|
105
|
+
const mediaBaseClassName = useMediaBaseClassName();
|
|
106
|
+
const rootStyles = useRootStyles();
|
|
107
|
+
const dividerStyles = useDividerStyles();
|
|
108
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.root, rootBaseClassName, appearance === 'darker' && rootStyles.darker, state.root.className);
|
|
109
|
+
if (state.citation) {
|
|
110
|
+
state.citation.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.citation, citationBaseClassName, state.citation.className);
|
|
111
|
+
}
|
|
112
|
+
if (state.divider) {
|
|
113
|
+
state.divider.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.divider, dividerBaseClassName, appearance === 'darker' && dividerStyles.darker, state.divider.className);
|
|
114
|
+
}
|
|
115
|
+
if (state.content) {
|
|
116
|
+
state.content.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.content, contentBaseClassName, state.content.className);
|
|
117
|
+
}
|
|
118
|
+
if (state.media) {
|
|
119
|
+
state.media.className = (0, _reactcomponents.mergeClasses)(referenceClassNames.media, mediaBaseClassName, state.media.className);
|
|
120
|
+
}
|
|
121
|
+
return state;
|
|
122
|
+
}; //# sourceMappingURL=useReferenceStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';\nexport const referenceClassNames = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n divider: 'fai-Reference__divider',\n media: 'fai-Reference__media',\n content: 'fai-Reference__content'\n};\nexport const referenceExtraClassNames = {\n mediaChild: 'fai-Reference__mediaChild'\n};\nconst MEDIA_SIZE = '16px';\nconst useRootBaseClassName = __resetStyles(\"r1aeqif9\", null, [\".r1aeqif9{align-items:center;background-color:var(--colorNeutralBackground3);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);border-radius:var(--borderRadiusMedium);box-sizing:border-box;color:var(--colorNeutralForeground2);column-gap:var(--spacingHorizontalXXS);display:flex;flex-shrink:0;justify-content:center;padding:var(--spacingVerticalXXS) var(--spacingHorizontalS);}\", \".r1aeqif9:hover{background-color:var(--colorNeutralBackground3Hover);border-color:var(--colorNeutralStroke1Hover);color:var(--colorNeutralForeground2Hover);}\", \".r1aeqif9:hover .fai-Reference__divider{background-color:var(--colorNeutralStroke1Hover);}\", \".r1aeqif9:hover:active{background-color:var(--colorNeutralBackground3Pressed);border-color:var(--colorNeutralStroke1Pressed);color:var(--colorNeutralForeground2Pressed);}\", \".r1aeqif9:hover:active .fai-Reference__divider{background-color:var(--colorNeutralStroke1Pressed);}\"]);\nexport const useRootStyles = __styles({\n darker: {\n De3pzq: \"f3vzo32\",\n g2u3we: \"fj3muxo\",\n h3c5rm: [\"f1akhkt\", \"f1lxtadh\"],\n B9xav0g: \"f1aperda\",\n zhjwy3: [\"f1lxtadh\", \"f1akhkt\"],\n Jwef8y: \"f14vf7cg\",\n iro3zm: \"fho4vwd\"\n },\n overflow: {\n a9b677: \"fly5x3f\"\n }\n}, {\n d: [\".f3vzo32{background-color:var(--colorNeutralBackground5);}\", \".fj3muxo{border-top-color:var(--colorNeutralStroke1);}\", \".f1akhkt{border-right-color:var(--colorNeutralStroke1);}\", \".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}\", \".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}\", \".fly5x3f{width:100%;}\"],\n h: [\".f14vf7cg:hover{background-color:var(--colorNeutralBackground5Hover);}\", \".fho4vwd:hover:active{background-color:var(--colorNeutralBackground5Pressed);}\"]\n});\nconst useCitationBaseClassName = __resetStyles(\"rzdip90\", null, [\".rzdip90{font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightSemibold);line-height:var(--lineHeightBase100);}\"]);\nconst useDividerBaseClassName = __resetStyles(\"r1eyqaw5\", null, [\".r1eyqaw5{background-color:var(--colorNeutralStroke2);height:16px;margin:var(--spacingVerticalNone) var(--spacingHorizontalXS);width:1px;}\"]);\nconst useDividerStyles = __styles({\n darker: {\n De3pzq: \"f1d3jkam\"\n }\n}, {\n d: [\".f1d3jkam{background-color:var(--colorNeutralStroke1);}\"]\n});\nconst useMediaBaseClassName = __resetStyles(\"r4nw7iy\", null, [\".r4nw7iy{font-size:16px;height:16px;line-height:16px;width:16px;}\", \".r4nw7iy>.fai-Reference__mediaChild{height:16px;width:16px;}\"]);\nconst useContentBaseClassName = __resetStyles(\"r1yvxokd\", null, [\".r1yvxokd{column-gap:var(--spacingHorizontalSNudge);display:inline-flex;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase200);font-weight:var(--fontWeightRegular);line-height:var(--lineHeightBase200);}\"]);\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = state => {\n const {\n appearance\n } = state;\n const rootBaseClassName = useRootBaseClassName();\n const citationBaseClassName = useCitationBaseClassName();\n const dividerBaseClassName = useDividerBaseClassName();\n const contentBaseClassName = useContentBaseClassName();\n const mediaBaseClassName = useMediaBaseClassName();\n const rootStyles = useRootStyles();\n const dividerStyles = useDividerStyles();\n state.root.className = mergeClasses(referenceClassNames.root, rootBaseClassName, appearance === 'darker' && rootStyles.darker, state.root.className);\n if (state.citation) {\n state.citation.className = mergeClasses(referenceClassNames.citation, citationBaseClassName, state.citation.className);\n }\n if (state.divider) {\n state.divider.className = mergeClasses(referenceClassNames.divider, dividerBaseClassName, appearance === 'darker' && dividerStyles.darker, state.divider.className);\n }\n if (state.content) {\n state.content.className = mergeClasses(referenceClassNames.content, contentBaseClassName, state.content.className);\n }\n if (state.media) {\n state.media.className = mergeClasses(referenceClassNames.media, mediaBaseClassName, state.media.className);\n }\n return state;\n};\n//# sourceMappingURL=useReferenceStyles.js.map"],"names":["referenceClassNames","referenceExtraClassNames","useRootStyles","useReferenceStyles_unstable","root","citation","divider","media","content","mediaChild","MEDIA_SIZE","useRootBaseClassName","__resetStyles","__styles","darker","De3pzq","g2u3we","h3c5rm","B9xav0g","zhjwy3","Jwef8y","iro3zm","overflow","a9b677","d","h","useCitationBaseClassName","useDividerBaseClassName","useDividerStyles","useMediaBaseClassName","useContentBaseClassName","state","appearance","rootBaseClassName","citationBaseClassName","dividerBaseClassName","contentBaseClassName","mediaBaseClassName","rootStyles","dividerStyles","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,mBAAmB;eAAnBA;;IAOAC,wBAAwB;eAAxBA;;IAKAC,aAAa;eAAbA;;IA+BAC,2BAA2B;eAA3BA;;;iCA5C+E;AACrF,MAAMH,sBAAsB;IACjCI,MAAM;IACNC,UAAU;IACVC,SAAS;IACTC,OAAO;IACPC,SAAS;AACX;AACO,MAAMP,2BAA2B;IACtCQ,YAAY;AACd;AACA,MAAMC,aAAa;AACnB,MAAMC,uBAAuBC,IAAAA,8BAAa,EAAC,YAAY,MAAM;IAAC;IAAyY;IAAiK;IAA8F;IAA8K;CAAsG;AACn9B,MAAMV,gBAAgBW,IAAAA,yBAAQ,EAAC;IACpCC,QAAQ;QACNC,QAAQ;QACRC,QAAQ;QACRC,QAAQ;YAAC;YAAW;SAAW;QAC/BC,SAAS;QACTC,QAAQ;YAAC;YAAY;SAAU;QAC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AAY,EAACzC,oBAAoBM,OAAO,EAAE6B,sBAAsBH,eAAe,YAAYO,cAAczB,MAAM,EAAEiB,MAAMzB,OAAO,CAACkC,SAAS;IACpK;IACA,IAAIT,MAAMvB,OAAO,EAAE;QACjBuB,MAAMvB,OAAO,CAACgC,SAAS,GAAGC,IAAAA,6BAAY,EAACzC,oBAAoBQ,OAAO,EAAE4B,sBAAsBL,MAAMvB,OAAO,CAACgC,SAAS;IACnH;IACA,IAAIT,MAAMxB,KAAK,EAAE;QACfwB,MAAMxB,KAAK,CAACiC,SAAS,GAAGC,IAAAA,6BAAY,EAACzC,oBAAoBO,KAAK,EAAE8B,oBAAoBN,MAAMxB,KAAK,CAACiC,SAAS;IAC3G;IACA,OAAOT;AACT,GACA,8CAA8C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ReferenceList", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ReferenceList;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _renderReferenceList = require("./renderReferenceList");
|
|
14
|
+
const _useReferenceList = require("./useReferenceList");
|
|
15
|
+
const _useReferenceListStyles = require("./useReferenceListStyles");
|
|
16
|
+
const _useReferenceListContextValues = require("./useReferenceListContextValues");
|
|
17
|
+
const ReferenceList = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
18
|
+
const state = (0, _useReferenceList.useReferenceList_unstable)(props, ref);
|
|
19
|
+
const referenceListContextValues = (0, _useReferenceListContextValues.useReferenceListContextValues_unstable)(state);
|
|
20
|
+
(0, _useReferenceListStyles.useReferenceListStyles_unstable)(state);
|
|
21
|
+
return (0, _renderReferenceList.renderReferenceList_unstable)(state, referenceListContextValues);
|
|
22
|
+
});
|
|
23
|
+
ReferenceList.displayName = 'ReferenceList'; //# sourceMappingURL=ReferenceList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceList.js"],"sourcesContent":["import * as React from 'react';\nimport { renderReferenceList_unstable } from './renderReferenceList';\nimport { useReferenceList_unstable } from './useReferenceList';\nimport { useReferenceListStyles_unstable } from './useReferenceListStyles';\nimport { useReferenceListContextValues_unstable } from './useReferenceListContextValues';\nexport const ReferenceList = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useReferenceList_unstable(props, ref);\n const referenceListContextValues = useReferenceListContextValues_unstable(state);\n useReferenceListStyles_unstable(state);\n return renderReferenceList_unstable(state, referenceListContextValues);\n});\nReferenceList.displayName = 'ReferenceList';\n//# sourceMappingURL=ReferenceList.js.map"],"names":["ReferenceList","React","forwardRef","props","ref","state","useReferenceList_unstable","referenceListContextValues","useReferenceListContextValues_unstable","useReferenceListStyles_unstable","renderReferenceList_unstable","displayName"],"mappings":";;;;+BAKaA;;;eAAAA;;;;iEALU;qCACsB;kCACH;wCACM;+CACO;AAChD,MAAMA,gBAAgB,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IACjE,MAAMC,QAAQC,IAAAA,2CAAyB,EAACH,OAAOC;IAC/C,MAAMG,6BAA6BC,IAAAA,qEAAsC,EAACH;IAC1EI,IAAAA,uDAA+B,EAACJ;IAChC,OAAOK,IAAAA,iDAA4B,EAACL,OAAOE;AAC7C;AACAP,cAAcW,WAAW,GAAG,iBAC5B,yCAAyC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceList.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=ReferenceList.types.js.map"],"names":[],"mappings":";;;;CACA,+CAA+C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./ReferenceList"), exports);
|
|
7
|
+
_export_star._(require("./ReferenceList.types"), exports);
|
|
8
|
+
_export_star._(require("./renderReferenceList"), exports);
|
|
9
|
+
_export_star._(require("./useReferenceList"), exports);
|
|
10
|
+
_export_star._(require("./useReferenceListStyles"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './ReferenceList';\nexport * from './ReferenceList.types';\nexport * from './renderReferenceList';\nexport * from './useReferenceList';\nexport * from './useReferenceListStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;CACd,iCAAiC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "renderReferenceList_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return renderReferenceList_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
13
|
+
const _referenceListContext = require("../../../contexts/reference-v2/referenceListContext");
|
|
14
|
+
const renderReferenceList_unstable = (state, contextValues)=>{
|
|
15
|
+
(0, _reactcomponents.assertSlots)(state);
|
|
16
|
+
return /*#__PURE__*/ (0, _jsxruntime.jsx)(_referenceListContext.ReferenceListContextProvider, {
|
|
17
|
+
value: contextValues.referenceList,
|
|
18
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_reactcomponents.Overflow, {
|
|
19
|
+
children: /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
|
|
20
|
+
children: [
|
|
21
|
+
state.root.children,
|
|
22
|
+
state.showMoreButton && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.showMoreButton, {}),
|
|
23
|
+
state.showLessButton && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.showLessButton, {})
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}; //# sourceMappingURL=renderReferenceList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderReferenceList.js"],"sourcesContent":["import { jsx as _jsx, jsxs as _jsxs } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { Overflow, assertSlots } from '@fluentui/react-components';\nimport { ReferenceListContextProvider } from '../../../contexts/reference-v2/referenceListContext';\n/**\n * Render the final JSX of ReferenceList\n */\nexport const renderReferenceList_unstable = (state, contextValues) => {\n assertSlots(state);\n return /*#__PURE__*/_jsx(ReferenceListContextProvider, {\n value: contextValues.referenceList,\n children: /*#__PURE__*/_jsx(Overflow, {\n children: /*#__PURE__*/_jsxs(state.root, {\n children: [state.root.children, state.showMoreButton && /*#__PURE__*/_jsx(state.showMoreButton, {}), state.showLessButton && /*#__PURE__*/_jsx(state.showLessButton, {})]\n })\n })\n });\n};\n//# sourceMappingURL=renderReferenceList.js.map"],"names":["renderReferenceList_unstable","state","contextValues","assertSlots","_jsx","ReferenceListContextProvider","value","referenceList","children","Overflow","_jsxs","root","showMoreButton","showLessButton"],"mappings":";;;;+BAMaA;;;eAAAA;;;4BAN8B;iCACL;sCACO;AAItC,MAAMA,+BAA+B,CAACC,OAAOC;IAClDC,IAAAA,4BAAW,EAACF;IACZ,OAAO,WAAW,GAAEG,IAAAA,eAAI,EAACC,kDAA4B,EAAE;QACrDC,OAAOJ,cAAcK,aAAa;QAClCC,UAAU,WAAW,GAAEJ,IAAAA,eAAI,EAACK,yBAAQ,EAAE;YACpCD,UAAU,WAAW,GAAEE,IAAAA,gBAAK,EAACT,MAAMU,IAAI,EAAE;gBACvCH,UAAU;oBAACP,MAAMU,IAAI,CAACH,QAAQ;oBAAEP,MAAMW,cAAc,IAAI,WAAW,GAAER,IAAAA,eAAI,EAACH,MAAMW,cAAc,EAAE,CAAC;oBAAIX,MAAMY,cAAc,IAAI,WAAW,GAAET,IAAAA,eAAI,EAACH,MAAMY,cAAc,EAAE,CAAC;iBAAG;YAC3K;QACF;IACF;AACF,GACA,+CAA+C"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useReferenceList_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useReferenceList_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
14
|
+
const _useReferenceStyles = require("../Reference/useReferenceStyles");
|
|
15
|
+
const useReferenceList_unstable = (props, ref)=>{
|
|
16
|
+
const { appearance = 'lighter', children, maxVisibleReferences, showLessButton, showMoreButton, ...rest } = props;
|
|
17
|
+
const [areReferencesExpanded, setAreReferencesExpanded] = _react.useState(false);
|
|
18
|
+
const referenceInOverflowClassName = (0, _useReferenceStyles.useRootStyles)().overflow;
|
|
19
|
+
const resolvedChildren = _react.useMemo(()=>{
|
|
20
|
+
if (maxVisibleReferences !== undefined && !areReferencesExpanded) {
|
|
21
|
+
const results = [];
|
|
22
|
+
const childrenArray = _react.Children.toArray(children);
|
|
23
|
+
for(let index = 0; index < childrenArray.length; index++){
|
|
24
|
+
const child = childrenArray[index];
|
|
25
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
+
if (index >= maxVisibleReferences && /*#__PURE__*/ _react.isValidElement(child)) {
|
|
27
|
+
results.push(/*#__PURE__*/ _react.cloneElement(child, {
|
|
28
|
+
...child.props,
|
|
29
|
+
className: (0, _reactcomponents.mergeClasses)(child.props.className, referenceInOverflowClassName)
|
|
30
|
+
}));
|
|
31
|
+
} else {
|
|
32
|
+
results.push(child);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return results;
|
|
36
|
+
}
|
|
37
|
+
return children;
|
|
38
|
+
}, [
|
|
39
|
+
areReferencesExpanded,
|
|
40
|
+
children,
|
|
41
|
+
maxVisibleReferences,
|
|
42
|
+
referenceInOverflowClassName
|
|
43
|
+
]);
|
|
44
|
+
// We keep track of the previous overflow count to determine element to move focus to when expanding the references via keyboard.
|
|
45
|
+
const previousOverflowCount = _react.useRef(0);
|
|
46
|
+
// We keep track of whether we are interacting with the overflow button via keyboard or not.
|
|
47
|
+
const overflowButtonTriggeredViaKeyboard = _react.useRef(false);
|
|
48
|
+
const focusAttributes = (0, _reactcomponents.useArrowNavigationGroup)({
|
|
49
|
+
axis: 'both',
|
|
50
|
+
circular: true,
|
|
51
|
+
memorizeCurrent: true
|
|
52
|
+
});
|
|
53
|
+
const onShowMoreButtonClick = _react.useCallback(()=>{
|
|
54
|
+
setAreReferencesExpanded(true);
|
|
55
|
+
}, []);
|
|
56
|
+
const onShowLessButtonClick = _react.useCallback(()=>{
|
|
57
|
+
setAreReferencesExpanded(false);
|
|
58
|
+
}, []);
|
|
59
|
+
const shouldUseOverflow = maxVisibleReferences !== undefined && !areReferencesExpanded;
|
|
60
|
+
const state = {
|
|
61
|
+
appearance,
|
|
62
|
+
areReferencesExpanded,
|
|
63
|
+
overflowButtonTriggeredViaKeyboard,
|
|
64
|
+
previousOverflowCount,
|
|
65
|
+
shouldUseOverflow,
|
|
66
|
+
components: {
|
|
67
|
+
root: 'div',
|
|
68
|
+
showMoreButton: 'span',
|
|
69
|
+
showLessButton: 'span'
|
|
70
|
+
},
|
|
71
|
+
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('div', {
|
|
72
|
+
ref,
|
|
73
|
+
...focusAttributes,
|
|
74
|
+
...rest,
|
|
75
|
+
children: resolvedChildren
|
|
76
|
+
}), {
|
|
77
|
+
elementType: 'div'
|
|
78
|
+
}),
|
|
79
|
+
showMoreButton: shouldUseOverflow ? _reactcomponents.slot.optional(showMoreButton, {
|
|
80
|
+
elementType: 'span'
|
|
81
|
+
}) : undefined,
|
|
82
|
+
showLessButton: areReferencesExpanded ? _reactcomponents.slot.optional(showLessButton, {
|
|
83
|
+
elementType: 'span'
|
|
84
|
+
}) : undefined
|
|
85
|
+
};
|
|
86
|
+
if (state.showMoreButton) {
|
|
87
|
+
state.showMoreButton.onClick = (0, _reactcomponents.mergeCallbacks)(onShowMoreButtonClick, state.showMoreButton.onClick);
|
|
88
|
+
}
|
|
89
|
+
if (state.showLessButton) {
|
|
90
|
+
state.showLessButton.onClick = (0, _reactcomponents.mergeCallbacks)(onShowLessButtonClick, state.showLessButton.onClick);
|
|
91
|
+
}
|
|
92
|
+
return state;
|
|
93
|
+
}; //# sourceMappingURL=useReferenceList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceList.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, mergeClasses, slot, useArrowNavigationGroup } from '@fluentui/react-components';\nimport { useRootStyles as useReferenceStyles } from '../Reference/useReferenceStyles';\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 = (props, ref) => {\n const {\n appearance = 'lighter',\n children,\n maxVisibleReferences,\n showLessButton,\n showMoreButton,\n ...rest\n } = props;\n const [areReferencesExpanded, setAreReferencesExpanded] = React.useState(false);\n const referenceInOverflowClassName = useReferenceStyles().overflow;\n const resolvedChildren = React.useMemo(() => {\n if (maxVisibleReferences !== undefined && !areReferencesExpanded) {\n const results = [];\n const childrenArray = React.Children.toArray(children);\n for (let index = 0; index < childrenArray.length; index++) {\n const child = childrenArray[index];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (index >= maxVisibleReferences && React.isValidElement(child)) {\n results.push(React.cloneElement(child, {\n ...child.props,\n className: mergeClasses(child.props.className, referenceInOverflowClassName)\n }));\n } else {\n results.push(child);\n }\n }\n return results;\n }\n return children;\n }, [areReferencesExpanded, children, maxVisibleReferences, referenceInOverflowClassName]);\n // We keep track of the previous overflow count to determine element to move focus to when expanding the references via keyboard.\n const previousOverflowCount = React.useRef(0);\n // We keep track of whether we are interacting with the overflow button via keyboard or not.\n const overflowButtonTriggeredViaKeyboard = React.useRef(false);\n const focusAttributes = useArrowNavigationGroup({\n axis: 'both',\n circular: true,\n memorizeCurrent: true\n });\n const onShowMoreButtonClick = React.useCallback(() => {\n setAreReferencesExpanded(true);\n }, []);\n const onShowLessButtonClick = React.useCallback(() => {\n setAreReferencesExpanded(false);\n }, []);\n const shouldUseOverflow = maxVisibleReferences !== undefined && !areReferencesExpanded;\n const state = {\n appearance,\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n previousOverflowCount,\n shouldUseOverflow,\n components: {\n root: 'div',\n showMoreButton: 'span',\n showLessButton: 'span'\n },\n root: slot.always(getIntrinsicElementProps('div', {\n ref,\n ...focusAttributes,\n ...rest,\n children: resolvedChildren\n }), {\n elementType: 'div'\n }),\n showMoreButton: shouldUseOverflow ? slot.optional(showMoreButton, {\n elementType: 'span'\n }) : undefined,\n showLessButton: areReferencesExpanded ? slot.optional(showLessButton, {\n elementType: 'span'\n }) : undefined\n };\n if (state.showMoreButton) {\n state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);\n }\n if (state.showLessButton) {\n state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);\n }\n return state;\n};\n//# sourceMappingURL=useReferenceList.js.map"],"names":["useReferenceList_unstable","props","ref","appearance","children","maxVisibleReferences","showLessButton","showMoreButton","rest","areReferencesExpanded","setAreReferencesExpanded","React","useState","referenceInOverflowClassName","useReferenceStyles","overflow","resolvedChildren","useMemo","undefined","results","childrenArray","Children","toArray","index","length","child","isValidElement","push","cloneElement","className","mergeClasses","previousOverflowCount","useRef","overflowButtonTriggeredViaKeyboard","focusAttributes","useArrowNavigationGroup","axis","circular","memorizeCurrent","onShowMoreButtonClick","useCallback","onShowLessButtonClick","shouldUseOverflow","state","components","root","slot","always","getIntrinsicElementProps","elementType","optional","onClick","mergeCallbacks"],"mappings":";;;;+BAYaA;;;eAAAA;;;;iEAZU;iCAC+E;oCAClD;AAU7C,MAAMA,4BAA4B,CAACC,OAAOC;IAC/C,MAAM,EACJC,aAAa,SAAS,EACtBC,QAAQ,EACRC,oBAAoB,EACpBC,cAAc,EACdC,cAAc,EACd,GAAGC,MACJ,GAAGP;IACJ,MAAM,CAACQ,uBAAuBC,yBAAyB,GAAGC,OAAMC,QAAQ,CAAC;IACzE,MAAMC,+BAA+BC,IAAAA,iCAAkB,IAAGC,QAAQ;IAClE,MAAMC,mBAAmBL,OAAMM,OAAO,CAAC;QACrC,IAAIZ,yBAAyBa,aAAa,CAACT,uBAAuB;YAChE,MAAMU,UAAU,EAAE;YAClB,MAAMC,gBAAgBT,OAAMU,QAAQ,CAACC,OAAO,CAAClB;YAC7C,IAAK,IAAImB,QAAQ,GAAGA,QAAQH,cAAcI,MAAM,EAAED,QAAS;gBACzD,MAAME,QAAQL,aAAa,CAACG,MAAM;gBAClC,8DAA8D;gBAC9D,IAAIA,SAASlB,sCAAwBM,OAAMe,cAAc,CAACD,QAAQ;oBAChEN,QAAQQ,IAAI,eAAChB,OAAMiB,YAAY,CAACH,OAAO;wBACrC,GAAGA,MAAMxB,KAAK;wBACd4B,WAAWC,IAAAA,6BAAY,EAACL,MAA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xBqC,MAAMrC,cAAc,CAAC6C,OAAO,GAAGC,IAAAA,+BAAc,EAACX,uBAAuBE,MAAMrC,cAAc,CAAC6C,OAAO;IACnG;IACA,OAAOR;AACT,GACA,4CAA4C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useReferenceListContextValues_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useReferenceListContextValues_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function useReferenceListContextValues_unstable(state) {
|
|
12
|
+
const { appearance, areReferencesExpanded, overflowButtonTriggeredViaKeyboard, previousOverflowCount, shouldUseOverflow } = state;
|
|
13
|
+
// This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
|
|
14
|
+
const referenceList = {
|
|
15
|
+
appearance,
|
|
16
|
+
areReferencesExpanded,
|
|
17
|
+
overflowButtonTriggeredViaKeyboard,
|
|
18
|
+
previousOverflowCount,
|
|
19
|
+
shouldUseOverflow
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
referenceList
|
|
23
|
+
};
|
|
24
|
+
} //# sourceMappingURL=useReferenceListContextValues.js.map
|
package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceListContextValues.js"],"sourcesContent":["export function useReferenceListContextValues_unstable(state) {\n const {\n appearance,\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n previousOverflowCount,\n shouldUseOverflow\n } = state;\n // This context is created with \"@fluentui/react-context-selector\", there is no sense to memoize it\n const referenceList = {\n appearance,\n areReferencesExpanded,\n overflowButtonTriggeredViaKeyboard,\n previousOverflowCount,\n shouldUseOverflow\n };\n return {\n referenceList\n };\n}\n//# sourceMappingURL=useReferenceListContextValues.js.map"],"names":["useReferenceListContextValues_unstable","state","appearance","areReferencesExpanded","overflowButtonTriggeredViaKeyboard","previousOverflowCount","shouldUseOverflow","referenceList"],"mappings":";;;;+BAAgBA;;;eAAAA;;;AAAT,SAASA,uCAAuCC,KAAK;IAC1D,MAAM,EACJC,UAAU,EACVC,qBAAqB,EACrBC,kCAAkC,EAClCC,qBAAqB,EACrBC,iBAAiB,EAClB,GAAGL;IACJ,mGAAmG;IACnG,MAAMM,gBAAgB;QACpBL;QACAC;QACAC;QACAC;QACAC;IACF;IACA,OAAO;QACLC;IACF;AACF,EACA,yDAAyD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 referenceListClassNames = {
|
|
21
|
+
root: 'fai-ReferenceList',
|
|
22
|
+
showMoreButton: 'fai-ReferenceList__showMoreButton',
|
|
23
|
+
showLessButton: 'fai-ReferenceList__showLessButton'
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Styles for the root slot
|
|
27
|
+
*/ const useRootBaseClassName = (0, _reactcomponents.__resetStyles)("rylvie1", null, [
|
|
28
|
+
".rylvie1{display:flex;flex-direction:row;gap:var(--spacingVerticalXS) var(--spacingHorizontalXS);}"
|
|
29
|
+
]);
|
|
30
|
+
const useRootStyles = (0, _reactcomponents.__styles)({
|
|
31
|
+
referencesExpanded: {
|
|
32
|
+
Eh141a: "fni485r"
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
d: [
|
|
36
|
+
".fni485r{flex-wrap:wrap;}"
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
const useOverflowButtonBaseClassName = (0, _reactcomponents.__resetStyles)("r6su6fj", null, [
|
|
40
|
+
".r6su6fj{flex-shrink:0;}"
|
|
41
|
+
]);
|
|
42
|
+
const useReferenceListStyles_unstable = (state)=>{
|
|
43
|
+
const { areReferencesExpanded, shouldUseOverflow } = state;
|
|
44
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
45
|
+
const rootStyles = useRootStyles();
|
|
46
|
+
const overflowButtonBaseClassName = useOverflowButtonBaseClassName();
|
|
47
|
+
state.root.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.root, rootBaseClassName, (areReferencesExpanded || !shouldUseOverflow) && rootStyles.referencesExpanded, state.root.className);
|
|
48
|
+
if (state.showMoreButton) {
|
|
49
|
+
state.showMoreButton.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.showMoreButton, overflowButtonBaseClassName, state.showMoreButton.className);
|
|
50
|
+
}
|
|
51
|
+
if (state.showLessButton) {
|
|
52
|
+
state.showLessButton.className = (0, _reactcomponents.mergeClasses)(referenceListClassNames.showLessButton, overflowButtonBaseClassName, state.showLessButton.className);
|
|
53
|
+
}
|
|
54
|
+
return state;
|
|
55
|
+
}; //# sourceMappingURL=useReferenceListStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceListStyles.js"],"sourcesContent":["import { __resetStyles, __styles, mergeClasses, tokens } from '@fluentui/react-components';\nexport const referenceListClassNames = {\n root: 'fai-ReferenceList',\n showMoreButton: 'fai-ReferenceList__showMoreButton',\n showLessButton: 'fai-ReferenceList__showLessButton'\n};\n/**\n * Styles for the root slot\n */\nconst useRootBaseClassName = __resetStyles(\"rylvie1\", null, [\".rylvie1{display:flex;flex-direction:row;gap:var(--spacingVerticalXS) var(--spacingHorizontalXS);}\"]);\nconst useRootStyles = __styles({\n referencesExpanded: {\n Eh141a: \"fni485r\"\n }\n}, {\n d: [\".fni485r{flex-wrap:wrap;}\"]\n});\nconst useOverflowButtonBaseClassName = __resetStyles(\"r6su6fj\", null, [\".r6su6fj{flex-shrink:0;}\"]);\n/**\n * Apply styling to the ReferenceList slots based on the state\n */\nexport const useReferenceListStyles_unstable = state => {\n const {\n areReferencesExpanded,\n shouldUseOverflow\n } = state;\n const rootBaseClassName = useRootBaseClassName();\n const rootStyles = useRootStyles();\n const overflowButtonBaseClassName = useOverflowButtonBaseClassName();\n state.root.className = mergeClasses(referenceListClassNames.root, rootBaseClassName, (areReferencesExpanded || !shouldUseOverflow) && rootStyles.referencesExpanded, state.root.className);\n if (state.showMoreButton) {\n state.showMoreButton.className = mergeClasses(referenceListClassNames.showMoreButton, overflowButtonBaseClassName, state.showMoreButton.className);\n }\n if (state.showLessButton) {\n state.showLessButton.className = mergeClasses(referenceListClassNames.showLessButton, overflowButtonBaseClassName, state.showLessButton.className);\n }\n return state;\n};\n//# sourceMappingURL=useReferenceListStyles.js.map"],"names":["referenceListClassNames","useReferenceListStyles_unstable","root","showMoreButton","showLessButton","useRootBaseClassName","__resetStyles","useRootStyles","__styles","referencesExpanded","Eh141a","d","useOverflowButtonBaseClassName","state","areReferencesExpanded","shouldUseOverflow","rootBaseClassName","rootStyles","overflowButtonBaseClassName","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,uBAAuB;eAAvBA;;IAoBAC,+BAA+B;eAA/BA;;;iCArBiD;AACvD,MAAMD,0BAA0B;IACrCE,MAAM;IACNC,gBAAgB;IAChBC,gBAAgB;AAClB;AACA;;CAEC,GACD,MAAMC,uBAAuBC,IAAAA,8BAAa,EAAC,WAAW,MAAM;IAAC;CAAqG;AAClK,MAAMC,gBAAgBC,IAAAA,yBAAQ,EAAC;IAC7BC,oBAAoB;QAClBC,QAAQ;IACV;AACF,GAAG;IACDC,GAAG;QAAC;KAA4B;AAClC;AACA,MAAMC,iCAAiCN,IAAAA,8BAAa,EAAC,WAAW,MAAM;IAAC;CAA2B;AAI3F,MAAML,kCAAkCY,CAAAA;IAC7C,MAAM,EACJC,qBAAqB,EACrBC,iBAAiB,EAClB,GAAGF;IACJ,MAAMG,oBAAoBX;IAC1B,MAAMY,aAAaV;IACnB,MAAMW,8BAA8BN;IACpCC,MAAMX,IAAI,CAACiB,SAAS,GAAGC,IAAAA,6BAAY,EAACpB,wBAAwBE,IAAI,EAAEc,mBAAmB,AAACF,CAAAA,yBAAyB,CAACC,iBAAgB,KAAME,WAAWR,kBAAkB,EAAEI,MAAMX,IAAI,CAACiB,SAAS;IACzL,IAAIN,MAAMV,cAAc,EAAE;QACxBU,MAAMV,cAAc,CAACgB,SAAS,GAAGC,IAAAA,6BAAY,EAACpB,wBAAwBG,cAAc,EAAEe,6BAA6BL,MAAMV,cAAc,CAACgB,SAAS;IACnJ;IACA,IAAIN,MAAMT,cAAc,EAAE;QACxBS,MAAMT,cAAc,CAACe,SAAS,GAAGC,IAAAA,6BAAY,EAACpB,wBAAwBI,cAAc,EAAEc,6BAA6BL,MAAMT,cAAc,CAACe,SAAS;IACnJ;IACA,OAAON;AACT,GACA,kDAAkD"}
|
package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "ReferenceOverflowButton", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return ReferenceOverflowButton;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _useReferenceOverflowButton = require("./useReferenceOverflowButton");
|
|
14
|
+
const _renderReferenceOverflowButton = require("./renderReferenceOverflowButton");
|
|
15
|
+
const _useReferenceOverflowButtonStyles = require("./useReferenceOverflowButtonStyles");
|
|
16
|
+
const ReferenceOverflowButton = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
|
|
17
|
+
const state = (0, _useReferenceOverflowButton.useReferenceOverflowButton_unstable)(props, ref);
|
|
18
|
+
(0, _useReferenceOverflowButtonStyles.useReferenceOverflowButtonStyles_unstable)(state);
|
|
19
|
+
return (0, _renderReferenceOverflowButton.renderReferenceOverflowButton_unstable)(state);
|
|
20
|
+
});
|
|
21
|
+
ReferenceOverflowButton.displayName = 'ReferenceOverflowButton'; //# sourceMappingURL=ReferenceOverflowButton.js.map
|
package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.js"],"sourcesContent":["import * as React from 'react';\nimport { useReferenceOverflowButton_unstable } from './useReferenceOverflowButton';\nimport { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';\nimport { useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles';\n// ReferenceOverflowButton component - TODO: add more docs\nexport const ReferenceOverflowButton = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useReferenceOverflowButton_unstable(props, ref);\n useReferenceOverflowButtonStyles_unstable(state);\n return renderReferenceOverflowButton_unstable(state);\n});\nReferenceOverflowButton.displayName = 'ReferenceOverflowButton';\n//# sourceMappingURL=ReferenceOverflowButton.js.map"],"names":["ReferenceOverflowButton","React","forwardRef","props","ref","state","useReferenceOverflowButton_unstable","useReferenceOverflowButtonStyles_unstable","renderReferenceOverflowButton_unstable","displayName"],"mappings":";;;;+BAKaA;;;eAAAA;;;;iEALU;4CAC6B;+CACG;kDACG;AAEnD,MAAMA,0BAA0B,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC3E,MAAMC,QAAQC,IAAAA,+DAAmC,EAACH,OAAOC;IACzDG,IAAAA,2EAAyC,EAACF;IAC1C,OAAOG,IAAAA,qEAAsC,EAACH;AAChD;AACAL,wBAAwBS,WAAW,GAAG,2BACtC,mDAAmD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["ReferenceOverflowButton.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=ReferenceOverflowButton.types.js.map"],"names":[],"mappings":";;;;CACA,yDAAyD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
const _export_star = require("@swc/helpers/_/_export_star");
|
|
6
|
+
_export_star._(require("./ReferenceOverflowButton"), exports);
|
|
7
|
+
_export_star._(require("./ReferenceOverflowButton.types"), exports);
|
|
8
|
+
_export_star._(require("./renderReferenceOverflowButton"), exports);
|
|
9
|
+
_export_star._(require("./useReferenceOverflowButton"), exports);
|
|
10
|
+
_export_star._(require("./useReferenceOverflowButtonStyles"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export * from './ReferenceOverflowButton';\nexport * from './ReferenceOverflowButton.types';\nexport * from './renderReferenceOverflowButton';\nexport * from './useReferenceOverflowButton';\nexport * from './useReferenceOverflowButtonStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;uBAAc;uBACA;uBACA;uBACA;uBACA;CACd,iCAAiC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "renderReferenceOverflowButton_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return renderReferenceOverflowButton_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
|
|
12
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
13
|
+
const renderReferenceOverflowButton_unstable = (state)=>{
|
|
14
|
+
(0, _reactcomponents.assertSlots)(state);
|
|
15
|
+
return state.shouldRenderOverflowButton ? /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {}) : null;
|
|
16
|
+
}; //# sourceMappingURL=renderReferenceOverflowButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["renderReferenceOverflowButton.js"],"sourcesContent":["import { jsx as _jsx } from \"@fluentui/react-jsx-runtime/jsx-runtime\";\nimport { assertSlots } from '@fluentui/react-components';\n/**\n * Render the final JSX of ReferenceOverflowButton\n */\nexport const renderReferenceOverflowButton_unstable = state => {\n assertSlots(state);\n return state.shouldRenderOverflowButton ? /*#__PURE__*/_jsx(state.root, {}) : null;\n};\n//# sourceMappingURL=renderReferenceOverflowButton.js.map"],"names":["renderReferenceOverflowButton_unstable","state","assertSlots","shouldRenderOverflowButton","_jsx","root"],"mappings":";;;;+BAKaA;;;eAAAA;;;4BALe;iCACA;AAIrB,MAAMA,yCAAyCC,CAAAA;IACpDC,IAAAA,4BAAW,EAACD;IACZ,OAAOA,MAAME,0BAA0B,GAAG,WAAW,GAAEC,IAAAA,eAAI,EAACH,MAAMI,IAAI,EAAE,CAAC,KAAK;AAChF,GACA,yDAAyD"}
|
package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "useReferenceOverflowButton_unstable", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return useReferenceOverflowButton_unstable;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _keyboardkeys = require("@fluentui/keyboard-keys");
|
|
14
|
+
const _reactcomponents = require("@fluentui/react-components");
|
|
15
|
+
const _reactutilities = require("@fluentui/react-utilities");
|
|
16
|
+
const _referenceListContext = require("../../../contexts/reference-v2/referenceListContext");
|
|
17
|
+
const useReferenceOverflowButton_unstable = (props, ref)=>{
|
|
18
|
+
const { children, text } = props;
|
|
19
|
+
const rootRef = _react.useRef(null);
|
|
20
|
+
const [setTimeout] = (0, _reactutilities.useTimeout)();
|
|
21
|
+
const { areReferencesExpanded, ctxAppearance, previousOverflowCount, triggeredViaKeyboard } = (0, _referenceListContext.useReferenceListContext_unstable)((ctx)=>({
|
|
22
|
+
ctxAppearance: ctx.appearance,
|
|
23
|
+
areReferencesExpanded: ctx.areReferencesExpanded,
|
|
24
|
+
previousOverflowCount: ctx.previousOverflowCount,
|
|
25
|
+
triggeredViaKeyboard: ctx.overflowButtonTriggeredViaKeyboard
|
|
26
|
+
}));
|
|
27
|
+
const appearance = props.appearance || ctxAppearance;
|
|
28
|
+
const { isOverflowing, overflowCount } = (0, _reactcomponents.useOverflowMenu)();
|
|
29
|
+
const processedText = children !== null && children !== void 0 ? children : typeof text === 'function' ? text(overflowCount) : text;
|
|
30
|
+
const { findPrevFocusable } = (0, _reactcomponents.useFocusFinders)();
|
|
31
|
+
const onKeyDown = _react.useCallback((ev)=>{
|
|
32
|
+
if (ev.key === _keyboardkeys.Enter || ev.key === _keyboardkeys.Space) {
|
|
33
|
+
triggeredViaKeyboard.current = true;
|
|
34
|
+
}
|
|
35
|
+
}, [
|
|
36
|
+
triggeredViaKeyboard
|
|
37
|
+
]);
|
|
38
|
+
// When the references are expanded or contracted via keyboard, we need to move focus to the appropriate element.
|
|
39
|
+
_react.useEffect(()=>{
|
|
40
|
+
if (triggeredViaKeyboard.current) {
|
|
41
|
+
let elementToFocus;
|
|
42
|
+
// If the references are contracted, we move focus to the overflow button.
|
|
43
|
+
if (!areReferencesExpanded) {
|
|
44
|
+
elementToFocus = rootRef.current;
|
|
45
|
+
} else if (rootRef.current && previousOverflowCount) {
|
|
46
|
+
let currentElement = rootRef.current;
|
|
47
|
+
for(let i = 0; i < previousOverflowCount.current && currentElement; i++){
|
|
48
|
+
currentElement = findPrevFocusable(currentElement);
|
|
49
|
+
}
|
|
50
|
+
elementToFocus = currentElement;
|
|
51
|
+
}
|
|
52
|
+
// 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.
|
|
53
|
+
setTimeout(()=>{
|
|
54
|
+
elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
|
|
55
|
+
triggeredViaKeyboard.current = false;
|
|
56
|
+
}, 0);
|
|
57
|
+
}
|
|
58
|
+
// We update the previousOverflowCount to the current one when references are contracted, so that we have the correct number once they are expanded.
|
|
59
|
+
previousOverflowCount.current = areReferencesExpanded ? 0 : overflowCount;
|
|
60
|
+
}, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
+
[
|
|
62
|
+
areReferencesExpanded,
|
|
63
|
+
isOverflowing,
|
|
64
|
+
triggeredViaKeyboard
|
|
65
|
+
]);
|
|
66
|
+
const state = {
|
|
67
|
+
appearance,
|
|
68
|
+
shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,
|
|
69
|
+
components: {
|
|
70
|
+
root: 'button'
|
|
71
|
+
},
|
|
72
|
+
root: _reactcomponents.slot.always((0, _reactcomponents.getIntrinsicElementProps)('button', {
|
|
73
|
+
ref: (0, _reactcomponents.useMergedRefs)(rootRef, ref),
|
|
74
|
+
...props
|
|
75
|
+
}), {
|
|
76
|
+
defaultProps: {
|
|
77
|
+
children: processedText
|
|
78
|
+
},
|
|
79
|
+
elementType: 'button'
|
|
80
|
+
})
|
|
81
|
+
};
|
|
82
|
+
state.root.onKeyDown = (0, _reactcomponents.mergeCallbacks)(onKeyDown, props.onKeyDown);
|
|
83
|
+
return state;
|
|
84
|
+
}; //# sourceMappingURL=useReferenceOverflowButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceOverflowButton.js"],"sourcesContent":["import * as React from 'react';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\nimport { getIntrinsicElementProps, mergeCallbacks, slot, useFocusFinders, useMergedRefs, useOverflowMenu } from '@fluentui/react-components';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport { useReferenceListContext_unstable } from '../../../contexts/reference-v2/referenceListContext';\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 = (props, ref) => {\n const {\n children,\n text\n } = props;\n const rootRef = React.useRef(null);\n const [setTimeout] = useTimeout();\n const {\n areReferencesExpanded,\n ctxAppearance,\n previousOverflowCount,\n triggeredViaKeyboard\n } = useReferenceListContext_unstable(ctx => ({\n ctxAppearance: ctx.appearance,\n areReferencesExpanded: ctx.areReferencesExpanded,\n previousOverflowCount: ctx.previousOverflowCount,\n triggeredViaKeyboard: ctx.overflowButtonTriggeredViaKeyboard\n }));\n const appearance = props.appearance || ctxAppearance;\n const {\n isOverflowing,\n overflowCount\n } = useOverflowMenu();\n const processedText = children !== null && children !== void 0 ? children : typeof text === 'function' ? text(overflowCount) : text;\n const {\n findPrevFocusable\n } = useFocusFinders();\n const onKeyDown = React.useCallback(ev => {\n if (ev.key === Enter || ev.key === Space) {\n triggeredViaKeyboard.current = true;\n }\n }, [triggeredViaKeyboard]);\n // When the references are expanded or contracted via keyboard, we need to move focus to the appropriate element.\n React.useEffect(() => {\n if (triggeredViaKeyboard.current) {\n let elementToFocus;\n // If the references are contracted, we move focus to the overflow button.\n if (!areReferencesExpanded) {\n elementToFocus = rootRef.current;\n } else if (rootRef.current && previousOverflowCount) {\n let currentElement = rootRef.current;\n for (let i = 0; i < previousOverflowCount.current && currentElement; i++) {\n currentElement = findPrevFocusable(currentElement);\n }\n elementToFocus = currentElement;\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 === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();\n triggeredViaKeyboard.current = false;\n }, 0);\n }\n // We update the previousOverflowCount to the current one when references are contracted, so that we have the correct number once they are expanded.\n previousOverflowCount.current = areReferencesExpanded ? 0 : overflowCount;\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [areReferencesExpanded, isOverflowing, triggeredViaKeyboard]);\n const state = {\n appearance,\n shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,\n components: {\n root: 'button'\n },\n root: slot.always(getIntrinsicElementProps('button', {\n ref: useMergedRefs(rootRef, ref),\n ...props\n }), {\n defaultProps: {\n children: processedText\n },\n elementType: 'button'\n })\n };\n state.root.onKeyDown = mergeCallbacks(onKeyDown, props.onKeyDown);\n return state;\n};\n//# sourceMappingURL=useReferenceOverflowButton.js.map"],"names":["useReferenceOverflowButton_unstable","props","ref","children","text","rootRef","React","useRef","setTimeout","useTimeout","areReferencesExpanded","ctxAppearance","previousOverflowCount","triggeredViaKeyboard","useReferenceListContext_unstable","ctx","appearance","overflowButtonTriggeredViaKeyboard","isOverflowing","overflowCount","useOverflowMenu","processedText","findPrevFocusable","useFocusFinders","onKeyDown","useCallback","ev","key","Enter","Space","current","useEffect","elementToFocus","currentElement","i","focus","state","shouldRenderOverflowButton","components","root","slot","always","getIntrinsicElementProps","useMergedRefs","defaultProps","elementType","mergeCallbacks"],"mappings":";;;;+BAcaA;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