UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

64 lines (63 loc) 2.39 kB
'use client'; import _extends from "@babel/runtime/helpers/esm/extends"; import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose"; const _excluded = ["skipAnimation", "ownerState"]; import * as React from 'react'; import PropTypes from 'prop-types'; import { useAnimateLine } from "../hooks/index.js"; import { AppearingMask } from "./AppearingMask.js"; import { jsx as _jsx } from "react/jsx-runtime"; /** * Demos: * * - [Lines](https://mui.com/x/react-charts/lines/) * - [Line demonstration](https://mui.com/x/react-charts/line-demo/) * * API: * * - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/) */ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props, ref) { const { skipAnimation, ownerState } = props, other = _objectWithoutPropertiesLoose(props, _excluded); const animateProps = useAnimateLine(_extends({}, props, { ref })); return /*#__PURE__*/_jsx(AppearingMask, { skipAnimation: skipAnimation, id: `${ownerState.id}-line-clip`, children: /*#__PURE__*/_jsx("path", _extends({ stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color, strokeWidth: 2, strokeLinejoin: "round", fill: "none", filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined, opacity: ownerState.isFaded ? 0.3 : 1 }, other, animateProps)) }); }); if (process.env.NODE_ENV !== "production") AnimatedLine.displayName = "AnimatedLine"; process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = { // ----------------------------- Warning -------------------------------- // | These PropTypes are generated from the TypeScript type definitions | // | To update them edit the TypeScript types and run "pnpm proptypes" | // ---------------------------------------------------------------------- d: PropTypes.string.isRequired, ownerState: PropTypes.shape({ classes: PropTypes.object, color: PropTypes.string.isRequired, gradientId: PropTypes.string, id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, isFaded: PropTypes.bool.isRequired, isHighlighted: PropTypes.bool.isRequired }).isRequired, /** * If `true`, animations are skipped. * @default false */ skipAnimation: PropTypes.bool } : void 0; export { AnimatedLine };