@devsym/graph-toolkit-react 0.1.0-next.2 → 1.0.0-next.11
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/AGENTS.md +171 -0
- package/dist/components/People/People.d.ts +16 -0
- package/dist/components/People/People.d.ts.map +1 -0
- package/dist/components/People/People.types.d.ts +55 -0
- package/dist/components/People/People.types.d.ts.map +1 -0
- package/dist/components/People/index.d.ts +6 -0
- package/dist/components/People/index.d.ts.map +1 -0
- package/dist/components/PeoplePicker/PeoplePicker.d.ts +24 -0
- package/dist/components/PeoplePicker/PeoplePicker.d.ts.map +1 -0
- package/dist/components/PeoplePicker/PeoplePicker.types.d.ts +57 -0
- package/dist/components/PeoplePicker/PeoplePicker.types.d.ts.map +1 -0
- package/dist/components/PeoplePicker/index.d.ts +6 -0
- package/dist/components/PeoplePicker/index.d.ts.map +1 -0
- package/dist/components/Person/Person.d.ts.map +1 -1
- package/dist/components/Person/Person.types.d.ts +148 -21
- package/dist/components/Person/Person.types.d.ts.map +1 -1
- package/dist/components/Person/index.d.ts +1 -1
- package/dist/components/Person/index.d.ts.map +1 -1
- package/dist/hooks/usePeopleList.d.ts +62 -0
- package/dist/hooks/usePeopleList.d.ts.map +1 -0
- package/dist/hooks/usePeopleSearch.d.ts +42 -0
- package/dist/hooks/usePeopleSearch.d.ts.map +1 -0
- package/dist/hooks/usePersonData.d.ts +1 -0
- package/dist/hooks/usePersonData.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.mjs +1437 -306
- package/dist/providers/IPersonDataProvider.d.ts +116 -0
- package/dist/providers/IPersonDataProvider.d.ts.map +1 -0
- package/dist/providers/IProvider.d.ts +1 -5
- package/dist/providers/IProvider.d.ts.map +1 -1
- package/dist/providers/MockProvider.d.ts +4 -1
- package/dist/providers/MockProvider.d.ts.map +1 -1
- package/dist/providers/MsalBrowserProvider.d.ts +14 -2
- package/dist/providers/MsalBrowserProvider.d.ts.map +1 -1
- package/dist/providers/ProviderContext.d.ts +6 -0
- package/dist/providers/ProviderContext.d.ts.map +1 -1
- package/dist/providers/TeamsHostedProvider.d.ts +1 -1
- package/dist/providers/TeamsHostedProvider.d.ts.map +1 -1
- package/dist/providers/mockAvatarData.d.ts +5 -0
- package/dist/providers/mockAvatarData.d.ts.map +1 -0
- package/dist/utils/graph.d.ts +17 -0
- package/dist/utils/graph.d.ts.map +1 -1
- package/dist/utils/personCache.d.ts +24 -0
- package/dist/utils/personCache.d.ts.map +1 -0
- package/package.json +13 -5
- package/readme.md +119 -19
package/AGENTS.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# AGENTS.md — Graph Toolkit React
|
|
2
|
+
|
|
3
|
+
This file is for coding agents that consume `@devsym/graph-toolkit-react`.
|
|
4
|
+
Use this as the primary quick reference for implementation choices.
|
|
5
|
+
|
|
6
|
+
## Package
|
|
7
|
+
|
|
8
|
+
- Package name: `@devsym/graph-toolkit-react`
|
|
9
|
+
- Peer deps: `react`, `react-dom`, `@fluentui/react-components`
|
|
10
|
+
- Optional peer dep: `@azure/msal-browser` (required only for `MsalBrowserProvider`)
|
|
11
|
+
|
|
12
|
+
Install:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @devsym/graph-toolkit-react react react-dom @fluentui/react-components
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If using browser MSAL auth:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @azure/msal-browser
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Scenario Decision Matrix
|
|
25
|
+
|
|
26
|
+
Choose one provider and wire it into `GraphProvider`.
|
|
27
|
+
|
|
28
|
+
| Scenario | Use | Why |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| Local development / UI prototyping | `MockProvider` | No auth setup; deterministic mock data |
|
|
31
|
+
| Browser-hosted app (SPA) with Entra/MSA sign-in | `MsalBrowserProvider` | Native browser MSAL flow |
|
|
32
|
+
| Microsoft Teams-hosted app with consumer-managed Teams auth | `TeamsHostedProvider` | Reuses existing Teams token acquisition + backend exchange |
|
|
33
|
+
| Existing custom auth stack | Custom `IProvider` implementation | Full control over token source and lifecycle |
|
|
34
|
+
|
|
35
|
+
## Minimal Patterns
|
|
36
|
+
|
|
37
|
+
### 1) MockProvider (fastest start)
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { FluentProvider, webLightTheme } from '@fluentui/react-components';
|
|
41
|
+
import { GraphProvider, MockProvider, Person } from '@devsym/graph-toolkit-react';
|
|
42
|
+
|
|
43
|
+
const provider = new MockProvider();
|
|
44
|
+
|
|
45
|
+
export function App() {
|
|
46
|
+
return (
|
|
47
|
+
<FluentProvider theme={webLightTheme}>
|
|
48
|
+
<GraphProvider provider={provider}>
|
|
49
|
+
<Person userId="AdeleV@contoso.com" view="twolines" showPresence />
|
|
50
|
+
</GraphProvider>
|
|
51
|
+
</FluentProvider>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 2) Browser SPA with MSAL (`MsalBrowserProvider`)
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { PublicClientApplication } from '@azure/msal-browser';
|
|
60
|
+
import { GraphProvider, MsalBrowserProvider, Person } from '@devsym/graph-toolkit-react';
|
|
61
|
+
|
|
62
|
+
const msal = new PublicClientApplication({
|
|
63
|
+
auth: {
|
|
64
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
65
|
+
authority: 'https://login.microsoftonline.com/common',
|
|
66
|
+
redirectUri: window.location.origin,
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const provider = new MsalBrowserProvider(msal, ['User.Read']);
|
|
71
|
+
await provider.initialize();
|
|
72
|
+
|
|
73
|
+
export function App() {
|
|
74
|
+
return (
|
|
75
|
+
<GraphProvider provider={provider}>
|
|
76
|
+
<Person userId="me" view="threelines" />
|
|
77
|
+
</GraphProvider>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The provider uses redirect flow. Set the redirect URI to your app's origin and register it as a **Single-page application (SPA)** in Azure AD.
|
|
83
|
+
|
|
84
|
+
### 3) Teams-hosted app (`TeamsHostedProvider`)
|
|
85
|
+
|
|
86
|
+
```tsx
|
|
87
|
+
import {
|
|
88
|
+
createBackendTokenExchange,
|
|
89
|
+
GraphProvider,
|
|
90
|
+
Person,
|
|
91
|
+
TeamsHostedProvider,
|
|
92
|
+
} from '@devsym/graph-toolkit-react';
|
|
93
|
+
import { authentication } from '@microsoft/teams-js';
|
|
94
|
+
|
|
95
|
+
const exchangeForGraphToken = createBackendTokenExchange({
|
|
96
|
+
endpoint: '/api/token/exchange',
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const provider = new TeamsHostedProvider({
|
|
100
|
+
defaultScopes: ['User.Read'],
|
|
101
|
+
getTeamsSsoToken: async scopes => authentication.getAuthToken({ resources: scopes }),
|
|
102
|
+
exchangeForGraphToken,
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
await provider.login();
|
|
106
|
+
|
|
107
|
+
export function App() {
|
|
108
|
+
return (
|
|
109
|
+
<GraphProvider provider={provider}>
|
|
110
|
+
<Person userId="me" view="threelines" />
|
|
111
|
+
</GraphProvider>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### 4) Custom auth (`IProvider`)
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import { IProvider, ProviderState } from '@devsym/graph-toolkit-react';
|
|
120
|
+
|
|
121
|
+
export class MyProvider implements IProvider {
|
|
122
|
+
state: ProviderState = 'SignedOut';
|
|
123
|
+
|
|
124
|
+
async login(): Promise<void> {
|
|
125
|
+
this.state = 'SignedIn';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async logout(): Promise<void> {
|
|
129
|
+
this.state = 'SignedOut';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async getAccessToken(): Promise<string> {
|
|
133
|
+
return 'ACCESS_TOKEN';
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Scopes by Feature
|
|
139
|
+
|
|
140
|
+
| Feature | Minimum delegated scope | Notes |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| Current user profile (`userId="me"`) | `User.Read` | Required for basic profile fields |
|
|
143
|
+
| Other user profile (`userId="{id/upn}"`) | `User.ReadBasic.All` | May require admin consent |
|
|
144
|
+
| People default suggestions | `User.ReadBasic.All` | Used for the initial `/users` directory list when no explicit people source is provided |
|
|
145
|
+
| PeoplePicker focus suggestions | `User.ReadBasic.All` | Uses the initial `/users` directory list shown before typing |
|
|
146
|
+
| Presence (`showPresence`) | `Presence.Read` | UI still renders without presence |
|
|
147
|
+
| Profile photo (`fetchImage`) | `User.Read` | Falls back to initials if unavailable |
|
|
148
|
+
|
|
149
|
+
## Common Failures and Fixes
|
|
150
|
+
|
|
151
|
+
| Symptom | Likely Cause | Action |
|
|
152
|
+
| --- | --- | --- |
|
|
153
|
+
| Redirect URI mismatch / `AADSTS50011` | App registration redirect URI does not match dev URL | Add exact SPA redirect URI used by local dev server |
|
|
154
|
+
| Person stays loading | Provider not initialized / login not completed | Ensure `await provider.initialize()` (MSAL) or `await provider.login()` (Teams/custom) before rendering |
|
|
155
|
+
| Presence missing | `Presence.Read` not granted | Add and consent to `Presence.Read`; keep graceful fallback |
|
|
156
|
+
| `Cannot find module '@azure/msal-browser'` | Using `MsalBrowserProvider` without optional peer dependency installed | Install `@azure/msal-browser` |
|
|
157
|
+
|
|
158
|
+
## Agent Rules
|
|
159
|
+
|
|
160
|
+
- Choose the simplest provider that fits the host environment.
|
|
161
|
+
- Keep scopes minimal and feature-driven.
|
|
162
|
+
- Prefer `userId="me"` for first implementation; expand to other users only when needed.
|
|
163
|
+
- Wrap components with `GraphProvider`; avoid direct token handling in UI components.
|
|
164
|
+
- If uncertain, default to `MockProvider` for local iteration, then switch to real auth provider.
|
|
165
|
+
|
|
166
|
+
## Source of Truth
|
|
167
|
+
|
|
168
|
+
- Primary docs: `README.md`
|
|
169
|
+
- Migration guide: `docs/MGT_MIGRATION.md`
|
|
170
|
+
- MSAL sample: `samples/react-msal-sample/README.md`
|
|
171
|
+
- API exports and types: package root `dist/index.d.ts` in published artifact
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* People component - Display a compact group of people as overlapping avatars
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { PeopleProps } from './People.types';
|
|
6
|
+
/**
|
|
7
|
+
* `People` renders a compact avatar strip similar to the MGT `mgt-people` control.
|
|
8
|
+
*
|
|
9
|
+
* The component can render a supplied list of people, resolve a list of `userIds`, load
|
|
10
|
+
* group members, or default to tenant directory users from `/users`.
|
|
11
|
+
*
|
|
12
|
+
* @param props - Avatar group configuration and people-loading options
|
|
13
|
+
* @returns A compact avatar group, a loading spinner, or `null` when no people are available
|
|
14
|
+
*/
|
|
15
|
+
export declare const People: React.FC<PeopleProps>;
|
|
16
|
+
//# sourceMappingURL=People.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"People.d.ts","sourceRoot":"","sources":["../../../src/components/People/People.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,EAAgB,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA6C3D;;;;;;;;GAQG;AACH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAwCxC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* People component types
|
|
3
|
+
*/
|
|
4
|
+
import type { AvatarGroupProps } from '@fluentui/react-components';
|
|
5
|
+
import type { PeopleSearchResult } from '../../providers/IPersonDataProvider';
|
|
6
|
+
/**
|
|
7
|
+
* A person entry rendered by the {@link People} component.
|
|
8
|
+
*
|
|
9
|
+
* This extends the base people search result shape with optional presence fields used
|
|
10
|
+
* for avatar badges when {@link PeopleProps.showPresence} is enabled.
|
|
11
|
+
*/
|
|
12
|
+
export interface PeoplePerson extends PeopleSearchResult {
|
|
13
|
+
/**
|
|
14
|
+
* Current presence activity when available.
|
|
15
|
+
*/
|
|
16
|
+
presenceActivity?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Current presence availability when available.
|
|
19
|
+
*/
|
|
20
|
+
presenceAvailability?: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Props for the {@link People} component.
|
|
24
|
+
*/
|
|
25
|
+
export interface PeopleProps extends Omit<AvatarGroupProps, 'children'> {
|
|
26
|
+
/**
|
|
27
|
+
* A pre-resolved list of people to render.
|
|
28
|
+
*
|
|
29
|
+
* When provided, the component skips list discovery and renders these people directly.
|
|
30
|
+
*/
|
|
31
|
+
people?: PeoplePerson[];
|
|
32
|
+
/**
|
|
33
|
+
* A list of user identifiers to resolve and render.
|
|
34
|
+
*
|
|
35
|
+
* Values can be Microsoft Graph user IDs, UPNs, email addresses, or `"me"`.
|
|
36
|
+
*/
|
|
37
|
+
userIds?: string[];
|
|
38
|
+
/**
|
|
39
|
+
* The ID of a Microsoft Entra ID group whose direct user members should be rendered.
|
|
40
|
+
*/
|
|
41
|
+
groupId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of visible avatars before the remaining people are shown in overflow.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to `3`, matching the MGT `mgt-people` control.
|
|
46
|
+
*/
|
|
47
|
+
showMax?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Whether presence badges should be shown on each avatar.
|
|
50
|
+
*
|
|
51
|
+
* Presence is loaded when the active provider and granted scopes support it.
|
|
52
|
+
*/
|
|
53
|
+
showPresence?: boolean;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=People.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"People.types.d.ts","sourceRoot":"","sources":["../../../src/components/People/People.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,kBAAkB;IACtD;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IACrE;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IAExB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/People/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PeoplePicker component - Select one or more people using Microsoft Graph search
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { PeoplePickerProps } from './PeoplePicker.types';
|
|
6
|
+
/**
|
|
7
|
+
* PeoplePicker — a tag-picker backed by Microsoft Graph people search.
|
|
8
|
+
*
|
|
9
|
+
* In controlled mode supply `selectedPeople` + `onSelectionChange`.
|
|
10
|
+
* In uncontrolled mode supply `defaultSelectedPeople` or leave both props unset.
|
|
11
|
+
*
|
|
12
|
+
* The component automatically uses {@link MockProvider} mock data when no real
|
|
13
|
+
* Graph provider is available, making it easy to prototype UIs without auth.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <PeoplePicker
|
|
18
|
+
* placeholder="Search for people..."
|
|
19
|
+
* onSelectionChange={(people) => console.log(people)}
|
|
20
|
+
* />
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare const PeoplePicker: React.FC<PeoplePickerProps>;
|
|
24
|
+
//# sourceMappingURL=PeoplePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeoplePicker.d.ts","sourceRoot":"","sources":["../../../src/components/PeoplePicker/PeoplePicker.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAyC,MAAM,OAAO,CAAC;AAkB9D,OAAO,EAAsB,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAyD7E;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAyJpD,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PeoplePicker component types
|
|
3
|
+
*/
|
|
4
|
+
import type { TagPickerProps } from '@fluentui/react-components';
|
|
5
|
+
import type { PeopleSearchResult } from '../../providers/IPersonDataProvider';
|
|
6
|
+
/**
|
|
7
|
+
* A person entry used in the PeoplePicker component.
|
|
8
|
+
*
|
|
9
|
+
* This is an alias for {@link PeopleSearchResult} — both types share the same shape
|
|
10
|
+
* so they can be used interchangeably.
|
|
11
|
+
*/
|
|
12
|
+
export type PeoplePickerPerson = PeopleSearchResult;
|
|
13
|
+
/**
|
|
14
|
+
* Props for the {@link PeoplePicker} component.
|
|
15
|
+
*/
|
|
16
|
+
export interface PeoplePickerProps extends Pick<TagPickerProps, 'appearance' | 'size' | 'disabled'> {
|
|
17
|
+
/**
|
|
18
|
+
* Currently selected people (controlled mode).
|
|
19
|
+
* When provided, the component operates in controlled mode and does not manage its own selection state.
|
|
20
|
+
*/
|
|
21
|
+
selectedPeople?: PeoplePickerPerson[];
|
|
22
|
+
/**
|
|
23
|
+
* Initial selected people (uncontrolled mode).
|
|
24
|
+
* Ignored when {@link selectedPeople} is provided.
|
|
25
|
+
*/
|
|
26
|
+
defaultSelectedPeople?: PeoplePickerPerson[];
|
|
27
|
+
/**
|
|
28
|
+
* Called when the selection changes.
|
|
29
|
+
* @param people - The new array of selected people
|
|
30
|
+
*/
|
|
31
|
+
onSelectionChange?: (people: PeoplePickerPerson[]) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Placeholder text shown in the search input when nothing is typed
|
|
34
|
+
*/
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of people that can be selected.
|
|
38
|
+
* When reached the search input is hidden.
|
|
39
|
+
*/
|
|
40
|
+
maxPeople?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Minimum number of characters required before a search is triggered (default: 1)
|
|
43
|
+
*/
|
|
44
|
+
searchMinChars?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Maximum number of search results to show in the dropdown (default: 10)
|
|
47
|
+
*/
|
|
48
|
+
maxSearchResults?: number;
|
|
49
|
+
/**
|
|
50
|
+
* User IDs to exclude from search results.
|
|
51
|
+
* When provided, these IDs will be filtered out of the dropdown suggestions.
|
|
52
|
+
* The search will fetch extra results to compensate so that the dropdown still
|
|
53
|
+
* shows up to {@link maxSearchResults} items after exclusion.
|
|
54
|
+
*/
|
|
55
|
+
excludeUserIds?: string[];
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=PeoplePicker.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PeoplePicker.types.d.ts","sourceRoot":"","sources":["../../../src/components/PeoplePicker/PeoplePicker.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAEpD;;GAEG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,YAAY,GAAG,MAAM,GAAG,UAAU,CAAC;IAChE;;;OAGG;IACH,cAAc,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAEtC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAE7C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,EAAE,KAAK,IAAI,CAAC;IAE3D;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PeoplePicker/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Person.d.ts","sourceRoot":"","sources":["../../../src/components/Person/Person.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,
|
|
1
|
+
{"version":3,"file":"Person.d.ts","sourceRoot":"","sources":["../../../src/components/Person/Person.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAA8D,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAsHrH,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAyHxC,CAAC"}
|
|
@@ -1,35 +1,162 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Person component types
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import {
|
|
6
|
-
export type PersonView = 'avatar' | 'oneline' | 'twolines' | 'threelines';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
import type { PersonaProps } from '@fluentui/react-components';
|
|
5
|
+
import type { ReactElement } from 'react';
|
|
6
|
+
export type PersonView = 'avatar' | 'oneline' | 'twolines' | 'threelines' | 'fourlines';
|
|
7
|
+
/**
|
|
8
|
+
* Normalized details about a person used by the {@link Person} component.
|
|
9
|
+
*
|
|
10
|
+
* This interface typically comes from Microsoft Graph or an application-specific user store
|
|
11
|
+
* and is used as the backing data for line mappings and custom renderers.
|
|
12
|
+
*/
|
|
10
13
|
export interface PersonDetails {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The person's display name.
|
|
16
|
+
*/
|
|
17
|
+
displayName?: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* The person's primary mail address (as returned by some Microsoft Graph shapes).
|
|
20
|
+
*/
|
|
21
|
+
mail?: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The person's job title.
|
|
24
|
+
*/
|
|
25
|
+
jobTitle?: string | null;
|
|
26
|
+
/**
|
|
27
|
+
* The department the person belongs to.
|
|
28
|
+
*/
|
|
29
|
+
department?: string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The person's office location.
|
|
32
|
+
*/
|
|
33
|
+
officeLocation?: string | null;
|
|
34
|
+
/**
|
|
35
|
+
* The unique identifier for the person.
|
|
36
|
+
*/
|
|
37
|
+
id?: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* The person's user principal name (UPN).
|
|
40
|
+
*/
|
|
41
|
+
userPrincipalName?: string | null;
|
|
42
|
+
/**
|
|
43
|
+
* The person's email address (alias for some data sources).
|
|
44
|
+
*/
|
|
45
|
+
email?: string | null;
|
|
46
|
+
/**
|
|
47
|
+
* Current presence activity (for example, "InAMeeting" or "Presenting"), when available.
|
|
48
|
+
*/
|
|
49
|
+
presenceActivity?: string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Current presence availability (for example, "Available", "Busy", "Away"), when available.
|
|
52
|
+
*/
|
|
53
|
+
presenceAvailability?: string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Additional custom fields for the person.
|
|
56
|
+
*
|
|
57
|
+
* These fields can also be referenced from `lineXProperty` mappings when supported by the implementation.
|
|
58
|
+
*/
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Context passed to a {@link PersonLineRenderer} when rendering a line of text.
|
|
63
|
+
*/
|
|
64
|
+
export interface PersonLineRenderContext {
|
|
65
|
+
/**
|
|
66
|
+
* The logical line number being rendered (1–4).
|
|
67
|
+
*/
|
|
68
|
+
line: 1 | 2 | 3 | 4;
|
|
69
|
+
/**
|
|
70
|
+
* The resolved person details used for this line.
|
|
71
|
+
*/
|
|
72
|
+
person: PersonDetails;
|
|
73
|
+
/**
|
|
74
|
+
* The default text that would be rendered for this line based on the `lineXProperty` mapping,
|
|
75
|
+
* if any. This can be used as a fallback or starting point when customizing rendering.
|
|
76
|
+
*/
|
|
77
|
+
text?: string;
|
|
18
78
|
}
|
|
19
|
-
|
|
79
|
+
/**
|
|
80
|
+
* Function used to customize rendering of a single line of person information.
|
|
81
|
+
*
|
|
82
|
+
* The renderer can either return a `ReactElement` for full control over layout and styling,
|
|
83
|
+
* a plain `string` to be rendered as simple text, or `null` to suppress rendering of the line.
|
|
84
|
+
*
|
|
85
|
+
* @param context - Information about the line being rendered and its resolved data.
|
|
86
|
+
* @returns A React element, plain string, or `null` to skip the line.
|
|
87
|
+
*/
|
|
88
|
+
export type PersonLineRenderer = (context: PersonLineRenderContext) => ReactElement | string | null;
|
|
89
|
+
export interface PersonProps extends PersonaProps {
|
|
20
90
|
userId?: string;
|
|
21
91
|
userPrincipalName?: string;
|
|
22
92
|
email?: string;
|
|
23
93
|
personDetails?: PersonDetails;
|
|
24
94
|
view?: PersonView;
|
|
25
95
|
showPresence?: boolean;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Mapping for the first text line.
|
|
98
|
+
*
|
|
99
|
+
* This is the name of a field on {@link PersonDetails} (for example, `"displayName"`), or a
|
|
100
|
+
* comma-separated list of field names to use as fallbacks in order (for example,
|
|
101
|
+
* `"displayName,mail,email"`).
|
|
102
|
+
*
|
|
103
|
+
* Implementations may also support pseudo-fields for derived values such as presence in
|
|
104
|
+
* addition to literal `PersonDetails` keys.
|
|
105
|
+
*/
|
|
106
|
+
line1Property?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Mapping for the second text line.
|
|
109
|
+
*
|
|
110
|
+
* Accepts a single {@link PersonDetails} field name or a comma-separated list of field names
|
|
111
|
+
* to be used as fallbacks, in the same way as {@link PersonProps.line1Property}.
|
|
112
|
+
*/
|
|
113
|
+
line2Property?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Mapping for the third text line.
|
|
116
|
+
*
|
|
117
|
+
* Accepts a single {@link PersonDetails} field name or a comma-separated list of field names
|
|
118
|
+
* to be used as fallbacks, in the same way as {@link PersonProps.line1Property}.
|
|
119
|
+
*/
|
|
120
|
+
line3Property?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Mapping for the fourth text line.
|
|
123
|
+
*
|
|
124
|
+
* Accepts a single {@link PersonDetails} field name or a comma-separated list of field names
|
|
125
|
+
* to be used as fallbacks, in the same way as {@link PersonProps.line1Property}.
|
|
126
|
+
*/
|
|
127
|
+
line4Property?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Custom renderer for the first text line.
|
|
130
|
+
*
|
|
131
|
+
* When provided, this overrides the default rendering for line 1 and is called with a
|
|
132
|
+
* {@link PersonLineRenderContext}. The `text` property in the context contains the value that
|
|
133
|
+
* would have been shown based on `line1Property`, if any.
|
|
134
|
+
*/
|
|
135
|
+
renderLine1?: PersonLineRenderer;
|
|
136
|
+
/**
|
|
137
|
+
* Custom renderer for the second text line.
|
|
138
|
+
*
|
|
139
|
+
* When provided, this overrides the default rendering for line 2 and is called with a
|
|
140
|
+
* {@link PersonLineRenderContext}. The `text` property in the context contains the value that
|
|
141
|
+
* would have been shown based on `line2Property`, if any.
|
|
142
|
+
*/
|
|
143
|
+
renderLine2?: PersonLineRenderer;
|
|
144
|
+
/**
|
|
145
|
+
* Custom renderer for the third text line.
|
|
146
|
+
*
|
|
147
|
+
* When provided, this overrides the default rendering for line 3 and is called with a
|
|
148
|
+
* {@link PersonLineRenderContext}. The `text` property in the context contains the value that
|
|
149
|
+
* would have been shown based on `line3Property`, if any.
|
|
150
|
+
*/
|
|
151
|
+
renderLine3?: PersonLineRenderer;
|
|
152
|
+
/**
|
|
153
|
+
* Custom renderer for the fourth text line.
|
|
154
|
+
*
|
|
155
|
+
* When provided, this overrides the default rendering for line 4 and is called with a
|
|
156
|
+
* {@link PersonLineRenderContext}. The `text` property in the context contains the value that
|
|
157
|
+
* would have been shown based on `line4Property`, if any.
|
|
158
|
+
*/
|
|
159
|
+
renderLine4?: PersonLineRenderer;
|
|
30
160
|
fetchImage?: boolean;
|
|
31
|
-
onClick?: (person: User) => void;
|
|
32
|
-
className?: string;
|
|
33
|
-
style?: CSSProperties;
|
|
34
161
|
}
|
|
35
162
|
//# sourceMappingURL=Person.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Person.types.d.ts","sourceRoot":"","sources":["../../../src/components/Person/Person.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Person.types.d.ts","sourceRoot":"","sources":["../../../src/components/Person/Person.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,WAAW,CAAC;AAExF;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;OAIG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACpB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,uBAAuB,KAAK,YAAY,GAAG,MAAM,GAAG,IAAI,CAAC;AAEpG,MAAM,WAAW,WAAY,SAAQ,YAAY;IAE/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IAGf,aAAa,CAAC,EAAE,aAAa,CAAC;IAG9B,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAGjC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Person/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Person/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EACV,uBAAuB,EACvB,kBAAkB,EAClB,WAAW,GACZ,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to load a list of people from Microsoft Graph or a compatible provider
|
|
3
|
+
*/
|
|
4
|
+
import type { PeoplePerson } from '../components/People/People.types';
|
|
5
|
+
/**
|
|
6
|
+
* Options for the {@link usePeopleList} hook.
|
|
7
|
+
*/
|
|
8
|
+
export interface UsePeopleListOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Pre-resolved people to render directly.
|
|
11
|
+
*/
|
|
12
|
+
people?: PeoplePerson[];
|
|
13
|
+
/**
|
|
14
|
+
* User identifiers to resolve into person entries.
|
|
15
|
+
*/
|
|
16
|
+
userIds?: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Group ID whose direct members should be loaded.
|
|
19
|
+
*/
|
|
20
|
+
groupId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Maximum number of people to load for Graph-backed list queries.
|
|
23
|
+
*
|
|
24
|
+
* Ignored when {@link userIds} or direct {@link people} are provided.
|
|
25
|
+
*/
|
|
26
|
+
maxPeople?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Whether presence information should be loaded when supported.
|
|
29
|
+
*/
|
|
30
|
+
showPresence?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Result returned by the {@link usePeopleList} hook.
|
|
34
|
+
*/
|
|
35
|
+
export interface UsePeopleListResult {
|
|
36
|
+
/**
|
|
37
|
+
* The resolved list of people.
|
|
38
|
+
*/
|
|
39
|
+
people: PeoplePerson[];
|
|
40
|
+
/**
|
|
41
|
+
* Whether loading is currently in progress.
|
|
42
|
+
*/
|
|
43
|
+
loading: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The most recent list-loading error, if any.
|
|
46
|
+
*/
|
|
47
|
+
error: Error | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Hook to load a compact people list for the {@link People} component.
|
|
51
|
+
*
|
|
52
|
+
* Resolution order matches the component inputs:
|
|
53
|
+
* 1. `people` (render directly)
|
|
54
|
+
* 2. `userIds` (resolve each identifier)
|
|
55
|
+
* 3. `groupId` (load direct group members)
|
|
56
|
+
* 4. default tenant directory users (`/users`)
|
|
57
|
+
*
|
|
58
|
+
* @param options - Configuration for how people should be resolved
|
|
59
|
+
* @returns The resolved people, loading state, and any list-level error
|
|
60
|
+
*/
|
|
61
|
+
export declare const usePeopleList: (options?: UsePeopleListOptions) => UsePeopleListResult;
|
|
62
|
+
//# sourceMappingURL=usePeopleList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePeopleList.d.ts","sourceRoot":"","sources":["../../src/hooks/usePeopleList.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAOtE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAwCD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,oBAAoB,KAAG,mBA4N9D,CAAC"}
|