@fluentui-copilot/react-reference 0.15.0 → 0.15.2-hotfix.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 +38 -0
- package/CHANGELOG.md +19 -1
- package/lib/Citation.js +0 -1
- package/lib/Reference.js +0 -1
- package/lib/ReferenceGroupToggle.js +0 -1
- package/lib/ReferenceList.js +0 -1
- package/lib/ReferenceListV2.js +0 -1
- package/lib/ReferenceOverflowButton.js +0 -1
- package/lib/ReferenceV2.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 +67 -0
- package/lib/components/Citation/useCitationStyles.styles.raw.js.map +1 -0
- package/lib/components/Reference/Reference.js +5 -7
- package/lib/components/Reference/Reference.types.js +1 -2
- package/lib/components/Reference/index.js +0 -1
- package/lib/components/Reference/renderReference.js +27 -12
- package/lib/components/Reference/useReference.js +173 -172
- package/lib/components/Reference/useReferenceStyles.styles.raw.js +197 -0
- package/lib/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.js +4 -6
- package/lib/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js +1 -2
- package/lib/components/ReferenceGroupToggle/index.js +0 -1
- package/lib/components/ReferenceGroupToggle/renderReferenceGroupToggle.js +9 -8
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggle.js +26 -30
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js +44 -0
- package/lib/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js.map +1 -0
- package/lib/components/ReferenceList/ReferenceList.js +5 -7
- package/lib/components/ReferenceList/ReferenceList.types.js +1 -2
- package/lib/components/ReferenceList/index.js +0 -1
- package/lib/components/ReferenceList/renderReferenceList.js +4 -6
- package/lib/components/ReferenceList/useReferenceList.js +15 -17
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js +27 -0
- package/lib/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/Reference/Reference.js +4 -5
- package/lib/components/reference-v2/Reference/Reference.types.js +1 -2
- package/lib/components/reference-v2/Reference/index.js +0 -1
- package/lib/components/reference-v2/Reference/renderReference.js +20 -17
- package/lib/components/reference-v2/Reference/useReference.js +53 -59
- package/lib/components/reference-v2/Reference/useReferenceStyles.styles.raw.js +110 -0
- package/lib/components/reference-v2/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/ReferenceList/ReferenceList.js +5 -6
- package/lib/components/reference-v2/ReferenceList/ReferenceList.types.js +1 -2
- package/lib/components/reference-v2/ReferenceList/index.js +0 -1
- package/lib/components/reference-v2/ReferenceList/renderReferenceList.js +17 -17
- package/lib/components/reference-v2/ReferenceList/useReferenceList.js +70 -80
- package/lib/components/reference-v2/ReferenceList/useReferenceListContextValues.js +13 -21
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js +47 -0
- package/lib/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +4 -5
- package/lib/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +1 -2
- package/lib/components/reference-v2/ReferenceOverflowButton/index.js +0 -1
- package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +9 -14
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +77 -77
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +45 -0
- package/lib/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +1 -0
- package/lib/components/reference-v2/index.js +0 -1
- package/lib/contexts/ReferenceGroupContext.js +5 -6
- package/lib/contexts/reference-v2/index.js +0 -1
- package/lib/contexts/reference-v2/referenceListContext.js +11 -12
- package/lib/index.js +0 -1
- package/lib/utilities/index.js +0 -1
- package/lib/utilities/reference-v2/generateReferenceCitationPreview.js +75 -86
- package/lib/utilities/reference-v2/index.js +0 -1
- package/lib/utilities/reference-v2/useReferenceCitationPreview.js +5 -5
- package/lib/utilities/useReferenceCitationPreview.js +123 -114
- package/lib/utilities/useReferenceGroup.js +28 -32
- package/lib/utilities/useReferenceGroup.js.map +1 -1
- package/lib/utilities/useReferenceGroup.styles.js +9 -0
- package/lib/utilities/useReferenceGroup.styles.js.map +1 -0
- package/lib/utilities/useReferenceGroup.styles.raw.js +6 -0
- package/lib/utilities/useReferenceGroup.styles.raw.js.map +1 -0
- package/lib-commonjs/Citation.js +0 -1
- package/lib-commonjs/Reference.js +0 -1
- package/lib-commonjs/ReferenceGroupToggle.js +0 -1
- package/lib-commonjs/ReferenceList.js +0 -1
- package/lib-commonjs/ReferenceListV2.js +0 -1
- package/lib-commonjs/ReferenceOverflowButton.js +0 -1
- package/lib-commonjs/ReferenceV2.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 +83 -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 +214 -0
- package/lib-commonjs/components/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.js +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/ReferenceGroupToggle.types.js +0 -1
- package/lib-commonjs/components/ReferenceGroupToggle/index.js +0 -1
- package/lib-commonjs/components/ReferenceGroupToggle/renderReferenceGroupToggle.js +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/renderReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggle.js +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggle.js.map +1 -1
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.styles.raw.js +60 -0
- package/lib-commonjs/components/ReferenceGroupToggle/useReferenceGroupToggleStyles.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/useReferenceListStyles.styles.raw.js +44 -0
- package/lib-commonjs/components/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/Reference/Reference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/Reference.types.js +0 -1
- package/lib-commonjs/components/reference-v2/Reference/index.js +0 -1
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReference.js +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.styles.raw.js +132 -0
- package/lib-commonjs/components/reference-v2/Reference/useReferenceStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/ReferenceList.types.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/index.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/renderReferenceList.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceList.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListContextValues.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js +63 -0
- package/lib-commonjs/components/reference-v2/ReferenceList/useReferenceListStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/ReferenceOverflowButton.types.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/index.js +0 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButton.js.map +1 -1
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js +61 -0
- package/lib-commonjs/components/reference-v2/ReferenceOverflowButton/useReferenceOverflowButtonStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/reference-v2/index.js +0 -1
- package/lib-commonjs/contexts/ReferenceGroupContext.js +1 -1
- package/lib-commonjs/contexts/ReferenceGroupContext.js.map +1 -1
- package/lib-commonjs/contexts/reference-v2/index.js +0 -1
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js +1 -1
- package/lib-commonjs/contexts/reference-v2/referenceListContext.js.map +1 -1
- package/lib-commonjs/index.js +0 -1
- package/lib-commonjs/utilities/index.js +0 -1
- package/lib-commonjs/utilities/reference-v2/generateReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/reference-v2/generateReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/reference-v2/index.js +0 -1
- package/lib-commonjs/utilities/reference-v2/useReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/reference-v2/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js +1 -1
- package/lib-commonjs/utilities/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/utilities/useReferenceGroup.js +3 -11
- package/lib-commonjs/utilities/useReferenceGroup.js.map +1 -1
- package/lib-commonjs/utilities/useReferenceGroup.styles.js +20 -0
- package/lib-commonjs/utilities/useReferenceGroup.styles.js.map +1 -0
- package/lib-commonjs/utilities/useReferenceGroup.styles.raw.js +16 -0
- package/lib-commonjs/utilities/useReferenceGroup.styles.raw.js.map +1 -0
- package/package.json +13 -17
|
@@ -10,84 +10,74 @@ import { useRootStyles } from '../Reference/useReferenceStyles.styles';
|
|
|
10
10
|
*
|
|
11
11
|
* @param props - props from this instance of ReferenceList
|
|
12
12
|
* @param ref - reference to root HTMLElement of ReferenceList
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
children
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}) : undefined
|
|
84
|
-
};
|
|
85
|
-
if (state.showMoreButton) {
|
|
86
|
-
state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);
|
|
87
|
-
}
|
|
88
|
-
if (state.showLessButton) {
|
|
89
|
-
state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);
|
|
90
|
-
}
|
|
91
|
-
return state;
|
|
13
|
+
*/ export const useReferenceList_unstable = (props, ref)=>{
|
|
14
|
+
const { arrowableRegion, children, maxVisibleReferences, minVisibleReferences, showLessButton, showMoreButton, ...rest } = props;
|
|
15
|
+
const [areReferencesExpanded, setAreReferencesExpanded] = React.useState(false);
|
|
16
|
+
const referenceListRef = React.useRef(null);
|
|
17
|
+
const totalReferencesCount = React.Children.count(children);
|
|
18
|
+
const styles = useRootStyles();
|
|
19
|
+
const resolvedChildren = useOverflowMaxVisibleItems({
|
|
20
|
+
additionalCondition: !areReferencesExpanded,
|
|
21
|
+
children,
|
|
22
|
+
maxVisibleItems: maxVisibleReferences,
|
|
23
|
+
minVisibleItems: minVisibleReferences,
|
|
24
|
+
overflowClassName: styles.overflow
|
|
25
|
+
});
|
|
26
|
+
// We keep track of whether we are interacting with the overflow button via keyboard or not.
|
|
27
|
+
const overflowButtonTriggeredViaKeyboard = React.useRef(false);
|
|
28
|
+
const focusAttributes = useArrowNavigationGroup({
|
|
29
|
+
axis: 'both',
|
|
30
|
+
circular: true,
|
|
31
|
+
memorizeCurrent: true
|
|
32
|
+
});
|
|
33
|
+
const onShowMoreButtonClick = React.useCallback(()=>{
|
|
34
|
+
setAreReferencesExpanded(true);
|
|
35
|
+
}, []);
|
|
36
|
+
const onShowLessButtonClick = React.useCallback(()=>{
|
|
37
|
+
setAreReferencesExpanded(false);
|
|
38
|
+
}, []);
|
|
39
|
+
const shouldUseOverflow = (minVisibleReferences === undefined || minVisibleReferences < totalReferencesCount) && maxVisibleReferences !== undefined && !areReferencesExpanded;
|
|
40
|
+
// Since the overflow button is an OverflowItem that's always visible, we need to account for it.
|
|
41
|
+
const minVisibleOverflowItems = minVisibleReferences ? minVisibleReferences + 1 : 1;
|
|
42
|
+
const state = {
|
|
43
|
+
areReferencesExpanded,
|
|
44
|
+
overflowButtonTriggeredViaKeyboard,
|
|
45
|
+
maxVisibleReferences,
|
|
46
|
+
minVisibleReferences: minVisibleOverflowItems,
|
|
47
|
+
referenceListRef,
|
|
48
|
+
shouldUseOverflow,
|
|
49
|
+
totalReferencesCount,
|
|
50
|
+
components: {
|
|
51
|
+
root: 'div',
|
|
52
|
+
arrowableRegion: 'div',
|
|
53
|
+
showMoreButton: 'span',
|
|
54
|
+
showLessButton: 'span'
|
|
55
|
+
},
|
|
56
|
+
root: slot.always(getIntrinsicElementProps('div', {
|
|
57
|
+
ref: useMergedRefs(ref, referenceListRef),
|
|
58
|
+
...rest
|
|
59
|
+
}), {
|
|
60
|
+
elementType: 'div'
|
|
61
|
+
}),
|
|
62
|
+
arrowableRegion: slot.always(arrowableRegion, {
|
|
63
|
+
defaultProps: {
|
|
64
|
+
...focusAttributes,
|
|
65
|
+
children: resolvedChildren
|
|
66
|
+
},
|
|
67
|
+
elementType: 'div'
|
|
68
|
+
}),
|
|
69
|
+
showMoreButton: shouldUseOverflow ? slot.optional(showMoreButton, {
|
|
70
|
+
elementType: 'span'
|
|
71
|
+
}) : undefined,
|
|
72
|
+
showLessButton: areReferencesExpanded ? slot.optional(showLessButton, {
|
|
73
|
+
elementType: 'span'
|
|
74
|
+
}) : undefined
|
|
75
|
+
};
|
|
76
|
+
if (state.showMoreButton) {
|
|
77
|
+
state.showMoreButton.onClick = mergeCallbacks(onShowMoreButtonClick, state.showMoreButton.onClick);
|
|
78
|
+
}
|
|
79
|
+
if (state.showLessButton) {
|
|
80
|
+
state.showLessButton.onClick = mergeCallbacks(onShowLessButtonClick, state.showLessButton.onClick);
|
|
81
|
+
}
|
|
82
|
+
return state;
|
|
92
83
|
};
|
|
93
|
-
//# sourceMappingURL=useReferenceList.js.map
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
export function useReferenceListContextValues_unstable(state) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
referenceListRef,
|
|
16
|
-
shouldUseOverflow,
|
|
17
|
-
totalReferencesCount
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
referenceList
|
|
21
|
-
};
|
|
2
|
+
const { areReferencesExpanded, maxVisibleReferences, overflowButtonTriggeredViaKeyboard, referenceListRef, shouldUseOverflow, totalReferencesCount } = state;
|
|
3
|
+
// This context is created with "@fluentui/react-context-selector", there is no sense to memoize it
|
|
4
|
+
const referenceList = {
|
|
5
|
+
areReferencesExpanded,
|
|
6
|
+
maxVisibleReferences,
|
|
7
|
+
overflowButtonTriggeredViaKeyboard,
|
|
8
|
+
referenceListRef,
|
|
9
|
+
shouldUseOverflow,
|
|
10
|
+
totalReferencesCount
|
|
11
|
+
};
|
|
12
|
+
return {
|
|
13
|
+
referenceList
|
|
14
|
+
};
|
|
22
15
|
}
|
|
23
|
-
//# sourceMappingURL=useReferenceListContextValues.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const referenceListClassNames = {
|
|
4
|
+
root: 'fai-ReferenceList',
|
|
5
|
+
arrowableRegion: 'fai-ReferenceList__arrowableRegion',
|
|
6
|
+
showMoreButton: 'fai-ReferenceList__showMoreButton',
|
|
7
|
+
showLessButton: 'fai-ReferenceList__showLessButton'
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Styles for the root slot
|
|
11
|
+
*/ const useRootBaseClassName = makeResetStyles({
|
|
12
|
+
display: 'flex',
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
gap: `${tokens.spacingVerticalXS} ${tokens.spacingHorizontalXS}`
|
|
15
|
+
});
|
|
16
|
+
const useRootStyles = makeStyles({
|
|
17
|
+
referencesExpanded: {
|
|
18
|
+
flexWrap: 'wrap'
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const useArrowableRegionBaseClassName = makeResetStyles({
|
|
22
|
+
display: 'contents',
|
|
23
|
+
maxWidth: '100%'
|
|
24
|
+
});
|
|
25
|
+
const useOverflowButtonBaseClassName = makeResetStyles({
|
|
26
|
+
display: 'inline-flex',
|
|
27
|
+
flexShrink: 0
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Apply styling to the ReferenceList slots based on the state
|
|
31
|
+
*/ export const useReferenceListStyles_unstable = (state)=>{
|
|
32
|
+
'use no memo';
|
|
33
|
+
const { areReferencesExpanded, shouldUseOverflow } = state;
|
|
34
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
35
|
+
const arrowableRegionBaseClassName = useArrowableRegionBaseClassName();
|
|
36
|
+
const overflowButtonBaseClassName = useOverflowButtonBaseClassName();
|
|
37
|
+
const rootStyles = useRootStyles();
|
|
38
|
+
state.root.className = mergeClasses(referenceListClassNames.root, rootBaseClassName, (areReferencesExpanded || !shouldUseOverflow) && rootStyles.referencesExpanded, state.root.className);
|
|
39
|
+
state.arrowableRegion.className = mergeClasses(referenceListClassNames.arrowableRegion, arrowableRegionBaseClassName, state.arrowableRegion.className);
|
|
40
|
+
if (state.showMoreButton) {
|
|
41
|
+
state.showMoreButton.className = mergeClasses(referenceListClassNames.showMoreButton, overflowButtonBaseClassName, state.showMoreButton.className);
|
|
42
|
+
}
|
|
43
|
+
if (state.showLessButton) {
|
|
44
|
+
state.showLessButton.className = mergeClasses(referenceListClassNames.showLessButton, overflowButtonBaseClassName, state.showLessButton.className);
|
|
45
|
+
}
|
|
46
|
+
return state;
|
|
47
|
+
};
|
|
@@ -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":["makeResetStyles","makeStyles","mergeClasses","tokens","referenceListClassNames","root","arrowableRegion","showMoreButton","showLessButton","useRootBaseClassName","display","flexDirection","gap","spacingVerticalXS","spacingHorizontalXS","useRootStyles","referencesExpanded","flexWrap","useArrowableRegionBaseClassName","maxWidth","useOverflowButtonBaseClassName","flexShrink","useReferenceListStyles_unstable","state","areReferencesExpanded","shouldUseOverflow","rootBaseClassName","arrowableRegionBaseClassName","overflowButtonBaseClassName","rootStyles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,QAAQ,6BAA6B;AACvF,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,0BAA8D;IACzEC,MAAM;IACNC,iBAAiB;IACjBC,gBAAgB;IAChBC,gBAAgB;AAClB,EAAE;AAEF;;CAEC,GACD,MAAMC,uBAAuBT,gBAAgB;IAC3CU,SAAS;IACTC,eAAe;IACfC,KAAK,CAAC,EAAET,OAAOU,iBAAiB,CAAC,CAAC,EAAEV,OAAOW,mBAAmB,CAAC,CAAC;AAClE;AAEA,MAAMC,gBAAgBd,WAAW;IAC/Be,oBAAoB;QAClBC,UAAU;IACZ;AACF;AAEA,MAAMC,kCAAkClB,gBAAgB;IACtDU,SAAS;IACTS,UAAU;AACZ;AAEA,MAAMC,iCAAiCpB,gBAAgB;IACrDU,SAAS;IACTW,YAAY;AACd;AAEA;;CAEC,GACD,OAAO,MAAMC,kCAAkC,CAACC;IAC9C;IAEA,MAAM,EAAEC,qBAAqB,EAAEC,iBAAiB,EAAE,GAAGF;IAErD,MAAMG,oBAAoBjB;IAC1B,MAAMkB,+BAA+BT;IACrC,MAAMU,8BAA8BR;IACpC,MAAMS,aAAad;IAEnBQ,MAAMlB,IAAI,CAACyB,SAAS,GAAG5B,aACrBE,wBAAwBC,IAAI,EAC5BqB,mBACA,AAACF,CAAAA,yBAAyB,CAACC,iBAAgB,KAAMI,WAAWb,kBAAkB,EAC9EO,MAAMlB,IAAI,CAACyB,SAAS;IAGtBP,MAAMjB,eAAe,CAACwB,SAAS,GAAG5B,aAChCE,wBAAwBE,eAAe,EACvCqB,8BACAJ,MAAMjB,eAAe,CAACwB,SAAS;IAGjC,IAAIP,MAAMhB,cAAc,EAAE;QACxBgB,MAAMhB,cAAc,CAACuB,SAAS,GAAG5B,aAC/BE,wBAAwBG,cAAc,EACtCqB,6BACAL,MAAMhB,cAAc,CAACuB,SAAS;IAElC;IAEA,IAAIP,MAAMf,cAAc,EAAE;QACxBe,MAAMf,cAAc,CAACsB,SAAS,GAAG5B,aAC/BE,wBAAwBI,cAAc,EACtCoB,6BACAL,MAAMf,cAAc,CAACsB,SAAS;IAElC;IAEA,OAAOP;AACT,EAAE"}
|
|
@@ -3,10 +3,9 @@ import { useReferenceOverflowButton_unstable } from './useReferenceOverflowButto
|
|
|
3
3
|
import { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';
|
|
4
4
|
import { useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles.styles';
|
|
5
5
|
// ReferenceOverflowButton component - TODO: add more docs
|
|
6
|
-
export const ReferenceOverflowButton = /*#__PURE__*/React.forwardRef((props, ref)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export const ReferenceOverflowButton = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
7
|
+
const state = useReferenceOverflowButton_unstable(props, ref);
|
|
8
|
+
useReferenceOverflowButtonStyles_unstable(state);
|
|
9
|
+
return renderReferenceOverflowButton_unstable(state);
|
|
10
10
|
});
|
|
11
11
|
ReferenceOverflowButton.displayName = 'ReferenceOverflowButton';
|
|
12
|
-
//# sourceMappingURL=ReferenceOverflowButton.js.map
|
|
@@ -2,4 +2,3 @@ export { ReferenceOverflowButton } from './ReferenceOverflowButton';
|
|
|
2
2
|
export { renderReferenceOverflowButton_unstable } from './renderReferenceOverflowButton';
|
|
3
3
|
export { useReferenceOverflowButton_unstable } from './useReferenceOverflowButton';
|
|
4
4
|
export { referenceOverflowButtonClassNames, useReferenceOverflowButtonStyles_unstable } from './useReferenceOverflowButtonStyles.styles';
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
package/lib/components/reference-v2/ReferenceOverflowButton/renderReferenceOverflowButton.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
2
|
import { OverflowItem, assertSlots } from '@fluentui/react-components';
|
|
3
3
|
/**
|
|
4
4
|
* Render the final JSX of ReferenceOverflowButton
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
id: id,
|
|
14
|
-
priority: 1,
|
|
15
|
-
children: /*#__PURE__*/_jsx(state.root, {})
|
|
16
|
-
}, id) : null;
|
|
5
|
+
*/ export const renderReferenceOverflowButton_unstable = (state)=>{
|
|
6
|
+
assertSlots(state);
|
|
7
|
+
const { id, shouldRenderOverflowButton } = state;
|
|
8
|
+
return shouldRenderOverflowButton ? /*#__PURE__*/ _jsx(OverflowItem, {
|
|
9
|
+
id: id,
|
|
10
|
+
priority: 1,
|
|
11
|
+
children: /*#__PURE__*/ _jsx(state.root, {})
|
|
12
|
+
}, id) : null;
|
|
17
13
|
};
|
|
18
|
-
//# sourceMappingURL=renderReferenceOverflowButton.js.map
|
|
@@ -12,82 +12,82 @@ import { useDesignVersion } from '@fluentui-copilot/react-provider';
|
|
|
12
12
|
*
|
|
13
13
|
* @param props - props from this instance of ReferenceOverflowButton
|
|
14
14
|
* @param ref - reference to root HTMLElement of ReferenceOverflowButton
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
id
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const {
|
|
34
|
-
isOverflowing,
|
|
35
|
-
overflowCount
|
|
36
|
-
} = useOverflowMenu();
|
|
37
|
-
const processedText = children !== null && children !== void 0 ? children : typeof text === 'function' ? text(overflowCount) : text;
|
|
38
|
-
const {
|
|
39
|
-
findFirstFocusable,
|
|
40
|
-
findNextFocusable
|
|
41
|
-
} = useFocusFinders();
|
|
42
|
-
const onKeyDown = React.useCallback(ev => {
|
|
43
|
-
if (ev.key === Enter || ev.key === Space) {
|
|
44
|
-
triggeredViaKeyboard.current = true;
|
|
45
|
-
}
|
|
46
|
-
}, [triggeredViaKeyboard]);
|
|
47
|
-
// We keep track of the previous overflow count to help determine the element to move focus to when expanding the references via keyboard.
|
|
48
|
-
const previousOverflow = React.useRef(0);
|
|
49
|
-
// When the references are expanded or collapsed via keyboard, we need to move focus to the appropriate element.
|
|
50
|
-
React.useEffect(() => {
|
|
51
|
-
// We only try to move focus if maxVisibleReferences is set and the overflow button was triggered via keyboard.
|
|
52
|
-
if (maxVisibleReferences !== undefined && triggeredViaKeyboard.current) {
|
|
53
|
-
let elementToFocus;
|
|
54
|
-
// If the references are collapsed, we move focus to the overflow button.
|
|
55
|
-
if (!areReferencesExpanded) {
|
|
56
|
-
elementToFocus = rootRef.current;
|
|
57
|
-
previousOverflow.current = overflowCount;
|
|
58
|
-
} else if (rootRef.current && referenceListRef.current) {
|
|
59
|
-
const positionToFocus = maxVisibleReferences < totalReferencesCount - previousOverflow.current ? maxVisibleReferences : totalReferencesCount - previousOverflow.current;
|
|
60
|
-
let currentElement = findFirstFocusable(referenceListRef.current);
|
|
61
|
-
for (let i = 0; i < positionToFocus && currentElement; i++) {
|
|
62
|
-
currentElement = findNextFocusable(currentElement);
|
|
15
|
+
*/ export const useReferenceOverflowButton_unstable = (props, ref)=>{
|
|
16
|
+
'use no memo';
|
|
17
|
+
const { children, id, text } = props;
|
|
18
|
+
const designVersion = useDesignVersion(props.designVersion);
|
|
19
|
+
const rootRef = React.useRef(null);
|
|
20
|
+
const [setTimeout] = useTimeout();
|
|
21
|
+
const referenceOverflowButtonId = useId('reference-overflow-button-', id);
|
|
22
|
+
const areReferencesExpanded = useReferenceListContext_unstable((ctx)=>ctx.areReferencesExpanded);
|
|
23
|
+
const maxVisibleReferences = useReferenceListContext_unstable((ctx)=>ctx.maxVisibleReferences);
|
|
24
|
+
const referenceListRef = useReferenceListContext_unstable((ctx)=>ctx.referenceListRef);
|
|
25
|
+
const totalReferencesCount = useReferenceListContext_unstable((ctx)=>ctx.totalReferencesCount);
|
|
26
|
+
const triggeredViaKeyboard = useReferenceListContext_unstable((ctx)=>ctx.overflowButtonTriggeredViaKeyboard);
|
|
27
|
+
const { isOverflowing, overflowCount } = useOverflowMenu();
|
|
28
|
+
const processedText = children !== null && children !== void 0 ? children : typeof text === 'function' ? text(overflowCount) : text;
|
|
29
|
+
const { findFirstFocusable, findNextFocusable } = useFocusFinders();
|
|
30
|
+
const onKeyDown = React.useCallback((ev)=>{
|
|
31
|
+
if (ev.key === Enter || ev.key === Space) {
|
|
32
|
+
triggeredViaKeyboard.current = true;
|
|
63
33
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
34
|
+
}, [
|
|
35
|
+
triggeredViaKeyboard
|
|
36
|
+
]);
|
|
37
|
+
// We keep track of the previous overflow count to help determine the element to move focus to when expanding the references via keyboard.
|
|
38
|
+
const previousOverflow = React.useRef(0);
|
|
39
|
+
// When the references are expanded or collapsed via keyboard, we need to move focus to the appropriate element.
|
|
40
|
+
React.useEffect(()=>{
|
|
41
|
+
// We only try to move focus if maxVisibleReferences is set and the overflow button was triggered via keyboard.
|
|
42
|
+
if (maxVisibleReferences !== undefined && triggeredViaKeyboard.current) {
|
|
43
|
+
let elementToFocus;
|
|
44
|
+
// If the references are collapsed, we move focus to the overflow button.
|
|
45
|
+
if (!areReferencesExpanded) {
|
|
46
|
+
elementToFocus = rootRef.current;
|
|
47
|
+
previousOverflow.current = overflowCount;
|
|
48
|
+
} else if (rootRef.current && referenceListRef.current) {
|
|
49
|
+
const positionToFocus = maxVisibleReferences < totalReferencesCount - previousOverflow.current ? maxVisibleReferences : totalReferencesCount - previousOverflow.current;
|
|
50
|
+
let currentElement = findFirstFocusable(referenceListRef.current);
|
|
51
|
+
for(let i = 0; i < positionToFocus && currentElement; i++){
|
|
52
|
+
currentElement = findNextFocusable(currentElement);
|
|
53
|
+
}
|
|
54
|
+
elementToFocus = currentElement;
|
|
55
|
+
}
|
|
56
|
+
// 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.
|
|
57
|
+
setTimeout(()=>{
|
|
58
|
+
elementToFocus === null || elementToFocus === void 0 ? void 0 : elementToFocus.focus();
|
|
59
|
+
triggeredViaKeyboard.current = false;
|
|
60
|
+
}, 0);
|
|
61
|
+
}
|
|
62
|
+
}, [
|
|
63
|
+
areReferencesExpanded,
|
|
64
|
+
findFirstFocusable,
|
|
65
|
+
findNextFocusable,
|
|
66
|
+
isOverflowing,
|
|
67
|
+
maxVisibleReferences,
|
|
68
|
+
overflowCount,
|
|
69
|
+
referenceListRef,
|
|
70
|
+
setTimeout,
|
|
71
|
+
totalReferencesCount,
|
|
72
|
+
triggeredViaKeyboard
|
|
73
|
+
]);
|
|
74
|
+
const state = {
|
|
75
|
+
designVersion,
|
|
76
|
+
id: referenceOverflowButtonId,
|
|
77
|
+
shouldRenderOverflowButton: isOverflowing || areReferencesExpanded,
|
|
78
|
+
components: {
|
|
79
|
+
root: 'button'
|
|
80
|
+
},
|
|
81
|
+
root: slot.always(getIntrinsicElementProps('button', {
|
|
82
|
+
ref: useMergedRefs(rootRef, ref),
|
|
83
|
+
...props
|
|
84
|
+
}), {
|
|
85
|
+
defaultProps: {
|
|
86
|
+
children: processedText
|
|
87
|
+
},
|
|
88
|
+
elementType: 'button'
|
|
89
|
+
})
|
|
90
|
+
};
|
|
91
|
+
state.root.onKeyDown = mergeCallbacks(onKeyDown, props.onKeyDown);
|
|
92
|
+
return state;
|
|
92
93
|
};
|
|
93
|
-
//# sourceMappingURL=useReferenceOverflowButton.js.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';
|
|
2
|
+
import { tokens } from '@fluentui-copilot/tokens';
|
|
3
|
+
export const referenceOverflowButtonClassNames = {
|
|
4
|
+
root: 'fai-ReferenceOverflowButton'
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Styles for the root slot
|
|
8
|
+
*/ const useRootBaseClassName = makeResetStyles({
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
backgroundColor: tokens.colorNeutralBackground3,
|
|
11
|
+
border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,
|
|
12
|
+
borderRadius: tokens.borderRadiusMedium,
|
|
13
|
+
color: tokens.colorNeutralForeground2,
|
|
14
|
+
cursor: 'pointer',
|
|
15
|
+
display: 'inline-flex',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
minHeight: '24px',
|
|
18
|
+
padding: `${tokens.spacingVerticalXXS} ${tokens.spacingHorizontalS}`,
|
|
19
|
+
...typographyStyles.caption1,
|
|
20
|
+
':hover': {
|
|
21
|
+
backgroundColor: tokens.colorNeutralBackground3Hover,
|
|
22
|
+
borderColor: tokens.colorNeutralStroke1Hover,
|
|
23
|
+
color: tokens.colorNeutralForeground2Hover
|
|
24
|
+
},
|
|
25
|
+
':hover:active': {
|
|
26
|
+
backgroundColor: tokens.colorNeutralBackground3Pressed,
|
|
27
|
+
borderColor: tokens.colorNeutralStroke1Pressed,
|
|
28
|
+
color: tokens.colorNeutralForeground2Pressed
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const useNextStyles = makeStyles({
|
|
32
|
+
root: {
|
|
33
|
+
borderRadius: tokens.borderRadiusXLarge
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Apply styling to the ReferenceOverflowButton slots based on the state
|
|
38
|
+
*/ export const useReferenceOverflowButtonStyles_unstable = (state)=>{
|
|
39
|
+
'use no memo';
|
|
40
|
+
const { designVersion } = state;
|
|
41
|
+
const rootBaseClassName = useRootBaseClassName();
|
|
42
|
+
const nextStyles = useNextStyles();
|
|
43
|
+
state.root.className = mergeClasses(referenceOverflowButtonClassNames.root, rootBaseClassName, designVersion === 'next' && nextStyles.root, state.root.className);
|
|
44
|
+
return state;
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useReferenceOverflowButtonStyles.styles.ts"],"sourcesContent":["import { makeResetStyles, makeStyles, mergeClasses, typographyStyles } from '@fluentui/react-components';\nimport { tokens } 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":["makeResetStyles","makeStyles","mergeClasses","typographyStyles","tokens","referenceOverflowButtonClassNames","root","useRootBaseClassName","alignItems","backgroundColor","colorNeutralBackground3","border","strokeWidthThin","colorNeutralStroke2","borderRadius","borderRadiusMedium","color","colorNeutralForeground2","cursor","display","justifyContent","minHeight","padding","spacingVerticalXXS","spacingHorizontalS","caption1","colorNeutralBackground3Hover","borderColor","colorNeutralStroke1Hover","colorNeutralForeground2Hover","colorNeutralBackground3Pressed","colorNeutralStroke1Pressed","colorNeutralForeground2Pressed","useNextStyles","borderRadiusXLarge","useReferenceOverflowButtonStyles_unstable","state","designVersion","rootBaseClassName","nextStyles","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,eAAe,EAAEC,UAAU,EAAEC,YAAY,EAAEC,gBAAgB,QAAQ,6BAA6B;AACzG,SAASC,MAAM,QAAQ,2BAA2B;AAIlD,OAAO,MAAMC,oCAAkF;IAC7FC,MAAM;AACR,EAAE;AAEF;;CAEC,GACD,MAAMC,uBAAuBP,gBAAgB;IAC3CQ,YAAY;IACZC,iBAAiBL,OAAOM,uBAAuB;IAC/CC,QAAQ,CAAC,EAAEP,OAAOQ,eAAe,CAAC,OAAO,EAAER,OAAOS,mBAAmB,CAAC,CAAC;IACvEC,cAAcV,OAAOW,kBAAkB;IACvCC,OAAOZ,OAAOa,uBAAuB;IACrCC,QAAQ;IACRC,SAAS;IACTC,gBAAgB;IAChBC,WAAW;IACXC,SAAS,CAAC,EAAElB,OAAOmB,kBAAkB,CAAC,CAAC,EAAEnB,OAAOoB,kBAAkB,CAAC,CAAC;IACpE,GAAGrB,iBAAiBsB,QAAQ;IAE5B,UAAU;QACRhB,iBAAiBL,OAAOsB,4BAA4B;QACpDC,aAAavB,OAAOwB,wBAAwB;QAC5CZ,OAAOZ,OAAOyB,4BAA4B;IAC5C;IAEA,iBAAiB;QACfpB,iBAAiBL,OAAO0B,8BAA8B;QACtDH,aAAavB,OAAO2B,0BAA0B;QAC9Cf,OAAOZ,OAAO4B,8BAA8B;IAC9C;AACF;AAEA,MAAMC,gBAAgBhC,WAAW;IAAEK,MAAM;QAAEQ,cAAcV,OAAO8B,kBAAkB;IAAC;AAAE;AAErF;;CAEC,GACD,OAAO,MAAMC,4CAA4C,CACvDC;IAEA;IAEA,MAAM,EAAEC,aAAa,EAAE,GAAGD;IAE1B,MAAME,oBAAoB/B;IAC1B,MAAMgC,aAAaN;IAEnBG,MAAM9B,IAAI,CAACkC,SAAS,GAAGtC,aACrBG,kCAAkCC,IAAI,EACtCgC,mBACAD,kBAAkB,UAAUE,WAAWjC,IAAI,EAC3C8B,MAAM9B,IAAI,CAACkC,SAAS;IAGtB,OAAOJ;AACT,EAAE"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { Reference, referenceClassNames, referenceExtraClassNames, renderReference_unstable, useReferenceStyles_unstable, useReference_unstable } from './Reference';
|
|
2
2
|
export { ReferenceList, referenceListClassNames, renderReferenceList_unstable, useReferenceListStyles_unstable, useReferenceList_unstable } from './ReferenceList';
|
|
3
3
|
export { ReferenceOverflowButton, referenceOverflowButtonClassNames, renderReferenceOverflowButton_unstable, useReferenceOverflowButtonStyles_unstable, useReferenceOverflowButton_unstable } from './ReferenceOverflowButton';
|
|
4
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
3
|
-
const noop = ()
|
|
3
|
+
const noop = ()=>{};
|
|
4
4
|
const ReferenceGroupContext = React.createContext(undefined);
|
|
5
5
|
export const ReferenceGroupProvider = ReferenceGroupContext.Provider;
|
|
6
|
-
export const useReferenceGroupSetOpen = ()
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
export const useReferenceGroupSetOpen = ()=>{
|
|
7
|
+
const context = React.useContext(ReferenceGroupContext);
|
|
8
|
+
var _context_setOpen;
|
|
9
|
+
return (_context_setOpen = context === null || context === void 0 ? void 0 : context.setOpen) !== null && _context_setOpen !== void 0 ? _context_setOpen : noop;
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=ReferenceGroupContext.js.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { createContext, useContextSelector } from '@fluentui/react-context-selector';
|
|
2
2
|
export const ReferenceListContext = createContext(undefined);
|
|
3
3
|
const referenceListContextDefaultValue = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
areReferencesExpanded: false,
|
|
5
|
+
maxVisibleReferences: undefined,
|
|
6
|
+
overflowButtonTriggeredViaKeyboard: {
|
|
7
|
+
current: false
|
|
8
|
+
},
|
|
9
|
+
referenceListRef: {
|
|
10
|
+
current: null
|
|
11
|
+
},
|
|
12
|
+
shouldUseOverflow: false,
|
|
13
|
+
totalReferencesCount: 0
|
|
14
14
|
};
|
|
15
15
|
export const ReferenceListContextProvider = ReferenceListContext.Provider;
|
|
16
|
-
export const useReferenceListContext_unstable = selector
|
|
17
|
-
//# sourceMappingURL=referenceListContext.js.map
|
|
16
|
+
export const useReferenceListContext_unstable = (selector)=>useContextSelector(ReferenceListContext, (ctx = referenceListContextDefaultValue)=>selector(ctx));
|
package/lib/index.js
CHANGED
|
@@ -8,4 +8,3 @@ export { ReferenceList as ReferenceListV2, referenceListClassNames as referenceL
|
|
|
8
8
|
export { ReferenceOverflowButton, referenceOverflowButtonClassNames, renderReferenceOverflowButton_unstable, useReferenceOverflowButtonStyles_unstable, useReferenceOverflowButton_unstable } from './ReferenceOverflowButton';
|
|
9
9
|
export { ReferenceListContext, ReferenceListContextProvider, useReferenceListContext_unstable } from './contexts/reference-v2';
|
|
10
10
|
export { generateReferenceCitationPreview, useReferenceCitationPreview as useReferenceCitationPreviewV2 } from './utilities/reference-v2';
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
package/lib/utilities/index.js
CHANGED