Skip to content

Commit de8f26a

Browse files
authored
Merge branch 'master' into edwl/fluent-checkbox-radio-motion
2 parents b8f1d47 + 71acfbd commit de8f26a

File tree

298 files changed

+4732
-962
lines changed

Some content is hidden

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

298 files changed

+4732
-962
lines changed

apps/public-docsite-resources/src/components/pages/ColorsPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class Content extends React.Component {
4848
}
4949
}
5050
51-
ReactDOM.render(<Content />,document.getElementById('content'));`;
51+
createRoot(document.getElementById('content')).render(<Content />)`;
5252

5353
export class ColorsPage extends React.Component<{}, IColorsPageState> {
5454
private _semanticSlotColorChangeTimeout: number;

apps/public-docsite-resources/src/docs/GettingStartedOverview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The library includes commonjs entry points under the `lib-commonjs` folder. To u
2020

2121
```tsx
2222
import * as React from 'react';
23-
import * as ReactDOM from 'react-dom';
23+
import * as ReactDOMClient from 'react-dom/client';
2424
import { Fabric, DefaultButton } from '@fluentui/react';
2525

2626
const MyPage = () => (
@@ -29,7 +29,7 @@ const MyPage = () => (
2929
</Fabric>
3030
);
3131

32-
ReactDOM.render(<MyPage />, document.body.firstChild);
32+
ReactDOMClient.createRoot(document.body.firstChild).render(<MyPage />);
3333
```
3434

3535
## Notes on module vs path-based imports

apps/public-docsite-v9/src/Concepts/Migration/FromV8/Troubleshooting.stories.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ We recommend placing the `FluentProvider` at the root of your app so that everyt
1111

1212
```jsx
1313
import React from 'react';
14-
import ReactDOM from 'react-dom';
14+
import ReactDOMClient from 'react-dom/client';
1515
import { FluentProvider, webLightTheme } from '@fluentui/react-components';
1616

1717
import App from './App';
1818

19-
ReactDOM.render(
19+
const root = ReactDOMClient.createRoot(document.getElementById('root'));
20+
root.render(
2021
<FluentProvider theme={webLightTheme}>
2122
<App />
2223
</FluentProvider>,
23-
document.getElementById('root'),
2424
);
2525
```
2626

apps/public-docsite/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"just": "just-scripts",
1919
"clean": "just-scripts clean",
2020
"code-style": "just-scripts code-style",
21-
"start": "just-scripts dev"
21+
"start": "just-scripts dev",
22+
"type-check": "tsc -p . --noEmit --baseUrl ."
2223
},
2324
"license": "MIT",
2425
"devDependencies": {

apps/public-docsite/project.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,13 @@
33
"$schema": "../../node_modules/nx/schemas/project-schema.json",
44
"projectType": "application",
55
"implicitDependencies": [],
6-
"tags": ["v8"]
6+
"tags": ["v8"],
7+
"targets": {
8+
"type-check": {
9+
"dependsOn": ["prebundle"]
10+
},
11+
"prebundle": {
12+
"dependsOn": ["^build"]
13+
}
14+
}
715
}

apps/public-docsite/src/pages/Styles/FabricIconsPage/docs/web/FabricIconsSvgUsage.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ The SVG icon components are primarily intended to be used directly, rather than
88

99
```tsx
1010
import * as React from 'react';
11-
import * as ReactDOM from 'react-dom';
11+
import * as ReactDOMClient from 'react-dom/client';
1212
import { ChevronDownIcon } from '@fluentui/react-icons-mdl2';
1313

14-
ReactDOM.render(<ChevronDownIcon />, document.body.firstChild);
14+
ReactDOMClient.createRoot(document.body.firstChild).render(<ChevronDownIcon />);
1515
```
1616

1717
If you do need to make SVG icons available to reference by name (for example, in Fluent UI React components which take `iconProps`), this can be done using `registerIcons` as follows:

apps/public-docsite/src/pages/Styles/FabricIconsPage/docs/web/FabricIconsUsage.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,24 @@ Once you've initialized the icons, you can use the Icon component in your app li
2323

