Comparing version 0.84.0 to 0.85.0
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("react"),r=require("@nivo/core"),o=require("@nivo/tooltip"),t=require("prop-types"),i=require("@nivo/colors"),n=require("lodash/isFunction"),a=require("lodash/get"),u=require("d3-format"),l=require("d3-geo"),s=require("@nivo/legends"),c=require("react/jsx-runtime");function d(){return d=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},d.apply(this,arguments)}var p={azimuthalEqualArea:l.geoAzimuthalEqualArea,azimuthalEquidistant:l.geoAzimuthalEquidistant,gnomonic:l.geoGnomonic,orthographic:l.geoOrthographic,stereographic:l.geoStereographic,equalEarth:l.geoEqualEarth,equirectangular:l.geoEquirectangular,mercator:l.geoMercator,transverseMercator:l.geoTransverseMercator,naturalEarth1:l.geoNaturalEarth1},h=function(o){var t=o.width,n=o.height,a=o.projectionType,u=o.projectionScale,s=o.projectionTranslation,c=o.projectionRotation,d=o.fillColor,h=o.borderWidth,f=o.borderColor,g=e.useMemo((function(){return p[a]().scale(u).translate([t*s[0],n*s[1]]).rotate(c)}),[t,n,a,u,s[0],s[1],c[0],c[1],c[2]]),v=e.useMemo((function(){return l.geoPath(g)}),[g]),C=e.useMemo((function(){return l.geoGraticule()})),m=r.useTheme(),b=e.useMemo((function(){return"function"==typeof h?h:function(){return h}}),[h]),j=i.useInheritedColor(f,m),y=e.useMemo((function(){return"function"==typeof d?d:function(){return d}}),[d]);return{projection:g,path:v,graticule:C,getBorderWidth:b,getBorderColor:j,getFillColor:y}},f=function(o){var t=o.features,i=o.data,l=o.match,c=o.label,p=o.value,h=o.valueFormat,f=o.colors,g=o.unknownColor,v=o.domain,C=e.useMemo((function(){return n(l)?l:function(e,r){var o=a(e,l),t=a(r,l);return o&&o===t}}),[l]),m=e.useMemo((function(){return n(c)?c:function(e){return a(e,c)}}),[c]),b=e.useMemo((function(){return n(p)?p:function(e){return a(e,p)}}),[p]),j=e.useMemo((function(){return void 0===h?function(e){return e}:n(h)?h:u.format(h)}),[h]),y=e.useMemo((function(){return r.guessQuantizeColorScale(f).domain(v)}),[f,v]),R=e.useMemo((function(){return function(e){return void 0===e.value?g:y(e.value)}}),[y,g]),q=e.useMemo((function(){return t.map((function(e){var r=i.find((function(r){return C(e,r)})),o=b(r);if(r){var t=d({},e,{data:r,value:o,formattedValue:j(o)});return t.color=R(t),t.label=m(t),t}return e}))}),[t,i,C,b,j,R]),M=s.useQuantizeColorScaleLegendData({scale:y,valueFormat:j});return{colorScale:y,getFillColor:R,boundFeatures:q,valueFormatter:j,legendData:M}},g=e.memo((function(e){var r=e.feature;return void 0===r.data?null:c.jsx(o.BasicTooltip,{id:r.label,color:r.color,enableChip:!0,value:r.formattedValue})}));g.propTypes={feature:t.object.isRequired},g.displayName="ChoroplethTooltip";var v={features:t.arrayOf(t.shape({id:t.string.isRequired,type:t.oneOf(["Feature"]).isRequired,properties:t.object,geometry:t.object.isRequired})).isRequired,projectionType:t.oneOf(Object.keys(p)).isRequired,projectionScale:t.number.isRequired,projectionTranslation:t.arrayOf(t.number).isRequired,projectionRotation:t.arrayOf(t.number).isRequired,fillColor:t.oneOfType([t.string,t.func]).isRequired,borderWidth:t.oneOfType([t.number,t.func]).isRequired,borderColor:i.inheritedColorPropType.isRequired,enableGraticule:t.bool.isRequired,graticuleLineWidth:t.number.isRequired,graticuleLineColor:t.string.isRequired,isInteractive:t.bool.isRequired,onMouseEnter:t.func.isRequired,onMouseMove:t.func.isRequired,onMouseLeave:t.func.isRequired,onClick:t.func.isRequired,tooltip:t.any,layers:t.arrayOf(t.oneOfType([t.oneOf(["graticule","features"]),t.func])).isRequired},C=d({},v,{role:t.string.isRequired}),m=d({pixelRatio:t.number.isRequired},v),b={data:t.arrayOf(t.object).isRequired,match:t.oneOfType([t.string,t.func]).isRequired,label:t.oneOfType([t.string,t.func]).isRequired,value:t.oneOfType([t.string,t.func]).isRequired,valueFormat:t.oneOfType([t.string,t.func]),colors:r.quantizeColorScalePropType.isRequired,domain:t.arrayOf(t.number).isRequired,unknownColor:t.string.isRequired,layers:t.arrayOf(t.oneOfType([t.oneOf(["graticule","features","legends"]),t.func])).isRequired},j=d({},C,b,{role:t.string.isRequired}),y=d({},m,b),R={projectionType:"mercator",projectionScale:100,projectionTranslation:[.5,.5],projectionRotation:[0,0,0],enableGraticule:!1,graticuleLineWidth:.5,graticuleLineColor:"#999999",fillColor:"#dddddd",borderWidth:0,borderColor:"#000000",isInteractive:!0,onMouseEnter:function(){},onMouseLeave:function(){},onMouseMove:function(){},onClick:function(){},layers:["graticule","features"],legends:[],fill:[],defs:[]},q=d({},R,{role:"img"}),M=d({},R,{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1}),T={match:"id",label:"id",value:"value",colors:"PuBuGn",unknownColor:"#999",tooltip:g,layers:["graticule","features","legends"]},x=d({},q,T,{role:"img"}),k=d({},M,T),W=e.memo((function(e){var r=e.path,o=e.graticule,t=e.lineWidth,i=e.lineColor;return c.jsx("path",{fill:"none",strokeWidth:t,stroke:i,d:r(o())})}));W.propTypes={path:t.func.isRequired,graticule:t.func.isRequired,lineWidth:t.number.isRequired,lineColor:t.string.isRequired},W.displayName="GeoGraticule";var w=e.memo((function(e){var r,o=e.feature,t=e.path,i=e.fillColor,n=e.borderWidth,a=e.borderColor,u=e.onClick,l=e.onMouseEnter,s=e.onMouseMove,d=e.onMouseLeave;return c.jsx("path",{fill:null!=(r=null==o?void 0:o.fill)?r:i,strokeWidth:n,stroke:a,strokeLinejoin:"bevel",d:t(o),onMouseEnter:function(e){return l(o,e)},onMouseMove:function(e){return s(o,e)},onMouseLeave:function(e){return d(o,e)},onClick:function(e){return u(o,e)}},o.id)}));w.propTypes={feature:t.shape({id:t.string.isRequired,type:t.oneOf(["Feature"]).isRequired,properties:t.object,geometry:t.object.isRequired}).isRequired,path:t.func.isRequired,fillColor:t.string.isRequired,borderWidth:t.number.isRequired,borderColor:t.string.isRequired,onMouseEnter:t.func.isRequired,onMouseMove:t.func.isRequired,onMouseLeave:t.func.isRequired,onClick:t.func.isRequired},w.displayName="GeoMapFeature";var F=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.features,l=t.layers,s=t.projectionType,d=t.projectionScale,p=t.projectionTranslation,f=t.projectionRotation,g=t.fillColor,v=t.borderWidth,C=t.borderColor,m=t.enableGraticule,b=t.graticuleLineWidth,j=t.graticuleLineColor,y=t.isInteractive,R=t.onClick,q=t.tooltip,M=t.role,T=r.useDimensions(i,n,a),x=T.margin,k=T.outerWidth,F=T.outerHeight,E=h({width:i,height:n,projectionType:s,projectionScale:d,projectionTranslation:p,projectionRotation:f,fillColor:g,borderWidth:v,borderColor:C}),S=E.graticule,O=E.path,L=E.getFillColor,G=E.getBorderWidth,P=E.getBorderColor,B=r.useTheme(),D=o.useTooltip(),I=D.showTooltipFromEvent,N=D.hideTooltip,z=e.useCallback((function(e,r){return y&&R&&R(e,r)}),[y,R]),H=e.useCallback((function(e,r){return y&&q&&I(c.jsx(q,{feature:e}),r)}),[y,I,q]),A=e.useCallback((function(e,r){return y&&q&&I(c.jsx(q,{feature:e}),r)}),[y,I,q]),K=e.useCallback((function(){return y&&N()}),[y,N]);return c.jsx(r.SvgWrapper,{width:k,height:F,margin:x,theme:B,role:M,children:l.map((function(r,o){return"graticule"===r?!0!==m?null:c.jsx(W,{path:O,graticule:S,lineWidth:b,lineColor:j},"graticule"):"features"===r?c.jsx(e.Fragment,{children:u.map((function(e){return c.jsx(w,{feature:e,path:O,fillColor:L(e),borderWidth:G(e),borderColor:P(e),onMouseEnter:H,onMouseMove:A,onMouseLeave:K,onClick:z},e.id)}))},"features"):c.jsx(e.Fragment,{children:r(t)},o)}))})}));F.displayName="GeoMap",F.propTypes=C,F.defaultProps=q;var E=r.withContainer(F),S=function(e,o,t,i){var n=r.getRelativeCursor(o,e),a=n[0],u=n[1];return t.find((function(e){return l.geoContains(e,i.invert([a,u]))}))},O=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.pixelRatio,l=t.features,s=t.layers,d=t.projectionType,p=t.projectionScale,f=t.projectionTranslation,g=t.projectionRotation,v=t.fillColor,C=t.borderWidth,m=t.borderColor,b=t.enableGraticule,j=t.graticuleLineWidth,y=t.graticuleLineColor,R=t.isInteractive,q=t.onClick,M=t.onMouseMove,T=t.tooltip,x=e.useRef(null),k=r.useTheme(),W=r.useDimensions(i,n,a),w=W.margin,F=W.outerWidth,E=W.outerHeight,O=h({width:i,height:n,projectionType:d,projectionScale:p,projectionTranslation:f,projectionRotation:g,fillColor:v,borderWidth:C,borderColor:m}),L=O.projection,G=O.graticule,P=O.path,B=O.getFillColor,D=O.getBorderWidth,I=O.getBorderColor;e.useEffect((function(){if(x){x.current.width=F*u,x.current.height=E*u;var e=x.current.getContext("2d");e.scale(u,u),e.fillStyle=k.background,e.fillRect(0,0,F,E),e.translate(w.left,w.top),P.context(e),s.forEach((function(r){"graticule"===r?!0===b&&(e.lineWidth=j,e.strokeStyle=y,e.beginPath(),P(G()),e.stroke()):"features"===r?l.forEach((function(r){e.beginPath(),P(r),e.fillStyle=B(r),e.fill();var o=D(r);o>0&&(e.strokeStyle=I(r),e.lineWidth=o,e.stroke())})):r(e,t)}))}}),[x,F,E,w,u,k,P,G,B,D,I,l,s]);var N=o.useTooltip(),z=N.showTooltipFromEvent,H=N.hideTooltip,A=e.useCallback((function(e){if(R&&T){var r=S(e,x.current,l,L);r?z(c.jsx(T,{feature:r}),e):H(),M&&M(r||null,e)}}),[z,H,R,T,x,l,L]),K=e.useCallback((function(){return R&&H()}),[R,H]),Q=e.useCallback((function(e){if(R&&q){var r=S(e,x.current,l,L);r&&q(r,e)}}),[R,x,l,L,q]);return c.jsx("canvas",{ref:x,width:F*u,height:E*u,style:{width:F,height:E,cursor:R?"auto":"normal"},onMouseMove:A,onMouseLeave:K,onClick:Q})}));O.displatName="GeoMapCanvas",O.propTypes=m,O.defaultProps=M;var L=r.withContainer(O),G=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.features,l=t.data,p=t.match,g=t.label,v=t.value,C=t.valueFormat,m=t.projectionType,b=t.projectionScale,j=t.projectionTranslation,y=t.projectionRotation,R=t.colors,q=t.domain,M=t.unknownColor,T=t.borderWidth,k=t.borderColor,F=t.enableGraticule,E=t.graticuleLineWidth,S=t.graticuleLineColor,O=t.layers,L=t.legends,G=t.isInteractive,P=t.onClick,B=t.tooltip,D=t.role,I=t.defs,N=void 0===I?x.defs:I,z=t.fill,H=void 0===z?x.fill:z,A=r.useDimensions(i,n,a),K=A.margin,Q=A.outerWidth,V=A.outerHeight,J=h({width:i,height:n,projectionType:m,projectionScale:b,projectionTranslation:j,projectionRotation:y,fillColor:function(){},borderWidth:T,borderColor:k}),U=J.graticule,X=J.path,Y=J.getBorderWidth,Z=J.getBorderColor,$=f({features:u,data:l,match:p,label:g,value:v,valueFormat:C,colors:R,unknownColor:M,domain:q}),_=$.getFillColor,ee=$.boundFeatures,re=$.legendData,oe=r.useTheme(),te=r.bindDefs(N,ee,H,{dataKey:"data",targetKey:"fill"}),ie=o.useTooltip(),ne=ie.showTooltipFromEvent,ae=ie.hideTooltip,ue=e.useCallback((function(e,r){return G&&P&&P(e,r)}),[G,P]),le=e.useCallback((function(e,r){return G&&B&&ne(c.jsx(B,{feature:e}),r)}),[G,ne,B]),se=e.useCallback((function(e,r){return G&&B&&ne(c.jsx(B,{feature:e}),r)}),[G,ne,B]),ce=e.useCallback((function(){return G&&ae()}),[G,ae]);return c.jsx(r.SvgWrapper,{width:Q,height:V,margin:K,theme:oe,defs:te,role:D,children:O.map((function(r,o){return"graticule"===r?!0!==F?null:c.jsx(W,{path:X,graticule:U,lineWidth:E,lineColor:S},"graticule"):"features"===r?c.jsx(e.Fragment,{children:ee.map((function(e){return c.jsx(w,{feature:e,path:X,fillColor:_(e),borderWidth:Y(e),borderColor:Z(e),onMouseEnter:le,onMouseMove:se,onMouseLeave:ce,onClick:ue},e.id)}))},"features"):"legends"===r?L.map((function(e,r){return c.jsx(s.BoxLegendSvg,d({containerWidth:i,containerHeight:n,data:re},e),r)})):c.jsx(e.Fragment,{children:r({})},o)}))})}));G.displayName="Choropleth",G.propTypes=j,G.defaultProps=x;var P=r.withContainer(G),B=function(e,o,t,i){var n=r.getRelativeCursor(o,e),a=n[0],u=n[1];return t.find((function(e){return l.geoContains(e,i.invert([a,u]))}))},D=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.pixelRatio,l=t.features,p=t.data,g=t.match,v=t.label,C=t.value,m=t.valueFormat,b=t.projectionType,j=t.projectionScale,y=t.projectionTranslation,R=t.projectionRotation,q=t.colors,M=t.domain,T=t.unknownColor,x=t.borderWidth,k=t.borderColor,W=t.enableGraticule,w=t.graticuleLineWidth,F=t.graticuleLineColor,E=t.layers,S=t.legends,O=t.isInteractive,L=t.onClick,G=t.onMouseMove,P=t.tooltip,D=e.useRef(null),I=r.useTheme(),N=r.useDimensions(i,n,a),z=N.margin,H=N.outerWidth,A=N.outerHeight,K=h({width:i,height:n,projectionType:b,projectionScale:j,projectionTranslation:y,projectionRotation:R,fillColor:function(){},borderWidth:x,borderColor:k}),Q=K.projection,V=K.graticule,J=K.path,U=K.getBorderWidth,X=K.getBorderColor,Y=f({features:l,data:p,match:g,label:v,value:C,valueFormat:m,colors:q,unknownColor:T,domain:M}),Z=Y.getFillColor,$=Y.boundFeatures,_=Y.legendData;e.useEffect((function(){if(D){D.current.width=H*u,D.current.height=A*u;var e=D.current.getContext("2d");e.scale(u,u),e.fillStyle=I.background,e.fillRect(0,0,H,A),e.translate(z.left,z.top),J.context(e),E.forEach((function(r){"graticule"===r?!0===W&&(e.lineWidth=w,e.strokeStyle=F,e.beginPath(),J(V()),e.stroke()):"features"===r?$.forEach((function(r){e.beginPath(),J(r),e.fillStyle=Z(r),e.fill();var o=U(r);o>0&&(e.strokeStyle=X(r),e.lineWidth=o,e.stroke())})):"legends"===r&&S.forEach((function(r){s.renderLegendToCanvas(e,d({},r,{data:_,containerWidth:i,containerHeight:n,theme:I}))}))}))}}),[D,H,A,z,u,I,J,V,Z,U,X,$,S,E]);var ee=o.useTooltip(),re=ee.showTooltipFromEvent,oe=ee.hideTooltip,te=e.useCallback((function(e){if(O&&P){var r=B(e,D.current,$,Q);r?re(c.jsx(P,{feature:r}),e):oe(),G&&G(r||null,e)}}),[re,oe,O,P,D,$,Q]),ie=e.useCallback((function(){return O&&oe()}),[O,oe]),ne=e.useCallback((function(e){if(O&&L){var r=B(e,D.current,$,Q);r&&L(r,e)}}),[O,D,$,Q,L]);return c.jsx("canvas",{ref:D,width:H*u,height:A*u,style:{width:H,height:A,cursor:O?"auto":"normal"},onMouseMove:te,onMouseLeave:ie,onClick:ne})}));D.displayName="ChoroplethCanvas",D.propTypes=y,D.defaultProps=k;var I=r.withContainer(D);exports.Choropleth=P,exports.ChoroplethCanvas=I,exports.ChoroplethCanvasDefaultProps=k,exports.ChoroplethCanvasPropTypes=y,exports.ChoroplethDefaultProps=x,exports.ChoroplethPropTypes=j,exports.GeoMap=E,exports.GeoMapCanvas=L,exports.GeoMapCanvasDefaultProps=M,exports.GeoMapCanvasPropTypes=m,exports.GeoMapDefaultProps=q,exports.GeoMapPropTypes=C,exports.ResponsiveChoropleth=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(P,d({width:o,height:t},e))}})},exports.ResponsiveChoroplethCanvas=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(I,d({width:o,height:t},e))}})},exports.ResponsiveGeoMap=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(E,d({width:o,height:t},e))}})},exports.ResponsiveGeoMapCanvas=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(L,d({width:o,height:t},e))}})},exports.projectionById=p,exports.useChoropleth=f,exports.useGeoMap=h; | ||
"use strict";var e=require("react"),o=require("@nivo/core"),r=require("@nivo/tooltip"),i=require("prop-types"),t=require("@nivo/colors"),n=require("lodash/isFunction"),a=require("lodash/get"),u=require("d3-format"),l=require("d3-geo"),s=require("@nivo/legends"),d=require("react/jsx-runtime");function c(){return c=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c.apply(this,arguments)}var p={azimuthalEqualArea:l.geoAzimuthalEqualArea,azimuthalEquidistant:l.geoAzimuthalEquidistant,gnomonic:l.geoGnomonic,orthographic:l.geoOrthographic,stereographic:l.geoStereographic,equalEarth:l.geoEqualEarth,equirectangular:l.geoEquirectangular,mercator:l.geoMercator,transverseMercator:l.geoTransverseMercator,naturalEarth1:l.geoNaturalEarth1},f=function(r){var i=r.width,n=r.height,a=r.projectionType,u=r.projectionScale,s=r.projectionTranslation,d=r.projectionRotation,c=r.fillColor,f=r.borderWidth,h=r.borderColor,v=e.useMemo((function(){return p[a]().scale(u).translate([i*s[0],n*s[1]]).rotate(d)}),[i,n,a,u,s[0],s[1],d[0],d[1],d[2]]),g=e.useMemo((function(){return l.geoPath(v)}),[v]),m=e.useMemo((function(){return l.geoGraticule()})),C=o.useTheme(),b=e.useMemo((function(){return"function"==typeof f?f:function(){return f}}),[f]),j=t.useInheritedColor(h,C),y=e.useMemo((function(){return"function"==typeof c?c:function(){return c}}),[c]);return{projection:v,path:g,graticule:m,getBorderWidth:b,getBorderColor:j,getFillColor:y}},h=function(r){var i=r.features,t=r.data,l=r.match,d=r.label,p=r.value,f=r.valueFormat,h=r.colors,v=r.unknownColor,g=r.domain,m=e.useMemo((function(){return n(l)?l:function(e,o){var r=a(e,l),i=a(o,l);return r&&r===i}}),[l]),C=e.useMemo((function(){return n(d)?d:function(e){return a(e,d)}}),[d]),b=e.useMemo((function(){return n(p)?p:function(e){return a(e,p)}}),[p]),j=e.useMemo((function(){return void 0===f?function(e){return e}:n(f)?f:u.format(f)}),[f]),y=e.useMemo((function(){return o.guessQuantizeColorScale(h).domain(g)}),[h,g]),R=e.useMemo((function(){return function(e){return void 0===e.value?v:y(e.value)}}),[y,v]),q=e.useMemo((function(){return i.map((function(e){var o=t.find((function(o){return m(e,o)})),r=b(o);if(o){var i=c({},e,{data:o,value:r,formattedValue:j(r)});return i.color=R(i),i.label=C(i),i}return e}))}),[i,t,m,b,j,R]),M=s.useQuantizeColorScaleLegendData({scale:y,valueFormat:j});return{colorScale:y,getFillColor:R,boundFeatures:q,valueFormatter:j,legendData:M}},v=e.memo((function(e){var o=e.feature;return void 0===o.data?null:d.jsx(r.BasicTooltip,{id:o.label,color:o.color,enableChip:!0,value:o.formattedValue})}));v.propTypes={feature:i.object.isRequired},v.displayName="ChoroplethTooltip";var g={features:i.arrayOf(i.shape({id:i.string.isRequired,type:i.oneOf(["Feature"]).isRequired,properties:i.object,geometry:i.object.isRequired})).isRequired,projectionType:i.oneOf(Object.keys(p)).isRequired,projectionScale:i.number.isRequired,projectionTranslation:i.arrayOf(i.number).isRequired,projectionRotation:i.arrayOf(i.number).isRequired,fillColor:i.oneOfType([i.string,i.func]).isRequired,borderWidth:i.oneOfType([i.number,i.func]).isRequired,borderColor:t.inheritedColorPropType.isRequired,enableGraticule:i.bool.isRequired,graticuleLineWidth:i.number.isRequired,graticuleLineColor:i.string.isRequired,isInteractive:i.bool.isRequired,onMouseEnter:i.func.isRequired,onMouseMove:i.func.isRequired,onMouseLeave:i.func.isRequired,onClick:i.func.isRequired,tooltip:i.any,layers:i.arrayOf(i.oneOfType([i.oneOf(["graticule","features"]),i.func])).isRequired},m=c({},g,{role:i.string.isRequired}),C=c({pixelRatio:i.number.isRequired},g),b={data:i.arrayOf(i.object).isRequired,match:i.oneOfType([i.string,i.func]).isRequired,label:i.oneOfType([i.string,i.func]).isRequired,value:i.oneOfType([i.string,i.func]).isRequired,valueFormat:i.oneOfType([i.string,i.func]),colors:o.quantizeColorScalePropType.isRequired,domain:i.arrayOf(i.number).isRequired,unknownColor:i.string.isRequired,layers:i.arrayOf(i.oneOfType([i.oneOf(["graticule","features","legends"]),i.func])).isRequired},j=c({},m,b,{role:i.string.isRequired}),y=c({},C,b),R={projectionType:"mercator",projectionScale:100,projectionTranslation:[.5,.5],projectionRotation:[0,0,0],enableGraticule:!1,graticuleLineWidth:.5,graticuleLineColor:"#999999",fillColor:"#dddddd",borderWidth:0,borderColor:"#000000",isInteractive:!0,onMouseEnter:function(){},onMouseLeave:function(){},onMouseMove:function(){},onClick:function(){},layers:["graticule","features"],legends:[],fill:[],defs:[]},q=c({},R,{role:"img"}),M=c({},R,{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1}),T={match:"id",label:"id",value:"value",colors:"PuBuGn",unknownColor:"#999",tooltip:v,layers:["graticule","features","legends"]},x=c({},q,T,{role:"img"}),w=c({},M,T),k=e.memo((function(e){var o=e.path,r=e.graticule,i=e.lineWidth,t=e.lineColor;return d.jsx("path",{fill:"none",strokeWidth:i,stroke:t,d:o(r())})}));k.propTypes={path:i.func.isRequired,graticule:i.func.isRequired,lineWidth:i.number.isRequired,lineColor:i.string.isRequired},k.displayName="GeoGraticule";var W=e.memo((function(e){var o,r=e.feature,i=e.path,t=e.fillColor,n=e.borderWidth,a=e.borderColor,u=e.onClick,l=e.onMouseEnter,s=e.onMouseMove,c=e.onMouseLeave;return d.jsx("path",{fill:null!=(o=null==r?void 0:r.fill)?o:t,strokeWidth:n,stroke:a,strokeLinejoin:"bevel",d:i(r),onMouseEnter:function(e){return l(r,e)},onMouseMove:function(e){return s(r,e)},onMouseLeave:function(e){return c(r,e)},onClick:function(e){return u(r,e)}},r.id)}));W.propTypes={feature:i.shape({id:i.string.isRequired,type:i.oneOf(["Feature"]).isRequired,properties:i.object,geometry:i.object.isRequired}).isRequired,path:i.func.isRequired,fillColor:i.string.isRequired,borderWidth:i.number.isRequired,borderColor:i.string.isRequired,onMouseEnter:i.func.isRequired,onMouseMove:i.func.isRequired,onMouseLeave:i.func.isRequired,onClick:i.func.isRequired},W.displayName="GeoMapFeature";var F=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.features,l=i.layers,s=void 0===l?["graticule","features"]:l,c=i.projectionType,p=void 0===c?"mercator":c,h=i.projectionScale,v=void 0===h?100:h,g=i.projectionTranslation,m=void 0===g?[.5,.5]:g,C=i.projectionRotation,b=void 0===C?[0,0,0]:C,j=i.fillColor,y=void 0===j?"#dddddd":j,R=i.borderWidth,q=void 0===R?0:R,M=i.borderColor,T=void 0===M?"#000000":M,x=i.enableGraticule,w=void 0!==x&&x,F=i.graticuleLineWidth,E=void 0===F?.5:F,S=i.graticuleLineColor,O=void 0===S?"#999999":S,G=i.isInteractive,L=void 0===G||G,P=i.onClick,B=void 0===P?function(){}:P,D=i.tooltip,I=i.role,N=void 0===I?"img":I,z=o.useDimensions(t,n,a),H=z.margin,A=z.outerWidth,K=z.outerHeight,Q=f({width:t,height:n,projectionType:p,projectionScale:v,projectionTranslation:m,projectionRotation:b,fillColor:y,borderWidth:q,borderColor:T}),V=Q.graticule,J=Q.path,U=Q.getFillColor,X=Q.getBorderWidth,Y=Q.getBorderColor,Z=o.useTheme(),$=r.useTooltip(),_=$.showTooltipFromEvent,ee=$.hideTooltip,oe=e.useCallback((function(e,o){return L&&B&&B(e,o)}),[L,B]),re=e.useCallback((function(e,o){return L&&D&&_(d.jsx(D,{feature:e}),o)}),[L,_,D]),ie=e.useCallback((function(e,o){return L&&D&&_(d.jsx(D,{feature:e}),o)}),[L,_,D]),te=e.useCallback((function(){return L&&ee()}),[L,ee]);return d.jsx(o.SvgWrapper,{width:A,height:K,margin:H,theme:Z,role:N,children:s.map((function(o,r){return"graticule"===o?!0!==w?null:d.jsx(k,{path:J,graticule:V,lineWidth:E,lineColor:O},"graticule"):"features"===o?d.jsx(e.Fragment,{children:u.map((function(e){return d.jsx(W,{feature:e,path:J,fillColor:U(e),borderWidth:X(e),borderColor:Y(e),onMouseEnter:re,onMouseMove:ie,onMouseLeave:te,onClick:oe},e.id)}))},"features"):d.jsx(e.Fragment,{children:o(i)},r)}))})}));F.displayName="GeoMap",F.propTypes=m;var E=o.withContainer(F),S=function(e,r,i,t){var n=o.getRelativeCursor(r,e),a=n[0],u=n[1];return i.find((function(e){return l.geoContains(e,t.invert([a,u]))}))},O=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.pixelRatio,l=void 0===u?"undefined"!=typeof window&&window.devicePixelRatio||1:u,s=i.features,c=i.layers,p=i.projectionType,h=void 0===p?"mercator":p,v=i.projectionScale,g=void 0===v?100:v,m=i.projectionTranslation,C=void 0===m?[.5,.5]:m,b=i.projectionRotation,j=void 0===b?[0,0,0]:b,y=i.fillColor,R=void 0===y?"#dddddd":y,q=i.borderWidth,M=void 0===q?0:q,T=i.borderColor,x=void 0===T?"#000000":T,w=i.enableGraticule,k=void 0!==w&&w,W=i.graticuleLineWidth,F=void 0===W?.5:W,E=i.graticuleLineColor,O=void 0===E?"#999999":E,G=i.isInteractive,L=void 0===G||G,P=i.onClick,B=void 0===P?function(){}:P,D=i.onMouseMove,I=void 0===D?function(){}:D,N=i.tooltip,z=e.useRef(null),H=o.useTheme(),A=o.useDimensions(t,n,a),K=A.margin,Q=A.outerWidth,V=A.outerHeight,J=f({width:t,height:n,projectionType:h,projectionScale:g,projectionTranslation:C,projectionRotation:j,fillColor:R,borderWidth:M,borderColor:x}),U=J.projection,X=J.graticule,Y=J.path,Z=J.getFillColor,$=J.getBorderWidth,_=J.getBorderColor;e.useEffect((function(){if(z){z.current.width=Q*l,z.current.height=V*l;var e=z.current.getContext("2d");e.scale(l,l),e.fillStyle=H.background,e.fillRect(0,0,Q,V),e.translate(K.left,K.top),Y.context(e),c.forEach((function(o){"graticule"===o?!0===k&&(e.lineWidth=F,e.strokeStyle=O,e.beginPath(),Y(X()),e.stroke()):"features"===o?s.forEach((function(o){e.beginPath(),Y(o),e.fillStyle=Z(o),e.fill();var r=$(o);r>0&&(e.strokeStyle=_(o),e.lineWidth=r,e.stroke())})):o(e,i)}))}}),[z,Q,V,K,l,H,Y,X,Z,$,_,s,c]);var ee=r.useTooltip(),oe=ee.showTooltipFromEvent,re=ee.hideTooltip,ie=e.useCallback((function(e){if(L&&N){var o=S(e,z.current,s,U);o?oe(d.jsx(N,{feature:o}),e):re(),I&&I(o||null,e)}}),[oe,re,L,N,z,s,U]),te=e.useCallback((function(){return L&&re()}),[L,re]),ne=e.useCallback((function(e){if(L&&B){var o=S(e,z.current,s,U);o&&B(o,e)}}),[L,z,s,U,B]);return d.jsx("canvas",{ref:z,width:Q*l,height:V*l,style:{width:Q,height:V,cursor:L?"auto":"normal"},onMouseMove:ie,onMouseLeave:te,onClick:ne})}));O.displatName="GeoMapCanvas",O.propTypes=C;var G=o.withContainer(O),L=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.features,l=i.data,p=i.match,g=void 0===p?"id":p,m=i.label,C=void 0===m?"id":m,b=i.value,j=void 0===b?"value":b,y=i.valueFormat,R=i.projectionType,q=void 0===R?"mercator":R,M=i.projectionScale,T=void 0===M?100:M,x=i.projectionTranslation,w=void 0===x?[.5,.5]:x,F=i.projectionRotation,E=void 0===F?[0,0,0]:F,S=i.colors,O=void 0===S?"PuBuGn":S,G=i.domain,L=i.unknownColor,P=void 0===L?"#999":L,B=i.borderWidth,D=void 0===B?0:B,I=i.borderColor,N=void 0===I?"#000000":I,z=i.enableGraticule,H=void 0!==z&&z,A=i.graticuleLineWidth,K=void 0===A?.5:A,Q=i.graticuleLineColor,V=void 0===Q?"#999999":Q,J=i.layers,U=void 0===J?["graticule","features","legends"]:J,X=i.legends,Y=void 0===X?[]:X,Z=i.isInteractive,$=void 0===Z||Z,_=i.onClick,ee=void 0===_?function(){}:_,oe=i.tooltip,re=void 0===oe?v:oe,ie=i.role,te=void 0===ie?"img":ie,ne=i.defs,ae=void 0===ne?[]:ne,ue=i.fill,le=void 0===ue?[]:ue,se=o.useDimensions(t,n,a),de=se.margin,ce=se.outerWidth,pe=se.outerHeight,fe=f({width:t,height:n,projectionType:q,projectionScale:T,projectionTranslation:w,projectionRotation:E,fillColor:function(){},borderWidth:D,borderColor:N}),he=fe.graticule,ve=fe.path,ge=fe.getBorderWidth,me=fe.getBorderColor,Ce=h({features:u,data:l,match:g,label:C,value:j,valueFormat:y,colors:O,unknownColor:P,domain:G}),be=Ce.getFillColor,je=Ce.boundFeatures,ye=Ce.legendData,Re=o.useTheme(),qe=o.bindDefs(ae,je,le,{dataKey:"data",targetKey:"fill"}),Me=r.useTooltip(),Te=Me.showTooltipFromEvent,xe=Me.hideTooltip,we=e.useCallback((function(e,o){return $&&ee&&ee(e,o)}),[$,ee]),ke=e.useCallback((function(e,o){return $&&re&&Te(d.jsx(re,{feature:e}),o)}),[$,Te,re]),We=e.useCallback((function(e,o){return $&&re&&Te(d.jsx(re,{feature:e}),o)}),[$,Te,re]),Fe=e.useCallback((function(){return $&&xe()}),[$,xe]);return d.jsx(o.SvgWrapper,{width:ce,height:pe,margin:de,theme:Re,defs:qe,role:te,children:U.map((function(o,r){return"graticule"===o?!0!==H?null:d.jsx(k,{path:ve,graticule:he,lineWidth:K,lineColor:V},"graticule"):"features"===o?d.jsx(e.Fragment,{children:je.map((function(e){return d.jsx(W,{feature:e,path:ve,fillColor:be(e),borderWidth:ge(e),borderColor:me(e),onMouseEnter:ke,onMouseMove:We,onMouseLeave:Fe,onClick:we},e.id)}))},"features"):"legends"===o?Y.map((function(e,o){return d.jsx(s.BoxLegendSvg,c({containerWidth:t,containerHeight:n,data:ye},e),o)})):d.jsx(e.Fragment,{children:o({})},r)}))})}));L.displayName="Choropleth",L.propTypes=j;var P=o.withContainer(L),B=function(e,r,i,t){var n=o.getRelativeCursor(r,e),a=n[0],u=n[1];return i.find((function(e){return l.geoContains(e,t.invert([a,u]))}))},D=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.pixelRatio,l=void 0===u?"undefined"!=typeof window&&window.devicePixelRatio||1:u,p=i.features,g=i.data,m=i.match,C=void 0===m?"id":m,b=i.label,j=void 0===b?"id":b,y=i.value,R=void 0===y?"value":y,q=i.valueFormat,M=i.projectionType,T=void 0===M?"mercator":M,x=i.projectionScale,w=void 0===x?100:x,k=i.projectionTranslation,W=void 0===k?[.5,.5]:k,F=i.projectionRotation,E=void 0===F?[0,0,0]:F,S=i.colors,O=void 0===S?"PuBuGn":S,G=i.domain,L=i.unknownColor,P=void 0===L?"#999":L,D=i.borderWidth,I=void 0===D?0:D,N=i.borderColor,z=void 0===N?"#000000":N,H=i.enableGraticule,A=void 0!==H&&H,K=i.graticuleLineWidth,Q=void 0===K?.5:K,V=i.graticuleLineColor,J=void 0===V?"#999999":V,U=i.layers,X=void 0===U?["graticule","features","legends"]:U,Y=i.legends,Z=void 0===Y?[]:Y,$=i.isInteractive,_=void 0===$||$,ee=i.onClick,oe=void 0===ee?function(){}:ee,re=i.onMouseMove,ie=void 0===re?function(){}:re,te=i.tooltip,ne=void 0===te?v:te,ae=e.useRef(null),ue=o.useTheme(),le=o.useDimensions(t,n,a),se=le.margin,de=le.outerWidth,ce=le.outerHeight,pe=f({width:t,height:n,projectionType:T,projectionScale:w,projectionTranslation:W,projectionRotation:E,fillColor:function(){},borderWidth:I,borderColor:z}),fe=pe.projection,he=pe.graticule,ve=pe.path,ge=pe.getBorderWidth,me=pe.getBorderColor,Ce=h({features:p,data:g,match:C,label:j,value:R,valueFormat:q,colors:O,unknownColor:P,domain:G}),be=Ce.getFillColor,je=Ce.boundFeatures,ye=Ce.legendData;e.useEffect((function(){if(ae){ae.current.width=de*l,ae.current.height=ce*l;var e=ae.current.getContext("2d");e.scale(l,l),e.fillStyle=ue.background,e.fillRect(0,0,de,ce),e.translate(se.left,se.top),ve.context(e),X.forEach((function(o){"graticule"===o?!0===A&&(e.lineWidth=Q,e.strokeStyle=J,e.beginPath(),ve(he()),e.stroke()):"features"===o?je.forEach((function(o){e.beginPath(),ve(o),e.fillStyle=be(o),e.fill();var r=ge(o);r>0&&(e.strokeStyle=me(o),e.lineWidth=r,e.stroke())})):"legends"===o&&Z.forEach((function(o){s.renderLegendToCanvas(e,c({},o,{data:ye,containerWidth:t,containerHeight:n,theme:ue}))}))}))}}),[ae,de,ce,se,l,ue,ve,he,be,ge,me,je,Z,X]);var Re=r.useTooltip(),qe=Re.showTooltipFromEvent,Me=Re.hideTooltip,Te=e.useCallback((function(e){if(_&&ne){var o=B(e,ae.current,je,fe);o?qe(d.jsx(ne,{feature:o}),e):Me(),ie&&ie(o||null,e)}}),[qe,Me,_,ne,ae,je,fe]),xe=e.useCallback((function(){return _&&Me()}),[_,Me]),we=e.useCallback((function(e){if(_&&oe){var o=B(e,ae.current,je,fe);o&&oe(o,e)}}),[_,ae,je,fe,oe]);return d.jsx("canvas",{ref:ae,width:de*l,height:ce*l,style:{width:de,height:ce,cursor:_?"auto":"normal"},onMouseMove:Te,onMouseLeave:xe,onClick:we})}));D.displayName="ChoroplethCanvas",D.propTypes=y;var I=o.withContainer(D);exports.Choropleth=P,exports.ChoroplethCanvas=I,exports.ChoroplethCanvasDefaultProps=w,exports.ChoroplethCanvasPropTypes=y,exports.ChoroplethDefaultProps=x,exports.ChoroplethPropTypes=j,exports.GeoMap=E,exports.GeoMapCanvas=G,exports.GeoMapCanvasDefaultProps=M,exports.GeoMapCanvasPropTypes=C,exports.GeoMapDefaultProps=q,exports.GeoMapPropTypes=m,exports.ResponsiveChoropleth=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(P,c({width:r,height:i},e))}})},exports.ResponsiveChoroplethCanvas=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(I,c({width:r,height:i},e))}})},exports.ResponsiveGeoMap=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(E,c({width:r,height:i},e))}})},exports.ResponsiveGeoMapCanvas=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(G,c({width:r,height:i},e))}})},exports.projectionById=p,exports.useChoropleth=h,exports.useGeoMap=f; | ||
//# sourceMappingURL=nivo-geo.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var e=require("react"),r=require("@nivo/core"),o=require("@nivo/tooltip"),t=require("prop-types"),i=require("@nivo/colors"),n=require("lodash/isFunction"),a=require("lodash/get"),u=require("d3-format"),l=require("d3-geo"),s=require("@nivo/legends"),c=require("react/jsx-runtime");function d(){return d=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},d.apply(this,arguments)}var p={azimuthalEqualArea:l.geoAzimuthalEqualArea,azimuthalEquidistant:l.geoAzimuthalEquidistant,gnomonic:l.geoGnomonic,orthographic:l.geoOrthographic,stereographic:l.geoStereographic,equalEarth:l.geoEqualEarth,equirectangular:l.geoEquirectangular,mercator:l.geoMercator,transverseMercator:l.geoTransverseMercator,naturalEarth1:l.geoNaturalEarth1},h=function(o){var t=o.width,n=o.height,a=o.projectionType,u=o.projectionScale,s=o.projectionTranslation,c=o.projectionRotation,d=o.fillColor,h=o.borderWidth,f=o.borderColor,g=e.useMemo((function(){return p[a]().scale(u).translate([t*s[0],n*s[1]]).rotate(c)}),[t,n,a,u,s[0],s[1],c[0],c[1],c[2]]),v=e.useMemo((function(){return l.geoPath(g)}),[g]),C=e.useMemo((function(){return l.geoGraticule()})),m=r.useTheme(),b=e.useMemo((function(){return"function"==typeof h?h:function(){return h}}),[h]),j=i.useInheritedColor(f,m),y=e.useMemo((function(){return"function"==typeof d?d:function(){return d}}),[d]);return{projection:g,path:v,graticule:C,getBorderWidth:b,getBorderColor:j,getFillColor:y}},f=function(o){var t=o.features,i=o.data,l=o.match,c=o.label,p=o.value,h=o.valueFormat,f=o.colors,g=o.unknownColor,v=o.domain,C=e.useMemo((function(){return n(l)?l:function(e,r){var o=a(e,l),t=a(r,l);return o&&o===t}}),[l]),m=e.useMemo((function(){return n(c)?c:function(e){return a(e,c)}}),[c]),b=e.useMemo((function(){return n(p)?p:function(e){return a(e,p)}}),[p]),j=e.useMemo((function(){return void 0===h?function(e){return e}:n(h)?h:u.format(h)}),[h]),y=e.useMemo((function(){return r.guessQuantizeColorScale(f).domain(v)}),[f,v]),R=e.useMemo((function(){return function(e){return void 0===e.value?g:y(e.value)}}),[y,g]),q=e.useMemo((function(){return t.map((function(e){var r=i.find((function(r){return C(e,r)})),o=b(r);if(r){var t=d({},e,{data:r,value:o,formattedValue:j(o)});return t.color=R(t),t.label=m(t),t}return e}))}),[t,i,C,b,j,R]),M=s.useQuantizeColorScaleLegendData({scale:y,valueFormat:j});return{colorScale:y,getFillColor:R,boundFeatures:q,valueFormatter:j,legendData:M}},g=e.memo((function(e){var r=e.feature;return void 0===r.data?null:c.jsx(o.BasicTooltip,{id:r.label,color:r.color,enableChip:!0,value:r.formattedValue})}));g.propTypes={feature:t.object.isRequired},g.displayName="ChoroplethTooltip";var v={features:t.arrayOf(t.shape({id:t.string.isRequired,type:t.oneOf(["Feature"]).isRequired,properties:t.object,geometry:t.object.isRequired})).isRequired,projectionType:t.oneOf(Object.keys(p)).isRequired,projectionScale:t.number.isRequired,projectionTranslation:t.arrayOf(t.number).isRequired,projectionRotation:t.arrayOf(t.number).isRequired,fillColor:t.oneOfType([t.string,t.func]).isRequired,borderWidth:t.oneOfType([t.number,t.func]).isRequired,borderColor:i.inheritedColorPropType.isRequired,enableGraticule:t.bool.isRequired,graticuleLineWidth:t.number.isRequired,graticuleLineColor:t.string.isRequired,isInteractive:t.bool.isRequired,onMouseEnter:t.func.isRequired,onMouseMove:t.func.isRequired,onMouseLeave:t.func.isRequired,onClick:t.func.isRequired,tooltip:t.any,layers:t.arrayOf(t.oneOfType([t.oneOf(["graticule","features"]),t.func])).isRequired},C=d({},v,{role:t.string.isRequired}),m=d({pixelRatio:t.number.isRequired},v),b={data:t.arrayOf(t.object).isRequired,match:t.oneOfType([t.string,t.func]).isRequired,label:t.oneOfType([t.string,t.func]).isRequired,value:t.oneOfType([t.string,t.func]).isRequired,valueFormat:t.oneOfType([t.string,t.func]),colors:r.quantizeColorScalePropType.isRequired,domain:t.arrayOf(t.number).isRequired,unknownColor:t.string.isRequired,layers:t.arrayOf(t.oneOfType([t.oneOf(["graticule","features","legends"]),t.func])).isRequired},j=d({},C,b,{role:t.string.isRequired}),y=d({},m,b),R={projectionType:"mercator",projectionScale:100,projectionTranslation:[.5,.5],projectionRotation:[0,0,0],enableGraticule:!1,graticuleLineWidth:.5,graticuleLineColor:"#999999",fillColor:"#dddddd",borderWidth:0,borderColor:"#000000",isInteractive:!0,onMouseEnter:function(){},onMouseLeave:function(){},onMouseMove:function(){},onClick:function(){},layers:["graticule","features"],legends:[],fill:[],defs:[]},q=d({},R,{role:"img"}),M=d({},R,{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1}),T={match:"id",label:"id",value:"value",colors:"PuBuGn",unknownColor:"#999",tooltip:g,layers:["graticule","features","legends"]},x=d({},q,T,{role:"img"}),k=d({},M,T),W=e.memo((function(e){var r=e.path,o=e.graticule,t=e.lineWidth,i=e.lineColor;return c.jsx("path",{fill:"none",strokeWidth:t,stroke:i,d:r(o())})}));W.propTypes={path:t.func.isRequired,graticule:t.func.isRequired,lineWidth:t.number.isRequired,lineColor:t.string.isRequired},W.displayName="GeoGraticule";var w=e.memo((function(e){var r,o=e.feature,t=e.path,i=e.fillColor,n=e.borderWidth,a=e.borderColor,u=e.onClick,l=e.onMouseEnter,s=e.onMouseMove,d=e.onMouseLeave;return c.jsx("path",{fill:null!=(r=null==o?void 0:o.fill)?r:i,strokeWidth:n,stroke:a,strokeLinejoin:"bevel",d:t(o),onMouseEnter:function(e){return l(o,e)},onMouseMove:function(e){return s(o,e)},onMouseLeave:function(e){return d(o,e)},onClick:function(e){return u(o,e)}},o.id)}));w.propTypes={feature:t.shape({id:t.string.isRequired,type:t.oneOf(["Feature"]).isRequired,properties:t.object,geometry:t.object.isRequired}).isRequired,path:t.func.isRequired,fillColor:t.string.isRequired,borderWidth:t.number.isRequired,borderColor:t.string.isRequired,onMouseEnter:t.func.isRequired,onMouseMove:t.func.isRequired,onMouseLeave:t.func.isRequired,onClick:t.func.isRequired},w.displayName="GeoMapFeature";var F=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.features,l=t.layers,s=t.projectionType,d=t.projectionScale,p=t.projectionTranslation,f=t.projectionRotation,g=t.fillColor,v=t.borderWidth,C=t.borderColor,m=t.enableGraticule,b=t.graticuleLineWidth,j=t.graticuleLineColor,y=t.isInteractive,R=t.onClick,q=t.tooltip,M=t.role,T=r.useDimensions(i,n,a),x=T.margin,k=T.outerWidth,F=T.outerHeight,E=h({width:i,height:n,projectionType:s,projectionScale:d,projectionTranslation:p,projectionRotation:f,fillColor:g,borderWidth:v,borderColor:C}),S=E.graticule,O=E.path,L=E.getFillColor,G=E.getBorderWidth,P=E.getBorderColor,B=r.useTheme(),D=o.useTooltip(),I=D.showTooltipFromEvent,N=D.hideTooltip,z=e.useCallback((function(e,r){return y&&R&&R(e,r)}),[y,R]),H=e.useCallback((function(e,r){return y&&q&&I(c.jsx(q,{feature:e}),r)}),[y,I,q]),A=e.useCallback((function(e,r){return y&&q&&I(c.jsx(q,{feature:e}),r)}),[y,I,q]),K=e.useCallback((function(){return y&&N()}),[y,N]);return c.jsx(r.SvgWrapper,{width:k,height:F,margin:x,theme:B,role:M,children:l.map((function(r,o){return"graticule"===r?!0!==m?null:c.jsx(W,{path:O,graticule:S,lineWidth:b,lineColor:j},"graticule"):"features"===r?c.jsx(e.Fragment,{children:u.map((function(e){return c.jsx(w,{feature:e,path:O,fillColor:L(e),borderWidth:G(e),borderColor:P(e),onMouseEnter:H,onMouseMove:A,onMouseLeave:K,onClick:z},e.id)}))},"features"):c.jsx(e.Fragment,{children:r(t)},o)}))})}));F.displayName="GeoMap",F.propTypes=C,F.defaultProps=q;var E=r.withContainer(F),S=function(e,o,t,i){var n=r.getRelativeCursor(o,e),a=n[0],u=n[1];return t.find((function(e){return l.geoContains(e,i.invert([a,u]))}))},O=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.pixelRatio,l=t.features,s=t.layers,d=t.projectionType,p=t.projectionScale,f=t.projectionTranslation,g=t.projectionRotation,v=t.fillColor,C=t.borderWidth,m=t.borderColor,b=t.enableGraticule,j=t.graticuleLineWidth,y=t.graticuleLineColor,R=t.isInteractive,q=t.onClick,M=t.onMouseMove,T=t.tooltip,x=e.useRef(null),k=r.useTheme(),W=r.useDimensions(i,n,a),w=W.margin,F=W.outerWidth,E=W.outerHeight,O=h({width:i,height:n,projectionType:d,projectionScale:p,projectionTranslation:f,projectionRotation:g,fillColor:v,borderWidth:C,borderColor:m}),L=O.projection,G=O.graticule,P=O.path,B=O.getFillColor,D=O.getBorderWidth,I=O.getBorderColor;e.useEffect((function(){if(x){x.current.width=F*u,x.current.height=E*u;var e=x.current.getContext("2d");e.scale(u,u),e.fillStyle=k.background,e.fillRect(0,0,F,E),e.translate(w.left,w.top),P.context(e),s.forEach((function(r){"graticule"===r?!0===b&&(e.lineWidth=j,e.strokeStyle=y,e.beginPath(),P(G()),e.stroke()):"features"===r?l.forEach((function(r){e.beginPath(),P(r),e.fillStyle=B(r),e.fill();var o=D(r);o>0&&(e.strokeStyle=I(r),e.lineWidth=o,e.stroke())})):r(e,t)}))}}),[x,F,E,w,u,k,P,G,B,D,I,l,s]);var N=o.useTooltip(),z=N.showTooltipFromEvent,H=N.hideTooltip,A=e.useCallback((function(e){if(R&&T){var r=S(e,x.current,l,L);r?z(c.jsx(T,{feature:r}),e):H(),M&&M(r||null,e)}}),[z,H,R,T,x,l,L]),K=e.useCallback((function(){return R&&H()}),[R,H]),Q=e.useCallback((function(e){if(R&&q){var r=S(e,x.current,l,L);r&&q(r,e)}}),[R,x,l,L,q]);return c.jsx("canvas",{ref:x,width:F*u,height:E*u,style:{width:F,height:E,cursor:R?"auto":"normal"},onMouseMove:A,onMouseLeave:K,onClick:Q})}));O.displatName="GeoMapCanvas",O.propTypes=m,O.defaultProps=M;var L=r.withContainer(O),G=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.features,l=t.data,p=t.match,g=t.label,v=t.value,C=t.valueFormat,m=t.projectionType,b=t.projectionScale,j=t.projectionTranslation,y=t.projectionRotation,R=t.colors,q=t.domain,M=t.unknownColor,T=t.borderWidth,k=t.borderColor,F=t.enableGraticule,E=t.graticuleLineWidth,S=t.graticuleLineColor,O=t.layers,L=t.legends,G=t.isInteractive,P=t.onClick,B=t.tooltip,D=t.role,I=t.defs,N=void 0===I?x.defs:I,z=t.fill,H=void 0===z?x.fill:z,A=r.useDimensions(i,n,a),K=A.margin,Q=A.outerWidth,V=A.outerHeight,J=h({width:i,height:n,projectionType:m,projectionScale:b,projectionTranslation:j,projectionRotation:y,fillColor:function(){},borderWidth:T,borderColor:k}),U=J.graticule,X=J.path,Y=J.getBorderWidth,Z=J.getBorderColor,$=f({features:u,data:l,match:p,label:g,value:v,valueFormat:C,colors:R,unknownColor:M,domain:q}),_=$.getFillColor,ee=$.boundFeatures,re=$.legendData,oe=r.useTheme(),te=r.bindDefs(N,ee,H,{dataKey:"data",targetKey:"fill"}),ie=o.useTooltip(),ne=ie.showTooltipFromEvent,ae=ie.hideTooltip,ue=e.useCallback((function(e,r){return G&&P&&P(e,r)}),[G,P]),le=e.useCallback((function(e,r){return G&&B&&ne(c.jsx(B,{feature:e}),r)}),[G,ne,B]),se=e.useCallback((function(e,r){return G&&B&&ne(c.jsx(B,{feature:e}),r)}),[G,ne,B]),ce=e.useCallback((function(){return G&&ae()}),[G,ae]);return c.jsx(r.SvgWrapper,{width:Q,height:V,margin:K,theme:oe,defs:te,role:D,children:O.map((function(r,o){return"graticule"===r?!0!==F?null:c.jsx(W,{path:X,graticule:U,lineWidth:E,lineColor:S},"graticule"):"features"===r?c.jsx(e.Fragment,{children:ee.map((function(e){return c.jsx(w,{feature:e,path:X,fillColor:_(e),borderWidth:Y(e),borderColor:Z(e),onMouseEnter:le,onMouseMove:se,onMouseLeave:ce,onClick:ue},e.id)}))},"features"):"legends"===r?L.map((function(e,r){return c.jsx(s.BoxLegendSvg,d({containerWidth:i,containerHeight:n,data:re},e),r)})):c.jsx(e.Fragment,{children:r({})},o)}))})}));G.displayName="Choropleth",G.propTypes=j,G.defaultProps=x;var P=r.withContainer(G),B=function(e,o,t,i){var n=r.getRelativeCursor(o,e),a=n[0],u=n[1];return t.find((function(e){return l.geoContains(e,i.invert([a,u]))}))},D=e.memo((function(t){var i=t.width,n=t.height,a=t.margin,u=t.pixelRatio,l=t.features,p=t.data,g=t.match,v=t.label,C=t.value,m=t.valueFormat,b=t.projectionType,j=t.projectionScale,y=t.projectionTranslation,R=t.projectionRotation,q=t.colors,M=t.domain,T=t.unknownColor,x=t.borderWidth,k=t.borderColor,W=t.enableGraticule,w=t.graticuleLineWidth,F=t.graticuleLineColor,E=t.layers,S=t.legends,O=t.isInteractive,L=t.onClick,G=t.onMouseMove,P=t.tooltip,D=e.useRef(null),I=r.useTheme(),N=r.useDimensions(i,n,a),z=N.margin,H=N.outerWidth,A=N.outerHeight,K=h({width:i,height:n,projectionType:b,projectionScale:j,projectionTranslation:y,projectionRotation:R,fillColor:function(){},borderWidth:x,borderColor:k}),Q=K.projection,V=K.graticule,J=K.path,U=K.getBorderWidth,X=K.getBorderColor,Y=f({features:l,data:p,match:g,label:v,value:C,valueFormat:m,colors:q,unknownColor:T,domain:M}),Z=Y.getFillColor,$=Y.boundFeatures,_=Y.legendData;e.useEffect((function(){if(D){D.current.width=H*u,D.current.height=A*u;var e=D.current.getContext("2d");e.scale(u,u),e.fillStyle=I.background,e.fillRect(0,0,H,A),e.translate(z.left,z.top),J.context(e),E.forEach((function(r){"graticule"===r?!0===W&&(e.lineWidth=w,e.strokeStyle=F,e.beginPath(),J(V()),e.stroke()):"features"===r?$.forEach((function(r){e.beginPath(),J(r),e.fillStyle=Z(r),e.fill();var o=U(r);o>0&&(e.strokeStyle=X(r),e.lineWidth=o,e.stroke())})):"legends"===r&&S.forEach((function(r){s.renderLegendToCanvas(e,d({},r,{data:_,containerWidth:i,containerHeight:n,theme:I}))}))}))}}),[D,H,A,z,u,I,J,V,Z,U,X,$,S,E]);var ee=o.useTooltip(),re=ee.showTooltipFromEvent,oe=ee.hideTooltip,te=e.useCallback((function(e){if(O&&P){var r=B(e,D.current,$,Q);r?re(c.jsx(P,{feature:r}),e):oe(),G&&G(r||null,e)}}),[re,oe,O,P,D,$,Q]),ie=e.useCallback((function(){return O&&oe()}),[O,oe]),ne=e.useCallback((function(e){if(O&&L){var r=B(e,D.current,$,Q);r&&L(r,e)}}),[O,D,$,Q,L]);return c.jsx("canvas",{ref:D,width:H*u,height:A*u,style:{width:H,height:A,cursor:O?"auto":"normal"},onMouseMove:te,onMouseLeave:ie,onClick:ne})}));D.displayName="ChoroplethCanvas",D.propTypes=y,D.defaultProps=k;var I=r.withContainer(D);exports.Choropleth=P,exports.ChoroplethCanvas=I,exports.ChoroplethCanvasDefaultProps=k,exports.ChoroplethCanvasPropTypes=y,exports.ChoroplethDefaultProps=x,exports.ChoroplethPropTypes=j,exports.GeoMap=E,exports.GeoMapCanvas=L,exports.GeoMapCanvasDefaultProps=M,exports.GeoMapCanvasPropTypes=m,exports.GeoMapDefaultProps=q,exports.GeoMapPropTypes=C,exports.ResponsiveChoropleth=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(P,d({width:o,height:t},e))}})},exports.ResponsiveChoroplethCanvas=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(I,d({width:o,height:t},e))}})},exports.ResponsiveGeoMap=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(E,d({width:o,height:t},e))}})},exports.ResponsiveGeoMapCanvas=function(e){return c.jsx(r.ResponsiveWrapper,{children:function(r){var o=r.width,t=r.height;return c.jsx(L,d({width:o,height:t},e))}})},exports.projectionById=p,exports.useChoropleth=f,exports.useGeoMap=h; | ||
"use strict";var e=require("react"),o=require("@nivo/core"),r=require("@nivo/tooltip"),i=require("prop-types"),t=require("@nivo/colors"),n=require("lodash/isFunction"),a=require("lodash/get"),u=require("d3-format"),l=require("d3-geo"),s=require("@nivo/legends"),d=require("react/jsx-runtime");function c(){return c=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},c.apply(this,arguments)}var p={azimuthalEqualArea:l.geoAzimuthalEqualArea,azimuthalEquidistant:l.geoAzimuthalEquidistant,gnomonic:l.geoGnomonic,orthographic:l.geoOrthographic,stereographic:l.geoStereographic,equalEarth:l.geoEqualEarth,equirectangular:l.geoEquirectangular,mercator:l.geoMercator,transverseMercator:l.geoTransverseMercator,naturalEarth1:l.geoNaturalEarth1},f=function(r){var i=r.width,n=r.height,a=r.projectionType,u=r.projectionScale,s=r.projectionTranslation,d=r.projectionRotation,c=r.fillColor,f=r.borderWidth,h=r.borderColor,v=e.useMemo((function(){return p[a]().scale(u).translate([i*s[0],n*s[1]]).rotate(d)}),[i,n,a,u,s[0],s[1],d[0],d[1],d[2]]),g=e.useMemo((function(){return l.geoPath(v)}),[v]),m=e.useMemo((function(){return l.geoGraticule()})),C=o.useTheme(),b=e.useMemo((function(){return"function"==typeof f?f:function(){return f}}),[f]),j=t.useInheritedColor(h,C),y=e.useMemo((function(){return"function"==typeof c?c:function(){return c}}),[c]);return{projection:v,path:g,graticule:m,getBorderWidth:b,getBorderColor:j,getFillColor:y}},h=function(r){var i=r.features,t=r.data,l=r.match,d=r.label,p=r.value,f=r.valueFormat,h=r.colors,v=r.unknownColor,g=r.domain,m=e.useMemo((function(){return n(l)?l:function(e,o){var r=a(e,l),i=a(o,l);return r&&r===i}}),[l]),C=e.useMemo((function(){return n(d)?d:function(e){return a(e,d)}}),[d]),b=e.useMemo((function(){return n(p)?p:function(e){return a(e,p)}}),[p]),j=e.useMemo((function(){return void 0===f?function(e){return e}:n(f)?f:u.format(f)}),[f]),y=e.useMemo((function(){return o.guessQuantizeColorScale(h).domain(g)}),[h,g]),R=e.useMemo((function(){return function(e){return void 0===e.value?v:y(e.value)}}),[y,v]),q=e.useMemo((function(){return i.map((function(e){var o=t.find((function(o){return m(e,o)})),r=b(o);if(o){var i=c({},e,{data:o,value:r,formattedValue:j(r)});return i.color=R(i),i.label=C(i),i}return e}))}),[i,t,m,b,j,R]),M=s.useQuantizeColorScaleLegendData({scale:y,valueFormat:j});return{colorScale:y,getFillColor:R,boundFeatures:q,valueFormatter:j,legendData:M}},v=e.memo((function(e){var o=e.feature;return void 0===o.data?null:d.jsx(r.BasicTooltip,{id:o.label,color:o.color,enableChip:!0,value:o.formattedValue})}));v.propTypes={feature:i.object.isRequired},v.displayName="ChoroplethTooltip";var g={features:i.arrayOf(i.shape({id:i.string.isRequired,type:i.oneOf(["Feature"]).isRequired,properties:i.object,geometry:i.object.isRequired})).isRequired,projectionType:i.oneOf(Object.keys(p)).isRequired,projectionScale:i.number.isRequired,projectionTranslation:i.arrayOf(i.number).isRequired,projectionRotation:i.arrayOf(i.number).isRequired,fillColor:i.oneOfType([i.string,i.func]).isRequired,borderWidth:i.oneOfType([i.number,i.func]).isRequired,borderColor:t.inheritedColorPropType.isRequired,enableGraticule:i.bool.isRequired,graticuleLineWidth:i.number.isRequired,graticuleLineColor:i.string.isRequired,isInteractive:i.bool.isRequired,onMouseEnter:i.func.isRequired,onMouseMove:i.func.isRequired,onMouseLeave:i.func.isRequired,onClick:i.func.isRequired,tooltip:i.any,layers:i.arrayOf(i.oneOfType([i.oneOf(["graticule","features"]),i.func])).isRequired},m=c({},g,{role:i.string.isRequired}),C=c({pixelRatio:i.number.isRequired},g),b={data:i.arrayOf(i.object).isRequired,match:i.oneOfType([i.string,i.func]).isRequired,label:i.oneOfType([i.string,i.func]).isRequired,value:i.oneOfType([i.string,i.func]).isRequired,valueFormat:i.oneOfType([i.string,i.func]),colors:o.quantizeColorScalePropType.isRequired,domain:i.arrayOf(i.number).isRequired,unknownColor:i.string.isRequired,layers:i.arrayOf(i.oneOfType([i.oneOf(["graticule","features","legends"]),i.func])).isRequired},j=c({},m,b,{role:i.string.isRequired}),y=c({},C,b),R={projectionType:"mercator",projectionScale:100,projectionTranslation:[.5,.5],projectionRotation:[0,0,0],enableGraticule:!1,graticuleLineWidth:.5,graticuleLineColor:"#999999",fillColor:"#dddddd",borderWidth:0,borderColor:"#000000",isInteractive:!0,onMouseEnter:function(){},onMouseLeave:function(){},onMouseMove:function(){},onClick:function(){},layers:["graticule","features"],legends:[],fill:[],defs:[]},q=c({},R,{role:"img"}),M=c({},R,{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1}),T={match:"id",label:"id",value:"value",colors:"PuBuGn",unknownColor:"#999",tooltip:v,layers:["graticule","features","legends"]},x=c({},q,T,{role:"img"}),w=c({},M,T),k=e.memo((function(e){var o=e.path,r=e.graticule,i=e.lineWidth,t=e.lineColor;return d.jsx("path",{fill:"none",strokeWidth:i,stroke:t,d:o(r())})}));k.propTypes={path:i.func.isRequired,graticule:i.func.isRequired,lineWidth:i.number.isRequired,lineColor:i.string.isRequired},k.displayName="GeoGraticule";var W=e.memo((function(e){var o,r=e.feature,i=e.path,t=e.fillColor,n=e.borderWidth,a=e.borderColor,u=e.onClick,l=e.onMouseEnter,s=e.onMouseMove,c=e.onMouseLeave;return d.jsx("path",{fill:null!=(o=null==r?void 0:r.fill)?o:t,strokeWidth:n,stroke:a,strokeLinejoin:"bevel",d:i(r),onMouseEnter:function(e){return l(r,e)},onMouseMove:function(e){return s(r,e)},onMouseLeave:function(e){return c(r,e)},onClick:function(e){return u(r,e)}},r.id)}));W.propTypes={feature:i.shape({id:i.string.isRequired,type:i.oneOf(["Feature"]).isRequired,properties:i.object,geometry:i.object.isRequired}).isRequired,path:i.func.isRequired,fillColor:i.string.isRequired,borderWidth:i.number.isRequired,borderColor:i.string.isRequired,onMouseEnter:i.func.isRequired,onMouseMove:i.func.isRequired,onMouseLeave:i.func.isRequired,onClick:i.func.isRequired},W.displayName="GeoMapFeature";var F=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.features,l=i.layers,s=void 0===l?["graticule","features"]:l,c=i.projectionType,p=void 0===c?"mercator":c,h=i.projectionScale,v=void 0===h?100:h,g=i.projectionTranslation,m=void 0===g?[.5,.5]:g,C=i.projectionRotation,b=void 0===C?[0,0,0]:C,j=i.fillColor,y=void 0===j?"#dddddd":j,R=i.borderWidth,q=void 0===R?0:R,M=i.borderColor,T=void 0===M?"#000000":M,x=i.enableGraticule,w=void 0!==x&&x,F=i.graticuleLineWidth,E=void 0===F?.5:F,S=i.graticuleLineColor,O=void 0===S?"#999999":S,G=i.isInteractive,L=void 0===G||G,P=i.onClick,B=void 0===P?function(){}:P,D=i.tooltip,I=i.role,N=void 0===I?"img":I,z=o.useDimensions(t,n,a),H=z.margin,A=z.outerWidth,K=z.outerHeight,Q=f({width:t,height:n,projectionType:p,projectionScale:v,projectionTranslation:m,projectionRotation:b,fillColor:y,borderWidth:q,borderColor:T}),V=Q.graticule,J=Q.path,U=Q.getFillColor,X=Q.getBorderWidth,Y=Q.getBorderColor,Z=o.useTheme(),$=r.useTooltip(),_=$.showTooltipFromEvent,ee=$.hideTooltip,oe=e.useCallback((function(e,o){return L&&B&&B(e,o)}),[L,B]),re=e.useCallback((function(e,o){return L&&D&&_(d.jsx(D,{feature:e}),o)}),[L,_,D]),ie=e.useCallback((function(e,o){return L&&D&&_(d.jsx(D,{feature:e}),o)}),[L,_,D]),te=e.useCallback((function(){return L&&ee()}),[L,ee]);return d.jsx(o.SvgWrapper,{width:A,height:K,margin:H,theme:Z,role:N,children:s.map((function(o,r){return"graticule"===o?!0!==w?null:d.jsx(k,{path:J,graticule:V,lineWidth:E,lineColor:O},"graticule"):"features"===o?d.jsx(e.Fragment,{children:u.map((function(e){return d.jsx(W,{feature:e,path:J,fillColor:U(e),borderWidth:X(e),borderColor:Y(e),onMouseEnter:re,onMouseMove:ie,onMouseLeave:te,onClick:oe},e.id)}))},"features"):d.jsx(e.Fragment,{children:o(i)},r)}))})}));F.displayName="GeoMap",F.propTypes=m;var E=o.withContainer(F),S=function(e,r,i,t){var n=o.getRelativeCursor(r,e),a=n[0],u=n[1];return i.find((function(e){return l.geoContains(e,t.invert([a,u]))}))},O=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.pixelRatio,l=void 0===u?"undefined"!=typeof window&&window.devicePixelRatio||1:u,s=i.features,c=i.layers,p=i.projectionType,h=void 0===p?"mercator":p,v=i.projectionScale,g=void 0===v?100:v,m=i.projectionTranslation,C=void 0===m?[.5,.5]:m,b=i.projectionRotation,j=void 0===b?[0,0,0]:b,y=i.fillColor,R=void 0===y?"#dddddd":y,q=i.borderWidth,M=void 0===q?0:q,T=i.borderColor,x=void 0===T?"#000000":T,w=i.enableGraticule,k=void 0!==w&&w,W=i.graticuleLineWidth,F=void 0===W?.5:W,E=i.graticuleLineColor,O=void 0===E?"#999999":E,G=i.isInteractive,L=void 0===G||G,P=i.onClick,B=void 0===P?function(){}:P,D=i.onMouseMove,I=void 0===D?function(){}:D,N=i.tooltip,z=e.useRef(null),H=o.useTheme(),A=o.useDimensions(t,n,a),K=A.margin,Q=A.outerWidth,V=A.outerHeight,J=f({width:t,height:n,projectionType:h,projectionScale:g,projectionTranslation:C,projectionRotation:j,fillColor:R,borderWidth:M,borderColor:x}),U=J.projection,X=J.graticule,Y=J.path,Z=J.getFillColor,$=J.getBorderWidth,_=J.getBorderColor;e.useEffect((function(){if(z){z.current.width=Q*l,z.current.height=V*l;var e=z.current.getContext("2d");e.scale(l,l),e.fillStyle=H.background,e.fillRect(0,0,Q,V),e.translate(K.left,K.top),Y.context(e),c.forEach((function(o){"graticule"===o?!0===k&&(e.lineWidth=F,e.strokeStyle=O,e.beginPath(),Y(X()),e.stroke()):"features"===o?s.forEach((function(o){e.beginPath(),Y(o),e.fillStyle=Z(o),e.fill();var r=$(o);r>0&&(e.strokeStyle=_(o),e.lineWidth=r,e.stroke())})):o(e,i)}))}}),[z,Q,V,K,l,H,Y,X,Z,$,_,s,c]);var ee=r.useTooltip(),oe=ee.showTooltipFromEvent,re=ee.hideTooltip,ie=e.useCallback((function(e){if(L&&N){var o=S(e,z.current,s,U);o?oe(d.jsx(N,{feature:o}),e):re(),I&&I(o||null,e)}}),[oe,re,L,N,z,s,U]),te=e.useCallback((function(){return L&&re()}),[L,re]),ne=e.useCallback((function(e){if(L&&B){var o=S(e,z.current,s,U);o&&B(o,e)}}),[L,z,s,U,B]);return d.jsx("canvas",{ref:z,width:Q*l,height:V*l,style:{width:Q,height:V,cursor:L?"auto":"normal"},onMouseMove:ie,onMouseLeave:te,onClick:ne})}));O.displatName="GeoMapCanvas",O.propTypes=C;var G=o.withContainer(O),L=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.features,l=i.data,p=i.match,g=void 0===p?"id":p,m=i.label,C=void 0===m?"id":m,b=i.value,j=void 0===b?"value":b,y=i.valueFormat,R=i.projectionType,q=void 0===R?"mercator":R,M=i.projectionScale,T=void 0===M?100:M,x=i.projectionTranslation,w=void 0===x?[.5,.5]:x,F=i.projectionRotation,E=void 0===F?[0,0,0]:F,S=i.colors,O=void 0===S?"PuBuGn":S,G=i.domain,L=i.unknownColor,P=void 0===L?"#999":L,B=i.borderWidth,D=void 0===B?0:B,I=i.borderColor,N=void 0===I?"#000000":I,z=i.enableGraticule,H=void 0!==z&&z,A=i.graticuleLineWidth,K=void 0===A?.5:A,Q=i.graticuleLineColor,V=void 0===Q?"#999999":Q,J=i.layers,U=void 0===J?["graticule","features","legends"]:J,X=i.legends,Y=void 0===X?[]:X,Z=i.isInteractive,$=void 0===Z||Z,_=i.onClick,ee=void 0===_?function(){}:_,oe=i.tooltip,re=void 0===oe?v:oe,ie=i.role,te=void 0===ie?"img":ie,ne=i.defs,ae=void 0===ne?[]:ne,ue=i.fill,le=void 0===ue?[]:ue,se=o.useDimensions(t,n,a),de=se.margin,ce=se.outerWidth,pe=se.outerHeight,fe=f({width:t,height:n,projectionType:q,projectionScale:T,projectionTranslation:w,projectionRotation:E,fillColor:function(){},borderWidth:D,borderColor:N}),he=fe.graticule,ve=fe.path,ge=fe.getBorderWidth,me=fe.getBorderColor,Ce=h({features:u,data:l,match:g,label:C,value:j,valueFormat:y,colors:O,unknownColor:P,domain:G}),be=Ce.getFillColor,je=Ce.boundFeatures,ye=Ce.legendData,Re=o.useTheme(),qe=o.bindDefs(ae,je,le,{dataKey:"data",targetKey:"fill"}),Me=r.useTooltip(),Te=Me.showTooltipFromEvent,xe=Me.hideTooltip,we=e.useCallback((function(e,o){return $&&ee&&ee(e,o)}),[$,ee]),ke=e.useCallback((function(e,o){return $&&re&&Te(d.jsx(re,{feature:e}),o)}),[$,Te,re]),We=e.useCallback((function(e,o){return $&&re&&Te(d.jsx(re,{feature:e}),o)}),[$,Te,re]),Fe=e.useCallback((function(){return $&&xe()}),[$,xe]);return d.jsx(o.SvgWrapper,{width:ce,height:pe,margin:de,theme:Re,defs:qe,role:te,children:U.map((function(o,r){return"graticule"===o?!0!==H?null:d.jsx(k,{path:ve,graticule:he,lineWidth:K,lineColor:V},"graticule"):"features"===o?d.jsx(e.Fragment,{children:je.map((function(e){return d.jsx(W,{feature:e,path:ve,fillColor:be(e),borderWidth:ge(e),borderColor:me(e),onMouseEnter:ke,onMouseMove:We,onMouseLeave:Fe,onClick:we},e.id)}))},"features"):"legends"===o?Y.map((function(e,o){return d.jsx(s.BoxLegendSvg,c({containerWidth:t,containerHeight:n,data:ye},e),o)})):d.jsx(e.Fragment,{children:o({})},r)}))})}));L.displayName="Choropleth",L.propTypes=j;var P=o.withContainer(L),B=function(e,r,i,t){var n=o.getRelativeCursor(r,e),a=n[0],u=n[1];return i.find((function(e){return l.geoContains(e,t.invert([a,u]))}))},D=e.memo((function(i){var t=i.width,n=i.height,a=i.margin,u=i.pixelRatio,l=void 0===u?"undefined"!=typeof window&&window.devicePixelRatio||1:u,p=i.features,g=i.data,m=i.match,C=void 0===m?"id":m,b=i.label,j=void 0===b?"id":b,y=i.value,R=void 0===y?"value":y,q=i.valueFormat,M=i.projectionType,T=void 0===M?"mercator":M,x=i.projectionScale,w=void 0===x?100:x,k=i.projectionTranslation,W=void 0===k?[.5,.5]:k,F=i.projectionRotation,E=void 0===F?[0,0,0]:F,S=i.colors,O=void 0===S?"PuBuGn":S,G=i.domain,L=i.unknownColor,P=void 0===L?"#999":L,D=i.borderWidth,I=void 0===D?0:D,N=i.borderColor,z=void 0===N?"#000000":N,H=i.enableGraticule,A=void 0!==H&&H,K=i.graticuleLineWidth,Q=void 0===K?.5:K,V=i.graticuleLineColor,J=void 0===V?"#999999":V,U=i.layers,X=void 0===U?["graticule","features","legends"]:U,Y=i.legends,Z=void 0===Y?[]:Y,$=i.isInteractive,_=void 0===$||$,ee=i.onClick,oe=void 0===ee?function(){}:ee,re=i.onMouseMove,ie=void 0===re?function(){}:re,te=i.tooltip,ne=void 0===te?v:te,ae=e.useRef(null),ue=o.useTheme(),le=o.useDimensions(t,n,a),se=le.margin,de=le.outerWidth,ce=le.outerHeight,pe=f({width:t,height:n,projectionType:T,projectionScale:w,projectionTranslation:W,projectionRotation:E,fillColor:function(){},borderWidth:I,borderColor:z}),fe=pe.projection,he=pe.graticule,ve=pe.path,ge=pe.getBorderWidth,me=pe.getBorderColor,Ce=h({features:p,data:g,match:C,label:j,value:R,valueFormat:q,colors:O,unknownColor:P,domain:G}),be=Ce.getFillColor,je=Ce.boundFeatures,ye=Ce.legendData;e.useEffect((function(){if(ae){ae.current.width=de*l,ae.current.height=ce*l;var e=ae.current.getContext("2d");e.scale(l,l),e.fillStyle=ue.background,e.fillRect(0,0,de,ce),e.translate(se.left,se.top),ve.context(e),X.forEach((function(o){"graticule"===o?!0===A&&(e.lineWidth=Q,e.strokeStyle=J,e.beginPath(),ve(he()),e.stroke()):"features"===o?je.forEach((function(o){e.beginPath(),ve(o),e.fillStyle=be(o),e.fill();var r=ge(o);r>0&&(e.strokeStyle=me(o),e.lineWidth=r,e.stroke())})):"legends"===o&&Z.forEach((function(o){s.renderLegendToCanvas(e,c({},o,{data:ye,containerWidth:t,containerHeight:n,theme:ue}))}))}))}}),[ae,de,ce,se,l,ue,ve,he,be,ge,me,je,Z,X]);var Re=r.useTooltip(),qe=Re.showTooltipFromEvent,Me=Re.hideTooltip,Te=e.useCallback((function(e){if(_&&ne){var o=B(e,ae.current,je,fe);o?qe(d.jsx(ne,{feature:o}),e):Me(),ie&&ie(o||null,e)}}),[qe,Me,_,ne,ae,je,fe]),xe=e.useCallback((function(){return _&&Me()}),[_,Me]),we=e.useCallback((function(e){if(_&&oe){var o=B(e,ae.current,je,fe);o&&oe(o,e)}}),[_,ae,je,fe,oe]);return d.jsx("canvas",{ref:ae,width:de*l,height:ce*l,style:{width:de,height:ce,cursor:_?"auto":"normal"},onMouseMove:Te,onMouseLeave:xe,onClick:we})}));D.displayName="ChoroplethCanvas",D.propTypes=y;var I=o.withContainer(D);exports.Choropleth=P,exports.ChoroplethCanvas=I,exports.ChoroplethCanvasDefaultProps=w,exports.ChoroplethCanvasPropTypes=y,exports.ChoroplethDefaultProps=x,exports.ChoroplethPropTypes=j,exports.GeoMap=E,exports.GeoMapCanvas=G,exports.GeoMapCanvasDefaultProps=M,exports.GeoMapCanvasPropTypes=C,exports.GeoMapDefaultProps=q,exports.GeoMapPropTypes=m,exports.ResponsiveChoropleth=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(P,c({width:r,height:i},e))}})},exports.ResponsiveChoroplethCanvas=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(I,c({width:r,height:i},e))}})},exports.ResponsiveGeoMap=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(E,c({width:r,height:i},e))}})},exports.ResponsiveGeoMapCanvas=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var r=o.width,i=o.height;return d.jsx(G,c({width:r,height:i},e))}})},exports.projectionById=p,exports.useChoropleth=h,exports.useGeoMap=f; | ||
//# sourceMappingURL=nivo-geo.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{useMemo as e,memo as r,useCallback as o,Fragment as t,useRef as i,useEffect as n}from"react";import{useTheme as a,guessQuantizeColorScale as u,quantizeColorScalePropType as l,useDimensions as c,SvgWrapper as d,withContainer as s,ResponsiveWrapper as f,getRelativeCursor as h,bindDefs as p}from"@nivo/core";import{BasicTooltip as g,useTooltip as v}from"@nivo/tooltip";import m from"prop-types";import{useInheritedColor as C,inheritedColorPropType as b}from"@nivo/colors";import y from"lodash/isFunction";import R from"lodash/get";import{format as j}from"d3-format";import{geoAzimuthalEqualArea as q,geoAzimuthalEquidistant as T,geoGnomonic as M,geoOrthographic as W,geoStereographic as w,geoEqualEarth as k,geoEquirectangular as F,geoMercator as O,geoTransverseMercator as L,geoNaturalEarth1 as E,geoPath as S,geoGraticule as G,geoContains as x}from"d3-geo";import{useQuantizeColorScaleLegendData as B,BoxLegendSvg as P,renderLegendToCanvas as N}from"@nivo/legends";import{jsx as H}from"react/jsx-runtime";function I(){return I=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e},I.apply(this,arguments)}var D={azimuthalEqualArea:q,azimuthalEquidistant:T,gnomonic:M,orthographic:W,stereographic:w,equalEarth:k,equirectangular:F,mercator:O,transverseMercator:L,naturalEarth1:E},z=function(r){var o=r.width,t=r.height,i=r.projectionType,n=r.projectionScale,u=r.projectionTranslation,l=r.projectionRotation,c=r.fillColor,d=r.borderWidth,s=r.borderColor,f=e((function(){return D[i]().scale(n).translate([o*u[0],t*u[1]]).rotate(l)}),[o,t,i,n,u[0],u[1],l[0],l[1],l[2]]),h=e((function(){return S(f)}),[f]),p=e((function(){return G()})),g=a(),v=e((function(){return"function"==typeof d?d:function(){return d}}),[d]),m=C(s,g),b=e((function(){return"function"==typeof c?c:function(){return c}}),[c]);return{projection:f,path:h,graticule:p,getBorderWidth:v,getBorderColor:m,getFillColor:b}},K=function(r){var o=r.features,t=r.data,i=r.match,n=r.label,a=r.value,l=r.valueFormat,c=r.colors,d=r.unknownColor,s=r.domain,f=e((function(){return y(i)?i:function(e,r){var o=R(e,i),t=R(r,i);return o&&o===t}}),[i]),h=e((function(){return y(n)?n:function(e){return R(e,n)}}),[n]),p=e((function(){return y(a)?a:function(e){return R(e,a)}}),[a]),g=e((function(){return void 0===l?function(e){return e}:y(l)?l:j(l)}),[l]),v=e((function(){return u(c).domain(s)}),[c,s]),m=e((function(){return function(e){return void 0===e.value?d:v(e.value)}}),[v,d]),C=e((function(){return o.map((function(e){var r=t.find((function(r){return f(e,r)})),o=p(r);if(r){var i=I({},e,{data:r,value:o,formattedValue:g(o)});return i.color=m(i),i.label=h(i),i}return e}))}),[o,t,f,p,g,m]),b=B({scale:v,valueFormat:g});return{colorScale:v,getFillColor:m,boundFeatures:C,valueFormatter:g,legendData:b}},V=r((function(e){var r=e.feature;return void 0===r.data?null:H(g,{id:r.label,color:r.color,enableChip:!0,value:r.formattedValue})}));V.propTypes={feature:m.object.isRequired},V.displayName="ChoroplethTooltip";var A={features:m.arrayOf(m.shape({id:m.string.isRequired,type:m.oneOf(["Feature"]).isRequired,properties:m.object,geometry:m.object.isRequired})).isRequired,projectionType:m.oneOf(Object.keys(D)).isRequired,projectionScale:m.number.isRequired,projectionTranslation:m.arrayOf(m.number).isRequired,projectionRotation:m.arrayOf(m.number).isRequired,fillColor:m.oneOfType([m.string,m.func]).isRequired,borderWidth:m.oneOfType([m.number,m.func]).isRequired,borderColor:b.isRequired,enableGraticule:m.bool.isRequired,graticuleLineWidth:m.number.isRequired,graticuleLineColor:m.string.isRequired,isInteractive:m.bool.isRequired,onMouseEnter:m.func.isRequired,onMouseMove:m.func.isRequired,onMouseLeave:m.func.isRequired,onClick:m.func.isRequired,tooltip:m.any,layers:m.arrayOf(m.oneOfType([m.oneOf(["graticule","features"]),m.func])).isRequired},J=I({},A,{role:m.string.isRequired}),Q=I({pixelRatio:m.number.isRequired},A),U={data:m.arrayOf(m.object).isRequired,match:m.oneOfType([m.string,m.func]).isRequired,label:m.oneOfType([m.string,m.func]).isRequired,value:m.oneOfType([m.string,m.func]).isRequired,valueFormat:m.oneOfType([m.string,m.func]),colors:l.isRequired,domain:m.arrayOf(m.number).isRequired,unknownColor:m.string.isRequired,layers:m.arrayOf(m.oneOfType([m.oneOf(["graticule","features","legends"]),m.func])).isRequired},X=I({},J,U,{role:m.string.isRequired}),Y=I({},Q,U),Z={projectionType:"mercator",projectionScale:100,projectionTranslation:[.5,.5],projectionRotation:[0,0,0],enableGraticule:!1,graticuleLineWidth:.5,graticuleLineColor:"#999999",fillColor:"#dddddd",borderWidth:0,borderColor:"#000000",isInteractive:!0,onMouseEnter:function(){},onMouseLeave:function(){},onMouseMove:function(){},onClick:function(){},layers:["graticule","features"],legends:[],fill:[],defs:[]},$=I({},Z,{role:"img"}),_=I({},Z,{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1}),ee={match:"id",label:"id",value:"value",colors:"PuBuGn",unknownColor:"#999",tooltip:V,layers:["graticule","features","legends"]},re=I({},$,ee,{role:"img"}),oe=I({},_,ee),te=r((function(e){var r=e.path,o=e.graticule,t=e.lineWidth,i=e.lineColor;return H("path",{fill:"none",strokeWidth:t,stroke:i,d:r(o())})}));te.propTypes={path:m.func.isRequired,graticule:m.func.isRequired,lineWidth:m.number.isRequired,lineColor:m.string.isRequired},te.displayName="GeoGraticule";var ie=r((function(e){var r,o=e.feature,t=e.path,i=e.fillColor,n=e.borderWidth,a=e.borderColor,u=e.onClick,l=e.onMouseEnter,c=e.onMouseMove,d=e.onMouseLeave;return H("path",{fill:null!=(r=null==o?void 0:o.fill)?r:i,strokeWidth:n,stroke:a,strokeLinejoin:"bevel",d:t(o),onMouseEnter:function(e){return l(o,e)},onMouseMove:function(e){return c(o,e)},onMouseLeave:function(e){return d(o,e)},onClick:function(e){return u(o,e)}},o.id)}));ie.propTypes={feature:m.shape({id:m.string.isRequired,type:m.oneOf(["Feature"]).isRequired,properties:m.object,geometry:m.object.isRequired}).isRequired,path:m.func.isRequired,fillColor:m.string.isRequired,borderWidth:m.number.isRequired,borderColor:m.string.isRequired,onMouseEnter:m.func.isRequired,onMouseMove:m.func.isRequired,onMouseLeave:m.func.isRequired,onClick:m.func.isRequired},ie.displayName="GeoMapFeature";var ne=r((function(e){var r=e.width,i=e.height,n=e.margin,u=e.features,l=e.layers,s=e.projectionType,f=e.projectionScale,h=e.projectionTranslation,p=e.projectionRotation,g=e.fillColor,m=e.borderWidth,C=e.borderColor,b=e.enableGraticule,y=e.graticuleLineWidth,R=e.graticuleLineColor,j=e.isInteractive,q=e.onClick,T=e.tooltip,M=e.role,W=c(r,i,n),w=W.margin,k=W.outerWidth,F=W.outerHeight,O=z({width:r,height:i,projectionType:s,projectionScale:f,projectionTranslation:h,projectionRotation:p,fillColor:g,borderWidth:m,borderColor:C}),L=O.graticule,E=O.path,S=O.getFillColor,G=O.getBorderWidth,x=O.getBorderColor,B=a(),P=v(),N=P.showTooltipFromEvent,I=P.hideTooltip,D=o((function(e,r){return j&&q&&q(e,r)}),[j,q]),K=o((function(e,r){return j&&T&&N(H(T,{feature:e}),r)}),[j,N,T]),V=o((function(e,r){return j&&T&&N(H(T,{feature:e}),r)}),[j,N,T]),A=o((function(){return j&&I()}),[j,I]);return H(d,{width:k,height:F,margin:w,theme:B,role:M,children:l.map((function(r,o){return"graticule"===r?!0!==b?null:H(te,{path:E,graticule:L,lineWidth:y,lineColor:R},"graticule"):"features"===r?H(t,{children:u.map((function(e){return H(ie,{feature:e,path:E,fillColor:S(e),borderWidth:G(e),borderColor:x(e),onMouseEnter:K,onMouseMove:V,onMouseLeave:A,onClick:D},e.id)}))},"features"):H(t,{children:r(e)},o)}))})}));ne.displayName="GeoMap",ne.propTypes=J,ne.defaultProps=$;var ae=s(ne),ue=function(e){return H(f,{children:function(r){var o=r.width,t=r.height;return H(ae,I({width:o,height:t},e))}})},le=function(e,r,o,t){var i=h(r,e),n=i[0],a=i[1];return o.find((function(e){return x(e,t.invert([n,a]))}))},ce=r((function(e){var r=e.width,t=e.height,u=e.margin,l=e.pixelRatio,d=e.features,s=e.layers,f=e.projectionType,h=e.projectionScale,p=e.projectionTranslation,g=e.projectionRotation,m=e.fillColor,C=e.borderWidth,b=e.borderColor,y=e.enableGraticule,R=e.graticuleLineWidth,j=e.graticuleLineColor,q=e.isInteractive,T=e.onClick,M=e.onMouseMove,W=e.tooltip,w=i(null),k=a(),F=c(r,t,u),O=F.margin,L=F.outerWidth,E=F.outerHeight,S=z({width:r,height:t,projectionType:f,projectionScale:h,projectionTranslation:p,projectionRotation:g,fillColor:m,borderWidth:C,borderColor:b}),G=S.projection,x=S.graticule,B=S.path,P=S.getFillColor,N=S.getBorderWidth,I=S.getBorderColor;n((function(){if(w){w.current.width=L*l,w.current.height=E*l;var r=w.current.getContext("2d");r.scale(l,l),r.fillStyle=k.background,r.fillRect(0,0,L,E),r.translate(O.left,O.top),B.context(r),s.forEach((function(o){"graticule"===o?!0===y&&(r.lineWidth=R,r.strokeStyle=j,r.beginPath(),B(x()),r.stroke()):"features"===o?d.forEach((function(e){r.beginPath(),B(e),r.fillStyle=P(e),r.fill();var o=N(e);o>0&&(r.strokeStyle=I(e),r.lineWidth=o,r.stroke())})):o(r,e)}))}}),[w,L,E,O,l,k,B,x,P,N,I,d,s]);var D=v(),K=D.showTooltipFromEvent,V=D.hideTooltip,A=o((function(e){if(q&&W){var r=le(e,w.current,d,G);r?K(H(W,{feature:r}),e):V(),M&&M(r||null,e)}}),[K,V,q,W,w,d,G]),J=o((function(){return q&&V()}),[q,V]),Q=o((function(e){if(q&&T){var r=le(e,w.current,d,G);r&&T(r,e)}}),[q,w,d,G,T]);return H("canvas",{ref:w,width:L*l,height:E*l,style:{width:L,height:E,cursor:q?"auto":"normal"},onMouseMove:A,onMouseLeave:J,onClick:Q})}));ce.displatName="GeoMapCanvas",ce.propTypes=Q,ce.defaultProps=_;var de=s(ce),se=function(e){return H(f,{children:function(r){var o=r.width,t=r.height;return H(de,I({width:o,height:t},e))}})},fe=r((function(e){var r=e.width,i=e.height,n=e.margin,u=e.features,l=e.data,s=e.match,f=e.label,h=e.value,g=e.valueFormat,m=e.projectionType,C=e.projectionScale,b=e.projectionTranslation,y=e.projectionRotation,R=e.colors,j=e.domain,q=e.unknownColor,T=e.borderWidth,M=e.borderColor,W=e.enableGraticule,w=e.graticuleLineWidth,k=e.graticuleLineColor,F=e.layers,O=e.legends,L=e.isInteractive,E=e.onClick,S=e.tooltip,G=e.role,x=e.defs,B=void 0===x?re.defs:x,N=e.fill,D=void 0===N?re.fill:N,V=c(r,i,n),A=V.margin,J=V.outerWidth,Q=V.outerHeight,U=z({width:r,height:i,projectionType:m,projectionScale:C,projectionTranslation:b,projectionRotation:y,fillColor:function(){},borderWidth:T,borderColor:M}),X=U.graticule,Y=U.path,Z=U.getBorderWidth,$=U.getBorderColor,_=K({features:u,data:l,match:s,label:f,value:h,valueFormat:g,colors:R,unknownColor:q,domain:j}),ee=_.getFillColor,oe=_.boundFeatures,ne=_.legendData,ae=a(),ue=p(B,oe,D,{dataKey:"data",targetKey:"fill"}),le=v(),ce=le.showTooltipFromEvent,de=le.hideTooltip,se=o((function(e,r){return L&&E&&E(e,r)}),[L,E]),fe=o((function(e,r){return L&&S&&ce(H(S,{feature:e}),r)}),[L,ce,S]),he=o((function(e,r){return L&&S&&ce(H(S,{feature:e}),r)}),[L,ce,S]),pe=o((function(){return L&&de()}),[L,de]);return H(d,{width:J,height:Q,margin:A,theme:ae,defs:ue,role:G,children:F.map((function(e,o){return"graticule"===e?!0!==W?null:H(te,{path:Y,graticule:X,lineWidth:w,lineColor:k},"graticule"):"features"===e?H(t,{children:oe.map((function(e){return H(ie,{feature:e,path:Y,fillColor:ee(e),borderWidth:Z(e),borderColor:$(e),onMouseEnter:fe,onMouseMove:he,onMouseLeave:pe,onClick:se},e.id)}))},"features"):"legends"===e?O.map((function(e,o){return H(P,I({containerWidth:r,containerHeight:i,data:ne},e),o)})):H(t,{children:e({})},o)}))})}));fe.displayName="Choropleth",fe.propTypes=X,fe.defaultProps=re;var he=s(fe),pe=function(e){return H(f,{children:function(r){var o=r.width,t=r.height;return H(he,I({width:o,height:t},e))}})},ge=function(e,r,o,t){var i=h(r,e),n=i[0],a=i[1];return o.find((function(e){return x(e,t.invert([n,a]))}))},ve=r((function(e){var r=e.width,t=e.height,u=e.margin,l=e.pixelRatio,d=e.features,s=e.data,f=e.match,h=e.label,p=e.value,g=e.valueFormat,m=e.projectionType,C=e.projectionScale,b=e.projectionTranslation,y=e.projectionRotation,R=e.colors,j=e.domain,q=e.unknownColor,T=e.borderWidth,M=e.borderColor,W=e.enableGraticule,w=e.graticuleLineWidth,k=e.graticuleLineColor,F=e.layers,O=e.legends,L=e.isInteractive,E=e.onClick,S=e.onMouseMove,G=e.tooltip,x=i(null),B=a(),P=c(r,t,u),D=P.margin,V=P.outerWidth,A=P.outerHeight,J=z({width:r,height:t,projectionType:m,projectionScale:C,projectionTranslation:b,projectionRotation:y,fillColor:function(){},borderWidth:T,borderColor:M}),Q=J.projection,U=J.graticule,X=J.path,Y=J.getBorderWidth,Z=J.getBorderColor,$=K({features:d,data:s,match:f,label:h,value:p,valueFormat:g,colors:R,unknownColor:q,domain:j}),_=$.getFillColor,ee=$.boundFeatures,re=$.legendData;n((function(){if(x){x.current.width=V*l,x.current.height=A*l;var e=x.current.getContext("2d");e.scale(l,l),e.fillStyle=B.background,e.fillRect(0,0,V,A),e.translate(D.left,D.top),X.context(e),F.forEach((function(o){"graticule"===o?!0===W&&(e.lineWidth=w,e.strokeStyle=k,e.beginPath(),X(U()),e.stroke()):"features"===o?ee.forEach((function(r){e.beginPath(),X(r),e.fillStyle=_(r),e.fill();var o=Y(r);o>0&&(e.strokeStyle=Z(r),e.lineWidth=o,e.stroke())})):"legends"===o&&O.forEach((function(o){N(e,I({},o,{data:re,containerWidth:r,containerHeight:t,theme:B}))}))}))}}),[x,V,A,D,l,B,X,U,_,Y,Z,ee,O,F]);var oe=v(),te=oe.showTooltipFromEvent,ie=oe.hideTooltip,ne=o((function(e){if(L&&G){var r=ge(e,x.current,ee,Q);r?te(H(G,{feature:r}),e):ie(),S&&S(r||null,e)}}),[te,ie,L,G,x,ee,Q]),ae=o((function(){return L&&ie()}),[L,ie]),ue=o((function(e){if(L&&E){var r=ge(e,x.current,ee,Q);r&&E(r,e)}}),[L,x,ee,Q,E]);return H("canvas",{ref:x,width:V*l,height:A*l,style:{width:V,height:A,cursor:L?"auto":"normal"},onMouseMove:ne,onMouseLeave:ae,onClick:ue})}));ve.displayName="ChoroplethCanvas",ve.propTypes=Y,ve.defaultProps=oe;var me=s(ve),Ce=function(e){return H(f,{children:function(r){var o=r.width,t=r.height;return H(me,I({width:o,height:t},e))}})};export{he as Choropleth,me as ChoroplethCanvas,oe as ChoroplethCanvasDefaultProps,Y as ChoroplethCanvasPropTypes,re as ChoroplethDefaultProps,X as ChoroplethPropTypes,ae as GeoMap,de as GeoMapCanvas,_ as GeoMapCanvasDefaultProps,Q as GeoMapCanvasPropTypes,$ as GeoMapDefaultProps,J as GeoMapPropTypes,pe as ResponsiveChoropleth,Ce as ResponsiveChoroplethCanvas,ue as ResponsiveGeoMap,se as ResponsiveGeoMapCanvas,D as projectionById,K as useChoropleth,z as useGeoMap}; | ||
import{useMemo as e,memo as o,useCallback as r,Fragment as i,useRef as t,useEffect as n}from"react";import{useTheme as a,guessQuantizeColorScale as u,quantizeColorScalePropType as l,useDimensions as d,SvgWrapper as c,withContainer as f,ResponsiveWrapper as s,getRelativeCursor as h,bindDefs as p}from"@nivo/core";import{BasicTooltip as v,useTooltip as g}from"@nivo/tooltip";import m from"prop-types";import{useInheritedColor as C,inheritedColorPropType as b}from"@nivo/colors";import y from"lodash/isFunction";import R from"lodash/get";import{format as j}from"d3-format";import{geoAzimuthalEqualArea as q,geoAzimuthalEquidistant as w,geoGnomonic as T,geoOrthographic as M,geoStereographic as W,geoEqualEarth as k,geoEquirectangular as F,geoMercator as O,geoTransverseMercator as L,geoNaturalEarth1 as E,geoPath as S,geoGraticule as G,geoContains as x}from"d3-geo";import{useQuantizeColorScaleLegendData as B,BoxLegendSvg as P,renderLegendToCanvas as N}from"@nivo/legends";import{jsx as H}from"react/jsx-runtime";function I(){return I=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var r=arguments[o];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},I.apply(this,arguments)}var D={azimuthalEqualArea:q,azimuthalEquidistant:w,gnomonic:T,orthographic:M,stereographic:W,equalEarth:k,equirectangular:F,mercator:O,transverseMercator:L,naturalEarth1:E},z=function(o){var r=o.width,i=o.height,t=o.projectionType,n=o.projectionScale,u=o.projectionTranslation,l=o.projectionRotation,d=o.fillColor,c=o.borderWidth,f=o.borderColor,s=e((function(){return D[t]().scale(n).translate([r*u[0],i*u[1]]).rotate(l)}),[r,i,t,n,u[0],u[1],l[0],l[1],l[2]]),h=e((function(){return S(s)}),[s]),p=e((function(){return G()})),v=a(),g=e((function(){return"function"==typeof c?c:function(){return c}}),[c]),m=C(f,v),b=e((function(){return"function"==typeof d?d:function(){return d}}),[d]);return{projection:s,path:h,graticule:p,getBorderWidth:g,getBorderColor:m,getFillColor:b}},K=function(o){var r=o.features,i=o.data,t=o.match,n=o.label,a=o.value,l=o.valueFormat,d=o.colors,c=o.unknownColor,f=o.domain,s=e((function(){return y(t)?t:function(e,o){var r=R(e,t),i=R(o,t);return r&&r===i}}),[t]),h=e((function(){return y(n)?n:function(e){return R(e,n)}}),[n]),p=e((function(){return y(a)?a:function(e){return R(e,a)}}),[a]),v=e((function(){return void 0===l?function(e){return e}:y(l)?l:j(l)}),[l]),g=e((function(){return u(d).domain(f)}),[d,f]),m=e((function(){return function(e){return void 0===e.value?c:g(e.value)}}),[g,c]),C=e((function(){return r.map((function(e){var o=i.find((function(o){return s(e,o)})),r=p(o);if(o){var t=I({},e,{data:o,value:r,formattedValue:v(r)});return t.color=m(t),t.label=h(t),t}return e}))}),[r,i,s,p,v,m]),b=B({scale:g,valueFormat:v});return{colorScale:g,getFillColor:m,boundFeatures:C,valueFormatter:v,legendData:b}},V=o((function(e){var o=e.feature;return void 0===o.data?null:H(v,{id:o.label,color:o.color,enableChip:!0,value:o.formattedValue})}));V.propTypes={feature:m.object.isRequired},V.displayName="ChoroplethTooltip";var A={features:m.arrayOf(m.shape({id:m.string.isRequired,type:m.oneOf(["Feature"]).isRequired,properties:m.object,geometry:m.object.isRequired})).isRequired,projectionType:m.oneOf(Object.keys(D)).isRequired,projectionScale:m.number.isRequired,projectionTranslation:m.arrayOf(m.number).isRequired,projectionRotation:m.arrayOf(m.number).isRequired,fillColor:m.oneOfType([m.string,m.func]).isRequired,borderWidth:m.oneOfType([m.number,m.func]).isRequired,borderColor:b.isRequired,enableGraticule:m.bool.isRequired,graticuleLineWidth:m.number.isRequired,graticuleLineColor:m.string.isRequired,isInteractive:m.bool.isRequired,onMouseEnter:m.func.isRequired,onMouseMove:m.func.isRequired,onMouseLeave:m.func.isRequired,onClick:m.func.isRequired,tooltip:m.any,layers:m.arrayOf(m.oneOfType([m.oneOf(["graticule","features"]),m.func])).isRequired},J=I({},A,{role:m.string.isRequired}),Q=I({pixelRatio:m.number.isRequired},A),U={data:m.arrayOf(m.object).isRequired,match:m.oneOfType([m.string,m.func]).isRequired,label:m.oneOfType([m.string,m.func]).isRequired,value:m.oneOfType([m.string,m.func]).isRequired,valueFormat:m.oneOfType([m.string,m.func]),colors:l.isRequired,domain:m.arrayOf(m.number).isRequired,unknownColor:m.string.isRequired,layers:m.arrayOf(m.oneOfType([m.oneOf(["graticule","features","legends"]),m.func])).isRequired},X=I({},J,U,{role:m.string.isRequired}),Y=I({},Q,U),Z={projectionType:"mercator",projectionScale:100,projectionTranslation:[.5,.5],projectionRotation:[0,0,0],enableGraticule:!1,graticuleLineWidth:.5,graticuleLineColor:"#999999",fillColor:"#dddddd",borderWidth:0,borderColor:"#000000",isInteractive:!0,onMouseEnter:function(){},onMouseLeave:function(){},onMouseMove:function(){},onClick:function(){},layers:["graticule","features"],legends:[],fill:[],defs:[]},$=I({},Z,{role:"img"}),_=I({},Z,{pixelRatio:"undefined"!=typeof window&&window.devicePixelRatio||1}),ee={match:"id",label:"id",value:"value",colors:"PuBuGn",unknownColor:"#999",tooltip:V,layers:["graticule","features","legends"]},oe=I({},$,ee,{role:"img"}),re=I({},_,ee),ie=o((function(e){var o=e.path,r=e.graticule,i=e.lineWidth,t=e.lineColor;return H("path",{fill:"none",strokeWidth:i,stroke:t,d:o(r())})}));ie.propTypes={path:m.func.isRequired,graticule:m.func.isRequired,lineWidth:m.number.isRequired,lineColor:m.string.isRequired},ie.displayName="GeoGraticule";var te=o((function(e){var o,r=e.feature,i=e.path,t=e.fillColor,n=e.borderWidth,a=e.borderColor,u=e.onClick,l=e.onMouseEnter,d=e.onMouseMove,c=e.onMouseLeave;return H("path",{fill:null!=(o=null==r?void 0:r.fill)?o:t,strokeWidth:n,stroke:a,strokeLinejoin:"bevel",d:i(r),onMouseEnter:function(e){return l(r,e)},onMouseMove:function(e){return d(r,e)},onMouseLeave:function(e){return c(r,e)},onClick:function(e){return u(r,e)}},r.id)}));te.propTypes={feature:m.shape({id:m.string.isRequired,type:m.oneOf(["Feature"]).isRequired,properties:m.object,geometry:m.object.isRequired}).isRequired,path:m.func.isRequired,fillColor:m.string.isRequired,borderWidth:m.number.isRequired,borderColor:m.string.isRequired,onMouseEnter:m.func.isRequired,onMouseMove:m.func.isRequired,onMouseLeave:m.func.isRequired,onClick:m.func.isRequired},te.displayName="GeoMapFeature";var ne=o((function(e){var o=e.width,t=e.height,n=e.margin,u=e.features,l=e.layers,f=void 0===l?["graticule","features"]:l,s=e.projectionType,h=void 0===s?"mercator":s,p=e.projectionScale,v=void 0===p?100:p,m=e.projectionTranslation,C=void 0===m?[.5,.5]:m,b=e.projectionRotation,y=void 0===b?[0,0,0]:b,R=e.fillColor,j=void 0===R?"#dddddd":R,q=e.borderWidth,w=void 0===q?0:q,T=e.borderColor,M=void 0===T?"#000000":T,W=e.enableGraticule,k=void 0!==W&&W,F=e.graticuleLineWidth,O=void 0===F?.5:F,L=e.graticuleLineColor,E=void 0===L?"#999999":L,S=e.isInteractive,G=void 0===S||S,x=e.onClick,B=void 0===x?function(){}:x,P=e.tooltip,N=e.role,I=void 0===N?"img":N,D=d(o,t,n),K=D.margin,V=D.outerWidth,A=D.outerHeight,J=z({width:o,height:t,projectionType:h,projectionScale:v,projectionTranslation:C,projectionRotation:y,fillColor:j,borderWidth:w,borderColor:M}),Q=J.graticule,U=J.path,X=J.getFillColor,Y=J.getBorderWidth,Z=J.getBorderColor,$=a(),_=g(),ee=_.showTooltipFromEvent,oe=_.hideTooltip,re=r((function(e,o){return G&&B&&B(e,o)}),[G,B]),ne=r((function(e,o){return G&&P&&ee(H(P,{feature:e}),o)}),[G,ee,P]),ae=r((function(e,o){return G&&P&&ee(H(P,{feature:e}),o)}),[G,ee,P]),ue=r((function(){return G&&oe()}),[G,oe]);return H(c,{width:V,height:A,margin:K,theme:$,role:I,children:f.map((function(o,r){return"graticule"===o?!0!==k?null:H(ie,{path:U,graticule:Q,lineWidth:O,lineColor:E},"graticule"):"features"===o?H(i,{children:u.map((function(e){return H(te,{feature:e,path:U,fillColor:X(e),borderWidth:Y(e),borderColor:Z(e),onMouseEnter:ne,onMouseMove:ae,onMouseLeave:ue,onClick:re},e.id)}))},"features"):H(i,{children:o(e)},r)}))})}));ne.displayName="GeoMap",ne.propTypes=J;var ae=f(ne),ue=function(e){return H(s,{children:function(o){var r=o.width,i=o.height;return H(ae,I({width:r,height:i},e))}})},le=function(e,o,r,i){var t=h(o,e),n=t[0],a=t[1];return r.find((function(e){return x(e,i.invert([n,a]))}))},de=o((function(e){var o=e.width,i=e.height,u=e.margin,l=e.pixelRatio,c=void 0===l?"undefined"!=typeof window&&window.devicePixelRatio||1:l,f=e.features,s=e.layers,h=e.projectionType,p=void 0===h?"mercator":h,v=e.projectionScale,m=void 0===v?100:v,C=e.projectionTranslation,b=void 0===C?[.5,.5]:C,y=e.projectionRotation,R=void 0===y?[0,0,0]:y,j=e.fillColor,q=void 0===j?"#dddddd":j,w=e.borderWidth,T=void 0===w?0:w,M=e.borderColor,W=void 0===M?"#000000":M,k=e.enableGraticule,F=void 0!==k&&k,O=e.graticuleLineWidth,L=void 0===O?.5:O,E=e.graticuleLineColor,S=void 0===E?"#999999":E,G=e.isInteractive,x=void 0===G||G,B=e.onClick,P=void 0===B?function(){}:B,N=e.onMouseMove,I=void 0===N?function(){}:N,D=e.tooltip,K=t(null),V=a(),A=d(o,i,u),J=A.margin,Q=A.outerWidth,U=A.outerHeight,X=z({width:o,height:i,projectionType:p,projectionScale:m,projectionTranslation:b,projectionRotation:R,fillColor:q,borderWidth:T,borderColor:W}),Y=X.projection,Z=X.graticule,$=X.path,_=X.getFillColor,ee=X.getBorderWidth,oe=X.getBorderColor;n((function(){if(K){K.current.width=Q*c,K.current.height=U*c;var o=K.current.getContext("2d");o.scale(c,c),o.fillStyle=V.background,o.fillRect(0,0,Q,U),o.translate(J.left,J.top),$.context(o),s.forEach((function(r){"graticule"===r?!0===F&&(o.lineWidth=L,o.strokeStyle=S,o.beginPath(),$(Z()),o.stroke()):"features"===r?f.forEach((function(e){o.beginPath(),$(e),o.fillStyle=_(e),o.fill();var r=ee(e);r>0&&(o.strokeStyle=oe(e),o.lineWidth=r,o.stroke())})):r(o,e)}))}}),[K,Q,U,J,c,V,$,Z,_,ee,oe,f,s]);var re=g(),ie=re.showTooltipFromEvent,te=re.hideTooltip,ne=r((function(e){if(x&&D){var o=le(e,K.current,f,Y);o?ie(H(D,{feature:o}),e):te(),I&&I(o||null,e)}}),[ie,te,x,D,K,f,Y]),ae=r((function(){return x&&te()}),[x,te]),ue=r((function(e){if(x&&P){var o=le(e,K.current,f,Y);o&&P(o,e)}}),[x,K,f,Y,P]);return H("canvas",{ref:K,width:Q*c,height:U*c,style:{width:Q,height:U,cursor:x?"auto":"normal"},onMouseMove:ne,onMouseLeave:ae,onClick:ue})}));de.displatName="GeoMapCanvas",de.propTypes=Q;var ce=f(de),fe=function(e){return H(s,{children:function(o){var r=o.width,i=o.height;return H(ce,I({width:r,height:i},e))}})},se=o((function(e){var o=e.width,t=e.height,n=e.margin,u=e.features,l=e.data,f=e.match,s=void 0===f?"id":f,h=e.label,v=void 0===h?"id":h,m=e.value,C=void 0===m?"value":m,b=e.valueFormat,y=e.projectionType,R=void 0===y?"mercator":y,j=e.projectionScale,q=void 0===j?100:j,w=e.projectionTranslation,T=void 0===w?[.5,.5]:w,M=e.projectionRotation,W=void 0===M?[0,0,0]:M,k=e.colors,F=void 0===k?"PuBuGn":k,O=e.domain,L=e.unknownColor,E=void 0===L?"#999":L,S=e.borderWidth,G=void 0===S?0:S,x=e.borderColor,B=void 0===x?"#000000":x,N=e.enableGraticule,D=void 0!==N&&N,A=e.graticuleLineWidth,J=void 0===A?.5:A,Q=e.graticuleLineColor,U=void 0===Q?"#999999":Q,X=e.layers,Y=void 0===X?["graticule","features","legends"]:X,Z=e.legends,$=void 0===Z?[]:Z,_=e.isInteractive,ee=void 0===_||_,oe=e.onClick,re=void 0===oe?function(){}:oe,ne=e.tooltip,ae=void 0===ne?V:ne,ue=e.role,le=void 0===ue?"img":ue,de=e.defs,ce=void 0===de?[]:de,fe=e.fill,se=void 0===fe?[]:fe,he=d(o,t,n),pe=he.margin,ve=he.outerWidth,ge=he.outerHeight,me=z({width:o,height:t,projectionType:R,projectionScale:q,projectionTranslation:T,projectionRotation:W,fillColor:function(){},borderWidth:G,borderColor:B}),Ce=me.graticule,be=me.path,ye=me.getBorderWidth,Re=me.getBorderColor,je=K({features:u,data:l,match:s,label:v,value:C,valueFormat:b,colors:F,unknownColor:E,domain:O}),qe=je.getFillColor,we=je.boundFeatures,Te=je.legendData,Me=a(),We=p(ce,we,se,{dataKey:"data",targetKey:"fill"}),ke=g(),Fe=ke.showTooltipFromEvent,Oe=ke.hideTooltip,Le=r((function(e,o){return ee&&re&&re(e,o)}),[ee,re]),Ee=r((function(e,o){return ee&&ae&&Fe(H(ae,{feature:e}),o)}),[ee,Fe,ae]),Se=r((function(e,o){return ee&&ae&&Fe(H(ae,{feature:e}),o)}),[ee,Fe,ae]),Ge=r((function(){return ee&&Oe()}),[ee,Oe]);return H(c,{width:ve,height:ge,margin:pe,theme:Me,defs:We,role:le,children:Y.map((function(e,r){return"graticule"===e?!0!==D?null:H(ie,{path:be,graticule:Ce,lineWidth:J,lineColor:U},"graticule"):"features"===e?H(i,{children:we.map((function(e){return H(te,{feature:e,path:be,fillColor:qe(e),borderWidth:ye(e),borderColor:Re(e),onMouseEnter:Ee,onMouseMove:Se,onMouseLeave:Ge,onClick:Le},e.id)}))},"features"):"legends"===e?$.map((function(e,r){return H(P,I({containerWidth:o,containerHeight:t,data:Te},e),r)})):H(i,{children:e({})},r)}))})}));se.displayName="Choropleth",se.propTypes=X;var he=f(se),pe=function(e){return H(s,{children:function(o){var r=o.width,i=o.height;return H(he,I({width:r,height:i},e))}})},ve=function(e,o,r,i){var t=h(o,e),n=t[0],a=t[1];return r.find((function(e){return x(e,i.invert([n,a]))}))},ge=o((function(e){var o=e.width,i=e.height,u=e.margin,l=e.pixelRatio,c=void 0===l?"undefined"!=typeof window&&window.devicePixelRatio||1:l,f=e.features,s=e.data,h=e.match,p=void 0===h?"id":h,v=e.label,m=void 0===v?"id":v,C=e.value,b=void 0===C?"value":C,y=e.valueFormat,R=e.projectionType,j=void 0===R?"mercator":R,q=e.projectionScale,w=void 0===q?100:q,T=e.projectionTranslation,M=void 0===T?[.5,.5]:T,W=e.projectionRotation,k=void 0===W?[0,0,0]:W,F=e.colors,O=void 0===F?"PuBuGn":F,L=e.domain,E=e.unknownColor,S=void 0===E?"#999":E,G=e.borderWidth,x=void 0===G?0:G,B=e.borderColor,P=void 0===B?"#000000":B,D=e.enableGraticule,A=void 0!==D&&D,J=e.graticuleLineWidth,Q=void 0===J?.5:J,U=e.graticuleLineColor,X=void 0===U?"#999999":U,Y=e.layers,Z=void 0===Y?["graticule","features","legends"]:Y,$=e.legends,_=void 0===$?[]:$,ee=e.isInteractive,oe=void 0===ee||ee,re=e.onClick,ie=void 0===re?function(){}:re,te=e.onMouseMove,ne=void 0===te?function(){}:te,ae=e.tooltip,ue=void 0===ae?V:ae,le=t(null),de=a(),ce=d(o,i,u),fe=ce.margin,se=ce.outerWidth,he=ce.outerHeight,pe=z({width:o,height:i,projectionType:j,projectionScale:w,projectionTranslation:M,projectionRotation:k,fillColor:function(){},borderWidth:x,borderColor:P}),ge=pe.projection,me=pe.graticule,Ce=pe.path,be=pe.getBorderWidth,ye=pe.getBorderColor,Re=K({features:f,data:s,match:p,label:m,value:b,valueFormat:y,colors:O,unknownColor:S,domain:L}),je=Re.getFillColor,qe=Re.boundFeatures,we=Re.legendData;n((function(){if(le){le.current.width=se*c,le.current.height=he*c;var e=le.current.getContext("2d");e.scale(c,c),e.fillStyle=de.background,e.fillRect(0,0,se,he),e.translate(fe.left,fe.top),Ce.context(e),Z.forEach((function(r){"graticule"===r?!0===A&&(e.lineWidth=Q,e.strokeStyle=X,e.beginPath(),Ce(me()),e.stroke()):"features"===r?qe.forEach((function(o){e.beginPath(),Ce(o),e.fillStyle=je(o),e.fill();var r=be(o);r>0&&(e.strokeStyle=ye(o),e.lineWidth=r,e.stroke())})):"legends"===r&&_.forEach((function(r){N(e,I({},r,{data:we,containerWidth:o,containerHeight:i,theme:de}))}))}))}}),[le,se,he,fe,c,de,Ce,me,je,be,ye,qe,_,Z]);var Te=g(),Me=Te.showTooltipFromEvent,We=Te.hideTooltip,ke=r((function(e){if(oe&&ue){var o=ve(e,le.current,qe,ge);o?Me(H(ue,{feature:o}),e):We(),ne&&ne(o||null,e)}}),[Me,We,oe,ue,le,qe,ge]),Fe=r((function(){return oe&&We()}),[oe,We]),Oe=r((function(e){if(oe&&ie){var o=ve(e,le.current,qe,ge);o&&ie(o,e)}}),[oe,le,qe,ge,ie]);return H("canvas",{ref:le,width:se*c,height:he*c,style:{width:se,height:he,cursor:oe?"auto":"normal"},onMouseMove:ke,onMouseLeave:Fe,onClick:Oe})}));ge.displayName="ChoroplethCanvas",ge.propTypes=Y;var me=f(ge),Ce=function(e){return H(s,{children:function(o){var r=o.width,i=o.height;return H(me,I({width:r,height:i},e))}})};export{he as Choropleth,me as ChoroplethCanvas,re as ChoroplethCanvasDefaultProps,Y as ChoroplethCanvasPropTypes,oe as ChoroplethDefaultProps,X as ChoroplethPropTypes,ae as GeoMap,ce as GeoMapCanvas,_ as GeoMapCanvasDefaultProps,Q as GeoMapCanvasPropTypes,$ as GeoMapDefaultProps,J as GeoMapPropTypes,pe as ResponsiveChoropleth,Ce as ResponsiveChoroplethCanvas,ue as ResponsiveGeoMap,fe as ResponsiveGeoMapCanvas,D as projectionById,K as useChoropleth,z as useGeoMap}; | ||
//# sourceMappingURL=nivo-geo.es.js.map |
{ | ||
"name": "@nivo/geo", | ||
"version": "0.84.0", | ||
"version": "0.85.0", | ||
"license": "MIT", | ||
@@ -32,6 +32,6 @@ "author": { | ||
"dependencies": { | ||
"@nivo/colors": "0.84.0", | ||
"@nivo/core": "0.84.0", | ||
"@nivo/legends": "0.84.0", | ||
"@nivo/tooltip": "0.84.0", | ||
"@nivo/colors": "0.85.0", | ||
"@nivo/core": "0.85.0", | ||
"@nivo/legends": "0.85.0", | ||
"@nivo/tooltip": "0.85.0", | ||
"d3-format": "^1.4.4", | ||
@@ -48,3 +48,3 @@ "d3-geo": "^1.11.3", | ||
}, | ||
"gitHead": "71f3496361eb33c10380d12d3abb200813d9429b" | ||
"gitHead": "4ab05e2a976cb43397fe91720aab9fb3705bdf36" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
179784
302
1
+ Added@nivo/colors@0.85.0(transitive)
+ Added@nivo/core@0.85.0(transitive)
+ Added@nivo/recompose@0.85.0(transitive)
+ Added@nivo/tooltip@0.85.0(transitive)
+ Added@types/d3-color@3.1.3(transitive)
+ Added@types/d3-scale-chromatic@3.0.3(transitive)
- Removed@nivo/colors@0.84.0(transitive)
- Removed@nivo/core@0.84.0(transitive)
- Removed@nivo/recompose@0.84.0(transitive)
- Removed@nivo/tooltip@0.84.0(transitive)
- Removed@types/d3-color@2.0.6(transitive)
- Removed@types/d3-scale-chromatic@2.0.4(transitive)
- Removedd3-scale-chromatic@2.0.0(transitive)
Updated@nivo/colors@0.85.0
Updated@nivo/core@0.85.0
Updated@nivo/legends@0.85.0
Updated@nivo/tooltip@0.85.0