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

[pickers] Finish the migration to be compatible with PigmentCSS #13643

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

flaviendelangle
Copy link
Member

@flaviendelangle flaviendelangle commented Jun 27, 2024

Closes #12277

This PR will remain opened until @mui/material reaches its v6 stable release and Pigment reaches its v1 stable release.
By then we should have a better view of what we want to do.

@flaviendelangle flaviendelangle self-assigned this Jun 27, 2024
@flaviendelangle flaviendelangle added the component: pickers This is the name of the generic UI component, not the React module! label Jun 27, 2024
@mui-bot
Copy link

mui-bot commented Jun 27, 2024

Deploy preview: https://deploy-preview-13643--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against c3508aa

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Nice effort, thanks! 👍
Leaving some clarification questions.

import { SingleInputTimeRangeFieldProps } from './SingleInputTimeRangeField.types';
import { useSingleInputTimeRangeField } from './useSingleInputTimeRangeField';
import { FieldType } from '../models';

const useThemeProps = createUseThemeProps('MuiSingleInputTimeRangeField');
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Do you know if it is mandatory to duplicate the name prop?
Is it used in static extraction or something else? 🤔
Currently, it seems a bit strange. 🙈

Copy link
Member Author

Choose a reason for hiding this comment

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

Honestly I have no idea
I think I read it month ago. I'd say it's just that PigmentCSS will replace it be an import links it to the build-time theme based on the name that is in createUseThemeProps and ignore the one of useThemeProps and we kept the one in useThemeProps to avoid a breaking change.

.eslintrc.js Show resolved Hide resolved
@@ -1,16 +1,19 @@
import * as React from 'react';
import clsx from 'clsx';
import { styled, alpha, useThemeProps } from '@mui/material/styles';
import { alpha } from '@mui/material/styles';
Copy link
Member

Choose a reason for hiding this comment

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

Will keeping the alpha call outside of zero-styled allow for static extraction? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I think so, but @brijeshb42 can confirm/infirm this one 👍

@@ -2,13 +2,13 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { useRtl } from '@mui/system/RtlProvider';
import { styled, useThemeProps } from '@mui/material/styles';
Copy link
Member

Choose a reason for hiding this comment

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

To keep the static-extraction intact we should avoid adding new imports from @mui/material/styles directly.
WDYT about creating an ESLint rule for that? 🤔
However, we'd have to think of what to do with type imports... Maybe import type could be skipped by an ESLint rule? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

@brijeshb42 is this something that is planned on the core side?
I guess it could benefit all MUI teams trying to migrate and to avoid re-using direct imports by mistake.

I don't think we can totally bloke @mui/material/styles since we want to use useTheme

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense. We'd need too many ignores for those. 🙈

I don't think we can totally bloke @mui/material/styles since we want to use useTheme

Which ideally would be eventually replaced with the @mui/system import if there were no issues with theme merging/scoping. 🤔 🤞

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, not sure when this would be though

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 2, 2024
Copy link

github-actions bot commented Jul 2, 2024

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 10, 2024
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 16, 2024
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@flaviendelangle flaviendelangle added the on hold There is a blocker, we need to wait label Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: pickers This is the name of the generic UI component, not the React module! on hold There is a blocker, we need to wait PR: out-of-date The pull request has merge conflicts and can't be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pickers] Add support for zero runtime CSS (pigmentcss)
3 participants