2424
```tsx
2525
import * as React from 'react';
26-
import * as ReactDOM from 'react-dom';
26+
import * as ReactDOMClient from 'react-dom/client';
2727
import { Icon } from '@fluentui/react/lib/Icon';
2828

2929
const MyIcon = () => <Icon iconName="CompassNW" />;
3030

31-
ReactDOM.render(<MyIcon />, document.body.firstChild);
31+
ReactDOMClient.createRoot(document.body.firstChild).render(<MyIcon />);
3232
```
3333

3434
Some components also include baked-in support for Icon via `iconProps`, which you can use to configure how the icon renders. Here's an example using IconButton:
3535

3636
```tsx
3737
import * as React from 'react';
38-
import * as ReactDOM from 'react-dom';
38+
import * as ReactDOMClient from 'react-dom/client';
3939
import { IconButton } from '@fluentui/react/lib/Button';
4040

4141
const MyIconButton = () => <IconButton iconProps={{ iconName: 'Add' }} title="Add" ariaLabel="Add" />;
4242

43-
ReactDOM.render(<MyIconButton />, document.body.firstChild);
43+
ReactDOMClient.createRoot(document.body.firstChild).render(<MyIconButton />);
4444
```
4545

4646
### Fabric Core

apps/public-docsite/src/utilities/createSite.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// TODO: move to react-docsite-components once Site moves
22

33
import * as React from 'react';
4-
import * as ReactDOM from 'react-dom';
4+
import * as ReactDOMClient from 'react-dom/client';
55
import { ThemeProvider } from '@fluentui/react';
66
import { initializeIcons } from '@fluentui/font-icons-mdl2';
77
import {
@@ -37,7 +37,8 @@ initializeIcons();
3737
// blog storage is now immutable, so new versions of fabric-core will be at a new url based on the build number
3838
addCSSToHeader(`${cdnUrl}/office-ui-fabric-core/11.1.0/css/fabric.min.css`);
3939

40-
let rootElement: HTMLElement;
40+
let rootElement: HTMLElement | null;
41+
let root: ReactDOMClient.Root | null;
4142

4243
type ComponentLike = React.ComponentProps<typeof Route>['component'];
4344

@@ -109,19 +110,21 @@ export function createSite<TPlatforms extends string>(
109110

110111
const renderSite = (props: {}) => <Site siteDefinition={siteDefinition} hasUHF={hasUHF} {...props} />;
111112

112-
ReactDOM.render(
113+
root = ReactDOMClient.createRoot(rootElement!);
114+
root.render(
113115
<ThemeProvider>
114116
<Router>
115117
<Route component={renderSite}>{_getSiteRoutes()}</Route>
116118
</Router>
117119
</ThemeProvider>,
118-
rootElement,
119120
);
120121
}
121122

122123
function _onUnload() {
123-
if (rootElement) {
124-
ReactDOM.unmountComponentAtNode(rootElement);
124+
if (root && rootElement) {
125+
root.unmount();
126+
root = null;
127+
rootElement = null;
125128
}
126129
}
127130
}

apps/theming-designer/src/components/Header.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ const Content = () => {
8989
</ThemeProvider>
9090
);
9191
}
92-
ReactDOM.render(<Content />,document.getElementById('content'));`;
92+
93+
ReactDOM.createRoot(document.getElementById('content')).render(<Content />);`;
9394

9495
export class Header extends React.Component<IHeaderProps, IHeaderState> {
9596
constructor(props: any) {

apps/theming-designer/src/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import * as React from 'react';
2-
import * as ReactDOM from 'react-dom';
3-
import { Fabric } from '@fluentui/react/lib/Fabric';
2+
import { createRoot } from 'react-dom/client';
43
import { initializeIcons } from '@fluentui/font-icons-mdl2';
54
import { ThemingDesigner } from './components/ThemingDesigner';
65

@@ -13,7 +12,7 @@ function start(): void {
1312
_rootDiv = document.createElement('div');
1413
document.body.appendChild(_rootDiv);
1514
}
16-
ReactDOM.render(<ThemingDesigner />, _rootDiv);
15+
createRoot(_rootDiv).render(<ThemingDesigner />);
1716
}
1817

1918
// Start the application.

0 commit comments

Comments
 (0)