Skip to content

Commit 42c7be8

Browse files
authored
Merge pull request #2005 from microsoftgraph/merge/from-main
chore: update next/fluentui from main
2 parents 6317ccf + cc7d855 commit 42c7be8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+471
-80
lines changed

.github/workflows/pr-reporting.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,32 @@ on:
1010
jobs:
1111
pr_report:
1212
runs-on: ubuntu-latest
13+
env:
14+
GH_TOKEN: ${{ github.token }}
1315
steps:
16+
# added to work around missing .git repo wanted by gh cli
17+
- uses: actions/checkout@v2
1418
- name: Test Report
1519
uses: dorny/test-reporter@v1
16-
if: always() # run this step even if previous step failed
1720
with:
1821
artifact: test-results
1922
name: JEST Tests # Name of the check run which will be created
2023
path: junit.xml # Path to test results
2124
reporter: jest-junit # Format of test results
22-
25+
- name: Download coverage artifacts with cli
26+
run: |
27+
gh run download ${{ github.event.workflow_run.id }} -n coverage
2328
- name: Code Coverage Summary Report
2429
uses: irongut/[email protected]
2530
with:
26-
filename: coverage/cobertura-coverage.xml
31+
filename: cobertura-coverage.xml
2732
badge: true
2833
format: 'markdown'
2934
output: 'both'
3035
- name: Add Coverage PR Comment
3136
uses: marocchino/sticky-pull-request-comment@v2
32-
if: github.event_name == 'pull_request'
37+
if: github.event.workflow_run.event == 'pull_request'
3338
with:
3439
recreate: true
3540
path: code-coverage-results.md
41+
number: ${{ github.event.workflow_run.pull_requests[0].number }}

.github/workflows/pr-storybook.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,25 @@ jobs:
2525
node-version: ${{ matrix.node-version }}
2626
registry-url: 'https://registry.npmjs.org'
2727

28-
- name: Build 🛠
28+
- name: Install deps 🛠
2929
run: |
3030
npm install -g yarn lerna
3131
yarn
32+
- name: Extract tag name
33+
shell: bash
34+
run: |
35+
tag=$(branch=${{ github.event.pull_request.head.ref }}; echo ${branch/\//.})
36+
if [[ $tag == next.* ]];
37+
then
38+
echo "##[set-output name=tag;]$tag"
39+
else
40+
echo "##[set-output name=tag;]pr.${{ github.event.pull_request.number }}"
41+
fi
42+
id: extract_tag
43+
- run: node scripts/setVersion.js --tag ${{ steps.extract_tag.outputs.tag }}
44+
45+
- name: Build 🛠
46+
run: |
3247
yarn build
3348
yarn storybook:build
3449

.storybook/fix-title.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
function fixTitle(filePath, title) {
5+
const htmlDocumentPath = path.resolve(__dirname, filePath);
6+
const htmlDocument = fs.readFileSync(htmlDocumentPath, 'utf-8');
7+
const updatedHtmlDocument = htmlDocument.replace(/<title>.*<\/title>/, `<title>${title}</title>`);
8+
9+
fs.writeFileSync(htmlDocumentPath, updatedHtmlDocument);
10+
}
11+
12+
function addSeoTags(filePath, title) {
13+
const htmlDocumentPath = path.resolve(__dirname, filePath);
14+
const htmlDocument = fs.readFileSync(htmlDocumentPath, 'utf-8');
15+
const updatedHtmlDocument = htmlDocument.replace(
16+
/<\/title>/,
17+
`</title>
18+
<meta name="og:title" content="${title}"></meta>
19+
<meta name="og:type" content="website"></meta>
20+
<meta name="og:description" content="Use Microsoft Graph Toolkit to find authentication providers and reusable, framework-agnostic web components for accessing and working with Microsoft Graph."></meta>
21+
<meta name="description" content="Use Microsoft Graph Toolkit to find authentication providers and reusable, framework-agnostic web components for accessing and working with Microsoft Graph."></meta>
22+
`
23+
);
24+
25+
fs.writeFileSync(htmlDocumentPath, updatedHtmlDocument);
26+
}
27+
28+
try {
29+
const args = process.argv.slice(2);
30+
const [title, distPath] = args;
31+
32+
const storybookDistPath = `${distPath}storybook-static`;
33+
const indexPath = `${storybookDistPath}/index.html`;
34+
const iframePath = `${storybookDistPath}/iframe.html`;
35+
36+
console.log(`Rewriting ${indexPath} document title to ${title}.`);
37+
fixTitle(indexPath, title);
38+
console.log(`Adding SeoTags to ${indexPath}.`);
39+
addSeoTags(indexPath, title);
40+
41+
console.log(`Rewriting iframe.html document title to ${title}.`);
42+
fixTitle(iframePath, title);
43+
44+
console.log('Title rewrite complete.');
45+
} catch (error) {
46+
console.log('Title rewrite failed.');
47+
console.error(error);
48+
process.exit(1);
49+
}

.storybook/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ module.exports = {
1818
],
1919
stories: ['../stories/overview.stories.mdx', '../stories/**/*.@(js|mdx)'],
2020
addons: [
21+
'storybook-version',
2122
'@storybook/addon-docs'
2223
// '@storybook/addon-a11y/register',
2324
// '@storybook/addon-actions/register',

.storybook/manager-head.html

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
</script>
77

88
<footer class="storybook-footer">
9-
Microsoft Graph Toolkit Playground was founded by Microsoft as a community guided, open source project.
9+
Microsoft Graph Toolkit (v<span id="mgt-version"></span>) Playground was founded by Microsoft as a community guided,
10+
open source project.
1011
<a tabindex="-1" href="https://privacy.microsoft.com/en-us/privacystatement">Privacy & cookies</a>
1112
<a tabindex="-1" href="https://www.microsoft.com/en-us/legal/intellectualproperty/copyright/default">Term of use</a>
1213
</footer>
14+
<script type="module">
15+
import { PACKAGE_VERSION } from './mgt.storybook.js'
16+
document.getElementById('mgt-version').innerText = PACKAGE_VERSION;
17+
</script>
1318

1419
<script src="https://consentdeliveryfd.azurefd.net/mscc/lib/v2/wcp-consent.js"></script>
1520
<script src="https://az725175.vo.msecnd.net/scripts/jsll-4.js" type="text/javascript"></script>
@@ -309,11 +314,26 @@
309314
</style>
310315

311316
<style>
317+
318+
/* don't show the footer on mobile */
319+
@media (max-width: 599px) {
320+
.storybook-footer {
321+
display: none !important;
322+
}
323+
}
324+
312325
/* this keeps the storybook body area above footer */
313-
#root>div:first-of-type {
314-
height: calc(100% - 40px);
326+
@media (max-width: 768px) {
327+
#root>div:first-of-type {
328+
height: calc(100% - 50px);
329+
}
315330
}
316331

332+
@media (min-width: 769px) {
333+
#root>div:first-of-type {
334+
height: calc(100% - 40px);
335+
}
336+
}
317337
.sidebar-header button {
318338
display: none !important;
319339
}
@@ -341,12 +361,6 @@
341361
color: #717171 !important;
342362
}
343363

