import * as React from 'react'; import { SVGProps, CSSProperties, ReactElement, SyntheticEvent, MouseEvent as MouseEvent$1, TouchEvent, ReactNode, Ref, PropsWithoutRef, Key, AriaAttributes, ClipboardEvent, CompositionEvent, FocusEvent, FormEvent, KeyboardEvent, DragEvent, PointerEvent, UIEvent, WheelEvent, AnimationEvent, TransitionEvent, SVGAttributes, FunctionComponent, Component, ComponentType } from 'react'; interface DotProps { className?: string; /** * The x-coordinate of center in pixels. */ cx?: number; /** * The y-coordinate of center in pixels. */ cy?: number; /** * The radius of dot. */ r?: number | string; clipDot?: boolean; } type Props$D = PresentationAttributesWithProps & DotProps; /** * Renders a dot in the chart. * * This component accepts X and Y coordinates in pixels. * If you need to position the rectangle based on your chart's data, * consider using the {@link ReferenceDot} component instead. * * @param props * @constructor */ declare const Dot: React.FC; declare global { interface SymbolConstructor { readonly observable: symbol; } } /** * @inline */ type TextAnchor = 'start' | 'middle' | 'end' | 'inherit'; /** * @inline */ type TextVerticalAnchor = 'start' | 'middle' | 'end'; /** * @inline */ type RenderableText = string | number | boolean | null | undefined; interface TextProps { /** * When true, scales the text to fit within the specified width. * The text will be scaled down proportionally to fit the available space. * * **Important interactions:** * - Requires `width` to be defined to have any effect. If width is undefined, scaleToFit does nothing. * - When enabled, `maxLines` restrictions are bypassed and ellipsis truncation is disabled. * - Uses the first line's width to calculate the scale factor. * - The scaling transform is applied as `scale(width / lineWidth)`. * * @defaultValue false */ scaleToFit?: boolean; /** * Text rotation angle in degrees. * Positive values rotate clockwise, negative values rotate counterclockwise. * * @defaultValue 0 */ angle?: number; /** * Horizontal text alignment within the text element. * - 'start': Text starts at the x coordinate (left-aligned for LTR text) * - 'middle': Text is centered on the x coordinate * - 'end': Text ends at the x coordinate (right-aligned for LTR text) * - 'inherit': Inherits the text-anchor from parent element * * **Note:** This controls horizontal alignment only and does not affect RTL text behavior. * @defaultValue 'start' */ textAnchor?: TextAnchor; /** * Vertical text alignment relative to the y coordinate. * - 'start': Text baseline starts at y coordinate (text appears below the y position) * - 'middle': Text is vertically centered on the y coordinate * - 'end': Text baseline ends at y coordinate (text appears above the y position) * * **Note:** This controls vertical positioning only and does not affect RTL (right-to-left) text behavior. * The alignment calculation uses capHeight and lineHeight to determine the starting dy offset. * * @defaultValue 'end' */ verticalAnchor?: TextVerticalAnchor; /** * CSS styles to apply to the text element. * These styles are used for text measurement calculations when width constraints or scaleToFit are used. * Font-related properties (fontSize, fontFamily, fontWeight, etc.) are particularly important for accurate measurements. */ style?: CSSProperties; /** * Line height for multi-line text. * Can be a number (height in pixels) or a string with CSS units. * Used to calculate spacing between lines when text wraps to multiple lines. * Also used in verticalAnchor calculations for positioning the text block. * @defaultValue '1em' */ lineHeight?: number | string; /** * When true, enables character-level breaking instead of word-level breaking. * - false: Text breaks at word boundaries (spaces, tabs, etc.) * - true: Text can break between any characters, useful for languages without spaces * * **Note:** Only effective when `width` is defined to enable line breaking. * @defaultValue false */ breakAll?: boolean; /** * The text content to render. * Can be a string or number. Numbers will be converted to strings. * undefined or null values will result in no text being rendered. */ children?: RenderableText; /** * Maximum number of lines to display when text wrapping is enabled. * When text exceeds this limit, it will be truncated with an ellipsis (…). * * **Important requirements for ellipsis truncation:** * - `width` must be defined (no effect when width is undefined) * - `scaleToFit` must be false (when scaleToFit is true, maxLines is bypassed) * - Text must actually overflow the specified maxLines or width constraints * * **Truncation behavior:** * - Uses binary search to find the optimal truncation point * - Adds ellipsis (…) at the end of the truncated text * - Ensures the truncated text + ellipsis fits within the constraints * * **Interaction with other props:** * - When `scaleToFit` is true, this property is ignored * - Requires `width` to be set for line breaking to occur */ maxLines?: number; /** * When width is specified, the text will automatically wrap by calculating the width of text. */ width?: number | string; } type Props$C = Omit, 'textAnchor' | 'verticalAnchor'> & TextProps; declare const Text: React.ForwardRefExoticComponent & React.RefAttributes>; /** * @since 3.4 */ interface ZIndexable { /** * Z-Index of this component and its children. The higher the value, * the more on top it will be rendered. * Components with higher zIndex will appear in front of components with lower zIndex. * If undefined or 0, the content is rendered in the default layer without portals. * * @since 3.4 * @defaultValue 0 * @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide} */ zIndex?: number; } type ZIndexLayerProps = { /** * Z-Index of this component and its children. * * The higher the value, the more on top it will be rendered. * Components with higher zIndex will appear in front of components with lower zIndex. * * If `undefined` or `0`, the content is rendered in the default layer without portals. */ zIndex: number | undefined; /** * The content to render inside this zIndex layer. * Undefined children are allowed and will render nothing and will still report the zIndex to the portal system. */ children?: React.ReactNode; }; /** * A layer that renders its children into a portal corresponding to the given zIndex. * We can't use regular CSS `z-index` because SVG does not support it. * So instead, we create separate DOM nodes for each zIndex layer * and render the children into the corresponding DOM node using React portals. * * This component must be used inside a Chart component. * * @param zIndex numeric zIndex value, higher values are rendered on top of lower values * @param children the content to render inside this zIndex layer * * @since 3.4 */ declare function ZIndexLayer({ zIndex, children }: ZIndexLayerProps): React.ReactNode; type CartesianLabelPosition = 'top' | 'left' | 'right' | 'bottom' | 'inside' | 'outside' | 'insideLeft' | 'insideRight' | 'insideTop' | 'insideBottom' | 'insideTopLeft' | 'insideBottomLeft' | 'insideTopRight' | 'insideBottomRight' | 'insideStart' | 'insideEnd' | 'end' | 'center' | 'centerTop' | 'centerBottom' | 'middle' | { x?: number | string; y?: number | string; }; /** * @inline */ type LabelContentType = ReactElement | ((props: Props$B) => RenderableText | ReactElement); type PolarLabelPosition = 'insideStart' | 'insideEnd' | 'end'; /** * @inline */ type LabelPosition = CartesianLabelPosition | PolarLabelPosition; /** * @inline */ type LabelFormatter = (label: RenderableText) => RenderableText; interface LabelProps extends ZIndexable { /** * The box of viewing area. Used for positioning. * If undefined, viewBox will be calculated based on surrounding context. */ viewBox?: ViewBox; parentViewBox?: ViewBox; /** * Function to customize how content is serialized before rendering. * * This should return a renderable text - something that the {@link Text} component can render. * Typically, a string or number. * Custom components are not supported here - use the `content` prop instead. */ formatter?: LabelFormatter; /** * The value of label can be set as children or as the `value` prop * * @example