@fluentui-copilot/react-reference 0.9.0 → 0.10.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 +22 -1
- package/CHANGELOG.md +12 -2
- package/dist/index.d.ts +40 -191
- 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 +3 -157
- 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 +0 -5
- 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/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 +3 -155
- 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 +0 -5
- 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/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 +2 -2
- 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
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@fluentui-copilot/react-reference",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Wed,
|
|
5
|
+
"date": "Wed, 03 Apr 2024 00:23:26 GMT",
|
|
6
|
+
"tag": "@fluentui-copilot/react-reference_v0.10.0",
|
|
7
|
+
"version": "0.10.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"minor": [
|
|
10
|
+
{
|
|
11
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
12
|
+
"package": "@fluentui-copilot/react-reference",
|
|
13
|
+
"commit": "f39879814cf5225d9dcbecf32aa2038b9a0a3488",
|
|
14
|
+
"comment": "chore: Removing deprecated props and hooks that made use of old Popover pattern that was replaced by the use of the Preview component."
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "Humberto.Morimoto@microsoft.com",
|
|
18
|
+
"package": "@fluentui-copilot/react-reference",
|
|
19
|
+
"commit": "56cbae9a99e595f4b295ae07c77179d361136b2a",
|
|
20
|
+
"comment": "chore: Removing deprecated ReferenceGroup component that was replaced by useReferenceGroup utility hook."
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Wed, 13 Mar 2024 18:01:50 GMT",
|
|
6
27
|
"tag": "@fluentui-copilot/react-reference_v0.9.0",
|
|
7
28
|
"version": "0.9.0",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @fluentui-copilot/react-reference
|
|
2
2
|
|
|
3
|
-
This log was last generated on Wed,
|
|
3
|
+
This log was last generated on Wed, 03 Apr 2024 00:23:26 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [0.10.0](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.10.0)
|
|
8
|
+
|
|
9
|
+
Wed, 03 Apr 2024 00:23:26 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentui-copilot/react-reference_v0.9.0..@fluentui-copilot/react-reference_v0.10.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- chore: Removing deprecated props and hooks that made use of old Popover pattern that was replaced by the use of the Preview component. ([PR #1487](https://github.com/microsoft/fluentai/pull/1487) by Humberto.Morimoto@microsoft.com)
|
|
15
|
+
- chore: Removing deprecated ReferenceGroup component that was replaced by useReferenceGroup utility hook. ([PR #1489](https://github.com/microsoft/fluentai/pull/1489) by Humberto.Morimoto@microsoft.com)
|
|
16
|
+
|
|
7
17
|
## [0.9.0](https://github.com/microsoft/fluentai/tree/@fluentui-copilot/react-reference_v0.9.0)
|
|
8
18
|
|
|
9
|
-
Wed, 13 Mar 2024 18:
|
|
19
|
+
Wed, 13 Mar 2024 18:01:50 GMT
|
|
10
20
|
[Compare changes](https://github.com/microsoft/fluentai/compare/@fluentai/reference_v0.8.2..@fluentui-copilot/react-reference_v0.9.0)
|
|
11
21
|
|
|
12
22
|
### Minor changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,10 @@ import type { Button } from '@fluentui/react-components';
|
|
|
2
2
|
import type { ComponentProps } from '@fluentui/react-components';
|
|
3
3
|
import type { ComponentState } from '@fluentui/react-components';
|
|
4
4
|
import type { ForwardRefComponent } from '@fluentui/react-components';
|
|
5
|
-
import type { OnOpenChangeData } from '@fluentui/react-components';
|
|
6
|
-
import type { OpenPopoverEvents } from '@fluentui/react-components';
|
|
7
5
|
import type { PopoverProps } from '@fluentui/react-components';
|
|
8
|
-
import type { PopoverSurface } from '@fluentui/react-components';
|
|
9
6
|
import type { PopoverSurfaceProps } from '@fluentui/react-components';
|
|
10
7
|
import type { PopoverSurfaceSlots } from '@fluentui/react-components';
|
|
8
|
+
import type { PositioningShorthand } from '@fluentui/react-components';
|
|
11
9
|
import * as React_2 from 'react';
|
|
12
10
|
import type { Slot } from '@fluentui/react-components';
|
|
13
11
|
import type { SlotClassNames } from '@fluentui/react-components';
|
|
@@ -29,11 +27,6 @@ export declare type CitationProps = ComponentProps<Partial<CitationSlots>> & {
|
|
|
29
27
|
* Citations are inline by default with margins to separate them from inline text.
|
|
30
28
|
*/
|
|
31
29
|
block?: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Unique ID of the associated `Reference`.
|
|
34
|
-
* @deprecated No longer used.
|
|
35
|
-
*/
|
|
36
|
-
referenceId?: string;
|
|
37
30
|
};
|
|
38
31
|
|
|
39
32
|
export declare type CitationSlots = {
|
|
@@ -41,28 +34,13 @@ export declare type CitationSlots = {
|
|
|
41
34
|
* The root slot.
|
|
42
35
|
*/
|
|
43
36
|
root: NonNullable<Slot<'a'>>;
|
|
44
|
-
/**
|
|
45
|
-
* Popover slot. This will be displayed on hover/focus.
|
|
46
|
-
*
|
|
47
|
-
* @deprecated Use `Preview` component and `useReferenceCitationPreview` hook instead.
|
|
48
|
-
*/
|
|
49
|
-
popover?: Slot<'div'>;
|
|
50
|
-
/**
|
|
51
|
-
* PopoverSurface slot. This exposes the underlying PopoverSurface that is displayed on hover/focus.
|
|
52
|
-
*
|
|
53
|
-
* @deprecated Use `Preview` component and `useReferenceCitationPreview` hook instead.
|
|
54
|
-
*/
|
|
55
|
-
popoverSurface: Slot<typeof PopoverSurface>;
|
|
56
37
|
};
|
|
57
38
|
|
|
58
39
|
/**
|
|
59
40
|
* State used in rendering Citation
|
|
60
41
|
*/
|
|
61
42
|
export declare type CitationState = ComponentState<CitationSlots> & Required<Pick<CitationProps, 'block'>> & {
|
|
62
|
-
disableAutoFocus: boolean;
|
|
63
|
-
isPopoverOpen: boolean;
|
|
64
43
|
isPopoverLocked: boolean;
|
|
65
|
-
onPopoverOpenChange: (e: OpenPopoverEvents, data: OnOpenChangeData) => void;
|
|
66
44
|
};
|
|
67
45
|
|
|
68
46
|
declare type CopilotMode = {
|
|
@@ -72,82 +50,36 @@ declare type CopilotMode = {
|
|
|
72
50
|
/**
|
|
73
51
|
* A "packaged Citation". A packaged Citation is a `Citation` that is
|
|
74
52
|
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
75
|
-
*
|
|
76
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
77
53
|
*/
|
|
78
54
|
export declare type PackagedCitation = React_2.FC<PackagedCitationProps>;
|
|
79
55
|
|
|
80
|
-
/**
|
|
81
|
-
* A "packaged Citation". A packaged Citation is a `Citation` that is
|
|
82
|
-
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
83
|
-
*/
|
|
84
|
-
declare type PackagedCitation_2 = React_2.FC<PackagedCitationProps_2>;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
88
|
-
*/
|
|
89
|
-
declare type PackagedCitationPopover = React_2.FC<PackagedCitationPopoverProps>;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
93
|
-
*/
|
|
94
|
-
declare type PackagedCitationPopoverProps = Omit<PackagedReferenceProps, 'layout'>;
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Props for a "packaged Citation". A packaged Citation is a `Citation` that is
|
|
98
|
-
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
99
|
-
*
|
|
100
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
101
|
-
*/
|
|
102
|
-
export declare type PackagedCitationProps = Omit<CitationProps, PartialCitationProps> & Partial<Pick<CitationProps, PartialCitationProps>>;
|
|
103
|
-
|
|
104
56
|
/**
|
|
105
57
|
* Props for a "packaged Citation". A packaged Citation is a `Citation` that is
|
|
106
58
|
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
107
59
|
*/
|
|
108
|
-
declare type
|
|
60
|
+
export declare type PackagedCitationProps = Omit<CitationProps, 'referenceHref'> & Partial<Pick<CitationProps, 'referenceHref'>>;
|
|
109
61
|
|
|
110
62
|
/**
|
|
111
63
|
* A "packaged Reference". A packaged Reference is a `Reference` that is
|
|
112
64
|
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
113
|
-
*
|
|
114
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
115
65
|
*/
|
|
116
66
|
export declare type PackagedReference = React_2.FC<PackagedReferenceProps>;
|
|
117
67
|
|
|
118
|
-
/**
|
|
119
|
-
* A "packaged Reference". A packaged Reference is a `Reference` that is
|
|
120
|
-
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
121
|
-
*/
|
|
122
|
-
declare type PackagedReference_2 = React_2.FC<PackagedReferenceProps_2>;
|
|
123
|
-
|
|
124
68
|
/**
|
|
125
69
|
* Props for a "packaged Reference". A packaged Reference is a `Reference` that is
|
|
126
70
|
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
127
|
-
*
|
|
128
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
129
71
|
*/
|
|
130
72
|
export declare type PackagedReferenceProps = Omit<ReferenceProps, PartialReferenceProps> & Partial<Pick<ReferenceProps, PartialReferenceProps>>;
|
|
131
73
|
|
|
132
|
-
/**
|
|
133
|
-
* Props for a "packaged Reference". A packaged Reference is a `Reference` that is
|
|
134
|
-
* pre-packaged with props set by the `useReferenceCitation` hook.
|
|
135
|
-
*/
|
|
136
|
-
declare type PackagedReferenceProps_2 = Omit<ReferenceProps, PartialReferenceProps_2> & Partial<Pick<ReferenceProps, PartialReferenceProps_2>>;
|
|
137
|
-
|
|
138
|
-
declare type PartialCitationProps = 'referenceHref' | 'referenceId';
|
|
139
|
-
|
|
140
|
-
declare type PartialCitationProps_2 = 'referenceHref' | 'referenceId';
|
|
141
|
-
|
|
142
74
|
declare type PartialReferenceProps = 'citationHref' | 'index' | 'referenceId';
|
|
143
75
|
|
|
144
|
-
declare type PartialReferenceProps_2 = 'citationHref' | 'index' | 'referenceId';
|
|
145
|
-
|
|
146
76
|
/**
|
|
147
77
|
* Preview Props
|
|
148
78
|
*/
|
|
149
79
|
declare type PreviewProps = PopoverProps;
|
|
150
80
|
|
|
81
|
+
declare const PreviewSurface: ForwardRefComponent<PreviewSurfaceProps>;
|
|
82
|
+
|
|
151
83
|
/**
|
|
152
84
|
* PreviewSurface Props
|
|
153
85
|
*/
|
|
@@ -160,8 +92,6 @@ export declare const Reference: ForwardRefComponent<ReferenceProps>;
|
|
|
160
92
|
/**
|
|
161
93
|
* Data used to package a `Citation` and `Reference` together with
|
|
162
94
|
* the `useReferenceCitation` hook.
|
|
163
|
-
*
|
|
164
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
165
95
|
*/
|
|
166
96
|
export declare type ReferenceCitationData = {
|
|
167
97
|
index: number;
|
|
@@ -169,81 +99,13 @@ export declare type ReferenceCitationData = {
|
|
|
169
99
|
citationId?: string;
|
|
170
100
|
citationProps?: PackagedCitationProps;
|
|
171
101
|
referenceProps?: PackagedReferenceProps;
|
|
172
|
-
popoverProps?: PackagedCitationPopoverProps;
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Data used to package a `Citation` and `Reference` together with
|
|
177
|
-
* the `useReferenceCitation` hook.
|
|
178
|
-
*/
|
|
179
|
-
declare type ReferenceCitationData_2 = {
|
|
180
|
-
index: number;
|
|
181
|
-
referenceId?: string;
|
|
182
|
-
citationId?: string;
|
|
183
|
-
citationProps?: PackagedCitationProps_2;
|
|
184
|
-
referenceProps?: PackagedReferenceProps_2;
|
|
185
102
|
previewProps?: PreviewProps;
|
|
186
103
|
previewSurfaceProps?: PreviewSurfaceProps;
|
|
104
|
+
sensitivityLabelProps?: SensitivityLabelProps;
|
|
187
105
|
};
|
|
188
106
|
|
|
189
107
|
export declare const referenceClassNames: SlotClassNames<ReferenceSlots>;
|
|
190
108
|
|
|
191
|
-
/**
|
|
192
|
-
* ReferenceGroup component
|
|
193
|
-
* @deprecated use `useReferenceGroup` instead.
|
|
194
|
-
*/
|
|
195
|
-
export declare const ReferenceGroup: ForwardRefComponent<ReferenceGroupProps>;
|
|
196
|
-
|
|
197
|
-
export declare const referenceGroupClassNames: SlotClassNames<ReferenceGroupSlots>;
|
|
198
|
-
|
|
199
|
-
declare type ReferenceGroupContext = {
|
|
200
|
-
open?: boolean;
|
|
201
|
-
setOpen: () => void;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* ReferenceGroup Props
|
|
206
|
-
*/
|
|
207
|
-
export declare type ReferenceGroupProps = ComponentProps<Partial<ReferenceGroupSlots>, 'content'> & CopilotMode;
|
|
208
|
-
|
|
209
|
-
export declare type ReferenceGroupSlots = {
|
|
210
|
-
/**
|
|
211
|
-
* The root slot.
|
|
212
|
-
*/
|
|
213
|
-
root: NonNullable<Slot<'div'>>;
|
|
214
|
-
/**
|
|
215
|
-
* Label slot. Primary description of the group.
|
|
216
|
-
*/
|
|
217
|
-
label: NonNullable<Slot<'span'>>;
|
|
218
|
-
/**
|
|
219
|
-
* Icon slot.
|
|
220
|
-
*/
|
|
221
|
-
icon: Slot<'span'>;
|
|
222
|
-
/**
|
|
223
|
-
* Details button slot. Used to expand/collapse the group.
|
|
224
|
-
*/
|
|
225
|
-
detailsButton: NonNullable<Slot<'button'>>;
|
|
226
|
-
/**
|
|
227
|
-
* Content slot. Used to display the group's references. Visibility should be controlled by `detailsButton`.
|
|
228
|
-
*/
|
|
229
|
-
content: NonNullable<Slot<'div'>>;
|
|
230
|
-
};
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* State used in rendering ReferenceGroup
|
|
234
|
-
*/
|
|
235
|
-
export declare type ReferenceGroupState = ComponentState<ReferenceGroupSlots> & Required<Pick<ReferenceGroupProps, 'mode'>> & {
|
|
236
|
-
/**
|
|
237
|
-
* State to track if the group is open or not.
|
|
238
|
-
*/
|
|
239
|
-
isOpen: boolean;
|
|
240
|
-
/**
|
|
241
|
-
* Callback used to open the group from a child.
|
|
242
|
-
* @returns void
|
|
243
|
-
*/
|
|
244
|
-
setOpen: () => void;
|
|
245
|
-
};
|
|
246
|
-
|
|
247
109
|
export declare const ReferenceGroupToggle: ForwardRefComponent<ReferenceGroupToggleProps>;
|
|
248
110
|
|
|
249
111
|
export declare const referenceGroupToggleClassNames: SlotClassNames<ReferenceGroupToggleSlots>;
|
|
@@ -306,6 +168,9 @@ export declare type ReferenceProps = ComponentProps<Partial<ReferenceSlots>> & C
|
|
|
306
168
|
* Text snippet from the reference source.
|
|
307
169
|
*/
|
|
308
170
|
excerpt?: string;
|
|
171
|
+
/**
|
|
172
|
+
* @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`.
|
|
173
|
+
*/
|
|
309
174
|
layout?: 'inline' | 'popover';
|
|
310
175
|
};
|
|
311
176
|
|
|
@@ -334,11 +199,6 @@ export declare type ReferenceSlots = {
|
|
|
334
199
|
* Sensitivity slot. Used to display a `SensitivityLabel`.
|
|
335
200
|
*/
|
|
336
201
|
sensitivity: Slot<'span'>;
|
|
337
|
-
/**
|
|
338
|
-
* @deprecated Use `sensitivity` instead.
|
|
339
|
-
* Sensitivity label slot. Displays a label indicating how sensitive the information displayed in the reference is.
|
|
340
|
-
*/
|
|
341
|
-
sensitivityLabel: Slot<'span'>;
|
|
342
202
|
/**
|
|
343
203
|
* Metadata slot. Container for `primaryText`, `secondaryText`, `tertiaryText` and `icon`.
|
|
344
204
|
*/
|
|
@@ -389,11 +249,6 @@ export declare const renderCitation_unstable: (state: CitationState) => JSX.Elem
|
|
|
389
249
|
*/
|
|
390
250
|
export declare const renderReference_unstable: (state: ReferenceState) => JSX.Element;
|
|
391
251
|
|
|
392
|
-
/**
|
|
393
|
-
* Render the final JSX of ReferenceGroup
|
|
394
|
-
*/
|
|
395
|
-
export declare const renderReferenceGroup_unstable: (state: ReferenceGroupState, contextValues: ReferenceGroupContext) => JSX.Element;
|
|
396
|
-
|
|
397
252
|
/**
|
|
398
253
|
* Render the final JSX of ReferenceGroupToggle
|
|
399
254
|
*/
|
|
@@ -404,6 +259,36 @@ export declare const renderReferenceGroupToggle_unstable: (state: ReferenceGroup
|
|
|
404
259
|
*/
|
|
405
260
|
export declare const renderReferenceList_unstable: (state: ReferenceListState) => JSX.Element;
|
|
406
261
|
|
|
262
|
+
/**
|
|
263
|
+
* SensitivityLabel Props
|
|
264
|
+
*/
|
|
265
|
+
declare type SensitivityLabelProps = ComponentProps<SensitivityLabelSlots> & {
|
|
266
|
+
description: string;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
declare type SensitivityLabelSlots = {
|
|
270
|
+
root: Slot<'span'>;
|
|
271
|
+
label?: Slot<'span'>;
|
|
272
|
+
tooltip?: Slot<typeof SensitivityTooltip>;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
declare const SensitivityTooltip: ForwardRefComponent<SensitivityTooltipProps>;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* SensitivityTooltip Props
|
|
279
|
+
*/
|
|
280
|
+
declare type SensitivityTooltipProps = ComponentProps<SensitivityTooltipSlots> & {
|
|
281
|
+
positioning?: PositioningShorthand;
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
declare type SensitivityTooltipSlots = {
|
|
285
|
+
root: Slot<'span'>;
|
|
286
|
+
heading?: Slot<'span'>;
|
|
287
|
+
message?: Slot<'span'>;
|
|
288
|
+
previewSurface?: Slot<typeof PreviewSurface>;
|
|
289
|
+
trigger?: Slot<'span'>;
|
|
290
|
+
};
|
|
291
|
+
|
|
407
292
|
/**
|
|
408
293
|
* Create the state required to render Citation.
|
|
409
294
|
*
|
|
@@ -413,7 +298,7 @@ export declare const renderReferenceList_unstable: (state: ReferenceListState) =
|
|
|
413
298
|
* @param props - props from this instance of Citation
|
|
414
299
|
* @param ref - reference to root HTMLElement of Citation
|
|
415
300
|
*/
|
|
416
|
-
export declare const useCitation_unstable: (props: CitationProps, ref:
|
|
301
|
+
export declare const useCitation_unstable: (props: CitationProps, ref: React.Ref<HTMLElement>) => CitationState;
|
|
417
302
|
|
|
418
303
|
/**
|
|
419
304
|
* Apply styling to the Citation slots based on the state
|
|
@@ -431,29 +316,9 @@ export declare const useCitationStyles_unstable: (state: CitationState) => Citat
|
|
|
431
316
|
*/
|
|
432
317
|
export declare const useReference_unstable: (props: ReferenceProps, ref: React_2.Ref<HTMLElement>) => ReferenceState;
|
|
433
318
|
|
|
434
|
-
|
|
435
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
436
|
-
*/
|
|
437
|
-
export declare type UseReferenceCitation = (data: ReferenceCitationData) => {
|
|
319
|
+
export declare type UseReferenceCitationPreview = (data: ReferenceCitationData) => {
|
|
438
320
|
Citation: PackagedCitation;
|
|
439
321
|
Reference: PackagedReference;
|
|
440
|
-
Popover: PackagedCitationPopover;
|
|
441
|
-
};
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Hook to package a `Citation` and `Reference` together in an
|
|
445
|
-
* accessibly by default manner.
|
|
446
|
-
*
|
|
447
|
-
* When using citations and references, prefer using them via this
|
|
448
|
-
* hook to ensure props are wired up correctly.
|
|
449
|
-
*
|
|
450
|
-
* @deprecated Use `useReferenceCitationPreview` hook instead.
|
|
451
|
-
*/
|
|
452
|
-
export declare const useReferenceCitation: UseReferenceCitation;
|
|
453
|
-
|
|
454
|
-
export declare type UseReferenceCitationPreview = (data: ReferenceCitationData_2) => {
|
|
455
|
-
Citation: PackagedCitation_2;
|
|
456
|
-
Reference: PackagedReference_2;
|
|
457
322
|
};
|
|
458
323
|
|
|
459
324
|
/**
|
|
@@ -479,26 +344,10 @@ export declare type UseReferenceGroup = (props: UseReferenceGroupProps) => {
|
|
|
479
344
|
*/
|
|
480
345
|
export declare const useReferenceGroup: UseReferenceGroup;
|
|
481
346
|
|
|
482
|
-
/**
|
|
483
|
-
* Create the state required to render ReferenceGroup.
|
|
484
|
-
*
|
|
485
|
-
* The returned state can be modified with hooks such as useReferenceGroupStyles_unstable,
|
|
486
|
-
* before being passed to renderReferenceGroup_unstable.
|
|
487
|
-
*
|
|
488
|
-
* @param props - props from this instance of ReferenceGroup
|
|
489
|
-
* @param ref - reference to root HTMLElement of ReferenceGroup
|
|
490
|
-
*/
|
|
491
|
-
export declare const useReferenceGroup_unstable: (props: ReferenceGroupProps, ref: React_2.Ref<HTMLElement>) => ReferenceGroupState;
|
|
492
|
-
|
|
493
347
|
export declare type UseReferenceGroupProps = {
|
|
494
348
|
referenceListId?: string;
|
|
495
349
|
};
|
|
496
350
|
|
|
497
|
-
/**
|
|
498
|
-
* Apply styling to the ReferenceGroup slots based on the state
|
|
499
|
-
*/
|
|
500
|
-
export declare const useReferenceGroupStyles_unstable: (state: ReferenceGroupState) => ReferenceGroupState;
|
|
501
|
-
|
|
502
351
|
/**
|
|
503
352
|
* Create the state required to render ReferenceGroupToggle.
|
|
504
353
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Citation.types.ts"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"sources":["Citation.types.ts"],"sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-components';\n\nexport type CitationSlots = {\n /**\n * The root slot.\n */\n root: NonNullable<Slot<'a'>>;\n};\n\n/**\n * Citation Props\n */\nexport type CitationProps = ComponentProps<Partial<CitationSlots>> & {\n /**\n * HREF to the associated `Reference`.\n */\n referenceHref?: string;\n\n /**\n * Whether the citation is a block citation and has no built in margins.\n * Citations are inline by default with margins to separate them from inline text.\n */\n block?: boolean;\n};\n\n/**\n * State used in rendering Citation\n */\nexport type CitationState = ComponentState<CitationSlots> &\n Required<Pick<CitationProps, 'block'>> & {\n isPopoverLocked: boolean;\n };\n"],"names":[],"mappings":"AAAA,WA+BI"}
|
|
@@ -1,29 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import {
|
|
3
|
-
const popoverPositioning = {
|
|
4
|
-
overflowBoundaryPadding: 4,
|
|
5
|
-
position: 'below'
|
|
6
|
-
};
|
|
1
|
+
import { jsx as _jsx } from "@fluentui/react-jsx-runtime/jsx-runtime";
|
|
2
|
+
import { assertSlots } from '@fluentui/react-components';
|
|
7
3
|
/**
|
|
8
4
|
* Render the final JSX of Citation
|
|
9
5
|
*/
|
|
10
6
|
export const renderCitation_unstable = state => {
|
|
11
7
|
assertSlots(state);
|
|
12
|
-
return
|
|
13
|
-
closeOnScroll: true,
|
|
14
|
-
onOpenChange: state.onPopoverOpenChange,
|
|
15
|
-
open: state.isPopoverOpen,
|
|
16
|
-
positioning: popoverPositioning,
|
|
17
|
-
size: "small",
|
|
18
|
-
trapFocus: true,
|
|
19
|
-
unstable_disableAutoFocus: state.disableAutoFocus,
|
|
20
|
-
withArrow: true,
|
|
21
|
-
children: [/*#__PURE__*/_jsx(PopoverTrigger, {
|
|
22
|
-
disableButtonEnhancement: true,
|
|
23
|
-
children: /*#__PURE__*/_jsx(state.root, {})
|
|
24
|
-
}), /*#__PURE__*/_jsx(state.popoverSurface, {
|
|
25
|
-
children: /*#__PURE__*/_jsx(state.popover, {})
|
|
26
|
-
})]
|
|
27
|
-
}) : /*#__PURE__*/_jsx(state.root, {});
|
|
8
|
+
return /*#__PURE__*/_jsx(state.root, {});
|
|
28
9
|
};
|
|
29
10
|
//# sourceMappingURL=renderCitation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport {
|
|
1
|
+
{"version":3,"sources":["renderCitation.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-components';\nimport type { CitationState, CitationSlots } from './Citation.types';\n/**\n * Render the final JSX of Citation\n */\nexport const renderCitation_unstable = (state: CitationState) => {\n assertSlots<CitationSlots>(state);\n\n return <state.root />;\n};\n"],"names":["assertSlots","renderCitation_unstable","state","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,6BAA6B;AAEzD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtCF,YAA2BE;IAE3B,qBAAO,KAACA,MAAMC,IAAI;AACpB,EAAE"}
|
|
@@ -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 { getNativeElementProps, 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,137 +11,16 @@ 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
25
|
root: slot.always(getNativeElementProps('a', {
|
|
158
26
|
ref,
|
|
@@ -162,30 +30,8 @@ export const useCitation_unstable = (props, ref) => {
|
|
|
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
|