344-
@media (max-width: 768px) {
345-
#root>div:first-of-type {
346-
height: calc(100% - 50px);
347-
}
348-
}
349-
350364
.sidebar-header h1 {
351365
font-size: 14px;
352366
font-weight: 700;

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ <h2>mgt-file-list</h2>
7575
<mgt-file-list></mgt-file-list>
7676
</main>
7777
</body>
78-
</html>
78+
</html>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"storybook:watch": "npm-run-all --parallel watch storybook:bundle:watch storybook",
5656
"storybook:bundle": "rollup -c ./.storybook/rollup.config.js",
5757
"storybook:bundle:watch": "rollup -c ./.storybook/rollup.config.js --watch",
58-
"storybook:build": "npm run storybook:bundle && npm run storybook:dev && build-storybook -s assets && cpx .storybook/CNAME storybook-static",
58+
"storybook:build": "npm run storybook:bundle && npm run storybook:dev && build-storybook -s assets && cpx .storybook/CNAME storybook-static && node ./.storybook/fix-title.js 'Microsoft Graph Toolkit Playground' ../",
5959
"storybook:deploy": "npm run storybook:build && storybook-to-ghpages -e storybook-static",
6060
"setLicense": "gulp setLicense",
6161
"test": "jest",
@@ -133,6 +133,7 @@
133133
"sass": "^1.29.0",
134134
"shx": "^0.3.3",
135135
"storybook-addon-web-components-knobs": "^0.3.20",
136+
"storybook-version": "^0.1.1",
136137
"testing-library__dom": "^7.29.4-beta.1",
137138
"ts-jest": "^29.0.3",
138139
"tslint": "^6.1.3",

packages/mgt-components/src/components/mgt-people-picker/mgt-people-picker.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
502502
private _type: PersonType = PersonType.person;
503503
private _groupType: GroupType = GroupType.any;
504504
private _userType: UserType = UserType.any;
505-
private _currentSelectedUser: IDynamicPerson;
506505
private _userFilters: string;
507506
private _groupFilters: string;
508507
private _peopleFilters: string;
@@ -520,8 +519,19 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
520519
// current user index to the left of the highlighted users
521520
private _currentHighlightedUserPos: number = 0;
522521

522+
/**
523+
* Checks if the input is focused.
524+
*/
523525
@state() private _isFocused = false;
524526

527+
/**
528+
* Switch to determine if a typed email can be set.
529+
*/
530+
@state() private _setAnyEmail: boolean = false;
531+
532+
/**
533+
* List of people found from the graph calls.
534+
*/
525535
@state() private _foundPeople: IDynamicPerson[];
526536

527537
private _mouseLeaveTimeout;
@@ -1349,7 +1359,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
13491359
}
13501360

