Skip to content

Commit 49fc3e7

Browse files
committed
Merge remote-tracking branch 'upstream/master' into base/number-input-reducer
2 parents 7a6c1a2 + b2c4a86 commit 49fc3e7

File tree

15 files changed

+107
-115
lines changed

15 files changed

+107
-115
lines changed
+11-24
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,22 @@
11
import * as React from 'react';
22
import Avatar from '@mui/joy/Avatar';
3-
import Box from '@mui/joy/Box';
43
import Card from '@mui/joy/Card';
54
import Link from '@mui/joy/Link';
65
import Typography from '@mui/joy/Typography';
7-
import CenterFocusWeak from '@mui/icons-material/CenterFocusWeak';
86

97
export default function LinkCard() {
108
return (
11-
<Card>
12-
<Box sx={{ display: 'flex', gap: 2, mb: 2 }}>
13-
<Avatar size="lg" src="/static/images/avatar/1.jpg" />
14-
<div>
15-
{/* This could be a heading (eg. h2) depends on your use case. */}
16-
<Typography component="div">
17-
<Link
18-
overlay
19-
href="#with-card"
20-
textColor="inherit"
21-
underline="none"
22-
fontWeight="md"
23-
>
24-
Joy UI
25-
</Link>
26-
</Typography>
27-
<Typography level="body-sm">Components that spark joy!</Typography>
28-
</div>
29-
</Box>
30-
<Typography level="body-sm" display="flex" alignItems="center" gap={0.5}>
31-
Click the <CenterFocusWeak /> and <kbd>TAB</kbd> to test the focus
32-
</Typography>
9+
<Card variant="outlined" sx={{ display: 'flex', gap: 2 }}>
10+
<Avatar size="lg" src="/static/images/avatar/1.jpg" />
11+
<Link
12+
overlay
13+
href="#introduction"
14+
underline="none"
15+
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }}
16+
>
17+
<Typography level="body-md">Joy UI</Typography>
18+
<Typography level="body-sm">Components that spark joy!</Typography>
19+
</Link>
3320
</Card>
3421
);
3522
}
+11-24
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,22 @@
11
import * as React from 'react';
22
import Avatar from '@mui/joy/Avatar';
3-
import Box from '@mui/joy/Box';
43
import Card from '@mui/joy/Card';
54
import Link from '@mui/joy/Link';
65
import Typography from '@mui/joy/Typography';
7-
import CenterFocusWeak from '@mui/icons-material/CenterFocusWeak';
86

97
export default function LinkCard() {
108
return (
11-
<Card>
12-
<Box sx={{ display: 'flex', gap: 2, mb: 2 }}>
13-
<Avatar size="lg" src="/static/images/avatar/1.jpg" />
14-
<div>
15-
{/* This could be a heading (eg. h2) depends on your use case. */}
16-
<Typography component="div">
17-
<Link
18-
overlay
19-
href="#with-card"
20-
textColor="inherit"
21-
underline="none"
22-
fontWeight="md"
23-
>
24-
Joy UI
25-
</Link>
26-
</Typography>
27-
<Typography level="body-sm">Components that spark joy!</Typography>
28-
</div>
29-
</Box>
30-
<Typography level="body-sm" display="flex" alignItems="center" gap={0.5}>
31-
Click the <CenterFocusWeak /> and <kbd>TAB</kbd> to test the focus
32-
</Typography>
9+
<Card variant="outlined" sx={{ display: 'flex', gap: 2 }}>
10+
<Avatar size="lg" src="/static/images/avatar/1.jpg" />
11+
<Link
12+
overlay
13+
href="#introduction"
14+
underline="none"
15+
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }}
16+
>
17+
<Typography level="body-md">Joy UI</Typography>
18+
<Typography level="body-sm">Components that spark joy!</Typography>
19+
</Link>
3320
</Card>
3421
);
3522
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Card variant="outlined" sx={{ display: 'flex', gap: 2 }}>
2+
<Avatar size="lg" src="/static/images/avatar/1.jpg" />
3+
<Link
4+
overlay
5+
href="#introduction"
6+
underline="none"
7+
sx={{ display: 'flex', flexDirection: 'column', alignItems: 'start' }}
8+
>
9+
<Typography level="body-md">Joy UI</Typography>
10+
<Typography level="body-sm">Components that spark joy!</Typography>
11+
</Link>
12+
</Card>

docs/data/material/components/material-icons/SearchIcons.js

-18
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,10 @@ const Icons = React.memo(function Icons(props) {
132132

133133
const handleIconClick = (icon) => () => {
134134
if (Math.random() < 0.1) {
135-
window.ga('send', {
136-
hitType: 'event',
137-
eventCategory: 'material-icons',
138-
eventAction: 'click',
139-
eventLabel: icon.name,
140-
});
141135
window.gtag('event', 'material-icons', {
142136
eventAction: 'click',
143137
eventLabel: icon.name,
144138
});
145-
window.ga('send', {
146-
hitType: 'event',
147-
eventCategory: 'material-icons-theme',
148-
eventAction: 'click',
149-
eventLabel: icon.theme,
150-
});
151139
window.gtag('event', 'material-icons-theme', {
152140
eventAction: 'click',
153141
eventLabel: icon.theme,
@@ -505,12 +493,6 @@ export default function SearchIcons() {
505493

506494
// Keep track of the no results so we can add synonyms in the future.
507495
if (value.length >= 4 && results.length === 0) {
508-
window.ga('send', {
509-
hitType: 'event',
510-
eventCategory: 'material-icons',
511-
eventAction: 'no-results',
512-
eventLabel: value,
513-
});
514496
window.gtag('event', 'material-icons', {
515497
eventAction: 'no-results',
516498
eventLabel: value,

docs/data/material/guides/routing/routing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const LinkBehavior = React.forwardRef((props, ref) => (
101101

102102
### Next.js Pages Router
103103

104-
The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-nextjs-ts) provides an adapter for the use of [Next.js's Link component](https://nextjs.org/docs/api-reference/next/link) with Material UI.
104+
The [example folder](https://github.com/mui/material-ui/tree/HEAD/examples/material-ui-nextjs-pages-router-ts) provides an adapter for the use of [Next.js's Link component](https://nextjs.org/docs/api-reference/next/link) with Material UI.
105105

106106
- The first version of the adapter is the [`NextLinkComposed`](https://github.com/mui/material-ui/blob/-/examples/material-ui-nextjs-pages-router-ts/src/Link.tsx) component.
107107
This component is unstyled and only responsible for handling the navigation.

docs/pages/_app.js

-7
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,6 @@ export function reportWebVitals({ id, name, label, delta, value }) {
359359
return;
360360
}
361361

362-
window.ga('send', 'event', {
363-
eventCategory: label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',
364-
eventAction: name,
365-
eventValue: Math.round(name === 'CLS' ? value * 1000 : value), // values must be integers
366-
eventLabel: id, // id unique to current page load
367-
nonInteraction: true, // avoids affecting bounce rate.
368-
});
369362
window.gtag('event', name, {
370363
value: delta,
371364
metric_label: label === 'web-vital' ? 'Web Vitals' : 'Next.js custom metric',

docs/pages/_document.js

-8
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ if (process.env.NODE_ENV === 'production') {
3434
const PRODUCTION_GA =
3535
process.env.DEPLOY_ENV === 'production' || process.env.DEPLOY_ENV === 'staging';
3636

37-
// TODO remove https://support.google.com/analytics/answer/11986666
38-
const GOOGLE_ANALYTICS_ID = PRODUCTION_GA ? 'UA-106598593-2' : 'UA-106598593-3';
39-
4037
const GOOGLE_ANALYTICS_ID_V4 = PRODUCTION_GA ? 'G-5NXDQLC2ZK' : 'G-XJ83JQEK7J';
4138

4239
export default class MyDocument extends Document {
@@ -176,11 +173,6 @@ export default class MyDocument extends Document {
176173
// eslint-disable-next-line react/no-danger
177174
dangerouslySetInnerHTML={{
178175
__html: `
179-
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
180-
window.ga('create','${GOOGLE_ANALYTICS_ID}',{
181-
sampleRate: ${PRODUCTION_GA ? 80 : 100},
182-
});
183-
184176
window.dataLayer = window.dataLayer || [];
185177
function gtag(){dataLayer.push(arguments);}
186178
window.gtag = gtag;

docs/src/components/header/HeaderNavDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const DOCS = [
113113
name: 'MUI Toolpad',
114114
description: 'Low-code admin builder.',
115115
href: ROUTES.toolpadDocs,
116-
chip: 'Alpha',
116+
chip: 'Beta',
117117
},
118118
];
119119

docs/src/modules/components/Ad.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,7 @@ class AdErrorBoundary extends React.Component {
8888
// send explicit `'null'`
8989
const eventLabel = String(this.props.eventLabel);
9090
// TODO: Use proper error monitoring service (e.g. Sentry) instead
91-
window.ga('send', {
92-
hitType: 'event',
93-
eventCategory: 'ad',
94-
eventAction: 'crash',
95-
eventLabel,
96-
});
91+
9792
window.gtag('event', 'ad', {
9893
eventAction: 'crash',
9994
eventLabel,
@@ -199,12 +194,6 @@ export default function Ad() {
199194
}
200195

201196
const delay = setTimeout(() => {
202-
window.ga('send', {
203-
hitType: 'event',
204-
eventCategory: 'ad',
205-
eventAction: 'display',
206-
eventLabel,
207-
});
208197
window.gtag('event', 'ad', {
209198
eventAction: 'display',
210199
eventLabel,

docs/src/modules/components/GoogleAnalytics.js

-17
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import * as React from 'react';
22
import { useTheme } from '@mui/material/styles';
33
import useMediaQuery from '@mui/material/useMediaQuery';
44
import { useRouter } from 'next/router';
5-
import loadScript from 'docs/src/modules/utils/loadScript';
65
import { useNoSsrCodeVariant } from 'docs/src/modules/utils/codeVariant';
76
import { useNoSsrCodeStyling } from 'docs/src/modules/utils/codeStylingSolution';
87
import { useUserLanguage } from 'docs/src/modules/utils/i18n';
@@ -30,12 +29,6 @@ function handleClick(event) {
3029
return;
3130
}
3231

33-
window.ga('send', {
34-
hitType: 'event',
35-
eventCategory: category,
36-
eventAction: element.getAttribute('data-ga-event-action'),
37-
eventLabel: element.getAttribute('data-ga-event-label'),
38-
});
3932
window.gtag('event', category, {
4033
eventAction: element.getAttribute('data-ga-event-action'),
4134
eventLabel: element.getAttribute('data-ga-event-label'),
@@ -56,14 +49,11 @@ let boundDataGaListener = false;
5649
*/
5750
function GoogleAnalytics() {
5851
React.useEffect(() => {
59-
loadScript('https://www.google-analytics.com/analytics.js', document.querySelector('head'));
60-
6152
if (!boundDataGaListener) {
6253
boundDataGaListener = true;
6354
document.addEventListener('click', handleClick);
6455
}
6556
}, []);
66-
6757
const router = useRouter();
6858
const timeout = React.useRef();
6959

@@ -73,8 +63,6 @@ function GoogleAnalytics() {
7363
clearTimeout(timeout.current);
7464
timeout.current = setTimeout(() => {
7565
const { canonicalAsServer } = pathnameToLanguage(window.location.pathname);
76-
window.ga('set', { page: canonicalAsServer });
77-
window.ga('send', { hitType: 'pageview' });
7866

7967
// https://developers.google.com/analytics/devguides/collection/ga4/views?client_type=gtag
8068
window.gtag('event', 'page_view', {
@@ -88,15 +76,13 @@ function GoogleAnalytics() {
8876

8977
const codeVariant = useNoSsrCodeVariant();
9078
React.useEffect(() => {
91-
window.ga('set', 'dimension1', codeVariant);
9279
window.gtag('set', 'user_properties', {
9380
codeVariant,
9481
});
9582
}, [codeVariant]);
9683

9784
const userLanguage = useUserLanguage();
9885
React.useEffect(() => {
99-
window.ga('set', 'dimension2', userLanguage);
10086
window.gtag('set', 'user_properties', {
10187
userLanguage,
10288
});
@@ -109,7 +95,6 @@ function GoogleAnalytics() {
10995
*/
11096
function trackDevicePixelRation() {
11197
const devicePixelRatio = Math.round(window.devicePixelRatio * 10) / 10;
112-
window.ga('set', 'dimension3', devicePixelRatio);
11398
window.gtag('set', 'user_properties', {
11499
devicePixelRatio,
115100
});
@@ -135,14 +120,12 @@ function GoogleAnalytics() {
135120
const colorScheme = theme.palette.mode;
136121

137122
React.useEffect(() => {
138-
window.ga('set', 'dimension4', colorSchemeOS);
139123
window.gtag('set', 'user_properties', {
140124
colorSchemeOS,
141125
});
142126
}, [colorSchemeOS]);
143127

144128
React.useEffect(() => {
145-
window.ga('set', 'dimension5', colorScheme);
146129
window.gtag('set', 'user_properties', {
147130
colorScheme,
148131
});

packages/mui-material/src/ImageListItem/ImageListItem.js

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ const ImageListItem = React.forwardRef(function ImageListItem(inProps, ref) {
101101
gridColumnEnd: variant !== 'masonry' ? `span ${cols}` : undefined,
102102
gridRowEnd: variant !== 'masonry' ? `span ${rows}` : undefined,
103103
marginBottom: variant === 'masonry' ? gap : undefined,
104+
breakInside: variant === 'masonry' ? 'avoid' : undefined,
104105
...style,
105106
}}
106107
ownerState={ownerState}

packages/mui-system/src/Box/Box.test.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import * as React from 'react';
33
import { expect } from 'chai';
44
import { createRenderer, describeConformance } from 'test/utils';
5-
import { Box } from '@mui/system';
5+
import { Box, createTheme, ThemeProvider } from '@mui/system';
66

77
describe('<Box />', () => {
88
const { render } = createRenderer();
@@ -279,4 +279,34 @@ describe('<Box />', () => {
279279

280280
expect(getByTestId('regular-box')).to.have.class('MuiBox-root');
281281
});
282+
283+
describe('prop: maxWidth', () => {
284+
it('should resolve breakpoints with custom units', function test() {
285+
const isJSDOM = /jsdom/.test(window.navigator.userAgent);
286+
287+
if (isJSDOM) {
288+
this.skip();
289+
}
290+
291+
const theme = createTheme({
292+
breakpoints: {
293+
unit: 'rem',
294+
values: {
295+
xs: 10,
296+
},
297+
},
298+
});
299+
300+
const { container } = render(
301+
<ThemeProvider theme={theme}>
302+
<Box maxWidth="xs" />,
303+
</ThemeProvider>,
304+
);
305+
306+
expect(container.firstChild).toHaveComputedStyle({
307+
// 10rem x 16px = 160px
308+
maxWidth: '160px',
309+
});
310+
});
311+
});
282312
});

packages/mui-system/src/sizing.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,21 @@ export const maxWidth = (props) => {
1616
const styleFromPropValue = (propValue) => {
1717
const breakpoint =
1818
props.theme?.breakpoints?.values?.[propValue] || breakpointsValues[propValue];
19+
20+
if (!breakpoint) {
21+
return {
22+
maxWidth: sizingTransform(propValue),
23+
};
24+
}
25+
26+
if (props.theme?.breakpoints?.unit !== 'px') {
27+
return {
28+
maxWidth: `${breakpoint}${props.theme.breakpoints.unit}`,
29+
};
30+
}
31+
1932
return {
20-
maxWidth: breakpoint || sizingTransform(propValue),
33+
maxWidth: breakpoint,
2134
};
2235
};
2336
return handleBreakpoints(props, props.maxWidth, styleFromPropValue);

0 commit comments

Comments
 (0)