-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[charts] Export MuiBarElement-series
as part of barElementClasses
#17211
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
Comments
MuiBarElement-series
as part of barElementClasses
MuiBarElement-series
as part of barElementClasses
Thanks for taking the time to open an issue for this. The only problem I can see is that the series classes are suffixed with the seriesId here:
So just exporting it as a member of the WDYT @JCQuintas ? |
Ah sure. From my perspective I was happy to append |
Allowing to pass in a We could have different behaviours like // This doesn't play very well with our internals
export interface BarElementClasses {
series: (seriesId: SeriesId) => string;
}
barElementClasses.series('myId')
// or
// This would work, but it is a bit hidden as a function inside a string.
export interface BarElementClasses {
series: string & { withId: (seriesId: SeriesId) => string };
}
barElementClasses.series.withId('myId') @michelengelen @alexfauquette do you know if there are other places in the codebase we use similar patterns? 🤔 |
I know there was a similar pattern in the grid somewhere, but afaik its not used for classes. Those should ideally be static. 🤷🏼 If manually re-creating (in userland) these is an option this can work as well ... in that case we should just export the "base" class for series like the others and then let the user decide if he needs to use this. On the other hand this can be made into a helper to be used in userland as well, which should work, when we are not using it in the internals, right? |
Yeah, just providing the |
In that case i will add the "good first issue" label and give a short diff to get a contributor started: --- a/packages/x-charts/src/BarChart/BarElement.tsx
+++ b/packages/x-charts/src/BarChart/BarElement.tsx
@@ -18,6 +18,10 @@ export interface BarElementClasses {
highlighted: string;
/** Styles applied to the root element if it is faded. */
faded: string;
+ /** Styles applied to the root element for a specified series.
+ * To be used like this: `&.${barElementClasses.series}-${seriesId}`.
+ */
+ series: string;
}
export type BarElementClassKey = keyof BarElementClasses;
@@ -39,6 +43,7 @@ export const barElementClasses: BarElementClasses = generateUtilityClasses('MuiBarElement', [
'root',
'highlighted',
'faded',
+ 'series',
]);
const useUtilityClasses = (ownerState: BarElementOwnerState) => { cc @JCQuintas |
Hi! Would it be okay if I gave this a try? If it's alright, I'd also appreciate it if you could add a label to PR #17273. |
Yep... I added reviewers and the label! Thanks for the contribution! 💪🏻 |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. |
Summary
Currently
barElementClasses
only containsroot
(MuiBarElement-root
). It would be helpful if it also exportedseries
(MuiBarElement-series
).Thanks
Examples
No response
Motivation
No response
Search keywords: barElement, series, classes
The text was updated successfully, but these errors were encountered: