@mui/x-charts
Version:
The community edition of the charts components (MUI X).
77 lines • 2.74 kB
JavaScript
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
var _excluded = ["x", "y", "id", "classes", "color"];
import * as React from 'react';
import PropTypes from 'prop-types';
import composeClasses from '@mui/utils/composeClasses';
import generateUtilityClass from '@mui/utils/generateUtilityClass';
import { styled } from '@mui/material/styles';
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
import { jsx as _jsx } from "react/jsx-runtime";
export function getHighlightElementUtilityClass(slot) {
return generateUtilityClass('MuiHighlightElement', slot);
}
export var lineHighlightElementClasses = generateUtilityClasses('MuiHighlightElement', ['root']);
var useUtilityClasses = function useUtilityClasses(ownerState) {
var classes = ownerState.classes,
id = ownerState.id;
var slots = {
root: ['root', "series-".concat(id)]
};
return composeClasses(slots, getHighlightElementUtilityClass, classes);
};
var HighlightElement = styled('circle', {
name: 'MuiHighlightElement',
slot: 'Root',
overridesResolver: function overridesResolver(_, styles) {
return styles.root;
}
})(function (_ref) {
var ownerState = _ref.ownerState;
return {
transform: "translate(".concat(ownerState.x, "px, ").concat(ownerState.y, "px)"),
transformOrigin: "".concat(ownerState.x, "px ").concat(ownerState.y, "px"),
fill: ownerState.color
};
});
/**
* Demos:
*
* - [Lines](https://mui.com/x/react-charts/lines/)
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
*
* API:
*
* - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
*/
function LineHighlightElement(props) {
var x = props.x,
y = props.y,
id = props.id,
innerClasses = props.classes,
color = props.color,
other = _objectWithoutProperties(props, _excluded);
var ownerState = {
id: id,
classes: innerClasses,
color: color,
x: x,
y: y
};
var classes = useUtilityClasses(ownerState);
return /*#__PURE__*/_jsx(HighlightElement, _extends({}, other, {
ownerState: ownerState,
className: classes.root,
cx: 0,
cy: 0,
r: other.r === undefined ? 5 : other.r
}));
}
process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
// ----------------------------- Warning --------------------------------
// | These PropTypes are generated from the TypeScript type definitions |
// | To update them edit the TypeScript types and run "yarn proptypes" |
// ----------------------------------------------------------------------
classes: PropTypes.object
} : void 0;
export { LineHighlightElement };