64 lines
2.4 KiB
JavaScript
64 lines
2.4 KiB
JavaScript
'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 { useAnimateArea } from "../hooks/animation/useAnimateArea.js";
|
|
import { AppearingMask } from "./AppearingMask.js";
|
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
/**
|
|
* Demos:
|
|
*
|
|
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
*
|
|
* API:
|
|
*
|
|
* - [AreaElement API](https://mui.com/x/api/charts/animated-area/)
|
|
*/
|
|
function AnimatedArea(props) {
|
|
const {
|
|
skipAnimation,
|
|
ownerState
|
|
} = props,
|
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
const animatedProps = useAnimateArea(props);
|
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
skipAnimation: skipAnimation,
|
|
id: `${ownerState.id}-area-clip`,
|
|
children: /*#__PURE__*/_jsx("path", _extends({
|
|
fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
filter:
|
|
// eslint-disable-next-line no-nested-ternary
|
|
ownerState.isHighlighted ? 'brightness(140%)' : ownerState.gradientId ? undefined : 'brightness(120%)',
|
|
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
stroke: "none",
|
|
"data-series": ownerState.id,
|
|
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
"data-faded": ownerState.isFaded || undefined
|
|
}, other, animatedProps))
|
|
});
|
|
}
|
|
process.env.NODE_ENV !== "production" ? AnimatedArea.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 { AnimatedArea }; |