Skip to content

Commit

Permalink
Merge branch 'master' into simplify-handleChange-select-input
Browse files Browse the repository at this point in the history
  • Loading branch information
ZeeshanTamboli committed May 4, 2023
2 parents 4f26bc7 + 7c385b4 commit 2dbe2a7
Show file tree
Hide file tree
Showing 462 changed files with 5,674 additions and 3,893 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
uses: github/codeql-action/init@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
with:
languages: typescript
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -30,4 +30,4 @@ jobs:
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
uses: github/codeql-action/analyze@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
2 changes: 1 addition & 1 deletion .github/workflows/scorecards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: Upload to code-scanning
uses: github/codeql-action/upload-sarif@b2c19fb9a2a485599ccf4ed5d65527d94bc57226 # v2.3.0
uses: github/codeql-action/upload-sarif@f3feb00acb00f31a6f60280e6ace9ca31d91c76a # v2.3.2
with:
sarif_file: results.sarif
120 changes: 120 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,125 @@
# [Versions](https://mui.com/versions/)

## 5.12.3

<!-- generated comparing v5.12.2..master -->

_May 2, 2023_

A big thanks to the 18 contributors who made this release possible. Here are some highlights ✨:

- all planned breaking changes for Base UI are done. The first beta release should come next week 🎉
- 🐛 bug fixes and 📚 documentation improvements.

### `@mui/material@5.12.3`

- &#8203;<!-- 43 -->[Accordion] Add missing `component` type (#37111) @sai6855
- &#8203;<!-- 23 -->[ButtonGroup] Should not retain divider color when it is disabled and variant is `text` (#36967) @DavidBoyer11
- &#8203;<!-- 21 -->[Divider] Fix styles on dividers with text (#35072) @maxdestors
- &#8203;<!-- 04 -->[TextField] Improve IntelliSense support for props (#36737) @sai6855
- &#8203;<!-- 03 -->[TextField] Fix running click event on disabled (#36892) @sai6855

### `@mui/joy@5.0.0-alpha.78`

- &#8203;<!-- 09 -->[Joy] Miscellaneous fixes and docs improvement (#37026) @siriwatknp

### `@mui/base@5.0.0-alpha.128`

#### Breaking changes

- The `component` prop is no longer supported because it can be replaced with the slots API. This is how the transformation will look like:

```diff
<Button
- component="span"
+ slots={{ root: "span" }}
/>
```

If using TypeScript, the custom component type should be added as a generic on the `Button` component.

```diff
-<Button
+<Button<typeof CustomComponent>
slots={{ root: CustomComponent }}
customProp="foo"
/>
```

There is codemod that you can run in your project to do the transformation:

```sh
npx @mui/codemod v5.0.0/base-remove-component-prop <path>
```

