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

[material-next][Select] Refactor to use Base UI's hooks #40210

Closed

Conversation

DiegoAndai
Copy link
Member

@DiegoAndai DiegoAndai commented Dec 14, 2023

Summary

Refactor the SelectInput component based on Base UI's useSelect hook. This also implies adding the Option component, which consumes the useOption hook.

Experiment

https://deploy-preview-40210--material-ui.netlify.app/experiments/material-next/select/

Issues solved with this refactor

Breaking changes

  • MenuItem replaced with Option. Users can just copy-paste Option wherever they had MenuItem, as it supports the same API except selected, which is ignored when MenuItem is inside Select anyways.
  • Menu dependency was removed; thus, MenuProps was removed. We should be able to support most of the functionality either via the PopoverProps prop (added in this PR) or new Select props (not yet added)

@mui-bot
Copy link

mui-bot commented Dec 14, 2023

Netlify deploy preview

https://deploy-preview-40210--material-ui.netlify.app/

@mui/material-next: parsed: +0.40% , gzip: +0.64%

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against 3e34ad4

@DiegoAndai DiegoAndai self-assigned this Dec 14, 2023
@DiegoAndai DiegoAndai added the component: select This is the name of the generic UI component, not the React module! label Dec 14, 2023
@DiegoAndai DiegoAndai force-pushed the material-select-with-base-ui branch 2 times, most recently from ce9a10a to d5546b0 Compare December 14, 2023 20:15
@DiegoAndai DiegoAndai added the on hold There is a blocker, we need to wait label Dec 14, 2023
@DiegoAndai DiegoAndai force-pushed the material-select-with-base-ui branch 4 times, most recently from fd56820 to c1f92b4 Compare December 21, 2023 17:45
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 26, 2023
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Dec 27, 2023

The menu dependency was removed, and the `MenuProps` prop was removed with it.

(Section WIP)
Copy link
Member Author

Choose a reason for hiding this comment

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

We will need to create a follow-up issue for this one as it will depend on the changes for the Material You design, which we're not doing right now.

@DiegoAndai DiegoAndai removed the on hold There is a blocker, we need to wait label Dec 29, 2023
@DiegoAndai DiegoAndai marked this pull request as ready for review December 29, 2023 13:48
@DiegoAndai DiegoAndai added this to the Material UI: v7 draft milestone Dec 29, 2023
@mj12albert mj12albert self-assigned this Feb 6, 2024
@DiegoAndai
Copy link
Member Author

Given Base UI's decision to adopt the Composition API and Material UI to be built on top of that API instead of hooks, I'll close this PR. We can use it as a guide for implementing Material UI's Select on top of Base UI's Composition API.

This will reduce the friction for Base UI's Composition API refactor.

cc @michaldudak @mj12albert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: select This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants