@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.
Files changed (48) hide show
  1. package/AGENTS.md +171 -0
  2. package/dist/components/People/People.d.ts +16 -0
  3. package/dist/components/People/People.d.ts.map +1 -0
  4. package/dist/components/People/People.types.d.ts +55 -0
  5. package/dist/components/People/People.types.d.ts.map +1 -0
  6. package/dist/components/People/index.d.ts +6 -0
  7. package/dist/components/People/index.d.ts.map +1 -0
  8. package/dist/components/PeoplePicker/PeoplePicker.d.ts +24 -0
  9. package/dist/components/PeoplePicker/PeoplePicker.d.ts.map +1 -0
  10. package/dist/components/PeoplePicker/PeoplePicker.types.d.ts +57 -0
  11. package/dist/components/PeoplePicker/PeoplePicker.types.d.ts.map +1 -0
  12. package/dist/components/PeoplePicker/index.d.ts +6 -0
  13. package/dist/components/PeoplePicker/index.d.ts.map +1 -0
  14. package/dist/components/Person/Person.d.ts.map +1 -1
  15. package/dist/components/Person/Person.types.d.ts +148 -21
  16. package/dist/components/Person/Person.types.d.ts.map +1 -1
  17. package/dist/components/Person/index.d.ts +1 -1
  18. package/dist/components/Person/index.d.ts.map +1 -1
  19. package/dist/hooks/usePeopleList.d.ts +62 -0
  20. package/dist/hooks/usePeopleList.d.ts.map +1 -0
  21. package/dist/hooks/usePeopleSearch.d.ts +42 -0
  22. package/dist/hooks/usePeopleSearch.d.ts.map +1 -0
  23. package/dist/hooks/usePersonData.d.ts +1 -0
  24. package/dist/hooks/usePersonData.d.ts.map +1 -1
  25. package/dist/index.d.ts +5 -0
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +3 -1
  28. package/dist/index.mjs +1437 -306
  29. package/dist/providers/IPersonDataProvider.d.ts +116 -0
  30. package/dist/providers/IPersonDataProvider.d.ts.map +1 -0
  31. package/dist/providers/IProvider.d.ts +1 -5
  32. package/dist/providers/IProvider.d.ts.map +1 -1
  33. package/dist/providers/MockProvider.d.ts +4 -1
  34. package/dist/providers/MockProvider.d.ts.map +1 -1
  35. package/dist/providers/MsalBrowserProvider.d.ts +14 -2
  36. package/dist/providers/MsalBrowserProvider.d.ts.map +1 -1
  37. package/dist/providers/ProviderContext.d.ts +6 -0
  38. package/dist/providers/ProviderContext.d.ts.map +1 -1
  39. package/dist/providers/TeamsHostedProvider.d.ts +1 -1
  40. package/dist/providers/TeamsHostedProvider.d.ts.map +1 -1
  41. package/dist/providers/mockAvatarData.d.ts +5 -0
  42. package/dist/providers/mockAvatarData.d.ts.map +1 -0
  43. package/dist/utils/graph.d.ts +17 -0
  44. package/dist/utils/graph.d.ts.map +1 -1
  45. package/dist/utils/personCache.d.ts +24 -0
  46. package/dist/utils/personCache.d.ts.map +1 -0
  47. package/package.json +13 -5
  48. package/readme.md +119 -19
package/readme.md CHANGED
@@ -5,16 +5,18 @@
5
5
  <h4 align="center">Modern React Components for <a href="https://graph.microsoft.com">Microsoft Graph</a> powered by <a href="https://react.fluentui.dev/">Fluent UI</a></h4>
6
6
 
7
7
  <p align="center">
8
- <img src="https://img.shields.io/badge/alpha-0.1.0-orange" alt="Alpha Release">
8
+ <a href="https://www.npmjs.com/package/@devsym/graph-toolkit-react"><img src="https://img.shields.io/badge/alpha-0.1.0-orange" alt="Alpha Release"></a>
9
9
  <img src="https://img.shields.io/badge/React-18%2F19-blue" alt="React 18/19">
