Skip to content

Commit

Permalink
Merge branch 'master' into migrate-to-swc
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanWatanabe committed Mar 15, 2023
2 parents e9620b6 + a3463ec commit fbb3ad5
Show file tree
Hide file tree
Showing 236 changed files with 3,712 additions and 478 deletions.
14 changes: 7 additions & 7 deletions apps/perf-test-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
},
"dependencies": {
"@griffel/core": "^1.9.0",
"@fluentui/react-avatar": "^9.4.3",
"@fluentui/react-button": "^9.3.3",
"@fluentui/react-field": "9.0.0-alpha.25",
"@fluentui/react-infobutton": "9.0.0-beta.21",
"@fluentui/react-persona": "^9.2.3",
"@fluentui/react-provider": "^9.4.3",
"@fluentui/react-spinbutton": "^9.2.3",
"@fluentui/react-avatar": "^9.4.4",
"@fluentui/react-button": "^9.3.4",
"@fluentui/react-field": "9.0.0-alpha.26",
"@fluentui/react-infobutton": "9.0.0-beta.22",
"@fluentui/react-persona": "^9.2.4",
"@fluentui/react-provider": "^9.4.4",
"@fluentui/react-spinbutton": "^9.2.4",
"@fluentui/react-theme": "^9.1.6",
"@microsoft/load-themed-styles": "^1.10.26",
"flamegrill": "0.2.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/public-docsite-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
"@fluentui/scripts-tasks": "*"
},
"dependencies": {
"@fluentui/react-migration-v8-v9": "^9.2.0",
"@fluentui/react-migration-v8-v9": "^9.2.1",
"@fluentui/react-migration-v0-v9": "9.0.0-alpha.0",
"@fluentui/react": "^8.106.6",
"@fluentui/react-northstar": "^0.66.4",
"@fluentui/react-icons-northstar": "^0.66.4",
"@fluentui/react-components": "^9.18.1",
"@fluentui/react-components": "^9.18.2",
"@fluentui/react-storybook-addon": "9.0.0-rc.1",
"@fluentui/react-storybook-addon-codesandbox": "9.0.0-alpha.0",
"@griffel/react": "^1.5.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/react-18-tests-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@fluentui/scripts-tasks": "*"
},
"dependencies": {
"@fluentui/react-components": "^9.18.1",
"@fluentui/react-components": "^9.18.2",
"@types/react": "18.0.14",
"@types/react-dom": "18.0.6",
"react": "18.2.0",
Expand Down
4 changes: 2 additions & 2 deletions apps/recipes-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"@fluentui/scripts-tasks": "*"
},
"dependencies": {
"@fluentui/react-components": "^9.18.1",
"@fluentui/react-components": "^9.18.2",
"@fluentui/react-icons": "^2.0.175",
"@fluentui/react-theme": "^9.1.6",
"@fluentui/react-provider": "^9.4.3",
"@fluentui/react-provider": "^9.4.4",
"@fluentui/react-storybook-addon": "9.0.0-rc.1",
"@fluentui/react-storybook-addon-codesandbox": "9.0.0-alpha.0",
"@griffel/react": "^1.5.2",
Expand Down
2 changes: 1 addition & 1 deletion apps/ssr-tests-v9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type-check": "tsc -b tsconfig.json"
},
"dependencies": {
"@fluentui/react-components": "^9.18.1"
"@fluentui/react-components": "^9.18.2"
},
"devDependencies": {
"@fluentui/eslint-plugin": "*",
Expand Down
2 changes: 1 addition & 1 deletion apps/stress-test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@fluentui/react": "^8.106.6",
"@fluentui/react-components": "^9.18.1",
"@fluentui/react-components": "^9.18.2",
"@fluentui/react-icons": "^2.0.175",
"@fluentui/web-components": "^2.5.12",
"@microsoft/fast-element": "^1.11.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/ts-minbar-test-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "Testing Fluent UI React Components compatibility with Typescript 3.9",
"license": "MIT",
"dependencies": {
"@fluentui/react-components": "^9.18.1"
"@fluentui/react-components": "^9.18.2"
},
"scripts": {
"type-check": "tsc -p .",
Expand Down
72 changes: 36 additions & 36 deletions apps/vr-tests-react-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,47 @@
"@fluentui/scripts-storybook": "*"
},
"dependencies": {
"@fluentui/react-accordion": "^9.1.3",
"@fluentui/react-avatar": "^9.4.3",
"@fluentui/react-badge": "^9.1.3",
"@fluentui/react-button": "^9.3.3",
"@fluentui/react-card": "^9.0.1",
"@fluentui/react-checkbox": "^9.1.3",
"@fluentui/react-combobox": "^9.2.3",
"@fluentui/react-dialog": "^9.3.2",
"@fluentui/react-divider": "^9.2.3",
"@fluentui/react-field": "9.0.0-alpha.25",
"@fluentui/react-accordion": "^9.1.4",
"@fluentui/react-avatar": "^9.4.4",
"@fluentui/react-badge": "^9.1.4",
"@fluentui/react-button": "^9.3.4",
"@fluentui/react-card": "^9.0.2",
"@fluentui/react-checkbox": "^9.1.4",
"@fluentui/react-combobox": "^9.2.4",
"@fluentui/react-dialog": "^9.4.0",
"@fluentui/react-divider": "^9.2.4",
"@fluentui/react-field": "9.0.0-alpha.26",
"@fluentui/react-icons": "^2.0.175",
"@fluentui/react-image": "^9.1.0",
"@fluentui/react-infobutton": "9.0.0-beta.21",
"@fluentui/react-input": "^9.4.3",
"@fluentui/react-label": "^9.1.3",
"@fluentui/react-link": "^9.0.29",
"@fluentui/react-menu": "^9.7.3",
"@fluentui/react-persona": "^9.2.3",
"@fluentui/react-popover": "^9.5.3",
"@fluentui/react-portal": "^9.2.0",
"@fluentui/react-positioning": "^9.5.4",
"@fluentui/react-progress": "^9.1.3",
"@fluentui/react-provider": "^9.4.3",
"@fluentui/react-radio": "^9.1.3",
"@fluentui/react-select": "^9.1.3",
"@fluentui/react-image": "^9.1.1",
"@fluentui/react-infobutton": "9.0.0-beta.22",
"@fluentui/react-input": "^9.4.4",
"@fluentui/react-label": "^9.1.4",
"@fluentui/react-link": "^9.0.30",
"@fluentui/react-menu": "^9.7.4",
"@fluentui/react-persona": "^9.2.4",
"@fluentui/react-popover": "^9.5.4",
"@fluentui/react-portal": "^9.2.1",
"@fluentui/react-positioning": "^9.5.5",
"@fluentui/react-progress": "^9.1.4",
"@fluentui/react-provider": "^9.4.4",
"@fluentui/react-radio": "^9.1.4",
"@fluentui/react-select": "^9.1.4",
"@fluentui/react-shared-contexts": "^9.3.1",
"@fluentui/react-skeleton": "9.0.0-beta.2",
"@fluentui/react-slider": "^9.1.3",
"@fluentui/react-spinner": "^9.1.3",
"@fluentui/react-spinbutton": "^9.2.3",
"@fluentui/react-skeleton": "9.0.0-beta.3",
"@fluentui/react-slider": "^9.1.4",
"@fluentui/react-spinner": "^9.1.4",
"@fluentui/react-spinbutton": "^9.2.4",
"@fluentui/react-storybook-addon": "9.0.0-rc.1",
"@fluentui/react-storybook-addon-codesandbox": "9.0.0-alpha.0",
"@fluentui/react-switch": "^9.1.3",
"@fluentui/react-tabs": "^9.3.3",
"@fluentui/react-table": "^9.2.0",
"@fluentui/react-text": "^9.3.0",
"@fluentui/react-textarea": "^9.3.3",
"@fluentui/react-switch": "^9.1.4",
"@fluentui/react-tabs": "^9.3.4",
"@fluentui/react-table": "^9.2.1",
"@fluentui/react-text": "^9.3.1",
"@fluentui/react-textarea": "^9.3.4",
"@fluentui/react-theme": "^9.1.6",
"@fluentui/react-tooltip": "^9.2.3",
"@fluentui/react-toolbar": "^9.1.3",
"@fluentui/react-utilities": "^9.7.0",
"@fluentui/react-tooltip": "^9.2.4",
"@fluentui/react-toolbar": "^9.1.4",
"@fluentui/react-utilities": "^9.7.1",
"@griffel/react": "^1.5.2",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,59 @@ ScrollLongContent.storyName = 'scroll long content';
export const ScrollLongContentDarkMode = getStoryVariant(ScrollLongContent, DARK_MODE);
export const ScrollLongContentHighContrast = getStoryVariant(ScrollLongContent, HIGH_CONTRAST);
export const ScrollLongContentRTL = getStoryVariant(ScrollLongContent, RTL);

export const FluidActionsStart = () => {
return (
<Dialog open>
<DialogTrigger disableButtonEnhancement>
<Button>Open dialog</Button>
</DialogTrigger>
<DialogSurface>
<DialogBody>
<DialogTitle>Dialog title</DialogTitle>
<DialogContent>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam exercitationem cumque repellendus eaque
est dolor eius expedita nulla ullam? Tenetur reprehenderit aut voluptatum impedit voluptates in natus iure
cumque eaque?
</DialogContent>
<DialogActions fluid position="start">
<Button appearance="secondary">Something Else</Button>
<Button appearance="secondary">Something Else</Button>
<DialogTrigger disableButtonEnhancement>
<Button appearance="secondary">Close</Button>
</DialogTrigger>
<Button appearance="primary">Do Something</Button>
</DialogActions>
</DialogBody>
</DialogSurface>
</Dialog>
);
};

export const FluidActionsEnd = () => {
return (
<Dialog open>
<DialogTrigger disableButtonEnhancement>
<Button>Open dialog</Button>
</DialogTrigger>
<DialogSurface>
<DialogBody>
<DialogTitle>Dialog title</DialogTitle>
<DialogContent>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam exercitationem cumque repellendus eaque
est dolor eius expedita nulla ullam? Tenetur reprehenderit aut voluptatum impedit voluptates in natus iure
cumque eaque?
</DialogContent>
<DialogActions fluid position="end">
<Button appearance="secondary">Something Else</Button>
<Button appearance="secondary">Something Else</Button>
<DialogTrigger disableButtonEnhancement>
<Button appearance="secondary">Close</Button>
</DialogTrigger>
<Button appearance="primary">Do Something</Button>
</DialogActions>
</DialogBody>
</DialogSurface>
</Dialog>
);
};
43 changes: 43 additions & 0 deletions apps/vr-tests-react-components/src/stories/InfoLabel.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as React from 'react';

import { Steps, StoryWright } from 'storywright';
import { InfoLabel } from '@fluentui/react-infobutton';
import { storiesOf } from '@storybook/react';
import { TestWrapperDecoratorFixedWidth } from '../utilities/TestWrapperDecorator';

storiesOf('InfoLabel', module)
.addDecorator(TestWrapperDecoratorFixedWidth)
.addDecorator(story => (
<StoryWright steps={new Steps().snapshot('rest', { cropTo: '.testWrapper' }).end()}>{story()}</StoryWright>
))
.addStory('default', () => <InfoLabel info="Test">This is an info label</InfoLabel>, {
includeHighContrast: true,
includeDarkMode: true,
includeRtl: true,
})
.addStory('wrap', () => (
<InfoLabel info="Test">
This is a very long info label that should wrap to multiple lines and put the info button on the last line
</InfoLabel>
))
.addStory('size:small', () => (
<InfoLabel size="small" info="Test">
This is a small info label
</InfoLabel>
))
.addStory('size:large', () => (
<InfoLabel size="large" info="Test">
This is a large info label
</InfoLabel>
))
.addStory(
'required',
() => (
<InfoLabel required info="Test">
This is a required info label
</InfoLabel>
),
{
includeRtl: true,
},
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "feat: rule to ban usage of instanceof HTMLElement",
"packageName": "@fluentui/eslint-plugin",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: exports isHTMLElement as public",
"packageName": "@fluentui/react-utilities",
"email": "[email protected]",
"dependentChangeType": "patch"
}
24 changes: 24 additions & 0 deletions packages/eslint-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,27 @@ const context = React.createContext({ someValue: undefined });
import * as React from 'react';
const context = React.createContext(undefined);
```

### `ban-instanceof-html-element`

Bans usage of `instanceof HTMLElement` binary expressions as they might cause problems on [multiple realms](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#instanceof_and_multiple_realms) environments.

The alternative is to use `isHTMLElement` helper method provided by `@fluentui/react-utilities` packages, since that method does the proper verifications to ensure proper instance comparison.

**❌ Don't**

```ts
event.target instanceof HTMLElement;

event.target instanceof HTMLInputElement;
```

**✅ Do**

```ts
import { isHTMLElement } from '@fluentui/react-components';

isHTMLElement(event.target);

isHTMLElement(event.target, { constructorName: 'HTMLInputElement' });
```
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/configs/react.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const v9PackageDeps = Object.keys(
module.exports = {
extends: [path.join(__dirname, 'base'), path.join(__dirname, 'react-config')],
rules: {
'@fluentui/ban-instanceof-html-element': ['error'],
'@fluentui/no-context-default-value': [
'error',
{
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module.exports = {
rules: {
'ban-imports': require('./rules/ban-imports'),
'ban-context-export': require('./rules/ban-context-export'),
'ban-instanceof-html-element': require('./rules/ban-instanceof-html-element'),
'deprecated-keyboard-event-props': require('./rules/deprecated-keyboard-event-props'),
'max-len': require('./rules/max-len'),
'no-global-react': require('./rules/no-global-react'),
Expand Down
Loading

0 comments on commit fbb3ad5

Please sign in to comment.