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

[charts] Add missing themeAugmentation in pro plan #14313

Merged
merged 14 commits into from
Aug 27, 2024

Conversation

lhilgert9
Copy link
Contributor

@lhilgert9 lhilgert9 commented Aug 23, 2024

@mui-bot
Copy link

mui-bot commented Aug 23, 2024

Copy link
Member

@JCQuintas JCQuintas left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement. 💪

This looks good to me, I'll just ask my colleague @alexfauquette for a final check. :)

@alexfauquette
Copy link
Member

Nice improvement. There are just two points we need to verify before merging:

  • Is the theme augmentation effectively working?
  • Since this PR impacts a non MIT library, we light need you to sign an agreement. I'm not sure about the exact process.' @michelengelen do you have more information

@michelengelen
Copy link
Member

Nice improvement. There are just two points we need to verify before merging:

  • Is the theme augmentation effectively working?

  • Since this PR impacts a non MIT library, we light need you to sign an agreement. I'm not sure about the exact process.' @michelengelen do you have more information

@joserodolfofreitas would you mind helping out with the CLA?

@oliviertassinari oliviertassinari added the component: charts This is the name of the generic UI component, not the React module! label Aug 24, 2024
@lhilgert9
Copy link
Contributor Author

Nice improvement. There are just two points we need to verify before merging:

  • Is the theme augmentation effectively working?
  • Since this PR impacts a non MIT library, we light need you to sign an agreement. I'm not sure about the exact process.' @michelengelen do you have more information

@joserodolfofreitas would you mind helping out with the CLA?

@michelengelen I must have signed the CLA last year or so, if it is still valid.

@oliviertassinari oliviertassinari added plan: Pro Impact at least one Pro user CLA: required See https://www.notion.so/mui-org/CLA-Contributor-License-Agreement-92ece655b1584b10b00e4de9e67eedb0 labels Aug 24, 2024
Copy link

codspeed-hq bot commented Aug 24, 2024

CodSpeed Performance Report

Merging #14313 will not alter performance

Comparing lhilgert9:charts-pro/add-theme-augmentation (bc59def) with master (1080a76)

Summary

✅ 3 untouched benchmarks

@lhilgert9
Copy link
Contributor Author

  • Is the theme augmentation effectively working?
    @alexfauquette Should I create an own test file for themeAugmentation or test it in the heatmap test files or how did you imagine that?

Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Since this PR impacts a non MIT library, we light need you to sign an agreement. I'm not sure about the exact process.'

The process for maintainers is documented alongside the process for contributors: https://www.notion.so/mui-org/CLA-Contributor-License-Agreement-92ece655b1584b10b00e4de9e67eedb0?pvs=4#417626432f9e419f9fc8bc90aa6ca871.

I must have signed the CLA last year or so, if it is still valid.

@lhilgert9 We have an entry for it, but couldn't verify your email. Could you do this step? https://www.notion.so/mui-org/CLA-Contributor-License-Agreement-92ece655b1584b10b00e4de9e67eedb0?pvs=4#fb0396ecff384a4cb515ab9f4351eddc Thanks

docs/data/charts/getting-started/getting-started.md Outdated Show resolved Hide resolved
docs/data/charts/getting-started/getting-started.md Outdated Show resolved Hide resolved
@lhilgert9
Copy link
Contributor Author

lhilgert9 commented Aug 24, 2024

@oliviertassinari Your mail server has rejected the forwarded message as spam. What can I do instead?

@oliviertassinari oliviertassinari added CLA: signed See https://www.notion.so/mui-org/CLA-Contributor-License-Agreement-92ece655b1584b10b00e4de9e67eedb0 and removed CLA: required See https://www.notion.so/mui-org/CLA-Contributor-License-Agreement-92ece655b1584b10b00e4de9e67eedb0 labels Aug 25, 2024
@oliviertassinari
Copy link
Member

@lhilgert9 Ok, thanks, that should be enough in this case, we can clearly correlate the signature form timestamp and link with the GitHub profile.

@lhilgert9
Copy link
Contributor Author

lhilgert9 commented Aug 25, 2024

@alexfauquette @JCQuintas @oliviertassinari While testing a bit with the themeAugmentation, I came to the point that the themeAugmentation for the normal charts package doesn't work either. It seems to be because the useThemeProps hook is not used as with all other components at mui. Is this intentional?