10
10
  <img src="https://img.shields.io/badge/Fluent_UI-9.72-purple" alt="Fluent UI 9">
11
11
  <img src="https://img.shields.io/badge/TypeScript-5.9-blue" alt="TypeScript 5.9">
12
12
  </p>
13
13
 
14
14
  <h3 align="center">
15
- <a href="#getting-started">Get Started</a> •
16
- <a href="#storybook">Storybook</a> •
17
- <a href="#contribute">Contribute</a>
15
+ <a href="#-getting-started">Get Started</a> •
16
+ <a href="#-migration-from-mgt">Migration</a> •
17
+ <a href="#-agent-quick-reference">Agent Quick Reference</a>
18
+ <a href="#-storybook">Storybook</a> •
19
+ <a href="#-contribute">Contribute</a>
18
20
  </h3>
19
21
 
20
22
  ## 🎯 Project Vision
@@ -50,6 +52,30 @@ npm install @devsym/graph-toolkit-react
50
52
  | ------- | ------- | ----------- |
51
53
  | `@devsym/graph-toolkit-react` | `0.1.0-alpha.1` | React components for Microsoft Graph powered by Fluent UI |
52
54
 
55
+ ## 🔄 Migration from MGT
56
+
57
+ For migration from Microsoft Graph Toolkit (including Teams-hosted scenarios), use [`docs/MGT_MIGRATION.md`](./docs/MGT_MIGRATION.md).
58
+
59
+ The guide includes:
60
+
61
+ - Concept mapping (MGT patterns to this package)
62
+ - Step-by-step migration checklist
63
+ - Teams-specific migration section (`TeamsHostedProvider` + backend token exchange)
64
+ - Common migration pitfalls and validation checklist
65
+
66
+ ## 🤖 Agent Quick Reference
67
+
68
+ If you are using a coding agent (Copilot/Codex/Claude/etc.), use the scenario-first reference in [`AGENTS.md`](./AGENTS.md).
69
+
70
+ It includes:
71
+
72
+ - Provider decision matrix by hosting scenario
73
+ - Minimal copy-ready snippets for `MockProvider`, `MsalBrowserProvider`, `TeamsHostedProvider`, and custom `IProvider`
74
+ - Scopes-by-feature mapping
75
+ - Common failures and exact remediation steps
76
+
77
+ For end-to-end browser-hosted setup with MSAL, also see [`samples/react-msal-sample/README.md`](./samples/react-msal-sample/README.md).
78
+
53
79
  ## 🎨 Components
54
80
 
55
81
  Currently available in alpha:
@@ -62,15 +88,76 @@ import { Person } from '@devsym/graph-toolkit-react';
62
88
 
63
89
  <Person
64
90
  userId="user@contoso.com"
65
- view="twoLines"
91
+ view="twolines"
66
92
  showPresence
93
+ presenceOnly={false}
94
+ size="large"
67
95
  textAlignment="center"
68
- onClick={() => console.log('Clicked!')}
96
+ onClick={() => console.log('Persona clicked!')}
97
+ />
98
+ ```
99
+
100
+ `Person` supports Fluent UI Persona props directly.
101
+
102
+ MGT-style line customization is also supported:
103
+
104
+ ```tsx
105
+ <Person
106
+ userId="me"
107
+ view="threelines"
108
+ line1Property="givenName"
109
+ line2Property="mail,userPrincipalName"
110
+ line3Property="presenceAvailability"
111
+ />
112
+ ```
113
+
114
+ For full manual override, use React render callbacks as the replacement for MGT line templates:
115
+
116
+ ```tsx
117
+ <Person
118
+ personDetails={{
119
+ displayName: 'Megan Bowen',
120
+ jobTitle: 'CEO',
121
+ department: 'Leadership',
122
+ officeLocation: 'Seattle',
123
+ }}
124
+ view="fourlines"
125
+ renderLine1={({ text }) => <span>Name: {text}</span>}
126
+ renderLine2={({ text }) => <span>Role: {text}</span>}
127
+ renderLine3={({ text }) => <span>Org: {text}</span>}
128
+ renderLine4={({ text }) => <span>Location: {text}</span>}
129
+ />
130
+ ```
131
+
132
+ ### People Component
133
+ Display a compact strip of people using Fluent UI `AvatarGroup`.
134
+
135
+ ```tsx
136
+ import { People } from '@devsym/graph-toolkit-react';
137
+
138
+ <People showMax={4} size={40} />
139
+ ```
140
+
141
+ You can also provide people directly or resolve specific users:
142
+
143
+ ```tsx
144
+ <People
145
+ userIds={['me', 'user@contoso.com']}
146
+ showMax={2}
147
+ showPresence
148
+ />
149
+ ```
150
+
151
+ ```tsx
152
+ <People
153
+ people={[
154
+ { id: 'adele', displayName: 'Adele Vance', mail: 'adelev@contoso.com' },
155
+ { id: 'alex', displayName: 'Alex Wilber', mail: 'alexw@contoso.com' },
156
+ ]}
69
157
  />
