Skip to content

Commit

Permalink
Revert start of PigmentCSS support
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasTy committed Aug 21, 2024
1 parent be69a13 commit 0b2a17a
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,7 @@ const ResponsiveChartContainerPro = React.forwardRef(function ResponsiveChartCon
useResponsiveChartContainerProProps(props, ref);

return (
<ResizableContainer
{...resizableChartContainerProps}
style={
{
'--width': resizableChartContainerProps.ownerState.width,
'--height': resizableChartContainerProps.ownerState.height,
} as React.CSSProperties
}
>
<ResizableContainer {...resizableChartContainerProps}>
{hasIntrinsicSize ? <ChartContainerPro {...chartContainerProProps} /> : null}
<Watermark packageName="x-charts-pro" releaseInfo={releaseInfo} />
</ResizableContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export const ChartsAxisHighlightPath = styled('path', {
pointerEvents: 'none',
variants: [
{
props: ({ ownerState }) => ownerState.axisHighlight === 'band',
props: {
axisHighlight: 'band',
},
style: {
fill: 'white',
fillOpacity: 0.1,
Expand All @@ -51,7 +53,9 @@ export const ChartsAxisHighlightPath = styled('path', {
},
},
{
props: ({ ownerState }) => ownerState.axisHighlight === 'line',
props: {
axisHighlight: 'line',
},
style: {
strokeDasharray: '5 2',
stroke: '#ffffff',
Expand Down
12 changes: 3 additions & 9 deletions packages/x-charts/src/Gauge/GaugeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export interface GaugeContainerProps
const ResizableContainer = styled('div', {
name: 'MuiGauge',
slot: 'Container',
})<{ ownerState: Pick<GaugeContainerProps, 'width' | 'height'> }>(({ theme }) => ({
width: 'var(--width, 100%)',
height: 'var(--height, 100%)',
})<{ ownerState: Pick<GaugeContainerProps, 'width' | 'height'> }>(({ ownerState, theme }) => ({
width: ownerState.width ?? '100%',
height: ownerState.height ?? '100%',
display: 'flex',
position: 'relative',
flexGrow: 1,
Expand Down Expand Up @@ -77,12 +77,6 @@ const GaugeContainer = React.forwardRef(function GaugeContainer(props: GaugeCont
aria-valuenow={value === null ? undefined : value}
aria-valuemin={valueMin}
aria-valuemax={valueMax}
style={
{
'--width': inWidth,
'--height': inHeight,
} as React.CSSProperties
}
{...other}
>
{width && height ? (
Expand Down
18 changes: 5 additions & 13 deletions packages/x-charts/src/LineChart/LineHighlightElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ const HighlightElement = styled('circle', {
name: 'MuiHighlightElement',
slot: 'Root',
overridesResolver: (_, styles) => styles.root,
})<{ ownerState: LineHighlightElementOwnerState }>({
transform: `translate(var(--x)px, var(--y)px)`,
transformOrigin: `var(--x)px var(--y)px`,
fill: 'var(--color)',
});
})<{ ownerState: LineHighlightElementOwnerState }>(({ ownerState }) => ({
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
fill: ownerState.color,
}));

export type LineHighlightElementProps = LineHighlightElementOwnerState &
Omit<React.SVGProps<SVGCircleElement>, 'ref' | 'id'>;
Expand Down Expand Up @@ -82,14 +82,6 @@ function LineHighlightElement(props: LineHighlightElementProps) {
cx={0}
cy={0}
r={other.r === undefined ? 5 : other.r}
style={
{
...other.style,
'--x': x,
'--y': y,
'--color': color,
} as React.CSSProperties
}
{...other}
/>
);
Expand Down
15 changes: 6 additions & 9 deletions packages/x-charts/src/LineChart/MarkElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ const MarkElementPath = styled(animated.path, {
name: 'MuiMarkElement',
slot: 'Root',
overridesResolver: (_, styles) => styles.root,
})<{ ownerState: MarkElementOwnerState }>(({ theme }) => ({
})<{ ownerState: MarkElementOwnerState }>(({ ownerState, theme }) => ({
fill: (theme.vars || theme).palette.background.paper,
stroke: 'var(--color)',
stroke: ownerState.color,
strokeWidth: 2,
}));

Expand Down Expand Up @@ -120,13 +120,10 @@ function MarkElement(props: MarkElementProps) {
return (
<MarkElementPath
{...other}
style={
{
transform: to([position.x, position.y], (pX, pY) => `translate(${pX}px, ${pY}px)`),
transformOrigin: to([position.x, position.y], (pX, pY) => `${pX}px ${pY}px`),
'--color': color,
} as unknown as React.CSSProperties
}
style={{
transform: to([position.x, position.y], (pX, pY) => `translate(${pX}px, ${pY}px)`),
transformOrigin: to([position.x, position.y], (pX, pY) => `${pX}px ${pY}px`),
}}
ownerState={ownerState}
className={classes.root}
d={d3Symbol(d3SymbolsFill[getSymbol(shape)])()!}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import type { ResponsiveChartContainerProps } from './ResponsiveChartContainer';
export const ResizableContainer = styled('div', {
name: 'MuiResponsiveChart',
slot: 'Container',
})<{ ownerState: Pick<ResponsiveChartContainerProps, 'width' | 'height'> }>({
width: 'var(--width, 100%)',
height: 'var(--height, 100%)',
})<{ ownerState: Pick<ResponsiveChartContainerProps, 'width' | 'height'> }>(({ ownerState }) => ({
width: ownerState.width ?? '100%',
height: ownerState.height ?? '100%',
display: 'flex',
position: 'relative',
flexGrow: 1,
Expand All @@ -23,4 +23,4 @@ export const ResizableContainer = styled('div', {
width: '100%',
height: '100%',
},
});
}));
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ const ResponsiveChartContainer = React.forwardRef(function ResponsiveChartContai
useResponsiveChartContainerProps(props, ref);

return (
<ResizableContainer
{...resizableChartContainerProps}
style={
{
'--width': resizableChartContainerProps.ownerState.width,
'--height': resizableChartContainerProps.ownerState.height,
} as React.CSSProperties
}
>
<ResizableContainer {...resizableChartContainerProps}>
{hasIntrinsicSize ? <ChartContainer {...chartContainerProps} /> : null}
</ResizableContainer>
);
Expand Down

0 comments on commit 0b2a17a

Please sign in to comment.