@fluentui-copilot/react-reference 0.9.1 → 0.11.0
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 +36 -0
- package/CHANGELOG.md +20 -1
- package/dist/index.d.ts +42 -193
- package/lib/components/Citation/Citation.types.js.map +1 -1
- package/lib/components/Citation/renderCitation.js +3 -22
- package/lib/components/Citation/renderCitation.js.map +1 -1
- package/lib/components/Citation/useCitation.js +6 -160
- package/lib/components/Citation/useCitation.js.map +1 -1
- package/lib/components/Citation/useCitationStyles.js +1 -6
- package/lib/components/Citation/useCitationStyles.js.map +1 -1
- package/lib/components/Reference/Reference.types.js.map +1 -1
- package/lib/components/Reference/renderReference.js +1 -1
- package/lib/components/Reference/renderReference.js.map +1 -1
- package/lib/components/Reference/useReference.js +2 -7
- package/lib/components/Reference/useReference.js.map +1 -1
- package/lib/components/Reference/useReferenceStyles.js +1 -38
- package/lib/components/Reference/useReferenceStyles.js.map +1 -1
- package/lib/components/ReferenceList/useReferenceList.js +2 -2
- package/lib/components/ReferenceList/useReferenceList.js.map +1 -1
- package/lib/hooks/index.js +1 -2
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useReferenceCitationPreview.js +11 -12
- package/lib/hooks/useReferenceCitationPreview.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/components/Citation/renderCitation.js +1 -23
- package/lib-commonjs/components/Citation/renderCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitation.js +6 -158
- package/lib-commonjs/components/Citation/useCitation.js.map +1 -1
- package/lib-commonjs/components/Citation/useCitationStyles.js +1 -6
- package/lib-commonjs/components/Citation/useCitationStyles.js.map +1 -1
- package/lib-commonjs/components/Reference/renderReference.js +0 -1
- package/lib-commonjs/components/Reference/renderReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReference.js +1 -6
- package/lib-commonjs/components/Reference/useReference.js.map +1 -1
- package/lib-commonjs/components/Reference/useReferenceStyles.js +4 -98
- package/lib-commonjs/components/Reference/useReferenceStyles.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/hooks/index.js +1 -8
- package/lib-commonjs/hooks/index.js.map +1 -1
- package/lib-commonjs/hooks/useReferenceCitationPreview.js +10 -10
- package/lib-commonjs/hooks/useReferenceCitationPreview.js.map +1 -1
- package/lib-commonjs/index.js +0 -19
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +3 -3
- package/lib/ReferenceGroup.js +0 -2
- package/lib/ReferenceGroup.js.map +0 -1
- package/lib/components/ReferenceGroup/ReferenceGroup.js +0 -19
- package/lib/components/ReferenceGroup/ReferenceGroup.js.map +0 -1
- package/lib/components/ReferenceGroup/ReferenceGroup.types.js +0 -2
- package/lib/components/ReferenceGroup/ReferenceGroup.types.js.map +0 -1
- package/lib/components/ReferenceGroup/index.js +0 -6
- package/lib/components/ReferenceGroup/index.js.map +0 -1
- package/lib/components/ReferenceGroup/renderReferenceGroup.js +0 -21
- package/lib/components/ReferenceGroup/renderReferenceGroup.js.map +0 -1
- package/lib/components/ReferenceGroup/useReferenceGroup.js +0 -104
- package/lib/components/ReferenceGroup/useReferenceGroup.js.map +0 -1
- package/lib/components/ReferenceGroup/useReferenceGroupContextValues.js +0 -10
- package/lib/components/ReferenceGroup/useReferenceGroupContextValues.js.map +0 -1
- package/lib/components/ReferenceGroup/useReferenceGroupStyles.js +0 -50
- package/lib/components/ReferenceGroup/useReferenceGroupStyles.js.map +0 -1
- package/lib/hooks/useReferenceCitation.js +0 -77
- package/lib/hooks/useReferenceCitation.js.map +0 -1
- package/lib-commonjs/ReferenceGroup.js +0 -7
- package/lib-commonjs/ReferenceGroup.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/ReferenceGroup.js +0 -25
- package/lib-commonjs/components/ReferenceGroup/ReferenceGroup.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/ReferenceGroup.types.js +0 -5
- package/lib-commonjs/components/ReferenceGroup/ReferenceGroup.types.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/index.js +0 -11
- package/lib-commonjs/components/ReferenceGroup/index.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/renderReferenceGroup.js +0 -33
- package/lib-commonjs/components/ReferenceGroup/renderReferenceGroup.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/useReferenceGroup.js +0 -103
- package/lib-commonjs/components/ReferenceGroup/useReferenceGroup.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/useReferenceGroupContextValues.js +0 -23
- package/lib-commonjs/components/ReferenceGroup/useReferenceGroupContextValues.js.map +0 -1
- package/lib-commonjs/components/ReferenceGroup/useReferenceGroupStyles.js +0 -75
- package/lib-commonjs/components/ReferenceGroup/useReferenceGroupStyles.js.map +0 -1
- package/lib-commonjs/hooks/useReferenceCitation.js +0 -78
- package/lib-commonjs/hooks/useReferenceCitation.js.map +0 -1
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getNativeElementProps, PopoverSurface, mergeCallbacks, slot, useFluent, useId, useIsomorphicLayoutEffect } from '@fluentui/react-components';
|
|
3
|
-
import { Enter, Escape } from '@fluentui/keyboard-keys';
|
|
4
|
-
import { useTimeout } from '@fluentui/react-utilities';
|
|
1
|
+
import { getIntrinsicElementProps, slot } from '@fluentui/react-components';
|
|
5
2
|
import { usePreviewContext_unstable } from '@fluentui-copilot/react-preview';
|
|
6
|
-
const POPOVER_MOUSE_HIDE_DELAY = 500;
|
|
7
|
-
const POPOVER_KEYBOARD_HIDE_DELAY = 0;
|
|
8
|
-
const getDelay = type => {
|
|
9
|
-
if (type === 'focus' || type === 'blur') {
|
|
10
|
-
return POPOVER_KEYBOARD_HIDE_DELAY;
|
|
11
|
-
}
|
|
12
|
-
return POPOVER_MOUSE_HIDE_DELAY;
|
|
13
|
-
};
|
|
14
3
|
/**
|
|
15
4
|
* Create the state required to render Citation.
|
|
16
5
|
*
|
|
@@ -22,170 +11,27 @@ const getDelay = type => {
|
|
|
22
11
|
*/
|
|
23
12
|
export const useCitation_unstable = (props, ref) => {
|
|
24
13
|
const {
|
|
25
|
-
popover,
|
|
26
|
-
popoverSurface,
|
|
27
14
|
referenceHref,
|
|
28
15
|
block = false,
|
|
29
16
|
...otherProps
|
|
30
17
|
} = props;
|
|
31
|
-
const
|
|
32
|
-
targetDocument
|
|
33
|
-
} = useFluent();
|
|
34
|
-
const [setTimeout, clearTimeout] = useTimeout();
|
|
35
|
-
const popoverId = useId('citation-popover-');
|
|
36
|
-
const [disableAutoFocus, setDisableAutoFocus] = React.useState(true);
|
|
37
|
-
const {
|
|
38
|
-
current: citationInternalState
|
|
39
|
-
} = React.useRef({
|
|
40
|
-
openByClick: false,
|
|
41
|
-
openByHoverOverCitation: false,
|
|
42
|
-
openByHoverOverPopover: false,
|
|
43
|
-
openByKeyboard: false
|
|
44
|
-
});
|
|
45
|
-
const isOpen = () => {
|
|
46
|
-
return citationInternalState.openByClick || citationInternalState.openByHoverOverCitation || citationInternalState.openByHoverOverPopover || citationInternalState.openByKeyboard;
|
|
47
|
-
};
|
|
48
|
-
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
|
|
49
|
-
const preventDefaultClose = React.useRef(false);
|
|
50
|
-
const handleCitationTargetEnter = e => {
|
|
51
|
-
citationInternalState.openByHoverOverCitation = true;
|
|
52
|
-
// We want to disable auto focus only if the popover is being opened by hovering over the citation
|
|
53
|
-
if (!citationInternalState.openByClick && !citationInternalState.openByKeyboard) {
|
|
54
|
-
setDisableAutoFocus(true);
|
|
55
|
-
}
|
|
56
|
-
setIsPopoverOpen(isOpen());
|
|
57
|
-
};
|
|
58
|
-
const handleCitationTargetLeave = e => {
|
|
59
|
-
citationInternalState.openByHoverOverCitation = false;
|
|
60
|
-
setTimeout(() => {
|
|
61
|
-
setIsPopoverOpen(isOpen());
|
|
62
|
-
}, getDelay(e.type));
|
|
63
|
-
};
|
|
64
|
-
const handleCitationClick = e => {
|
|
65
|
-
// Setting preventDefaultClose so that onPopoverOpenChange does not apply its logic when click is on the citation as we want to control that behavior.
|
|
66
|
-
preventDefaultClose.current = true;
|
|
67
|
-
// We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via click.
|
|
68
|
-
setDisableAutoFocus(false);
|
|
69
|
-
// If openByKeyboard is true, then the popover was already opened via keyboard and we always want to close it.
|
|
70
|
-
citationInternalState.openByClick = citationInternalState.openByKeyboard ? false : !citationInternalState.openByClick;
|
|
71
|
-
citationInternalState.openByHoverOverCitation = false;
|
|
72
|
-
citationInternalState.openByHoverOverPopover = false;
|
|
73
|
-
citationInternalState.openByKeyboard = false;
|
|
74
|
-
setIsPopoverOpen(isOpen());
|
|
75
|
-
};
|
|
76
|
-
const handleCitationKeyDown = e => {
|
|
77
|
-
if (e.key === Enter) {
|
|
78
|
-
clearTimeout();
|
|
79
|
-
// Setting default prevented so the enter key does not trigger a click event or onPopoverOpenChange.
|
|
80
|
-
e.preventDefault();
|
|
81
|
-
// We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via keyboard.
|
|
82
|
-
setDisableAutoFocus(false);
|
|
83
|
-
// If openByClick is true, then the popover was already opened via click and we always want to close it.
|
|
84
|
-
citationInternalState.openByKeyboard = citationInternalState.openByClick ? false : !citationInternalState.openByKeyboard;
|
|
85
|
-
citationInternalState.openByClick = false;
|
|
86
|
-
citationInternalState.openByHoverOverCitation = false;
|
|
87
|
-
citationInternalState.openByHoverOverPopover = false;
|
|
88
|
-
setIsPopoverOpen(isOpen());
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
const handlePopoverTargetEnter = e => {
|
|
92
|
-
citationInternalState.openByHoverOverPopover = true;
|
|
93
|
-
setIsPopoverOpen(isOpen());
|
|
94
|
-
};
|
|
95
|
-
const handlePopoverTargetLeave = e => {
|
|
96
|
-
citationInternalState.openByHoverOverPopover = false;
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
setIsPopoverOpen(isOpen());
|
|
99
|
-
}, getDelay(e.type));
|
|
100
|
-
};
|
|
101
|
-
const onPopoverOpenChange = (e, data) => {
|
|
102
|
-
if (!data.open) {
|
|
103
|
-
// We set all open state to false if preventDefaultClose was not set to true
|
|
104
|
-
if (!preventDefaultClose.current) {
|
|
105
|
-
clearTimeout();
|
|
106
|
-
citationInternalState.openByClick = false;
|
|
107
|
-
citationInternalState.openByHoverOverCitation = false;
|
|
108
|
-
citationInternalState.openByHoverOverPopover = false;
|
|
109
|
-
citationInternalState.openByKeyboard = false;
|
|
110
|
-
// use isOpen if managing owned popover, otherwise use data.open
|
|
111
|
-
const open = popover ? isOpen() : data.open;
|
|
112
|
-
setIsPopoverOpen(open);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
preventDefaultClose.current = false;
|
|
116
|
-
};
|
|
117
|
-
// hitting escape should close the popover if it was opened by hover
|
|
118
|
-
// this is necessary to attach to the document because focus is likely not within the citation or popover
|
|
119
|
-
useIsomorphicLayoutEffect(() => {
|
|
120
|
-
if (isPopoverOpen) {
|
|
121
|
-
const onDocumentKeyDown = e => {
|
|
122
|
-
const openedByHover = !citationInternalState.openByClick && !citationInternalState.openByKeyboard;
|
|
123
|
-
if (openedByHover && e.key === Escape) {
|
|
124
|
-
clearTimeout();
|
|
125
|
-
// We set state back to its default if the Escape key has been pressed
|
|
126
|
-
setDisableAutoFocus(true);
|
|
127
|
-
citationInternalState.openByClick = false;
|
|
128
|
-
citationInternalState.openByHoverOverCitation = false;
|
|
129
|
-
citationInternalState.openByHoverOverPopover = false;
|
|
130
|
-
citationInternalState.openByKeyboard = false;
|
|
131
|
-
setIsPopoverOpen(isOpen());
|
|
132
|
-
e.stopPropagation();
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.addEventListener('keydown', onDocumentKeyDown, {
|
|
136
|
-
capture: true
|
|
137
|
-
});
|
|
138
|
-
return () => {
|
|
139
|
-
targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.removeEventListener('keydown', onDocumentKeyDown, {
|
|
140
|
-
capture: true
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}, [targetDocument, isPopoverOpen]);
|
|
145
|
-
const isPopoverLocked = usePreviewContext_unstable(ctx => ctx.isPreviewLocked) && props['aria-expanded'] || citationInternalState.openByClick || citationInternalState.openByKeyboard;
|
|
18
|
+
const isPopoverLocked = usePreviewContext_unstable(ctx => ctx.isPreviewLocked) && props['aria-expanded'];
|
|
146
19
|
const state = {
|
|
147
20
|
block,
|
|
148
|
-
disableAutoFocus,
|
|
149
|
-
isPopoverOpen,
|
|
150
21
|
isPopoverLocked,
|
|
151
|
-
onPopoverOpenChange,
|
|
152
22
|
components: {
|
|
153
|
-
root: 'a'
|
|
154
|
-
popover: 'div',
|
|
155
|
-
popoverSurface: PopoverSurface
|
|
23
|
+
root: 'a'
|
|
156
24
|
},
|
|
157
|
-
root: slot.always(
|
|
25
|
+
root: slot.always(getIntrinsicElementProps('a', {
|
|
158
26
|
ref,
|
|
159
27
|
href: referenceHref,
|
|
160
|
-
role:
|
|
161
|
-
'aria-expanded':
|
|
28
|
+
role: undefined,
|
|
29
|
+
'aria-expanded': undefined,
|
|
162
30
|
...otherProps
|
|
163
31
|
}), {
|
|
164
32
|
elementType: 'a'
|
|
165
|
-
}),
|
|
166
|
-
popover: slot.optional(popover, {
|
|
167
|
-
elementType: 'div'
|
|
168
|
-
}),
|
|
169
|
-
popoverSurface: slot.optional(popoverSurface, {
|
|
170
|
-
defaultProps: {
|
|
171
|
-
id: popoverId,
|
|
172
|
-
'aria-labelledby': popoverId
|
|
173
|
-
},
|
|
174
|
-
elementType: PopoverSurface,
|
|
175
|
-
renderByDefault: true
|
|
176
33
|
})
|
|
177
34
|
};
|
|
178
|
-
// attach popover handling events only if a popover is present
|
|
179
|
-
if (state.popover) {
|
|
180
|
-
state.root.onMouseEnter = mergeCallbacks(state.root.onMouseEnter, handleCitationTargetEnter);
|
|
181
|
-
state.root.onMouseLeave = mergeCallbacks(state.root.onMouseLeave, handleCitationTargetLeave);
|
|
182
|
-
state.root.onBlur = mergeCallbacks(state.root.onBlur, handleCitationTargetLeave);
|
|
183
|
-
state.root.onClick = mergeCallbacks(state.root.onClick, handleCitationClick);
|
|
184
|
-
state.root.onKeyDown = mergeCallbacks(state.root.onKeyDown, handleCitationKeyDown);
|
|
185
|
-
state.popover.onMouseEnter = mergeCallbacks(state.popover.onMouseEnter, handlePopoverTargetEnter);
|
|
186
|
-
state.popover.onMouseLeave = mergeCallbacks(state.popover.onMouseLeave, handlePopoverTargetLeave);
|
|
187
|
-
state.popover.onFocus = mergeCallbacks(state.popover.onFocus, handlePopoverTargetEnter);
|
|
188
|
-
}
|
|
189
35
|
return state;
|
|
190
36
|
};
|
|
191
37
|
//# sourceMappingURL=useCitation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCitation.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getNativeElementProps,\n PopoverSurface,\n mergeCallbacks,\n slot,\n useFluent,\n useId,\n useIsomorphicLayoutEffect,\n} from '@fluentui/react-components';\nimport { Enter, Escape } from '@fluentui/keyboard-keys';\nimport { useTimeout } from '@fluentui/react-utilities';\nimport type { OnOpenChangeData, OpenPopoverEvents } from '@fluentui/react-components';\nimport type { CitationProps, CitationState } from './Citation.types';\nimport { usePreviewContext_unstable } from '@fluentui-copilot/react-preview';\n\ntype CitationInternalState = {\n openByClick: boolean;\n openByHoverOverCitation: boolean;\n openByHoverOverPopover: boolean;\n openByKeyboard: boolean;\n};\n\nconst POPOVER_MOUSE_HIDE_DELAY = 500;\nconst POPOVER_KEYBOARD_HIDE_DELAY = 0;\n\nconst getDelay = (type: string): number => {\n if (type === 'focus' || type === 'blur') {\n return POPOVER_KEYBOARD_HIDE_DELAY;\n }\n\n return POPOVER_MOUSE_HIDE_DELAY;\n};\n\ntype TargetEvent<T> = React.MouseEvent<T> | React.FocusEvent<T>;\n\n/**\n * Create the state required to render Citation.\n *\n * The returned state can be modified with hooks such as useCitationStyles_unstable,\n * before being passed to renderCitation_unstable.\n *\n * @param props - props from this instance of Citation\n * @param ref - reference to root HTMLElement of Citation\n */\nexport const useCitation_unstable = (props: CitationProps, ref: React.Ref<HTMLElement>): CitationState => {\n const { popover, popoverSurface, referenceHref, block = false, ...otherProps } = props;\n\n const { targetDocument } = useFluent();\n const [setTimeout, clearTimeout] = useTimeout();\n const popoverId = useId('citation-popover-');\n\n const [disableAutoFocus, setDisableAutoFocus] = React.useState(true);\n\n const { current: citationInternalState } = React.useRef<CitationInternalState>({\n openByClick: false,\n openByHoverOverCitation: false,\n openByHoverOverPopover: false,\n openByKeyboard: false,\n });\n\n const isOpen = () => {\n return (\n citationInternalState.openByClick ||\n citationInternalState.openByHoverOverCitation ||\n citationInternalState.openByHoverOverPopover ||\n citationInternalState.openByKeyboard\n );\n };\n\n const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);\n const preventDefaultClose = React.useRef(false);\n\n const handleCitationTargetEnter = (e: TargetEvent<HTMLSpanElement>): void => {\n citationInternalState.openByHoverOverCitation = true;\n\n // We want to disable auto focus only if the popover is being opened by hovering over the citation\n if (!citationInternalState.openByClick && !citationInternalState.openByKeyboard) {\n setDisableAutoFocus(true);\n }\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleCitationTargetLeave = (e: TargetEvent<HTMLSpanElement>): void => {\n citationInternalState.openByHoverOverCitation = false;\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n }, getDelay(e.type));\n };\n\n const handleCitationClick = (e: TargetEvent<HTMLSpanElement>): void => {\n // Setting preventDefaultClose so that onPopoverOpenChange does not apply its logic when click is on the citation as we want to control that behavior.\n preventDefaultClose.current = true;\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via click.\n setDisableAutoFocus(false);\n\n // If openByKeyboard is true, then the popover was already opened via keyboard and we always want to close it.\n citationInternalState.openByClick = citationInternalState.openByKeyboard\n ? false\n : !citationInternalState.openByClick;\n citationInternalState.openByHoverOverCitation = false;\n citationInternalState.openByHoverOverPopover = false;\n citationInternalState.openByKeyboard = false;\n\n setIsPopoverOpen(isOpen());\n };\n\n const handleCitationKeyDown = (e: React.KeyboardEvent<HTMLSpanElement>): void => {\n if (e.key === Enter) {\n clearTimeout();\n\n // Setting default prevented so the enter key does not trigger a click event or onPopoverOpenChange.\n e.preventDefault();\n\n // We set disableAutoFocus to false so that interactive elements within popover can be focused when it opens via keyboard.\n setDisableAutoFocus(false);\n\n // If openByClick is true, then the popover was already opened via click and we always want to close it.\n citationInternalState.openByKeyboard = citationInternalState.openByClick\n ? false\n : !citationInternalState.openByKeyboard;\n citationInternalState.openByClick = false;\n citationInternalState.openByHoverOverCitation = false;\n citationInternalState.openByHoverOverPopover = false;\n\n setIsPopoverOpen(isOpen());\n }\n };\n\n const handlePopoverTargetEnter = (e: TargetEvent<HTMLDivElement>): void => {\n citationInternalState.openByHoverOverPopover = true;\n setIsPopoverOpen(isOpen());\n };\n\n const handlePopoverTargetLeave = (e: TargetEvent<HTMLDivElement>): void => {\n citationInternalState.openByHoverOverPopover = false;\n setTimeout(() => {\n setIsPopoverOpen(isOpen());\n }, getDelay(e.type));\n };\n\n const onPopoverOpenChange = (e: OpenPopoverEvents, data: OnOpenChangeData): void => {\n if (!data.open) {\n // We set all open state to false if preventDefaultClose was not set to true\n if (!preventDefaultClose.current) {\n clearTimeout();\n citationInternalState.openByClick = false;\n citationInternalState.openByHoverOverCitation = false;\n citationInternalState.openByHoverOverPopover = false;\n citationInternalState.openByKeyboard = false;\n\n // use isOpen if managing owned popover, otherwise use data.open\n const open = popover ? isOpen() : data.open;\n setIsPopoverOpen(open);\n }\n }\n\n preventDefaultClose.current = false;\n };\n\n // hitting escape should close the popover if it was opened by hover\n // this is necessary to attach to the document because focus is likely not within the citation or popover\n useIsomorphicLayoutEffect(() => {\n if (isPopoverOpen) {\n const onDocumentKeyDown = (e: KeyboardEvent) => {\n const openedByHover = !citationInternalState.openByClick && !citationInternalState.openByKeyboard;\n if (openedByHover && e.key === Escape) {\n clearTimeout();\n\n // We set state back to its default if the Escape key has been pressed\n setDisableAutoFocus(true);\n citationInternalState.openByClick = false;\n citationInternalState.openByHoverOverCitation = false;\n citationInternalState.openByHoverOverPopover = false;\n citationInternalState.openByKeyboard = false;\n\n setIsPopoverOpen(isOpen());\n\n e.stopPropagation();\n }\n };\n\n targetDocument?.addEventListener('keydown', onDocumentKeyDown, { capture: true });\n\n return () => {\n targetDocument?.removeEventListener('keydown', onDocumentKeyDown, { capture: true });\n };\n }\n }, [targetDocument, isPopoverOpen]);\n\n const isPopoverLocked =\n (usePreviewContext_unstable(ctx => ctx.isPreviewLocked) && (props['aria-expanded'] as boolean)) ||\n citationInternalState.openByClick ||\n citationInternalState.openByKeyboard;\n\n const state: CitationState = {\n block,\n disableAutoFocus,\n isPopoverOpen,\n isPopoverLocked,\n onPopoverOpenChange,\n components: {\n root: 'a',\n popover: 'div',\n popoverSurface: PopoverSurface,\n },\n root: slot.always(\n getNativeElementProps('a', {\n ref,\n href: referenceHref,\n role: null,\n 'aria-expanded': null,\n ...otherProps,\n }),\n { elementType: 'a' },\n ),\n popover: slot.optional(popover, { elementType: 'div' }),\n popoverSurface: slot.optional(popoverSurface, {\n defaultProps: {\n id: popoverId,\n 'aria-labelledby': popoverId,\n },\n elementType: PopoverSurface,\n renderByDefault: true,\n }),\n };\n\n // attach popover handling events only if a popover is present\n\n if (state.popover) {\n state.root.onMouseEnter = mergeCallbacks(state.root.onMouseEnter, handleCitationTargetEnter);\n state.root.onMouseLeave = mergeCallbacks(state.root.onMouseLeave, handleCitationTargetLeave);\n state.root.onBlur = mergeCallbacks(state.root.onBlur, handleCitationTargetLeave);\n state.root.onClick = mergeCallbacks(state.root.onClick, handleCitationClick);\n state.root.onKeyDown = mergeCallbacks(state.root.onKeyDown, handleCitationKeyDown);\n state.popover.onMouseEnter = mergeCallbacks(state.popover.onMouseEnter, handlePopoverTargetEnter);\n state.popover.onMouseLeave = mergeCallbacks(state.popover.onMouseLeave, handlePopoverTargetLeave);\n state.popover.onFocus = mergeCallbacks(state.popover.onFocus, handlePopoverTargetEnter);\n }\n\n return state;\n};\n"],"names":["React","getNativeElementProps","PopoverSurface","mergeCallbacks","slot","useFluent","useId","useIsomorphicLayoutEffect","Enter","Escape","useTimeout","usePreviewContext_unstable","POPOVER_MOUSE_HIDE_DELAY","POPOVER_KEYBOARD_HIDE_DELAY","getDelay","type","useCitation_unstable","props","ref","popover","popoverSurface","referenceHref","block","otherProps","targetDocument","setTimeout","clearTimeout","popoverId","disableAutoFocus","setDisableAutoFocus","useState","current","citationInternalState","useRef","openByClick","openByHoverOverCitation","openByHoverOverPopover","openByKeyboard","isOpen","isPopoverOpen","setIsPopoverOpen","preventDefaultClose","handleCitationTargetEnter","e","handleCitationTargetLeave","handleCitationClick","handleCitationKeyDown","key","preventDefault","handlePopoverTargetEnter","handlePopoverTargetLeave","onPopoverOpenChange","data","open","onDocumentKeyDown","openedByHover","stopPropagation","addEventListener","capture","removeEventListener","isPopoverLocked","ctx","isPreviewLocked","state","components","root","always","href","role","elementType","optional","defaultProps","id","renderByDefault","onMouseEnter","onMouseLeave","onBlur","onClick","onKeyDown","onFocus"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,qBAAqB,EACrBC,cAAc,EACdC,cAAc,EACdC,IAAI,EACJC,SAAS,EACTC,KAAK,EACLC,yBAAyB,QACpB,6BAA6B;AACpC,SAASC,KAAK,EAAEC,MAAM,QAAQ,0BAA0B;AACxD,SAASC,UAAU,QAAQ,4BAA4B;AAGvD,SAASC,0BAA0B,QAAQ,kCAAkC;AAS7E,MAAMC,2BAA2B;AACjC,MAAMC,8BAA8B;AAEpC,MAAMC,WAAW,CAACC;IAChB,IAAIA,SAAS,WAAWA,SAAS,QAAQ;QACvC,OAAOF;IACT;IAE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jB4C,MAAME,IAAI,CAACS,YAAY,GAAGvE,eAAe4D,MAAME,IAAI,CAACS,YAAY,EAAEhC;QAClEqB,MAAME,IAAI,CAACU,YAAY,GAAGxE,eAAe4D,MAAME,IAAI,CAACU,YAAY,EAAE/B;QAClEmB,MAAME,IAAI,CAACW,MAAM,GAAGzE,eAAe4D,MAAME,IAAI,CAACW,MAAM,EAAEhC;QACtDmB,MAAME,IAAI,CAACY,OAAO,GAAG1E,eAAe4D,MAAME,IAAI,CAACY,OAAO,EAAEhC;QACxDkB,MAAME,IAAI,CAACa,SAAS,GAAG3E,eAAe4D,MAAME,IAAI,CAACa,SAAS,EAAEhC;QAC5DiB,MAAM5C,OAAO,CAACuD,YAAY,GAAGvE,eAAe4D,MAAM5C,OAAO,CAACuD,YAAY,EAAEzB;QACxEc,MAAM5C,OAAO,CAACwD,YAAY,GAAGxE,eAAe4D,MAAM5C,OAAO,CAACwD,YAAY,EAAEzB;QACxEa,MAAM5C,OAAO,CAAC4D,OAAO,GAAG5E,eAAe4D,MAAM5C,OAAO,CAAC4D,OAAO,EAAE9B;IAChE;IAEA,OAAOc;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useCitation.ts"],"sourcesContent":["import { getIntrinsicElementProps, slot } from '@fluentui/react-components';\nimport { usePreviewContext_unstable } from '@fluentui-copilot/react-preview';\nimport type { CitationProps, CitationState } from './Citation.types';\n/**\n * Create the state required to render Citation.\n *\n * The returned state can be modified with hooks such as useCitationStyles_unstable,\n * before being passed to renderCitation_unstable.\n *\n * @param props - props from this instance of Citation\n * @param ref - reference to root HTMLElement of Citation\n */\nexport const useCitation_unstable = (props: CitationProps, ref: React.Ref<HTMLAnchorElement>): CitationState => {\n const { referenceHref, block = false, ...otherProps } = props;\n\n const isPopoverLocked = usePreviewContext_unstable(ctx => ctx.isPreviewLocked) && (props['aria-expanded'] as boolean);\n\n const state: CitationState = {\n block,\n isPopoverLocked,\n components: {\n root: 'a',\n },\n root: slot.always(\n getIntrinsicElementProps('a', {\n ref,\n href: referenceHref,\n role: undefined,\n 'aria-expanded': undefined,\n ...otherProps,\n }),\n { elementType: 'a' },\n ),\n };\n\n return state;\n};\n"],"names":["getIntrinsicElementProps","slot","usePreviewContext_unstable","useCitation_unstable","props","ref","referenceHref","block","otherProps","isPopoverLocked","ctx","isPreviewLocked","state","components","root","always","href","role","undefined","elementType"],"mappings":"AAAA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,6BAA6B;AAC5E,SAASC,0BAA0B,QAAQ,kCAAkC;AAE7E;;;;;;;;CAQC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC;IACzD,MAAM,EAAEC,aAAa,EAAEC,QAAQ,KAAK,EAAE,GAAGC,YAAY,GAAGJ;IAExD,MAAMK,kBAAkBP,2BAA2BQ,CAAAA,MAAOA,IAAIC,eAAe,KAAMP,KAAK,CAAC,gBAAgB;IAEzG,MAAMQ,QAAuB;QAC3BL;QACAE;QACAI,YAAY;YACVC,MAAM;QACR;QACAA,MAAMb,KAAKc,MAAM,CACff,yBAAyB,KAAK;YAC5BK;YACAW,MAAMV;YACNW,MAAMC;YACN,iBAAiBA;YACjB,GAAGV,UAAU;QACf,IACA;YAAEW,aAAa;QAAI;IAEvB;IAEA,OAAOP;AACT,EAAE"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { __resetStyles, __styles, mergeClasses, shorthands, tokens, typographyStyles } from '@fluentui/react-components';
|
|
2
2
|
export const citationClassNames = {
|
|
3
|
-
root: 'fai-Citation'
|
|
4
|
-
popover: 'fai-Citation__popover',
|
|
5
|
-
popoverSurface: 'fai-Citation__popoverSurface'
|
|
3
|
+
root: 'fai-Citation'
|
|
6
4
|
};
|
|
7
5
|
const useCitationBaseClassName = __resetStyles("rad2akz", "r1hx2d32", [".rad2akz{display:inline-flex;justify-content:center;box-sizing:border-box;align-items:center;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightSemibold);line-height:var(--lineHeightBase100);color:var(--colorNeutralForeground2);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);min-width:14px;height:14px;vertical-align:calc((var(--lineHeightBase100) - var(--fontSizeBase100)) / 2);border-radius:var(--borderRadiusMedium);text-decoration:none;margin-left:var(--spacingHorizontalXXS);margin-right:var(--spacingHorizontalXXS);}", ".rad2akz:hover{cursor:pointer;color:var(--colorBrandForeground2Hover);border-color:var(--colorBrandStroke2Hover);background-color:var(--colorBrandBackground2Hover);}", ".rad2akz:hover:active{cursor:pointer;color:var(--colorBrandForeground2Pressed);border-color:var(--colorBrandStroke2Pressed);background-color:var(--colorBrandBackground2Pressed);}", ".r1hx2d32{display:inline-flex;justify-content:center;box-sizing:border-box;align-items:center;font-family:var(--fontFamilyBase);font-size:var(--fontSizeBase100);font-weight:var(--fontWeightSemibold);line-height:var(--lineHeightBase100);color:var(--colorNeutralForeground2);border:var(--strokeWidthThin) solid var(--colorNeutralStroke2);min-width:14px;height:14px;vertical-align:calc((var(--lineHeightBase100) - var(--fontSizeBase100)) / 2);border-radius:var(--borderRadiusMedium);text-decoration:none;margin-right:var(--spacingHorizontalXXS);margin-left:var(--spacingHorizontalXXS);}", ".r1hx2d32:hover{cursor:pointer;color:var(--colorBrandForeground2Hover);border-color:var(--colorBrandStroke2Hover);background-color:var(--colorBrandBackground2Hover);}", ".r1hx2d32:hover:active{cursor:pointer;color:var(--colorBrandForeground2Pressed);border-color:var(--colorBrandStroke2Pressed);background-color:var(--colorBrandBackground2Pressed);}"]);
|
|
8
6
|
const useCitationRootStyles = __styles({
|
|
@@ -36,9 +34,6 @@ export const useCitationStyles_unstable = state => {
|
|
|
36
34
|
const rootBaseClassName = useCitationBaseClassName();
|
|
37
35
|
const rootStyles = useCitationRootStyles();
|
|
38
36
|
state.root.className = mergeClasses(citationClassNames.root, state.isPopoverLocked && rootStyles.isPopoverLocked, state.block && rootStyles.isBlock, rootBaseClassName, state.root.className);
|
|
39
|
-
if (state.popover) {
|
|
40
|
-
state.popover.className = mergeClasses(citationClassNames.popover, state.popover.className);
|
|
41
|
-
}
|
|
42
37
|
return state;
|
|
43
38
|
};
|
|
44
39
|
//# sourceMappingURL=useCitationStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useCitationStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { CitationSlots, CitationState } from './Citation.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const citationClassNames: SlotClassNames<CitationSlots> = {\n root: 'fai-Citation',\n
|
|
1
|
+
{"version":3,"sources":["useCitationStyles.ts"],"sourcesContent":["import {\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { CitationSlots, CitationState } from './Citation.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const citationClassNames: SlotClassNames<CitationSlots> = {\n root: 'fai-Citation',\n};\n\nconst useCitationBaseClassName = makeResetStyles({\n display: 'inline-flex',\n justifyContent: 'center',\n boxSizing: 'border-box',\n alignItems: 'center',\n ...typographyStyles.caption2Strong,\n\n color: tokens.colorNeutralForeground2,\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke2}`,\n\n minWidth: '14px',\n height: '14px',\n verticalAlign: `calc((${typographyStyles.caption2Strong.lineHeight} - ${typographyStyles.caption2Strong.fontSize}) / 2)`,\n\n borderRadius: tokens.borderRadiusMedium,\n\n textDecoration: 'none',\n\n marginLeft: tokens.spacingHorizontalXXS,\n marginRight: tokens.spacingHorizontalXXS,\n\n ':hover': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Hover,\n borderColor: tokens.colorBrandStroke2Hover,\n backgroundColor: tokens.colorBrandBackground2Hover,\n },\n\n ':hover:active': {\n cursor: 'pointer',\n color: tokens.colorBrandForeground2Pressed,\n borderColor: tokens.colorBrandStroke2Pressed,\n backgroundColor: tokens.colorBrandBackground2Pressed,\n },\n});\n\nconst useCitationRootStyles = makeStyles({\n isBlock: {\n display: 'flex',\n marginLeft: 0,\n marginRight: 0,\n },\n isPopoverLocked: {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n ':hover': {\n color: tokens.colorBrandForeground2Pressed,\n ...shorthands.borderColor(tokens.colorBrandStroke2Pressed),\n backgroundColor: tokens.colorBrandBackground2,\n },\n },\n});\n\n/**\n * Apply styling to the Citation slots based on the state\n */\nexport const useCitationStyles_unstable = (state: CitationState): CitationState => {\n const rootBaseClassName = useCitationBaseClassName();\n const rootStyles = useCitationRootStyles();\n\n state.root.className = mergeClasses(\n citationClassNames.root,\n state.isPopoverLocked && rootStyles.isPopoverLocked,\n state.block && rootStyles.isBlock,\n rootBaseClassName,\n state.root.className,\n );\n\n return state;\n};\n"],"names":["makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","citationClassNames","root","useCitationBaseClassName","display","justifyContent","boxSizing","alignItems","caption2Strong","color","colorNeutralForeground2","border","strokeWidthThin","colorNeutralStroke2","minWidth","height","verticalAlign","lineHeight","fontSize","borderRadius","borderRadiusMedium","textDecoration","marginLeft","spacingHorizontalXXS","marginRight","cursor","colorBrandForeground2Hover","borderColor","colorBrandStroke2Hover","backgroundColor","colorBrandBackground2Hover","colorBrandForeground2Pressed","colorBrandStroke2Pressed","colorBrandBackground2Pressed","useCitationRootStyles","isBlock","isPopoverLocked","colorBrandBackground2","useCitationStyles_unstable","state","rootBaseClassName","rootStyles","className","block"],"mappings":"AAAA,SACEA,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,qBAAoD;IAC/DC,MAAM;AACR,EAAE;AAEF,MAAMC,2BAA2BR,gBAAgB;IAC/CS,SAAS;IACTC,gBAAgB;IAChBC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AAG7C,aACrBI,mBAAmBC,IAAI,EACvBqC,MAAMH,eAAe,IAAIK,WAAWL,eAAe,EACnDG,MAAMI,KAAK,IAAIF,WAAWN,OAAO,EACjCK,mBACAD,MAAMrC,IAAI,CAACwC,SAAS;IAGtB,OAAOH;AACT,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { Button, ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceSlots = {\n /**\n * The root slot.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Citation slot. Displays a `Citation`. Set the `null` to hide the citation.\n */\n citation: Slot<'div'>;\n\n /**\n * Media slot. Used to display Avatars, Icons, etc.\n */\n media: Slot<'div'>;\n\n /**\n * Actions slot.\n */\n actions: Slot<'div'>;\n\n /**\n * Label slot. Primary description of the reference.\n */\n label: NonNullable<Slot<'div'>>;\n\n /**\n * Sensitivity slot. Used to display a `SensitivityLabel`.\n */\n sensitivity: Slot<'span'>;\n\n /**\n *
|
|
1
|
+
{"version":3,"sources":["Reference.types.ts"],"sourcesContent":["import type { CopilotMode } from '@fluentui-copilot/react-provider';\nimport type { Button, ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type ReferenceSlots = {\n /**\n * The root slot.\n */\n root: NonNullable<Slot<'div'>>;\n\n /**\n * Citation slot. Displays a `Citation`. Set the `null` to hide the citation.\n */\n citation: Slot<'div'>;\n\n /**\n * Media slot. Used to display Avatars, Icons, etc.\n */\n media: Slot<'div'>;\n\n /**\n * Actions slot.\n */\n actions: Slot<'div'>;\n\n /**\n * Label slot. Primary description of the reference.\n */\n label: NonNullable<Slot<'div'>>;\n\n /**\n * Sensitivity slot. Used to display a `SensitivityLabel`.\n */\n sensitivity: Slot<'span'>;\n\n /**\n * Metadata slot. Container for `primaryText`, `secondaryText`, `tertiaryText` and `icon`.\n */\n metadata: NonNullable<Slot<'div'>>;\n\n /**\n * Primary text slot. First displayed metadata text.\n */\n primaryText: Slot<'span'>;\n\n /**\n * Secondary text slot. Second displayed metadata text.\n */\n secondaryText: Slot<'span'>;\n\n /**\n * Tertiary text slot. Third displayed metadata text.\n */\n tertiaryText: Slot<'span'>;\n\n /**\n * Icon slot. Icon displayed in metadata area.\n */\n icon: Slot<'span'>;\n\n /**\n * Content slot.\n */\n content: NonNullable<Slot<'div'>>;\n\n /**\n * Details button slot. Used to expand/collapse the reference.\n */\n detailsButton: Slot<typeof Button>;\n};\n\n/**\n * Reference Props\n */\nexport type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> &\n CopilotMode & {\n /**\n * Numeric index associated with `Citation`.\n */\n index: number;\n\n /**\n * HREF back to the `Citation` this `Reference` is associated with.\n */\n citationHref?: string;\n\n /**\n * Unique ID associated with this `Reference`.\n */\n referenceId?: string;\n\n /**\n * Text snippet from the reference source.\n */\n excerpt?: string;\n\n /**\n * @deprecated Inline layout is the only one that is available, use `Preview` component instead for an equivalent to a `Reference` with a popover layout inside of a `Popover`.\n */\n layout?: 'inline' | 'popover';\n };\n\n/**\n * State used in rendering Reference\n */\nexport type ReferenceState = ComponentState<ReferenceSlots> &\n Required<Pick<ReferenceProps, 'mode' | 'layout' | 'index'>> & {\n /**\n * State used to renderer the `Reference` in an expanded state.\n */\n isExpanded: boolean;\n };\n"],"names":[],"mappings":"AAAA,WA8GI"}
|
|
@@ -8,7 +8,7 @@ export const renderReference_unstable = state => {
|
|
|
8
8
|
return /*#__PURE__*/_jsxs(state.root, {
|
|
9
9
|
children: [state.citation && /*#__PURE__*/_jsx(state.citation, {}), state.media && /*#__PURE__*/_jsx(state.media, {}), /*#__PURE__*/_jsx(state.label, {}), state.actions && /*#__PURE__*/_jsxs(state.actions, {
|
|
10
10
|
children: [state.actions.children, state.detailsButton && /*#__PURE__*/_jsx(state.detailsButton, {})]
|
|
11
|
-
}), state.
|
|
11
|
+
}), state.sensitivity && /*#__PURE__*/_jsx(state.sensitivity, {}), /*#__PURE__*/_jsxs(state.metadata, {
|
|
12
12
|
children: [state.primaryText && /*#__PURE__*/_jsx(state.primaryText, {}), state.secondaryText && /*#__PURE__*/_jsx(state.secondaryText, {}), state.tertiaryText && /*#__PURE__*/_jsx(state.tertiaryText, {}), state.icon && /*#__PURE__*/_jsx(state.icon, {}), state.metadata.children]
|
|
13
13
|
}), /*#__PURE__*/_jsx(state.content, {})]
|
|
14
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\n\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\n/**\n * Render the final JSX of Reference\n */\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n return (\n <state.root>\n {state.citation && <state.citation />}\n {state.media && <state.media />}\n <state.label />\n {state.actions && (\n <state.actions>\n {state.actions.children}\n {state.detailsButton && <state.detailsButton />}\n </state.actions>\n )}\n {state.
|
|
1
|
+
{"version":3,"sources":["renderReference.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\n\nimport type { ReferenceState, ReferenceSlots } from './Reference.types';\n\n/**\n * Render the final JSX of Reference\n */\nexport const renderReference_unstable = (state: ReferenceState) => {\n assertSlots<ReferenceSlots>(state);\n\n return (\n <state.root>\n {state.citation && <state.citation />}\n {state.media && <state.media />}\n <state.label />\n {state.actions && (\n <state.actions>\n {state.actions.children}\n {state.detailsButton && <state.detailsButton />}\n </state.actions>\n )}\n {state.sensitivity && <state.sensitivity />}\n <state.metadata>\n {state.primaryText && <state.primaryText />}\n {state.secondaryText && <state.secondaryText />}\n {state.tertiaryText && <state.tertiaryText />}\n {state.icon && <state.icon />}\n {state.metadata.children}\n </state.metadata>\n <state.content />\n </state.root>\n );\n};\n"],"names":["assertSlots","renderReference_unstable","state","root","citation","media","label","actions","children","detailsButton","sensitivity","metadata","primaryText","secondaryText","tertiaryText","icon","content"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAIzD;;CAEC,GACD,OAAO,MAAMC,2BAA2B,CAACC;IACvCF,YAA4BE;IAE5B,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,QAAQ,kBAAI,KAACF,MAAME,QAAQ;YACjCF,MAAMG,KAAK,kBAAI,KAACH,MAAMG,KAAK;0BAC5B,KAACH,MAAMI,KAAK;YACXJ,MAAMK,OAAO,kBACZ,MAACL,MAAMK,OAAO;;oBACXL,MAAMK,OAAO,CAACC,QAAQ;oBACtBN,MAAMO,aAAa,kBAAI,KAACP,MAAMO,aAAa;;;YAG/CP,MAAMQ,WAAW,kBAAI,KAACR,MAAMQ,WAAW;0BACxC,MAACR,MAAMS,QAAQ;;oBACZT,MAAMU,WAAW,kBAAI,KAACV,MAAMU,WAAW;oBACvCV,MAAMW,aAAa,kBAAI,KAACX,MAAMW,aAAa;oBAC3CX,MAAMY,YAAY,kBAAI,KAACZ,MAAMY,YAAY;oBACzCZ,MAAMa,IAAI,kBAAI,KAACb,MAAMa,IAAI;oBACzBb,MAAMS,QAAQ,CAACH,QAAQ;;;0BAE1B,KAACN,MAAMc,OAAO;;;AAGpB,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Button, Caption1,
|
|
2
|
+
import { Button, Caption1, getIntrinsicElementProps, mergeCallbacks, mergeClasses, slot, useId, usePopoverContext_unstable as usePopoverContext } from '@fluentui/react-components';
|
|
3
3
|
import { ChevronDown24Regular, ChevronUp24Regular, ChevronDown16Regular, ChevronUp16Regular } from '@fluentui/react-icons';
|
|
4
4
|
import { referenceExtraClassNames } from './useReferenceStyles';
|
|
5
5
|
import { Citation } from '../Citation';
|
|
@@ -88,7 +88,6 @@ export const useReference_unstable = (props, ref) => {
|
|
|
88
88
|
actions: 'div',
|
|
89
89
|
label: 'div',
|
|
90
90
|
sensitivity: 'span',
|
|
91
|
-
sensitivityLabel: 'span',
|
|
92
91
|
metadata: 'div',
|
|
93
92
|
content: 'div',
|
|
94
93
|
primaryText: 'span',
|
|
@@ -97,7 +96,7 @@ export const useReference_unstable = (props, ref) => {
|
|
|
97
96
|
icon: 'span',
|
|
98
97
|
detailsButton: Button
|
|
99
98
|
},
|
|
100
|
-
root: slot.always(
|
|
99
|
+
root: slot.always(getIntrinsicElementProps('div', {
|
|
101
100
|
ref,
|
|
102
101
|
id: referenceId,
|
|
103
102
|
...groupSemantics,
|
|
@@ -109,7 +108,6 @@ export const useReference_unstable = (props, ref) => {
|
|
|
109
108
|
defaultProps: {
|
|
110
109
|
children: /*#__PURE__*/React.createElement(Citation, {
|
|
111
110
|
block: true,
|
|
112
|
-
referenceId: referenceId,
|
|
113
111
|
...citationProps
|
|
114
112
|
}, index)
|
|
115
113
|
},
|
|
@@ -125,9 +123,6 @@ export const useReference_unstable = (props, ref) => {
|
|
|
125
123
|
sensitivity: slot.optional(props.sensitivity, {
|
|
126
124
|
elementType: 'span'
|
|
127
125
|
}),
|
|
128
|
-
sensitivityLabel: slot.optional(props.sensitivityLabel, {
|
|
129
|
-
elementType: 'span'
|
|
130
|
-
}),
|
|
131
126
|
metadata: slot.always(props.metadata, {
|
|
132
127
|
elementType: 'div'
|
|
133
128
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReference.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Button,\n Caption1,\n getNativeElementProps,\n mergeCallbacks,\n mergeClasses,\n slot,\n useId,\n usePopoverContext_unstable as usePopoverContext,\n} from '@fluentui/react-components';\nimport {\n ChevronDown24Regular,\n ChevronUp24Regular,\n ChevronDown16Regular,\n ChevronUp16Regular,\n} from '@fluentui/react-icons';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport { Citation } from '../Citation';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\nimport { useReferenceGroupSetOpen } from '../../context/ReferenceGroupContext';\nimport { useCopilotMode } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (props: ReferenceProps, ref: React.Ref<HTMLElement>): ReferenceState => {\n const { index, referenceId, citationHref, excerpt, layout = 'inline' } = props;\n\n const mode = useCopilotMode(props.mode);\n\n const labelId = useId();\n const mediaId = useId();\n const [isExpanded, setIsExpanded] = React.useState(layout === 'popover' ? true : false);\n\n const setPopoverOpen = usePopoverContext(context => context.setOpen);\n\n const onExpandClick: React.MouseEventHandler<HTMLButtonElement> = _e => {\n setIsExpanded(!isExpanded);\n };\n\n const label = slot.always(props.label, {\n defaultProps: { id: labelId },\n elementType: 'div',\n });\n const media = slot.optional(props.media, { defaultProps: { id: mediaId }, elementType: 'div' });\n if (media && React.isValidElement<HTMLElement>(media.children)) {\n media.children = React.cloneElement(media.children, {\n className: mergeClasses(media.children.props.className, referenceExtraClassNames.mediaChild),\n });\n }\n\n if (media?.id) {\n label['aria-describedby'] = label['aria-describedby']?.concat(media.id) ?? media.id;\n }\n\n const ariaLabelledByProp = props['aria-labelledby'];\n const groupSemantics = React.useMemo(() => {\n return layout === 'inline'\n ? {\n role: 'group',\n 'aria-labelledby': `${ariaLabelledByProp ?? ''} ${label.id}`,\n tabIndex: -1,\n }\n : {};\n }, [layout, ariaLabelledByProp, label.id]);\n\n // Within a popup, a citation should function as a close button\n const citationProps = React.useMemo(() => {\n const onPopoverCloseClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n setPopoverOpen(e, false);\n\n // don't navigate\n e.preventDefault();\n };\n\n return layout === 'popover'\n ? {\n referenceHref: '#',\n tabIndex: -1,\n 'aria-label': `Reference ${index}, close`,\n onClick: onPopoverCloseClick,\n }\n : {\n referenceHref: citationHref,\n };\n }, [layout, citationHref, index, setPopoverOpen]);\n\n const state: ReferenceState = {\n isExpanded,\n mode: layout === 'popover' ? 'sidecar' : mode,\n layout,\n index,\n components: {\n root: 'div',\n citation: 'div',\n media: 'div',\n actions: 'div',\n label: 'div',\n sensitivity: 'span',\n sensitivityLabel: 'span',\n metadata: 'div',\n content: 'div',\n primaryText: 'span',\n secondaryText: 'span',\n tertiaryText: 'span',\n icon: 'span',\n detailsButton: Button,\n },\n root: slot.always(\n getNativeElementProps('div', {\n ref,\n id: referenceId,\n ...groupSemantics,\n ...props,\n }),\n { elementType: 'div' },\n ),\n citation: slot.optional(props.citation, {\n defaultProps: {\n children: (\n <Citation block referenceId={referenceId} {...citationProps}>\n {index}\n </Citation>\n ),\n },\n renderByDefault: true,\n elementType: 'div',\n }),\n media,\n actions: slot.optional(layout === 'inline' ? props.actions : null, {\n renderByDefault: true,\n elementType: 'div',\n }),\n label,\n sensitivity: slot.optional(props.sensitivity, { elementType: 'span' }),\n sensitivityLabel: slot.optional(props.sensitivityLabel, { elementType: 'span' }),\n metadata: slot.always(props.metadata, { elementType: 'div' }),\n primaryText: slot.optional(props.primaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n tertiaryText: slot.optional(props.tertiaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n content: slot.always(props.content, {\n defaultProps: {\n children: excerpt && <Caption1>{excerpt}</Caption1>,\n },\n elementType: 'div',\n }),\n detailsButton: slot.optional(layout === 'inline' ? props.detailsButton : null, {\n defaultProps: {\n appearance: 'transparent',\n 'aria-expanded': isExpanded,\n 'aria-label': 'show details',\n size: mode === 'sidecar' ? 'small' : 'medium',\n icon: {\n children: getIcon(isExpanded, mode),\n },\n },\n renderByDefault: true,\n elementType: Button,\n }),\n };\n\n if (state.detailsButton) {\n const onClick = state.detailsButton.onClick as React.MouseEventHandler<HTMLButtonElement>;\n state.detailsButton.onClick = mergeCallbacks(onClick, onExpandClick);\n }\n\n const referenceGroupSetOpen = useReferenceGroupSetOpen();\n const onTargettedByCitation = (e: React.FocusEvent<HTMLElement>) => {\n const relatedTargetHash: string | undefined = (e.relatedTarget as HTMLAnchorElement)?.hash;\n if (relatedTargetHash && relatedTargetHash.substring(1) === referenceId) {\n referenceGroupSetOpen();\n setIsExpanded(true);\n }\n };\n state.root.onFocus = mergeCallbacks(state.root.onFocus, onTargettedByCitation);\n\n return state;\n};\n\nconst getIcon = (isExpanded: boolean, mode: ReferenceProps['mode']): JSX.Element => {\n if (mode === 'sidecar') {\n return !isExpanded ? <ChevronDown16Regular /> : <ChevronUp16Regular />;\n }\n\n return !isExpanded ? <ChevronDown24Regular /> : <ChevronUp24Regular />;\n};\n"],"names":["React","Button","Caption1","getNativeElementProps","mergeCallbacks","mergeClasses","slot","useId","usePopoverContext_unstable","usePopoverContext","ChevronDown24Regular","ChevronUp24Regular","ChevronDown16Regular","ChevronUp16Regular","referenceExtraClassNames","Citation","useReferenceGroupSetOpen","useCopilotMode","useReference_unstable","props","ref","index","referenceId","citationHref","excerpt","layout","mode","labelId","mediaId","isExpanded","setIsExpanded","useState","setPopoverOpen","context","setOpen","onExpandClick","_e","label","always","defaultProps","id","elementType","media","optional","isValidElement","children","cloneElement","className","mediaChild","concat","ariaLabelledByProp","groupSemantics","useMemo","role","tabIndex","citationProps","onPopoverCloseClick","e","preventDefault","referenceHref","onClick","state","components","root","citation","actions","sensitivity","sensitivityLabel","metadata","content","primaryText","secondaryText","tertiaryText","icon","detailsButton","block","renderByDefault","hidden","appearance","size","getIcon","referenceGroupSetOpen","onTargettedByCitation","relatedTargetHash","relatedTarget","hash","substring","onFocus"],"mappings":"AAAA,YAAYA,WAAW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AAO,EAAE;YAClC9B,cAAc;gBACZM,UAAUrB,yBAAW,oBAACtB,gBAAUsB;YAClC;YACAiB,aAAa;QACf;QACAiC,eAAepE,KAAKqC,QAAQ,CAAClB,WAAW,WAAWN,MAAMuD,aAAa,GAAG,MAAM;YAC7EnC,cAAc;gBACZuC,YAAY;gBACZ,iBAAiBjD;gBACjB,cAAc;gBACdkD,MAAMrD,SAAS,YAAY,UAAU;gBACrC+C,MAAM;oBACJ5B,UAAUmC,QAAQnD,YAAYH;gBAChC;YACF;YACAkD,iBAAiB;YACjBnC,aAAaxC;QACf;IACF;IAEA,IAAI4D,MAAMa,aAAa,EAAE;QACvB,MAAMd,UAAUC,MAAMa,aAAa,CAACd,OAAO;QAC3CC,MAAMa,aAAa,CAACd,OAAO,GAAGxD,eAAewD,SAASzB;IACxD;IAEA,MAAM8C,wBAAwBjE;IAC9B,MAAMkE,wBAAwB,CAACzB;YACkBA;QAA/C,MAAM0B,qBAAyC1B,mBAAAA,EAAE2B,aAAa,cAAf3B,uCAAD,AAACA,iBAAuC4B,IAAI;QAC1F,IAAIF,qBAAqBA,kBAAkBG,SAAS,CAAC,OAAOhE,aAAa;YACvE2D;YACAnD,cAAc;QAChB;IACF;IACA+B,MAAME,IAAI,CAACwB,OAAO,GAAGnF,eAAeyD,MAAME,IAAI,CAACwB,OAAO,EAAEL;IAExD,OAAOrB;AACT,EAAE;AAEF,MAAMmB,UAAU,CAACnD,YAAqBH;IACpC,IAAIA,SAAS,WAAW;QACtB,OAAO,CAACG,2BAAa,oBAACjB,4CAA0B,oBAACC;IACnD;IAEA,OAAO,CAACgB,2BAAa,oBAACnB,4CAA0B,oBAACC;AACnD"}
|
|
1
|
+
{"version":3,"sources":["useReference.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n Button,\n Caption1,\n getIntrinsicElementProps,\n mergeCallbacks,\n mergeClasses,\n slot,\n useId,\n usePopoverContext_unstable as usePopoverContext,\n} from '@fluentui/react-components';\nimport {\n ChevronDown24Regular,\n ChevronUp24Regular,\n ChevronDown16Regular,\n ChevronUp16Regular,\n} from '@fluentui/react-icons';\nimport { referenceExtraClassNames } from './useReferenceStyles';\nimport { Citation } from '../Citation';\nimport type { ReferenceProps, ReferenceState } from './Reference.types';\nimport { useReferenceGroupSetOpen } from '../../context/ReferenceGroupContext';\nimport { useCopilotMode } from '@fluentui-copilot/react-provider';\n\n/**\n * Create the state required to render Reference.\n *\n * The returned state can be modified with hooks such as useReferenceStyles_unstable,\n * before being passed to renderReference_unstable.\n *\n * @param props - props from this instance of Reference\n * @param ref - reference to root HTMLElement of Reference\n */\nexport const useReference_unstable = (props: ReferenceProps, ref: React.Ref<HTMLDivElement>): ReferenceState => {\n const { index, referenceId, citationHref, excerpt, layout = 'inline' } = props;\n\n const mode = useCopilotMode(props.mode);\n\n const labelId = useId();\n const mediaId = useId();\n const [isExpanded, setIsExpanded] = React.useState(layout === 'popover' ? true : false);\n\n const setPopoverOpen = usePopoverContext(context => context.setOpen);\n\n const onExpandClick: React.MouseEventHandler<HTMLButtonElement> = _e => {\n setIsExpanded(!isExpanded);\n };\n\n const label = slot.always(props.label, {\n defaultProps: { id: labelId },\n elementType: 'div',\n });\n const media = slot.optional(props.media, { defaultProps: { id: mediaId }, elementType: 'div' });\n if (media && React.isValidElement<HTMLElement>(media.children)) {\n media.children = React.cloneElement(media.children, {\n className: mergeClasses(media.children.props.className, referenceExtraClassNames.mediaChild),\n });\n }\n\n if (media?.id) {\n label['aria-describedby'] = label['aria-describedby']?.concat(media.id) ?? media.id;\n }\n\n const ariaLabelledByProp = props['aria-labelledby'];\n const groupSemantics = React.useMemo(() => {\n return layout === 'inline'\n ? {\n role: 'group',\n 'aria-labelledby': `${ariaLabelledByProp ?? ''} ${label.id}`,\n tabIndex: -1,\n }\n : {};\n }, [layout, ariaLabelledByProp, label.id]);\n\n // Within a popup, a citation should function as a close button\n const citationProps = React.useMemo(() => {\n const onPopoverCloseClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n setPopoverOpen(e, false);\n\n // don't navigate\n e.preventDefault();\n };\n\n return layout === 'popover'\n ? {\n referenceHref: '#',\n tabIndex: -1,\n 'aria-label': `Reference ${index}, close`,\n onClick: onPopoverCloseClick,\n }\n : {\n referenceHref: citationHref,\n };\n }, [layout, citationHref, index, setPopoverOpen]);\n\n const state: ReferenceState = {\n isExpanded,\n mode: layout === 'popover' ? 'sidecar' : mode,\n layout,\n index,\n components: {\n root: 'div',\n citation: 'div',\n media: 'div',\n actions: 'div',\n label: 'div',\n sensitivity: 'span',\n metadata: 'div',\n content: 'div',\n primaryText: 'span',\n secondaryText: 'span',\n tertiaryText: 'span',\n icon: 'span',\n detailsButton: Button,\n },\n root: slot.always(\n getIntrinsicElementProps('div', {\n ref,\n id: referenceId,\n ...groupSemantics,\n ...props,\n }),\n { elementType: 'div' },\n ),\n citation: slot.optional(props.citation, {\n defaultProps: {\n children: (\n <Citation block {...citationProps}>\n {index}\n </Citation>\n ),\n },\n renderByDefault: true,\n elementType: 'div',\n }),\n media,\n actions: slot.optional(layout === 'inline' ? props.actions : null, {\n renderByDefault: true,\n elementType: 'div',\n }),\n label,\n sensitivity: slot.optional(props.sensitivity, { elementType: 'span' }),\n metadata: slot.always(props.metadata, { elementType: 'div' }),\n primaryText: slot.optional(props.primaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n secondaryText: slot.optional(props.secondaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n tertiaryText: slot.optional(props.tertiaryText, {\n defaultProps: {\n hidden: !isExpanded,\n },\n elementType: 'span',\n }),\n icon: slot.optional(props.icon, { elementType: 'span' }),\n content: slot.always(props.content, {\n defaultProps: {\n children: excerpt && <Caption1>{excerpt}</Caption1>,\n },\n elementType: 'div',\n }),\n detailsButton: slot.optional(layout === 'inline' ? props.detailsButton : null, {\n defaultProps: {\n appearance: 'transparent',\n 'aria-expanded': isExpanded,\n 'aria-label': 'show details',\n size: mode === 'sidecar' ? 'small' : 'medium',\n icon: {\n children: getIcon(isExpanded, mode),\n },\n },\n renderByDefault: true,\n elementType: Button,\n }),\n };\n\n if (state.detailsButton) {\n const onClick = state.detailsButton.onClick as React.MouseEventHandler<HTMLButtonElement>;\n state.detailsButton.onClick = mergeCallbacks(onClick, onExpandClick);\n }\n\n const referenceGroupSetOpen = useReferenceGroupSetOpen();\n const onTargettedByCitation = (e: React.FocusEvent<HTMLElement>) => {\n const relatedTargetHash: string | undefined = (e.relatedTarget as HTMLAnchorElement)?.hash;\n if (relatedTargetHash && relatedTargetHash.substring(1) === referenceId) {\n referenceGroupSetOpen();\n setIsExpanded(true);\n }\n };\n state.root.onFocus = mergeCallbacks(state.root.onFocus, onTargettedByCitation);\n\n return state;\n};\n\nconst getIcon = (isExpanded: boolean, mode: ReferenceProps['mode']): JSX.Element => {\n if (mode === 'sidecar') {\n return !isExpanded ? <ChevronDown16Regular /> : <ChevronUp16Regular />;\n }\n\n return !isExpanded ? <ChevronDown24Regular /> : <ChevronUp24Regular />;\n};\n"],"names":["React","Button","Caption1","getIntrinsicElementProps","mergeCallbacks","mergeClasses","slot","useId","usePopoverContext_unstable","usePopoverContext","ChevronDown24Regular","ChevronUp24Regular","ChevronDown16Regular","ChevronUp16Regular","referenceExtraClassNames","Citation","useReferenceGroupSetOpen","useCopilotMode","useReference_unstable","props","ref","index","referenceId","citationHref","excerpt","layout","mode","labelId","mediaId","isExpanded","setIsExpanded","useState","setPopoverOpen","context","setOpen","onExpandClick","_e","label","always","defaultProps","id","elementType","media","optional","isValidElement","children","cloneElement","className","mediaChild","concat","ariaLabelledByProp","groupSemantics","useMemo","role","tabIndex","citationProps","onPopoverCloseClick","e","preventDefault","referenceHref","onClick","state","components","root","citation","actions","sensitivity","metadata","content","primaryText","secondaryText","tertiaryText","icon","detailsButton","block","renderByDefault","hidden","appearance","size","getIcon","referenceGroupSetOpen","onTargettedByCitation","relatedTargetHash","relatedTarget","hash","substring","onFocus"],"mappings":"AAAA,YAA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,KAAKqC,QAAQ,CAAClB,WAAW,WAAWN,MAAMsD,aAAa,GAAG,MAAM;YAC7ElC,cAAc;gBACZsC,YAAY;gBACZ,iBAAiBhD;gBACjB,cAAc;gBACdiD,MAAMpD,SAAS,YAAY,UAAU;gBACrC8C,MAAM;oBACJ3B,UAAUkC,QAAQlD,YAAYH;gBAChC;YACF;YACAiD,iBAAiB;YACjBlC,aAAaxC;QACf;IACF;IAEA,IAAI4D,MAAMY,aAAa,EAAE;QACvB,MAAMb,UAAUC,MAAMY,aAAa,CAACb,OAAO;QAC3CC,MAAMY,aAAa,CAACb,OAAO,GAAGxD,eAAewD,SAASzB;IACxD;IAEA,MAAM6C,wBAAwBhE;IAC9B,MAAMiE,wBAAwB,CAACxB;YACkBA;QAA/C,MAAMyB,qBAAyCzB,mBAAAA,EAAE0B,aAAa,cAAf1B,uCAAD,AAACA,iBAAuC2B,IAAI;QAC1F,IAAIF,qBAAqBA,kBAAkBG,SAAS,CAAC,OAAO/D,aAAa;YACvE0D;YACAlD,cAAc;QAChB;IACF;IACA+B,MAAME,IAAI,CAACuB,OAAO,GAAGlF,eAAeyD,MAAME,IAAI,CAACuB,OAAO,EAAEL;IAExD,OAAOpB;AACT,EAAE;AAEF,MAAMkB,UAAU,CAAClD,YAAqBH;IACpC,IAAIA,SAAS,WAAW;QACtB,OAAO,CAACG,2BAAa,oBAACjB,4CAA0B,oBAACC;IACnD;IAEA,OAAO,CAACgB,2BAAa,oBAACnB,4CAA0B,oBAACC;AACnD"}
|
|
@@ -5,7 +5,6 @@ export const referenceClassNames = {
|
|
|
5
5
|
media: 'fai-Reference__media',
|
|
6
6
|
actions: 'fai-Reference__actions',
|
|
7
7
|
sensitivity: 'fai-Reference__sensitivity',
|
|
8
|
-
sensitivityLabel: 'fai-Reference__sensitivityLabel',
|
|
9
8
|
metadata: 'fai-Reference__metadata',
|
|
10
9
|
primaryText: 'fai-Reference__primaryText',
|
|
11
10
|
secondaryText: 'fai-Reference__secondaryText',
|
|
@@ -86,39 +85,6 @@ const useStyles = __styles({
|
|
|
86
85
|
Bw0ie65: "f15c84mf",
|
|
87
86
|
Bdqf98w: "fsxvdwy"
|
|
88
87
|
},
|
|
89
|
-
sensitivityLabel: {
|
|
90
|
-
B6of3ja: "fww94b8",
|
|
91
|
-
De3pzq: "f3vzo32",
|
|
92
|
-
B4j52fo: "f192inf7",
|
|
93
|
-
Bekrc4i: ["f5tn483", "f1ojsxk5"],
|
|
94
|
-
Bn0qgzm: "f1vxd6vx",
|
|
95
|
-
ibv6hh: ["f1ojsxk5", "f5tn483"],
|
|
96
|
-
icvyot: "fzkkow9",
|
|
97
|
-
vrafjx: ["fcdblym", "fjik90z"],
|
|
98
|
-
oivjwe: "fg706s2",
|
|
99
|
-
wvpqe5: ["fjik90z", "fcdblym"],
|
|
100
|
-
g2u3we: "fghlq4f",
|
|
101
|
-
h3c5rm: ["f1gn591s", "fjscplz"],
|
|
102
|
-
B9xav0g: "fb073pr",
|
|
103
|
-
zhjwy3: ["fjscplz", "f1gn591s"],
|
|
104
|
-
Bbmb7ep: ["f1aa9q02", "f16jpd5f"],
|
|
105
|
-
Beyfa6y: ["f16jpd5f", "f1aa9q02"],
|
|
106
|
-
B7oj6ja: ["f1jar5jt", "fyu767a"],
|
|
107
|
-
Btl43ni: ["fyu767a", "f1jar5jt"],
|
|
108
|
-
Ijaq50: "fpymh5q",
|
|
109
|
-
Br312pm: "fjieyc3",
|
|
110
|
-
nk6f5a: "f18utan",
|
|
111
|
-
Bw0ie65: "f15c84mf",
|
|
112
|
-
Bdqf98w: "fsxvdwy",
|
|
113
|
-
z8tnut: "f1g0x7ka",
|
|
114
|
-
z189sj: ["fdw0yi8", "fk8j09s"],
|
|
115
|
-
Byoj8tv: "f1qch9an",
|
|
116
|
-
uwmqm3: ["fk8j09s", "fdw0yi8"],
|
|
117
|
-
Bahqtrf: "fk6fouc",
|
|
118
|
-
Be2twd7: "f13mqy1h",
|
|
119
|
-
Bhrd7zp: "figsok6",
|
|
120
|
-
Bg96gwp: "fcpl73t"
|
|
121
|
-
},
|
|
122
88
|
metadata: {
|
|
123
89
|
B6of3ja: "fww94b8",
|
|
124
90
|
Ijaq50: "f1md2vp3",
|
|
@@ -166,7 +132,7 @@ const useStyles = __styles({
|
|
|
166
132
|
mc9l5x: "fjseox"
|
|
167
133
|
}
|
|
168
134
|
}, {
|
|
169
|
-
d: [".f2e0fxj{grid-template-rows:24px auto auto auto;}", ".f1ywm7hm{padding-top:var(--spacingVerticalXS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f14wxoun{padding-bottom:var(--spacingVerticalXS);}", ".f1pit55b{border-top-width:0px;}", ".f1orqat1{border-right-width:0px;}", ".ffbvwxd{border-left-width:0px;}", ".f136mcbi{border-bottom-width:0px;}", ".f1uniyfe{width:calc(256px - (var(--spacingHorizontalM) * 2));}", ".f1nbblvp{padding-top:0px;}", ".fifp7yv{padding-right:0px;}", ".f1asdtw4{padding-left:0px;}", ".f1ov4xf1{padding-bottom:0px;}", ".f1sff6ri{row-gap:0;}", ".fwllpr6{grid-row-start:citation;}", ".fx0qcsv{grid-column-start:citation;}", ".f1ldxewp{grid-row-end:citation;}", ".ftmncab{grid-column-end:citation;}", ".f11uok23{grid-row-start:media;}", ".f1qdfnnj{grid-column-start:media;}", ".f1s27gz{grid-row-end:media;}", ".f86d0yl{grid-column-end:media;}", ".f22iagw{display:flex;}", ".f122n59{align-items:center;}", ".f4d9j23{justify-content:center;}", ".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".fe9dio4>.fai-Reference__mediaChild{width:16px;}", ".f1ojxjpn>.fai-Reference__mediaChild{height:16px;}", ".f16hsg94{grid-row-start:1;}", ".f35n22n{grid-column-start:actions;}", ".fh3uimt{grid-row-end:actions;}", ".fnh4yke{grid-column-end:actions;}", ".f1a7i8kp{justify-self:end;}", ".fzmnlw3>fui-Button__icon{color:var(--colorNeutralForeground3);}", ".fpymh5q{grid-row-start:sensitivityLabel;}", ".fjieyc3{grid-column-start:sensitivityLabel;}", ".f18utan{grid-row-end:sensitivityLabel;}", ".f15c84mf{grid-column-end:sensitivityLabel;}", ".fsxvdwy{justify-self:start;}", ".fww94b8{margin-top:var(--spacingVerticalXS);}", ".
|
|
135
|
+
d: [".f2e0fxj{grid-template-rows:24px auto auto auto;}", ".f1ywm7hm{padding-top:var(--spacingVerticalXS);}", ".f1vdfbxk{padding-right:var(--spacingHorizontalS);}", ".f1f5gg8d{padding-left:var(--spacingHorizontalS);}", ".f14wxoun{padding-bottom:var(--spacingVerticalXS);}", ".f1pit55b{border-top-width:0px;}", ".f1orqat1{border-right-width:0px;}", ".ffbvwxd{border-left-width:0px;}", ".f136mcbi{border-bottom-width:0px;}", ".f1uniyfe{width:calc(256px - (var(--spacingHorizontalM) * 2));}", ".f1nbblvp{padding-top:0px;}", ".fifp7yv{padding-right:0px;}", ".f1asdtw4{padding-left:0px;}", ".f1ov4xf1{padding-bottom:0px;}", ".f1sff6ri{row-gap:0;}", ".fwllpr6{grid-row-start:citation;}", ".fx0qcsv{grid-column-start:citation;}", ".f1ldxewp{grid-row-end:citation;}", ".ftmncab{grid-column-end:citation;}", ".f11uok23{grid-row-start:media;}", ".f1qdfnnj{grid-column-start:media;}", ".f1s27gz{grid-row-end:media;}", ".f86d0yl{grid-column-end:media;}", ".f22iagw{display:flex;}", ".f122n59{align-items:center;}", ".f4d9j23{justify-content:center;}", ".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".fe9dio4>.fai-Reference__mediaChild{width:16px;}", ".f1ojxjpn>.fai-Reference__mediaChild{height:16px;}", ".f16hsg94{grid-row-start:1;}", ".f35n22n{grid-column-start:actions;}", ".fh3uimt{grid-row-end:actions;}", ".fnh4yke{grid-column-end:actions;}", ".f1a7i8kp{justify-self:end;}", ".fzmnlw3>fui-Button__icon{color:var(--colorNeutralForeground3);}", ".fpymh5q{grid-row-start:sensitivityLabel;}", ".fjieyc3{grid-column-start:sensitivityLabel;}", ".f18utan{grid-row-end:sensitivityLabel;}", ".f15c84mf{grid-column-end:sensitivityLabel;}", ".fsxvdwy{justify-self:start;}", ".fww94b8{margin-top:var(--spacingVerticalXS);}", ".f1md2vp3{grid-row-start:metadata;}", ".f1y0qc5c{grid-column-start:metadata;}", ".f179ty8e{grid-row-end:metadata;}", ".f83o9dc{grid-column-end:metadata;}", ".fk6fouc{font-family:var(--fontFamilyBase);}", ".f13mqy1h{font-size:var(--fontSizeBase100);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fcpl73t{line-height:var(--lineHeightBase100);}", ".f10pi13n{position:relative;}", ".foyynoy{margin-left:var(--spacingHorizontalS);}", ".f1vcna3q{margin-right:var(--spacingHorizontalS);}", ".f1wl9k8s::before{content:\"\";}", ".f1aocrix::before{display:block;}", ".f1j7ml58::before{position:absolute;}", ".f1s1fjay::before{left:calc(var(--spacingHorizontalS) / -2);}", ".f15a459s::before{right:calc(var(--spacingHorizontalS) / -2);}", ".f1wl9tmt::before{top:calc((var(--lineHeightBase100) - var(--fontSizeBase100)) / 2);}", ".f8pn7wt::before{height:var(--fontSizeBase100);}", ".f1x8pvcy::before{border-left-width:var(--strokeWidthThin);}", ".f9sc749::before{border-right-width:var(--strokeWidthThin);}", ".f1jpmc5p::before{border-left-style:solid;}", ".f1yq6w5o::before{border-right-style:solid;}", ".fjml6kk::before{border-left-color:var(--colorNeutralStroke2);}", ".f1geml7w::before{border-right-color:var(--colorNeutralStroke2);}", ".fmrv4ls{vertical-align:middle;}", ".fxwmwwq{grid-row-start:content;}", ".f1e0gndy{grid-column-start:content;}", ".f4zz6gv{grid-row-end:content;}", ".f7idnck{grid-column-end:content;}", ".f1vx9l62{flex-direction:column;}", ".f1wn3y0l{row-gap:var(--spacingVerticalS);}", ".f11d4kpn{color:var(--colorNeutralForeground3);}", ".f9ijwd5{word-break:break-word;}", ".fjseox{display:none;}"]
|
|
170
136
|
});
|
|
171
137
|
const useLabelStyles = __styles({
|
|
172
138
|
root: {
|
|
@@ -224,9 +190,6 @@ export const useReferenceStyles_unstable = state => {
|
|
|
224
190
|
if (state.sensitivity) {
|
|
225
191
|
state.sensitivity.className = mergeClasses(referenceClassNames.sensitivity, styles.sensitivity, !isExpanded && styles.hidden, state.sensitivity.className);
|
|
226
192
|
}
|
|
227
|
-
if (state.sensitivityLabel) {
|
|
228
|
-
state.sensitivityLabel.className = mergeClasses(referenceClassNames.sensitivityLabel, styles.sensitivityLabel, !isExpanded && styles.hidden, state.sensitivityLabel.className);
|
|
229
|
-
}
|
|
230
193
|
state.metadata.className = mergeClasses(referenceClassNames.metadata, styles.metadata, !isExpanded && styles.hidden, state.metadata.className);
|
|
231
194
|
let isSubsequentText = false;
|
|
232
195
|
if (state.primaryText) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n buttonClassNames,\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n media: 'fai-Reference__media',\n actions: 'fai-Reference__actions',\n sensitivity: 'fai-Reference__sensitivity',\n sensitivityLabel: 'fai-Reference__sensitivityLabel',\n metadata: 'fai-Reference__metadata',\n primaryText: 'fai-Reference__primaryText',\n secondaryText: 'fai-Reference__secondaryText',\n tertiaryText: 'fai-Reference__tertiaryText',\n icon: 'fai-Reference__icon',\n label: 'fai-Reference__label',\n content: 'fai-Reference__content',\n detailsButton: 'fai-Reference__detailsButton',\n};\n\nexport const referenceExtraClassNames = {\n text: 'fai-Reference__text',\n mediaChild: 'fai-Reference__mediaChild',\n};\n\nconst labelFontSize = typographyStyles.caption1Strong.fontSize;\nconst labelLineHeight = typographyStyles.caption1Strong.lineHeight;\n\nconst maxPopoverWidth = '256px';\n\nconst useReferenceClassName = makeResetStyles({\n boxSizing: 'border-box',\n width: '100%',\n display: 'grid',\n gridTemplateAreas: `\n \"citation media title actions\"\n \". . title .\"\n \"sensitivityLabel sensitivityLabel sensitivityLabel sensitivityLabel\"\n \"metadata metadata metadata metadata\"\n \"content content content content\"\n `,\n gridTemplateColumns: 'min-content min-content 1fr min-content',\n gridTemplateRows: '32px auto auto auto auto',\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderRadius: tokens.borderRadiusMedium,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n boxShadow: 'none',\n columnGap: tokens.spacingHorizontalXS,\n alignItems: 'center',\n});\n\nconst useStyles = makeStyles({\n canvas: {},\n sidecar: {\n gridTemplateRows: '24px auto auto auto',\n ...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalS),\n },\n inline: {},\n popover: {\n ...shorthands.borderWidth('0px'),\n width: `calc(${maxPopoverWidth} - (${tokens.spacingHorizontalM} * 2))`,\n ...shorthands.padding('0px'),\n },\n closed: {\n rowGap: 0,\n },\n citation: {\n ...shorthands.gridArea('citation'),\n },\n media: {\n ...shorthands.gridArea('media'),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n mediaPopover: {\n width: '16px',\n height: '16px',\n\n [`> .${referenceExtraClassNames.mediaChild}`]: {\n width: '16px',\n height: '16px',\n },\n },\n actions: {\n ...shorthands.gridArea('actions'),\n justifySelf: 'end',\n display: 'flex',\n gridRowStart: 1,\n },\n detailsButton: {\n [`> ${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground3,\n },\n },\n sensitivity: {\n ...shorthands.gridArea('sensitivityLabel'),\n justifySelf: 'start',\n },\n sensitivityLabel: {\n marginTop: tokens.spacingVerticalXS,\n backgroundColor: tokens.colorNeutralBackground5,\n ...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorTransparentStroke),\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n ...shorthands.gridArea('sensitivityLabel'),\n justifySelf: 'start',\n ...shorthands.padding(0, tokens.spacingHorizontalSNudge),\n ...typographyStyles.caption2,\n },\n metadata: {\n marginTop: tokens.spacingVerticalXS,\n\n ...shorthands.gridArea('metadata'),\n ...typographyStyles.caption2,\n },\n metadataSubsequentText: {\n position: 'relative',\n marginLeft: tokens.spacingHorizontalS,\n\n '&::before': {\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n left: `calc(${tokens.spacingHorizontalS} / -2)`,\n top: `calc((${typographyStyles.caption2.lineHeight} - ${typographyStyles.caption2.fontSize}) / 2)`,\n height: typographyStyles.caption2.fontSize,\n ...shorthands.borderLeft(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n },\n icon: {\n ...typographyStyles.caption2,\n verticalAlign: 'middle',\n },\n content: {\n marginTop: tokens.spacingVerticalXS,\n ...shorthands.gridArea('content'),\n display: 'flex',\n flexDirection: 'column',\n rowGap: tokens.spacingVerticalS,\n color: tokens.colorNeutralForeground3,\n wordBreak: 'break-word',\n },\n hidden: {\n display: 'none',\n },\n});\n\nconst useLabelStyles = makeStyles({\n root: {\n ...shorthands.gridArea('title'),\n alignSelf: 'start',\n ...typographyStyles.caption1Strong,\n wordBreak: 'break-word',\n '-webkit-box-orient': 'vertical',\n '-webkit-line-clamp': '2',\n display: '-webkit-box',\n overflowY: 'hidden',\n },\n\n canvas: {\n // 24px is the height of the tallest element within the reference\n paddingTop: `calc((24px / 2 ) - (${labelLineHeight} - ${labelFontSize}))`,\n },\n\n sidecar: {\n // 16px is the height of the tallest element within the reference\n paddingTop: `calc((16px / 2 ) - (${labelLineHeight} - ${labelFontSize}))`,\n },\n\n closed: {\n maxWidth: '100%',\n '-webkit-line-clamp': '1',\n },\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n const { isExpanded, mode, layout } = state;\n\n const rootClassName = useReferenceClassName();\n const styles = useStyles();\n const labelStyles = useLabelStyles();\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootClassName,\n styles[mode],\n styles[layout],\n !isExpanded && styles.closed,\n state.root.className,\n );\n\n if (state.citation) {\n state.citation.className = mergeClasses(referenceClassNames.citation, styles.citation, state.citation.className);\n }\n\n if (state.media) {\n state.media.className = mergeClasses(\n referenceClassNames.media,\n styles.media,\n layout === 'popover' && styles.mediaPopover,\n state.media.className,\n );\n }\n\n if (state.actions) {\n state.actions.className = mergeClasses(referenceClassNames.actions, styles.actions, state.actions.className);\n }\n\n state.label.className = mergeClasses(\n referenceClassNames.label,\n labelStyles.root,\n labelStyles[mode],\n !isExpanded && labelStyles.closed,\n state.label.className,\n );\n\n if (state.sensitivity) {\n state.sensitivity.className = mergeClasses(\n referenceClassNames.sensitivity,\n styles.sensitivity,\n !isExpanded && styles.hidden,\n state.sensitivity.className,\n );\n }\n\n if (state.sensitivityLabel) {\n state.sensitivityLabel.className = mergeClasses(\n referenceClassNames.sensitivityLabel,\n styles.sensitivityLabel,\n !isExpanded && styles.hidden,\n state.sensitivityLabel.className,\n );\n }\n\n state.metadata.className = mergeClasses(\n referenceClassNames.metadata,\n styles.metadata,\n !isExpanded && styles.hidden,\n state.metadata.className,\n );\n\n let isSubsequentText = false;\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n referenceClassNames.primaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.primaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n referenceClassNames.secondaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.secondaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n referenceClassNames.tertiaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.tertiaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(referenceClassNames.icon, styles.icon, state.icon.className);\n }\n state.content.className = mergeClasses(\n referenceClassNames.content,\n styles.content,\n !isExpanded && styles.hidden,\n state.content.className,\n );\n\n if (state.detailsButton) {\n state.detailsButton.className = mergeClasses(\n referenceClassNames.detailsButton,\n styles.detailsButton,\n state.detailsButton.className,\n );\n }\n\n return state;\n};\n"],"names":["buttonClassNames","makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","referenceClassNames","root","citation","media","actions","sensitivity","sensitivityLabel","metadata","primaryText","secondaryText","tertiaryText","icon","label","content","detailsButton","referenceExtraClassNames","text","mediaChild","labelFontSize","caption1Strong","fontSize","labelLineHeight","lineHeight","maxPopoverWidth","useReferenceClassName","boxSizing","width","display","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","border","strokeWidthThin","colorNeutralStroke1","borderRadius","borderRadiusMedium","padding","spacingVerticalS","spacingHorizontalS","boxShadow","columnGap","spacingHorizontalXS","alignItems","useStyles","canvas","sidecar","spacingVerticalXS","inline","popover","borderWidth","spacingHorizontalM","closed","rowGap","gridArea","justifyContent","mediaPopover","height","justifySelf","gridRowStart","color","colorNeutralForeground3","marginTop","backgroundColor","colorNeutralBackground5","colorTransparentStroke","spacingHorizontalSNudge","caption2","metadataSubsequentText","position","marginLeft","left","top","borderLeft","colorNeutralStroke2","verticalAlign","flexDirection","wordBreak","hidden","useLabelStyles","alignSelf","overflowY","paddingTop","maxWidth","useReferenceStyles_unstable","state","isExpanded","mode","layout","rootClassName","styles","labelStyles","className","isSubsequentText"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,UAAU;IACVC,OAAO;IACPC,SAAS;IACTC,aAAa;IACbC,kBAAkB;IAClBC,UAAU;IACVC,aAAa;I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AOZ,MAAM,EAC5BO,MAAMvE,OAAO,CAAC8E,SAAS;IAGzB,IAAIP,MAAMtE,aAAa,EAAE;QACvBsE,MAAMtE,aAAa,CAAC6E,SAAS,GAAG/F,aAC9BI,oBAAoBc,aAAa,EACjC2E,OAAO3E,aAAa,EACpBsE,MAAMtE,aAAa,CAAC6E,SAAS;IAEjC;IAEA,OAAOP;AACT,EAAE"}
|
|
1
|
+
{"version":3,"sources":["useReferenceStyles.ts"],"sourcesContent":["import {\n buttonClassNames,\n makeResetStyles,\n makeStyles,\n mergeClasses,\n shorthands,\n tokens,\n typographyStyles,\n} from '@fluentui/react-components';\nimport type { ReferenceSlots, ReferenceState } from './Reference.types';\nimport type { SlotClassNames } from '@fluentui/react-components';\n\nexport const referenceClassNames: SlotClassNames<ReferenceSlots> = {\n root: 'fai-Reference',\n citation: 'fai-Reference__citation',\n media: 'fai-Reference__media',\n actions: 'fai-Reference__actions',\n sensitivity: 'fai-Reference__sensitivity',\n metadata: 'fai-Reference__metadata',\n primaryText: 'fai-Reference__primaryText',\n secondaryText: 'fai-Reference__secondaryText',\n tertiaryText: 'fai-Reference__tertiaryText',\n icon: 'fai-Reference__icon',\n label: 'fai-Reference__label',\n content: 'fai-Reference__content',\n detailsButton: 'fai-Reference__detailsButton',\n};\n\nexport const referenceExtraClassNames = {\n text: 'fai-Reference__text',\n mediaChild: 'fai-Reference__mediaChild',\n};\n\nconst labelFontSize = typographyStyles.caption1Strong.fontSize;\nconst labelLineHeight = typographyStyles.caption1Strong.lineHeight;\n\nconst maxPopoverWidth = '256px';\n\nconst useReferenceClassName = makeResetStyles({\n boxSizing: 'border-box',\n width: '100%',\n display: 'grid',\n gridTemplateAreas: `\n \"citation media title actions\"\n \". . title .\"\n \"sensitivityLabel sensitivityLabel sensitivityLabel sensitivityLabel\"\n \"metadata metadata metadata metadata\"\n \"content content content content\"\n `,\n gridTemplateColumns: 'min-content min-content 1fr min-content',\n gridTemplateRows: '32px auto auto auto auto',\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\n borderRadius: tokens.borderRadiusMedium,\n padding: `${tokens.spacingVerticalS} ${tokens.spacingHorizontalS}`,\n boxShadow: 'none',\n columnGap: tokens.spacingHorizontalXS,\n alignItems: 'center',\n});\n\nconst useStyles = makeStyles({\n canvas: {},\n sidecar: {\n gridTemplateRows: '24px auto auto auto',\n ...shorthands.padding(tokens.spacingVerticalXS, tokens.spacingHorizontalS),\n },\n inline: {},\n popover: {\n ...shorthands.borderWidth('0px'),\n width: `calc(${maxPopoverWidth} - (${tokens.spacingHorizontalM} * 2))`,\n ...shorthands.padding('0px'),\n },\n closed: {\n rowGap: 0,\n },\n citation: {\n ...shorthands.gridArea('citation'),\n },\n media: {\n ...shorthands.gridArea('media'),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n },\n mediaPopover: {\n width: '16px',\n height: '16px',\n\n [`> .${referenceExtraClassNames.mediaChild}`]: {\n width: '16px',\n height: '16px',\n },\n },\n actions: {\n ...shorthands.gridArea('actions'),\n justifySelf: 'end',\n display: 'flex',\n gridRowStart: 1,\n },\n detailsButton: {\n [`> ${buttonClassNames.icon}`]: {\n color: tokens.colorNeutralForeground3,\n },\n },\n sensitivity: {\n ...shorthands.gridArea('sensitivityLabel'),\n justifySelf: 'start',\n },\n metadata: {\n marginTop: tokens.spacingVerticalXS,\n\n ...shorthands.gridArea('metadata'),\n ...typographyStyles.caption2,\n },\n metadataSubsequentText: {\n position: 'relative',\n marginLeft: tokens.spacingHorizontalS,\n\n '&::before': {\n content: '\"\"',\n display: 'block',\n position: 'absolute',\n left: `calc(${tokens.spacingHorizontalS} / -2)`,\n top: `calc((${typographyStyles.caption2.lineHeight} - ${typographyStyles.caption2.fontSize}) / 2)`,\n height: typographyStyles.caption2.fontSize,\n ...shorthands.borderLeft(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke2),\n },\n },\n icon: {\n ...typographyStyles.caption2,\n verticalAlign: 'middle',\n },\n content: {\n marginTop: tokens.spacingVerticalXS,\n ...shorthands.gridArea('content'),\n display: 'flex',\n flexDirection: 'column',\n rowGap: tokens.spacingVerticalS,\n color: tokens.colorNeutralForeground3,\n wordBreak: 'break-word',\n },\n hidden: {\n display: 'none',\n },\n});\n\nconst useLabelStyles = makeStyles({\n root: {\n ...shorthands.gridArea('title'),\n alignSelf: 'start',\n ...typographyStyles.caption1Strong,\n wordBreak: 'break-word',\n '-webkit-box-orient': 'vertical',\n '-webkit-line-clamp': '2',\n display: '-webkit-box',\n overflowY: 'hidden',\n },\n\n canvas: {\n // 24px is the height of the tallest element within the reference\n paddingTop: `calc((24px / 2 ) - (${labelLineHeight} - ${labelFontSize}))`,\n },\n\n sidecar: {\n // 16px is the height of the tallest element within the reference\n paddingTop: `calc((16px / 2 ) - (${labelLineHeight} - ${labelFontSize}))`,\n },\n\n closed: {\n maxWidth: '100%',\n '-webkit-line-clamp': '1',\n },\n});\n\n/**\n * Apply styling to the Reference slots based on the state\n */\nexport const useReferenceStyles_unstable = (state: ReferenceState): ReferenceState => {\n const { isExpanded, mode, layout } = state;\n\n const rootClassName = useReferenceClassName();\n const styles = useStyles();\n const labelStyles = useLabelStyles();\n state.root.className = mergeClasses(\n referenceClassNames.root,\n rootClassName,\n styles[mode],\n styles[layout],\n !isExpanded && styles.closed,\n state.root.className,\n );\n\n if (state.citation) {\n state.citation.className = mergeClasses(referenceClassNames.citation, styles.citation, state.citation.className);\n }\n\n if (state.media) {\n state.media.className = mergeClasses(\n referenceClassNames.media,\n styles.media,\n layout === 'popover' && styles.mediaPopover,\n state.media.className,\n );\n }\n\n if (state.actions) {\n state.actions.className = mergeClasses(referenceClassNames.actions, styles.actions, state.actions.className);\n }\n\n state.label.className = mergeClasses(\n referenceClassNames.label,\n labelStyles.root,\n labelStyles[mode],\n !isExpanded && labelStyles.closed,\n state.label.className,\n );\n\n if (state.sensitivity) {\n state.sensitivity.className = mergeClasses(\n referenceClassNames.sensitivity,\n styles.sensitivity,\n !isExpanded && styles.hidden,\n state.sensitivity.className,\n );\n }\n\n state.metadata.className = mergeClasses(\n referenceClassNames.metadata,\n styles.metadata,\n !isExpanded && styles.hidden,\n state.metadata.className,\n );\n\n let isSubsequentText = false;\n if (state.primaryText) {\n state.primaryText.className = mergeClasses(\n referenceClassNames.primaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.primaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.secondaryText) {\n state.secondaryText.className = mergeClasses(\n referenceClassNames.secondaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.secondaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.tertiaryText) {\n state.tertiaryText.className = mergeClasses(\n referenceClassNames.tertiaryText,\n referenceExtraClassNames.text,\n isSubsequentText && styles.metadataSubsequentText,\n state.tertiaryText.className,\n );\n isSubsequentText = true;\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(referenceClassNames.icon, styles.icon, state.icon.className);\n }\n state.content.className = mergeClasses(\n referenceClassNames.content,\n styles.content,\n !isExpanded && styles.hidden,\n state.content.className,\n );\n\n if (state.detailsButton) {\n state.detailsButton.className = mergeClasses(\n referenceClassNames.detailsButton,\n styles.detailsButton,\n state.detailsButton.className,\n );\n }\n\n return state;\n};\n"],"names":["buttonClassNames","makeResetStyles","makeStyles","mergeClasses","shorthands","tokens","typographyStyles","referenceClassNames","root","citation","media","actions","sensitivity","metadata","primaryText","secondaryText","tertiaryText","icon","label","content","detailsButton","referenceExtraClassNames","text","mediaChild","labelFontSize","caption1Strong","fontSize","labelLineHeight","lineHeight","maxPopoverWidth","useReferenceClassName","boxSizing","width","display","gridTemplateAreas","gridTemplateColumns","gridTemplateRows","border","strokeWidthThin","colorNeutralStroke1","borderRadius","borderRadiusMedium","padding","spacingVerticalS","spacingHorizontalS","boxShadow","columnGap","spacingHorizontalXS","alignItems","useStyles","canvas","sidecar","spacingVerticalXS","inline","popover","borderWidth","spacingHorizontalM","closed","rowGap","gridArea","justifyContent","mediaPopover","height","justifySelf","gridRowStart","color","colorNeutralForeground3","marginTop","caption2","metadataSubsequentText","position","marginLeft","left","top","borderLeft","colorNeutralStroke2","verticalAlign","flexDirection","wordBreak","hidden","useLabelStyles","alignSelf","overflowY","paddingTop","maxWidth","useReferenceStyles_unstable","state","isExpanded","mode","layout","rootClassName","styles","labelStyles","className","isSubsequentText"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,eAAe,EACfC,UAAU,EACVC,YAAY,EACZC,UAAU,EACVC,MAAM,EACNC,gBAAgB,QACX,6BAA6B;AAIpC,OAAO,MAAMC,sBAAsD;IACjEC,MAAM;IACNC,UAAU;IACVC,OAAO;IACPC,SAAS;IACTC,aAAa;IACbC,UAAU;IACVC,aAAa;IACbC,eAAe;IACfC,cAAc;IACdC,MAAM;IACNC,OAAO;IACPC,SAAS;IACTC,eAAe;AACjB,EAAE;AAEF,OAAO,MAAMC,2BAA2B;IACtCC,MAAM;IACNC,YAAY;AACd,EAAE;AAEF,MAAMC,gBAAgBlB,iBAAiBmB,cAAc,CAACC,QAAQ;AAC9D,MAAMC,kBAAkBrB,iBAAiBmB,cAAc,CAACG,UAAU;AAElE,MAAMC,kBAAkB;AAExB,MAAMC,wBAAwB7B,gBAAgB;IAC5C8B,WAAW;IACXC,OAAO;IACPC,SAAS;IACTC,mBAAmB,CAAC;;;;;;IAMlB,CAAC;IACHC,qBAAqB;IACrBC,kBAAkB;IAClBC,QAAQ,CAAC,EAAEhC,OAAOiC,eAAe,CAAC,OAAO,EAAEjC,OAAOkC,mBAAmB,CAAC,CAAC;IACvEC,cAAcnC,OAAOoC,kBAAkB;IACvCC,SAAS,CAAC,EAAErC,OAAOsC,gBAAgB,CAAC,CAAC,EAAEtC,OAAOuC,kBAAkB,CAAC,CAAC;IAClEC,WAAW;IACXC,WAAWzC,OAAO0C,mBAAmB;IACrCC,YAAY;AACd;AAEA,MAAMC,YAAY/C,WAAW;IAC3BgD,QAAQ,CAAC;I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