The full documentation about the codemod can be found [here](https://github.com/mui/material-ui/blob/master/packages/mui-codemod/README.md#base-remove-component-prop).

This is the list of PR related to this change:

- &#8203;<!-- 40 -->[Button][base] Drop `component` prop (#36677) @mnajdova
- &#8203;<!-- 42 -->[Badge][base] Drop `component` prop (#37028) @hbjORbj
- &#8203;<!-- 37 -->[FormControl][base] Drop component prop (#37031) @hbjORbj
- &#8203;<!-- 35 -->[Input][base] Drop component prop (#37057) @hbjORbj
- &#8203;<!-- 34 -->[Menu][base] Drop component prop (#37033) @hbjORbj
- &#8203;<!-- 33 -->[MenuItem][base] Drop component prop (#37032) @hbjORbj
- &#8203;<!-- 32 -->[Modal][base] Drop component prop (#37058) @hbjORbj
- &#8203;<!-- 31 -->[Option][base] Drop component prop (#37052) @hbjORbj
- &#8203;<!-- 30 -->[OptionGroup][base] Drop component prop (#37055) @hbjORbj
- &#8203;<!-- 31 -->[Popper][base] Drop component prop (#37084) @hbjORbj
- &#8203;<!-- 29 -->[Select][base] Drop component prop (#37035) @hbjORbj
- &#8203;<!-- 28 -->[Slider][base] Drop component prop (#37056) @hbjORbj
- &#8203;<!-- 27 -->[Snackbar][base] Drop component prop (#37041) @nicolas-ot
- &#8203;<!-- 26 -->[Switch][base] Drop component prop (#37053) @hbjORbj
- &#8203;<!-- 25 -->[Tab][base] Drop component prop (#36768) @sai6855
- &#8203;<!-- 24 -->[Tabs][base] Drop component prop (#36770) @sai6855
- &#8203;<!-- 08 -->[TablePagination][base] Drop component prop (#37059) @sai6855
- &#8203;<!-- 07 -->[TabPanel][base] Drop component prop (#37054) @sai6855
- &#8203;<!-- 06 -->[TabsList][base] Drop component prop (#37042) @sai6855

- &#8203;<!-- 41 -->[base] Improve API consistency (#36970) @michaldudak

Brought consistency to Base UI components and hooks' parameters and return values:

1. Whenever a hook needs a ref, it's now called `<slot_name>Ref`, which matches the `get<slot_name>Props` in the return value.
2. All hooks that accept external refs now return merged refs, making combining multiple hooks on one element easier. This was proven necessary in several compound components (like menuItem being both a button and a list item). The type of this value is `React.RefCallback` as using the more general `React.Ref` caused variance issues.
3. Type of accepted refs is standardized to `React.Ref<Element>`
4. Naming and typing of the forwarded ref in unstyled components were standardized - it's forwardedRef: React.ForwardedRef<Element> (unless a more specific type is needed).
5. The shape of the definition of unstyled components was standardized - it's React.forwardRef(function Component(props: Props, forwardedRef: React.Ref<Element>) { ... });. Specifically, the generic parameters of forwardRef were removed as they are specified in function arguments.

#### Changes

- &#8203;<!-- 36 -->[FormControl][base] Do not use optional fields in useFormControlContext's return value (#37037) @michaldudak

### Docs

- &#8203;<!-- 39 -->[base][docs] Add Base UI Quickstart Guide (#36717) @mj12albert
- &#8203;<!-- 20 -->[docs] Fix Material UI's API linking to Base UI (#37121) @mnajdova
- &#8203;<!-- 19 -->[docs] Fix pagination in the DataGrid demo (#37114) @cherniavskii
- &#8203;<!-- 18 -->[docs] Add notification to the release of the new Time Picker UI (#37065) @joserodolfofreitas
- &#8203;<!-- 17 -->[docs] Specify "Material UI" (not "MUI") where appropriate throughout the docs (#37066) @samuelsycamore
- &#8203;<!-- 16 -->[docs] Use focus-visible instead of focus for Menu demos (#36847) @michaldudak
- &#8203;<!-- 15 -->[docs] Fix small regressions API pages (#36972) @oliviertassinari
- &#8203;<!-- 14 -->[docs] Handle a few docs-feedback (#36977) @oliviertassinari
- &#8203;<!-- 13 -->[docs] Fix anchor link in customization (#37004) @oliviertassinari
- &#8203;<!-- 12 -->[docs] Add a note about minimal required version for theme merging to the guides (#36973) @jakub-stastny
- &#8203;<!-- 11 -->[docs] smooth scrolling added for `back to top` (#37011) @PunitSoniME
- &#8203;<!-- 10 -->[docs] Remove `useFormControl` return values from demos page (#37036) @ZeeshanTamboli
- &#8203;<!-- 47 --> [docs][base] Move styles to the bottom of demos code for `SwitchUnstyled` (#36720) @varunmulay22
- &#8203;<!-- 46 --> [docs][base] Move styles to the bottom of demos code for `InputUnstyled` (#36724) @varunmulay22
- &#8203;<!-- 45 --> [docs][base] Move styles to the bottom of demos code for `SliderUnstyled` (#36721) @varunmulay22
- &#8203;<!-- 44 --> [docs][base] Move styles to the bottom of demos code for `Snackbar` (#36719) @varunmulay22
- &#8203;<!-- 38 -->[docs][base] Move styles to the bottom of demos code for `SelectUnstyled` (#36718) @varunmulay22
- &#8203;<!-- 05 -->[templates] Image not displayed in blog layout of React template. (#36991) @navedqb
- &#8203;<!-- 02 -->[website] Take the design role offline @oliviertassinari
- &#8203;<!-- 01 -->[website] Fix URL convention @oliviertassinari
- &#8203;<!-- 21 -->[docs] Turn off job banner on docs (#36080) @joserodolfofreitas

### Core

- &#8203;<!-- 22 -->[core] Allow type alias as well in hooks API docs generation (#37034) @ZeeshanTamboli

All contributors of this release in alphabetical order: @cherniavskii, @DavidBoyer11, @hbjORbj, @jakub-stastny, @joserodolfofreitas, @maxdestors, @michaldudak, @mj12albert, @mnajdova, @navedqb, @nicolas-ot, @oliviertassinari, @PunitSoniME, @sai6855, @samuelsycamore, @siriwatknp, @varunmulay22, @ZeeshanTamboli

## 5.12.2

<!-- generated comparing v5.12.1..master -->
Expand Down
12 changes: 6 additions & 6 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
"server:system": "cd ../ && cross-env NODE_ENV=production BABEL_ENV=benchmark babel-node benchmark/server/scenarios/system.js --inspect=0.0.0.0:9229 --extensions \".tsx,.ts,.js\""
},
"dependencies": {
"@chakra-ui/system": "^2.5.5",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@chakra-ui/system": "^2.5.6",
"@emotion/react": "^11.10.8",
"@emotion/styled": "^11.10.8",
"@mdx-js/react": "^2.3.0",
"@mui/material": "^5.12.2",
"@mui/styles": "^5.12.0",
"@mui/system": "^5.12.1",
"@mui/material": "^5.12.3",
"@mui/styles": "^5.12.3",
"@mui/system": "^5.12.3",
"@styled-system/css": "^5.1.5",
"benchmark": "^2.1.4",
"playwright": "^1.31.2",
Expand Down
2 changes: 0 additions & 2 deletions docs/.link-check-errors.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Broken links found by `yarn docs:link-check` that exist:

- https://mui.com/base/react-portal/components-api/#portal
- https://mui.com/blog/material-ui-v4-is-out/#premium-themes-store-✨
- https://mui.com/material-ui/guides/minimizing-bundle-size/#legacy-bundle
- https://mui.com/size-snapshot
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/badge-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `BadgeUnstyled` component creates a badge that is applied to its child eleme

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import BadgeUnstyled from '@mui/base/BadgeUnstyled';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/badge-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `BadgeUnstyled` component creates a badge that is applied to its child eleme

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import BadgeUnstyled from '@mui/base/BadgeUnstyled';
Expand Down
36 changes: 20 additions & 16 deletions docs/data/base/components/badge/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The Badge component creates a badge that is applied to its child element.

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import Badge from '@mui/base/Badge';
Expand Down Expand Up @@ -59,27 +59,17 @@ The Badge component is composed of a root `<span>` that houses the element that
</span>
```

### Slot props
### Custom structure

:::info
The following props are available on all non-utility Base components.
See [Usage](/base/getting-started/usage/) for full details.
:::

Use the `component` prop to override the root slot with a custom element:

```jsx
<Badge component="div" />
```

Use the `slots` prop to override any interior slots in addition to the root:
Use the `slots` prop to override the root or any other interior slot:

```jsx
<Badge slots={{ root: 'div', badge: 'div' }} />
```

:::warning
If the root element is customized with both the `component` and `slots` props, then `component` will take precedence.
:::info
The `slots` prop is available on all non-utility Base components.
See [Overriding component structure](/base/guides/overriding-component-structure/) for full details.
:::

Use the `slotProps` prop to pass custom props to internal slots.
Expand All @@ -89,6 +79,20 @@ The following code snippet applies a CSS class called `my-badge` to the badge sl
<Badge slotProps={{ badge: { className: 'my-badge' } }} />
```

#### Usage with TypeScript

In TypeScript, you can specify the custom component type used in the `slots.root` as a generic parameter of the unstyled component. This way, you can safely provide the custom root's props directly on the component:

```tsx
<Badge<typeof CustomComponent> slots={{ root: CustomComponent }} customProp />
```

The same applies for props specific to custom primitive elements:

```tsx
<Badge<'img'> slots={{ root: 'img' }} src="badge.png" />
```

## Hook

```jsx
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/button/button-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/button/

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import ButtonUnstyled from '@mui/base/ButtonUnstyled';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/button/button-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ waiAria: https://www.w3.org/WAI/ARIA/apg/patterns/button/

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import ButtonUnstyled from '@mui/base/ButtonUnstyled';
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/button/button.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The Button component replaces the native HTML `<button>` element, and offers exp

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import Button from '@mui/base/Button';
Expand Down Expand Up @@ -80,7 +80,7 @@ Similarly, `<Button slots={{ root: "span" }} type="reset">` will not reset its p

#### Usage with TypeScript

In TypeScript, you can specify the custom component type used in the `slots.root` as a generic to the unstyled component. This way, you can safely provide the custom compoenent's props directly on the compnent:
In TypeScript, you can specify the custom component type used in the `slots.root` as a generic parameter of the unstyled component. This way, you can safely provide the custom root's props directly on the component:

```tsx
<Button<typeof CustomComponent> slots={{ root: CustomComponent }} customProp />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This is useful for components like [`PopperUnstyled`](/base/react-popper/) which

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import ClickAwayListener from '@mui/base/ClickAwayListener';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This is useful for components like [`PopperUnstyled`](/base/react-popper/) which

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import ClickAwayListener from '@mui/base/ClickAwayListener';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Click-Away Listener also supports the [Portal](/base/react-portal/) component.

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import ClickAwayListener from '@mui/base/ClickAwayListener';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/focus-trap/focus-trap-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ githubLabel: 'component: FocusTrap'

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import FocusTrap from '@mui/base/FocusTrap';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/focus-trap/focus-trap-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ githubLabel: 'component: FocusTrap'

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import FocusTrap from '@mui/base/FocusTrap';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/focus-trap/focus-trap.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Focus Trap is a utility component that's useful when implementing an overlay suc

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import FocusTrap from '@mui/base/FocusTrap';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/form-control/form-control-pt.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For instance, you may want to show an additional element asking the user to ente

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import FormControlUnstyled from '@mui/base/FormControlUnstyled';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/form-control/form-control-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ For instance, you may want to show an additional element asking the user to ente

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import FormControlUnstyled from '@mui/base/FormControlUnstyled';
Expand Down
16 changes: 15 additions & 1 deletion docs/data/base/components/form-control/form-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For instance, you may want to show an additional element asking the user to ente

### Usage

After [installation](/base/getting-started/installation/), you can start building with this component using the following basic elements:
After [installation](/base/getting-started/quickstart/#installation), you can start building with this component using the following basic elements:

```jsx
import FormControl from '@mui/base/FormControl';
Expand Down Expand Up @@ -53,6 +53,20 @@ Note that it also uses the `useFormControlContext` hook in order to pass props t

{{"demo": "BasicFormControl.js"}}

#### Usage with TypeScript

In TypeScript, you can specify the custom component type used in the `slots.root` as a generic parameter of the unstyled component. This way, you can safely provide the custom root's props directly on the component:

```tsx
<FormControl<typeof CustomComponent> slots={{ root: CustomComponent }} customProp />
```

The same applies for props specific to custom primitive elements:

```tsx
<FormControl<'button'> slots={{ root: 'button' }} onClick={() => {}} />
```

## Hook

```jsx
Expand Down

0 comments on commit 2dbe2a7

Please sign in to comment.