70
158
  ```
71
159
 
72
160
 
73
- <a id="getting-started"></a>
74
161
  ## 🚀 Getting Started
75
162
 
76
163
  ### Prerequisites
@@ -115,13 +202,15 @@ function App() {
115
202
  return (
116
203
  <FluentProvider theme={webLightTheme}>
117
204
  <GraphProvider provider={provider}>
118
- <Person userId="AdeleV@contoso.com" view="twoLines" showPresence />
205
+ <Person userId="AdeleV@contoso.com" view="twolines" showPresence />
119
206
  </GraphProvider>
120
207
  </FluentProvider>
121
208
  );
122
209
  }
123
210
  ```
124
211
 
212
+ For a complete browser-hosted example app, try the deployed [React MSAL sample](https://gentle-beach-0f6fe2903.2.azurestaticapps.net) or review [`samples/react-msal-sample/README.md`](./samples/react-msal-sample/README.md), which wires `MsalBrowserProvider` into `GraphProvider` and demonstrates `Person`, `People`, and `PeoplePicker`.
213
+
125
214
  ### Authentication Providers
126
215
 
127
216
  The library uses a provider pattern for authentication:
@@ -162,6 +251,8 @@ function App() {
162
251
  }
163
252
  ```
164
253
 
254
+ The provider uses redirect flow. Set the redirect URI to your app's origin and register it as a **Single-page application (SPA)** platform in Azure AD.
255
+
165
256
  #### `TeamsHostedProvider` quick start (consumer-managed Teams login)
166
257
 
167
258
  Use this when your app is hosted in Microsoft Teams and your app code already handles TeamsJS auth for multiple APIs.
@@ -211,6 +302,9 @@ Use explicit mode selection in your app:
211
302
  | ------- | ------------------------ | ----- |
212
303
  | Load current user profile (`userId="me"`) | `User.Read` | Required for basic person data (`displayName`, `mail`, etc.) |
213
304
  | Load another user by id/upn (`userId="{id}"`) | `User.ReadBasic.All` | May require admin consent depending on tenant policy |
305
+ | Load `People` default suggestions | `User.ReadBasic.All` | Used for the default `/users` directory list when no explicit people source is provided |
306
+ | Load `People` group members (`groupId`) | `GroupMember.Read.All` | Required only when resolving direct group membership |
307
+ | Load PeoplePicker focus suggestions | `User.ReadBasic.All` | Uses the initial `/users` directory list shown before typing |
214
308
  | Show presence (`showPresence`) | `Presence.Read` | If not granted, person still renders without presence |
215
309
  | Load profile photo (`fetchImage`) | `User.Read` | Falls back to initials if photo is unavailable |
216
310
 
@@ -218,7 +312,7 @@ Use explicit mode selection in your app:
218
312
  import { IProvider, ProviderState } from '@devsym/graph-toolkit-react';
219
313
 
220
314
  class MyAuthProvider implements IProvider {
221
- state = ProviderState.SignedOut;
315
+ state: ProviderState = 'SignedOut';
222
316
 
223
317
  async login(): Promise<void> { /* ... */ }
224
318
  async logout(): Promise<void> { /* ... */ }
@@ -226,7 +320,6 @@ class MyAuthProvider implements IProvider {
226
320
  }
227
321
  ```
228
322
 
229
- <a id="storybook"></a>
230
323
  ## 📚 Storybook
231
324
 
232
325
  Explore all components interactively in our Storybook documentation:
@@ -279,10 +372,13 @@ npm run build-storybook
279
372
  ```
280
373
  src/
281
374
  ├── components/
282
- └── Person/
283
- ├── Person.tsx # Component implementation
284
- ├── Person.types.ts # TypeScript definitions
285
- └── __tests__/ # Component tests
375
+ ├── Person/
376
+ ├── Person.tsx # Component implementation
377
+ ├── Person.types.ts # TypeScript definitions
378
+ └── __tests__/ # Component tests
379
+ │ └── People/
380
+ │ ├── People.tsx # Component implementation
381
+ │ └── People.types.ts # TypeScript definitions
286
382
  ├── providers/
287
383
  │ ├── IProvider.ts # Provider interface
288
384
  │ ├── MockProvider.ts # Development provider
@@ -290,11 +386,14 @@ src/
290
386
  ├── hooks/
291
387
  │ ├── useGraphClient.ts # Graph client hook
292
388
  │ ├── usePersonData.ts # Person data fetching
389
+ │ ├── usePeopleList.ts # People list fetching
293
390
  │ └── useProvider.ts # Provider access
294
391
  └── index.ts # Public API
295
392
 
296
393
  stories/
297
- └── Person.stories.tsx # Storybook stories (19 examples)
394
+ ├── Person.stories.tsx # Person stories
395
+ ├── People.stories.tsx # People stories
396
+ └── PeoplePicker.stories.tsx # PeoplePicker stories
298
397
  ```
299
398
 
300
399
  ## 🎯 Current Status
@@ -304,20 +403,21 @@ stories/
304
403
  - ✅ Repository restructured from monorepo to single package
305
404
  - ✅ Provider infrastructure with MockProvider for development
306
405
  - ✅ Person component using Fluent UI Persona
406
+ - ✅ People component using Fluent UI AvatarGroup
407
+ - ✅ PeoplePicker component using Fluent UI TagPicker
307
408
  - ✅ Full Persona configuration support (textAlignment, textPosition, sizing)
308
409
  - ✅ Build system (ESM + CJS + TypeScript declarations)
309
410
  - ✅ Storybook documentation and GitHub Pages deployment
310
411
  - ✅ CI/CD with GitHub Actions
311
412
  - ✅ Automatic Storybook deployment to GitHub Pages
312
- - ✅ Sample app with MSAL sign-in and `Person` (`userId="me"`) at `samples/react-msal-sample`
413
+ - ✅ Sample app with MSAL sign-in and `Person`, `People`, and `PeoplePicker` demos at `samples/react-msal-sample`
313
414
 
314
415
  **Next Steps**:
315
- - Additional components (PeoplePicker, PersonCard, Login)
416
+ - Additional components (PersonCard, Login, Agenda) — see [`docs/COMPONENT_ROADMAP.md`](./docs/COMPONENT_ROADMAP.md) for the full ranked list
316
417
  - Expanded provider guidance and production auth examples
317
418
  - Comprehensive test coverage
318
419
  - First stable release (1.0.0)
319
420
 
320
- <a id="contribute"></a>
321
421
  ## 🤝 Contribute
322
422
 
323
423
  This **community-driven project** provides React developers with components for Microsoft Graph. Contributions are welcome!
@@ -350,6 +450,6 @@ MIT License - see [LICENSE](LICENSE) for details.
350
450
 
351
451
  - **Fluent UI**: [react.fluentui.dev](https://react.fluentui.dev/)
352
452
  - **Microsoft Graph**: [graph.microsoft.com](https://graph.microsoft.com)
453
+ - **Component Roadmap**: [docs/COMPONENT_ROADMAP.md](./docs/COMPONENT_ROADMAP.md)
353
454
  - **Changelog**: [CHANGELOG.md](CHANGELOG.md)
354
455
  - **Publishing**: [PUBLISHING.md](PUBLISHING.md)
355
-