@bluecateng/pelagos-charts
Version:
59 lines • 1.71 kB
JavaScript
import PropTypes from 'prop-types';
import { Layer } from '@bluecateng/pelagos';
import getColorClass from './getColorClass';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
const SingleHint = ({
bottomTitle,
bottomValue,
bottomFormatter,
leftTitle,
leftValue,
leftFormatter,
groupLabel,
group,
groupFormatter,
groupIndex,
variant,
option,
getBgClass
}) => /*#__PURE__*/_jsxs(Layer, {
as: "ul",
className: "Chart Chart__hint",
children: [/*#__PURE__*/_jsxs("li", {
children: [/*#__PURE__*/_jsx("span", {
children: bottomTitle || 'x'
}), /*#__PURE__*/_jsx("span", {
children: bottomFormatter(bottomValue)
})]
}), /*#__PURE__*/_jsxs("li", {
children: [/*#__PURE__*/_jsx("span", {
children: leftTitle || 'y'
}), /*#__PURE__*/_jsx("span", {
children: leftFormatter(leftValue)
})]
}), group && /*#__PURE__*/_jsxs("li", {
children: [/*#__PURE__*/_jsx("span", {
className: `Chart__hintColor ${getBgClass(group, bottomValue, leftValue, getColorClass('bg', variant, option, groupIndex.get(group)))}`
}), /*#__PURE__*/_jsx("span", {
children: groupLabel
}), /*#__PURE__*/_jsx("span", {
children: groupFormatter(group)
})]
})]
});
SingleHint.propTypes = {
bottomTitle: PropTypes.string,
bottomValue: PropTypes.any,
bottomFormatter: PropTypes.func,
leftTitle: PropTypes.string,
leftValue: PropTypes.any,
leftFormatter: PropTypes.func,
groupLabel: PropTypes.string,
group: PropTypes.any,
groupFormatter: PropTypes.func,
groupIndex: PropTypes.object,
variant: PropTypes.number,
option: PropTypes.number,
getBgClass: PropTypes.func
};
export default SingleHint;