Socket
Socket
Sign inDemoInstall

@nivo/pie

Package Overview
Dependencies
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nivo/pie - npm Package Compare versions

Comparing version 0.63.0 to 0.63.1

925

dist/nivo-pie.cjs.js

@@ -9,11 +9,6 @@ 'use strict';

var React__default = _interopDefault(React);
var PropTypes = _interopDefault(require('prop-types'));
var d3Shape = require('d3-shape');
var setDisplayName = _interopDefault(require('recompose/setDisplayName'));
var compose = _interopDefault(require('recompose/compose'));
var pure = _interopDefault(require('recompose/pure'));
var defaultProps = _interopDefault(require('recompose/defaultProps'));
var withPropsOnChange = _interopDefault(require('recompose/withPropsOnChange'));
var core = require('@nivo/core');
var colors = require('@nivo/colors');
var PropTypes = _interopDefault(require('prop-types'));
var legends = require('@nivo/legends');

@@ -23,2 +18,31 @@ var tooltip = require('@nivo/tooltip');

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _defineProperty(obj, key, value) {

@@ -67,175 +91,2 @@ if (key in obj) {

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (_isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var PieLayout = function (_Component) {
_inherits(PieLayout, _Component);
var _super = _createSuper(PieLayout);
function PieLayout() {
_classCallCheck(this, PieLayout);
return _super.apply(this, arguments);
}
_createClass(PieLayout, [{
key: "render",
value: function render() {
var _this$props = this.props,
arcs = _this$props.arcs,
arcGenerator = _this$props.arcGenerator,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
width = _this$props.width,
height = _this$props.height,
centerX = _this$props.centerX,
centerY = _this$props.centerY,
radius = _this$props.radius,
innerRadius = _this$props.innerRadius,
debug = _this$props.debug,
render = _this$props.children;
return render({
arcs: arcs,
arcGenerator: arcGenerator,
startAngle: startAngle,
endAngle: endAngle,
width: width,
height: height,
centerX: centerX,
centerY: centerY,
radius: radius,
innerRadius: innerRadius,
debug: debug
});
}
}]);
return PieLayout;
}(React.Component);
var PieLayoutDefaultProps = {

@@ -250,16 +101,37 @@ fit: true,

};
var enhance = function enhance(Component) {
return compose(defaultProps(PieLayoutDefaultProps), withPropsOnChange(['colors'], function (_ref) {
var colors$1 = _ref.colors;
return {
getColor: colors.getOrdinalColorScale(colors$1, 'id')
};
}), withPropsOnChange(['width', 'height', 'innerRadius', 'startAngle', 'endAngle', 'fit', 'cornerRadius'], function (_ref2) {
var width = _ref2.width,
height = _ref2.height,
_innerRadius = _ref2.innerRadius,
startAngle = _ref2.startAngle,
endAngle = _ref2.endAngle,
fit = _ref2.fit,
cornerRadius = _ref2.cornerRadius;
function PieLayout(props) {
var startAngle = props.startAngle,
endAngle = props.endAngle,
width = props.width,
height = props.height,
_innerRadius = props.innerRadius,
debug = props.debug,
render = props.children,
fit = props.fit,
cornerRadius = props.cornerRadius,
colors$1 = props.colors,
sortByValue = props.sortByValue,
padAngle = props.padAngle,
data = props.data;
var getColor = React__default.useMemo(function () {
return colors.getOrdinalColorScale(colors$1, 'id');
}, [colors$1]);
var pie = React__default.useMemo(function () {
var pie = d3Shape.pie().value(function (d) {
return d.value;
}).padAngle(core.degreesToRadians(padAngle)).startAngle(core.degreesToRadians(startAngle)).endAngle(core.degreesToRadians(endAngle));
if (sortByValue !== true) pie.sortValues(null);
return pie;
}, [sortByValue, padAngle, startAngle, endAngle]);
var arcs = React__default.useMemo(function () {
return pie(data).map(function (arc) {
var angle = Math.abs(arc.endAngle - arc.startAngle);
return _objectSpread2(_objectSpread2({}, arc), {}, {
angle: angle,
angleDeg: core.radiansToDegrees(angle),
color: getColor(arc.data)
});
});
}, [pie, data, getColor]);
var computedProps = React__default.useMemo(function () {
var radius = Math.min(width, height) / 2;

@@ -300,39 +172,39 @@ var innerRadius = radius * Math.min(_innerRadius, 1);

};
}), withPropsOnChange(['sortByValue', 'padAngle', 'startAngle', 'endAngle'], function (_ref3) {
var sortByValue = _ref3.sortByValue,
padAngle = _ref3.padAngle,
startAngle = _ref3.startAngle,
endAngle = _ref3.endAngle;
var pie = d3Shape.pie().value(function (d) {
return d.value;
}).padAngle(core.degreesToRadians(padAngle)).startAngle(core.degreesToRadians(startAngle)).endAngle(core.degreesToRadians(endAngle));
if (sortByValue !== true) pie.sortValues(null);
return {
pie: pie
};
}), withPropsOnChange(['pie', 'data'], function (_ref4) {
var pie = _ref4.pie,
data = _ref4.data;
return {
arcs: pie(data).map(function (arc) {
var angle = Math.abs(arc.endAngle - arc.startAngle);
return _objectSpread2(_objectSpread2({}, arc), {}, {
angle: angle,
angleDeg: core.radiansToDegrees(angle)
});
})
};
}), withPropsOnChange(['arcs', 'getColor'], function (_ref5) {
var arcs = _ref5.arcs,
getColor = _ref5.getColor;
return {
arcs: arcs.map(function (arc) {
return _objectSpread2(_objectSpread2({}, arc), {}, {
color: getColor(arc.data)
});
})
};
}), pure)(Component);
}, [width, height, _innerRadius, startAngle, endAngle, fit, cornerRadius]);
return render(_objectSpread2({
arcs: arcs,
startAngle: startAngle,
endAngle: endAngle,
width: width,
height: height,
debug: debug
}, computedProps));
}
PieLayout.propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
})).isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
fit: PropTypes.bool.isRequired,
sortByValue: PropTypes.bool.isRequired,
startAngle: PropTypes.number.isRequired,
endAngle: PropTypes.number.isRequired,
padAngle: PropTypes.number.isRequired,
innerRadius: PropTypes.number.isRequired,
cornerRadius: PropTypes.number.isRequired,
debug: PropTypes.shape({
points: PropTypes.array.isRequired,
box: PropTypes.shape({
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired
}).isRequired,
ratio: PropTypes.number.isRequired
}),
children: PropTypes.func.isRequired
};
var PieLayout$1 = setDisplayName('PieLayout')(enhance(PieLayout));
PieLayout.defaultProps = PieLayoutDefaultProps;

