Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[base] Move hooks to their own directories #36235

Merged
merged 30 commits into from
Feb 21, 2023

Conversation

hbjORbj
Copy link
Member

@hbjORbj hbjORbj commented Feb 17, 2023

Breaking Changes

  • Base hooks (e.g., useSelect) are no longer exported from {Component}Unstyled directories and instead they have their own directories.
  • Below is an example of how the migration should look like:
-import { useBadge } from '@mui/base/BadgeUnstyled';
+import useBadge from '@mui/base/useBadge';

You can use this codemod to help with the migration.

Closes #34401
Closes #33903


@hbjORbj hbjORbj self-assigned this Feb 17, 2023
@hbjORbj hbjORbj added breaking change package: base-ui Specific to @mui/base labels Feb 17, 2023
@hbjORbj hbjORbj added this to the MUI Base stable release milestone Feb 17, 2023
@hbjORbj hbjORbj marked this pull request as draft February 17, 2023 11:31
@hbjORbj hbjORbj marked this pull request as ready for review February 18, 2023 19:47
@@ -1,7 +1,8 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { useButton } from '@mui/base/ButtonUnstyled';

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running yarn docs:typescript:formatted creates this space. I don't know why 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be interesting to investigate and debug (not necessarily in this PR, though) 😁

@@ -1,6 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import SelectUnstyled, { selectUnstyledClasses } from '@mui/base/SelectUnstyled';

Copy link
Member Author

@hbjORbj hbjORbj Feb 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reason as above

@@ -1,6 +1,7 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import SelectUnstyled, { selectUnstyledClasses } from '@mui/base/SelectUnstyled';

Copy link
Member Author

@hbjORbj hbjORbj Feb 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same reason as above

@michaldudak
Copy link
Member

michaldudak commented Feb 20, 2023

I found a few occurrences of the old paths in the docs left (FormControl, Input, Slider, Snackbar).
Search for use.* from .*Unstyled with regex enabled to find them.

Also, the API pages shows an incorrect import path of the hooks:
image

(https://deploy-preview-36235--material-ui.netlify.app/base/api/use-button/)

@hbjORbj
Copy link
Member Author

hbjORbj commented Feb 20, 2023

  • I updated the old paths in the docs of Input, Slider and Snackbar. FormControl doc seems fine.
  • I updated the import path in the Hook API pages.

@michaldudak
Copy link
Member

The useAutocomplete import is broken: https://deploy-preview-36235--material-ui.netlify.app/base/api/use-autocomplete/

@hbjORbj
Copy link
Member Author

hbjORbj commented Feb 21, 2023

My bad. Addressed it.

Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't found anything wrong. Good job!
Let's get it merged ASAP to avoid conflicts.

Would you mind working on a codemod to help devs with the migration (in a separate PR)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[base] Move hooks to their own directories
3 participants