UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

87 lines 2.59 kB
import * as React from 'react'; import { type SlotComponentPropsFromProps } from '@mui/x-internals/types'; import { type BarLabelOwnerState, type BarItem, type BarLabelContext } from "./BarLabel.types.js"; import { type BarLabelProps } from "./BarLabel.js"; import { type BarValueType } from "../../models/index.js"; export interface BarLabelSlots { /** * The component that renders the bar label. * @default BarLabel */ barLabel?: React.JSXElementConstructor<BarLabelProps>; } export interface BarLabelSlotProps { barLabel?: SlotComponentPropsFromProps<BarLabelProps, {}, BarLabelOwnerState>; } export type BarLabelItemProps<V extends BarValueType | null> = Omit<BarLabelOwnerState, 'isFaded' | 'isHighlighted'> & Pick<BarLabelProps, 'style'> & { /** * The props used for each component slot. * @default {} */ slotProps?: BarLabelSlotProps; /** * Overridable component slots. * @default {} */ slots?: BarLabelSlots; /** * The position in the x-axis of the stack this bar label belongs to. */ xOrigin: number; /** * The position in the y-axis of the stack this bar label belongs to. */ yOrigin: number; /** * The position of the bar in the x-axis. */ x: number; /** * The position of the bar in the y-axis. */ y: number; /** * The height of the bar. */ height: number; /** * The width of the bar. */ width: number; /** * The orientation of the bar. */ layout: 'vertical' | 'horizontal'; /** * The value of the data point. */ value: V; /** * If true, no animations should be applied. */ skipAnimation: boolean; /** * If provided, the function will be used to format the label of the bar. * It can be set to 'value' to display the current value. * @param {BarItem} item The item to format. * @param {BarLabelContext} context data about the bar. * @returns {string} The formatted label. */ barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined); /** * The placement of the bar label. * It controls whether the label is rendered in the center or outside the bar. * @default 'center' */ barLabelPlacement?: BarLabelProps['placement']; /** If true, the bar label is hidden. */ hidden?: boolean; }; /** * @ignore - internal component. */ declare function BarLabelItem<V extends BarValueType | null = BarValueType | null>(props: BarLabelItemProps<V>): import("react/jsx-runtime").JSX.Element | null; declare namespace BarLabelItem { var propTypes: any; } export { BarLabelItem };