@@ -449,3 +321,3 @@ var arcPropType = PropTypes.shape({

hideTooltip = _ref.hideTooltip,
onClick = _ref.onClick,
_onClick = _ref.onClick,
onMouseEnter = _ref.onMouseEnter,

@@ -486,16 +358,112 @@ onMouseLeave = _ref.onMouseLeave,

onMouseLeave: handleMouseLeave,
onClick: onClick
onClick: function onClick() {
return _onClick(data, event);
}
});
};
var enhance$1 = compose(withPropsOnChange(['data', 'onClick'], function (_ref2) {
var data = _ref2.data,
_onClick = _ref2.onClick;
return {
onClick: function onClick(event) {
return _onClick(data, event);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
}), pure);
var PieSlice$1 = enhance$1(PieSlice);
return _getPrototypeOf(o);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (_isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var computeRadialLabels = function computeRadialLabels(arcs, _ref) {

@@ -667,213 +635,180 @@ var getLabel = _ref.getLabel,

var PieLegends = function (_Component) {
_inherits(PieLegends, _Component);
var _super = _createSuper(PieLegends);
function PieLegends() {
_classCallCheck(this, PieLegends);
return _super.apply(this, arguments);
}
_createClass(PieLegends, [{
key: "render",
value: function render() {
var _this$props = this.props,
width = _this$props.width,
height = _this$props.height,
legends$1 = _this$props.legends,
data = _this$props.data,
theme = _this$props.theme;
return legends$1.map(function (legend, i) {
return React__default.createElement(legends.BoxLegendSvg, Object.assign({
key: i
}, legend, {
containerWidth: width,
containerHeight: height,
data: data,
function PieLegends(props) {
var width = props.width,
height = props.height,
legends$1 = props.legends,
theme = props.theme,
arcs = props.arcs;
var data = React__default.useMemo(function () {
return arcs.map(function (_ref) {
var color = _ref.color,
_ref$data = _ref.data,
id = _ref$data.id,
label = _ref$data.label,
fill = _ref.fill;
return {
id: id,
label: label || id,
color: color,
fill: fill
};
});
}, [arcs]);
return legends$1.map(function (legend, i) {
return React__default.createElement(legends.BoxLegendSvg, Object.assign({
key: i
}, legend, {
containerWidth: width,
containerHeight: height,
data: data,
theme: theme
}));
});
}
function Pie(props) {
var data = props.data,
sortByValue = props.sortByValue,
startAngle = props.startAngle,
endAngle = props.endAngle,
padAngle = props.padAngle,
fit = props.fit,
innerRadius = props.innerRadius,
cornerRadius = props.cornerRadius,
_margin = props.margin,
_width = props.width,
_height = props.height,
colors$1 = props.colors,
colorBy = props.colorBy,
borderWidth = props.borderWidth,
_borderColor = props.borderColor,
radialLabel = props.radialLabel,
enableRadialLabels = props.enableRadialLabels,
radialLabelsSkipAngle = props.radialLabelsSkipAngle,
radialLabelsLinkOffset = props.radialLabelsLinkOffset,
radialLabelsLinkDiagonalLength = props.radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength = props.radialLabelsLinkHorizontalLength,
radialLabelsLinkStrokeWidth = props.radialLabelsLinkStrokeWidth,
radialLabelsTextXOffset = props.radialLabelsTextXOffset,
radialLabelsTextColor = props.radialLabelsTextColor,
radialLabelsLinkColor = props.radialLabelsLinkColor,
sliceLabel = props.sliceLabel,
enableSlicesLabels = props.enableSlicesLabels,
slicesLabelsSkipAngle = props.slicesLabelsSkipAngle,
slicesLabelsTextColor = props.slicesLabelsTextColor,
_theme = props.theme,
defs = props.defs,
fill = props.fill,
isInteractive = props.isInteractive,
onClick = props.onClick,
onMouseEnter = props.onMouseEnter,
onMouseLeave = props.onMouseLeave,
tooltipFormat = props.tooltipFormat,
tooltip = props.tooltip,
legends = props.legends,
role = props.role;
var theme = core.usePartialTheme(_theme);
var _useDimensions = core.useDimensions(_width, _height, _margin),
outerWidth = _useDimensions.outerWidth,
outerHeight = _useDimensions.outerHeight,
margin = _useDimensions.margin,
innerWidth = _useDimensions.innerWidth,
innerHeight = _useDimensions.innerHeight;
var getRadialLabel = React__default.useMemo(function () {
return core.getLabelGenerator(radialLabel);
}, [radialLabel]);
var getSliceLabel = React__default.useMemo(function () {
return core.getLabelGenerator(sliceLabel);
}, [sliceLabel]);
var borderColor = colors.getInheritedColorGenerator(_borderColor, theme);
return React__default.createElement(PieLayout, {
width: innerWidth,
height: innerHeight,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors$1,
colorBy: colorBy
}, function (_ref) {
var centerX = _ref.centerX,
centerY = _ref.centerY,
radius = _ref.radius,
innerRadius = _ref.innerRadius,
arcs = _ref.arcs,
arcGenerator = _ref.arcGenerator;
var boundDefs = core.bindDefs(defs, arcs, fill, {
dataKey: 'data'
});
return React__default.createElement(core.Container, {
isInteractive: isInteractive,
theme: theme,
animate: false
}, function (_ref2) {
var showTooltip = _ref2.showTooltip,
hideTooltip = _ref2.hideTooltip;
return React__default.createElement(core.SvgWrapper, {
width: outerWidth,
height: outerHeight,
margin: margin,
defs: boundDefs,
theme: theme,
role: role
}, React__default.createElement("g", {
transform: "translate(".concat(centerX, ",").concat(centerY, ")")
}, arcs.map(function (arc) {
return React__default.createElement(PieSlice, {
key: arc.data.id,
data: arc.data,
path: arcGenerator(arc),
color: arc.color,
fill: arc.fill ? arc.fill : arc.color,
borderWidth: borderWidth,
borderColor: borderColor(arc),
showTooltip: showTooltip,
hideTooltip: hideTooltip,
tooltipFormat: tooltipFormat,
tooltip: tooltip,
onClick: onClick,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
theme: theme
}));
});
}
}]);
return PieLegends;
}(React.Component);
var enhance$2 = function enhance(Component) {
return compose(withPropsOnChange(['arcs'], function (_ref) {
var arcs = _ref.arcs;
return {
data: arcs.map(function (_ref2) {
var color = _ref2.color,
_ref2$data = _ref2.data,
id = _ref2$data.id,
label = _ref2$data.label,
fill = _ref2.fill;
return {
id: id,
label: label || id,
color: color,
fill: fill
};
})
};
}), pure)(Component);
};
var PieLegends$1 = setDisplayName('PieLegends')(enhance$2(PieLegends));
var Pie = function (_Component) {
_inherits(Pie, _Component);
var _super = _createSuper(Pie);
function Pie() {
_classCallCheck(this, Pie);
return _super.apply(this, arguments);
}
_createClass(Pie, [{
key: "render",
value: function render() {
var _this$props = this.props,
data = _this$props.data,
sortByValue = _this$props.sortByValue,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
padAngle = _this$props.padAngle,
fit = _this$props.fit,
innerRadius = _this$props.innerRadius,
cornerRadius = _this$props.cornerRadius,
margin = _this$props.margin,
width = _this$props.width,
height = _this$props.height,
outerWidth = _this$props.outerWidth,
outerHeight = _this$props.outerHeight,
colors$1 = _this$props.colors,
colorBy = _this$props.colorBy,
borderWidth = _this$props.borderWidth,
_borderColor = _this$props.borderColor,
enableRadialLabels = _this$props.enableRadialLabels,
getRadialLabel = _this$props.getRadialLabel,
radialLabelsSkipAngle = _this$props.radialLabelsSkipAngle,
radialLabelsLinkOffset = _this$props.radialLabelsLinkOffset,
radialLabelsLinkDiagonalLength = _this$props.radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength = _this$props.radialLabelsLinkHorizontalLength,
radialLabelsLinkStrokeWidth = _this$props.radialLabelsLinkStrokeWidth,
radialLabelsTextXOffset = _this$props.radialLabelsTextXOffset,
radialLabelsTextColor = _this$props.radialLabelsTextColor,
radialLabelsLinkColor = _this$props.radialLabelsLinkColor,
enableSlicesLabels = _this$props.enableSlicesLabels,
getSliceLabel = _this$props.getSliceLabel,
slicesLabelsSkipAngle = _this$props.slicesLabelsSkipAngle,
slicesLabelsTextColor = _this$props.slicesLabelsTextColor,
theme = _this$props.theme,
defs = _this$props.defs,
fill = _this$props.fill,
isInteractive = _this$props.isInteractive,
onClick = _this$props.onClick,
onMouseEnter = _this$props.onMouseEnter,
onMouseLeave = _this$props.onMouseLeave,
tooltipFormat = _this$props.tooltipFormat,
tooltip = _this$props.tooltip,
legends = _this$props.legends,
role = _this$props.role;
var borderColor = colors.getInheritedColorGenerator(_borderColor, theme);
return React__default.createElement(PieLayout$1, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
});
}), enableRadialLabels && React__default.createElement(PieRadialLabels, {
arcs: arcs,
radius: radius,
label: getRadialLabel,
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
textColor: colors.getInheritedColorGenerator(radialLabelsTextColor, theme),
linkColor: colors.getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme: theme
}), enableSlicesLabels && React__default.createElement(PieSlicesLabels, {
arcs: arcs,
radius: radius,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors$1,
colorBy: colorBy
}, function (_ref) {
var centerX = _ref.centerX,
centerY = _ref.centerY,
radius = _ref.radius,
innerRadius = _ref.innerRadius,
arcs = _ref.arcs,
arcGenerator = _ref.arcGenerator;
var boundDefs = core.bindDefs(defs, arcs, fill, {
dataKey: 'data'
});
return React__default.createElement(core.Container, {
isInteractive: isInteractive,
theme: theme,
animate: false
}, function (_ref2) {
var showTooltip = _ref2.showTooltip,
hideTooltip = _ref2.hideTooltip;
return React__default.createElement(core.SvgWrapper, {
width: outerWidth,
height: outerHeight,
margin: margin,
defs: boundDefs,
theme: theme,
role: role
}, React__default.createElement("g", {
transform: "translate(".concat(centerX, ",").concat(centerY, ")")
}, arcs.map(function (arc) {
return React__default.createElement(PieSlice$1, {
key: arc.data.id,
data: arc.data,
path: arcGenerator(arc),
color: arc.color,
fill: arc.fill ? arc.fill : arc.color,
borderWidth: borderWidth,
borderColor: borderColor(arc),
showTooltip: showTooltip,
hideTooltip: hideTooltip,
tooltipFormat: tooltipFormat,
tooltip: tooltip,
onClick: onClick,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
theme: theme
});
}), enableRadialLabels && React__default.createElement(PieRadialLabels, {
arcs: arcs,
radius: radius,
label: getRadialLabel,
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
textColor: colors.getInheritedColorGenerator(radialLabelsTextColor, theme),
linkColor: colors.getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme: theme
}), enableSlicesLabels && React__default.createElement(PieSlicesLabels, {
arcs: arcs,
radius: radius,
innerRadius: innerRadius,
theme: theme,
label: getSliceLabel,
skipAngle: slicesLabelsSkipAngle,
textColor: colors.getInheritedColorGenerator(slicesLabelsTextColor, theme)
})), React__default.createElement(PieLegends$1, {
width: width,
height: height,
arcs: arcs,
legends: legends,
theme: theme
}));
});
});
}
}]);
return Pie;
}(React.Component);
var enhance$3 = function enhance(Component) {
return compose(defaultProps(PieSvgDefaultProps), core.withTheme(), core.withDimensions(), withPropsOnChange(['radialLabel'], function (_ref3) {
var radialLabel = _ref3.radialLabel;
return {
getRadialLabel: core.getLabelGenerator(radialLabel)
};
}), withPropsOnChange(['sliceLabel'], function (_ref4) {
var sliceLabel = _ref4.sliceLabel;
return {
getSliceLabel: core.getLabelGenerator(sliceLabel)
};
}), pure)(Component);
};
var Pie$1 = setDisplayName('Pie')(enhance$3(Pie));
theme: theme,
label: getSliceLabel,
skipAngle: slicesLabelsSkipAngle,
textColor: colors.getInheritedColorGenerator(slicesLabelsTextColor, theme)
})), React__default.createElement(PieLegends, {
width: innerWidth,
height: innerHeight,
arcs: arcs,
legends: legends,
theme: theme
}));
});
});
}
Pie.displayName = 'Pie';
Pie.defaultProps = PieSvgDefaultProps;

@@ -884,3 +819,3 @@ var ResponsivePie = function ResponsivePie(props) {

height = _ref.height;
return React__default.createElement(Pie$1, Object.assign({
return React__default.createElement(Pie, Object.assign({
width: width,

@@ -892,6 +827,2 @@ height: height

var enhance$4 = (function (Component) {
return compose(defaultProps(PieDefaultProps), core.withTheme(), core.withDimensions(), pure)(Component);
});
function _arrayWithHoles(arr) {

@@ -1036,3 +967,2 @@ if (Array.isArray(arr)) return arr;

};
var PieTooltip$1 = pure(PieTooltip);

@@ -1068,3 +998,3 @@ var PieCanvasRenderer = function (_Component) {

if (arc) {
showTooltip( React__default.createElement(PieTooltip$1, {
showTooltip( React__default.createElement(PieTooltip, {
data: arc.data,

@@ -1245,47 +1175,34 @@ color: arc.color,

var PieCanvas = function (_Component) {
_inherits(PieCanvas, _Component);
var _super = _createSuper(PieCanvas);
function PieCanvas() {
_classCallCheck(this, PieCanvas);
return _super.apply(this, arguments);
}
_createClass(PieCanvas, [{
key: "render",
value: function render() {
var _this$props = this.props,
data = _this$props.data,
sortByValue = _this$props.sortByValue,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
fit = _this$props.fit,
padAngle = _this$props.padAngle,
innerRadius = _this$props.innerRadius,
cornerRadius = _this$props.cornerRadius,
width = _this$props.width,
height = _this$props.height,
colors = _this$props.colors,
colorBy = _this$props.colorBy,
topProps = _objectWithoutProperties(_this$props, ["data", "sortByValue", "startAngle", "endAngle", "fit", "padAngle", "innerRadius", "cornerRadius", "width", "height", "colors", "colorBy"]);
return React__default.createElement(PieLayout$1, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (props) {
return React__default.createElement(PieCanvasRenderer, Object.assign({}, topProps, props));
});
}
}]);
return PieCanvas;
}(React.Component);
var PieCanvas$1 = setDisplayName('PieCanvas')(enhance$4(PieCanvas));
function PieCanvas(props) {
var data = props.data,
sortByValue = props.sortByValue,
startAngle = props.startAngle,
endAngle = props.endAngle,
fit = props.fit,
padAngle = props.padAngle,
innerRadius = props.innerRadius,
cornerRadius = props.cornerRadius,
width = props.width,
height = props.height,
colors = props.colors,
colorBy = props.colorBy,
topProps = _objectWithoutProperties(props, ["data", "sortByValue", "startAngle", "endAngle", "fit", "padAngle", "innerRadius", "cornerRadius", "width", "height", "colors", "colorBy"]);
return React__default.createElement(PieLayout, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (props) {
return React__default.createElement(PieCanvasRenderer, Object.assign({}, topProps, props));
});
}
PieCanvas.displayName = 'PieCanvas';

@@ -1296,3 +1213,3 @@ var ResponsivePieCanvas = function ResponsivePieCanvas(props) {

height = _ref.height;
return React__default.createElement(PieCanvas$1, Object.assign({
return React__default.createElement(PieCanvas, Object.assign({
width: width,

@@ -1353,6 +1270,6 @@ height: height

exports.Pie = Pie$1;
exports.PieCanvas = PieCanvas$1;
exports.Pie = Pie;
exports.PieCanvas = PieCanvas;
exports.PieDefaultProps = PieDefaultProps;
exports.PieLayout = PieLayout$1;
exports.PieLayout = PieLayout;
exports.PiePropTypes = PiePropTypes;

@@ -1359,0 +1276,0 @@ exports.PieSvgDefaultProps = PieSvgDefaultProps;

@@ -1,11 +0,6 @@

import React, { Component, Fragment, useMemo } from 'react';
import { arc, pie, line } from 'd3-shape';
import setDisplayName from 'recompose/setDisplayName';
import compose from 'recompose/compose';
import pure from 'recompose/pure';
import defaultProps from 'recompose/defaultProps';
import withPropsOnChange from 'recompose/withPropsOnChange';
import { computeArcBoundingBox, degreesToRadians, radiansToDegrees, noop, absoluteAngleRadians, midAngle, positionFromAngle, absoluteAngleDegrees, textPropsByEngine, withTheme, withDimensions, getLabelGenerator, bindDefs, Container, SvgWrapper, ResponsiveWrapper, getRelativeCursor, getHoveredArc } from '@nivo/core';
import React, { Fragment, Component, useMemo } from 'react';
import PropTypes from 'prop-types';
import { pie, arc, line } from 'd3-shape';
import { degreesToRadians, radiansToDegrees, computeArcBoundingBox, noop, absoluteAngleRadians, midAngle, positionFromAngle, absoluteAngleDegrees, textPropsByEngine, usePartialTheme, useDimensions, getLabelGenerator, bindDefs, Container, SvgWrapper, ResponsiveWrapper, getRelativeCursor, getHoveredArc } from '@nivo/core';
import { getOrdinalColorScale, inheritedColorPropType, ordinalColorsPropType, getInheritedColorGenerator } from '@nivo/colors';
import PropTypes from 'prop-types';
import { LegendPropShape, BoxLegendSvg, renderLegendToCanvas } from '@nivo/legends';

@@ -15,2 +10,31 @@ import { BasicTooltip } from '@nivo/tooltip';

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _defineProperty(obj, key, value) {

@@ -59,175 +83,2 @@ if (key in obj) {

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (_isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var PieLayout = function (_Component) {
_inherits(PieLayout, _Component);
var _super = _createSuper(PieLayout);
function PieLayout() {
_classCallCheck(this, PieLayout);
return _super.apply(this, arguments);
}
_createClass(PieLayout, [{
key: "render",
value: function render() {
var _this$props = this.props,
arcs = _this$props.arcs,
arcGenerator = _this$props.arcGenerator,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
width = _this$props.width,
height = _this$props.height,
centerX = _this$props.centerX,
centerY = _this$props.centerY,
radius = _this$props.radius,
innerRadius = _this$props.innerRadius,
debug = _this$props.debug,
render = _this$props.children;
return render({
arcs: arcs,
arcGenerator: arcGenerator,
startAngle: startAngle,
endAngle: endAngle,
width: width,
height: height,
centerX: centerX,
centerY: centerY,
radius: radius,
innerRadius: innerRadius,
debug: debug
});
}
}]);
return PieLayout;
}(Component);
var PieLayoutDefaultProps = {

@@ -242,16 +93,37 @@ fit: true,

};
var enhance = function enhance(Component) {
return compose(defaultProps(PieLayoutDefaultProps), withPropsOnChange(['colors'], function (_ref) {
var colors = _ref.colors;
return {
getColor: getOrdinalColorScale(colors, 'id')
};
}), withPropsOnChange(['width', 'height', 'innerRadius', 'startAngle', 'endAngle', 'fit', 'cornerRadius'], function (_ref2) {
var width = _ref2.width,
height = _ref2.height,
_innerRadius = _ref2.innerRadius,
startAngle = _ref2.startAngle,
endAngle = _ref2.endAngle,
fit = _ref2.fit,
cornerRadius = _ref2.cornerRadius;
function PieLayout(props) {
var startAngle = props.startAngle,
endAngle = props.endAngle,
width = props.width,
height = props.height,
_innerRadius = props.innerRadius,
debug = props.debug,
render = props.children,
fit = props.fit,
cornerRadius = props.cornerRadius,
colors = props.colors,
sortByValue = props.sortByValue,
padAngle = props.padAngle,
data = props.data;
var getColor = React.useMemo(function () {
return getOrdinalColorScale(colors, 'id');
}, [colors]);
var pie$1 = React.useMemo(function () {
var pie$1 = pie().value(function (d) {
return d.value;
}).padAngle(degreesToRadians(padAngle)).startAngle(degreesToRadians(startAngle)).endAngle(degreesToRadians(endAngle));
if (sortByValue !== true) pie$1.sortValues(null);
return pie$1;
}, [sortByValue, padAngle, startAngle, endAngle]);
var arcs = React.useMemo(function () {
return pie$1(data).map(function (arc) {
var angle = Math.abs(arc.endAngle - arc.startAngle);
return _objectSpread2(_objectSpread2({}, arc), {}, {
angle: angle,
angleDeg: radiansToDegrees(angle),
color: getColor(arc.data)
});
});
}, [pie$1, data, getColor]);
var computedProps = React.useMemo(function () {
var radius = Math.min(width, height) / 2;

@@ -292,39 +164,39 @@ var innerRadius = radius * Math.min(_innerRadius, 1);

};
}), withPropsOnChange(['sortByValue', 'padAngle', 'startAngle', 'endAngle'], function (_ref3) {
var sortByValue = _ref3.sortByValue,
padAngle = _ref3.padAngle,
startAngle = _ref3.startAngle,
endAngle = _ref3.endAngle;
var pie$1 = pie().value(function (d) {
return d.value;
}).padAngle(degreesToRadians(padAngle)).startAngle(degreesToRadians(startAngle)).endAngle(degreesToRadians(endAngle));
if (sortByValue !== true) pie$1.sortValues(null);
return {
pie: pie$1
};
}), withPropsOnChange(['pie', 'data'], function (_ref4) {
var pie = _ref4.pie,
data = _ref4.data;
return {
arcs: pie(data).map(function (arc) {
var angle = Math.abs(arc.endAngle - arc.startAngle);
return _objectSpread2(_objectSpread2({}, arc), {}, {
angle: angle,
angleDeg: radiansToDegrees(angle)
});
})
};
}), withPropsOnChange(['arcs', 'getColor'], function (_ref5) {
var arcs = _ref5.arcs,
getColor = _ref5.getColor;
return {
arcs: arcs.map(function (arc) {
return _objectSpread2(_objectSpread2({}, arc), {}, {
color: getColor(arc.data)
});
})
};
}), pure)(Component);
}, [width, height, _innerRadius, startAngle, endAngle, fit, cornerRadius]);
return render(_objectSpread2({
arcs: arcs,
startAngle: startAngle,
endAngle: endAngle,
width: width,
height: height,
debug: debug
}, computedProps));
}
PieLayout.propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
})).isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
fit: PropTypes.bool.isRequired,
sortByValue: PropTypes.bool.isRequired,
startAngle: PropTypes.number.isRequired,
endAngle: PropTypes.number.isRequired,
padAngle: PropTypes.number.isRequired,
innerRadius: PropTypes.number.isRequired,
cornerRadius: PropTypes.number.isRequired,
debug: PropTypes.shape({
points: PropTypes.array.isRequired,
box: PropTypes.shape({
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired
}).isRequired,
ratio: PropTypes.number.isRequired
}),
children: PropTypes.func.isRequired
};
var PieLayout$1 = setDisplayName('PieLayout')(enhance(PieLayout));
PieLayout.defaultProps = PieLayoutDefaultProps;

@@ -441,3 +313,3 @@ var arcPropType = PropTypes.shape({

hideTooltip = _ref.hideTooltip,
onClick = _ref.onClick,
_onClick = _ref.onClick,
onMouseEnter = _ref.onMouseEnter,

@@ -478,16 +350,112 @@ onMouseLeave = _ref.onMouseLeave,

onMouseLeave: handleMouseLeave,
onClick: onClick
onClick: function onClick() {
return _onClick(data, event);
}
});
};
var enhance$1 = compose(withPropsOnChange(['data', 'onClick'], function (_ref2) {
var data = _ref2.data,
_onClick = _ref2.onClick;
return {
onClick: function onClick(event) {
return _onClick(data, event);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
}), pure);
var PieSlice$1 = enhance$1(PieSlice);
return _getPrototypeOf(o);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (_isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var computeRadialLabels = function computeRadialLabels(arcs, _ref) {

@@ -659,213 +627,180 @@ var getLabel = _ref.getLabel,

var PieLegends = function (_Component) {
_inherits(PieLegends, _Component);
var _super = _createSuper(PieLegends);
function PieLegends() {
_classCallCheck(this, PieLegends);
return _super.apply(this, arguments);
}
_createClass(PieLegends, [{
key: "render",
value: function render() {
var _this$props = this.props,
width = _this$props.width,
height = _this$props.height,
legends = _this$props.legends,
data = _this$props.data,
theme = _this$props.theme;
return legends.map(function (legend, i) {
return React.createElement(BoxLegendSvg, Object.assign({
key: i
}, legend, {
containerWidth: width,
containerHeight: height,
data: data,
function PieLegends(props) {
var width = props.width,
height = props.height,
legends = props.legends,
theme = props.theme,
arcs = props.arcs;
var data = React.useMemo(function () {
return arcs.map(function (_ref) {
var color = _ref.color,
_ref$data = _ref.data,
id = _ref$data.id,
label = _ref$data.label,
fill = _ref.fill;
return {
id: id,
label: label || id,
color: color,
fill: fill
};
});
}, [arcs]);
return legends.map(function (legend, i) {
return React.createElement(BoxLegendSvg, Object.assign({
key: i
}, legend, {
containerWidth: width,
containerHeight: height,
data: data,
theme: theme
}));
});
}
function Pie(props) {
var data = props.data,
sortByValue = props.sortByValue,
startAngle = props.startAngle,
endAngle = props.endAngle,
padAngle = props.padAngle,
fit = props.fit,
innerRadius = props.innerRadius,
cornerRadius = props.cornerRadius,
_margin = props.margin,
_width = props.width,
_height = props.height,
colors = props.colors,
colorBy = props.colorBy,
borderWidth = props.borderWidth,
_borderColor = props.borderColor,
radialLabel = props.radialLabel,
enableRadialLabels = props.enableRadialLabels,
radialLabelsSkipAngle = props.radialLabelsSkipAngle,
radialLabelsLinkOffset = props.radialLabelsLinkOffset,
radialLabelsLinkDiagonalLength = props.radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength = props.radialLabelsLinkHorizontalLength,
radialLabelsLinkStrokeWidth = props.radialLabelsLinkStrokeWidth,
radialLabelsTextXOffset = props.radialLabelsTextXOffset,
radialLabelsTextColor = props.radialLabelsTextColor,
radialLabelsLinkColor = props.radialLabelsLinkColor,
sliceLabel = props.sliceLabel,
enableSlicesLabels = props.enableSlicesLabels,
slicesLabelsSkipAngle = props.slicesLabelsSkipAngle,
slicesLabelsTextColor = props.slicesLabelsTextColor,
_theme = props.theme,
defs = props.defs,
fill = props.fill,
isInteractive = props.isInteractive,
onClick = props.onClick,
onMouseEnter = props.onMouseEnter,
onMouseLeave = props.onMouseLeave,
tooltipFormat = props.tooltipFormat,
tooltip = props.tooltip,
legends = props.legends,
role = props.role;
var theme = usePartialTheme(_theme);
var _useDimensions = useDimensions(_width, _height, _margin),
outerWidth = _useDimensions.outerWidth,
outerHeight = _useDimensions.outerHeight,
margin = _useDimensions.margin,
innerWidth = _useDimensions.innerWidth,
innerHeight = _useDimensions.innerHeight;
var getRadialLabel = React.useMemo(function () {
return getLabelGenerator(radialLabel);
}, [radialLabel]);
var getSliceLabel = React.useMemo(function () {
return getLabelGenerator(sliceLabel);
}, [sliceLabel]);
var borderColor = getInheritedColorGenerator(_borderColor, theme);
return React.createElement(PieLayout, {
width: innerWidth,
height: innerHeight,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (_ref) {
var centerX = _ref.centerX,
centerY = _ref.centerY,
radius = _ref.radius,
innerRadius = _ref.innerRadius,
arcs = _ref.arcs,
arcGenerator = _ref.arcGenerator;
var boundDefs = bindDefs(defs, arcs, fill, {
dataKey: 'data'
});
return React.createElement(Container, {
isInteractive: isInteractive,
theme: theme,
animate: false
}, function (_ref2) {
var showTooltip = _ref2.showTooltip,
hideTooltip = _ref2.hideTooltip;
return React.createElement(SvgWrapper, {
width: outerWidth,
height: outerHeight,
margin: margin,
defs: boundDefs,
theme: theme,
role: role
}, React.createElement("g", {
transform: "translate(".concat(centerX, ",").concat(centerY, ")")
}, arcs.map(function (arc) {
return React.createElement(PieSlice, {
key: arc.data.id,
data: arc.data,
path: arcGenerator(arc),
color: arc.color,
fill: arc.fill ? arc.fill : arc.color,
borderWidth: borderWidth,
borderColor: borderColor(arc),
showTooltip: showTooltip,
hideTooltip: hideTooltip,
tooltipFormat: tooltipFormat,
tooltip: tooltip,
onClick: onClick,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
theme: theme
}));
});
}
}]);
return PieLegends;
}(Component);
var enhance$2 = function enhance(Component) {
return compose(withPropsOnChange(['arcs'], function (_ref) {
var arcs = _ref.arcs;
return {
data: arcs.map(function (_ref2) {
var color = _ref2.color,
_ref2$data = _ref2.data,
id = _ref2$data.id,
label = _ref2$data.label,
fill = _ref2.fill;
return {
id: id,
label: label || id,
color: color,
fill: fill
};
})
};
}), pure)(Component);
};
var PieLegends$1 = setDisplayName('PieLegends')(enhance$2(PieLegends));
var Pie = function (_Component) {
_inherits(Pie, _Component);
var _super = _createSuper(Pie);
function Pie() {
_classCallCheck(this, Pie);
return _super.apply(this, arguments);
}
_createClass(Pie, [{
key: "render",
value: function render() {
var _this$props = this.props,
data = _this$props.data,
sortByValue = _this$props.sortByValue,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
padAngle = _this$props.padAngle,
fit = _this$props.fit,
innerRadius = _this$props.innerRadius,
cornerRadius = _this$props.cornerRadius,
margin = _this$props.margin,
width = _this$props.width,
height = _this$props.height,
outerWidth = _this$props.outerWidth,
outerHeight = _this$props.outerHeight,
colors = _this$props.colors,
colorBy = _this$props.colorBy,
borderWidth = _this$props.borderWidth,
_borderColor = _this$props.borderColor,
enableRadialLabels = _this$props.enableRadialLabels,
getRadialLabel = _this$props.getRadialLabel,
radialLabelsSkipAngle = _this$props.radialLabelsSkipAngle,
radialLabelsLinkOffset = _this$props.radialLabelsLinkOffset,
radialLabelsLinkDiagonalLength = _this$props.radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength = _this$props.radialLabelsLinkHorizontalLength,
radialLabelsLinkStrokeWidth = _this$props.radialLabelsLinkStrokeWidth,
radialLabelsTextXOffset = _this$props.radialLabelsTextXOffset,
radialLabelsTextColor = _this$props.radialLabelsTextColor,
radialLabelsLinkColor = _this$props.radialLabelsLinkColor,
enableSlicesLabels = _this$props.enableSlicesLabels,
getSliceLabel = _this$props.getSliceLabel,
slicesLabelsSkipAngle = _this$props.slicesLabelsSkipAngle,
slicesLabelsTextColor = _this$props.slicesLabelsTextColor,
theme = _this$props.theme,
defs = _this$props.defs,
fill = _this$props.fill,
isInteractive = _this$props.isInteractive,
onClick = _this$props.onClick,
onMouseEnter = _this$props.onMouseEnter,
onMouseLeave = _this$props.onMouseLeave,
tooltipFormat = _this$props.tooltipFormat,
tooltip = _this$props.tooltip,
legends = _this$props.legends,
role = _this$props.role;
var borderColor = getInheritedColorGenerator(_borderColor, theme);
return React.createElement(PieLayout$1, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
});
}), enableRadialLabels && React.createElement(PieRadialLabels, {
arcs: arcs,
radius: radius,
label: getRadialLabel,
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
textColor: getInheritedColorGenerator(radialLabelsTextColor, theme),
linkColor: getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme: theme
}), enableSlicesLabels && React.createElement(PieSlicesLabels, {
arcs: arcs,
radius: radius,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (_ref) {
var centerX = _ref.centerX,
centerY = _ref.centerY,
radius = _ref.radius,
innerRadius = _ref.innerRadius,
arcs = _ref.arcs,
arcGenerator = _ref.arcGenerator;
var boundDefs = bindDefs(defs, arcs, fill, {
dataKey: 'data'
});
return React.createElement(Container, {
isInteractive: isInteractive,
theme: theme,
animate: false
}, function (_ref2) {
var showTooltip = _ref2.showTooltip,
hideTooltip = _ref2.hideTooltip;
return React.createElement(SvgWrapper, {
width: outerWidth,
height: outerHeight,
margin: margin,
defs: boundDefs,
theme: theme,
role: role
}, React.createElement("g", {
transform: "translate(".concat(centerX, ",").concat(centerY, ")")
}, arcs.map(function (arc) {
return React.createElement(PieSlice$1, {
key: arc.data.id,
data: arc.data,
path: arcGenerator(arc),
color: arc.color,
fill: arc.fill ? arc.fill : arc.color,
borderWidth: borderWidth,
borderColor: borderColor(arc),
showTooltip: showTooltip,
hideTooltip: hideTooltip,
tooltipFormat: tooltipFormat,
tooltip: tooltip,
onClick: onClick,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
theme: theme
});
}), enableRadialLabels && React.createElement(PieRadialLabels, {
arcs: arcs,
radius: radius,
label: getRadialLabel,
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
textColor: getInheritedColorGenerator(radialLabelsTextColor, theme),
linkColor: getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme: theme
}), enableSlicesLabels && React.createElement(PieSlicesLabels, {
arcs: arcs,
radius: radius,
innerRadius: innerRadius,
theme: theme,
label: getSliceLabel,
skipAngle: slicesLabelsSkipAngle,
textColor: getInheritedColorGenerator(slicesLabelsTextColor, theme)
})), React.createElement(PieLegends$1, {
width: width,
height: height,
arcs: arcs,
legends: legends,
theme: theme
}));
});
});
}
}]);
return Pie;
}(Component);
var enhance$3 = function enhance(Component) {
return compose(defaultProps(PieSvgDefaultProps), withTheme(), withDimensions(), withPropsOnChange(['radialLabel'], function (_ref3) {
var radialLabel = _ref3.radialLabel;
return {
getRadialLabel: getLabelGenerator(radialLabel)
};
}), withPropsOnChange(['sliceLabel'], function (_ref4) {
var sliceLabel = _ref4.sliceLabel;
return {
getSliceLabel: getLabelGenerator(sliceLabel)
};
}), pure)(Component);
};
var Pie$1 = setDisplayName('Pie')(enhance$3(Pie));
theme: theme,
label: getSliceLabel,
skipAngle: slicesLabelsSkipAngle,
textColor: getInheritedColorGenerator(slicesLabelsTextColor, theme)
})), React.createElement(PieLegends, {
width: innerWidth,
height: innerHeight,
arcs: arcs,
legends: legends,
theme: theme
}));
});
});
}
Pie.displayName = 'Pie';
Pie.defaultProps = PieSvgDefaultProps;

@@ -876,3 +811,3 @@ var ResponsivePie = function ResponsivePie(props) {

height = _ref.height;
return React.createElement(Pie$1, Object.assign({
return React.createElement(Pie, Object.assign({
width: width,

@@ -884,6 +819,2 @@ height: height

var enhance$4 = (function (Component) {
return compose(defaultProps(PieDefaultProps), withTheme(), withDimensions(), pure)(Component);
});
function _arrayWithHoles(arr) {

@@ -1028,3 +959,2 @@ if (Array.isArray(arr)) return arr;

};
var PieTooltip$1 = pure(PieTooltip);

@@ -1060,3 +990,3 @@ var PieCanvasRenderer = function (_Component) {

if (arc) {
showTooltip( React.createElement(PieTooltip$1, {
showTooltip( React.createElement(PieTooltip, {
data: arc.data,

@@ -1237,47 +1167,34 @@ color: arc.color,

var PieCanvas = function (_Component) {
_inherits(PieCanvas, _Component);
var _super = _createSuper(PieCanvas);
function PieCanvas() {
_classCallCheck(this, PieCanvas);
return _super.apply(this, arguments);
}
_createClass(PieCanvas, [{
key: "render",
value: function render() {
var _this$props = this.props,
data = _this$props.data,
sortByValue = _this$props.sortByValue,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
fit = _this$props.fit,
padAngle = _this$props.padAngle,
innerRadius = _this$props.innerRadius,
cornerRadius = _this$props.cornerRadius,
width = _this$props.width,
height = _this$props.height,
colors = _this$props.colors,
colorBy = _this$props.colorBy,
topProps = _objectWithoutProperties(_this$props, ["data", "sortByValue", "startAngle", "endAngle", "fit", "padAngle", "innerRadius", "cornerRadius", "width", "height", "colors", "colorBy"]);
return React.createElement(PieLayout$1, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (props) {
return React.createElement(PieCanvasRenderer, Object.assign({}, topProps, props));
});
}
}]);
return PieCanvas;
}(Component);
var PieCanvas$1 = setDisplayName('PieCanvas')(enhance$4(PieCanvas));
function PieCanvas(props) {
var data = props.data,
sortByValue = props.sortByValue,
startAngle = props.startAngle,
endAngle = props.endAngle,
fit = props.fit,
padAngle = props.padAngle,
innerRadius = props.innerRadius,
cornerRadius = props.cornerRadius,
width = props.width,
height = props.height,
colors = props.colors,
colorBy = props.colorBy,
topProps = _objectWithoutProperties(props, ["data", "sortByValue", "startAngle", "endAngle", "fit", "padAngle", "innerRadius", "cornerRadius", "width", "height", "colors", "colorBy"]);
return React.createElement(PieLayout, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (props) {
return React.createElement(PieCanvasRenderer, Object.assign({}, topProps, props));
});
}
PieCanvas.displayName = 'PieCanvas';

@@ -1288,3 +1205,3 @@ var ResponsivePieCanvas = function ResponsivePieCanvas(props) {

height = _ref.height;
return React.createElement(PieCanvas$1, Object.assign({
return React.createElement(PieCanvas, Object.assign({
width: width,

@@ -1345,3 +1262,3 @@ height: height

export { Pie$1 as Pie, PieCanvas$1 as PieCanvas, PieDefaultProps, PieLayout$1 as PieLayout, PiePropTypes, PieSvgDefaultProps, PieSvgPropTypes, ResponsivePie, ResponsivePieCanvas, arcPropType, usePie };
export { Pie, PieCanvas, PieDefaultProps, PieLayout, PiePropTypes, PieSvgDefaultProps, PieSvgPropTypes, ResponsivePie, ResponsivePieCanvas, arcPropType, usePie };
//# sourceMappingURL=nivo-pie.es.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('d3-shape'), require('recompose/setDisplayName'), require('recompose/compose'), require('recompose/pure'), require('recompose/defaultProps'), require('recompose/withPropsOnChange'), require('@nivo/core'), require('@nivo/colors'), require('prop-types'), require('@nivo/legends'), require('@nivo/tooltip'), require('lodash/get')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'd3-shape', 'recompose/setDisplayName', 'recompose/compose', 'recompose/pure', 'recompose/defaultProps', 'recompose/withPropsOnChange', '@nivo/core', '@nivo/colors', 'prop-types', '@nivo/legends', '@nivo/tooltip', 'lodash/get'], factory) :
(global = global || self, factory(global.nivo = global.nivo || {}, global.React, global.d3, global.RecomposeSetDisplayName, global.RecomposeCompose, global.RecomposePure, global.RecomposeDefaultProps, global.RecomposeWithPropsOnChange, global.nivo, global.nivo, global.PropTypes, global.nivo, global.nivo, global['lodash/get']));
}(this, (function (exports, React, d3Shape, setDisplayName, compose, pure, defaultProps, withPropsOnChange, core, colors, PropTypes, legends, tooltip, get) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('prop-types'), require('d3-shape'), require('@nivo/core'), require('@nivo/colors'), require('@nivo/legends'), require('@nivo/tooltip'), require('lodash/get')) :
typeof define === 'function' && define.amd ? define(['exports', 'react', 'prop-types', 'd3-shape', '@nivo/core', '@nivo/colors', '@nivo/legends', '@nivo/tooltip', 'lodash/get'], factory) :
(global = global || self, factory(global.nivo = global.nivo || {}, global.React, global.PropTypes, global.d3, global.nivo, global.nivo, global.nivo, global.nivo, global['lodash/get']));
}(this, (function (exports, React, PropTypes, d3Shape, core, colors, legends, tooltip, get) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
setDisplayName = setDisplayName && Object.prototype.hasOwnProperty.call(setDisplayName, 'default') ? setDisplayName['default'] : setDisplayName;
compose = compose && Object.prototype.hasOwnProperty.call(compose, 'default') ? compose['default'] : compose;
pure = pure && Object.prototype.hasOwnProperty.call(pure, 'default') ? pure['default'] : pure;
defaultProps = defaultProps && Object.prototype.hasOwnProperty.call(defaultProps, 'default') ? defaultProps['default'] : defaultProps;
withPropsOnChange = withPropsOnChange && Object.prototype.hasOwnProperty.call(withPropsOnChange, 'default') ? withPropsOnChange['default'] : withPropsOnChange;
PropTypes = PropTypes && Object.prototype.hasOwnProperty.call(PropTypes, 'default') ? PropTypes['default'] : PropTypes;
get = get && Object.prototype.hasOwnProperty.call(get, 'default') ? get['default'] : get;
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _defineProperty(obj, key, value) {

@@ -59,175 +83,2 @@ if (key in obj) {

function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (_isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var PieLayout = function (_Component) {
_inherits(PieLayout, _Component);
var _super = _createSuper(PieLayout);
function PieLayout() {
_classCallCheck(this, PieLayout);
return _super.apply(this, arguments);
}
_createClass(PieLayout, [{
key: "render",
value: function render() {
var _this$props = this.props,
arcs = _this$props.arcs,
arcGenerator = _this$props.arcGenerator,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
width = _this$props.width,
height = _this$props.height,
centerX = _this$props.centerX,
centerY = _this$props.centerY,
radius = _this$props.radius,
innerRadius = _this$props.innerRadius,
debug = _this$props.debug,
render = _this$props.children;
return render({
arcs: arcs,
arcGenerator: arcGenerator,
startAngle: startAngle,
endAngle: endAngle,
width: width,
height: height,
centerX: centerX,
centerY: centerY,
radius: radius,
innerRadius: innerRadius,
debug: debug
});
}
}]);
return PieLayout;
}(React.Component);
var PieLayoutDefaultProps = {

@@ -242,16 +93,37 @@ fit: true,

};
var enhance = function enhance(Component) {
return compose(defaultProps(PieLayoutDefaultProps), withPropsOnChange(['colors'], function (_ref) {
var colors$1 = _ref.colors;
return {
getColor: colors.getOrdinalColorScale(colors$1, 'id')
};
}), withPropsOnChange(['width', 'height', 'innerRadius', 'startAngle', 'endAngle', 'fit', 'cornerRadius'], function (_ref2) {
var width = _ref2.width,
height = _ref2.height,
_innerRadius = _ref2.innerRadius,
startAngle = _ref2.startAngle,
endAngle = _ref2.endAngle,
fit = _ref2.fit,
cornerRadius = _ref2.cornerRadius;
function PieLayout(props) {
var startAngle = props.startAngle,
endAngle = props.endAngle,
width = props.width,
height = props.height,
_innerRadius = props.innerRadius,
debug = props.debug,
render = props.children,
fit = props.fit,
cornerRadius = props.cornerRadius,
colors$1 = props.colors,
sortByValue = props.sortByValue,
padAngle = props.padAngle,
data = props.data;
var getColor = React__default.useMemo(function () {
return colors.getOrdinalColorScale(colors$1, 'id');
}, [colors$1]);
var pie = React__default.useMemo(function () {
var pie = d3Shape.pie().value(function (d) {
return d.value;
}).padAngle(core.degreesToRadians(padAngle)).startAngle(core.degreesToRadians(startAngle)).endAngle(core.degreesToRadians(endAngle));
if (sortByValue !== true) pie.sortValues(null);
return pie;
}, [sortByValue, padAngle, startAngle, endAngle]);
var arcs = React__default.useMemo(function () {
return pie(data).map(function (arc) {
var angle = Math.abs(arc.endAngle - arc.startAngle);
return _objectSpread2(_objectSpread2({}, arc), {}, {
angle: angle,
angleDeg: core.radiansToDegrees(angle),
color: getColor(arc.data)
});
});
}, [pie, data, getColor]);
var computedProps = React__default.useMemo(function () {
var radius = Math.min(width, height) / 2;

@@ -292,39 +164,39 @@ var innerRadius = radius * Math.min(_innerRadius, 1);

};
}), withPropsOnChange(['sortByValue', 'padAngle', 'startAngle', 'endAngle'], function (_ref3) {
var sortByValue = _ref3.sortByValue,
padAngle = _ref3.padAngle,
startAngle = _ref3.startAngle,
endAngle = _ref3.endAngle;
var pie = d3Shape.pie().value(function (d) {
return d.value;
}).padAngle(core.degreesToRadians(padAngle)).startAngle(core.degreesToRadians(startAngle)).endAngle(core.degreesToRadians(endAngle));
if (sortByValue !== true) pie.sortValues(null);
return {
pie: pie
};
}), withPropsOnChange(['pie', 'data'], function (_ref4) {
var pie = _ref4.pie,
data = _ref4.data;
return {
arcs: pie(data).map(function (arc) {
var angle = Math.abs(arc.endAngle - arc.startAngle);
return _objectSpread2(_objectSpread2({}, arc), {}, {
angle: angle,
angleDeg: core.radiansToDegrees(angle)
});
})
};
}), withPropsOnChange(['arcs', 'getColor'], function (_ref5) {
var arcs = _ref5.arcs,
getColor = _ref5.getColor;
return {
arcs: arcs.map(function (arc) {
return _objectSpread2(_objectSpread2({}, arc), {}, {
color: getColor(arc.data)
});
})
};
}), pure)(Component);
}, [width, height, _innerRadius, startAngle, endAngle, fit, cornerRadius]);
return render(_objectSpread2({
arcs: arcs,
startAngle: startAngle,
endAngle: endAngle,
width: width,
height: height,
debug: debug
}, computedProps));
}
PieLayout.propTypes = {
data: PropTypes.arrayOf(PropTypes.shape({
id: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
})).isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired,
fit: PropTypes.bool.isRequired,
sortByValue: PropTypes.bool.isRequired,
startAngle: PropTypes.number.isRequired,
endAngle: PropTypes.number.isRequired,
padAngle: PropTypes.number.isRequired,
innerRadius: PropTypes.number.isRequired,
cornerRadius: PropTypes.number.isRequired,
debug: PropTypes.shape({
points: PropTypes.array.isRequired,
box: PropTypes.shape({
x: PropTypes.number.isRequired,
y: PropTypes.number.isRequired,
width: PropTypes.number.isRequired,
height: PropTypes.number.isRequired
}).isRequired,
ratio: PropTypes.number.isRequired
}),
children: PropTypes.func.isRequired
};
var PieLayout$1 = setDisplayName('PieLayout')(enhance(PieLayout));
PieLayout.defaultProps = PieLayoutDefaultProps;

@@ -441,3 +313,3 @@ var arcPropType = PropTypes.shape({

hideTooltip = _ref.hideTooltip,
onClick = _ref.onClick,
_onClick = _ref.onClick,
onMouseEnter = _ref.onMouseEnter,

@@ -478,16 +350,112 @@ onMouseLeave = _ref.onMouseLeave,

onMouseLeave: handleMouseLeave,
onClick: onClick
onClick: function onClick() {
return _onClick(data, event);
}
});
};
var enhance$1 = compose(withPropsOnChange(['data', 'onClick'], function (_ref2) {
var data = _ref2.data,
_onClick = _ref2.onClick;
return {
onClick: function onClick(event) {
return _onClick(data, event);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
}), pure);
var PieSlice$1 = enhance$1(PieSlice);
return _getPrototypeOf(o);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
return function () {
var Super = _getPrototypeOf(Derived),
result;
if (_isNativeReflectConstruct()) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
var computeRadialLabels = function computeRadialLabels(arcs, _ref) {

@@ -659,213 +627,180 @@ var getLabel = _ref.getLabel,

var PieLegends = function (_Component) {
_inherits(PieLegends, _Component);
var _super = _createSuper(PieLegends);
function PieLegends() {
_classCallCheck(this, PieLegends);
return _super.apply(this, arguments);
}
_createClass(PieLegends, [{
key: "render",
value: function render() {
var _this$props = this.props,
width = _this$props.width,
height = _this$props.height,
legends$1 = _this$props.legends,
data = _this$props.data,
theme = _this$props.theme;
return legends$1.map(function (legend, i) {
return React__default.createElement(legends.BoxLegendSvg, Object.assign({
key: i
}, legend, {
containerWidth: width,
containerHeight: height,
data: data,
function PieLegends(props) {
var width = props.width,
height = props.height,
legends$1 = props.legends,
theme = props.theme,
arcs = props.arcs;
var data = React__default.useMemo(function () {
return arcs.map(function (_ref) {
var color = _ref.color,
_ref$data = _ref.data,
id = _ref$data.id,
label = _ref$data.label,
fill = _ref.fill;
return {
id: id,
label: label || id,
color: color,
fill: fill
};
});
}, [arcs]);
return legends$1.map(function (legend, i) {
return React__default.createElement(legends.BoxLegendSvg, Object.assign({
key: i
}, legend, {
containerWidth: width,
containerHeight: height,
data: data,
theme: theme
}));
});
}
function Pie(props) {
var data = props.data,
sortByValue = props.sortByValue,
startAngle = props.startAngle,
endAngle = props.endAngle,
padAngle = props.padAngle,
fit = props.fit,
innerRadius = props.innerRadius,
cornerRadius = props.cornerRadius,
_margin = props.margin,
_width = props.width,
_height = props.height,
colors$1 = props.colors,
colorBy = props.colorBy,
borderWidth = props.borderWidth,
_borderColor = props.borderColor,
radialLabel = props.radialLabel,
enableRadialLabels = props.enableRadialLabels,
radialLabelsSkipAngle = props.radialLabelsSkipAngle,
radialLabelsLinkOffset = props.radialLabelsLinkOffset,
radialLabelsLinkDiagonalLength = props.radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength = props.radialLabelsLinkHorizontalLength,
radialLabelsLinkStrokeWidth = props.radialLabelsLinkStrokeWidth,
radialLabelsTextXOffset = props.radialLabelsTextXOffset,
radialLabelsTextColor = props.radialLabelsTextColor,
radialLabelsLinkColor = props.radialLabelsLinkColor,
sliceLabel = props.sliceLabel,
enableSlicesLabels = props.enableSlicesLabels,
slicesLabelsSkipAngle = props.slicesLabelsSkipAngle,
slicesLabelsTextColor = props.slicesLabelsTextColor,
_theme = props.theme,
defs = props.defs,
fill = props.fill,
isInteractive = props.isInteractive,
onClick = props.onClick,
onMouseEnter = props.onMouseEnter,
onMouseLeave = props.onMouseLeave,
tooltipFormat = props.tooltipFormat,
tooltip = props.tooltip,
legends = props.legends,
role = props.role;
var theme = core.usePartialTheme(_theme);
var _useDimensions = core.useDimensions(_width, _height, _margin),
outerWidth = _useDimensions.outerWidth,
outerHeight = _useDimensions.outerHeight,
margin = _useDimensions.margin,
innerWidth = _useDimensions.innerWidth,
innerHeight = _useDimensions.innerHeight;
var getRadialLabel = React__default.useMemo(function () {
return core.getLabelGenerator(radialLabel);
}, [radialLabel]);
var getSliceLabel = React__default.useMemo(function () {
return core.getLabelGenerator(sliceLabel);
}, [sliceLabel]);
var borderColor = colors.getInheritedColorGenerator(_borderColor, theme);
return React__default.createElement(PieLayout, {
width: innerWidth,
height: innerHeight,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors$1,
colorBy: colorBy
}, function (_ref) {
var centerX = _ref.centerX,
centerY = _ref.centerY,
radius = _ref.radius,
innerRadius = _ref.innerRadius,
arcs = _ref.arcs,
arcGenerator = _ref.arcGenerator;
var boundDefs = core.bindDefs(defs, arcs, fill, {
dataKey: 'data'
});
return React__default.createElement(core.Container, {
isInteractive: isInteractive,
theme: theme,
animate: false
}, function (_ref2) {
var showTooltip = _ref2.showTooltip,
hideTooltip = _ref2.hideTooltip;
return React__default.createElement(core.SvgWrapper, {
width: outerWidth,
height: outerHeight,
margin: margin,
defs: boundDefs,
theme: theme,
role: role
}, React__default.createElement("g", {
transform: "translate(".concat(centerX, ",").concat(centerY, ")")
}, arcs.map(function (arc) {
return React__default.createElement(PieSlice, {
key: arc.data.id,
data: arc.data,
path: arcGenerator(arc),
color: arc.color,
fill: arc.fill ? arc.fill : arc.color,
borderWidth: borderWidth,
borderColor: borderColor(arc),
showTooltip: showTooltip,
hideTooltip: hideTooltip,
tooltipFormat: tooltipFormat,
tooltip: tooltip,
onClick: onClick,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
theme: theme
}));
});
}
}]);
return PieLegends;
}(React.Component);
var enhance$2 = function enhance(Component) {
return compose(withPropsOnChange(['arcs'], function (_ref) {
var arcs = _ref.arcs;
return {
data: arcs.map(function (_ref2) {
var color = _ref2.color,
_ref2$data = _ref2.data,
id = _ref2$data.id,
label = _ref2$data.label,
fill = _ref2.fill;
return {
id: id,
label: label || id,
color: color,
fill: fill
};
})
};
}), pure)(Component);
};
var PieLegends$1 = setDisplayName('PieLegends')(enhance$2(PieLegends));
var Pie = function (_Component) {
_inherits(Pie, _Component);
var _super = _createSuper(Pie);
function Pie() {
_classCallCheck(this, Pie);
return _super.apply(this, arguments);
}
_createClass(Pie, [{
key: "render",
value: function render() {
var _this$props = this.props,
data = _this$props.data,
sortByValue = _this$props.sortByValue,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
padAngle = _this$props.padAngle,
fit = _this$props.fit,
innerRadius = _this$props.innerRadius,
cornerRadius = _this$props.cornerRadius,
margin = _this$props.margin,
width = _this$props.width,
height = _this$props.height,
outerWidth = _this$props.outerWidth,
outerHeight = _this$props.outerHeight,
colors$1 = _this$props.colors,
colorBy = _this$props.colorBy,
borderWidth = _this$props.borderWidth,
_borderColor = _this$props.borderColor,
enableRadialLabels = _this$props.enableRadialLabels,
getRadialLabel = _this$props.getRadialLabel,
radialLabelsSkipAngle = _this$props.radialLabelsSkipAngle,
radialLabelsLinkOffset = _this$props.radialLabelsLinkOffset,
radialLabelsLinkDiagonalLength = _this$props.radialLabelsLinkDiagonalLength,
radialLabelsLinkHorizontalLength = _this$props.radialLabelsLinkHorizontalLength,
radialLabelsLinkStrokeWidth = _this$props.radialLabelsLinkStrokeWidth,
radialLabelsTextXOffset = _this$props.radialLabelsTextXOffset,
radialLabelsTextColor = _this$props.radialLabelsTextColor,
radialLabelsLinkColor = _this$props.radialLabelsLinkColor,
enableSlicesLabels = _this$props.enableSlicesLabels,
getSliceLabel = _this$props.getSliceLabel,
slicesLabelsSkipAngle = _this$props.slicesLabelsSkipAngle,
slicesLabelsTextColor = _this$props.slicesLabelsTextColor,
theme = _this$props.theme,
defs = _this$props.defs,
fill = _this$props.fill,
isInteractive = _this$props.isInteractive,
onClick = _this$props.onClick,
onMouseEnter = _this$props.onMouseEnter,
onMouseLeave = _this$props.onMouseLeave,
tooltipFormat = _this$props.tooltipFormat,
tooltip = _this$props.tooltip,
legends = _this$props.legends,
role = _this$props.role;
var borderColor = colors.getInheritedColorGenerator(_borderColor, theme);
return React__default.createElement(PieLayout$1, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
});
}), enableRadialLabels && React__default.createElement(PieRadialLabels, {
arcs: arcs,
radius: radius,
label: getRadialLabel,
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
textColor: colors.getInheritedColorGenerator(radialLabelsTextColor, theme),
linkColor: colors.getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme: theme
}), enableSlicesLabels && React__default.createElement(PieSlicesLabels, {
arcs: arcs,
radius: radius,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors$1,
colorBy: colorBy
}, function (_ref) {
var centerX = _ref.centerX,
centerY = _ref.centerY,
radius = _ref.radius,
innerRadius = _ref.innerRadius,
arcs = _ref.arcs,
arcGenerator = _ref.arcGenerator;
var boundDefs = core.bindDefs(defs, arcs, fill, {
dataKey: 'data'
});
return React__default.createElement(core.Container, {
isInteractive: isInteractive,
theme: theme,
animate: false
}, function (_ref2) {
var showTooltip = _ref2.showTooltip,
hideTooltip = _ref2.hideTooltip;
return React__default.createElement(core.SvgWrapper, {
width: outerWidth,
height: outerHeight,
margin: margin,
defs: boundDefs,
theme: theme,
role: role
}, React__default.createElement("g", {
transform: "translate(".concat(centerX, ",").concat(centerY, ")")
}, arcs.map(function (arc) {
return React__default.createElement(PieSlice$1, {
key: arc.data.id,
data: arc.data,
path: arcGenerator(arc),
color: arc.color,
fill: arc.fill ? arc.fill : arc.color,
borderWidth: borderWidth,
borderColor: borderColor(arc),
showTooltip: showTooltip,
hideTooltip: hideTooltip,
tooltipFormat: tooltipFormat,
tooltip: tooltip,
onClick: onClick,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
theme: theme
});
}), enableRadialLabels && React__default.createElement(PieRadialLabels, {
arcs: arcs,
radius: radius,
label: getRadialLabel,
skipAngle: radialLabelsSkipAngle,
linkOffset: radialLabelsLinkOffset,
linkDiagonalLength: radialLabelsLinkDiagonalLength,
linkHorizontalLength: radialLabelsLinkHorizontalLength,
linkStrokeWidth: radialLabelsLinkStrokeWidth,
textXOffset: radialLabelsTextXOffset,
textColor: colors.getInheritedColorGenerator(radialLabelsTextColor, theme),
linkColor: colors.getInheritedColorGenerator(radialLabelsLinkColor, theme),
theme: theme
}), enableSlicesLabels && React__default.createElement(PieSlicesLabels, {
arcs: arcs,
radius: radius,
innerRadius: innerRadius,
theme: theme,
label: getSliceLabel,
skipAngle: slicesLabelsSkipAngle,
textColor: colors.getInheritedColorGenerator(slicesLabelsTextColor, theme)
})), React__default.createElement(PieLegends$1, {
width: width,
height: height,
arcs: arcs,
legends: legends,
theme: theme
}));
});
});
}
}]);
return Pie;
}(React.Component);
var enhance$3 = function enhance(Component) {
return compose(defaultProps(PieSvgDefaultProps), core.withTheme(), core.withDimensions(), withPropsOnChange(['radialLabel'], function (_ref3) {
var radialLabel = _ref3.radialLabel;
return {
getRadialLabel: core.getLabelGenerator(radialLabel)
};
}), withPropsOnChange(['sliceLabel'], function (_ref4) {
var sliceLabel = _ref4.sliceLabel;
return {
getSliceLabel: core.getLabelGenerator(sliceLabel)
};
}), pure)(Component);
};
var Pie$1 = setDisplayName('Pie')(enhance$3(Pie));
theme: theme,
label: getSliceLabel,
skipAngle: slicesLabelsSkipAngle,
textColor: colors.getInheritedColorGenerator(slicesLabelsTextColor, theme)
})), React__default.createElement(PieLegends, {
width: innerWidth,
height: innerHeight,
arcs: arcs,
legends: legends,
theme: theme
}));
});
});
}
Pie.displayName = 'Pie';
Pie.defaultProps = PieSvgDefaultProps;

@@ -876,3 +811,3 @@ var ResponsivePie = function ResponsivePie(props) {

height = _ref.height;
return React__default.createElement(Pie$1, Object.assign({
return React__default.createElement(Pie, Object.assign({
width: width,

@@ -884,6 +819,2 @@ height: height

var enhance$4 = (function (Component) {
return compose(defaultProps(PieDefaultProps), core.withTheme(), core.withDimensions(), pure)(Component);
});
function _arrayWithHoles(arr) {

@@ -1028,3 +959,2 @@ if (Array.isArray(arr)) return arr;

};
var PieTooltip$1 = pure(PieTooltip);

@@ -1060,3 +990,3 @@ var PieCanvasRenderer = function (_Component) {

if (arc) {
showTooltip( React__default.createElement(PieTooltip$1, {
showTooltip( React__default.createElement(PieTooltip, {
data: arc.data,

@@ -1237,47 +1167,34 @@ color: arc.color,

var PieCanvas = function (_Component) {
_inherits(PieCanvas, _Component);
var _super = _createSuper(PieCanvas);
function PieCanvas() {
_classCallCheck(this, PieCanvas);
return _super.apply(this, arguments);
}
_createClass(PieCanvas, [{
key: "render",
value: function render() {
var _this$props = this.props,
data = _this$props.data,
sortByValue = _this$props.sortByValue,
startAngle = _this$props.startAngle,
endAngle = _this$props.endAngle,
fit = _this$props.fit,
padAngle = _this$props.padAngle,
innerRadius = _this$props.innerRadius,
cornerRadius = _this$props.cornerRadius,
width = _this$props.width,
height = _this$props.height,
colors = _this$props.colors,
colorBy = _this$props.colorBy,
topProps = _objectWithoutProperties(_this$props, ["data", "sortByValue", "startAngle", "endAngle", "fit", "padAngle", "innerRadius", "cornerRadius", "width", "height", "colors", "colorBy"]);
return React__default.createElement(PieLayout$1, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (props) {
return React__default.createElement(PieCanvasRenderer, Object.assign({}, topProps, props));
});
}
}]);
return PieCanvas;
}(React.Component);
var PieCanvas$1 = setDisplayName('PieCanvas')(enhance$4(PieCanvas));
function PieCanvas(props) {
var data = props.data,
sortByValue = props.sortByValue,
startAngle = props.startAngle,
endAngle = props.endAngle,
fit = props.fit,
padAngle = props.padAngle,
innerRadius = props.innerRadius,
cornerRadius = props.cornerRadius,
width = props.width,
height = props.height,
colors = props.colors,
colorBy = props.colorBy,
topProps = _objectWithoutProperties(props, ["data", "sortByValue", "startAngle", "endAngle", "fit", "padAngle", "innerRadius", "cornerRadius", "width", "height", "colors", "colorBy"]);
return React__default.createElement(PieLayout, {
width: width,
height: height,
data: data,
sortByValue: sortByValue,
startAngle: startAngle,
endAngle: endAngle,
fit: fit,
padAngle: padAngle,
innerRadius: innerRadius,
cornerRadius: cornerRadius,
colors: colors,
colorBy: colorBy
}, function (props) {
return React__default.createElement(PieCanvasRenderer, Object.assign({}, topProps, props));
});
}
PieCanvas.displayName = 'PieCanvas';

@@ -1288,3 +1205,3 @@ var ResponsivePieCanvas = function ResponsivePieCanvas(props) {

height = _ref.height;
return React__default.createElement(PieCanvas$1, Object.assign({
return React__default.createElement(PieCanvas, Object.assign({
width: width,

@@ -1345,6 +1262,6 @@ height: height

exports.Pie = Pie$1;
exports.PieCanvas = PieCanvas$1;
exports.Pie = Pie;
exports.PieCanvas = PieCanvas;
exports.PieDefaultProps = PieDefaultProps;
exports.PieLayout = PieLayout$1;
exports.PieLayout = PieLayout;
exports.PiePropTypes = PiePropTypes;

@@ -1351,0 +1268,0 @@ exports.PieSvgDefaultProps = PieSvgDefaultProps;

{
"name": "@nivo/pie",
"version": "0.63.0",
"version": "0.63.1",
"license": "MIT",

@@ -27,9 +27,8 @@ "author": {

"@nivo/colors": "0.63.0",
"@nivo/core": "0.63.0",
"@nivo/legends": "0.63.0",
"@nivo/core": "0.63.1",
"@nivo/legends": "0.63.1",
"@nivo/tooltip": "0.63.0",
"d3-shape": "^1.3.5",
"lodash": "^4.17.11",
"react-motion": "^0.5.2",
"recompose": "^0.30.0"
"react-motion": "^0.5.2"
},

@@ -43,3 +42,3 @@ "peerDependencies": {

},
"gitHead": "defc453433d8e6767ba3d612cce0d05c119ec5ed"
"gitHead": "dfa63783e79cb07c8bafbd3a4aea6cabbd0131c3"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc