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.165 to 0.0.167

10

build/shapes/Rect.js

@@ -6,2 +6,5 @@ 'use strict';

});
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;

@@ -22,9 +25,8 @@

return _react2.default.createElement('div', {
style: {
style: _extends({
width: width,
height: height,
background: fill,
style: style
}
background: fill
}, style)
});
}

7

dist/vx-legend.es.js

@@ -144,8 +144,7 @@ import React from 'react';

return React.createElement('div', {
style: {
style: _extends({
width: width,
height: height,
background: fill,
style: style
}
background: fill
}, style)
});

@@ -152,0 +151,0 @@ }

@@ -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,z,a,o,P){"use strict";z=z&&z.hasOwnProperty("default")?z.default:z,a=a&&a.hasOwnProperty("default")?a.default:a,P=P&&P.hasOwnProperty("default")?P.default:P;var A=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},U=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},h=function(e,a){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,a){var r=[],l=!0,t=!1,n=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){t=!0,n=e}finally{try{!l&&o.return&&o.return()}finally{if(t)throw n}}return r}(e,a);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function k(e){var t,n,a=e.children,r=e.flexDirection,l=e.margin,i=e.label,o=U(e,["children","flexDirection","margin","label"]);return z.createElement("div",A({className:"vx-legend-item",style:{display:"flex",alignItems:"center",flexDirection:r,margin:l}},(t=o,n=i,Object.keys(t).reduce(function(e,a){var r,l;return e[a]=(r=t[a],l=n,"function"==typeof r?r(l):r),e},{}))),a)}function H(e){var a=e.label,r=e.margin,l=e.align;return z.createElement("div",{className:"vx-legend-label",style:{justifyContent:l,display:"flex",flex:"1",margin:r}},a)}function w(e){var a=e.fill,r=e.width,l=e.height,t=e.style;return z.createElement("div",{style:{width:r,height:l,background:a,style:t}})}function E(e){var a=e.fill,r=e.width,l=e.height,t=e.style;"string"==typeof r&&(r=0),"string"==typeof l&&(l=0);var n=Math.max(r,l),i=n/2;return z.createElement("svg",{width:n,height:n},z.createElement(o.Group,{top:i,left:i},z.createElement("circle",{r:i,fill:a,style:t})))}function W(e){return e&&e.value?e.value:e}function I(e){var a,r,l,t,n,i,o,s,c,m,u,d,f,p=e.shape,b=void 0===p?w:p,v=e.width,h=e.height,g=e.margin,y=e.label,x=e.fill,T=e.size,F=e.shapeStyle;return z.createElement("div",{className:"vx-legend-shape",style:{display:"flex",width:T?T(A({},y)):v,height:T?T(A({},y)):h,margin:g}},(r=(a={shape:b,label:y,width:v,height:h,fill:x,shapeStyle:F}).shape,l=void 0===r?"rect":r,t=a.fill,n=void 0===t?W:t,i=a.size,o=void 0===i?W:i,s=a.width,c=a.height,m=a.label,u=a.shapeStyle,d=void 0===u?function(e){}:u,f={width:s,height:c,label:m,fill:n(A({},m)),size:o(A({},m)),style:d(A({},m))},"string"==typeof l?"rect"===l?z.createElement(w,f):z.createElement(E,f):z.isValidElement(l)?z.cloneElement(l,f):z.createElement(l,f)))}k.propTypes={flexDirection:a.string,margin:a.string,label:a.object.isRequired},H.propTypes={label:a.string.isRequired,margin:a.string.isRequired},g.propTypes={className:a.string,style:a.object,scale:a.oneOfType([a.func,a.object]).isRequired,shapeWidth:a.oneOfType([a.number,a.string]),shapeHeight:a.oneOfType([a.number,a.string]),shapeMargin:a.string,labelMargin:a.string,itemMargin:a.string,direction:a.string,itemDirection:a.string,fill:a.func,shape:a.oneOfType([a.func,a.string]),labelFormat:a.func,labelTransform:a.func};var _={display:"flex"};function g(e){var a=e.className,r=e.style,l=void 0===r?_:r,t=e.shapeStyle,n=e.scale,i=e.shape,o=e.domain,s=e.fill,c=void 0===s?W:s,m=e.size,u=void 0===m?W:m,d=e.labelFormat,f=void 0===d?W:d,p=e.labelTransform,b=void 0===p?C:p,v=e.shapeWidth,h=void 0===v?15:v,g=e.shapeHeight,y=void 0===g?15:g,x=e.shapeMargin,T=void 0===x?"2px 4px 2px 0":x,F=e.labelAlign,w=void 0===F?"left":F,E=e.labelMargin,D=void 0===E?"0 4px":E,O=e.itemMargin,L=void 0===O?"0":O,q=e.direction,M=void 0===q?"column":q,j=e.itemDirection,R=void 0===j?"row":j,S=U(e,["className","style","shapeStyle","scale","shape","domain","fill","size","labelFormat","labelTransform","shapeWidth","shapeHeight","shapeMargin","labelAlign","labelMargin","itemMargin","direction","itemDirection"]),N=(o=o||n.domain()).map(b({scale:n,labelFormat:f}));return z.createElement("div",{className:P("vx-legend",a),style:A({},l,{flexDirection:M})},N.map(function(e,a){var r=e.text;return z.createElement(k,A({key:"legend-"+e+"-"+a,margin:L,flexDirection:R,label:e},S),z.createElement(I,{shape:i,height:y,width:h,margin:T,label:e,fill:c,size:u,shapeStyle:t}),z.createElement(H,{label:r,margin:D,align:w}))}))}function C(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,t=void 0===l?function(e){return e}:l,n=e.labelTransform,i=e.labelDelimiter,o=void 0===i?"-":i,c=U(e,["scale","domain","labelFormat","labelTransform","labelDelimiter"]);return r=r||a.range(),n=n||(s={labelDelimiter:o}.labelDelimiter,function(e){var i=e.scale,o=e.labelFormat;return function(e,a){var r=i.invertExtent(e),l=h(r,2),t=l[0],n=l[1];return{extent:[t,n],text:o(t,a)+" "+s+" "+o(n,a),value:i(t),datum:e,index:a}}}),z.createElement(g,A({scale:a,domain:r,labelFormat:t,labelTransform:n},c))}function l(e){var a,r,l,t,n,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,m=e.labelFormat,u=void 0===m?function(e){return e}:m,d=e.labelTransform,f=void 0===d?b:d,p=U(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(r=(a={steps:c,scale:i}).steps,l=a.scale.domain(),t=l[0],n=(l[l.length-1]-t)/(r-1),new Array(r).fill(1).reduce(function(e,a,r){return e.push(t+r*n),e},[])),z.createElement(g,A({scale:i,domain:o,labelFormat:u,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 t(e){var a=e.scale,r=e.domain,l=e.labelTransform,t=void 0===l?s:l,n=e.labelFormat,i=void 0===n?W:n,o=U(e,["scale","domain","labelTransform","labelFormat"]);return z.createElement(g,A({scale:a,domain:r,labelFormat:i,labelTransform:t},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 n(e){var a,u,d,f,r=e.scale,l=e.domain,t=e.labelFormat,n=void 0===t?function(e){return e}:t,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=U(e,["scale","domain","labelFormat","labelTransform","labelDelimiter","labelLower","labelUpper"]);return l=l||r.range(),i=i||(u=(a={labelDelimiter:s,labelLower:m,labelUpper:b}).labelDelimiter,d=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=h(r,2),t=l[0],n=l[1],i=" "+u+" ",o=void 0;return 0===t||t||0!==n&&!n?0!==t&&!t||0!==n&&!n?n||0!==t&&!t||(o=t+s.domain()[1],n=t,t=void 0,i=f):o=t:(o=n-1,i=d),{extent:[t,n],text:""+m(c,t,a)+i+m(c,n,a),value:s(o),datum:e,index:a}}}),z.createElement(g,A({scale:r,domain:l,labelFormat:n,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},t.propTypes={scale:a.func.isRequired,domain:a.array,labelTransform:a.func,labelFormat:a.func},n.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=g,e.LegendQuantile=r,e.LegendLinear=l,e.LegendOrdinal=t,e.LegendThreshold=n,e.LegendSize=function(e){var a,r,l,t,n,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,m=e.labelFormat,u=void 0===m?function(e){return e}:m,d=e.labelTransform,f=void 0===d?v:d,p=U(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(r=(a={steps:c,scale:i}).steps,l=a.scale.domain(),t=l[0],n=(l[l.length-1]-t)/(r-1),new Array(r).fill(1).reduce(function(e,a,r){return e.push(t+r*n),e},[])),z.createElement(g,A({scale:i,domain:o,labelFormat:u,labelTransform:f},p))},Object.defineProperty(e,"__esModule",{value:!0})});
!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,z,a,o,P){"use strict";z=z&&z.hasOwnProperty("default")?z.default:z,a=a&&a.hasOwnProperty("default")?a.default:a,P=P&&P.hasOwnProperty("default")?P.default:P;var A=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},U=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},h=function(e,a){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,a){var r=[],l=!0,t=!1,n=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){t=!0,n=e}finally{try{!l&&o.return&&o.return()}finally{if(t)throw n}}return r}(e,a);throw new TypeError("Invalid attempt to destructure non-iterable instance")};function k(e){var t,n,a=e.children,r=e.flexDirection,l=e.margin,i=e.label,o=U(e,["children","flexDirection","margin","label"]);return z.createElement("div",A({className:"vx-legend-item",style:{display:"flex",alignItems:"center",flexDirection:r,margin:l}},(t=o,n=i,Object.keys(t).reduce(function(e,a){var r,l;return e[a]=(r=t[a],l=n,"function"==typeof r?r(l):r),e},{}))),a)}function H(e){var a=e.label,r=e.margin,l=e.align;return z.createElement("div",{className:"vx-legend-label",style:{justifyContent:l,display:"flex",flex:"1",margin:r}},a)}function w(e){var a=e.fill,r=e.width,l=e.height,t=e.style;return z.createElement("div",{style:A({width:r,height:l,background:a},t)})}function E(e){var a=e.fill,r=e.width,l=e.height,t=e.style;"string"==typeof r&&(r=0),"string"==typeof l&&(l=0);var n=Math.max(r,l),i=n/2;return z.createElement("svg",{width:n,height:n},z.createElement(o.Group,{top:i,left:i},z.createElement("circle",{r:i,fill:a,style:t})))}function W(e){return e&&e.value?e.value:e}function I(e){var a,r,l,t,n,i,o,s,c,m,u,d,f,p=e.shape,b=void 0===p?w:p,v=e.width,h=e.height,g=e.margin,y=e.label,x=e.fill,T=e.size,F=e.shapeStyle;return z.createElement("div",{className:"vx-legend-shape",style:{display:"flex",width:T?T(A({},y)):v,height:T?T(A({},y)):h,margin:g}},(r=(a={shape:b,label:y,width:v,height:h,fill:x,shapeStyle:F}).shape,l=void 0===r?"rect":r,t=a.fill,n=void 0===t?W:t,i=a.size,o=void 0===i?W:i,s=a.width,c=a.height,m=a.label,u=a.shapeStyle,d=void 0===u?function(e){}:u,f={width:s,height:c,label:m,fill:n(A({},m)),size:o(A({},m)),style:d(A({},m))},"string"==typeof l?"rect"===l?z.createElement(w,f):z.createElement(E,f):z.isValidElement(l)?z.cloneElement(l,f):z.createElement(l,f)))}k.propTypes={flexDirection:a.string,margin:a.string,label:a.object.isRequired},H.propTypes={label:a.string.isRequired,margin:a.string.isRequired},g.propTypes={className:a.string,style:a.object,scale:a.oneOfType([a.func,a.object]).isRequired,shapeWidth:a.oneOfType([a.number,a.string]),shapeHeight:a.oneOfType([a.number,a.string]),shapeMargin:a.string,labelMargin:a.string,itemMargin:a.string,direction:a.string,itemDirection:a.string,fill:a.func,shape:a.oneOfType([a.func,a.string]),labelFormat:a.func,labelTransform:a.func};var _={display:"flex"};function g(e){var a=e.className,r=e.style,l=void 0===r?_:r,t=e.shapeStyle,n=e.scale,i=e.shape,o=e.domain,s=e.fill,c=void 0===s?W:s,m=e.size,u=void 0===m?W:m,d=e.labelFormat,f=void 0===d?W:d,p=e.labelTransform,b=void 0===p?C:p,v=e.shapeWidth,h=void 0===v?15:v,g=e.shapeHeight,y=void 0===g?15:g,x=e.shapeMargin,T=void 0===x?"2px 4px 2px 0":x,F=e.labelAlign,w=void 0===F?"left":F,E=e.labelMargin,D=void 0===E?"0 4px":E,O=e.itemMargin,L=void 0===O?"0":O,q=e.direction,M=void 0===q?"column":q,j=e.itemDirection,R=void 0===j?"row":j,S=U(e,["className","style","shapeStyle","scale","shape","domain","fill","size","labelFormat","labelTransform","shapeWidth","shapeHeight","shapeMargin","labelAlign","labelMargin","itemMargin","direction","itemDirection"]),N=(o=o||n.domain()).map(b({scale:n,labelFormat:f}));return z.createElement("div",{className:P("vx-legend",a),style:A({},l,{flexDirection:M})},N.map(function(e,a){var r=e.text;return z.createElement(k,A({key:"legend-"+e+"-"+a,margin:L,flexDirection:R,label:e},S),z.createElement(I,{shape:i,height:y,width:h,margin:T,label:e,fill:c,size:u,shapeStyle:t}),z.createElement(H,{label:r,margin:D,align:w}))}))}function C(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,t=void 0===l?function(e){return e}:l,n=e.labelTransform,i=e.labelDelimiter,o=void 0===i?"-":i,c=U(e,["scale","domain","labelFormat","labelTransform","labelDelimiter"]);return r=r||a.range(),n=n||(s={labelDelimiter:o}.labelDelimiter,function(e){var i=e.scale,o=e.labelFormat;return function(e,a){var r=i.invertExtent(e),l=h(r,2),t=l[0],n=l[1];return{extent:[t,n],text:o(t,a)+" "+s+" "+o(n,a),value:i(t),datum:e,index:a}}}),z.createElement(g,A({scale:a,domain:r,labelFormat:t,labelTransform:n},c))}function l(e){var a,r,l,t,n,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,m=e.labelFormat,u=void 0===m?function(e){return e}:m,d=e.labelTransform,f=void 0===d?b:d,p=U(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(r=(a={steps:c,scale:i}).steps,l=a.scale.domain(),t=l[0],n=(l[l.length-1]-t)/(r-1),new Array(r).fill(1).reduce(function(e,a,r){return e.push(t+r*n),e},[])),z.createElement(g,A({scale:i,domain:o,labelFormat:u,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 t(e){var a=e.scale,r=e.domain,l=e.labelTransform,t=void 0===l?s:l,n=e.labelFormat,i=void 0===n?W:n,o=U(e,["scale","domain","labelTransform","labelFormat"]);return z.createElement(g,A({scale:a,domain:r,labelFormat:i,labelTransform:t},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 n(e){var a,u,d,f,r=e.scale,l=e.domain,t=e.labelFormat,n=void 0===t?function(e){return e}:t,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=U(e,["scale","domain","labelFormat","labelTransform","labelDelimiter","labelLower","labelUpper"]);return l=l||r.range(),i=i||(u=(a={labelDelimiter:s,labelLower:m,labelUpper:b}).labelDelimiter,d=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=h(r,2),t=l[0],n=l[1],i=" "+u+" ",o=void 0;return 0===t||t||0!==n&&!n?0!==t&&!t||0!==n&&!n?n||0!==t&&!t||(o=t+s.domain()[1],n=t,t=void 0,i=f):o=t:(o=n-1,i=d),{extent:[t,n],text:""+m(c,t,a)+i+m(c,n,a),value:s(o),datum:e,index:a}}}),z.createElement(g,A({scale:r,domain:l,labelFormat:n,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},t.propTypes={scale:a.func.isRequired,domain:a.array,labelTransform:a.func,labelFormat:a.func},n.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=g,e.LegendQuantile=r,e.LegendLinear=l,e.LegendOrdinal=t,e.LegendThreshold=n,e.LegendSize=function(e){var a,r,l,t,n,i=e.scale,o=e.domain,s=e.steps,c=void 0===s?5:s,m=e.labelFormat,u=void 0===m?function(e){return e}:m,d=e.labelTransform,f=void 0===d?v:d,p=U(e,["scale","domain","steps","labelFormat","labelTransform"]);return o=o||(r=(a={steps:c,scale:i}).steps,l=a.scale.domain(),t=l[0],n=(l[l.length-1]-t)/(r-1),new Array(r).fill(1).reduce(function(e,a,r){return e.push(t+r*n),e},[])),z.createElement(g,A({scale:i,domain:o,labelFormat:u,labelTransform:f},p))},Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "@vx/legend",
"version": "0.0.165",
"version": "0.0.167",
"description": "vx legend",

@@ -5,0 +5,0 @@ "sideEffects": false,

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