@nivo/legends
Advanced tools
Comparing version 0.86.0 to 0.87.0
@@ -1,2 +0,2 @@ | ||
"use strict";var t=require("react/jsx-runtime"),e=require("d3-scale"),i=require("@nivo/core"),n=require("@nivo/colors"),o=require("react"),r=require("prop-types");function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=l(o),s=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("circle",{r:o/2,cx:i+o/2,cy:n+o/2,fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})},c=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+.8*o+" "+o/2+"\n L"+o/2+" "+o+"\n L"+.2*o+" "+o/2+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})},d=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("rect",{x:i,y:n,fill:r,opacity:a,strokeWidth:c,stroke:g,width:o,height:o,style:{pointerEvents:"none"}})},g=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+o+" "+o+"\n L0 "+o+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})};function h(){return h=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},h.apply(this,arguments)}var u={length:200,thickness:16,direction:"row",tickPosition:"after",tickSize:4,tickSpacing:3,tickOverlap:!1,tickFormat:function(t){return""+t},titleAlign:"start",titleOffset:4},m={top:0,right:0,bottom:0,left:0},f=function(t){var e,i=t.direction,n=t.itemsSpacing,o=t.padding,r=t.itemCount,l=t.itemWidth,a=t.itemHeight;if("number"!=typeof o&&("object"!=typeof(e=o)||Array.isArray(e)||null===e))throw new Error("Invalid property padding, must be one of: number, object");var s="number"==typeof o?{top:o,right:o,bottom:o,left:o}:h({},m,o),c=s.left+s.right,d=s.top+s.bottom,g=l+c,u=a+d,f=(r-1)*n;return"row"===i?g=l*r+f+c:"column"===i&&(u=a*r+f+d),{width:g,height:u,padding:s}},p=function(t){var e=t.anchor,i=t.translateX,n=t.translateY,o=t.containerWidth,r=t.containerHeight,l=t.width,a=t.height,s=i,c=n;switch(e){case"top":s+=(o-l)/2;break;case"top-right":s+=o-l;break;case"right":s+=o-l,c+=(r-a)/2;break;case"bottom-right":s+=o-l,c+=r-a;break;case"bottom":s+=(o-l)/2,c+=r-a;break;case"bottom-left":c+=r-a;break;case"left":c+=(r-a)/2;break;case"center":s+=(o-l)/2,c+=(r-a)/2}return{x:s,y:c}},v=function(t){var e,i,n,o,r,l,a=t.direction,s=t.justify,c=t.symbolSize,d=t.symbolSpacing,g=t.width,h=t.height;switch(a){case"left-to-right":e=0,i=(h-c)/2,o=h/2,l="central",s?(n=g,r="end"):(n=c+d,r="start");break;case"right-to-left":e=g-c,i=(h-c)/2,o=h/2,l="central",s?(n=0,r="start"):(n=g-c-d,r="end");break;case"top-to-bottom":e=(g-c)/2,i=0,n=g/2,r="middle",s?(o=h,l="alphabetic"):(o=c+d,l="text-before-edge");break;case"bottom-to-top":e=(g-c)/2,i=h-c,n=g/2,r="middle",s?(o=0,l="text-before-edge"):(o=h-c-d,l="alphabetic")}return{symbolX:e,symbolY:i,labelX:n,labelY:o,labelAnchor:r,labelAlignment:l}},x=function(t){var o,r=t.scale,l=t.ticks,a=t.length,s=void 0===a?u.length:a,c=t.thickness,d=void 0===c?u.thickness:c,g=t.direction,h=void 0===g?u.direction:g,m=t.tickPosition,f=void 0===m?u.tickPosition:m,p=t.tickSize,v=void 0===p?u.tickSize:p,x=t.tickSpacing,y=void 0===x?u.tickSpacing:x,b=t.tickOverlap,k=void 0===b?u.tickOverlap:b,S=t.tickFormat,C=void 0===S?u.tickFormat:S,A=t.title,j=t.titleAlign,O=void 0===j?u.titleAlign:j,W=t.titleOffset,z=void 0===W?u.titleOffset:W,B="column"===h?[].concat(r.domain()).reverse():r.domain(),w=e.scaleLinear().domain(B);2===B.length?w.range([0,s]):3===B.length&&w.range([0,s/2,s]),o="thresholds"in r?[B[0]].concat(r.thresholds(),[B[1]]):Array.isArray(l)?l:r.ticks(l);var X,Y,L,H,T,E,q=n.computeContinuousColorScaleColorStops(r,32),M=i.getValueFormatter(C),F=[],P=0,R=0;if("row"===h){var D,V,G;X=s,Y=d,R=1;var I;T=0,L="start"===O?0:"middle"===O?s/2:s,"before"===f?(D=-v,V=k?d:0,G=-v-y,I="alphabetic",H=d+z,E="hanging"):(D=k?0:d,G=(V=d+v)+y,I="hanging",H=-z,E="alphabetic"),o.forEach((function(t){var e=w(t);F.push({x1:e,y1:D,x2:e,y2:V,text:M(t),textX:e,textY:G,textHorizontalAlign:"middle",textVerticalAlign:I})}))}else{var N,Q,_,J;X=d,Y=s,P=1;T=-90,H="start"===O?s:"middle"===O?s/2:0,"before"===f?(Q=k?d:0,_=(N=-v)-y,J="end",L=d+z,E="hanging"):(N=k?0:d,_=(Q=d+v)+y,J="start",L=-z,E="alphabetic"),o.forEach((function(t){var e=w(t);F.push({x1:N,y1:e,x2:Q,y2:e,text:M(t),textX:_,textY:e,textHorizontalAlign:J,textVerticalAlign:"central"})}))}return{width:X,height:Y,gradientX1:0,gradientY1:P,gradientX2:R,gradientY2:0,colorStops:q,ticks:F,titleText:A,titleX:L,titleY:H,titleRotation:T,titleHorizontalAlign:O,titleVerticalAlign:E}},y=function(e){var n=e.scale,r=e.ticks,l=e.length,a=void 0===l?u.length:l,s=e.thickness,c=void 0===s?u.thickness:s,d=e.direction,g=void 0===d?u.direction:d,m=e.tickPosition,f=void 0===m?u.tickPosition:m,p=e.tickSize,v=void 0===p?u.tickSize:p,y=e.tickSpacing,b=void 0===y?u.tickSpacing:y,k=e.tickOverlap,S=void 0===k?u.tickOverlap:k,C=e.tickFormat,A=void 0===C?u.tickFormat:C,j=e.title,O=e.titleAlign,W=void 0===O?u.titleAlign:O,z=e.titleOffset,B=x({scale:n,ticks:r,length:a,thickness:c,direction:g,tickPosition:f,tickSize:v,tickSpacing:b,tickOverlap:S,tickFormat:A,title:j,titleAlign:W,titleOffset:void 0===z?u.titleOffset:z}),w=B.width,X=B.height,Y=B.gradientX1,L=B.gradientY1,H=B.gradientX2,T=B.gradientY2,E=B.ticks,q=B.colorStops,M=B.titleText,F=B.titleX,P=B.titleY,R=B.titleRotation,D=B.titleVerticalAlign,V=B.titleHorizontalAlign,G=i.useTheme(),I="ContinuousColorsLegendSvgGradient."+g+"."+q.map((function(t){return t.offset})).join("_");return t.jsxs("g",{children:[t.jsx("defs",{children:t.jsx("linearGradient",{id:I,x1:Y,y1:L,x2:H,y2:T,children:q.map((function(e){return t.jsx("stop",h({},e))}))})}),M&&t.jsx("text",{transform:"translate("+F+", "+P+") rotate("+R+")",textAnchor:V,dominantBaseline:D,style:G.legends.title.text,children:M}),t.jsx("rect",{width:w,height:X,fill:"url(#"+I}),E.map((function(e,i){return t.jsxs(o.Fragment,{children:[t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:G.legends.ticks.line}),t.jsx("text",{x:e.textX,y:e.textY,textAnchor:e.textHorizontalAlign,dominantBaseline:e.textVerticalAlign,style:G.legends.ticks.text,children:e.text})]},i)}))]})},b=["containerWidth","containerHeight","anchor","translateX","translateY","length","thickness","direction"],k={circle:s,diamond:c,square:d,triangle:g},S=function(e){var n,r,l,s,c,d,g,u,m,f,p,x=e.x,y=e.y,b=e.width,S=e.height,C=e.data,A=e.direction,j=void 0===A?"left-to-right":A,O=e.justify,W=void 0!==O&&O,z=e.textColor,B=e.background,w=void 0===B?"transparent":B,X=e.opacity,Y=void 0===X?1:X,L=e.symbolShape,H=void 0===L?"square":L,T=e.symbolSize,E=void 0===T?16:T,q=e.symbolSpacing,M=void 0===q?8:q,F=e.symbolBorderWidth,P=void 0===F?0:F,R=e.symbolBorderColor,D=void 0===R?"transparent":R,V=e.onClick,G=e.onMouseEnter,I=e.onMouseLeave,N=e.toggleSerie,Q=e.effects,_=o.useState({}),J=_[0],K=_[1],U=i.useTheme(),Z=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"===t.on})).reduce((function(t,e){return h({},t,e.style)}),{});K(e)}null==G||G(C,t)}),[G,C,Q]),$=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"!==t.on})).reduce((function(t,e){return h({},t,e.style)}),{});K(e)}null==I||I(C,t)}),[I,C,Q]),tt=v({direction:j,justify:W,symbolSize:null!=(n=J.symbolSize)?n:E,symbolSpacing:M,width:b,height:S}),et=tt.symbolX,it=tt.symbolY,nt=tt.labelX,ot=tt.labelY,rt=tt.labelAnchor,lt=tt.labelAlignment,at=[V,G,I,N].some((function(t){return void 0!==t})),st="function"==typeof H?H:k[H];return t.jsxs("g",{transform:"translate("+x+","+y+")",style:{opacity:null!=(r=J.itemOpacity)?r:Y},children:[t.jsx("rect",{width:b,height:S,fill:null!=(l=J.itemBackground)?l:w,style:{cursor:at?"pointer":"auto"},onClick:function(t){null==V||V(C,t),null==N||N(C.id)},onMouseEnter:Z,onMouseLeave:$}),a.createElement(st,h({id:C.id,x:et,y:it,size:null!=(s=J.symbolSize)?s:E,fill:null!=(c=null!=(d=C.fill)?d:C.color)?c:"black",borderWidth:null!=(g=J.symbolBorderWidth)?g:P,borderColor:null!=(u=J.symbolBorderColor)?u:D},C.hidden?U.legends.hidden.symbol:void 0)),t.jsx("text",{textAnchor:rt,style:h({},U.legends.text,{fill:null!=(m=null!=(f=null!=(p=J.itemTextColor)?p:z)?f:U.legends.text.fill)?m:"black",dominantBaseline:lt,pointerEvents:"none",userSelect:"none"},C.hidden?U.legends.hidden.text:void 0),x:nt,y:ot,children:C.label})]})},C=function(e){var i=e.data,n=e.x,o=e.y,r=e.direction,l=e.padding,a=void 0===l?0:l,s=e.justify,c=e.effects,d=e.itemWidth,g=e.itemHeight,h=e.itemDirection,u=void 0===h?"left-to-right":h,m=e.itemsSpacing,p=void 0===m?0:m,v=e.itemTextColor,x=e.itemBackground,y=void 0===x?"transparent":x,b=e.itemOpacity,k=void 0===b?1:b,C=e.symbolShape,A=e.symbolSize,j=e.symbolSpacing,O=e.symbolBorderWidth,W=e.symbolBorderColor,z=e.onClick,B=e.onMouseEnter,w=e.onMouseLeave,X=e.toggleSerie,Y=f({itemCount:i.length,itemWidth:d,itemHeight:g,itemsSpacing:p,direction:r,padding:a}).padding,L="row"===r?d+p:0,H="column"===r?g+p:0;return t.jsx("g",{transform:"translate("+n+","+o+")",children:i.map((function(e,i){return t.jsx(S,{data:e,x:i*L+Y.left,y:i*H+Y.top,width:d,height:g,direction:u,justify:s,effects:c,textColor:v,background:y,opacity:k,symbolShape:C,symbolSize:A,symbolSpacing:j,symbolBorderWidth:O,symbolBorderColor:W,onClick:z,onMouseEnter:B,onMouseLeave:w,toggleSerie:X},i)}))})},A={start:"left",middle:"center",end:"right"},j={data:r.arrayOf(r.object),anchor:r.oneOf(["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left","center"]).isRequired,translateX:r.number,translateY:r.number,direction:r.oneOf(["row","column"]).isRequired,itemsSpacing:r.number,itemWidth:r.number.isRequired,itemHeight:r.number.isRequired,itemDirection:r.oneOf(["left-to-right","right-to-left","top-to-bottom","bottom-to-top"]),itemTextColor:r.string,itemBackground:r.string,itemOpacity:r.number,symbolShape:r.oneOfType([r.oneOf(["circle","diamond","square","triangle"]),r.func]),symbolSize:r.number,symbolSpacing:r.number,symbolBorderWidth:r.number,symbolBorderColor:r.string,onClick:r.func,onMouseEnter:r.func,onMouseLeave:r.func,effects:r.arrayOf(r.shape({on:r.oneOfType([r.oneOf(["hover"])]).isRequired,style:r.shape({itemTextColor:r.string,itemBackground:r.string,itemOpacity:r.number,symbolSize:r.number,symbolBorderWidth:r.number,symbolBorderColor:r.string}).isRequired}))};exports.AnchoredContinuousColorsLegendSvg=function(e){var i,n,o=e.containerWidth,r=e.containerHeight,l=e.anchor,a=e.translateX,s=void 0===a?0:a,c=e.translateY,d=void 0===c?0:c,g=e.length,m=void 0===g?u.length:g,f=e.thickness,v=void 0===f?u.thickness:f,x=e.direction,k=void 0===x?u.direction:x,S=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(e,b);"row"===k?(i=m,n=v):(i=v,n=m);var C=p({anchor:l,translateX:s,translateY:d,containerWidth:o,containerHeight:r,width:i,height:n}),A=C.x,j=C.y;return t.jsx("g",{transform:"translate("+A+", "+j+")",children:t.jsx(y,h({length:m,thickness:v,direction:k},S))})},exports.BoxLegendSvg=function(e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,m=e.itemsSpacing,v=void 0===m?0:m,x=e.itemWidth,y=e.itemHeight,b=e.itemDirection,k=e.itemTextColor,S=e.itemBackground,A=e.itemOpacity,j=e.symbolShape,O=e.symbolSize,W=e.symbolSpacing,z=e.symbolBorderWidth,B=e.symbolBorderColor,w=e.onClick,X=e.onMouseEnter,Y=e.onMouseLeave,L=e.toggleSerie,H=e.effects,T=f({itemCount:i.length,itemsSpacing:v,itemWidth:x,itemHeight:y,direction:d,padding:h}),E=T.width,q=T.height,M=p({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:E,height:q}),F=M.x,P=M.y;return t.jsx(C,{data:i,x:F,y:P,direction:d,padding:h,justify:u,effects:H,itemsSpacing:v,itemWidth:x,itemHeight:y,itemDirection:b,itemTextColor:k,itemBackground:S,itemOpacity:A,symbolShape:j,symbolSize:O,symbolSpacing:W,symbolBorderWidth:z,symbolBorderColor:B,onClick:w,onMouseEnter:X,onMouseLeave:Y,toggleSerie:"boolean"==typeof L?void 0:L})},exports.ContinuousColorsLegendSvg=y,exports.LegendPropShape=j,exports.LegendSvg=C,exports.LegendSvgItem=S,exports.SymbolCircle=s,exports.SymbolDiamond=c,exports.SymbolSquare=d,exports.SymbolTriangle=g,exports.computeContinuousColorsLegend=x,exports.computeDimensions=f,exports.computeItemLayout=v,exports.computePositionFromAnchor=p,exports.continuousColorsLegendDefaults=u,exports.renderContinuousColorLegendToCanvas=function(t,e){var n=e.containerWidth,o=e.containerHeight,r=e.anchor,l=e.translateX,a=void 0===l?0:l,s=e.translateY,c=void 0===s?0:s,d=e.scale,g=e.length,h=void 0===g?u.length:g,m=e.thickness,f=void 0===m?u.thickness:m,v=e.direction,y=void 0===v?u.direction:v,b=e.ticks,k=e.tickPosition,S=void 0===k?u.tickPosition:k,C=e.tickSize,A=void 0===C?u.tickSize:C,j=e.tickSpacing,O=void 0===j?u.tickSpacing:j,W=e.tickOverlap,z=void 0===W?u.tickOverlap:W,B=e.tickFormat,w=void 0===B?u.tickFormat:B,X=e.title,Y=e.titleAlign,L=void 0===Y?u.titleAlign:Y,H=e.titleOffset,T=void 0===H?u.titleOffset:H,E=e.theme,q=x({scale:d,ticks:b,length:h,thickness:f,direction:y,tickPosition:S,tickSize:A,tickSpacing:O,tickOverlap:z,tickFormat:w,title:X,titleAlign:L,titleOffset:T}),M=q.width,F=q.height,P=q.gradientX1,R=q.gradientY1,D=q.gradientX2,V=q.gradientY2,G=q.colorStops,I=q.ticks,N=q.titleText,Q=q.titleX,_=q.titleY,J=q.titleRotation,K=q.titleVerticalAlign,U=q.titleHorizontalAlign,Z=p({anchor:r,translateX:a,translateY:c,containerWidth:n,containerHeight:o,width:M,height:F}),$=Z.x,tt=Z.y,et={font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline};t.save(),t.translate($,tt);var it=t.createLinearGradient(P*M,R*F,D*M,V*F);G.forEach((function(t){it.addColorStop(t.offset,t.stopColor)})),t.fillStyle=it,t.fillRect(0,0,M,F),t.font=(E.legends.ticks.text.fontWeight?E.legends.ticks.text.fontWeight+" ":"")+E.legends.ticks.text.fontSize+"px "+E.legends.ticks.text.fontFamily,I.forEach((function(e){var i;(null!=(i=E.legends.ticks.line.strokeWidth)?i:0)>0&&(t.lineWidth=Number(E.axis.ticks.line.strokeWidth),E.axis.ticks.line.stroke&&(t.strokeStyle=E.axis.ticks.line.stroke),t.lineCap="square",t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),E.legends.ticks.text.fill&&(t.fillStyle=E.legends.ticks.text.fill),t.textAlign="middle"===e.textHorizontalAlign?"center":e.textHorizontalAlign,t.textBaseline="central"===e.textVerticalAlign?"middle":e.textVerticalAlign,t.fillText(e.text,e.textX,e.textY)})),N&&(t.save(),t.translate(Q,_),t.rotate(i.degreesToRadians(J)),t.font=(E.legends.title.text.fontWeight?E.legends.title.text.fontWeight+" ":"")+E.legends.title.text.fontSize+"px "+E.legends.title.text.fontFamily,E.legends.title.text.fill&&(t.fillStyle=E.legends.title.text.fill),t.textAlign="middle"===U?"center":U,t.textBaseline=K,t.fillText(N,0,0),t.restore()),t.restore(),t.font=et.font,t.textAlign=et.textAlign,t.textBaseline=et.textBaseline},exports.renderLegendToCanvas=function(t,e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,m=void 0!==u&&u,x=e.itemsSpacing,y=void 0===x?0:x,b=e.itemWidth,k=e.itemHeight,S=e.itemDirection,C=void 0===S?"left-to-right":S,j=e.itemTextColor,O=e.symbolSize,W=void 0===O?16:O,z=e.symbolSpacing,B=void 0===z?8:z,w=e.theme,X=f({itemCount:i.length,itemWidth:b,itemHeight:k,itemsSpacing:y,direction:d,padding:h}),Y=X.width,L=X.height,H=X.padding,T=p({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:Y,height:L}),E=T.x,q=T.y,M="row"===d?b+y:0,F="column"===d?k+y:0;t.save(),t.translate(E,q),t.font=w.legends.text.fontSize+"px "+(w.legends.text.fontFamily||"sans-serif"),i.forEach((function(e,i){var n,o,r=i*M+H.left,l=i*F+H.top,a=v({direction:C,justify:m,symbolSize:W,symbolSpacing:B,width:b,height:k}),s=a.symbolX,c=a.symbolY,d=a.labelX,g=a.labelY,h=a.labelAnchor,u=a.labelAlignment;t.fillStyle=null!=(n=e.color)?n:"black",t.fillRect(r+s,l+c,W,W),t.textAlign=A[h],"central"===u&&(t.textBaseline="middle"),t.fillStyle=null!=(o=null!=j?j:w.legends.text.fill)?o:"black",t.fillText(String(e.label),r+d,l+g)})),t.restore()},exports.useQuantizeColorScaleLegendData=function(t){var e=t.scale,i=t.domain,n=t.reverse,r=void 0!==n&&n,l=t.valueFormat,a=void 0===l?function(t){return t}:l,s=t.separator,c=void 0===s?" - ":s;return o.useMemo((function(){var t=(null!=i?i:e.range()).map((function(t,i){var n=e.invertExtent(t),o=n[0],r=n[1];return{id:t,index:i,extent:[o,r],label:""+a(o)+c+a(r),value:e(o),color:t}}));return r&&t.reverse(),t}),[i,e,r,c,a])}; | ||
"use strict";var t=require("react/jsx-runtime"),e=require("d3-scale"),i=require("@nivo/core"),n=require("@nivo/colors"),o=require("react");function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var l=r(o),a=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("circle",{r:o/2,cx:i+o/2,cy:n+o/2,fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})},s=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+.8*o+" "+o/2+"\n L"+o/2+" "+o+"\n L"+.2*o+" "+o/2+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})},c=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("rect",{x:i,y:n,fill:r,opacity:a,strokeWidth:c,stroke:g,width:o,height:o,style:{pointerEvents:"none"}})},d=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+o+" "+o+"\n L0 "+o+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})};function g(){return g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},g.apply(this,arguments)}var h={length:200,thickness:16,direction:"row",tickPosition:"after",tickSize:4,tickSpacing:3,tickOverlap:!1,tickFormat:function(t){return""+t},titleAlign:"start",titleOffset:4},u={top:0,right:0,bottom:0,left:0},f=function(t){var e,i=t.direction,n=t.itemsSpacing,o=t.padding,r=t.itemCount,l=t.itemWidth,a=t.itemHeight;if("number"!=typeof o&&("object"!=typeof(e=o)||Array.isArray(e)||null===e))throw new Error("Invalid property padding, must be one of: number, object");var s="number"==typeof o?{top:o,right:o,bottom:o,left:o}:g({},u,o),c=s.left+s.right,d=s.top+s.bottom,h=l+c,f=a+d,m=(r-1)*n;return"row"===i?h=l*r+m+c:"column"===i&&(f=a*r+m+d),{width:h,height:f,padding:s}},m=function(t){var e=t.anchor,i=t.translateX,n=t.translateY,o=t.containerWidth,r=t.containerHeight,l=t.width,a=t.height,s=i,c=n;switch(e){case"top":s+=(o-l)/2;break;case"top-right":s+=o-l;break;case"right":s+=o-l,c+=(r-a)/2;break;case"bottom-right":s+=o-l,c+=r-a;break;case"bottom":s+=(o-l)/2,c+=r-a;break;case"bottom-left":c+=r-a;break;case"left":c+=(r-a)/2;break;case"center":s+=(o-l)/2,c+=(r-a)/2}return{x:s,y:c}},v=function(t){var e,i,n,o,r,l,a=t.direction,s=t.justify,c=t.symbolSize,d=t.symbolSpacing,g=t.width,h=t.height;switch(a){case"left-to-right":e=0,i=(h-c)/2,o=h/2,l="central",s?(n=g,r="end"):(n=c+d,r="start");break;case"right-to-left":e=g-c,i=(h-c)/2,o=h/2,l="central",s?(n=0,r="start"):(n=g-c-d,r="end");break;case"top-to-bottom":e=(g-c)/2,i=0,n=g/2,r="middle",s?(o=h,l="alphabetic"):(o=c+d,l="text-before-edge");break;case"bottom-to-top":e=(g-c)/2,i=h-c,n=g/2,r="middle",s?(o=0,l="text-before-edge"):(o=h-c-d,l="alphabetic")}return{symbolX:e,symbolY:i,labelX:n,labelY:o,labelAnchor:r,labelAlignment:l}},x=function(t){var o,r=t.scale,l=t.ticks,a=t.length,s=void 0===a?h.length:a,c=t.thickness,d=void 0===c?h.thickness:c,g=t.direction,u=void 0===g?h.direction:g,f=t.tickPosition,m=void 0===f?h.tickPosition:f,v=t.tickSize,x=void 0===v?h.tickSize:v,p=t.tickSpacing,y=void 0===p?h.tickSpacing:p,b=t.tickOverlap,k=void 0===b?h.tickOverlap:b,S=t.tickFormat,C=void 0===S?h.tickFormat:S,A=t.title,j=t.titleAlign,W=void 0===j?h.titleAlign:j,z=t.titleOffset,O=void 0===z?h.titleOffset:z,w="column"===u?[].concat(r.domain()).reverse():r.domain(),X=e.scaleLinear().domain(w);2===w.length?X.range([0,s]):3===w.length&&X.range([0,s/2,s]),o="thresholds"in r?[w[0]].concat(r.thresholds(),[w[1]]):Array.isArray(l)?l:r.ticks(l);var Y,B,L,H,E,T,F=n.computeContinuousColorScaleColorStops(r,32),M=i.getValueFormatter(C),P=[],q=0,D=0;if("row"===u){var V,R,G;Y=s,B=d,D=1;var I;E=0,L="start"===W?0:"middle"===W?s/2:s,"before"===m?(V=-x,R=k?d:0,G=-x-y,I="alphabetic",H=d+O,T="hanging"):(V=k?0:d,G=(R=d+x)+y,I="hanging",H=-O,T="alphabetic"),o.forEach((function(t){var e=X(t);P.push({x1:e,y1:V,x2:e,y2:R,text:M(t),textX:e,textY:G,textHorizontalAlign:"middle",textVerticalAlign:I})}))}else{var N,Q,_,J;Y=d,B=s,q=1;E=-90,H="start"===W?s:"middle"===W?s/2:0,"before"===m?(Q=k?d:0,_=(N=-x)-y,J="end",L=d+O,T="hanging"):(N=k?0:d,_=(Q=d+x)+y,J="start",L=-O,T="alphabetic"),o.forEach((function(t){var e=X(t);P.push({x1:N,y1:e,x2:Q,y2:e,text:M(t),textX:_,textY:e,textHorizontalAlign:J,textVerticalAlign:"central"})}))}return{width:Y,height:B,gradientX1:0,gradientY1:q,gradientX2:D,gradientY2:0,colorStops:F,ticks:P,titleText:A,titleX:L,titleY:H,titleRotation:E,titleHorizontalAlign:W,titleVerticalAlign:T}},p=function(e){var n=e.scale,r=e.ticks,l=e.length,a=void 0===l?h.length:l,s=e.thickness,c=void 0===s?h.thickness:s,d=e.direction,u=void 0===d?h.direction:d,f=e.tickPosition,m=void 0===f?h.tickPosition:f,v=e.tickSize,p=void 0===v?h.tickSize:v,y=e.tickSpacing,b=void 0===y?h.tickSpacing:y,k=e.tickOverlap,S=void 0===k?h.tickOverlap:k,C=e.tickFormat,A=void 0===C?h.tickFormat:C,j=e.title,W=e.titleAlign,z=void 0===W?h.titleAlign:W,O=e.titleOffset,w=x({scale:n,ticks:r,length:a,thickness:c,direction:u,tickPosition:m,tickSize:p,tickSpacing:b,tickOverlap:S,tickFormat:A,title:j,titleAlign:z,titleOffset:void 0===O?h.titleOffset:O}),X=w.width,Y=w.height,B=w.gradientX1,L=w.gradientY1,H=w.gradientX2,E=w.gradientY2,T=w.ticks,F=w.colorStops,M=w.titleText,P=w.titleX,q=w.titleY,D=w.titleRotation,V=w.titleVerticalAlign,R=w.titleHorizontalAlign,G=i.useTheme(),I="ContinuousColorsLegendSvgGradient."+u+"."+F.map((function(t){return t.offset})).join("_");return t.jsxs("g",{children:[t.jsx("defs",{children:t.jsx("linearGradient",{id:I,x1:B,y1:L,x2:H,y2:E,children:F.map((function(e){return t.jsx("stop",g({},e))}))})}),M&&t.jsx("text",{transform:"translate("+P+", "+q+") rotate("+D+")",textAnchor:R,dominantBaseline:V,style:G.legends.title.text,children:M}),t.jsx("rect",{width:X,height:Y,fill:"url(#"+I}),T.map((function(e,i){return t.jsxs(o.Fragment,{children:[t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:G.legends.ticks.line}),t.jsx("text",{x:e.textX,y:e.textY,textAnchor:e.textHorizontalAlign,dominantBaseline:e.textVerticalAlign,style:G.legends.ticks.text,children:e.text})]},i)}))]})},y=["containerWidth","containerHeight","anchor","translateX","translateY","length","thickness","direction"],b={circle:a,diamond:s,square:c,triangle:d},k=function(e){var n,r,a,s,c,d,h,u,f,m,x,p=e.x,y=e.y,k=e.width,S=e.height,C=e.data,A=e.direction,j=void 0===A?"left-to-right":A,W=e.justify,z=void 0!==W&&W,O=e.textColor,w=e.background,X=void 0===w?"transparent":w,Y=e.opacity,B=void 0===Y?1:Y,L=e.symbolShape,H=void 0===L?"square":L,E=e.symbolSize,T=void 0===E?16:E,F=e.symbolSpacing,M=void 0===F?8:F,P=e.symbolBorderWidth,q=void 0===P?0:P,D=e.symbolBorderColor,V=void 0===D?"transparent":D,R=e.onClick,G=e.onMouseEnter,I=e.onMouseLeave,N=e.toggleSerie,Q=e.effects,_=o.useState({}),J=_[0],K=_[1],U=i.useTheme(),Z=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"===t.on})).reduce((function(t,e){return g({},t,e.style)}),{});K(e)}null==G||G(C,t)}),[G,C,Q]),$=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"!==t.on})).reduce((function(t,e){return g({},t,e.style)}),{});K(e)}null==I||I(C,t)}),[I,C,Q]),tt=v({direction:j,justify:z,symbolSize:null!=(n=J.symbolSize)?n:T,symbolSpacing:M,width:k,height:S}),et=tt.symbolX,it=tt.symbolY,nt=tt.labelX,ot=tt.labelY,rt=tt.labelAnchor,lt=tt.labelAlignment,at=[R,G,I,N].some((function(t){return void 0!==t})),st="function"==typeof H?H:b[H];return t.jsxs("g",{transform:"translate("+p+","+y+")",style:{opacity:null!=(r=J.itemOpacity)?r:B},children:[t.jsx("rect",{width:k,height:S,fill:null!=(a=J.itemBackground)?a:X,style:{cursor:at?"pointer":"auto"},onClick:function(t){null==R||R(C,t),null==N||N(C.id)},onMouseEnter:Z,onMouseLeave:$}),l.createElement(st,g({id:C.id,x:et,y:it,size:null!=(s=J.symbolSize)?s:T,fill:null!=(c=null!=(d=C.fill)?d:C.color)?c:"black",borderWidth:null!=(h=J.symbolBorderWidth)?h:q,borderColor:null!=(u=J.symbolBorderColor)?u:V},C.hidden?U.legends.hidden.symbol:void 0)),t.jsx("text",{textAnchor:rt,style:g({},i.sanitizeSvgTextStyle(U.legends.text),{fill:null!=(f=null!=(m=null!=(x=J.itemTextColor)?x:O)?m:U.legends.text.fill)?f:"black",dominantBaseline:lt,pointerEvents:"none",userSelect:"none"},C.hidden?U.legends.hidden.text:void 0),x:nt,y:ot,children:C.label})]})},S=function(e){var i=e.data,n=e.x,o=e.y,r=e.direction,l=e.padding,a=void 0===l?0:l,s=e.justify,c=e.effects,d=e.itemWidth,g=e.itemHeight,h=e.itemDirection,u=void 0===h?"left-to-right":h,m=e.itemsSpacing,v=void 0===m?0:m,x=e.itemTextColor,p=e.itemBackground,y=void 0===p?"transparent":p,b=e.itemOpacity,S=void 0===b?1:b,C=e.symbolShape,A=e.symbolSize,j=e.symbolSpacing,W=e.symbolBorderWidth,z=e.symbolBorderColor,O=e.onClick,w=e.onMouseEnter,X=e.onMouseLeave,Y=e.toggleSerie,B=f({itemCount:i.length,itemWidth:d,itemHeight:g,itemsSpacing:v,direction:r,padding:a}).padding,L="row"===r?d+v:0,H="column"===r?g+v:0;return t.jsx("g",{transform:"translate("+n+","+o+")",children:i.map((function(e,i){return t.jsx(k,{data:e,x:i*L+B.left,y:i*H+B.top,width:d,height:g,direction:u,justify:s,effects:c,textColor:x,background:y,opacity:S,symbolShape:C,symbolSize:A,symbolSpacing:j,symbolBorderWidth:W,symbolBorderColor:z,onClick:O,onMouseEnter:w,onMouseLeave:X,toggleSerie:Y},i)}))})},C={start:"left",middle:"center",end:"right"};exports.AnchoredContinuousColorsLegendSvg=function(e){var i,n,o=e.containerWidth,r=e.containerHeight,l=e.anchor,a=e.translateX,s=void 0===a?0:a,c=e.translateY,d=void 0===c?0:c,u=e.length,f=void 0===u?h.length:u,v=e.thickness,x=void 0===v?h.thickness:v,b=e.direction,k=void 0===b?h.direction:b,S=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(e,y);"row"===k?(i=f,n=x):(i=x,n=f);var C=m({anchor:l,translateX:s,translateY:d,containerWidth:o,containerHeight:r,width:i,height:n}),A=C.x,j=C.y;return t.jsx("g",{transform:"translate("+A+", "+j+")",children:t.jsx(p,g({length:f,thickness:x,direction:k},S))})},exports.BoxLegendSvg=function(e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,v=e.itemsSpacing,x=void 0===v?0:v,p=e.itemWidth,y=e.itemHeight,b=e.itemDirection,k=e.itemTextColor,C=e.itemBackground,A=e.itemOpacity,j=e.symbolShape,W=e.symbolSize,z=e.symbolSpacing,O=e.symbolBorderWidth,w=e.symbolBorderColor,X=e.onClick,Y=e.onMouseEnter,B=e.onMouseLeave,L=e.toggleSerie,H=e.effects,E=f({itemCount:i.length,itemsSpacing:x,itemWidth:p,itemHeight:y,direction:d,padding:h}),T=E.width,F=E.height,M=m({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:T,height:F}),P=M.x,q=M.y;return t.jsx(S,{data:i,x:P,y:q,direction:d,padding:h,justify:u,effects:H,itemsSpacing:x,itemWidth:p,itemHeight:y,itemDirection:b,itemTextColor:k,itemBackground:C,itemOpacity:A,symbolShape:j,symbolSize:W,symbolSpacing:z,symbolBorderWidth:O,symbolBorderColor:w,onClick:X,onMouseEnter:Y,onMouseLeave:B,toggleSerie:"boolean"==typeof L?void 0:L})},exports.ContinuousColorsLegendSvg=p,exports.LegendSvg=S,exports.LegendSvgItem=k,exports.SymbolCircle=a,exports.SymbolDiamond=s,exports.SymbolSquare=c,exports.SymbolTriangle=d,exports.computeContinuousColorsLegend=x,exports.computeDimensions=f,exports.computeItemLayout=v,exports.computePositionFromAnchor=m,exports.continuousColorsLegendDefaults=h,exports.renderContinuousColorLegendToCanvas=function(t,e){var n=e.containerWidth,o=e.containerHeight,r=e.anchor,l=e.translateX,a=void 0===l?0:l,s=e.translateY,c=void 0===s?0:s,d=e.scale,g=e.length,u=void 0===g?h.length:g,f=e.thickness,v=void 0===f?h.thickness:f,p=e.direction,y=void 0===p?h.direction:p,b=e.ticks,k=e.tickPosition,S=void 0===k?h.tickPosition:k,C=e.tickSize,A=void 0===C?h.tickSize:C,j=e.tickSpacing,W=void 0===j?h.tickSpacing:j,z=e.tickOverlap,O=void 0===z?h.tickOverlap:z,w=e.tickFormat,X=void 0===w?h.tickFormat:w,Y=e.title,B=e.titleAlign,L=void 0===B?h.titleAlign:B,H=e.titleOffset,E=void 0===H?h.titleOffset:H,T=e.theme,F=x({scale:d,ticks:b,length:u,thickness:v,direction:y,tickPosition:S,tickSize:A,tickSpacing:W,tickOverlap:O,tickFormat:X,title:Y,titleAlign:L,titleOffset:E}),M=F.width,P=F.height,q=F.gradientX1,D=F.gradientY1,V=F.gradientX2,R=F.gradientY2,G=F.colorStops,I=F.ticks,N=F.titleText,Q=F.titleX,_=F.titleY,J=F.titleRotation,K=F.titleVerticalAlign,U=F.titleHorizontalAlign,Z=m({anchor:r,translateX:a,translateY:c,containerWidth:n,containerHeight:o,width:M,height:P}),$=Z.x,tt=Z.y,et={font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline};t.save(),t.translate($,tt);var it=t.createLinearGradient(q*M,D*P,V*M,R*P);G.forEach((function(t){it.addColorStop(t.offset,t.stopColor)})),t.fillStyle=it,t.fillRect(0,0,M,P),t.font=(T.legends.ticks.text.fontWeight?T.legends.ticks.text.fontWeight+" ":"")+T.legends.ticks.text.fontSize+"px "+T.legends.ticks.text.fontFamily,I.forEach((function(e){var i;(null!=(i=T.legends.ticks.line.strokeWidth)?i:0)>0&&(t.lineWidth=Number(T.axis.ticks.line.strokeWidth),T.axis.ticks.line.stroke&&(t.strokeStyle=T.axis.ticks.line.stroke),t.lineCap="square",t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),T.legends.ticks.text.fill&&(t.fillStyle=T.legends.ticks.text.fill),t.textAlign="middle"===e.textHorizontalAlign?"center":e.textHorizontalAlign,t.textBaseline="central"===e.textVerticalAlign?"middle":e.textVerticalAlign,t.fillText(e.text,e.textX,e.textY)})),N&&(t.save(),t.translate(Q,_),t.rotate(i.degreesToRadians(J)),t.font=(T.legends.title.text.fontWeight?T.legends.title.text.fontWeight+" ":"")+T.legends.title.text.fontSize+"px "+T.legends.title.text.fontFamily,T.legends.title.text.fill&&(t.fillStyle=T.legends.title.text.fill),t.textAlign="middle"===U?"center":U,t.textBaseline=K,t.fillText(N,0,0),t.restore()),t.restore(),t.font=et.font,t.textAlign=et.textAlign,t.textBaseline=et.textBaseline},exports.renderLegendToCanvas=function(t,e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,x=void 0!==u&&u,p=e.itemsSpacing,y=void 0===p?0:p,b=e.itemWidth,k=e.itemHeight,S=e.itemDirection,A=void 0===S?"left-to-right":S,j=e.itemTextColor,W=e.symbolSize,z=void 0===W?16:W,O=e.symbolSpacing,w=void 0===O?8:O,X=e.theme,Y=f({itemCount:i.length,itemWidth:b,itemHeight:k,itemsSpacing:y,direction:d,padding:h}),B=Y.width,L=Y.height,H=Y.padding,E=m({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:B,height:L}),T=E.x,F=E.y,M="row"===d?b+y:0,P="column"===d?k+y:0;t.save(),t.translate(T,F),t.font=X.legends.text.fontSize+"px "+(X.legends.text.fontFamily||"sans-serif"),i.forEach((function(e,i){var n,o,r=i*M+H.left,l=i*P+H.top,a=v({direction:A,justify:x,symbolSize:z,symbolSpacing:w,width:b,height:k}),s=a.symbolX,c=a.symbolY,d=a.labelX,g=a.labelY,h=a.labelAnchor,u=a.labelAlignment;t.fillStyle=null!=(n=e.color)?n:"black",t.fillRect(r+s,l+c,z,z),t.textAlign=C[h],"central"===u&&(t.textBaseline="middle"),t.fillStyle=null!=(o=null!=j?j:X.legends.text.fill)?o:"black",t.fillText(String(e.label),r+d,l+g)})),t.restore()},exports.useQuantizeColorScaleLegendData=function(t){var e=t.scale,i=t.domain,n=t.reverse,r=void 0!==n&&n,l=t.valueFormat,a=void 0===l?function(t){return t}:l,s=t.separator,c=void 0===s?" - ":s;return o.useMemo((function(){var t=(null!=i?i:e.range()).map((function(t,i){var n=e.invertExtent(t),o=n[0],r=n[1];return{id:t,index:i,extent:[o,r],label:""+a(o)+c+a(r),value:e(o),color:t}}));return r&&t.reverse(),t}),[i,e,r,c,a])}; | ||
//# sourceMappingURL=nivo-legends.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var t=require("react/jsx-runtime"),e=require("d3-scale"),i=require("@nivo/core"),n=require("@nivo/colors"),o=require("react"),r=require("prop-types");function l(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var a=l(o),s=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("circle",{r:o/2,cx:i+o/2,cy:n+o/2,fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})},c=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+.8*o+" "+o/2+"\n L"+o/2+" "+o+"\n L"+.2*o+" "+o/2+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})},d=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("rect",{x:i,y:n,fill:r,opacity:a,strokeWidth:c,stroke:g,width:o,height:o,style:{pointerEvents:"none"}})},g=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+o+" "+o+"\n L0 "+o+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})};function h(){return h=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},h.apply(this,arguments)}var u={length:200,thickness:16,direction:"row",tickPosition:"after",tickSize:4,tickSpacing:3,tickOverlap:!1,tickFormat:function(t){return""+t},titleAlign:"start",titleOffset:4},m={top:0,right:0,bottom:0,left:0},f=function(t){var e,i=t.direction,n=t.itemsSpacing,o=t.padding,r=t.itemCount,l=t.itemWidth,a=t.itemHeight;if("number"!=typeof o&&("object"!=typeof(e=o)||Array.isArray(e)||null===e))throw new Error("Invalid property padding, must be one of: number, object");var s="number"==typeof o?{top:o,right:o,bottom:o,left:o}:h({},m,o),c=s.left+s.right,d=s.top+s.bottom,g=l+c,u=a+d,f=(r-1)*n;return"row"===i?g=l*r+f+c:"column"===i&&(u=a*r+f+d),{width:g,height:u,padding:s}},p=function(t){var e=t.anchor,i=t.translateX,n=t.translateY,o=t.containerWidth,r=t.containerHeight,l=t.width,a=t.height,s=i,c=n;switch(e){case"top":s+=(o-l)/2;break;case"top-right":s+=o-l;break;case"right":s+=o-l,c+=(r-a)/2;break;case"bottom-right":s+=o-l,c+=r-a;break;case"bottom":s+=(o-l)/2,c+=r-a;break;case"bottom-left":c+=r-a;break;case"left":c+=(r-a)/2;break;case"center":s+=(o-l)/2,c+=(r-a)/2}return{x:s,y:c}},v=function(t){var e,i,n,o,r,l,a=t.direction,s=t.justify,c=t.symbolSize,d=t.symbolSpacing,g=t.width,h=t.height;switch(a){case"left-to-right":e=0,i=(h-c)/2,o=h/2,l="central",s?(n=g,r="end"):(n=c+d,r="start");break;case"right-to-left":e=g-c,i=(h-c)/2,o=h/2,l="central",s?(n=0,r="start"):(n=g-c-d,r="end");break;case"top-to-bottom":e=(g-c)/2,i=0,n=g/2,r="middle",s?(o=h,l="alphabetic"):(o=c+d,l="text-before-edge");break;case"bottom-to-top":e=(g-c)/2,i=h-c,n=g/2,r="middle",s?(o=0,l="text-before-edge"):(o=h-c-d,l="alphabetic")}return{symbolX:e,symbolY:i,labelX:n,labelY:o,labelAnchor:r,labelAlignment:l}},x=function(t){var o,r=t.scale,l=t.ticks,a=t.length,s=void 0===a?u.length:a,c=t.thickness,d=void 0===c?u.thickness:c,g=t.direction,h=void 0===g?u.direction:g,m=t.tickPosition,f=void 0===m?u.tickPosition:m,p=t.tickSize,v=void 0===p?u.tickSize:p,x=t.tickSpacing,y=void 0===x?u.tickSpacing:x,b=t.tickOverlap,k=void 0===b?u.tickOverlap:b,S=t.tickFormat,C=void 0===S?u.tickFormat:S,A=t.title,j=t.titleAlign,O=void 0===j?u.titleAlign:j,W=t.titleOffset,z=void 0===W?u.titleOffset:W,B="column"===h?[].concat(r.domain()).reverse():r.domain(),w=e.scaleLinear().domain(B);2===B.length?w.range([0,s]):3===B.length&&w.range([0,s/2,s]),o="thresholds"in r?[B[0]].concat(r.thresholds(),[B[1]]):Array.isArray(l)?l:r.ticks(l);var X,Y,L,H,T,E,q=n.computeContinuousColorScaleColorStops(r,32),M=i.getValueFormatter(C),F=[],P=0,R=0;if("row"===h){var D,V,G;X=s,Y=d,R=1;var I;T=0,L="start"===O?0:"middle"===O?s/2:s,"before"===f?(D=-v,V=k?d:0,G=-v-y,I="alphabetic",H=d+z,E="hanging"):(D=k?0:d,G=(V=d+v)+y,I="hanging",H=-z,E="alphabetic"),o.forEach((function(t){var e=w(t);F.push({x1:e,y1:D,x2:e,y2:V,text:M(t),textX:e,textY:G,textHorizontalAlign:"middle",textVerticalAlign:I})}))}else{var N,Q,_,J;X=d,Y=s,P=1;T=-90,H="start"===O?s:"middle"===O?s/2:0,"before"===f?(Q=k?d:0,_=(N=-v)-y,J="end",L=d+z,E="hanging"):(N=k?0:d,_=(Q=d+v)+y,J="start",L=-z,E="alphabetic"),o.forEach((function(t){var e=w(t);F.push({x1:N,y1:e,x2:Q,y2:e,text:M(t),textX:_,textY:e,textHorizontalAlign:J,textVerticalAlign:"central"})}))}return{width:X,height:Y,gradientX1:0,gradientY1:P,gradientX2:R,gradientY2:0,colorStops:q,ticks:F,titleText:A,titleX:L,titleY:H,titleRotation:T,titleHorizontalAlign:O,titleVerticalAlign:E}},y=function(e){var n=e.scale,r=e.ticks,l=e.length,a=void 0===l?u.length:l,s=e.thickness,c=void 0===s?u.thickness:s,d=e.direction,g=void 0===d?u.direction:d,m=e.tickPosition,f=void 0===m?u.tickPosition:m,p=e.tickSize,v=void 0===p?u.tickSize:p,y=e.tickSpacing,b=void 0===y?u.tickSpacing:y,k=e.tickOverlap,S=void 0===k?u.tickOverlap:k,C=e.tickFormat,A=void 0===C?u.tickFormat:C,j=e.title,O=e.titleAlign,W=void 0===O?u.titleAlign:O,z=e.titleOffset,B=x({scale:n,ticks:r,length:a,thickness:c,direction:g,tickPosition:f,tickSize:v,tickSpacing:b,tickOverlap:S,tickFormat:A,title:j,titleAlign:W,titleOffset:void 0===z?u.titleOffset:z}),w=B.width,X=B.height,Y=B.gradientX1,L=B.gradientY1,H=B.gradientX2,T=B.gradientY2,E=B.ticks,q=B.colorStops,M=B.titleText,F=B.titleX,P=B.titleY,R=B.titleRotation,D=B.titleVerticalAlign,V=B.titleHorizontalAlign,G=i.useTheme(),I="ContinuousColorsLegendSvgGradient."+g+"."+q.map((function(t){return t.offset})).join("_");return t.jsxs("g",{children:[t.jsx("defs",{children:t.jsx("linearGradient",{id:I,x1:Y,y1:L,x2:H,y2:T,children:q.map((function(e){return t.jsx("stop",h({},e))}))})}),M&&t.jsx("text",{transform:"translate("+F+", "+P+") rotate("+R+")",textAnchor:V,dominantBaseline:D,style:G.legends.title.text,children:M}),t.jsx("rect",{width:w,height:X,fill:"url(#"+I}),E.map((function(e,i){return t.jsxs(o.Fragment,{children:[t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:G.legends.ticks.line}),t.jsx("text",{x:e.textX,y:e.textY,textAnchor:e.textHorizontalAlign,dominantBaseline:e.textVerticalAlign,style:G.legends.ticks.text,children:e.text})]},i)}))]})},b=["containerWidth","containerHeight","anchor","translateX","translateY","length","thickness","direction"],k={circle:s,diamond:c,square:d,triangle:g},S=function(e){var n,r,l,s,c,d,g,u,m,f,p,x=e.x,y=e.y,b=e.width,S=e.height,C=e.data,A=e.direction,j=void 0===A?"left-to-right":A,O=e.justify,W=void 0!==O&&O,z=e.textColor,B=e.background,w=void 0===B?"transparent":B,X=e.opacity,Y=void 0===X?1:X,L=e.symbolShape,H=void 0===L?"square":L,T=e.symbolSize,E=void 0===T?16:T,q=e.symbolSpacing,M=void 0===q?8:q,F=e.symbolBorderWidth,P=void 0===F?0:F,R=e.symbolBorderColor,D=void 0===R?"transparent":R,V=e.onClick,G=e.onMouseEnter,I=e.onMouseLeave,N=e.toggleSerie,Q=e.effects,_=o.useState({}),J=_[0],K=_[1],U=i.useTheme(),Z=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"===t.on})).reduce((function(t,e){return h({},t,e.style)}),{});K(e)}null==G||G(C,t)}),[G,C,Q]),$=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"!==t.on})).reduce((function(t,e){return h({},t,e.style)}),{});K(e)}null==I||I(C,t)}),[I,C,Q]),tt=v({direction:j,justify:W,symbolSize:null!=(n=J.symbolSize)?n:E,symbolSpacing:M,width:b,height:S}),et=tt.symbolX,it=tt.symbolY,nt=tt.labelX,ot=tt.labelY,rt=tt.labelAnchor,lt=tt.labelAlignment,at=[V,G,I,N].some((function(t){return void 0!==t})),st="function"==typeof H?H:k[H];return t.jsxs("g",{transform:"translate("+x+","+y+")",style:{opacity:null!=(r=J.itemOpacity)?r:Y},children:[t.jsx("rect",{width:b,height:S,fill:null!=(l=J.itemBackground)?l:w,style:{cursor:at?"pointer":"auto"},onClick:function(t){null==V||V(C,t),null==N||N(C.id)},onMouseEnter:Z,onMouseLeave:$}),a.createElement(st,h({id:C.id,x:et,y:it,size:null!=(s=J.symbolSize)?s:E,fill:null!=(c=null!=(d=C.fill)?d:C.color)?c:"black",borderWidth:null!=(g=J.symbolBorderWidth)?g:P,borderColor:null!=(u=J.symbolBorderColor)?u:D},C.hidden?U.legends.hidden.symbol:void 0)),t.jsx("text",{textAnchor:rt,style:h({},U.legends.text,{fill:null!=(m=null!=(f=null!=(p=J.itemTextColor)?p:z)?f:U.legends.text.fill)?m:"black",dominantBaseline:lt,pointerEvents:"none",userSelect:"none"},C.hidden?U.legends.hidden.text:void 0),x:nt,y:ot,children:C.label})]})},C=function(e){var i=e.data,n=e.x,o=e.y,r=e.direction,l=e.padding,a=void 0===l?0:l,s=e.justify,c=e.effects,d=e.itemWidth,g=e.itemHeight,h=e.itemDirection,u=void 0===h?"left-to-right":h,m=e.itemsSpacing,p=void 0===m?0:m,v=e.itemTextColor,x=e.itemBackground,y=void 0===x?"transparent":x,b=e.itemOpacity,k=void 0===b?1:b,C=e.symbolShape,A=e.symbolSize,j=e.symbolSpacing,O=e.symbolBorderWidth,W=e.symbolBorderColor,z=e.onClick,B=e.onMouseEnter,w=e.onMouseLeave,X=e.toggleSerie,Y=f({itemCount:i.length,itemWidth:d,itemHeight:g,itemsSpacing:p,direction:r,padding:a}).padding,L="row"===r?d+p:0,H="column"===r?g+p:0;return t.jsx("g",{transform:"translate("+n+","+o+")",children:i.map((function(e,i){return t.jsx(S,{data:e,x:i*L+Y.left,y:i*H+Y.top,width:d,height:g,direction:u,justify:s,effects:c,textColor:v,background:y,opacity:k,symbolShape:C,symbolSize:A,symbolSpacing:j,symbolBorderWidth:O,symbolBorderColor:W,onClick:z,onMouseEnter:B,onMouseLeave:w,toggleSerie:X},i)}))})},A={start:"left",middle:"center",end:"right"},j={data:r.arrayOf(r.object),anchor:r.oneOf(["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left","center"]).isRequired,translateX:r.number,translateY:r.number,direction:r.oneOf(["row","column"]).isRequired,itemsSpacing:r.number,itemWidth:r.number.isRequired,itemHeight:r.number.isRequired,itemDirection:r.oneOf(["left-to-right","right-to-left","top-to-bottom","bottom-to-top"]),itemTextColor:r.string,itemBackground:r.string,itemOpacity:r.number,symbolShape:r.oneOfType([r.oneOf(["circle","diamond","square","triangle"]),r.func]),symbolSize:r.number,symbolSpacing:r.number,symbolBorderWidth:r.number,symbolBorderColor:r.string,onClick:r.func,onMouseEnter:r.func,onMouseLeave:r.func,effects:r.arrayOf(r.shape({on:r.oneOfType([r.oneOf(["hover"])]).isRequired,style:r.shape({itemTextColor:r.string,itemBackground:r.string,itemOpacity:r.number,symbolSize:r.number,symbolBorderWidth:r.number,symbolBorderColor:r.string}).isRequired}))};exports.AnchoredContinuousColorsLegendSvg=function(e){var i,n,o=e.containerWidth,r=e.containerHeight,l=e.anchor,a=e.translateX,s=void 0===a?0:a,c=e.translateY,d=void 0===c?0:c,g=e.length,m=void 0===g?u.length:g,f=e.thickness,v=void 0===f?u.thickness:f,x=e.direction,k=void 0===x?u.direction:x,S=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(e,b);"row"===k?(i=m,n=v):(i=v,n=m);var C=p({anchor:l,translateX:s,translateY:d,containerWidth:o,containerHeight:r,width:i,height:n}),A=C.x,j=C.y;return t.jsx("g",{transform:"translate("+A+", "+j+")",children:t.jsx(y,h({length:m,thickness:v,direction:k},S))})},exports.BoxLegendSvg=function(e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,m=e.itemsSpacing,v=void 0===m?0:m,x=e.itemWidth,y=e.itemHeight,b=e.itemDirection,k=e.itemTextColor,S=e.itemBackground,A=e.itemOpacity,j=e.symbolShape,O=e.symbolSize,W=e.symbolSpacing,z=e.symbolBorderWidth,B=e.symbolBorderColor,w=e.onClick,X=e.onMouseEnter,Y=e.onMouseLeave,L=e.toggleSerie,H=e.effects,T=f({itemCount:i.length,itemsSpacing:v,itemWidth:x,itemHeight:y,direction:d,padding:h}),E=T.width,q=T.height,M=p({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:E,height:q}),F=M.x,P=M.y;return t.jsx(C,{data:i,x:F,y:P,direction:d,padding:h,justify:u,effects:H,itemsSpacing:v,itemWidth:x,itemHeight:y,itemDirection:b,itemTextColor:k,itemBackground:S,itemOpacity:A,symbolShape:j,symbolSize:O,symbolSpacing:W,symbolBorderWidth:z,symbolBorderColor:B,onClick:w,onMouseEnter:X,onMouseLeave:Y,toggleSerie:"boolean"==typeof L?void 0:L})},exports.ContinuousColorsLegendSvg=y,exports.LegendPropShape=j,exports.LegendSvg=C,exports.LegendSvgItem=S,exports.SymbolCircle=s,exports.SymbolDiamond=c,exports.SymbolSquare=d,exports.SymbolTriangle=g,exports.computeContinuousColorsLegend=x,exports.computeDimensions=f,exports.computeItemLayout=v,exports.computePositionFromAnchor=p,exports.continuousColorsLegendDefaults=u,exports.renderContinuousColorLegendToCanvas=function(t,e){var n=e.containerWidth,o=e.containerHeight,r=e.anchor,l=e.translateX,a=void 0===l?0:l,s=e.translateY,c=void 0===s?0:s,d=e.scale,g=e.length,h=void 0===g?u.length:g,m=e.thickness,f=void 0===m?u.thickness:m,v=e.direction,y=void 0===v?u.direction:v,b=e.ticks,k=e.tickPosition,S=void 0===k?u.tickPosition:k,C=e.tickSize,A=void 0===C?u.tickSize:C,j=e.tickSpacing,O=void 0===j?u.tickSpacing:j,W=e.tickOverlap,z=void 0===W?u.tickOverlap:W,B=e.tickFormat,w=void 0===B?u.tickFormat:B,X=e.title,Y=e.titleAlign,L=void 0===Y?u.titleAlign:Y,H=e.titleOffset,T=void 0===H?u.titleOffset:H,E=e.theme,q=x({scale:d,ticks:b,length:h,thickness:f,direction:y,tickPosition:S,tickSize:A,tickSpacing:O,tickOverlap:z,tickFormat:w,title:X,titleAlign:L,titleOffset:T}),M=q.width,F=q.height,P=q.gradientX1,R=q.gradientY1,D=q.gradientX2,V=q.gradientY2,G=q.colorStops,I=q.ticks,N=q.titleText,Q=q.titleX,_=q.titleY,J=q.titleRotation,K=q.titleVerticalAlign,U=q.titleHorizontalAlign,Z=p({anchor:r,translateX:a,translateY:c,containerWidth:n,containerHeight:o,width:M,height:F}),$=Z.x,tt=Z.y,et={font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline};t.save(),t.translate($,tt);var it=t.createLinearGradient(P*M,R*F,D*M,V*F);G.forEach((function(t){it.addColorStop(t.offset,t.stopColor)})),t.fillStyle=it,t.fillRect(0,0,M,F),t.font=(E.legends.ticks.text.fontWeight?E.legends.ticks.text.fontWeight+" ":"")+E.legends.ticks.text.fontSize+"px "+E.legends.ticks.text.fontFamily,I.forEach((function(e){var i;(null!=(i=E.legends.ticks.line.strokeWidth)?i:0)>0&&(t.lineWidth=Number(E.axis.ticks.line.strokeWidth),E.axis.ticks.line.stroke&&(t.strokeStyle=E.axis.ticks.line.stroke),t.lineCap="square",t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),E.legends.ticks.text.fill&&(t.fillStyle=E.legends.ticks.text.fill),t.textAlign="middle"===e.textHorizontalAlign?"center":e.textHorizontalAlign,t.textBaseline="central"===e.textVerticalAlign?"middle":e.textVerticalAlign,t.fillText(e.text,e.textX,e.textY)})),N&&(t.save(),t.translate(Q,_),t.rotate(i.degreesToRadians(J)),t.font=(E.legends.title.text.fontWeight?E.legends.title.text.fontWeight+" ":"")+E.legends.title.text.fontSize+"px "+E.legends.title.text.fontFamily,E.legends.title.text.fill&&(t.fillStyle=E.legends.title.text.fill),t.textAlign="middle"===U?"center":U,t.textBaseline=K,t.fillText(N,0,0),t.restore()),t.restore(),t.font=et.font,t.textAlign=et.textAlign,t.textBaseline=et.textBaseline},exports.renderLegendToCanvas=function(t,e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,m=void 0!==u&&u,x=e.itemsSpacing,y=void 0===x?0:x,b=e.itemWidth,k=e.itemHeight,S=e.itemDirection,C=void 0===S?"left-to-right":S,j=e.itemTextColor,O=e.symbolSize,W=void 0===O?16:O,z=e.symbolSpacing,B=void 0===z?8:z,w=e.theme,X=f({itemCount:i.length,itemWidth:b,itemHeight:k,itemsSpacing:y,direction:d,padding:h}),Y=X.width,L=X.height,H=X.padding,T=p({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:Y,height:L}),E=T.x,q=T.y,M="row"===d?b+y:0,F="column"===d?k+y:0;t.save(),t.translate(E,q),t.font=w.legends.text.fontSize+"px "+(w.legends.text.fontFamily||"sans-serif"),i.forEach((function(e,i){var n,o,r=i*M+H.left,l=i*F+H.top,a=v({direction:C,justify:m,symbolSize:W,symbolSpacing:B,width:b,height:k}),s=a.symbolX,c=a.symbolY,d=a.labelX,g=a.labelY,h=a.labelAnchor,u=a.labelAlignment;t.fillStyle=null!=(n=e.color)?n:"black",t.fillRect(r+s,l+c,W,W),t.textAlign=A[h],"central"===u&&(t.textBaseline="middle"),t.fillStyle=null!=(o=null!=j?j:w.legends.text.fill)?o:"black",t.fillText(String(e.label),r+d,l+g)})),t.restore()},exports.useQuantizeColorScaleLegendData=function(t){var e=t.scale,i=t.domain,n=t.reverse,r=void 0!==n&&n,l=t.valueFormat,a=void 0===l?function(t){return t}:l,s=t.separator,c=void 0===s?" - ":s;return o.useMemo((function(){var t=(null!=i?i:e.range()).map((function(t,i){var n=e.invertExtent(t),o=n[0],r=n[1];return{id:t,index:i,extent:[o,r],label:""+a(o)+c+a(r),value:e(o),color:t}}));return r&&t.reverse(),t}),[i,e,r,c,a])}; | ||
"use strict";var t=require("react/jsx-runtime"),e=require("d3-scale"),i=require("@nivo/core"),n=require("@nivo/colors"),o=require("react");function r(t){var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var l=r(o),a=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("circle",{r:o/2,cx:i+o/2,cy:n+o/2,fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})},s=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+.8*o+" "+o/2+"\n L"+o/2+" "+o+"\n L"+.2*o+" "+o/2+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})},c=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("rect",{x:i,y:n,fill:r,opacity:a,strokeWidth:c,stroke:g,width:o,height:o,style:{pointerEvents:"none"}})},d=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,s=e.borderWidth,c=void 0===s?0:s,d=e.borderColor,g=void 0===d?"transparent":d;return t.jsx("g",{transform:"translate("+i+","+n+")",children:t.jsx("path",{d:"\n M"+o/2+" 0\n L"+o+" "+o+"\n L0 "+o+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:c,stroke:g,style:{pointerEvents:"none"}})})};function g(){return g=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},g.apply(this,arguments)}var h={length:200,thickness:16,direction:"row",tickPosition:"after",tickSize:4,tickSpacing:3,tickOverlap:!1,tickFormat:function(t){return""+t},titleAlign:"start",titleOffset:4},u={top:0,right:0,bottom:0,left:0},f=function(t){var e,i=t.direction,n=t.itemsSpacing,o=t.padding,r=t.itemCount,l=t.itemWidth,a=t.itemHeight;if("number"!=typeof o&&("object"!=typeof(e=o)||Array.isArray(e)||null===e))throw new Error("Invalid property padding, must be one of: number, object");var s="number"==typeof o?{top:o,right:o,bottom:o,left:o}:g({},u,o),c=s.left+s.right,d=s.top+s.bottom,h=l+c,f=a+d,m=(r-1)*n;return"row"===i?h=l*r+m+c:"column"===i&&(f=a*r+m+d),{width:h,height:f,padding:s}},m=function(t){var e=t.anchor,i=t.translateX,n=t.translateY,o=t.containerWidth,r=t.containerHeight,l=t.width,a=t.height,s=i,c=n;switch(e){case"top":s+=(o-l)/2;break;case"top-right":s+=o-l;break;case"right":s+=o-l,c+=(r-a)/2;break;case"bottom-right":s+=o-l,c+=r-a;break;case"bottom":s+=(o-l)/2,c+=r-a;break;case"bottom-left":c+=r-a;break;case"left":c+=(r-a)/2;break;case"center":s+=(o-l)/2,c+=(r-a)/2}return{x:s,y:c}},v=function(t){var e,i,n,o,r,l,a=t.direction,s=t.justify,c=t.symbolSize,d=t.symbolSpacing,g=t.width,h=t.height;switch(a){case"left-to-right":e=0,i=(h-c)/2,o=h/2,l="central",s?(n=g,r="end"):(n=c+d,r="start");break;case"right-to-left":e=g-c,i=(h-c)/2,o=h/2,l="central",s?(n=0,r="start"):(n=g-c-d,r="end");break;case"top-to-bottom":e=(g-c)/2,i=0,n=g/2,r="middle",s?(o=h,l="alphabetic"):(o=c+d,l="text-before-edge");break;case"bottom-to-top":e=(g-c)/2,i=h-c,n=g/2,r="middle",s?(o=0,l="text-before-edge"):(o=h-c-d,l="alphabetic")}return{symbolX:e,symbolY:i,labelX:n,labelY:o,labelAnchor:r,labelAlignment:l}},x=function(t){var o,r=t.scale,l=t.ticks,a=t.length,s=void 0===a?h.length:a,c=t.thickness,d=void 0===c?h.thickness:c,g=t.direction,u=void 0===g?h.direction:g,f=t.tickPosition,m=void 0===f?h.tickPosition:f,v=t.tickSize,x=void 0===v?h.tickSize:v,p=t.tickSpacing,y=void 0===p?h.tickSpacing:p,b=t.tickOverlap,k=void 0===b?h.tickOverlap:b,S=t.tickFormat,C=void 0===S?h.tickFormat:S,A=t.title,j=t.titleAlign,W=void 0===j?h.titleAlign:j,z=t.titleOffset,O=void 0===z?h.titleOffset:z,w="column"===u?[].concat(r.domain()).reverse():r.domain(),X=e.scaleLinear().domain(w);2===w.length?X.range([0,s]):3===w.length&&X.range([0,s/2,s]),o="thresholds"in r?[w[0]].concat(r.thresholds(),[w[1]]):Array.isArray(l)?l:r.ticks(l);var Y,B,L,H,E,T,F=n.computeContinuousColorScaleColorStops(r,32),M=i.getValueFormatter(C),P=[],q=0,D=0;if("row"===u){var V,R,G;Y=s,B=d,D=1;var I;E=0,L="start"===W?0:"middle"===W?s/2:s,"before"===m?(V=-x,R=k?d:0,G=-x-y,I="alphabetic",H=d+O,T="hanging"):(V=k?0:d,G=(R=d+x)+y,I="hanging",H=-O,T="alphabetic"),o.forEach((function(t){var e=X(t);P.push({x1:e,y1:V,x2:e,y2:R,text:M(t),textX:e,textY:G,textHorizontalAlign:"middle",textVerticalAlign:I})}))}else{var N,Q,_,J;Y=d,B=s,q=1;E=-90,H="start"===W?s:"middle"===W?s/2:0,"before"===m?(Q=k?d:0,_=(N=-x)-y,J="end",L=d+O,T="hanging"):(N=k?0:d,_=(Q=d+x)+y,J="start",L=-O,T="alphabetic"),o.forEach((function(t){var e=X(t);P.push({x1:N,y1:e,x2:Q,y2:e,text:M(t),textX:_,textY:e,textHorizontalAlign:J,textVerticalAlign:"central"})}))}return{width:Y,height:B,gradientX1:0,gradientY1:q,gradientX2:D,gradientY2:0,colorStops:F,ticks:P,titleText:A,titleX:L,titleY:H,titleRotation:E,titleHorizontalAlign:W,titleVerticalAlign:T}},p=function(e){var n=e.scale,r=e.ticks,l=e.length,a=void 0===l?h.length:l,s=e.thickness,c=void 0===s?h.thickness:s,d=e.direction,u=void 0===d?h.direction:d,f=e.tickPosition,m=void 0===f?h.tickPosition:f,v=e.tickSize,p=void 0===v?h.tickSize:v,y=e.tickSpacing,b=void 0===y?h.tickSpacing:y,k=e.tickOverlap,S=void 0===k?h.tickOverlap:k,C=e.tickFormat,A=void 0===C?h.tickFormat:C,j=e.title,W=e.titleAlign,z=void 0===W?h.titleAlign:W,O=e.titleOffset,w=x({scale:n,ticks:r,length:a,thickness:c,direction:u,tickPosition:m,tickSize:p,tickSpacing:b,tickOverlap:S,tickFormat:A,title:j,titleAlign:z,titleOffset:void 0===O?h.titleOffset:O}),X=w.width,Y=w.height,B=w.gradientX1,L=w.gradientY1,H=w.gradientX2,E=w.gradientY2,T=w.ticks,F=w.colorStops,M=w.titleText,P=w.titleX,q=w.titleY,D=w.titleRotation,V=w.titleVerticalAlign,R=w.titleHorizontalAlign,G=i.useTheme(),I="ContinuousColorsLegendSvgGradient."+u+"."+F.map((function(t){return t.offset})).join("_");return t.jsxs("g",{children:[t.jsx("defs",{children:t.jsx("linearGradient",{id:I,x1:B,y1:L,x2:H,y2:E,children:F.map((function(e){return t.jsx("stop",g({},e))}))})}),M&&t.jsx("text",{transform:"translate("+P+", "+q+") rotate("+D+")",textAnchor:R,dominantBaseline:V,style:G.legends.title.text,children:M}),t.jsx("rect",{width:X,height:Y,fill:"url(#"+I}),T.map((function(e,i){return t.jsxs(o.Fragment,{children:[t.jsx("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,style:G.legends.ticks.line}),t.jsx("text",{x:e.textX,y:e.textY,textAnchor:e.textHorizontalAlign,dominantBaseline:e.textVerticalAlign,style:G.legends.ticks.text,children:e.text})]},i)}))]})},y=["containerWidth","containerHeight","anchor","translateX","translateY","length","thickness","direction"],b={circle:a,diamond:s,square:c,triangle:d},k=function(e){var n,r,a,s,c,d,h,u,f,m,x,p=e.x,y=e.y,k=e.width,S=e.height,C=e.data,A=e.direction,j=void 0===A?"left-to-right":A,W=e.justify,z=void 0!==W&&W,O=e.textColor,w=e.background,X=void 0===w?"transparent":w,Y=e.opacity,B=void 0===Y?1:Y,L=e.symbolShape,H=void 0===L?"square":L,E=e.symbolSize,T=void 0===E?16:E,F=e.symbolSpacing,M=void 0===F?8:F,P=e.symbolBorderWidth,q=void 0===P?0:P,D=e.symbolBorderColor,V=void 0===D?"transparent":D,R=e.onClick,G=e.onMouseEnter,I=e.onMouseLeave,N=e.toggleSerie,Q=e.effects,_=o.useState({}),J=_[0],K=_[1],U=i.useTheme(),Z=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"===t.on})).reduce((function(t,e){return g({},t,e.style)}),{});K(e)}null==G||G(C,t)}),[G,C,Q]),$=o.useCallback((function(t){if(Q){var e=Q.filter((function(t){return"hover"!==t.on})).reduce((function(t,e){return g({},t,e.style)}),{});K(e)}null==I||I(C,t)}),[I,C,Q]),tt=v({direction:j,justify:z,symbolSize:null!=(n=J.symbolSize)?n:T,symbolSpacing:M,width:k,height:S}),et=tt.symbolX,it=tt.symbolY,nt=tt.labelX,ot=tt.labelY,rt=tt.labelAnchor,lt=tt.labelAlignment,at=[R,G,I,N].some((function(t){return void 0!==t})),st="function"==typeof H?H:b[H];return t.jsxs("g",{transform:"translate("+p+","+y+")",style:{opacity:null!=(r=J.itemOpacity)?r:B},children:[t.jsx("rect",{width:k,height:S,fill:null!=(a=J.itemBackground)?a:X,style:{cursor:at?"pointer":"auto"},onClick:function(t){null==R||R(C,t),null==N||N(C.id)},onMouseEnter:Z,onMouseLeave:$}),l.createElement(st,g({id:C.id,x:et,y:it,size:null!=(s=J.symbolSize)?s:T,fill:null!=(c=null!=(d=C.fill)?d:C.color)?c:"black",borderWidth:null!=(h=J.symbolBorderWidth)?h:q,borderColor:null!=(u=J.symbolBorderColor)?u:V},C.hidden?U.legends.hidden.symbol:void 0)),t.jsx("text",{textAnchor:rt,style:g({},i.sanitizeSvgTextStyle(U.legends.text),{fill:null!=(f=null!=(m=null!=(x=J.itemTextColor)?x:O)?m:U.legends.text.fill)?f:"black",dominantBaseline:lt,pointerEvents:"none",userSelect:"none"},C.hidden?U.legends.hidden.text:void 0),x:nt,y:ot,children:C.label})]})},S=function(e){var i=e.data,n=e.x,o=e.y,r=e.direction,l=e.padding,a=void 0===l?0:l,s=e.justify,c=e.effects,d=e.itemWidth,g=e.itemHeight,h=e.itemDirection,u=void 0===h?"left-to-right":h,m=e.itemsSpacing,v=void 0===m?0:m,x=e.itemTextColor,p=e.itemBackground,y=void 0===p?"transparent":p,b=e.itemOpacity,S=void 0===b?1:b,C=e.symbolShape,A=e.symbolSize,j=e.symbolSpacing,W=e.symbolBorderWidth,z=e.symbolBorderColor,O=e.onClick,w=e.onMouseEnter,X=e.onMouseLeave,Y=e.toggleSerie,B=f({itemCount:i.length,itemWidth:d,itemHeight:g,itemsSpacing:v,direction:r,padding:a}).padding,L="row"===r?d+v:0,H="column"===r?g+v:0;return t.jsx("g",{transform:"translate("+n+","+o+")",children:i.map((function(e,i){return t.jsx(k,{data:e,x:i*L+B.left,y:i*H+B.top,width:d,height:g,direction:u,justify:s,effects:c,textColor:x,background:y,opacity:S,symbolShape:C,symbolSize:A,symbolSpacing:j,symbolBorderWidth:W,symbolBorderColor:z,onClick:O,onMouseEnter:w,onMouseLeave:X,toggleSerie:Y},i)}))})},C={start:"left",middle:"center",end:"right"};exports.AnchoredContinuousColorsLegendSvg=function(e){var i,n,o=e.containerWidth,r=e.containerHeight,l=e.anchor,a=e.translateX,s=void 0===a?0:a,c=e.translateY,d=void 0===c?0:c,u=e.length,f=void 0===u?h.length:u,v=e.thickness,x=void 0===v?h.thickness:v,b=e.direction,k=void 0===b?h.direction:b,S=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(e,y);"row"===k?(i=f,n=x):(i=x,n=f);var C=m({anchor:l,translateX:s,translateY:d,containerWidth:o,containerHeight:r,width:i,height:n}),A=C.x,j=C.y;return t.jsx("g",{transform:"translate("+A+", "+j+")",children:t.jsx(p,g({length:f,thickness:x,direction:k},S))})},exports.BoxLegendSvg=function(e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,v=e.itemsSpacing,x=void 0===v?0:v,p=e.itemWidth,y=e.itemHeight,b=e.itemDirection,k=e.itemTextColor,C=e.itemBackground,A=e.itemOpacity,j=e.symbolShape,W=e.symbolSize,z=e.symbolSpacing,O=e.symbolBorderWidth,w=e.symbolBorderColor,X=e.onClick,Y=e.onMouseEnter,B=e.onMouseLeave,L=e.toggleSerie,H=e.effects,E=f({itemCount:i.length,itemsSpacing:x,itemWidth:p,itemHeight:y,direction:d,padding:h}),T=E.width,F=E.height,M=m({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:T,height:F}),P=M.x,q=M.y;return t.jsx(S,{data:i,x:P,y:q,direction:d,padding:h,justify:u,effects:H,itemsSpacing:x,itemWidth:p,itemHeight:y,itemDirection:b,itemTextColor:k,itemBackground:C,itemOpacity:A,symbolShape:j,symbolSize:W,symbolSpacing:z,symbolBorderWidth:O,symbolBorderColor:w,onClick:X,onMouseEnter:Y,onMouseLeave:B,toggleSerie:"boolean"==typeof L?void 0:L})},exports.ContinuousColorsLegendSvg=p,exports.LegendSvg=S,exports.LegendSvgItem=k,exports.SymbolCircle=a,exports.SymbolDiamond=s,exports.SymbolSquare=c,exports.SymbolTriangle=d,exports.computeContinuousColorsLegend=x,exports.computeDimensions=f,exports.computeItemLayout=v,exports.computePositionFromAnchor=m,exports.continuousColorsLegendDefaults=h,exports.renderContinuousColorLegendToCanvas=function(t,e){var n=e.containerWidth,o=e.containerHeight,r=e.anchor,l=e.translateX,a=void 0===l?0:l,s=e.translateY,c=void 0===s?0:s,d=e.scale,g=e.length,u=void 0===g?h.length:g,f=e.thickness,v=void 0===f?h.thickness:f,p=e.direction,y=void 0===p?h.direction:p,b=e.ticks,k=e.tickPosition,S=void 0===k?h.tickPosition:k,C=e.tickSize,A=void 0===C?h.tickSize:C,j=e.tickSpacing,W=void 0===j?h.tickSpacing:j,z=e.tickOverlap,O=void 0===z?h.tickOverlap:z,w=e.tickFormat,X=void 0===w?h.tickFormat:w,Y=e.title,B=e.titleAlign,L=void 0===B?h.titleAlign:B,H=e.titleOffset,E=void 0===H?h.titleOffset:H,T=e.theme,F=x({scale:d,ticks:b,length:u,thickness:v,direction:y,tickPosition:S,tickSize:A,tickSpacing:W,tickOverlap:O,tickFormat:X,title:Y,titleAlign:L,titleOffset:E}),M=F.width,P=F.height,q=F.gradientX1,D=F.gradientY1,V=F.gradientX2,R=F.gradientY2,G=F.colorStops,I=F.ticks,N=F.titleText,Q=F.titleX,_=F.titleY,J=F.titleRotation,K=F.titleVerticalAlign,U=F.titleHorizontalAlign,Z=m({anchor:r,translateX:a,translateY:c,containerWidth:n,containerHeight:o,width:M,height:P}),$=Z.x,tt=Z.y,et={font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline};t.save(),t.translate($,tt);var it=t.createLinearGradient(q*M,D*P,V*M,R*P);G.forEach((function(t){it.addColorStop(t.offset,t.stopColor)})),t.fillStyle=it,t.fillRect(0,0,M,P),t.font=(T.legends.ticks.text.fontWeight?T.legends.ticks.text.fontWeight+" ":"")+T.legends.ticks.text.fontSize+"px "+T.legends.ticks.text.fontFamily,I.forEach((function(e){var i;(null!=(i=T.legends.ticks.line.strokeWidth)?i:0)>0&&(t.lineWidth=Number(T.axis.ticks.line.strokeWidth),T.axis.ticks.line.stroke&&(t.strokeStyle=T.axis.ticks.line.stroke),t.lineCap="square",t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),T.legends.ticks.text.fill&&(t.fillStyle=T.legends.ticks.text.fill),t.textAlign="middle"===e.textHorizontalAlign?"center":e.textHorizontalAlign,t.textBaseline="central"===e.textVerticalAlign?"middle":e.textVerticalAlign,t.fillText(e.text,e.textX,e.textY)})),N&&(t.save(),t.translate(Q,_),t.rotate(i.degreesToRadians(J)),t.font=(T.legends.title.text.fontWeight?T.legends.title.text.fontWeight+" ":"")+T.legends.title.text.fontSize+"px "+T.legends.title.text.fontFamily,T.legends.title.text.fill&&(t.fillStyle=T.legends.title.text.fill),t.textAlign="middle"===U?"center":U,t.textBaseline=K,t.fillText(N,0,0),t.restore()),t.restore(),t.font=et.font,t.textAlign=et.textAlign,t.textBaseline=et.textBaseline},exports.renderLegendToCanvas=function(t,e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,s=void 0===a?0:a,c=e.anchor,d=e.direction,g=e.padding,h=void 0===g?0:g,u=e.justify,x=void 0!==u&&u,p=e.itemsSpacing,y=void 0===p?0:p,b=e.itemWidth,k=e.itemHeight,S=e.itemDirection,A=void 0===S?"left-to-right":S,j=e.itemTextColor,W=e.symbolSize,z=void 0===W?16:W,O=e.symbolSpacing,w=void 0===O?8:O,X=e.theme,Y=f({itemCount:i.length,itemWidth:b,itemHeight:k,itemsSpacing:y,direction:d,padding:h}),B=Y.width,L=Y.height,H=Y.padding,E=m({anchor:c,translateX:l,translateY:s,containerWidth:n,containerHeight:o,width:B,height:L}),T=E.x,F=E.y,M="row"===d?b+y:0,P="column"===d?k+y:0;t.save(),t.translate(T,F),t.font=X.legends.text.fontSize+"px "+(X.legends.text.fontFamily||"sans-serif"),i.forEach((function(e,i){var n,o,r=i*M+H.left,l=i*P+H.top,a=v({direction:A,justify:x,symbolSize:z,symbolSpacing:w,width:b,height:k}),s=a.symbolX,c=a.symbolY,d=a.labelX,g=a.labelY,h=a.labelAnchor,u=a.labelAlignment;t.fillStyle=null!=(n=e.color)?n:"black",t.fillRect(r+s,l+c,z,z),t.textAlign=C[h],"central"===u&&(t.textBaseline="middle"),t.fillStyle=null!=(o=null!=j?j:X.legends.text.fill)?o:"black",t.fillText(String(e.label),r+d,l+g)})),t.restore()},exports.useQuantizeColorScaleLegendData=function(t){var e=t.scale,i=t.domain,n=t.reverse,r=void 0!==n&&n,l=t.valueFormat,a=void 0===l?function(t){return t}:l,s=t.separator,c=void 0===s?" - ":s;return o.useMemo((function(){var t=(null!=i?i:e.range()).map((function(t,i){var n=e.invertExtent(t),o=n[0],r=n[1];return{id:t,index:i,extent:[o,r],label:""+a(o)+c+a(r),value:e(o),color:t}}));return r&&t.reverse(),t}),[i,e,r,c,a])}; | ||
//# sourceMappingURL=nivo-legends.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{scaleLinear as i}from"d3-scale";import{getValueFormatter as n,useTheme as o,degreesToRadians as r}from"@nivo/core";import{computeContinuousColorScaleColorStops as l}from"@nivo/colors";import*as a from"react";import{Fragment as c,useState as s,useCallback as d,useMemo as h}from"react";import g from"prop-types";var m=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,s=void 0===c?0:c,d=e.borderColor;return t("circle",{r:o/2,cx:i+o/2,cy:n+o/2,fill:r,opacity:a,strokeWidth:s,stroke:void 0===d?"transparent":d,style:{pointerEvents:"none"}})},f=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,s=void 0===c?0:c,d=e.borderColor;return t("g",{transform:"translate("+i+","+n+")",children:t("path",{d:"\n M"+o/2+" 0\n L"+.8*o+" "+o/2+"\n L"+o/2+" "+o+"\n L"+.2*o+" "+o/2+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:s,stroke:void 0===d?"transparent":d,style:{pointerEvents:"none"}})})},u=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,s=void 0===c?0:c,d=e.borderColor;return t("rect",{x:i,y:n,fill:r,opacity:a,strokeWidth:s,stroke:void 0===d?"transparent":d,width:o,height:o,style:{pointerEvents:"none"}})},v=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,s=void 0===c?0:c,d=e.borderColor;return t("g",{transform:"translate("+i+","+n+")",children:t("path",{d:"\n M"+o/2+" 0\n L"+o+" "+o+"\n L0 "+o+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:s,stroke:void 0===d?"transparent":d,style:{pointerEvents:"none"}})})};function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},p.apply(this,arguments)}var y={length:200,thickness:16,direction:"row",tickPosition:"after",tickSize:4,tickSpacing:3,tickOverlap:!1,tickFormat:function(t){return""+t},titleAlign:"start",titleOffset:4},b={top:0,right:0,bottom:0,left:0},k=function(t){var e,i=t.direction,n=t.itemsSpacing,o=t.padding,r=t.itemCount,l=t.itemWidth,a=t.itemHeight;if("number"!=typeof o&&("object"!=typeof(e=o)||Array.isArray(e)||null===e))throw new Error("Invalid property padding, must be one of: number, object");var c="number"==typeof o?{top:o,right:o,bottom:o,left:o}:p({},b,o),s=c.left+c.right,d=c.top+c.bottom,h=l+s,g=a+d,m=(r-1)*n;return"row"===i?h=l*r+m+s:"column"===i&&(g=a*r+m+d),{width:h,height:g,padding:c}},x=function(t){var e=t.anchor,i=t.translateX,n=t.translateY,o=t.containerWidth,r=t.containerHeight,l=t.width,a=t.height,c=i,s=n;switch(e){case"top":c+=(o-l)/2;break;case"top-right":c+=o-l;break;case"right":c+=o-l,s+=(r-a)/2;break;case"bottom-right":c+=o-l,s+=r-a;break;case"bottom":c+=(o-l)/2,s+=r-a;break;case"bottom-left":s+=r-a;break;case"left":s+=(r-a)/2;break;case"center":c+=(o-l)/2,s+=(r-a)/2}return{x:c,y:s}},S=function(t){var e,i,n,o,r,l,a=t.direction,c=t.justify,s=t.symbolSize,d=t.symbolSpacing,h=t.width,g=t.height;switch(a){case"left-to-right":e=0,i=(g-s)/2,o=g/2,l="central",c?(n=h,r="end"):(n=s+d,r="start");break;case"right-to-left":e=h-s,i=(g-s)/2,o=g/2,l="central",c?(n=0,r="start"):(n=h-s-d,r="end");break;case"top-to-bottom":e=(h-s)/2,i=0,n=h/2,r="middle",c?(o=g,l="alphabetic"):(o=s+d,l="text-before-edge");break;case"bottom-to-top":e=(h-s)/2,i=g-s,n=h/2,r="middle",c?(o=0,l="text-before-edge"):(o=g-s-d,l="alphabetic")}return{symbolX:e,symbolY:i,labelX:n,labelY:o,labelAnchor:r,labelAlignment:l}},A=function(t){var e,o=t.scale,r=t.ticks,a=t.length,c=void 0===a?y.length:a,s=t.thickness,d=void 0===s?y.thickness:s,h=t.direction,g=void 0===h?y.direction:h,m=t.tickPosition,f=void 0===m?y.tickPosition:m,u=t.tickSize,v=void 0===u?y.tickSize:u,p=t.tickSpacing,b=void 0===p?y.tickSpacing:p,k=t.tickOverlap,x=void 0===k?y.tickOverlap:k,S=t.tickFormat,A=void 0===S?y.tickFormat:S,W=t.title,O=t.titleAlign,z=void 0===O?y.titleAlign:O,C=t.titleOffset,B=void 0===C?y.titleOffset:C,w="column"===g?[].concat(o.domain()).reverse():o.domain(),X=i().domain(w);2===w.length?X.range([0,c]):3===w.length&&X.range([0,c/2,c]),e="thresholds"in o?[w[0]].concat(o.thresholds(),[w[1]]):Array.isArray(r)?r:o.ticks(r);var Y,H,E,j,T,L,M=l(o,32),F=n(A),P=[],R=0,q=0;if("row"===g){var V,D,G;Y=c,H=d,q=1;var I;T=0,E="start"===z?0:"middle"===z?c/2:c,"before"===f?(V=-v,D=x?d:0,G=-v-b,I="alphabetic",j=d+B,L="hanging"):(V=x?0:d,G=(D=d+v)+b,I="hanging",j=-B,L="alphabetic"),e.forEach((function(t){var e=X(t);P.push({x1:e,y1:V,x2:e,y2:D,text:F(t),textX:e,textY:G,textHorizontalAlign:"middle",textVerticalAlign:I})}))}else{var N,_,J,K;Y=d,H=c,R=1;T=-90,j="start"===z?c:"middle"===z?c/2:0,"before"===f?(_=x?d:0,J=(N=-v)-b,K="end",E=d+B,L="hanging"):(N=x?0:d,J=(_=d+v)+b,K="start",E=-B,L="alphabetic"),e.forEach((function(t){var e=X(t);P.push({x1:N,y1:e,x2:_,y2:e,text:F(t),textX:J,textY:e,textHorizontalAlign:K,textVerticalAlign:"central"})}))}return{width:Y,height:H,gradientX1:0,gradientY1:R,gradientX2:q,gradientY2:0,colorStops:M,ticks:P,titleText:W,titleX:E,titleY:j,titleRotation:T,titleHorizontalAlign:z,titleVerticalAlign:L}},W=function(i){var n=i.scale,r=i.ticks,l=i.length,a=void 0===l?y.length:l,s=i.thickness,d=void 0===s?y.thickness:s,h=i.direction,g=void 0===h?y.direction:h,m=i.tickPosition,f=void 0===m?y.tickPosition:m,u=i.tickSize,v=void 0===u?y.tickSize:u,b=i.tickSpacing,k=void 0===b?y.tickSpacing:b,x=i.tickOverlap,S=void 0===x?y.tickOverlap:x,W=i.tickFormat,O=void 0===W?y.tickFormat:W,z=i.title,C=i.titleAlign,B=void 0===C?y.titleAlign:C,w=i.titleOffset,X=A({scale:n,ticks:r,length:a,thickness:d,direction:g,tickPosition:f,tickSize:v,tickSpacing:k,tickOverlap:S,tickFormat:O,title:z,titleAlign:B,titleOffset:void 0===w?y.titleOffset:w}),Y=X.width,H=X.height,E=X.gradientX1,j=X.gradientY1,T=X.gradientX2,L=X.gradientY2,M=X.ticks,F=X.colorStops,P=X.titleText,R=X.titleX,q=X.titleY,V=X.titleRotation,D=X.titleVerticalAlign,G=X.titleHorizontalAlign,I=o(),N="ContinuousColorsLegendSvgGradient."+g+"."+F.map((function(t){return t.offset})).join("_");return e("g",{children:[t("defs",{children:t("linearGradient",{id:N,x1:E,y1:j,x2:T,y2:L,children:F.map((function(e){return t("stop",p({},e))}))})}),P&&t("text",{transform:"translate("+R+", "+q+") rotate("+V+")",textAnchor:G,dominantBaseline:D,style:I.legends.title.text,children:P}),t("rect",{width:Y,height:H,fill:"url(#"+N}),M.map((function(i,n){return e(c,{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,style:I.legends.ticks.line}),t("text",{x:i.textX,y:i.textY,textAnchor:i.textHorizontalAlign,dominantBaseline:i.textVerticalAlign,style:I.legends.ticks.text,children:i.text})]},n)}))]})},O=["containerWidth","containerHeight","anchor","translateX","translateY","length","thickness","direction"],z=function(e){var i,n,o=e.containerWidth,r=e.containerHeight,l=e.anchor,a=e.translateX,c=void 0===a?0:a,s=e.translateY,d=void 0===s?0:s,h=e.length,g=void 0===h?y.length:h,m=e.thickness,f=void 0===m?y.thickness:m,u=e.direction,v=void 0===u?y.direction:u,b=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(e,O);"row"===v?(i=g,n=f):(i=f,n=g);var k=x({anchor:l,translateX:c,translateY:d,containerWidth:o,containerHeight:r,width:i,height:n}),S=k.x,A=k.y;return t("g",{transform:"translate("+S+", "+A+")",children:t(W,p({length:g,thickness:f,direction:v},b))})},C={circle:m,diamond:f,square:u,triangle:v},B=function(i){var n,r,l,c,h,g,m,f,u,v,y,b=i.x,k=i.y,x=i.width,A=i.height,W=i.data,O=i.direction,z=void 0===O?"left-to-right":O,B=i.justify,w=void 0!==B&&B,X=i.textColor,Y=i.background,H=void 0===Y?"transparent":Y,E=i.opacity,j=void 0===E?1:E,T=i.symbolShape,L=void 0===T?"square":T,M=i.symbolSize,F=void 0===M?16:M,P=i.symbolSpacing,R=void 0===P?8:P,q=i.symbolBorderWidth,V=void 0===q?0:q,D=i.symbolBorderColor,G=void 0===D?"transparent":D,I=i.onClick,N=i.onMouseEnter,_=i.onMouseLeave,J=i.toggleSerie,K=i.effects,Q=s({}),U=Q[0],Z=Q[1],$=o(),tt=d((function(t){if(K){var e=K.filter((function(t){return"hover"===t.on})).reduce((function(t,e){return p({},t,e.style)}),{});Z(e)}null==N||N(W,t)}),[N,W,K]),et=d((function(t){if(K){var e=K.filter((function(t){return"hover"!==t.on})).reduce((function(t,e){return p({},t,e.style)}),{});Z(e)}null==_||_(W,t)}),[_,W,K]),it=S({direction:z,justify:w,symbolSize:null!=(n=U.symbolSize)?n:F,symbolSpacing:R,width:x,height:A}),nt=it.symbolX,ot=it.symbolY,rt=it.labelX,lt=it.labelY,at=it.labelAnchor,ct=it.labelAlignment,st=[I,N,_,J].some((function(t){return void 0!==t})),dt="function"==typeof L?L:C[L];return e("g",{transform:"translate("+b+","+k+")",style:{opacity:null!=(r=U.itemOpacity)?r:j},children:[t("rect",{width:x,height:A,fill:null!=(l=U.itemBackground)?l:H,style:{cursor:st?"pointer":"auto"},onClick:function(t){null==I||I(W,t),null==J||J(W.id)},onMouseEnter:tt,onMouseLeave:et}),a.createElement(dt,p({id:W.id,x:nt,y:ot,size:null!=(c=U.symbolSize)?c:F,fill:null!=(h=null!=(g=W.fill)?g:W.color)?h:"black",borderWidth:null!=(m=U.symbolBorderWidth)?m:V,borderColor:null!=(f=U.symbolBorderColor)?f:G},W.hidden?$.legends.hidden.symbol:void 0)),t("text",{textAnchor:at,style:p({},$.legends.text,{fill:null!=(u=null!=(v=null!=(y=U.itemTextColor)?y:X)?v:$.legends.text.fill)?u:"black",dominantBaseline:ct,pointerEvents:"none",userSelect:"none"},W.hidden?$.legends.hidden.text:void 0),x:rt,y:lt,children:W.label})]})},w=function(e){var i=e.data,n=e.x,o=e.y,r=e.direction,l=e.padding,a=void 0===l?0:l,c=e.justify,s=e.effects,d=e.itemWidth,h=e.itemHeight,g=e.itemDirection,m=void 0===g?"left-to-right":g,f=e.itemsSpacing,u=void 0===f?0:f,v=e.itemTextColor,p=e.itemBackground,y=void 0===p?"transparent":p,b=e.itemOpacity,x=void 0===b?1:b,S=e.symbolShape,A=e.symbolSize,W=e.symbolSpacing,O=e.symbolBorderWidth,z=e.symbolBorderColor,C=e.onClick,w=e.onMouseEnter,X=e.onMouseLeave,Y=e.toggleSerie,H=k({itemCount:i.length,itemWidth:d,itemHeight:h,itemsSpacing:u,direction:r,padding:a}).padding,E="row"===r?d+u:0,j="column"===r?h+u:0;return t("g",{transform:"translate("+n+","+o+")",children:i.map((function(e,i){return t(B,{data:e,x:i*E+H.left,y:i*j+H.top,width:d,height:h,direction:m,justify:c,effects:s,textColor:v,background:y,opacity:x,symbolShape:S,symbolSize:A,symbolSpacing:W,symbolBorderWidth:O,symbolBorderColor:z,onClick:C,onMouseEnter:w,onMouseLeave:X,toggleSerie:Y},i)}))})},X=function(e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,c=void 0===a?0:a,s=e.anchor,d=e.direction,h=e.padding,g=void 0===h?0:h,m=e.justify,f=e.itemsSpacing,u=void 0===f?0:f,v=e.itemWidth,p=e.itemHeight,y=e.itemDirection,b=e.itemTextColor,S=e.itemBackground,A=e.itemOpacity,W=e.symbolShape,O=e.symbolSize,z=e.symbolSpacing,C=e.symbolBorderWidth,B=e.symbolBorderColor,X=e.onClick,Y=e.onMouseEnter,H=e.onMouseLeave,E=e.toggleSerie,j=e.effects,T=k({itemCount:i.length,itemsSpacing:u,itemWidth:v,itemHeight:p,direction:d,padding:g}),L=T.width,M=T.height,F=x({anchor:s,translateX:l,translateY:c,containerWidth:n,containerHeight:o,width:L,height:M}),P=F.x,R=F.y;return t(w,{data:i,x:P,y:R,direction:d,padding:g,justify:m,effects:j,itemsSpacing:u,itemWidth:v,itemHeight:p,itemDirection:y,itemTextColor:b,itemBackground:S,itemOpacity:A,symbolShape:W,symbolSize:O,symbolSpacing:z,symbolBorderWidth:C,symbolBorderColor:B,onClick:X,onMouseEnter:Y,onMouseLeave:H,toggleSerie:"boolean"==typeof E?void 0:E})},Y={start:"left",middle:"center",end:"right"},H=function(t,e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,c=void 0===a?0:a,s=e.anchor,d=e.direction,h=e.padding,g=void 0===h?0:h,m=e.justify,f=void 0!==m&&m,u=e.itemsSpacing,v=void 0===u?0:u,p=e.itemWidth,y=e.itemHeight,b=e.itemDirection,A=void 0===b?"left-to-right":b,W=e.itemTextColor,O=e.symbolSize,z=void 0===O?16:O,C=e.symbolSpacing,B=void 0===C?8:C,w=e.theme,X=k({itemCount:i.length,itemWidth:p,itemHeight:y,itemsSpacing:v,direction:d,padding:g}),H=X.width,E=X.height,j=X.padding,T=x({anchor:s,translateX:l,translateY:c,containerWidth:n,containerHeight:o,width:H,height:E}),L=T.x,M=T.y,F="row"===d?p+v:0,P="column"===d?y+v:0;t.save(),t.translate(L,M),t.font=w.legends.text.fontSize+"px "+(w.legends.text.fontFamily||"sans-serif"),i.forEach((function(e,i){var n,o,r=i*F+j.left,l=i*P+j.top,a=S({direction:A,justify:f,symbolSize:z,symbolSpacing:B,width:p,height:y}),c=a.symbolX,s=a.symbolY,d=a.labelX,h=a.labelY,g=a.labelAnchor,m=a.labelAlignment;t.fillStyle=null!=(n=e.color)?n:"black",t.fillRect(r+c,l+s,z,z),t.textAlign=Y[g],"central"===m&&(t.textBaseline="middle"),t.fillStyle=null!=(o=null!=W?W:w.legends.text.fill)?o:"black",t.fillText(String(e.label),r+d,l+h)})),t.restore()},E=function(t,e){var i=e.containerWidth,n=e.containerHeight,o=e.anchor,l=e.translateX,a=void 0===l?0:l,c=e.translateY,s=void 0===c?0:c,d=e.scale,h=e.length,g=void 0===h?y.length:h,m=e.thickness,f=void 0===m?y.thickness:m,u=e.direction,v=void 0===u?y.direction:u,p=e.ticks,b=e.tickPosition,k=void 0===b?y.tickPosition:b,S=e.tickSize,W=void 0===S?y.tickSize:S,O=e.tickSpacing,z=void 0===O?y.tickSpacing:O,C=e.tickOverlap,B=void 0===C?y.tickOverlap:C,w=e.tickFormat,X=void 0===w?y.tickFormat:w,Y=e.title,H=e.titleAlign,E=void 0===H?y.titleAlign:H,j=e.titleOffset,T=void 0===j?y.titleOffset:j,L=e.theme,M=A({scale:d,ticks:p,length:g,thickness:f,direction:v,tickPosition:k,tickSize:W,tickSpacing:z,tickOverlap:B,tickFormat:X,title:Y,titleAlign:E,titleOffset:T}),F=M.width,P=M.height,R=M.gradientX1,q=M.gradientY1,V=M.gradientX2,D=M.gradientY2,G=M.colorStops,I=M.ticks,N=M.titleText,_=M.titleX,J=M.titleY,K=M.titleRotation,Q=M.titleVerticalAlign,U=M.titleHorizontalAlign,Z=x({anchor:o,translateX:a,translateY:s,containerWidth:i,containerHeight:n,width:F,height:P}),$=Z.x,tt=Z.y,et={font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline};t.save(),t.translate($,tt);var it=t.createLinearGradient(R*F,q*P,V*F,D*P);G.forEach((function(t){it.addColorStop(t.offset,t.stopColor)})),t.fillStyle=it,t.fillRect(0,0,F,P),t.font=(L.legends.ticks.text.fontWeight?L.legends.ticks.text.fontWeight+" ":"")+L.legends.ticks.text.fontSize+"px "+L.legends.ticks.text.fontFamily,I.forEach((function(e){var i;(null!=(i=L.legends.ticks.line.strokeWidth)?i:0)>0&&(t.lineWidth=Number(L.axis.ticks.line.strokeWidth),L.axis.ticks.line.stroke&&(t.strokeStyle=L.axis.ticks.line.stroke),t.lineCap="square",t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),L.legends.ticks.text.fill&&(t.fillStyle=L.legends.ticks.text.fill),t.textAlign="middle"===e.textHorizontalAlign?"center":e.textHorizontalAlign,t.textBaseline="central"===e.textVerticalAlign?"middle":e.textVerticalAlign,t.fillText(e.text,e.textX,e.textY)})),N&&(t.save(),t.translate(_,J),t.rotate(r(K)),t.font=(L.legends.title.text.fontWeight?L.legends.title.text.fontWeight+" ":"")+L.legends.title.text.fontSize+"px "+L.legends.title.text.fontFamily,L.legends.title.text.fill&&(t.fillStyle=L.legends.title.text.fill),t.textAlign="middle"===U?"center":U,t.textBaseline=Q,t.fillText(N,0,0),t.restore()),t.restore(),t.font=et.font,t.textAlign=et.textAlign,t.textBaseline=et.textBaseline},j=function(t){var e=t.scale,i=t.domain,n=t.reverse,o=void 0!==n&&n,r=t.valueFormat,l=void 0===r?function(t){return t}:r,a=t.separator,c=void 0===a?" - ":a;return h((function(){var t=(null!=i?i:e.range()).map((function(t,i){var n=e.invertExtent(t),o=n[0],r=n[1];return{id:t,index:i,extent:[o,r],label:""+l(o)+c+l(r),value:e(o),color:t}}));return o&&t.reverse(),t}),[i,e,o,c,l])},T={data:g.arrayOf(g.object),anchor:g.oneOf(["top","top-right","right","bottom-right","bottom","bottom-left","left","top-left","center"]).isRequired,translateX:g.number,translateY:g.number,direction:g.oneOf(["row","column"]).isRequired,itemsSpacing:g.number,itemWidth:g.number.isRequired,itemHeight:g.number.isRequired,itemDirection:g.oneOf(["left-to-right","right-to-left","top-to-bottom","bottom-to-top"]),itemTextColor:g.string,itemBackground:g.string,itemOpacity:g.number,symbolShape:g.oneOfType([g.oneOf(["circle","diamond","square","triangle"]),g.func]),symbolSize:g.number,symbolSpacing:g.number,symbolBorderWidth:g.number,symbolBorderColor:g.string,onClick:g.func,onMouseEnter:g.func,onMouseLeave:g.func,effects:g.arrayOf(g.shape({on:g.oneOfType([g.oneOf(["hover"])]).isRequired,style:g.shape({itemTextColor:g.string,itemBackground:g.string,itemOpacity:g.number,symbolSize:g.number,symbolBorderWidth:g.number,symbolBorderColor:g.string}).isRequired}))};export{z as AnchoredContinuousColorsLegendSvg,X as BoxLegendSvg,W as ContinuousColorsLegendSvg,T as LegendPropShape,w as LegendSvg,B as LegendSvgItem,m as SymbolCircle,f as SymbolDiamond,u as SymbolSquare,v as SymbolTriangle,A as computeContinuousColorsLegend,k as computeDimensions,S as computeItemLayout,x as computePositionFromAnchor,y as continuousColorsLegendDefaults,E as renderContinuousColorLegendToCanvas,H as renderLegendToCanvas,j as useQuantizeColorScaleLegendData}; | ||
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{scaleLinear as i}from"d3-scale";import{getValueFormatter as n,useTheme as o,sanitizeSvgTextStyle as r,degreesToRadians as l}from"@nivo/core";import{computeContinuousColorScaleColorStops as a}from"@nivo/colors";import*as c from"react";import{Fragment as d,useState as s,useCallback as h,useMemo as g}from"react";var f=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,d=void 0===c?0:c,s=e.borderColor;return t("circle",{r:o/2,cx:i+o/2,cy:n+o/2,fill:r,opacity:a,strokeWidth:d,stroke:void 0===s?"transparent":s,style:{pointerEvents:"none"}})},m=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,d=void 0===c?0:c,s=e.borderColor;return t("g",{transform:"translate("+i+","+n+")",children:t("path",{d:"\n M"+o/2+" 0\n L"+.8*o+" "+o/2+"\n L"+o/2+" "+o+"\n L"+.2*o+" "+o/2+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:d,stroke:void 0===s?"transparent":s,style:{pointerEvents:"none"}})})},v=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,d=void 0===c?0:c,s=e.borderColor;return t("rect",{x:i,y:n,fill:r,opacity:a,strokeWidth:d,stroke:void 0===s?"transparent":s,width:o,height:o,style:{pointerEvents:"none"}})},u=function(e){var i=e.x,n=e.y,o=e.size,r=e.fill,l=e.opacity,a=void 0===l?1:l,c=e.borderWidth,d=void 0===c?0:c,s=e.borderColor;return t("g",{transform:"translate("+i+","+n+")",children:t("path",{d:"\n M"+o/2+" 0\n L"+o+" "+o+"\n L0 "+o+"\n L"+o/2+" 0\n ",fill:r,opacity:a,strokeWidth:d,stroke:void 0===s?"transparent":s,style:{pointerEvents:"none"}})})};function p(){return p=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},p.apply(this,arguments)}var y={length:200,thickness:16,direction:"row",tickPosition:"after",tickSize:4,tickSpacing:3,tickOverlap:!1,tickFormat:function(t){return""+t},titleAlign:"start",titleOffset:4},k={top:0,right:0,bottom:0,left:0},x=function(t){var e,i=t.direction,n=t.itemsSpacing,o=t.padding,r=t.itemCount,l=t.itemWidth,a=t.itemHeight;if("number"!=typeof o&&("object"!=typeof(e=o)||Array.isArray(e)||null===e))throw new Error("Invalid property padding, must be one of: number, object");var c="number"==typeof o?{top:o,right:o,bottom:o,left:o}:p({},k,o),d=c.left+c.right,s=c.top+c.bottom,h=l+d,g=a+s,f=(r-1)*n;return"row"===i?h=l*r+f+d:"column"===i&&(g=a*r+f+s),{width:h,height:g,padding:c}},b=function(t){var e=t.anchor,i=t.translateX,n=t.translateY,o=t.containerWidth,r=t.containerHeight,l=t.width,a=t.height,c=i,d=n;switch(e){case"top":c+=(o-l)/2;break;case"top-right":c+=o-l;break;case"right":c+=o-l,d+=(r-a)/2;break;case"bottom-right":c+=o-l,d+=r-a;break;case"bottom":c+=(o-l)/2,d+=r-a;break;case"bottom-left":d+=r-a;break;case"left":d+=(r-a)/2;break;case"center":c+=(o-l)/2,d+=(r-a)/2}return{x:c,y:d}},S=function(t){var e,i,n,o,r,l,a=t.direction,c=t.justify,d=t.symbolSize,s=t.symbolSpacing,h=t.width,g=t.height;switch(a){case"left-to-right":e=0,i=(g-d)/2,o=g/2,l="central",c?(n=h,r="end"):(n=d+s,r="start");break;case"right-to-left":e=h-d,i=(g-d)/2,o=g/2,l="central",c?(n=0,r="start"):(n=h-d-s,r="end");break;case"top-to-bottom":e=(h-d)/2,i=0,n=h/2,r="middle",c?(o=g,l="alphabetic"):(o=d+s,l="text-before-edge");break;case"bottom-to-top":e=(h-d)/2,i=g-d,n=h/2,r="middle",c?(o=0,l="text-before-edge"):(o=g-d-s,l="alphabetic")}return{symbolX:e,symbolY:i,labelX:n,labelY:o,labelAnchor:r,labelAlignment:l}},A=function(t){var e,o=t.scale,r=t.ticks,l=t.length,c=void 0===l?y.length:l,d=t.thickness,s=void 0===d?y.thickness:d,h=t.direction,g=void 0===h?y.direction:h,f=t.tickPosition,m=void 0===f?y.tickPosition:f,v=t.tickSize,u=void 0===v?y.tickSize:v,p=t.tickSpacing,k=void 0===p?y.tickSpacing:p,x=t.tickOverlap,b=void 0===x?y.tickOverlap:x,S=t.tickFormat,A=void 0===S?y.tickFormat:S,W=t.title,z=t.titleAlign,C=void 0===z?y.titleAlign:z,w=t.titleOffset,X=void 0===w?y.titleOffset:w,Y="column"===g?[].concat(o.domain()).reverse():o.domain(),O=i().domain(Y);2===Y.length?O.range([0,c]):3===Y.length&&O.range([0,c/2,c]),e="thresholds"in o?[Y[0]].concat(o.thresholds(),[Y[1]]):Array.isArray(r)?r:o.ticks(r);var B,H,E,j,L,M,F=a(o,32),T=n(A),P=[],V=0,R=0;if("row"===g){var D,q,G;B=c,H=s,R=1;var I;L=0,E="start"===C?0:"middle"===C?c/2:c,"before"===m?(D=-u,q=b?s:0,G=-u-k,I="alphabetic",j=s+X,M="hanging"):(D=b?0:s,G=(q=s+u)+k,I="hanging",j=-X,M="alphabetic"),e.forEach((function(t){var e=O(t);P.push({x1:e,y1:D,x2:e,y2:q,text:T(t),textX:e,textY:G,textHorizontalAlign:"middle",textVerticalAlign:I})}))}else{var N,_,J,K;B=s,H=c,V=1;L=-90,j="start"===C?c:"middle"===C?c/2:0,"before"===m?(_=b?s:0,J=(N=-u)-k,K="end",E=s+X,M="hanging"):(N=b?0:s,J=(_=s+u)+k,K="start",E=-X,M="alphabetic"),e.forEach((function(t){var e=O(t);P.push({x1:N,y1:e,x2:_,y2:e,text:T(t),textX:J,textY:e,textHorizontalAlign:K,textVerticalAlign:"central"})}))}return{width:B,height:H,gradientX1:0,gradientY1:V,gradientX2:R,gradientY2:0,colorStops:F,ticks:P,titleText:W,titleX:E,titleY:j,titleRotation:L,titleHorizontalAlign:C,titleVerticalAlign:M}},W=function(i){var n=i.scale,r=i.ticks,l=i.length,a=void 0===l?y.length:l,c=i.thickness,s=void 0===c?y.thickness:c,h=i.direction,g=void 0===h?y.direction:h,f=i.tickPosition,m=void 0===f?y.tickPosition:f,v=i.tickSize,u=void 0===v?y.tickSize:v,k=i.tickSpacing,x=void 0===k?y.tickSpacing:k,b=i.tickOverlap,S=void 0===b?y.tickOverlap:b,W=i.tickFormat,z=void 0===W?y.tickFormat:W,C=i.title,w=i.titleAlign,X=void 0===w?y.titleAlign:w,Y=i.titleOffset,O=A({scale:n,ticks:r,length:a,thickness:s,direction:g,tickPosition:m,tickSize:u,tickSpacing:x,tickOverlap:S,tickFormat:z,title:C,titleAlign:X,titleOffset:void 0===Y?y.titleOffset:Y}),B=O.width,H=O.height,E=O.gradientX1,j=O.gradientY1,L=O.gradientX2,M=O.gradientY2,F=O.ticks,T=O.colorStops,P=O.titleText,V=O.titleX,R=O.titleY,D=O.titleRotation,q=O.titleVerticalAlign,G=O.titleHorizontalAlign,I=o(),N="ContinuousColorsLegendSvgGradient."+g+"."+T.map((function(t){return t.offset})).join("_");return e("g",{children:[t("defs",{children:t("linearGradient",{id:N,x1:E,y1:j,x2:L,y2:M,children:T.map((function(e){return t("stop",p({},e))}))})}),P&&t("text",{transform:"translate("+V+", "+R+") rotate("+D+")",textAnchor:G,dominantBaseline:q,style:I.legends.title.text,children:P}),t("rect",{width:B,height:H,fill:"url(#"+N}),F.map((function(i,n){return e(d,{children:[t("line",{x1:i.x1,y1:i.y1,x2:i.x2,y2:i.y2,style:I.legends.ticks.line}),t("text",{x:i.textX,y:i.textY,textAnchor:i.textHorizontalAlign,dominantBaseline:i.textVerticalAlign,style:I.legends.ticks.text,children:i.text})]},n)}))]})},z=["containerWidth","containerHeight","anchor","translateX","translateY","length","thickness","direction"],C=function(e){var i,n,o=e.containerWidth,r=e.containerHeight,l=e.anchor,a=e.translateX,c=void 0===a?0:a,d=e.translateY,s=void 0===d?0:d,h=e.length,g=void 0===h?y.length:h,f=e.thickness,m=void 0===f?y.thickness:f,v=e.direction,u=void 0===v?y.direction:v,k=function(t,e){if(null==t)return{};var i,n,o={},r=Object.keys(t);for(n=0;n<r.length;n++)i=r[n],e.indexOf(i)>=0||(o[i]=t[i]);return o}(e,z);"row"===u?(i=g,n=m):(i=m,n=g);var x=b({anchor:l,translateX:c,translateY:s,containerWidth:o,containerHeight:r,width:i,height:n}),S=x.x,A=x.y;return t("g",{transform:"translate("+S+", "+A+")",children:t(W,p({length:g,thickness:m,direction:u},k))})},w={circle:f,diamond:m,square:v,triangle:u},X=function(i){var n,l,a,d,g,f,m,v,u,y,k,x=i.x,b=i.y,A=i.width,W=i.height,z=i.data,C=i.direction,X=void 0===C?"left-to-right":C,Y=i.justify,O=void 0!==Y&&Y,B=i.textColor,H=i.background,E=void 0===H?"transparent":H,j=i.opacity,L=void 0===j?1:j,M=i.symbolShape,F=void 0===M?"square":M,T=i.symbolSize,P=void 0===T?16:T,V=i.symbolSpacing,R=void 0===V?8:V,D=i.symbolBorderWidth,q=void 0===D?0:D,G=i.symbolBorderColor,I=void 0===G?"transparent":G,N=i.onClick,_=i.onMouseEnter,J=i.onMouseLeave,K=i.toggleSerie,Q=i.effects,U=s({}),Z=U[0],$=U[1],tt=o(),et=h((function(t){if(Q){var e=Q.filter((function(t){return"hover"===t.on})).reduce((function(t,e){return p({},t,e.style)}),{});$(e)}null==_||_(z,t)}),[_,z,Q]),it=h((function(t){if(Q){var e=Q.filter((function(t){return"hover"!==t.on})).reduce((function(t,e){return p({},t,e.style)}),{});$(e)}null==J||J(z,t)}),[J,z,Q]),nt=S({direction:X,justify:O,symbolSize:null!=(n=Z.symbolSize)?n:P,symbolSpacing:R,width:A,height:W}),ot=nt.symbolX,rt=nt.symbolY,lt=nt.labelX,at=nt.labelY,ct=nt.labelAnchor,dt=nt.labelAlignment,st=[N,_,J,K].some((function(t){return void 0!==t})),ht="function"==typeof F?F:w[F];return e("g",{transform:"translate("+x+","+b+")",style:{opacity:null!=(l=Z.itemOpacity)?l:L},children:[t("rect",{width:A,height:W,fill:null!=(a=Z.itemBackground)?a:E,style:{cursor:st?"pointer":"auto"},onClick:function(t){null==N||N(z,t),null==K||K(z.id)},onMouseEnter:et,onMouseLeave:it}),c.createElement(ht,p({id:z.id,x:ot,y:rt,size:null!=(d=Z.symbolSize)?d:P,fill:null!=(g=null!=(f=z.fill)?f:z.color)?g:"black",borderWidth:null!=(m=Z.symbolBorderWidth)?m:q,borderColor:null!=(v=Z.symbolBorderColor)?v:I},z.hidden?tt.legends.hidden.symbol:void 0)),t("text",{textAnchor:ct,style:p({},r(tt.legends.text),{fill:null!=(u=null!=(y=null!=(k=Z.itemTextColor)?k:B)?y:tt.legends.text.fill)?u:"black",dominantBaseline:dt,pointerEvents:"none",userSelect:"none"},z.hidden?tt.legends.hidden.text:void 0),x:lt,y:at,children:z.label})]})},Y=function(e){var i=e.data,n=e.x,o=e.y,r=e.direction,l=e.padding,a=void 0===l?0:l,c=e.justify,d=e.effects,s=e.itemWidth,h=e.itemHeight,g=e.itemDirection,f=void 0===g?"left-to-right":g,m=e.itemsSpacing,v=void 0===m?0:m,u=e.itemTextColor,p=e.itemBackground,y=void 0===p?"transparent":p,k=e.itemOpacity,b=void 0===k?1:k,S=e.symbolShape,A=e.symbolSize,W=e.symbolSpacing,z=e.symbolBorderWidth,C=e.symbolBorderColor,w=e.onClick,Y=e.onMouseEnter,O=e.onMouseLeave,B=e.toggleSerie,H=x({itemCount:i.length,itemWidth:s,itemHeight:h,itemsSpacing:v,direction:r,padding:a}).padding,E="row"===r?s+v:0,j="column"===r?h+v:0;return t("g",{transform:"translate("+n+","+o+")",children:i.map((function(e,i){return t(X,{data:e,x:i*E+H.left,y:i*j+H.top,width:s,height:h,direction:f,justify:c,effects:d,textColor:u,background:y,opacity:b,symbolShape:S,symbolSize:A,symbolSpacing:W,symbolBorderWidth:z,symbolBorderColor:C,onClick:w,onMouseEnter:Y,onMouseLeave:O,toggleSerie:B},i)}))})},O=function(e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,c=void 0===a?0:a,d=e.anchor,s=e.direction,h=e.padding,g=void 0===h?0:h,f=e.justify,m=e.itemsSpacing,v=void 0===m?0:m,u=e.itemWidth,p=e.itemHeight,y=e.itemDirection,k=e.itemTextColor,S=e.itemBackground,A=e.itemOpacity,W=e.symbolShape,z=e.symbolSize,C=e.symbolSpacing,w=e.symbolBorderWidth,X=e.symbolBorderColor,O=e.onClick,B=e.onMouseEnter,H=e.onMouseLeave,E=e.toggleSerie,j=e.effects,L=x({itemCount:i.length,itemsSpacing:v,itemWidth:u,itemHeight:p,direction:s,padding:g}),M=L.width,F=L.height,T=b({anchor:d,translateX:l,translateY:c,containerWidth:n,containerHeight:o,width:M,height:F}),P=T.x,V=T.y;return t(Y,{data:i,x:P,y:V,direction:s,padding:g,justify:f,effects:j,itemsSpacing:v,itemWidth:u,itemHeight:p,itemDirection:y,itemTextColor:k,itemBackground:S,itemOpacity:A,symbolShape:W,symbolSize:z,symbolSpacing:C,symbolBorderWidth:w,symbolBorderColor:X,onClick:O,onMouseEnter:B,onMouseLeave:H,toggleSerie:"boolean"==typeof E?void 0:E})},B={start:"left",middle:"center",end:"right"},H=function(t,e){var i=e.data,n=e.containerWidth,o=e.containerHeight,r=e.translateX,l=void 0===r?0:r,a=e.translateY,c=void 0===a?0:a,d=e.anchor,s=e.direction,h=e.padding,g=void 0===h?0:h,f=e.justify,m=void 0!==f&&f,v=e.itemsSpacing,u=void 0===v?0:v,p=e.itemWidth,y=e.itemHeight,k=e.itemDirection,A=void 0===k?"left-to-right":k,W=e.itemTextColor,z=e.symbolSize,C=void 0===z?16:z,w=e.symbolSpacing,X=void 0===w?8:w,Y=e.theme,O=x({itemCount:i.length,itemWidth:p,itemHeight:y,itemsSpacing:u,direction:s,padding:g}),H=O.width,E=O.height,j=O.padding,L=b({anchor:d,translateX:l,translateY:c,containerWidth:n,containerHeight:o,width:H,height:E}),M=L.x,F=L.y,T="row"===s?p+u:0,P="column"===s?y+u:0;t.save(),t.translate(M,F),t.font=Y.legends.text.fontSize+"px "+(Y.legends.text.fontFamily||"sans-serif"),i.forEach((function(e,i){var n,o,r=i*T+j.left,l=i*P+j.top,a=S({direction:A,justify:m,symbolSize:C,symbolSpacing:X,width:p,height:y}),c=a.symbolX,d=a.symbolY,s=a.labelX,h=a.labelY,g=a.labelAnchor,f=a.labelAlignment;t.fillStyle=null!=(n=e.color)?n:"black",t.fillRect(r+c,l+d,C,C),t.textAlign=B[g],"central"===f&&(t.textBaseline="middle"),t.fillStyle=null!=(o=null!=W?W:Y.legends.text.fill)?o:"black",t.fillText(String(e.label),r+s,l+h)})),t.restore()},E=function(t,e){var i=e.containerWidth,n=e.containerHeight,o=e.anchor,r=e.translateX,a=void 0===r?0:r,c=e.translateY,d=void 0===c?0:c,s=e.scale,h=e.length,g=void 0===h?y.length:h,f=e.thickness,m=void 0===f?y.thickness:f,v=e.direction,u=void 0===v?y.direction:v,p=e.ticks,k=e.tickPosition,x=void 0===k?y.tickPosition:k,S=e.tickSize,W=void 0===S?y.tickSize:S,z=e.tickSpacing,C=void 0===z?y.tickSpacing:z,w=e.tickOverlap,X=void 0===w?y.tickOverlap:w,Y=e.tickFormat,O=void 0===Y?y.tickFormat:Y,B=e.title,H=e.titleAlign,E=void 0===H?y.titleAlign:H,j=e.titleOffset,L=void 0===j?y.titleOffset:j,M=e.theme,F=A({scale:s,ticks:p,length:g,thickness:m,direction:u,tickPosition:x,tickSize:W,tickSpacing:C,tickOverlap:X,tickFormat:O,title:B,titleAlign:E,titleOffset:L}),T=F.width,P=F.height,V=F.gradientX1,R=F.gradientY1,D=F.gradientX2,q=F.gradientY2,G=F.colorStops,I=F.ticks,N=F.titleText,_=F.titleX,J=F.titleY,K=F.titleRotation,Q=F.titleVerticalAlign,U=F.titleHorizontalAlign,Z=b({anchor:o,translateX:a,translateY:d,containerWidth:i,containerHeight:n,width:T,height:P}),$=Z.x,tt=Z.y,et={font:t.font,textAlign:t.textAlign,textBaseline:t.textBaseline};t.save(),t.translate($,tt);var it=t.createLinearGradient(V*T,R*P,D*T,q*P);G.forEach((function(t){it.addColorStop(t.offset,t.stopColor)})),t.fillStyle=it,t.fillRect(0,0,T,P),t.font=(M.legends.ticks.text.fontWeight?M.legends.ticks.text.fontWeight+" ":"")+M.legends.ticks.text.fontSize+"px "+M.legends.ticks.text.fontFamily,I.forEach((function(e){var i;(null!=(i=M.legends.ticks.line.strokeWidth)?i:0)>0&&(t.lineWidth=Number(M.axis.ticks.line.strokeWidth),M.axis.ticks.line.stroke&&(t.strokeStyle=M.axis.ticks.line.stroke),t.lineCap="square",t.beginPath(),t.moveTo(e.x1,e.y1),t.lineTo(e.x2,e.y2),t.stroke()),M.legends.ticks.text.fill&&(t.fillStyle=M.legends.ticks.text.fill),t.textAlign="middle"===e.textHorizontalAlign?"center":e.textHorizontalAlign,t.textBaseline="central"===e.textVerticalAlign?"middle":e.textVerticalAlign,t.fillText(e.text,e.textX,e.textY)})),N&&(t.save(),t.translate(_,J),t.rotate(l(K)),t.font=(M.legends.title.text.fontWeight?M.legends.title.text.fontWeight+" ":"")+M.legends.title.text.fontSize+"px "+M.legends.title.text.fontFamily,M.legends.title.text.fill&&(t.fillStyle=M.legends.title.text.fill),t.textAlign="middle"===U?"center":U,t.textBaseline=Q,t.fillText(N,0,0),t.restore()),t.restore(),t.font=et.font,t.textAlign=et.textAlign,t.textBaseline=et.textBaseline},j=function(t){var e=t.scale,i=t.domain,n=t.reverse,o=void 0!==n&&n,r=t.valueFormat,l=void 0===r?function(t){return t}:r,a=t.separator,c=void 0===a?" - ":a;return g((function(){var t=(null!=i?i:e.range()).map((function(t,i){var n=e.invertExtent(t),o=n[0],r=n[1];return{id:t,index:i,extent:[o,r],label:""+l(o)+c+l(r),value:e(o),color:t}}));return o&&t.reverse(),t}),[i,e,o,c,l])};export{C as AnchoredContinuousColorsLegendSvg,O as BoxLegendSvg,W as ContinuousColorsLegendSvg,Y as LegendSvg,X as LegendSvgItem,f as SymbolCircle,m as SymbolDiamond,v as SymbolSquare,u as SymbolTriangle,A as computeContinuousColorsLegend,x as computeDimensions,S as computeItemLayout,b as computePositionFromAnchor,y as continuousColorsLegendDefaults,E as renderContinuousColorLegendToCanvas,H as renderLegendToCanvas,j as useQuantizeColorScaleLegendData}; | ||
//# sourceMappingURL=nivo-legends.es.js.map |
@@ -14,3 +14,3 @@ import { BoxLegendSvgProps, ContinuousColorsLegendProps, LegendAnchor, LegendItemDirection } from './types'; | ||
anchor: LegendAnchor; | ||
} & Record<"translateX" | "translateY" | "containerWidth" | "containerHeight" | "width" | "height", number>) => { | ||
} & Record<"width" | "height" | "translateX" | "translateY" | "containerWidth" | "containerHeight", number>) => { | ||
x: number; | ||
@@ -22,3 +22,3 @@ y: number; | ||
justify: boolean; | ||
} & Record<"symbolSize" | "symbolSpacing" | "width" | "height", number>) => { | ||
} & Record<"width" | "height" | "symbolSize" | "symbolSpacing", number>) => { | ||
symbolX: number; | ||
@@ -29,3 +29,3 @@ symbolY: number; | ||
labelAnchor: "start" | "middle" | "end"; | ||
labelAlignment: "alphabetic" | "central" | "text-before-edge"; | ||
labelAlignment: "text-before-edge" | "central" | "alphabetic"; | ||
}; | ||
@@ -32,0 +32,0 @@ export declare const computeContinuousColorsLegend: ({ scale, ticks, length, thickness, direction, tickPosition, tickSize, tickSpacing, tickOverlap, tickFormat, title, titleAlign, titleOffset, }: ContinuousColorsLegendProps) => { |
@@ -5,3 +5,2 @@ export * from './svg'; | ||
export * from './hooks'; | ||
export * from './props'; | ||
export * from './types'; | ||
@@ -8,0 +7,0 @@ export * from './compute'; |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { AnchoredContinuousColorsLegendProps } from '../types'; | ||
export declare const AnchoredContinuousColorsLegendSvg: ({ containerWidth, containerHeight, anchor, translateX, translateY, length, thickness, direction, ...legendProps }: AnchoredContinuousColorsLegendProps) => JSX.Element; | ||
//# sourceMappingURL=AnchoredContinuousColorsLegendSvg.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { BoxLegendSvgProps } from '../types'; | ||
export declare const BoxLegendSvg: ({ data, containerWidth, containerHeight, translateX, translateY, anchor, direction, padding, justify, itemsSpacing, itemWidth, itemHeight, itemDirection, itemTextColor, itemBackground, itemOpacity, symbolShape, symbolSize, symbolSpacing, symbolBorderWidth, symbolBorderColor, onClick, onMouseEnter, onMouseLeave, toggleSerie, effects, }: BoxLegendSvgProps) => JSX.Element; | ||
//# sourceMappingURL=BoxLegendSvg.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { ContinuousColorsLegendProps } from '../types'; | ||
export declare const ContinuousColorsLegendSvg: ({ scale, ticks, length, thickness, direction, tickPosition, tickSize, tickSpacing, tickOverlap, tickFormat, title, titleAlign, titleOffset, }: ContinuousColorsLegendProps) => JSX.Element; | ||
//# sourceMappingURL=ContinuousColorsLegendSvg.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { LegendSvgProps } from '../types'; | ||
export declare const LegendSvg: ({ data, x, y, direction, padding: _padding, justify, effects, itemWidth, itemHeight, itemDirection, itemsSpacing, itemTextColor, itemBackground, itemOpacity, symbolShape, symbolSize, symbolSpacing, symbolBorderWidth, symbolBorderColor, onClick, onMouseEnter, onMouseLeave, toggleSerie, }: LegendSvgProps) => JSX.Element; | ||
//# sourceMappingURL=LegendSvg.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { LegendSvgItemProps } from '../types'; | ||
export declare const LegendSvgItem: ({ x, y, width, height, data, direction, justify, textColor, background, opacity, symbolShape, symbolSize, symbolSpacing, symbolBorderWidth, symbolBorderColor, onClick, onMouseEnter, onMouseLeave, toggleSerie, effects, }: LegendSvgItemProps) => JSX.Element; | ||
//# sourceMappingURL=LegendSvgItem.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { SymbolProps } from './types'; | ||
export declare const SymbolCircle: ({ x, y, size, fill, opacity, borderWidth, borderColor, }: SymbolProps) => JSX.Element; | ||
//# sourceMappingURL=SymbolCircle.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { SymbolProps } from './types'; | ||
export declare const SymbolDiamond: ({ x, y, size, fill, opacity, borderWidth, borderColor, }: SymbolProps) => JSX.Element; | ||
//# sourceMappingURL=SymbolDiamond.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { SymbolProps } from './types'; | ||
export declare const SymbolSquare: ({ x, y, size, fill, opacity, borderWidth, borderColor, }: SymbolProps) => JSX.Element; | ||
//# sourceMappingURL=SymbolSquare.d.ts.map |
@@ -1,4 +0,3 @@ | ||
/// <reference types="react" /> | ||
import { SymbolProps } from './types'; | ||
export declare const SymbolTriangle: ({ x, y, size, fill, opacity, borderWidth, borderColor, }: SymbolProps) => JSX.Element; | ||
//# sourceMappingURL=SymbolTriangle.d.ts.map |
{ | ||
"name": "@nivo/legends", | ||
"description": "legend components for nivo dataviz library", | ||
"version": "0.86.0", | ||
"version": "0.87.0", | ||
"license": "MIT", | ||
@@ -25,8 +25,6 @@ "author": { | ||
"dependencies": { | ||
"@nivo/colors": "0.86.0", | ||
"@nivo/core": "0.86.0", | ||
"@nivo/colors": "0.87.0", | ||
"@nivo/core": "0.87.0", | ||
"@types/d3-scale": "^4.0.8", | ||
"@types/prop-types": "^15.7.2", | ||
"d3-scale": "^4.0.2", | ||
"prop-types": "^15.7.2" | ||
"d3-scale": "^4.0.2" | ||
}, | ||
@@ -39,3 +37,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "6996fc1a0f0d3ee20ec002316e4d0d3aeddbd4ed" | ||
"gitHead": "da6d6b751cff5570fb7378d57b52e3e4bdbcf872" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5
198422
44
462
+ Added@nivo/colors@0.87.0(transitive)
+ Added@nivo/core@0.87.0(transitive)
+ Added@nivo/tooltip@0.87.0(transitive)
+ Added@types/d3-path@3.1.0(transitive)
+ Added@types/d3-shape@3.1.6(transitive)
+ Addedd3-path@3.1.0(transitive)
+ Addedd3-shape@3.2.0(transitive)
- Removed@types/prop-types@^15.7.2
- Removedprop-types@^15.7.2
- Removed@nivo/colors@0.86.0(transitive)
- Removed@nivo/core@0.86.0(transitive)
- Removed@nivo/recompose@0.86.0(transitive)
- Removed@nivo/tooltip@0.86.0(transitive)
- Removed@types/d3-path@2.0.4(transitive)
- Removed@types/d3-shape@2.1.7(transitive)
- Removed@types/react@18.3.12(transitive)
- Removed@types/react-lifecycles-compat@3.0.4(transitive)
- Removedcsstype@3.1.3(transitive)
- Removedd3-path@1.0.9(transitive)
- Removedd3-shape@1.3.7(transitive)
- Removedreact-lifecycles-compat@3.0.4(transitive)
Updated@nivo/colors@0.87.0
Updated@nivo/core@0.87.0