Skip to content

Commit

Permalink
Merge branch 'master' into poc/material-you-new-component
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Nov 21, 2022
2 parents 0c1f512 + bcf632c commit b9dd876
Show file tree
Hide file tree
Showing 10,764 changed files with 1,134 additions and 64,631 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ defaults: &defaults
AWS_REGION_ARTIFACTS: eu-central-1
working_directory: /tmp/material-ui
docker:
- image: cimg/node:14.20
- image: cimg/node:14.21

# CircleCI has disabled the cache across forks for security reasons.
# Following their official statement, it was a quick solution, they
Expand Down
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.13
uses: github/codeql-action/init@d00e8c09a38ef8c1ca1091fc55ef490776d2de73 # v2.1.13
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@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.13
uses: github/codeql-action/analyze@d00e8c09a38ef8c1ca1091fc55ef490776d2de73 # v2.1.13
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@9e288b03632e540432812c08ffaef313da7fb1d9 # v1.1.31
uses: github/codeql-action/upload-sarif@73113785b9e3aa4b2c9c2e1c91463606e882665e # v1.1.33
with:
sarif_file: results.sarif
6 changes: 3 additions & 3 deletions benchmark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"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.3.1",
"@chakra-ui/system": "^2.3.3",
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mdx-js/react": "^2.1.5",
Expand All @@ -29,8 +29,8 @@
"redux": "^4.2.0",
"serve-handler": "^6.1.5",
"styled-components": "^5.3.6",
"theme-ui": "^0.15.3",
"webpack": "^5.74.0",
"theme-ui": "^0.15.4",
"webpack": "^5.75.0",
"webpack-cli": "^4.10.0"
}
}
25 changes: 7 additions & 18 deletions docs/data/joy/components/alert/AlertColors.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as React from 'react';
import Alert from '@mui/joy/Alert';
import Stack from '@mui/joy/Stack';
import Box from '@mui/joy/Box';
import Radio from '@mui/joy/Radio';
import RadioGroup from '@mui/joy/RadioGroup';
import Sheet from '@mui/joy/Sheet';

import Typography from '@mui/joy/Typography';
import * as React from 'react';

