import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["seriesId", "onItemClick"]; import * as React from 'react'; import { clsx } from 'clsx'; import PropTypes from 'prop-types'; import { useRadarSeriesData } from "./useRadarSeriesData.js"; import { useItemHighlightedGetter } from "../../hooks/useItemHighlightedGetter.js"; import { useUtilityClasses } from "./radarSeriesPlotClasses.js"; import { jsx as _jsx } from "react/jsx-runtime"; export function getCircleProps(params) { const { isHighlighted, isFaded, seriesId, classes, point, fillArea, color } = params; const isItemHighlighted = isHighlighted({ seriesId }); const isItemFaded = !isItemHighlighted && isFaded({ seriesId }); return { cx: point.x, cy: point.y, r: 3, fill: color, stroke: color, opacity: fillArea && isItemFaded ? 0.5 : 1, className: clsx(classes.mark, isItemHighlighted && classes.highlighted || isItemFaded && classes.faded) }; } function RadarSeriesMarks(props) { const { onItemClick } = props, other = _objectWithoutPropertiesLoose(props, _excluded); const seriesCoordinates = useRadarSeriesData(props.seriesId); const classes = useUtilityClasses(props.classes); const { isFaded, isHighlighted } = useItemHighlightedGetter(); return /*#__PURE__*/_jsx(React.Fragment, { children: seriesCoordinates?.map(({ seriesId: id, points, color, hideMark, fillArea }) => { if (hideMark) { return null; } return /*#__PURE__*/_jsx("g", { children: points.map((point, index) => /*#__PURE__*/_jsx("circle", _extends({}, getCircleProps({ seriesId: id, point, color, fillArea, isFaded, isHighlighted, classes }), { pointerEvents: onItemClick ? undefined : 'none', onClick: event => onItemClick?.(event, { type: 'radar', seriesId: id, dataIndex: index }), cursor: onItemClick ? 'pointer' : 'unset' }, other), index)) }, id); }) }); } process.env.NODE_ENV !== "production" ? RadarSeriesMarks.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "pnpm proptypes" | // ---------------------------------------------------------------------- /** * Override or extend the styles applied to the component. */ classes: PropTypes.object, /** * Callback fired when a mark is clicked. * @param {React.MouseEvent} event The event source of the callback. * @param {RadarItemIdentifier} radarItemIdentifier The radar item identifier. */ onItemClick: PropTypes.func, /** * The id of the series to display. * If undefined all series are displayed. */ seriesId: PropTypes.string } : void 0; export { RadarSeriesMarks };