13511361
/**
1352-
* Adds debounce method for set delay on user input
1362+
* Handles input from the key up events on the keyboard.
13531363
*/
13541364
private onUserKeyUp(event: KeyboardEvent): void {
13551365
const isPaste = (event.ctrlKey || event.metaKey) && event.key === 'v';
@@ -1410,6 +1420,7 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
14101420

14111421
if (event.code === 'Comma' || event.code === 'Semicolon') {
14121422
if (this.allowAnyEmail) {
1423+
this._setAnyEmail = true;
14131424
event.preventDefault();
14141425
event.stopPropagation();
14151426
}
@@ -1419,10 +1430,13 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
14191430
this.userInput = input.value;
14201431
const validEmail = isValidEmail(this.userInput);
14211432
if (validEmail && this.allowAnyEmail) {
1422-
this.handleAnyEmail();
1433+
if (this._setAnyEmail) {
1434+
this.handleAnyEmail();
1435+
}
14231436
} else {
14241437
this.handleUserSearch();
14251438
}
1439+
this._setAnyEmail = false;
14261440
}
14271441

14281442
private handleAnyEmail() {
@@ -1549,9 +1563,9 @@ export class MgtPeoplePicker extends MgtTemplatedComponent {
15491563
this.addPerson(foundPerson);
15501564
this.hideFlyout();
15511565
this.input.value = '';
1552-
} else if (this.allowAnyEmail) {
1553-
this.handleAnyEmail();
15541566
}
1567+
} else if (this.allowAnyEmail) {
1568+
this.handleAnyEmail();
15551569
}
15561570
}
15571571

packages/mgt-components/src/components/mgt-person-card/mgt-person-card.graph.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { MgtPersonCardConfig, MgtPersonCardState } from './mgt-person-card.types
1414

1515
// tslint:disable-next-line:completed-docs
1616
const userProperties =
17-
'businessPhones,companyName,department,displayName,givenName,jobTitle,mail,mobilePhone,officeLocation,preferredLanguage,surname,userPrincipalName,id';
17+
'businessPhones,companyName,department,displayName,givenName,jobTitle,mail,mobilePhone,officeLocation,preferredLanguage,surname,userPrincipalName,id,accountEnabled';
1818

1919
// tslint:disable-next-line:completed-docs
2020
const batchKeys = {
@@ -94,6 +94,11 @@ export async function getPersonCardGraphData(
9494
}
9595
}
9696

97+
// filter out disabled users from direct reports.
98+
if (data.directReports && data.directReports.length > 0) {
99+
data.directReports = data.directReports.filter(report => report.accountEnabled);
100+
}
101+
97102
return data;
98103
}
99104

packages/mgt-components/src/components/mgt-person-card/sections/mgt-person-card-contact/mgt-person-card-contact.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class MgtPersonCardContact extends BasePersonCardSection {
9393
title: this.strings.chatTitle
9494
},
9595
businessPhone: {
96-
icon: getSvg(SvgIcon.CellPhone, '#605e5c'),
96+
icon: getSvg(SvgIcon.Phone, '#605e5c'),
9797
onClick: () => this.sendCall(this._person?.businessPhones?.length > 0 ? this._person.businessPhones[0] : null),
9898
showCompact: true,
9999
title: this.strings.businessPhoneTitle
@@ -264,13 +264,15 @@ export class MgtPersonCardContact extends BasePersonCardSection {
264264
`;
265265

266266
return html`
267-
<div class="part" @click=${(e: MouseEvent) => this.handlePartClick(e, part.value)} tabindex="0">
268-
<div class="part__icon">${part.icon}</div>
267+
<div class="part" @click=${(e: MouseEvent) => this.handlePartClick(e, part.value)} tabindex="0">
268+
<div class="part__icon" aria-label=${part.title} title=${part.title}>${part.icon}</div>
269269
<div class="part__details">
270270
<div class="part__title">${part.title}</div>
271-
<div class="part__value">${valueTemplate}</div>
271+
<div class="part__value" title=${part.title}>${valueTemplate}</div>
272272
</div>
273-
<div class="part__copy">
273+
<div class="part__copy" aria-role="button" aria-label=${this.strings.copyToClipboardButton} title=${
274+
this.strings.copyToClipboardButton
275+
}>
274276
${getSvg(SvgIcon.Copy)}
275277
</div>
276278
</div>

0 commit comments

Comments
 (0)