Skip to content

Commit

Permalink
Pass slots down
Browse files Browse the repository at this point in the history
  • Loading branch information
JCQuintas committed May 3, 2024
1 parent aab68ea commit 0bb1e9b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/x-charts/src/BarChart/BarPlot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import PropTypes from 'prop-types';
import { to, useTransition } from '@react-spring/web';
import { SeriesContext } from '../context/SeriesContextProvider';
import { CartesianContext } from '../context/CartesianContextProvider';
import { BarElement, BarElementProps, BarElementSlotProps, BarElementSlots } from './BarElement';
import { BarElement, BarElementSlotProps, BarElementSlots } from './BarElement';
import { AxisDefaultized, isBandScaleConfig, isPointScaleConfig } from '../models/axis';
import { FormatterResult } from '../models/seriesType/config';
import { HighlightScope } from '../context/HighlightProvider';
import { BarItemIdentifier, BarSeriesType } from '../models';
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
import { SeriesId } from '../models/seriesType/common';
import getColor from './getColor';
import { BarElementLabel } from './BarElementLabel';
import { BarElementLabel, BarElementLabelSlotProps, BarElementLabelSlots } from './BarElementLabel';

/**
* Solution of the equations
Expand Down Expand Up @@ -45,11 +45,11 @@ function getBandSize({
};
}

export interface BarPlotSlots extends BarElementSlots {}
export interface BarPlotSlots extends BarElementSlots, BarElementLabelSlots {}

export interface BarPlotSlotProps extends BarElementSlotProps {}
export interface BarPlotSlotProps extends BarElementSlotProps, BarElementLabelSlotProps {}

export interface BarPlotProps extends Pick<BarElementProps, 'slots' | 'slotProps'> {
export interface BarPlotProps extends BarPlotSlotProps {
/**
* If `true`, animations are skipped.
* @default false
Expand Down Expand Up @@ -289,14 +289,14 @@ function BarPlot(props: BarPlotProps) {
seriesId={seriesId}
dataIndex={dataIndex}
color={color}
{...other}
style={
{
...style,
x: to([(style as any).x, (style as any).width], (x, width) => (x ?? 0) + width / 2),
y: to([(style as any).y, (style as any).height], (x, width) => (x ?? 0) + width / 2),
} as any
}
// When value is 0 we don't want to show the label either
labelText={value ? value.toString() : null}
/>
))}
Expand Down

0 comments on commit 0bb1e9b

Please sign in to comment.