export default function AlertColors() {
const [variant, setVariant] = React.useState('solid');
Expand All @@ -14,16 +15,11 @@ export default function AlertColors() {
sx={{
display: 'flex',
alignItems: 'center',
gap: 3,
justifyContent: 'center',
width: '100%',
}}
>
<Box
sx={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))',
gap: 1,
}}
>
<Stack spacing={1} sx={{ width: '100%', maxWidth: 400 }}>
<Alert variant={variant} color="primary">
Primary
</Alert>
Expand All @@ -42,15 +38,8 @@ export default function AlertColors() {
<Alert variant={variant} color="warning">
Warning
</Alert>
</Box>
<Sheet
sx={{
background: 'transparent',
pl: 4,
borderLeft: '1px solid',
borderColor: 'divider',
}}
>
</Stack>
<Sheet sx={{ pl: 4, ml: 3, borderLeft: '1px solid', borderColor: 'divider' }}>
<Typography
level="body2"
fontWeight="xl"
Expand Down
25 changes: 7 additions & 18 deletions docs/data/joy/components/alert/AlertColors.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import * as React from 'react';
import Alert from '@mui/joy/Alert';
import Stack from '@mui/joy/Stack';
import Box from '@mui/joy/Box';
import Radio from '@mui/joy/Radio';
import RadioGroup from '@mui/joy/RadioGroup';
import Sheet from '@mui/joy/Sheet';
import { VariantProp } from '@mui/joy/styles';
import Typography from '@mui/joy/Typography';
import * as React from 'react';

export default function AlertColors() {
const [variant, setVariant] = React.useState<VariantProp>('solid');
Expand All @@ -14,16 +15,11 @@ export default function AlertColors() {
sx={{
display: 'flex',
alignItems: 'center',
gap: 3,
justifyContent: 'center',
width: '100%',
}}
>
<Box
sx={{
display: 'grid',
gridTemplateColumns: 'repeat(auto-fit, minmax(150px, 1fr))',
gap: 1,
}}
>
<Stack spacing={1} sx={{ width: '100%', maxWidth: 400 }}>
<Alert variant={variant} color="primary">
Primary
</Alert>
Expand All @@ -42,15 +38,8 @@ export default function AlertColors() {
<Alert variant={variant} color="warning">
Warning
</Alert>
</Box>
<Sheet
sx={{
background: 'transparent',
pl: 4,
borderLeft: '1px solid',
borderColor: 'divider',
}}
>
</Stack>
<Sheet sx={{ pl: 4, ml: 3, borderLeft: '1px solid', borderColor: 'divider' }}>
<Typography
level="body2"
fontWeight="xl"
Expand Down
63 changes: 23 additions & 40 deletions docs/data/joy/components/alert/alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,38 @@ Alerts should not be confused with alert _dialogs_ ([ARIA](https://www.w3.org/WA
Use the Joy UI [Modal](https://mui.com/joy-ui/react-modal/) if you need the behavior of a dialog.
:::

{{"demo": "AlertUsage.js", "hideToolbar": true}}
{{"demo": "AlertUsage.js", "hideToolbar": true, "bg": "gradient"}}

{{"component": "modules/components/ComponentLinkHeader.js", "design": false}}

## Usage

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

```jsx
import Alert from '@mui/joy/Alert';

export default function MyApp() {
return <Alert />;
}
```

## Basics

The Alert component wraps around its content, and stretches to fill its enclosing container, as shown below:

{{"demo": "AlertBasic.js"}}

## Anatomy

The Alert component is composed of a single root `<div>` element with its `role` set to `alert`:

```html
<div role="alert" class="JoyAlert-root">
This is how an Alert renders in the DOM.
</div>
```

### Overriding the root slot
## Customization

Use the `component` prop to override the root slot with a custom element.
For example, the following code snippet replaces the default `<div>` with a `<span>`:
### Variants

```jsx
<Alert component="span">Alert content</Alert>
The Alert component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `solid`, `soft` (default), `outlined`, and `plain`.

// renders as:
<span role="alert" class="JoyAlert-root">
Alert content
</span>
```
{{"demo": "AlertVariants.js"}}

## Customization
:::success
To learn how to add your own variants, check out [Themed components—Extend variants](/joy-ui/customization/themed-components/#extend-variants).
Note that you lose the global variants when you add custom variants.
:::

### Variants
### Sizes

The Alert component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `soft` (default), `solid`, `outlined`, and `plain`.
The Alert component comes in three sizes: `sm`, `md` (default), and `lg`:

{{"demo": "AlertVariants.js"}}
{{"demo": "AlertSizes.js"}}

### Colors

Expand All @@ -79,12 +58,6 @@ The demo below shows how the values for the `color` prop are affected by the glo

{{"demo": "AlertColors.js"}}

### Sizes

The Alert component comes with three sizes out of the box: `sm`, `md` (the default), and `lg`:

{{"demo": "AlertSizes.js"}}

### Decorators

Use the `startDecorator` and `endDecorator` props to append actions and icons to either side of the Alert:
Expand All @@ -111,3 +84,13 @@ Here are some factors to consider to ensure that your Alert is accessible:
- Alerts that occur too frequently can [inhibit the usability](https://www.w3.org/TR/UNDERSTANDING-WCAG20/time-limits-postponed.html) of your app.
- Dynamically rendered alerts are announced by screen readers; alerts that are already present on the page when it loads are _not_ announced.
- Color does not add meaning to the UI for users who require assistive technology. You must ensure that any information conveyed through color is also denoted in other ways, such as within the text of the alert itself, or with additional hidden text that's read by screen readers.

## Anatomy

The Alert component is composed of a single root `<div>` element with its `role` set to `alert`:

```html
<div role="alert" class="JoyAlert-root">
<!-- Alert contents -->
</div>
```
77 changes: 23 additions & 54 deletions docs/data/joy/components/aspect-ratio/aspect-ratio.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,76 +18,31 @@ As of Q4 2022, compatibility is at 90%.
Source: [Can I use…](https://caniuse.com/?search=aspect-ratio)
:::

## Usage

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

```jsx
import AspectRatio from '@mui/joy/AspectRatio';

export default function MyApp() {
return <AspectRatio />;
}
```

## Basics

The Aspect Ratio component wraps around the content that it resizes.
The element to be resized must be the first direct child.
The default ratio is `16/9`.

{{"demo": "BasicRatio.js"}}

## Anatomy

The Aspect Ratio component is composed of a root `<div>` with a content `<div>` nested inside; the child component is given a `data-first-child` attribute for styling purposes:

```html
<div class="JoyAspectRatio-root">
<div class="JoyAspectRatio-content">
<some-element data-first-child>
This is how an Aspect Ratio component renders in the DOM.
</some-element>
</div>
</div>
```

### Overriding the root slot

Use the `component` prop to override the root slot with a custom element.
For example, the following code snippet replaces the default `<div>` with a `<section>`:

```jsx
<AspectRatio component="section" />
```

### Overriding interior slots

Use the `components` prop to override any interior slots in addition to the root:

<AspectRatio components={{ Content: 'article' }} />

:::warning
If the root element is customized with both the `component` and `components` props, then `component` will take precedence.
:::

Use the `componentsProps` prop to pass custom props to internal slots.
The following code snippet applies a CSS class called `my-content` to the content slot:

<AspectRatio componentsProps={{ content: { className: 'my-content' } }} />

:::warning
Note that `componentsProps` slot names are written in lowercase (root) while `components` slot names are capitalized (Root).
:::

## Customization

### Variants

The Aspect Ratio component supports the four [global variants](/joy-ui/main-features/global-variants/): `solid`, `soft` (default), `outlined`, and `plain`.
The Aspect Ratio component supports Joy UI's four [global variants](/joy-ui/main-features/global-variants/): `solid`, `soft` (default), `outlined`, and `plain`.

{{"demo": "VariantsRatio.js"}}

:::success
To learn how to add your own variants, check out [Themed components—Extend variants](/joy-ui/customization/themed-components/#extend-variants).
Note that you lose the global variants when you add custom variants.
:::

### Ratio

Use the `ratio` prop to change the aspect ratio, following the pattern `height/width`.
Expand Down Expand Up @@ -120,13 +75,13 @@ This is useful when the Aspect Ratio component wraps dynamic-width content, as s

{{"demo": "MinMaxRatio.js"}}

### Usage inside a flex row
## Usage inside a flex row

When the Aspect Ratio component is a child of a flexbox `row` container, use `flex-basis` to set the ideal width of the content:

{{"demo": "FlexRowRatio.js"}}

### Usage with Next.js Image component
## Usage with Next.js Image

The Aspect Ratio component can be used with a [Next.js Image](https://nextjs.org/docs/basic-features/image-optimization) component as a child.
The Image should always include the `layout="fill"` property—otherwise it requires `height` and `width` values, which would defeat the purpose of the Aspect Ratio component.
Expand Down Expand Up @@ -161,3 +116,17 @@ In designs like this, make sure to assign a `minWidth` value to prevent the Aspe
This is a simple illustration of how to use Aspect Ratio with list components:

{{"demo": "ListStackRatio.js"}}

## Anatomy

The Aspect Ratio component is composed of a root `<div>` with a content `<div>` nested inside; the child component is given a `data-first-child` attribute for styling purposes:

```html
<div class="JoyAspectRatio-root">
<div class="JoyAspectRatio-content">
<some-element data-first-child>
<!-- Aspect Ratio contents -->
</some-element>
</div>
</div>
```
1 change: 0 additions & 1 deletion docs/data/joy/components/autocomplete/CustomTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default function CustomTags() {
id="tags-default"
multiple
placeholder="Favorites"
variant="soft"
options={top100Films}
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13]]}
Expand Down
1 change: 0 additions & 1 deletion docs/data/joy/components/autocomplete/CustomTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default function CustomTags() {
id="tags-default"
multiple
placeholder="Favorites"
variant="soft"
options={top100Films}
getOptionLabel={(option) => option.title}
defaultValue={[top100Films[13]]}
Expand Down
Loading

0 comments on commit b9dd876

Please sign in to comment.