Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vx/legend

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vx/legend - npm Package Compare versions

Comparing version 0.0.181 to 0.0.182

83

build/index.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,84 +6,75 @@ Object.defineProperty(exports, "__esModule", {

});
var _Legend = require('./legends/Legend');
Object.defineProperty(exports, 'Legend', {
Object.defineProperty(exports, "Legend", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Legend).default;
return _Legend.default;
}
});
var _Quantile = require('./legends/Quantile');
Object.defineProperty(exports, 'LegendQuantile', {
Object.defineProperty(exports, "LegendQuantile", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Quantile).default;
return _Quantile.default;
}
});
var _Linear = require('./legends/Linear');
Object.defineProperty(exports, 'LegendLinear', {
Object.defineProperty(exports, "LegendLinear", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Linear).default;
return _Linear.default;
}
});
var _Ordinal = require('./legends/Ordinal');
Object.defineProperty(exports, 'LegendOrdinal', {
Object.defineProperty(exports, "LegendOrdinal", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Ordinal).default;
return _Ordinal.default;
}
});
var _Threshold = require('./legends/Threshold');
Object.defineProperty(exports, 'LegendThreshold', {
Object.defineProperty(exports, "LegendThreshold", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Threshold).default;
return _Threshold.default;
}
});
var _Size = require('./legends/Size');
Object.defineProperty(exports, 'LegendSize', {
Object.defineProperty(exports, "LegendSize", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Size).default;
return _Size.default;
}
});
var _LegendItem = require('./legends/LegendItem');
Object.defineProperty(exports, 'LegendItem', {
Object.defineProperty(exports, "LegendItem", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_LegendItem).default;
return _LegendItem.default;
}
});
var _LegendLabel = require('./legends/LegendLabel');
Object.defineProperty(exports, 'LegendLabel', {
Object.defineProperty(exports, "LegendLabel", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_LegendLabel).default;
return _LegendLabel.default;
}
});
var _LegendShape = require('./legends/LegendShape');
Object.defineProperty(exports, 'LegendShape', {
Object.defineProperty(exports, "LegendShape", {
enumerable: true,
get: function get() {
return _interopRequireDefault(_LegendShape).default;
return _LegendShape.default;
}
});
var _Legend = _interopRequireDefault(require("./legends/Legend"));
var _Quantile = _interopRequireDefault(require("./legends/Quantile"));
var _Linear = _interopRequireDefault(require("./legends/Linear"));
var _Ordinal = _interopRequireDefault(require("./legends/Ordinal"));
var _Threshold = _interopRequireDefault(require("./legends/Threshold"));
var _Size = _interopRequireDefault(require("./legends/Size"));
var _LegendItem = _interopRequireDefault(require("./legends/LegendItem"));
var _LegendLabel = _interopRequireDefault(require("./legends/LegendLabel"));
var _LegendShape = _interopRequireDefault(require("./legends/LegendShape"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,62 +6,52 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = Legend;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _classnames = _interopRequireDefault(require("classnames"));
var _classnames = require('classnames');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _classnames2 = _interopRequireDefault(_classnames);
var _LegendItem = _interopRequireDefault(require("./LegendItem"));
var _propTypes = require('prop-types');
var _LegendLabel = _interopRequireDefault(require("./LegendLabel"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _LegendShape = _interopRequireDefault(require("./LegendShape"));
var _LegendItem = require('./LegendItem');
var _valueOrIdentity = _interopRequireDefault(require("../util/valueOrIdentity"));
var _LegendItem2 = _interopRequireDefault(_LegendItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _LegendLabel = require('./LegendLabel');
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _LegendLabel2 = _interopRequireDefault(_LegendLabel);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
var _LegendShape = require('./LegendShape');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _LegendShape2 = _interopRequireDefault(_LegendShape);
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; }
var _valueOrIdentity = require('../util/valueOrIdentity');
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; }
var _valueOrIdentity2 = _interopRequireDefault(_valueOrIdentity);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
Legend.propTypes = {
className: _propTypes2.default.string,
style: _propTypes2.default.any,
domain: _propTypes2.default.array,
scale: _propTypes2.default.oneOfType([_propTypes2.default.func, _propTypes2.default.object]).isRequired,
shapeWidth: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
shapeHeight: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
shapeMargin: _propTypes2.default.any,
labelAlign: _propTypes2.default.string,
labelFlex: _propTypes2.default.string,
labelMargin: _propTypes2.default.string,
itemMargin: _propTypes2.default.string,
direction: _propTypes2.default.string,
itemDirection: _propTypes2.default.string,
fill: _propTypes2.default.any,
size: _propTypes2.default.any,
shape: _propTypes2.default.any,
shapeStyle: _propTypes2.default.any,
labelFormat: _propTypes2.default.func,
labelTransform: _propTypes2.default.func,
children: _propTypes2.default.func
className: _propTypes.default.string,
style: _propTypes.default.any,
domain: _propTypes.default.array,
scale: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]).isRequired,
shapeWidth: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
shapeHeight: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
shapeMargin: _propTypes.default.any,
labelAlign: _propTypes.default.string,
labelFlex: _propTypes.default.string,
labelMargin: _propTypes.default.string,
itemMargin: _propTypes.default.string,
direction: _propTypes.default.string,
itemDirection: _propTypes.default.string,
fill: _propTypes.default.any,
size: _propTypes.default.any,
shape: _propTypes.default.any,
shapeStyle: _propTypes.default.any,
labelFormat: _propTypes.default.func,
labelTransform: _propTypes.default.func,
children: _propTypes.default.func
};
var defaultStyle = {

@@ -74,3 +64,3 @@ display: 'flex'

_ref$style = _ref.style,
style = _ref$style === undefined ? defaultStyle : _ref$style,
style = _ref$style === void 0 ? defaultStyle : _ref$style,
shapeStyle = _ref.shapeStyle,

@@ -81,66 +71,64 @@ scale = _ref.scale,

_ref$fill = _ref.fill,
fill = _ref$fill === undefined ? _valueOrIdentity2.default : _ref$fill,
fill = _ref$fill === void 0 ? _valueOrIdentity.default : _ref$fill,
_ref$size = _ref.size,
size = _ref$size === undefined ? _valueOrIdentity2.default : _ref$size,
size = _ref$size === void 0 ? _valueOrIdentity.default : _ref$size,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? _valueOrIdentity2.default : _ref$labelFormat,
labelFormat = _ref$labelFormat === void 0 ? _valueOrIdentity.default : _ref$labelFormat,
_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform : _ref$labelTransform,
labelTransform = _ref$labelTransform === void 0 ? defaultTransform : _ref$labelTransform,
_ref$shapeWidth = _ref.shapeWidth,
shapeWidth = _ref$shapeWidth === undefined ? 15 : _ref$shapeWidth,
shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth,
_ref$shapeHeight = _ref.shapeHeight,
shapeHeight = _ref$shapeHeight === undefined ? 15 : _ref$shapeHeight,
shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight,
_ref$shapeMargin = _ref.shapeMargin,
shapeMargin = _ref$shapeMargin === undefined ? '2px 4px 2px 0' : _ref$shapeMargin,
shapeMargin = _ref$shapeMargin === void 0 ? '2px 4px 2px 0' : _ref$shapeMargin,
_ref$labelAlign = _ref.labelAlign,
labelAlign = _ref$labelAlign === undefined ? 'left' : _ref$labelAlign,
labelAlign = _ref$labelAlign === void 0 ? 'left' : _ref$labelAlign,
_ref$labelFlex = _ref.labelFlex,
labelFlex = _ref$labelFlex === undefined ? '1' : _ref$labelFlex,
labelFlex = _ref$labelFlex === void 0 ? '1' : _ref$labelFlex,
_ref$labelMargin = _ref.labelMargin,
labelMargin = _ref$labelMargin === undefined ? '0 4px' : _ref$labelMargin,
labelMargin = _ref$labelMargin === void 0 ? '0 4px' : _ref$labelMargin,
_ref$itemMargin = _ref.itemMargin,
itemMargin = _ref$itemMargin === undefined ? '0' : _ref$itemMargin,
itemMargin = _ref$itemMargin === void 0 ? '0' : _ref$itemMargin,
_ref$direction = _ref.direction,
direction = _ref$direction === undefined ? 'column' : _ref$direction,
direction = _ref$direction === void 0 ? 'column' : _ref$direction,
_ref$itemDirection = _ref.itemDirection,
itemDirection = _ref$itemDirection === undefined ? 'row' : _ref$itemDirection,
itemDirection = _ref$itemDirection === void 0 ? 'row' : _ref$itemDirection,
children = _ref.children,
restProps = _objectWithoutProperties(_ref, ['className', 'style', 'shapeStyle', 'scale', 'shape', 'domain', 'fill', 'size', 'labelFormat', 'labelTransform', 'shapeWidth', 'shapeHeight', 'shapeMargin', 'labelAlign', 'labelFlex', 'labelMargin', 'itemMargin', 'direction', 'itemDirection', 'children']);
restProps = _objectWithoutProperties(_ref, ["className", "style", "shapeStyle", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "children"]);
domain = domain || scale.domain();
var labels = domain.map(labelTransform({ scale: scale, labelFormat: labelFormat }));
var labels = domain.map(labelTransform({
scale: scale,
labelFormat: labelFormat
}));
if (children) return children(labels);
return _react2.default.createElement(
'div',
{
className: (0, _classnames2.default)('vx-legend', className),
style: _extends({}, style, {
flexDirection: direction
})
},
labels.map(function (label, i) {
var text = label.text;
return _react2.default.createElement(
_LegendItem2.default,
_extends({
key: 'legend-' + label + '-' + i,
margin: itemMargin,
flexDirection: itemDirection,
label: label
}, restProps),
_react2.default.createElement(_LegendShape2.default, {
shape: shape,
height: shapeHeight,
width: shapeWidth,
margin: shapeMargin,
label: label,
fill: fill,
size: size,
shapeStyle: shapeStyle
}),
_react2.default.createElement(_LegendLabel2.default, { label: text, flex: labelFlex, margin: labelMargin, align: labelAlign })
);
return _react.default.createElement("div", {
className: (0, _classnames.default)('vx-legend', className),
style: _objectSpread({}, style, {
flexDirection: direction
})
);
}, labels.map(function (label, i) {
var text = label.text;
return _react.default.createElement(_LegendItem.default, _extends({
key: "legend-".concat(label, "-").concat(i),
margin: itemMargin,
flexDirection: itemDirection,
label: label
}, restProps), _react.default.createElement(_LegendShape.default, {
shape: shape,
height: shapeHeight,
width: shapeWidth,
margin: shapeMargin,
label: label,
fill: fill,
size: size,
shapeStyle: shapeStyle
}), _react.default.createElement(_LegendLabel.default, {
label: text,
flex: labelFlex,
margin: labelMargin,
align: labelAlign
}));
}));
}

@@ -151,3 +139,2 @@

labelFormat = _ref2.labelFormat;
return function (d, i) {

@@ -157,3 +144,3 @@ return {

index: i,
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d)

@@ -160,0 +147,0 @@ };

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,24 +6,21 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = LegendItem;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
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; }
LegendItem.propTypes = {
flexDirection: _propTypes2.default.string,
alignItems: _propTypes2.default.string,
margin: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
children: _propTypes2.default.any
flexDirection: _propTypes.default.string,
alignItems: _propTypes.default.string,
margin: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
children: _propTypes.default.any
};

@@ -33,25 +30,21 @@

var _ref$flexDirection = _ref.flexDirection,
flexDirection = _ref$flexDirection === undefined ? 'row' : _ref$flexDirection,
flexDirection = _ref$flexDirection === void 0 ? 'row' : _ref$flexDirection,
_ref$alignItems = _ref.alignItems,
alignItems = _ref$alignItems === undefined ? 'center' : _ref$alignItems,
alignItems = _ref$alignItems === void 0 ? 'center' : _ref$alignItems,
_ref$margin = _ref.margin,
margin = _ref$margin === undefined ? '0' : _ref$margin,
margin = _ref$margin === void 0 ? '0' : _ref$margin,
_ref$display = _ref.display,
display = _ref$display === undefined ? 'flex' : _ref$display,
display = _ref$display === void 0 ? 'flex' : _ref$display,
children = _ref.children,
restProps = _objectWithoutProperties(_ref, ['flexDirection', 'alignItems', 'margin', 'display', 'children']);
restProps = _objectWithoutProperties(_ref, ["flexDirection", "alignItems", "margin", "display", "children"]);
return _react2.default.createElement(
'div',
_extends({
className: 'vx-legend-item',
style: {
display: display,
alignItems: alignItems,
flexDirection: flexDirection,
margin: margin
}
}, restProps),
children
);
return _react.default.createElement("div", _extends({
className: "vx-legend-item",
style: {
display: display,
alignItems: alignItems,
flexDirection: flexDirection,
margin: margin
}
}, restProps), children);
}

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -8,18 +8,14 @@ Object.defineProperty(exports, "__esModule", {

var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
LegendLabel.propTypes = {
align: _propTypes2.default.string,
label: _propTypes2.default.any,
flex: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
margin: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
children: _propTypes2.default.any
align: _propTypes.default.string,
label: _propTypes.default.any,
flex: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
margin: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
children: _propTypes.default.any
};

@@ -29,23 +25,18 @@

var _ref$flex = _ref.flex,
flex = _ref$flex === undefined ? '1' : _ref$flex,
flex = _ref$flex === void 0 ? '1' : _ref$flex,
label = _ref.label,
_ref$margin = _ref.margin,
margin = _ref$margin === undefined ? '5px 0' : _ref$margin,
margin = _ref$margin === void 0 ? '5px 0' : _ref$margin,
_ref$align = _ref.align,
align = _ref$align === undefined ? 'left' : _ref$align,
align = _ref$align === void 0 ? 'left' : _ref$align,
children = _ref.children;
return _react2.default.createElement(
'div',
{
className: 'vx-legend-label',
style: {
justifyContent: align,
display: 'flex',
flex: flex,
margin: margin
}
},
children || label
);
return _react.default.createElement("div", {
className: "vx-legend-label",
style: {
justifyContent: align,
display: 'flex',
flex: flex,
margin: margin
}
}, children || label);
}

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,34 +6,27 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = LegendShape;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _Rect = _interopRequireDefault(require("../shapes/Rect"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _renderShape = _interopRequireDefault(require("../util/renderShape"));
var _Rect = require('../shapes/Rect');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Rect2 = _interopRequireDefault(_Rect);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
var _renderShape = require('../util/renderShape');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _renderShape2 = _interopRequireDefault(_renderShape);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
LegendShape.propTypes = {
shape: _propTypes2.default.any,
width: _propTypes2.default.any,
height: _propTypes2.default.any,
margin: _propTypes2.default.any,
label: _propTypes2.default.any,
fill: _propTypes2.default.any,
size: _propTypes2.default.any,
shapeStyle: _propTypes2.default.any
shape: _propTypes.default.any,
width: _propTypes.default.any,
height: _propTypes.default.any,
margin: _propTypes.default.any,
label: _propTypes.default.any,
fill: _propTypes.default.any,
size: _propTypes.default.any,
shapeStyle: _propTypes.default.any
};

@@ -43,3 +36,3 @@

var _ref$shape = _ref.shape,
shape = _ref$shape === undefined ? _Rect2.default : _ref$shape,
shape = _ref$shape === void 0 ? _Rect.default : _ref$shape,
width = _ref.width,

@@ -52,23 +45,18 @@ height = _ref.height,

shapeStyle = _ref.shapeStyle;
return _react2.default.createElement(
'div',
{
className: 'vx-legend-shape',
style: {
display: 'flex',
width: !!size ? size(_extends({}, label)) : width,
height: !!size ? size(_extends({}, label)) : height,
margin: margin
}
},
(0, _renderShape2.default)({
shape: shape,
label: label,
width: width,
height: height,
fill: fill,
shapeStyle: shapeStyle
})
);
return _react.default.createElement("div", {
className: "vx-legend-shape",
style: {
display: 'flex',
width: !!size ? size(_objectSpread({}, label)) : width,
height: !!size ? size(_objectSpread({}, label)) : height,
margin: margin
}
}, (0, _renderShape.default)({
shape: shape,
label: label,
width: width,
height: height,
fill: fill,
shapeStyle: shapeStyle
}));
}

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,29 +6,24 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = LegendLinear;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _Legend = _interopRequireDefault(require("./Legend"));
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Legend = require('./Legend');
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _Legend2 = _interopRequireDefault(_Legend);
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
LegendLinear.propTypes = {
scale: _propTypes2.default.func.isRequired,
domain: _propTypes2.default.array,
steps: _propTypes2.default.number,
labelFormat: _propTypes2.default.func,
labelTransform: _propTypes2.default.func
scale: _propTypes.default.func.isRequired,
domain: _propTypes.default.array,
steps: _propTypes.default.number,
labelFormat: _propTypes.default.func,
labelTransform: _propTypes.default.func
};

@@ -40,13 +35,16 @@

_ref$steps = _ref.steps,
steps = _ref$steps === undefined ? 5 : _ref$steps,
steps = _ref$steps === void 0 ? 5 : _ref$steps,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;
} : _ref$labelFormat,
_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform : _ref$labelTransform,
restProps = _objectWithoutProperties(_ref, ['scale', 'domain', 'steps', 'labelFormat', 'labelTransform']);
labelTransform = _ref$labelTransform === void 0 ? defaultTransform : _ref$labelTransform,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "steps", "labelFormat", "labelTransform"]);
domain = domain || defaultDomain({ steps: steps, scale: scale });
return _react2.default.createElement(_Legend2.default, _extends({
domain = domain || defaultDomain({
steps: steps,
scale: scale
});
return _react.default.createElement(_Legend.default, _extends({
scale: scale,

@@ -62,3 +60,2 @@ domain: domain,

scale = _ref2.scale;
var domain = scale.domain();

@@ -77,6 +74,5 @@ var start = domain[0];

labelFormat = _ref3.labelFormat;
return function (d, i) {
return {
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d)

@@ -83,0 +79,0 @@ };

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,32 +6,25 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = LegendOrdinal;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _Legend = _interopRequireDefault(require("./Legend"));
var _propTypes2 = _interopRequireDefault(_propTypes);
var _valueOrIdentity = _interopRequireDefault(require("../util/valueOrIdentity"));
var _Legend = require('./Legend');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Legend2 = _interopRequireDefault(_Legend);
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _valueOrIdentity = require('../util/valueOrIdentity');
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; }
var _valueOrIdentity2 = _interopRequireDefault(_valueOrIdentity);
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
LegendOrdinal.propTypes = {
scale: _propTypes2.default.func.isRequired,
domain: _propTypes2.default.array,
labelTransform: _propTypes2.default.func,
labelFormat: _propTypes2.default.func
scale: _propTypes.default.func.isRequired,
domain: _propTypes.default.array,
labelTransform: _propTypes.default.func,
labelFormat: _propTypes.default.func
};

@@ -43,8 +36,8 @@

_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform : _ref$labelTransform,
labelTransform = _ref$labelTransform === void 0 ? defaultTransform : _ref$labelTransform,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? _valueOrIdentity2.default : _ref$labelFormat,
restProps = _objectWithoutProperties(_ref, ['scale', 'domain', 'labelTransform', 'labelFormat']);
labelFormat = _ref$labelFormat === void 0 ? _valueOrIdentity.default : _ref$labelFormat,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "labelTransform", "labelFormat"]);
return _react2.default.createElement(_Legend2.default, _extends({
return _react.default.createElement(_Legend.default, _extends({
scale: scale,

@@ -60,3 +53,2 @@ domain: domain,

labelFormat = _ref2.labelFormat;
return function (d, i) {

@@ -66,3 +58,3 @@ return {

index: i,
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d)

@@ -69,0 +61,0 @@ };

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,31 +6,32 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = LegendQuantile;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _react = _interopRequireDefault(require("react"));
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _propTypes = _interopRequireDefault(require("prop-types"));
exports.default = LegendQuantile;
var _Legend = _interopRequireDefault(require("./Legend"));
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _react2 = _interopRequireDefault(_react);
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
var _propTypes = require('prop-types');
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
var _Legend = require('./Legend');
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var _Legend2 = _interopRequireDefault(_Legend);
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
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; }
LegendQuantile.propTypes = {
scale: _propTypes2.default.func.isRequired,
domain: _propTypes2.default.array,
labelFormat: _propTypes2.default.func,
labelTransform: _propTypes2.default.func,
labelDelimiter: _propTypes2.default.string
scale: _propTypes.default.func.isRequired,
domain: _propTypes.default.array,
labelFormat: _propTypes.default.func,
labelTransform: _propTypes.default.func,
labelDelimiter: _propTypes.default.string
};

@@ -42,3 +43,3 @@

_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;

@@ -48,8 +49,10 @@ } : _ref$labelFormat,

_ref$labelDelimiter = _ref.labelDelimiter,
labelDelimiter = _ref$labelDelimiter === undefined ? '-' : _ref$labelDelimiter,
restProps = _objectWithoutProperties(_ref, ['scale', 'domain', 'labelFormat', 'labelTransform', 'labelDelimiter']);
labelDelimiter = _ref$labelDelimiter === void 0 ? '-' : _ref$labelDelimiter,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "labelFormat", "labelTransform", "labelDelimiter"]);
domain = domain || scale.range();
labelTransform = labelTransform || defaultTransform({ labelDelimiter: labelDelimiter });
return _react2.default.createElement(_Legend2.default, _extends({
labelTransform = labelTransform || defaultTransform({
labelDelimiter: labelDelimiter
});
return _react.default.createElement(_Legend.default, _extends({
scale: scale,

@@ -64,7 +67,5 @@ domain: domain,

var labelDelimiter = _ref2.labelDelimiter;
return function (_ref3) {
var scale = _ref3.scale,
labelFormat = _ref3.labelFormat;
return function (d, i) {

@@ -78,3 +79,3 @@ var _scale$invertExtent = scale.invertExtent(d),

extent: [x0, x1],
text: labelFormat(x0, i) + ' ' + labelDelimiter + ' ' + labelFormat(x1, i),
text: "".concat(labelFormat(x0, i), " ").concat(labelDelimiter, " ").concat(labelFormat(x1, i)),
value: scale(x0),

@@ -81,0 +82,0 @@ datum: d,

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,23 +6,18 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = LegendSize;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _Legend = _interopRequireDefault(require("./Legend"));
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Legend = require('./Legend');
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _Legend2 = _interopRequireDefault(_Legend);
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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function LegendSize(_ref) {

@@ -32,13 +27,16 @@ var scale = _ref.scale,

_ref$steps = _ref.steps,
steps = _ref$steps === undefined ? 5 : _ref$steps,
steps = _ref$steps === void 0 ? 5 : _ref$steps,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;
} : _ref$labelFormat,
_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform : _ref$labelTransform,
restProps = _objectWithoutProperties(_ref, ['scale', 'domain', 'steps', 'labelFormat', 'labelTransform']);
labelTransform = _ref$labelTransform === void 0 ? defaultTransform : _ref$labelTransform,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "steps", "labelFormat", "labelTransform"]);
domain = domain || defaultDomain({ steps: steps, scale: scale });
return _react2.default.createElement(_Legend2.default, _extends({
domain = domain || defaultDomain({
steps: steps,
scale: scale
});
return _react.default.createElement(_Legend.default, _extends({
scale: scale,

@@ -54,3 +52,2 @@ domain: domain,

scale = _ref2.scale;
var domain = scale.domain();

@@ -69,6 +66,5 @@ var start = domain[0];

labelFormat = _ref3.labelFormat;
return function (d, i) {
return {
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d),

@@ -75,0 +71,0 @@ datum: d,

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,33 +6,34 @@ Object.defineProperty(exports, "__esModule", {

});
exports.default = LegendThreshold;
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _react = _interopRequireDefault(require("react"));
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _propTypes = _interopRequireDefault(require("prop-types"));
exports.default = LegendThreshold;
var _Legend = _interopRequireDefault(require("./Legend"));
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _react2 = _interopRequireDefault(_react);
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
var _propTypes = require('prop-types');
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
var _Legend = require('./Legend');
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var _Legend2 = _interopRequireDefault(_Legend);
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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 _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
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; }
LegendThreshold.propTypes = {
scale: _propTypes2.default.func.isRequired,
domain: _propTypes2.default.array,
labelTransform: _propTypes2.default.func,
labelFormat: _propTypes2.default.func,
labelDelimiter: _propTypes2.default.string,
labelLower: _propTypes2.default.string,
labelUpper: _propTypes2.default.string
scale: _propTypes.default.func.isRequired,
domain: _propTypes.default.array,
labelTransform: _propTypes.default.func,
labelFormat: _propTypes.default.func,
labelDelimiter: _propTypes.default.string,
labelLower: _propTypes.default.string,
labelUpper: _propTypes.default.string
};

@@ -44,3 +45,3 @@

_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;

@@ -50,8 +51,8 @@ } : _ref$labelFormat,

_ref$labelDelimiter = _ref.labelDelimiter,
labelDelimiter = _ref$labelDelimiter === undefined ? 'to' : _ref$labelDelimiter,
labelDelimiter = _ref$labelDelimiter === void 0 ? 'to' : _ref$labelDelimiter,
_ref$labelLower = _ref.labelLower,
labelLower = _ref$labelLower === undefined ? 'Less than ' : _ref$labelLower,
labelLower = _ref$labelLower === void 0 ? 'Less than ' : _ref$labelLower,
_ref$labelUpper = _ref.labelUpper,
labelUpper = _ref$labelUpper === undefined ? 'More than ' : _ref$labelUpper,
restProps = _objectWithoutProperties(_ref, ['scale', 'domain', 'labelFormat', 'labelTransform', 'labelDelimiter', 'labelLower', 'labelUpper']);
labelUpper = _ref$labelUpper === void 0 ? 'More than ' : _ref$labelUpper,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "labelFormat", "labelTransform", "labelDelimiter", "labelLower", "labelUpper"]);

@@ -64,3 +65,3 @@ domain = domain || scale.range();

});
return _react2.default.createElement(_Legend2.default, _extends({
return _react.default.createElement(_Legend.default, _extends({
scale: scale,

@@ -77,3 +78,2 @@ domain: domain,

labelUpper = _ref2.labelUpper;
return function (_ref3) {

@@ -85,5 +85,7 @@ var scale = _ref3.scale,

var formattedValue = _labelFormat(value, i);
if (formattedValue === 0) return '0';
return formattedValue || '';
}
return function (d, i) {

@@ -95,4 +97,5 @@ var _scale$invertExtent = scale.invertExtent(d),

var delimiter = ' ' + labelDelimiter + ' ';
var value = void 0;
var delimiter = " ".concat(labelDelimiter, " ");
var value;
if (x0 !== 0 && !x0 && (x1 === 0 || !!x1)) {

@@ -112,5 +115,6 @@ // lower threshold

}
return {
extent: [x0, x1],
text: '' + format(labelFormat, x0, i) + delimiter + format(labelFormat, x1, i),
text: "".concat(format(labelFormat, x0, i)).concat(delimiter).concat(format(labelFormat, x1, i)),
value: scale(value),

@@ -117,0 +121,0 @@ datum: d,

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -8,19 +8,15 @@ Object.defineProperty(exports, "__esModule", {

var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var _group = require("@vx/group");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _group = require('@vx/group');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
ShapeCircle.propTypes = {
fill: _propTypes2.default.any,
width: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
height: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
style: _propTypes2.default.object
fill: _propTypes.default.any,
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
height: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
style: _propTypes.default.object
};

@@ -33,3 +29,2 @@

style = _ref.style;
if (typeof width === 'string') width = 0;

@@ -39,11 +34,13 @@ if (typeof height === 'string') height = 0;

var radius = size / 2;
return _react2.default.createElement(
'svg',
{ width: size, height: size },
_react2.default.createElement(
_group.Group,
{ top: radius, left: radius },
_react2.default.createElement('circle', { r: radius, fill: fill, style: style })
)
);
return _react.default.createElement("svg", {
width: size,
height: size
}, _react.default.createElement(_group.Group, {
top: radius,
left: radius
}, _react.default.createElement("circle", {
r: radius,
fill: fill,
style: style
})));
}

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,22 +6,19 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = ShapeRect;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
ShapeRect.propTypes = {
fill: _propTypes2.default.any,
width: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
height: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
style: _propTypes2.default.object
fill: _propTypes.default.any,
width: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
height: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
style: _propTypes.default.object
};

@@ -34,5 +31,4 @@

style = _ref.style;
return _react2.default.createElement('div', {
style: _extends({
return _react.default.createElement("div", {
style: _objectSpread({
width: width,

@@ -39,0 +35,0 @@ height: height,

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,32 +6,25 @@ Object.defineProperty(exports, "__esModule", {

});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
exports.default = renderShape;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _Rect = _interopRequireDefault(require("../shapes/Rect"));
var _Rect = require('../shapes/Rect');
var _Circle = _interopRequireDefault(require("../shapes/Circle"));
var _Rect2 = _interopRequireDefault(_Rect);
var _valueOrIdentity = _interopRequireDefault(require("./valueOrIdentity"));
var _Circle = require('../shapes/Circle');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _Circle2 = _interopRequireDefault(_Circle);
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
var _valueOrIdentity = require('./valueOrIdentity');
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var _valueOrIdentity2 = _interopRequireDefault(_valueOrIdentity);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function renderShape(_ref) {
var _ref$shape = _ref.shape,
shape = _ref$shape === undefined ? 'rect' : _ref$shape,
shape = _ref$shape === void 0 ? 'rect' : _ref$shape,
_ref$fill = _ref.fill,
fill = _ref$fill === undefined ? _valueOrIdentity2.default : _ref$fill,
fill = _ref$fill === void 0 ? _valueOrIdentity.default : _ref$fill,
_ref$size = _ref.size,
size = _ref$size === undefined ? _valueOrIdentity2.default : _ref$size,
size = _ref$size === void 0 ? _valueOrIdentity.default : _ref$size,
width = _ref.width,

@@ -41,6 +34,5 @@ height = _ref.height,

_ref$shapeStyle = _ref.shapeStyle,
shapeStyle = _ref$shapeStyle === undefined ? function (x) {
shapeStyle = _ref$shapeStyle === void 0 ? function (x) {
return undefined;
} : _ref$shapeStyle;
var props = {

@@ -50,16 +42,20 @@ width: width,

label: label,
fill: fill(_extends({}, label)),
size: size(_extends({}, label)),
style: shapeStyle(_extends({}, label))
fill: fill(_objectSpread({}, label)),
size: size(_objectSpread({}, label)),
style: shapeStyle(_objectSpread({}, label))
};
if (typeof shape === 'string') {
if (shape === 'rect') {
return _react2.default.createElement(_Rect2.default, props);
return _react.default.createElement(_Rect.default, props);
}
return _react2.default.createElement(_Circle2.default, props);
return _react.default.createElement(_Circle.default, props);
}
if (_react2.default.isValidElement(shape)) {
return _react2.default.cloneElement(shape, props);
if (_react.default.isValidElement(shape)) {
return _react.default.cloneElement(shape, props);
}
return _react2.default.createElement(shape, props);
return _react.default.createElement(shape, props);
}

@@ -7,2 +7,3 @@ "use strict";

exports.default = valueOrIdentity;
function valueOrIdentity(x) {

@@ -9,0 +10,0 @@ if (x && x.value) return x.value;

@@ -0,70 +1,132 @@

import cx from 'classnames';
import { Group } from '@vx/group';
import React from 'react';
import PropTypes from 'prop-types';
import { Group } from '@vx/group';
import cx from 'classnames';
var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
return obj;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
var ownKeys = Object.keys(source);
if (typeof Object.getOwnPropertySymbols === 'function') {
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
}));
}
ownKeys.forEach(function (key) {
_defineProperty(target, key, source[key]);
});
}
return target;
};
}
var objectWithoutProperties = function (obj, keys) {
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
};
}
var slicedToArray = function () {
function sliceIterator(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
var target = _objectWithoutPropertiesLoose(source, excluded);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"]) _i["return"]();
} finally {
if (_d) throw _e;
}
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 _arr;
}
return function (arr, i) {
if (Array.isArray(arr)) {
return arr;
} else if (Symbol.iterator in Object(arr)) {
return sliceIterator(arr, i);
} else {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
return target;
}
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
};
}();
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
LegendItem.propTypes = {

@@ -76,28 +138,23 @@ flexDirection: PropTypes.string,

};
function LegendItem(_ref) {
var _ref$flexDirection = _ref.flexDirection,
flexDirection = _ref$flexDirection === undefined ? 'row' : _ref$flexDirection,
flexDirection = _ref$flexDirection === void 0 ? 'row' : _ref$flexDirection,
_ref$alignItems = _ref.alignItems,
alignItems = _ref$alignItems === undefined ? 'center' : _ref$alignItems,
alignItems = _ref$alignItems === void 0 ? 'center' : _ref$alignItems,
_ref$margin = _ref.margin,
margin = _ref$margin === undefined ? '0' : _ref$margin,
margin = _ref$margin === void 0 ? '0' : _ref$margin,
_ref$display = _ref.display,
display = _ref$display === undefined ? 'flex' : _ref$display,
display = _ref$display === void 0 ? 'flex' : _ref$display,
children = _ref.children,
restProps = objectWithoutProperties(_ref, ['flexDirection', 'alignItems', 'margin', 'display', 'children']);
restProps = _objectWithoutProperties(_ref, ["flexDirection", "alignItems", "margin", "display", "children"]);
return React.createElement(
'div',
_extends({
className: 'vx-legend-item',
style: {
display: display,
alignItems: alignItems,
flexDirection: flexDirection,
margin: margin
}
}, restProps),
children
);
return React.createElement("div", _extends({
className: "vx-legend-item",
style: {
display: display,
alignItems: alignItems,
flexDirection: flexDirection,
margin: margin
}
}, restProps), children);
}

@@ -112,26 +169,20 @@

};
function LegendLabel(_ref) {
var _ref$flex = _ref.flex,
flex = _ref$flex === undefined ? '1' : _ref$flex,
flex = _ref$flex === void 0 ? '1' : _ref$flex,
label = _ref.label,
_ref$margin = _ref.margin,
margin = _ref$margin === undefined ? '5px 0' : _ref$margin,
margin = _ref$margin === void 0 ? '5px 0' : _ref$margin,
_ref$align = _ref.align,
align = _ref$align === undefined ? 'left' : _ref$align,
align = _ref$align === void 0 ? 'left' : _ref$align,
children = _ref.children;
return React.createElement(
'div',
{
className: 'vx-legend-label',
style: {
justifyContent: align,
display: 'flex',
flex: flex,
margin: margin
}
},
children || label
);
return React.createElement("div", {
className: "vx-legend-label",
style: {
justifyContent: align,
display: 'flex',
flex: flex,
margin: margin
}
}, children || label);
}

@@ -145,3 +196,2 @@

};
function ShapeRect(_ref) {

@@ -152,5 +202,4 @@ var fill = _ref.fill,

style = _ref.style;
return React.createElement('div', {
style: _extends({
return React.createElement("div", {
style: _objectSpread({
width: width,

@@ -169,3 +218,2 @@ height: height,

};
function ShapeCircle(_ref) {

@@ -176,3 +224,2 @@ var fill = _ref.fill,

style = _ref.style;
if (typeof width === 'string') width = 0;

@@ -182,11 +229,13 @@ if (typeof height === 'string') height = 0;

var radius = size / 2;
return React.createElement(
'svg',
{ width: size, height: size },
React.createElement(
Group,
{ top: radius, left: radius },
React.createElement('circle', { r: radius, fill: fill, style: style })
)
);
return React.createElement("svg", {
width: size,
height: size
}, React.createElement(Group, {
top: radius,
left: radius
}, React.createElement("circle", {
r: radius,
fill: fill,
style: style
})));
}

@@ -201,7 +250,7 @@

var _ref$shape = _ref.shape,
shape = _ref$shape === undefined ? 'rect' : _ref$shape,
shape = _ref$shape === void 0 ? 'rect' : _ref$shape,
_ref$fill = _ref.fill,
fill = _ref$fill === undefined ? valueOrIdentity : _ref$fill,
fill = _ref$fill === void 0 ? valueOrIdentity : _ref$fill,
_ref$size = _ref.size,
size = _ref$size === undefined ? valueOrIdentity : _ref$size,
size = _ref$size === void 0 ? valueOrIdentity : _ref$size,
width = _ref.width,

@@ -211,6 +260,5 @@ height = _ref.height,

_ref$shapeStyle = _ref.shapeStyle,
shapeStyle = _ref$shapeStyle === undefined ? function (x) {
shapeStyle = _ref$shapeStyle === void 0 ? function (x) {
return undefined;
} : _ref$shapeStyle;
var props = {

@@ -220,6 +268,7 @@ width: width,

label: label,
fill: fill(_extends({}, label)),
size: size(_extends({}, label)),
style: shapeStyle(_extends({}, label))
fill: fill(_objectSpread({}, label)),
size: size(_objectSpread({}, label)),
style: shapeStyle(_objectSpread({}, label))
};
if (typeof shape === 'string') {

@@ -229,7 +278,10 @@ if (shape === 'rect') {

}
return React.createElement(ShapeCircle, props);
}
if (React.isValidElement(shape)) {
return React.cloneElement(shape, props);
}
return React.createElement(shape, props);

@@ -248,6 +300,5 @@ }

};
function LegendShape(_ref) {
var _ref$shape = _ref.shape,
shape = _ref$shape === undefined ? ShapeRect : _ref$shape,
shape = _ref$shape === void 0 ? ShapeRect : _ref$shape,
width = _ref.width,

@@ -260,23 +311,18 @@ height = _ref.height,

shapeStyle = _ref.shapeStyle;
return React.createElement(
'div',
{
className: 'vx-legend-shape',
style: {
display: 'flex',
width: !!size ? size(_extends({}, label)) : width,
height: !!size ? size(_extends({}, label)) : height,
margin: margin
}
},
renderShape({
shape: shape,
label: label,
width: width,
height: height,
fill: fill,
shapeStyle: shapeStyle
})
);
return React.createElement("div", {
className: "vx-legend-shape",
style: {
display: 'flex',
width: !!size ? size(_objectSpread({}, label)) : width,
height: !!size ? size(_objectSpread({}, label)) : height,
margin: margin
}
}, renderShape({
shape: shape,
label: label,
width: width,
height: height,
fill: fill,
shapeStyle: shapeStyle
}));
}

@@ -306,11 +352,9 @@

};
var defaultStyle = {
display: 'flex'
};
function Legend(_ref) {
var className = _ref.className,
_ref$style = _ref.style,
style = _ref$style === undefined ? defaultStyle : _ref$style,
style = _ref$style === void 0 ? defaultStyle : _ref$style,
shapeStyle = _ref.shapeStyle,

@@ -321,66 +365,64 @@ scale = _ref.scale,

_ref$fill = _ref.fill,
fill = _ref$fill === undefined ? valueOrIdentity : _ref$fill,
fill = _ref$fill === void 0 ? valueOrIdentity : _ref$fill,
_ref$size = _ref.size,
size = _ref$size === undefined ? valueOrIdentity : _ref$size,
size = _ref$size === void 0 ? valueOrIdentity : _ref$size,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? valueOrIdentity : _ref$labelFormat,
labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat,
_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform : _ref$labelTransform,
labelTransform = _ref$labelTransform === void 0 ? defaultTransform : _ref$labelTransform,
_ref$shapeWidth = _ref.shapeWidth,
shapeWidth = _ref$shapeWidth === undefined ? 15 : _ref$shapeWidth,
shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth,
_ref$shapeHeight = _ref.shapeHeight,
shapeHeight = _ref$shapeHeight === undefined ? 15 : _ref$shapeHeight,
shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight,
_ref$shapeMargin = _ref.shapeMargin,
shapeMargin = _ref$shapeMargin === undefined ? '2px 4px 2px 0' : _ref$shapeMargin,
shapeMargin = _ref$shapeMargin === void 0 ? '2px 4px 2px 0' : _ref$shapeMargin,
_ref$labelAlign = _ref.labelAlign,
labelAlign = _ref$labelAlign === undefined ? 'left' : _ref$labelAlign,
labelAlign = _ref$labelAlign === void 0 ? 'left' : _ref$labelAlign,
_ref$labelFlex = _ref.labelFlex,
labelFlex = _ref$labelFlex === undefined ? '1' : _ref$labelFlex,
labelFlex = _ref$labelFlex === void 0 ? '1' : _ref$labelFlex,
_ref$labelMargin = _ref.labelMargin,
labelMargin = _ref$labelMargin === undefined ? '0 4px' : _ref$labelMargin,
labelMargin = _ref$labelMargin === void 0 ? '0 4px' : _ref$labelMargin,
_ref$itemMargin = _ref.itemMargin,
itemMargin = _ref$itemMargin === undefined ? '0' : _ref$itemMargin,
itemMargin = _ref$itemMargin === void 0 ? '0' : _ref$itemMargin,
_ref$direction = _ref.direction,
direction = _ref$direction === undefined ? 'column' : _ref$direction,
direction = _ref$direction === void 0 ? 'column' : _ref$direction,
_ref$itemDirection = _ref.itemDirection,
itemDirection = _ref$itemDirection === undefined ? 'row' : _ref$itemDirection,
itemDirection = _ref$itemDirection === void 0 ? 'row' : _ref$itemDirection,
children = _ref.children,
restProps = objectWithoutProperties(_ref, ['className', 'style', 'shapeStyle', 'scale', 'shape', 'domain', 'fill', 'size', 'labelFormat', 'labelTransform', 'shapeWidth', 'shapeHeight', 'shapeMargin', 'labelAlign', 'labelFlex', 'labelMargin', 'itemMargin', 'direction', 'itemDirection', 'children']);
restProps = _objectWithoutProperties(_ref, ["className", "style", "shapeStyle", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "children"]);
domain = domain || scale.domain();
var labels = domain.map(labelTransform({ scale: scale, labelFormat: labelFormat }));
var labels = domain.map(labelTransform({
scale: scale,
labelFormat: labelFormat
}));
if (children) return children(labels);
return React.createElement(
'div',
{
className: cx('vx-legend', className),
style: _extends({}, style, {
flexDirection: direction
})
},
labels.map(function (label, i) {
var text = label.text;
return React.createElement(
LegendItem,
_extends({
key: 'legend-' + label + '-' + i,
margin: itemMargin,
flexDirection: itemDirection,
label: label
}, restProps),
React.createElement(LegendShape, {
shape: shape,
height: shapeHeight,
width: shapeWidth,
margin: shapeMargin,
label: label,
fill: fill,
size: size,
shapeStyle: shapeStyle
}),
React.createElement(LegendLabel, { label: text, flex: labelFlex, margin: labelMargin, align: labelAlign })
);
return React.createElement("div", {
className: cx('vx-legend', className),
style: _objectSpread({}, style, {
flexDirection: direction
})
);
}, labels.map(function (label, i) {
var text = label.text;
return React.createElement(LegendItem, _extends({
key: "legend-".concat(label, "-").concat(i),
margin: itemMargin,
flexDirection: itemDirection,
label: label
}, restProps), React.createElement(LegendShape, {
shape: shape,
height: shapeHeight,
width: shapeWidth,
margin: shapeMargin,
label: label,
fill: fill,
size: size,
shapeStyle: shapeStyle
}), React.createElement(LegendLabel, {
label: text,
flex: labelFlex,
margin: labelMargin,
align: labelAlign
}));
}));
}

@@ -391,3 +433,2 @@

labelFormat = _ref2.labelFormat;
return function (d, i) {

@@ -397,3 +438,3 @@ return {

index: i,
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d)

@@ -411,3 +452,2 @@ };

};
function LegendQuantile(_ref) {

@@ -417,3 +457,3 @@ var scale = _ref.scale,

_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;

@@ -423,7 +463,9 @@ } : _ref$labelFormat,

_ref$labelDelimiter = _ref.labelDelimiter,
labelDelimiter = _ref$labelDelimiter === undefined ? '-' : _ref$labelDelimiter,
restProps = objectWithoutProperties(_ref, ['scale', 'domain', 'labelFormat', 'labelTransform', 'labelDelimiter']);
labelDelimiter = _ref$labelDelimiter === void 0 ? '-' : _ref$labelDelimiter,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "labelFormat", "labelTransform", "labelDelimiter"]);
domain = domain || scale.range();
labelTransform = labelTransform || defaultTransform$1({ labelDelimiter: labelDelimiter });
labelTransform = labelTransform || defaultTransform$1({
labelDelimiter: labelDelimiter
});
return React.createElement(Legend, _extends({

@@ -439,10 +481,8 @@ scale: scale,

var labelDelimiter = _ref2.labelDelimiter;
return function (_ref3) {
var scale = _ref3.scale,
labelFormat = _ref3.labelFormat;
return function (d, i) {
var _scale$invertExtent = scale.invertExtent(d),
_scale$invertExtent2 = slicedToArray(_scale$invertExtent, 2),
_scale$invertExtent2 = _slicedToArray(_scale$invertExtent, 2),
x0 = _scale$invertExtent2[0],

@@ -453,3 +493,3 @@ x1 = _scale$invertExtent2[1];

extent: [x0, x1],
text: labelFormat(x0, i) + ' ' + labelDelimiter + ' ' + labelFormat(x1, i),
text: "".concat(labelFormat(x0, i), " ").concat(labelDelimiter, " ").concat(labelFormat(x1, i)),
value: scale(x0),

@@ -470,3 +510,2 @@ datum: d,

};
function LegendLinear(_ref) {

@@ -476,12 +515,15 @@ var scale = _ref.scale,

_ref$steps = _ref.steps,
steps = _ref$steps === undefined ? 5 : _ref$steps,
steps = _ref$steps === void 0 ? 5 : _ref$steps,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;
} : _ref$labelFormat,
_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform$2 : _ref$labelTransform,
restProps = objectWithoutProperties(_ref, ['scale', 'domain', 'steps', 'labelFormat', 'labelTransform']);
labelTransform = _ref$labelTransform === void 0 ? defaultTransform$2 : _ref$labelTransform,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "steps", "labelFormat", "labelTransform"]);
domain = domain || defaultDomain({ steps: steps, scale: scale });
domain = domain || defaultDomain({
steps: steps,
scale: scale
});
return React.createElement(Legend, _extends({

@@ -498,3 +540,2 @@ scale: scale,

scale = _ref2.scale;
var domain = scale.domain();

@@ -513,6 +554,5 @@ var start = domain[0];

labelFormat = _ref3.labelFormat;
return function (d, i) {
return {
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d)

@@ -529,3 +569,2 @@ };

};
function LegendOrdinal(_ref) {

@@ -535,6 +574,6 @@ var scale = _ref.scale,

_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform$3 : _ref$labelTransform,
labelTransform = _ref$labelTransform === void 0 ? defaultTransform$3 : _ref$labelTransform,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? valueOrIdentity : _ref$labelFormat,
restProps = objectWithoutProperties(_ref, ['scale', 'domain', 'labelTransform', 'labelFormat']);
labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "labelTransform", "labelFormat"]);

@@ -552,3 +591,2 @@ return React.createElement(Legend, _extends({

labelFormat = _ref2.labelFormat;
return function (d, i) {

@@ -558,3 +596,3 @@ return {

index: i,
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d)

@@ -574,3 +612,2 @@ };

};
function LegendThreshold(_ref) {

@@ -580,3 +617,3 @@ var scale = _ref.scale,

_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;

@@ -586,8 +623,8 @@ } : _ref$labelFormat,

_ref$labelDelimiter = _ref.labelDelimiter,
labelDelimiter = _ref$labelDelimiter === undefined ? 'to' : _ref$labelDelimiter,
labelDelimiter = _ref$labelDelimiter === void 0 ? 'to' : _ref$labelDelimiter,
_ref$labelLower = _ref.labelLower,
labelLower = _ref$labelLower === undefined ? 'Less than ' : _ref$labelLower,
labelLower = _ref$labelLower === void 0 ? 'Less than ' : _ref$labelLower,
_ref$labelUpper = _ref.labelUpper,
labelUpper = _ref$labelUpper === undefined ? 'More than ' : _ref$labelUpper,
restProps = objectWithoutProperties(_ref, ['scale', 'domain', 'labelFormat', 'labelTransform', 'labelDelimiter', 'labelLower', 'labelUpper']);
labelUpper = _ref$labelUpper === void 0 ? 'More than ' : _ref$labelUpper,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "labelFormat", "labelTransform", "labelDelimiter", "labelLower", "labelUpper"]);

@@ -612,3 +649,2 @@ domain = domain || scale.range();

labelUpper = _ref2.labelUpper;
return function (_ref3) {

@@ -620,13 +656,16 @@ var scale = _ref3.scale,

var formattedValue = _labelFormat(value, i);
if (formattedValue === 0) return '0';
return formattedValue || '';
}
return function (d, i) {
var _scale$invertExtent = scale.invertExtent(d),
_scale$invertExtent2 = slicedToArray(_scale$invertExtent, 2),
_scale$invertExtent2 = _slicedToArray(_scale$invertExtent, 2),
x0 = _scale$invertExtent2[0],
x1 = _scale$invertExtent2[1];
var delimiter = ' ' + labelDelimiter + ' ';
var value = void 0;
var delimiter = " ".concat(labelDelimiter, " ");
var value;
if (x0 !== 0 && !x0 && (x1 === 0 || !!x1)) {

@@ -646,5 +685,6 @@ // lower threshold

}
return {
extent: [x0, x1],
text: '' + format(labelFormat, x0, i) + delimiter + format(labelFormat, x1, i),
text: "".concat(format(labelFormat, x0, i)).concat(delimiter).concat(format(labelFormat, x1, i)),
value: scale(value),

@@ -662,12 +702,15 @@ datum: d,

_ref$steps = _ref.steps,
steps = _ref$steps === undefined ? 5 : _ref$steps,
steps = _ref$steps === void 0 ? 5 : _ref$steps,
_ref$labelFormat = _ref.labelFormat,
labelFormat = _ref$labelFormat === undefined ? function (x) {
labelFormat = _ref$labelFormat === void 0 ? function (x) {
return x;
} : _ref$labelFormat,
_ref$labelTransform = _ref.labelTransform,
labelTransform = _ref$labelTransform === undefined ? defaultTransform$5 : _ref$labelTransform,
restProps = objectWithoutProperties(_ref, ['scale', 'domain', 'steps', 'labelFormat', 'labelTransform']);
labelTransform = _ref$labelTransform === void 0 ? defaultTransform$5 : _ref$labelTransform,
restProps = _objectWithoutProperties(_ref, ["scale", "domain", "steps", "labelFormat", "labelTransform"]);
domain = domain || defaultDomain$1({ steps: steps, scale: scale });
domain = domain || defaultDomain$1({
steps: steps,
scale: scale
});
return React.createElement(Legend, _extends({

@@ -684,3 +727,2 @@ scale: scale,

scale = _ref2.scale;
var domain = scale.domain();

@@ -699,6 +741,5 @@ var start = domain[0];

labelFormat = _ref3.labelFormat;
return function (d, i) {
return {
text: '' + labelFormat(d, i),
text: "".concat(labelFormat(d, i)),
value: scale(d),

@@ -705,0 +746,0 @@ datum: d,

@@ -1,1 +0,1 @@

!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("react"),require("prop-types"),require("@vx/group"),require("classnames")):"function"==typeof define&&define.amd?define(["exports","react","prop-types","@vx/group","classnames"],a):a(e.vx=e.vx||{},e.React,e.PropTypes,e.vx,e.classNames)}(this,function(e,R,a,o,U){"use strict";R=R&&R.hasOwnProperty("default")?R.default:R,a=a&&a.hasOwnProperty("default")?a.default:a,U=U&&U.hasOwnProperty("default")?U.default:U;var H=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var l in r)Object.prototype.hasOwnProperty.call(r,l)&&(e[l]=r[l])}return e},W=function(e,a){var r={};for(var l in e)0<=a.indexOf(l)||Object.prototype.hasOwnProperty.call(e,l)&&(r[l]=e[l]);return r},y=function(e,a){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,a){var r=[],l=!0,n=!1,t=void 0;try{for(var i,o=e[Symbol.iterator]();!(l=(i=o.next()).done)&&(r.push(i.value),!a||r.length!==a);l=!0);}catch(e){n=!0,t=e}finally{try{!l&&o.return&&o.return()}finally{if(n)throw t}}return r}(e,a);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function k(e){var a=e.flexDirection,r=void 0===a?"row":a,l=e.alignItems,n=void 0===l?"center":l,t=e.margin,i=void 0===t?"0":t,o=e.display,s=void 0===o?"flex":o,c=e.children,m=W(e,["flexDirection","alignItems","margin","display","children"]);return R.createElement("div",H({className:"vx-legend-item",style:{display:s,alignItems:n,flexDirection:r,margin:i}},m),c)}function _(e){var a=e.flex,r=void 0===a?"1":a,l=e.label,n=e.margin,t=void 0===n?"5px 0":n,i=e.align,o=void 0===i?"left":i,s=e.children;return R.createElement("div",{className:"vx-legend-label",style:{justifyContent:o,display:"flex",flex:r,margin:t}},s||l)}function w(e){var a=e.fill,r=e.width,l=e.height,n=e.style;return R.createElement("div",{style:H({width:r,height:l,background:a},n)})}function E(e){var a=e.fill,r=e.width,l=e.height,n=e.style;"string"==typeof r&&(r=0),"string"==typeof l&&(l=0);var t=Math.max(r,l),i=t/2;return R.createElement("svg",{width:t,height:t},R.createElement(o.Group,{top:i,left:i},R.createElement("circle",{r:i,fill:a,style:n})))}function C(e){return e&&e.value?e.value:e}function G(e){var a,r,l,n,t,i,o,s,c,m,d,u,f,p=e.shape,b=void 0===p?w:p,v=e.width,y=e.height,h=e.margin,g=e.label,x=e.fill,T=e.size,F=e.shapeStyle;return R.createElement("div",{className:"vx-legend-shape",style:{display:"flex",width:T?T(H({},g)):v,height:T?T(H({},g)):y,margin:h}},(r=(a={shape:b,label:g,width:v,height:y,fill:x,shapeStyle:F}).shape,l=void 0===r?"rect":r,n=a.fill,t=void 0===n?C:n,i=a.size,o=void 0===i?C:i,s=a.width,c=a.height,m=a.label,d=a.shapeStyle,u=void 0===d?function(e){}:d,f={width:s,height:c,label:m,fill:t(H({},m)),size:o(H({},m)),style:u(H({},m))},"string"==typeof l?"rect"===l?R.createElement(w,f):R.createElement(E,f):R.isValidElement(l)?R.cloneElement(l,f):R.createElement(l,f)))}k.propTypes={flexDirection:a.string,alignItems:a.string,margin:a.oneOfType([a.string,a.number]),children:a.any},_.propTypes={align:a.string,label:a.any,flex:a.oneOfType([a.string,a.number]),margin:a.oneOfType([a.string,a.number]),children:a.any},w.propTypes={fill:a.any,width:a.oneOfType([a.number,a.string]),height:a.oneOfType([a.number,a.string]),style:a.object},E.propTypes={fill:a.any,width:a.oneOfType([a.number,a.string]),height:a.oneOfType([a.number,a.string]),style:a.object},G.propTypes={shape:a.any,width:a.any,height:a.any,margin:a.any,label:a.any,fill:a.any,size:a.any,shapeStyle:a.any},h.propTypes={className:a.string,style:a.any,domain:a.array,scale:a.oneOfType([a.func,a.object]).isRequired,shapeWidth:a.oneOfType([a.number,a.string]),shapeHeight:a.oneOfType([a.number,a.string]),shapeMargin:a.any,labelAlign:a.string,labelFlex:a.string,labelMargin:a.string,itemMargin:a.string,direction:a.string,itemDirection:a.string,fill:a.any,size:a.any,shape:a.any,shapeStyle:a.any,labelFormat:a.func,labelTransform:a.func,children:a.func};var Q={display:"flex"};function h(e){var a=e.className,r=e.style,l=void 0===r?Q:r,n=e.shapeStyle,t=e.scale,i=e.shape,o=e.domain,s=e.fill,c=void 0===s?C:s,m=e.size,d=void 0===m?C:m,u=e.labelFormat,f=void 0===u?C:u,p=e.labelTransform,b=void 0===p?V:p,v=e.shapeWidth,y=void 0===v?15:v,h=e.shapeHeight,g=void 0===h?15:h,x=e.shapeMargin,T=void 0===x?"2px 4px 2px 0":x,F=e.labelAlign,w=void 0===F?"left":F,E=e.labelFlex,O=void 0===E?"1":E,D=e.labelMargin,L=void 0===D?"0 4px":D,M=e.itemMargin,S=void 0===M?"0":M,j=e.direction,q=void 0===j?"column":j,z=e.itemDirection,N=void 0===z?"row":z,A=e.children,P=W(e,["className","style","shapeStyle","scale","shape","domain","fill","size","labelFormat","labelTransform","shapeWidth","shapeHeight","shapeMargin","labelAlign","labelFlex","labelMargin","itemMargin","direction","itemDirection","children"]),I=(o=o||t.domain()).map(b({scale:t,labelFormat:f}));return A?A(I):R.createElement("div",{className:U("vx-legend",a),style:H({},l,{flexDirection:q})},I.map(function(e,a){var r=e.text;return R.createElement(k,H({key:"legend-"+e+"-"+a,margin:S,flexDirection:N,label:e},P),R.createElement(G,{shape:i,height:g,width:y,margin:T,label:e,fill:c,size:d,shapeStyle:n}),R.createElement(_,{label:r,flex:O,margin:L,align:w}))}))}function V(e){var r=e.scale,l=e.labelFormat;return function(e,a){return{datum:e,index:a,text:""+l(e,a),value:r(e)}}}function r(e){var s,a=e.scale,r=e.domain,l=e.labelFormat,n=void 0===l?function(e){return e}:l,t=e.labelTransform,i=e.labelDelimiter,o=void 0===i?"-":i,c=W(e,["scale","domain","labelFormat","labelTransform","labelDelimiter"]);return r=r||a.range(),t=t||(s={labelDelimiter:o}.labelDelimiter,function(e){var i=e.scale,o=e.labelFormat;return function(e,a){var r=i.invertExtent(e),l=y(r,2),n=l[0],t=l[1];return{extent:[n,t],text:o(n,a)+" "+s+" "+o(t,a),value:i(n),datum:e,index:a}}}),R.createElement(h,H({scale:a,domain:r,labelFormat:n,labelTransform:t},c))}function l(e){var a,r,l,n,t,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,m=e.labelFormat,d=void 0===m?function(e){return e}:m,u=e.labelTransform,f=void 0===u?b:u,p=W(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(r=(a={steps:c,scale:i}).steps,l=a.scale.domain(),n=l[0],t=(l[l.length-1]-n)/(r-1),new Array(r).fill(1).reduce(function(e,a,r){return e.push(n+r*t),e},[])),R.createElement(h,H({scale:i,domain:o,labelFormat:d,labelTransform:f},p))}function b(e){var r=e.scale,l=e.labelFormat;return function(e,a){return{text:""+l(e,a),value:r(e)}}}function n(e){var a=e.scale,r=e.domain,l=e.labelTransform,n=void 0===l?s:l,t=e.labelFormat,i=void 0===t?C:t,o=W(e,["scale","domain","labelTransform","labelFormat"]);return R.createElement(h,H({scale:a,domain:r,labelFormat:i,labelTransform:n},o))}function s(e){var r=e.scale,l=e.labelFormat;return function(e,a){return{datum:e,index:a,text:""+l(e,a),value:r(e)}}}function t(e){var a,d,u,f,r=e.scale,l=e.domain,n=e.labelFormat,t=void 0===n?function(e){return e}:n,i=e.labelTransform,o=e.labelDelimiter,s=void 0===o?"to":o,c=e.labelLower,m=void 0===c?"Less than ":c,p=e.labelUpper,b=void 0===p?"More than ":p,v=W(e,["scale","domain","labelFormat","labelTransform","labelDelimiter","labelLower","labelUpper"]);return l=l||r.range(),i=i||(d=(a={labelDelimiter:s,labelLower:m,labelUpper:b}).labelDelimiter,u=a.labelLower,f=a.labelUpper,function(e){var s=e.scale,c=e.labelFormat;function m(e,a,r){var l=e(a,r);return 0===l?"0":l||""}return function(e,a){var r=s.invertExtent(e),l=y(r,2),n=l[0],t=l[1],i=" "+d+" ",o=void 0;return 0===n||n||0!==t&&!t?0!==n&&!n||0!==t&&!t?t||0!==n&&!n||(o=n+s.domain()[1],t=n,n=void 0,i=f):o=n:(o=t-1,i=u),{extent:[n,t],text:""+m(c,n,a)+i+m(c,t,a),value:s(o),datum:e,index:a}}}),R.createElement(h,H({scale:r,domain:l,labelFormat:t,labelTransform:i},v))}function v(e){var r=e.scale,l=e.labelFormat;return function(e,a){return{text:""+l(e,a),value:r(e),datum:e,index:a}}}r.propTypes={scale:a.func.isRequired,domain:a.array,labelFormat:a.func,labelTransform:a.func,labelDelimiter:a.string},l.propTypes={scale:a.func.isRequired,domain:a.array,steps:a.number,labelFormat:a.func,labelTransform:a.func},n.propTypes={scale:a.func.isRequired,domain:a.array,labelTransform:a.func,labelFormat:a.func},t.propTypes={scale:a.func.isRequired,domain:a.array,labelTransform:a.func,labelFormat:a.func,labelDelimiter:a.string,labelLower:a.string,labelUpper:a.string},e.Legend=h,e.LegendQuantile=r,e.LegendLinear=l,e.LegendOrdinal=n,e.LegendThreshold=t,e.LegendSize=function(e){var a,r,l,n,t,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,m=e.labelFormat,d=void 0===m?function(e){return e}:m,u=e.labelTransform,f=void 0===u?v:u,p=W(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(r=(a={steps:c,scale:i}).steps,l=a.scale.domain(),n=l[0],t=(l[l.length-1]-n)/(r-1),new Array(r).fill(1).reduce(function(e,a,r){return e.push(n+r*t),e},[])),R.createElement(h,H({scale:i,domain:o,labelFormat:d,labelTransform:f},p))},e.LegendItem=k,e.LegendLabel=_,e.LegendShape=G,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?a(exports,require("classnames"),require("@vx/group"),require("react"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","classnames","@vx/group","react","prop-types"],a):a(e.vx=e.vx||{},e.classNames,e.vx,e.React,e.PropTypes)}(this,function(e,R,o,U,a){"use strict";function k(){return(k=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function H(t){for(var e=1;e<arguments.length;e++){var l=null!=arguments[e]?arguments[e]:{},a=Object.keys(l);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(l).filter(function(e){return Object.getOwnPropertyDescriptor(l,e).enumerable}))),a.forEach(function(e){var a,n,r;a=t,r=l[n=e],n in a?Object.defineProperty(a,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):a[n]=r})}return t}function W(e,a){if(null==e)return{};var n,r,t=function(e,a){if(null==e)return{};var n,r,t={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],0<=a.indexOf(n)||(t[n]=e[n]);return t}(e,a);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],0<=a.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function g(e,a){return function(e){if(Array.isArray(e))return e}(e)||function(e,a){var n=[],r=!0,t=!1,l=void 0;try{for(var i,o=e[Symbol.iterator]();!(r=(i=o.next()).done)&&(n.push(i.value),!a||n.length!==a);r=!0);}catch(e){t=!0,l=e}finally{try{r||null==o.return||o.return()}finally{if(t)throw l}}return n}(e,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function _(e){var a=e.flexDirection,n=void 0===a?"row":a,r=e.alignItems,t=void 0===r?"center":r,l=e.margin,i=void 0===l?"0":l,o=e.display,s=void 0===o?"flex":o,c=e.children,u=W(e,["flexDirection","alignItems","margin","display","children"]);return U.createElement("div",k({className:"vx-legend-item",style:{display:s,alignItems:t,flexDirection:n,margin:i}},u),c)}function C(e){var a=e.flex,n=void 0===a?"1":a,r=e.label,t=e.margin,l=void 0===t?"5px 0":t,i=e.align,o=void 0===i?"left":i,s=e.children;return U.createElement("div",{className:"vx-legend-label",style:{justifyContent:o,display:"flex",flex:n,margin:l}},s||r)}function O(e){var a=e.fill,n=e.width,r=e.height,t=e.style;return U.createElement("div",{style:H({width:n,height:r,background:a},t)})}function F(e){var a=e.fill,n=e.width,r=e.height,t=e.style;"string"==typeof n&&(n=0),"string"==typeof r&&(r=0);var l=Math.max(n,r),i=l/2;return U.createElement("svg",{width:l,height:l},U.createElement(o.Group,{top:i,left:i},U.createElement("circle",{r:i,fill:a,style:t})))}function G(e){return e&&e.value?e.value:e}function Q(e){var a,n,r,t,l,i,o,s,c,u,m,f,d,p=e.shape,b=void 0===p?O:p,y=e.width,g=e.height,h=e.margin,v=e.label,x=e.fill,T=e.size,w=e.shapeStyle;return U.createElement("div",{className:"vx-legend-shape",style:{display:"flex",width:T?T(H({},v)):y,height:T?T(H({},v)):g,margin:h}},(n=(a={shape:b,label:v,width:y,height:g,fill:x,shapeStyle:w}).shape,r=void 0===n?"rect":n,t=a.fill,l=void 0===t?G:t,i=a.size,o=void 0===i?G:i,s=a.width,c=a.height,u=a.label,m=a.shapeStyle,f=void 0===m?function(e){}:m,d={width:s,height:c,label:u,fill:l(H({},u)),size:o(H({},u)),style:f(H({},u))},"string"==typeof r?"rect"===r?U.createElement(O,d):U.createElement(F,d):U.isValidElement(r)?U.cloneElement(r,d):U.createElement(r,d)))}R=R&&R.hasOwnProperty("default")?R.default:R,U=U&&U.hasOwnProperty("default")?U.default:U,a=a&&a.hasOwnProperty("default")?a.default:a,_.propTypes={flexDirection:a.string,alignItems:a.string,margin:a.oneOfType([a.string,a.number]),children:a.any},C.propTypes={align:a.string,label:a.any,flex:a.oneOfType([a.string,a.number]),margin:a.oneOfType([a.string,a.number]),children:a.any},O.propTypes={fill:a.any,width:a.oneOfType([a.number,a.string]),height:a.oneOfType([a.number,a.string]),style:a.object},F.propTypes={fill:a.any,width:a.oneOfType([a.number,a.string]),height:a.oneOfType([a.number,a.string]),style:a.object},Q.propTypes={shape:a.any,width:a.any,height:a.any,margin:a.any,label:a.any,fill:a.any,size:a.any,shapeStyle:a.any},h.propTypes={className:a.string,style:a.any,domain:a.array,scale:a.oneOfType([a.func,a.object]).isRequired,shapeWidth:a.oneOfType([a.number,a.string]),shapeHeight:a.oneOfType([a.number,a.string]),shapeMargin:a.any,labelAlign:a.string,labelFlex:a.string,labelMargin:a.string,itemMargin:a.string,direction:a.string,itemDirection:a.string,fill:a.any,size:a.any,shape:a.any,shapeStyle:a.any,labelFormat:a.func,labelTransform:a.func,children:a.func};var V={display:"flex"};function h(e){var a=e.className,n=e.style,r=void 0===n?V:n,t=e.shapeStyle,l=e.scale,i=e.shape,o=e.domain,s=e.fill,c=void 0===s?G:s,u=e.size,m=void 0===u?G:u,f=e.labelFormat,d=void 0===f?G:f,p=e.labelTransform,b=void 0===p?B:p,y=e.shapeWidth,g=void 0===y?15:y,h=e.shapeHeight,v=void 0===h?15:h,x=e.shapeMargin,T=void 0===x?"2px 4px 2px 0":x,w=e.labelAlign,O=void 0===w?"left":w,F=e.labelFlex,E=void 0===F?"1":F,D=e.labelMargin,j=void 0===D?"0 4px":D,L=e.itemMargin,S=void 0===L?"0":L,M=e.direction,P=void 0===M?"column":M,q=e.itemDirection,z=void 0===q?"row":q,N=e.children,A=W(e,["className","style","shapeStyle","scale","shape","domain","fill","size","labelFormat","labelTransform","shapeWidth","shapeHeight","shapeMargin","labelAlign","labelFlex","labelMargin","itemMargin","direction","itemDirection","children"]),I=(o=o||l.domain()).map(b({scale:l,labelFormat:d}));return N?N(I):U.createElement("div",{className:R("vx-legend",a),style:H({},r,{flexDirection:P})},I.map(function(e,a){var n=e.text;return U.createElement(_,k({key:"legend-".concat(e,"-").concat(a),margin:S,flexDirection:z,label:e},A),U.createElement(Q,{shape:i,height:v,width:g,margin:T,label:e,fill:c,size:m,shapeStyle:t}),U.createElement(C,{label:n,flex:E,margin:j,align:O}))}))}function B(e){var n=e.scale,r=e.labelFormat;return function(e,a){return{datum:e,index:a,text:"".concat(r(e,a)),value:n(e)}}}function n(e){var s,a=e.scale,n=e.domain,r=e.labelFormat,t=void 0===r?function(e){return e}:r,l=e.labelTransform,i=e.labelDelimiter,o=void 0===i?"-":i,c=W(e,["scale","domain","labelFormat","labelTransform","labelDelimiter"]);return n=n||a.range(),l=l||(s={labelDelimiter:o}.labelDelimiter,function(e){var i=e.scale,o=e.labelFormat;return function(e,a){var n=i.invertExtent(e),r=g(n,2),t=r[0],l=r[1];return{extent:[t,l],text:"".concat(o(t,a)," ").concat(s," ").concat(o(l,a)),value:i(t),datum:e,index:a}}}),U.createElement(h,k({scale:a,domain:n,labelFormat:t,labelTransform:l},c))}function r(e){var a,n,r,t,l,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,u=e.labelFormat,m=void 0===u?function(e){return e}:u,f=e.labelTransform,d=void 0===f?b:f,p=W(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(n=(a={steps:c,scale:i}).steps,r=a.scale.domain(),t=r[0],l=(r[r.length-1]-t)/(n-1),new Array(n).fill(1).reduce(function(e,a,n){return e.push(t+n*l),e},[])),U.createElement(h,k({scale:i,domain:o,labelFormat:m,labelTransform:d},p))}function b(e){var n=e.scale,r=e.labelFormat;return function(e,a){return{text:"".concat(r(e,a)),value:n(e)}}}function t(e){var a=e.scale,n=e.domain,r=e.labelTransform,t=void 0===r?s:r,l=e.labelFormat,i=void 0===l?G:l,o=W(e,["scale","domain","labelTransform","labelFormat"]);return U.createElement(h,k({scale:a,domain:n,labelFormat:i,labelTransform:t},o))}function s(e){var n=e.scale,r=e.labelFormat;return function(e,a){return{datum:e,index:a,text:"".concat(r(e,a)),value:n(e)}}}function l(e){var a,m,f,d,n=e.scale,r=e.domain,t=e.labelFormat,l=void 0===t?function(e){return e}:t,i=e.labelTransform,o=e.labelDelimiter,s=void 0===o?"to":o,c=e.labelLower,u=void 0===c?"Less than ":c,p=e.labelUpper,b=void 0===p?"More than ":p,y=W(e,["scale","domain","labelFormat","labelTransform","labelDelimiter","labelLower","labelUpper"]);return r=r||n.range(),i=i||(m=(a={labelDelimiter:s,labelLower:u,labelUpper:b}).labelDelimiter,f=a.labelLower,d=a.labelUpper,function(e){var s=e.scale,c=e.labelFormat;function u(e,a,n){var r=e(a,n);return 0===r?"0":r||""}return function(e,a){var n,r=s.invertExtent(e),t=g(r,2),l=t[0],i=t[1],o=" ".concat(m," ");return 0===l||l||0!==i&&!i?0!==l&&!l||0!==i&&!i?i||0!==l&&!l||(n=l+s.domain()[1],i=l,l=void 0,o=d):n=l:(n=i-1,o=f),{extent:[l,i],text:"".concat(u(c,l,a)).concat(o).concat(u(c,i,a)),value:s(n),datum:e,index:a}}}),U.createElement(h,k({scale:n,domain:r,labelFormat:l,labelTransform:i},y))}function y(e){var n=e.scale,r=e.labelFormat;return function(e,a){return{text:"".concat(r(e,a)),value:n(e),datum:e,index:a}}}n.propTypes={scale:a.func.isRequired,domain:a.array,labelFormat:a.func,labelTransform:a.func,labelDelimiter:a.string},r.propTypes={scale:a.func.isRequired,domain:a.array,steps:a.number,labelFormat:a.func,labelTransform:a.func},t.propTypes={scale:a.func.isRequired,domain:a.array,labelTransform:a.func,labelFormat:a.func},l.propTypes={scale:a.func.isRequired,domain:a.array,labelTransform:a.func,labelFormat:a.func,labelDelimiter:a.string,labelLower:a.string,labelUpper:a.string},e.Legend=h,e.LegendQuantile=n,e.LegendLinear=r,e.LegendOrdinal=t,e.LegendThreshold=l,e.LegendSize=function(e){var a,n,r,t,l,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,u=e.labelFormat,m=void 0===u?function(e){return e}:u,f=e.labelTransform,d=void 0===f?y:f,p=W(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(n=(a={steps:c,scale:i}).steps,r=a.scale.domain(),t=r[0],l=(r[r.length-1]-t)/(n-1),new Array(n).fill(1).reduce(function(e,a,n){return e.push(t+n*l),e},[])),U.createElement(h,k({scale:i,domain:o,labelFormat:m,labelTransform:d},p))},e.LegendItem=_,e.LegendLabel=C,e.LegendShape=Q,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@vx/legend",
"version": "0.0.181",
"version": "0.0.182",
"description": "vx legend",

@@ -15,3 +15,3 @@ "sideEffects": false,

"build:dist": "rm -rf dist && mkdir dist && rollup -c",
"build:babel": "rm -rf build && mkdir build && babel src --out-dir build --ignore node_modules/ --presets stage-0,react,env",
"build:babel": "rm -rf build && mkdir build && babel src --out-dir build --ignore node_modules/ --presets @babel/preset-react,@babel/preset-env",
"prepublish": "npm run build",

@@ -38,9 +38,25 @@ "test": "jest"

"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-jest": "^21.2.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"enzyme": "^3.1.0",

@@ -54,4 +70,4 @@ "enzyme-adapter-react-16": "^1.0.2",

"react-test-renderer": "^16.0.0",
"rollup": "^0.59.4",
"rollup-plugin-babel": "^3.0.4",
"rollup": "^0.67.4",
"rollup-plugin-babel": "^4.0.1",
"rollup-plugin-commonjs": "^9.1.3",

@@ -69,3 +85,3 @@ "rollup-plugin-node-resolve": "^3.3.0",

"dependencies": {
"@vx/group": "0.0.170",
"@vx/group": "0.0.182",
"classnames": "^2.2.5",

@@ -72,0 +88,0 @@ "prop-types": "^15.5.10"

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