Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into test-utils-from-npm
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Jun 11, 2024
2 parents fa80658 + d40b500 commit 56e110c
Show file tree
Hide file tree
Showing 586 changed files with 1,079 additions and 1,158 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ default-job: &default-job
REACT_VERSION: << parameters.react-version >>
TEST_GATE: << parameters.test-gate >>
AWS_REGION_ARTIFACTS: eu-central-1
working_directory: /tmp/material-ui
working_directory: /tmp/base-ui
docker:
- image: cimg/node:18.20

Expand Down
25 changes: 25 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const baseline = require('@mui/monorepo/.eslintrc');
const path = require('path');

const OneLevelImportMessage = [
'Prefer one level nested imports to avoid bundling everything in dev mode or breaking CJS/ESM split.',
'See https://github.com/mui/material-ui/pull/24147 for the kind of win it can unlock.',
].join('\n');

module.exports = {
...baseline,
settings: {
Expand All @@ -18,6 +23,26 @@ module.exports = {
...baseline.rules,
// TODO move to @mui/monorepo, codebase is moving away from default exports
'import/prefer-default-export': 'off',
'no-restricted-imports': [
'error',
{
patterns: [
{
group: [
'@mui/*/*/*',
'@pigment-css/*/*/*',
'@base_ui/react/*/*',
'!@base_ui/react/legacy/*',
// Allow any import depth with any internal packages
'!@mui/internal-*/**',
// TODO delete, @mui/docs should be @mui/internal-docs
'!@mui/docs/**',
],
message: OneLevelImportMessage,
},
],
},
],
},
overrides: [
...baseline.overrides,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { Button } from '@base_ui/react/Button';
import { Input } from '@base_ui/react/Input';
import { Popper } from '@base_ui/react/Popper';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { Button } from '@base_ui/react/legacy/Button';
import { Input } from '@base_ui/react/legacy/Input';
import { Popper } from '@base_ui/react/legacy/Popper';
import { useTheme } from '@mui/system';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import * as React from 'react';
import {
useAutocomplete,
UseAutocompleteProps,
} from '@base_ui/react/useAutocomplete';
import { Button } from '@base_ui/react/Button';
import { Input } from '@base_ui/react/Input';
import { Popper } from '@base_ui/react/Popper';
} from '@base_ui/react/legacy/useAutocomplete';
import { Button } from '@base_ui/react/legacy/Button';
import { Input } from '@base_ui/react/legacy/Input';
import { Popper } from '@base_ui/react/legacy/Popper';
import { useTheme } from '@mui/system';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { Button } from '@base_ui/react/Button';
import { Popper } from '@base_ui/react/Popper';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { Button } from '@base_ui/react/legacy/Button';
import { Popper } from '@base_ui/react/legacy/Popper';
import { styled } from '@mui/system';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as React from 'react';
import {
useAutocomplete,
UseAutocompleteProps,
} from '@base_ui/react/useAutocomplete';
import { Button } from '@base_ui/react/Button';
import { Popper } from '@base_ui/react/Popper';
} from '@base_ui/react/legacy/useAutocomplete';
import { Button } from '@base_ui/react/legacy/Button';
import { Popper } from '@base_ui/react/legacy/Popper';
import { styled } from '@mui/system';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { Button } from '@base_ui/react/Button';
import { Popper } from '@base_ui/react/Popper';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { Button } from '@base_ui/react/legacy/Button';
import { Popper } from '@base_ui/react/legacy/Popper';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import ClearIcon from '@mui/icons-material/Clear';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as React from 'react';
import {
useAutocomplete,
UseAutocompleteProps,
} from '@base_ui/react/useAutocomplete';
import { Button } from '@base_ui/react/Button';
import { Popper } from '@base_ui/react/Popper';
} from '@base_ui/react/legacy/useAutocomplete';
import { Button } from '@base_ui/react/legacy/Button';
import { Popper } from '@base_ui/react/legacy/Popper';
import { unstable_useForkRef as useForkRef } from '@mui/utils';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
import ClearIcon from '@mui/icons-material/Clear';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/autocomplete/ControlledStates.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { styled } from '@mui/system';

const options = ['Firefox', 'Google Chrome', 'Microsoft Edge', 'Safari', 'Opera'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { styled } from '@mui/system';

const options = ['Firefox', 'Google Chrome', 'Microsoft Edge', 'Safari', 'Opera'];
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/autocomplete/UseAutocomplete.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { styled } from '@mui/system';

export default function UseAutocomplete() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/autocomplete/UseAutocomplete.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { styled } from '@mui/system';

export default function UseAutocomplete() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { Popper } from '@base_ui/react/Popper';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { Popper } from '@base_ui/react/legacy/Popper';
import { styled } from '@mui/system';
import useForkRef from '@mui/utils/useForkRef';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import * as React from 'react';
import {
useAutocomplete,
UseAutocompleteProps,
} from '@base_ui/react/useAutocomplete';
import { Popper } from '@base_ui/react/Popper';
} from '@base_ui/react/legacy/useAutocomplete';
import { Popper } from '@base_ui/react/legacy/Popper';
import { styled } from '@mui/system';
import useForkRef from '@mui/utils/useForkRef';

Expand Down
6 changes: 3 additions & 3 deletions docs/data/base/components/autocomplete/autocomplete.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ To learn more about implementing a custom Autocomplete, you can explore the [`us
## Hook

```jsx
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
```

The `useAutocomplete` hook requires a list of `options` to be displayed when the textbox receives focus.
Expand Down Expand Up @@ -107,8 +107,8 @@ Base UI provides a [Popper](/base-ui/react-popper/) component built around Reac
To render the listbox in Base UI's Popper, the `ref`s must be merged as follows:

```jsx
import { useAutocomplete } from '@base_ui/react/useAutocomplete';
import { Popper } from '@base_ui/react/Popper';
import { useAutocomplete } from '@base_ui/react/legacy/useAutocomplete';
import { Popper } from '@base_ui/react/legacy/Popper';
import { unstable_useForkRef as useForkRef } from '@mui/utils';

export default function App(props) {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/AccessibleBadges.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { styled } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
import MailIcon from '@mui/icons-material/Mail';

function notificationsLabel(count) {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/AccessibleBadges.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { styled } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
import MailIcon from '@mui/icons-material/Mail';

function notificationsLabel(count: number) {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/BadgeMax.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Stack from '@mui/material/Stack';
import { styled } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
import MailIcon from '@mui/icons-material/Mail';

export default function BadgeMax() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/BadgeMax.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Stack from '@mui/material/Stack';
import { styled } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
import MailIcon from '@mui/icons-material/Mail';

export default function BadgeMax() {
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/badge/BadgeVisibility.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
// Auxiliary demo components
import { styled, Stack } from '@mui/system';
import { Button, buttonClasses } from '@base_ui/react/Button';
import { Button, buttonClasses } from '@base_ui/react/legacy/Button';
import * as BaseSwitch from '@base_ui/react/Switch';
import Divider from '@mui/material/Divider';
// Icons
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/badge/BadgeVisibility.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
// Auxiliary demo components
import { styled, Stack } from '@mui/system';
import { Button, buttonClasses } from '@base_ui/react/Button';
import { Button, buttonClasses } from '@base_ui/react/legacy/Button';
import * as BaseSwitch from '@base_ui/react/Switch';
import Divider from '@mui/material/Divider';
// Icons
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/ShowZeroBadge.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Stack from '@mui/material/Stack';
import { styled } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
import MailIcon from '@mui/icons-material/Mail';

export default function ShowZeroBadge() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/ShowZeroBadge.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Stack from '@mui/material/Stack';
import { styled } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';
import MailIcon from '@mui/icons-material/Mail';

export default function ShowZeroBadge() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/badge/UnstyledBadge/css/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Badge } from '@base_ui/react/Badge';
import { Badge } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

export default function UnstyledBadge() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Badge } from '@base_ui/react/Badge';
import { Badge } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

export default function UnstyledBadge() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { styled, Box } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';

function BadgeContent() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { styled, Box } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';

function BadgeContent() {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { Badge as BaseBadge } from '@base_ui/react/Badge';
import { Badge as BaseBadge } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

function useIsDarkMode() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
import { Badge as BaseBadge, BadgeProps } from '@base_ui/react/Badge';
import { Badge as BaseBadge, BadgeProps } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

function useIsDarkMode() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Badge } from '@base_ui/react/Badge';
import { Badge } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

export default function UnstyledBadgeIntroduction() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Badge } from '@base_ui/react/Badge';
import { Badge } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

export default function UnstyledBadgeIntroduction() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { styled, Box } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';

const blue = {
100: '#DAECFF',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import { styled, Box } from '@mui/system';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/Badge';
import { Badge as BaseBadge, badgeClasses } from '@base_ui/react/legacy/Badge';

const blue = {
100: '#DAECFF',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { Badge as BaseBadge } from '@base_ui/react/Badge';
import { Badge as BaseBadge } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

function useIsDarkMode() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import clsx from 'clsx';
import { Badge as BaseBadge, BadgeProps } from '@base_ui/react/Badge';
import { Badge as BaseBadge, BadgeProps } from '@base_ui/react/legacy/Badge';
import { useTheme } from '@mui/system';

function useIsDarkMode() {
Expand Down
4 changes: 2 additions & 2 deletions docs/data/base/components/badge/badge.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The Badge component creates a badge that is applied to its child element.
## Component

```jsx
import { Badge } from '@base_ui/react/Badge';
import { Badge } from '@base_ui/react/legacy/Badge';
```

The Badge wraps around the UI element that it's attached to.
Expand Down Expand Up @@ -80,7 +80,7 @@ The same applies for props specific to custom primitive elements:
## Hook

```jsx
import { useBadge } from '@base_ui/react/useBadge';
import { useBadge } from '@base_ui/react/legacy/useBadge';
```

The `useBadge` hook lets you apply the functionality of a Badge to a fully custom component.
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/button/UnstyledButtonCustom.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { Button, buttonClasses } from '@base_ui/react/Button';
import { Button, buttonClasses } from '@base_ui/react/legacy/Button';
import { styled } from '@mui/system';

const ButtonRoot = React.forwardRef(function ButtonRoot(props, ref) {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/base/components/button/UnstyledButtonCustom.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { Button, ButtonProps, buttonClasses } from '@base_ui/react/Button';
import { Button, ButtonProps, buttonClasses } from '@base_ui/react/legacy/Button';
import { styled, Theme } from '@mui/system';

const ButtonRoot = React.forwardRef(function ButtonRoot(
Expand Down
Loading

0 comments on commit 56e110c

Please sign in to comment.