Skip to content

Commit

Permalink
[charts] Fix TS bottle neck
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette committed May 15, 2024
1 parent 956f8bd commit 4dc48a9
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/x-charts/src/BarChart/BarElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
import { styled } from '@mui/material/styles';
import { color as d3Color } from 'd3-color';
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
import { animated } from '@react-spring/web';
import { AnimatedProps, animated } from '@react-spring/web';
import {
getIsFaded,
getIsHighlighted,
Expand Down Expand Up @@ -60,11 +60,20 @@ export const BarElementPath = styled(animated.rect, {
: ownerState.color,
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
opacity: (ownerState.isFaded && 0.3) || 1,
}));

interface BarProps extends Omit<React.ComponentPropsWithoutRef<'path'>, 'id' | 'color'> {
})) as React.ElementType<BarProps>;

interface BarProps
extends Omit<
React.SVGProps<SVGRectElement>,
'id' | 'color' | 'ref' | 'x' | 'y' | 'height' | 'width'
>,
AnimatedProps<{
x?: string | number | undefined;
y?: string | number | undefined;
height?: string | number | undefined;
width?: string | number | undefined;
}> {
highlightScope?: Partial<HighlightScope>;
onClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>) => void;
ownerState: BarElementOwnerState;
}

Expand All @@ -73,7 +82,7 @@ export interface BarElementSlots {
* The component that renders the bar.
* @default BarElementPath
*/
bar?: React.JSXElementConstructor<BarProps>;
bar?: React.ElementType<BarProps>;
}

export interface BarElementSlotProps {
Expand Down

0 comments on commit 4dc48a9

Please sign in to comment.