@alexfauquette
Copy link
Member

Is that intentional

Not really. It's because we are in the first version of the library, and did not find time to figure out which component should have this option. We have #12070 to track it

@lhilgert9
Copy link
Contributor Author

@alexfauquette My code seems to work on its own. However, all components of the pro plan are not yet equipped with the necessary functions for themeAugmentation, which is why the actual function is currently ineffective. Do we want to implement these functions in this PR or should I open another PR for the heatmap, for example, and do we want to put this PR on hold for the time being?

@alexfauquette
Copy link
Member

@lhilgert9 I'm working on fixing it.

I propose to add the default props to all the single components (LineChart, BarChart, ... LineChartPro, ..., Heatmap)
Not to the subcomponents (LinePlot, LineElement, ..., HeatmapPlot, HeatmapItem) because those components props are just SVG attributes, then modifying them is either for style customization (this can be done with CSS) or custom logic that I would not recommend doing with defaultProps

While working on it, I'm cleaning the TS to remove type definition of stuff that don't work

@lhilgert9
Copy link
Contributor Author

@alexfauquette If I can help anywhere, please feel free to let me know.

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

I did a big chunk of cleaning the TS definition.

I propose we merge this PR to get the big picture merged, and in follow-up PR add conformance test, to make sure each coponent have the default Props and styling applied as expected.

@lhilgert9
Copy link
Contributor Author

lhilgert9 commented Aug 26, 2024

@alexfauquette The plan sounds good to me. However, I have changed the implementation of the useThemeProps hook in the code as follows to be compliant with the other packages:

function Component(inProps: ComponentProps) {
const props = useThemeProps({props: inProps, name: 'MuiComponentName'});
// implementation
}

The rest of the changes LGTM.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 27, 2024
@alexfauquette alexfauquette merged commit 0c30a6f into mui:master Aug 27, 2024
21 checks passed
[`& .${axisClasses.line}`]: {
[`.${axisClasses.line}`]: {
Copy link
Member

@oliviertassinari oliviertassinari Aug 28, 2024

Choose a reason for hiding this comment

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

I'm unclear about this change. Does [`.${axisClasses.line}`]: { target the same element or a child element? I always find this API confusing, I can never remember. Always having & would mean that the developers looking at the source to see what to customize with CSS modules never have doubts. It feels like we should have this rule.

Copy link
Member

Choose a reason for hiding this comment

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

My issue is that we do not styled() the sub part of the axis, to avoid styling to many elements.

The idea of this modification was to reduce the specificity of the default style to let people override it from the root with & .${axisClasses.line}

Copy link
Member

@oliviertassinari oliviertassinari Aug 28, 2024

Choose a reason for hiding this comment

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

Does it mean its equivalent to?

  [`&.${axisClasses.line}`]: {

Copy link
Member

Choose a reason for hiding this comment

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

I got confused. I thaugh that removing the & would remove the root class. But it does not.

This modification changes nothing. I just tried the before after:

[`& .${axisClasses.line}`]: { ... },
[`.${axisClasses.line}`]: { },

The both selector above result into the same CSS

.css-6ic30x-MuiChartsAxis-root .MuiChartsAxis-line { ... } // in dev env
.css-6ic30x .MuiChartsAxis-line { ... } // in prod env

Copy link
Member

@oliviertassinari oliviertassinari Aug 28, 2024

Choose a reason for hiding this comment

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

Oh ok, this is what I was wondering about:

is [`.${axisClasses.line}`]: { }, equivalent to [`& .${axisClasses.line}`]: { ... }, or [`&.${axisClasses.line}`]: { ... },. It's the former, thanks I was too lazy to test 😄

I think we should always have & in the source then, no doubts possible.

Copy link
Member

Choose a reason for hiding this comment

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

Fix in #14378

@lhilgert9 lhilgert9 deleted the charts-pro/add-theme-augmentation branch November 25, 2024 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA: signed See https://www.notion.so/mui-org/CLA-Contributor-License-Agreement-92ece655b1584b10b00e4de9e67eedb0 component: charts This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user size:L This PR changes 100-499 lines, ignoring generated files. typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[charts] Missing themeAugmentation in pro plan
6 participants