@nivo/arcs
Advanced tools
Comparing version 0.81.0 to 0.82.0
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@react-spring/web"),n=require("@nivo/core"),t=require("react/jsx-runtime"),r=require("react"),o=require("@nivo/colors"),i=require("d3-shape");function a(){return a=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},a.apply(this,arguments)}var u={pointerEvents:"none"},s=function(r){var o=r.label,i=r.style,s=n.useTheme();return t.jsx(e.animated.g,{transform:i.transform,opacity:i.progress,style:u,children:t.jsx(e.animated.text,{textAnchor:"middle",dominantBaseline:"central",style:a({},s.labels.text,{fill:i.textColor}),children:o})})},l=function(e){var n=e%(2*Math.PI);return n<0&&(n+=2*Math.PI),n},d=function(e,t){return e.filter((function(e){return Math.abs(n.radiansToDegrees(e.arc.endAngle-e.arc.startAngle))>=t}))},c=function(e,n,t,r,o){return["A",e,e,0,n,t,r,o].join(" ")},f={startAngle:{enter:function(e){return a({},e,{endAngle:e.startAngle})},update:function(e){return e},leave:function(e){return a({},e,{startAngle:e.endAngle})}},middleAngle:{enter:function(e){var n=e.startAngle+(e.endAngle-e.startAngle)/2;return a({},e,{startAngle:n,endAngle:n})},update:function(e){return e},leave:function(e){var n=e.startAngle+(e.endAngle-e.startAngle)/2;return a({},e,{startAngle:n,endAngle:n})}},endAngle:{enter:function(e){return a({},e,{startAngle:e.endAngle})},update:function(e){return e},leave:function(e){return a({},e,{endAngle:e.startAngle})}},innerRadius:{enter:function(e){return a({},e,{outerRadius:e.innerRadius})},update:function(e){return e},leave:function(e){return a({},e,{innerRadius:e.outerRadius})}},centerRadius:{enter:function(e){var n=e.innerRadius+(e.outerRadius-e.innerRadius)/2;return a({},e,{innerRadius:n,outerRadius:n})},update:function(e){return e},leave:function(e){var n=e.innerRadius+(e.outerRadius-e.innerRadius)/2;return a({},e,{innerRadius:n,outerRadius:n})}},outerRadius:{enter:function(e){return a({},e,{innerRadius:e.outerRadius})},update:function(e){return e},leave:function(e){return a({},e,{outerRadius:e.innerRadius})}},pushIn:{enter:function(e){return a({},e,{innerRadius:e.innerRadius-e.outerRadius+e.innerRadius,outerRadius:e.innerRadius})},update:function(e){return e},leave:function(e){return a({},e,{innerRadius:e.outerRadius,outerRadius:e.outerRadius+e.outerRadius-e.innerRadius})}},pushOut:{enter:function(e){return a({},e,{innerRadius:e.outerRadius,outerRadius:e.outerRadius+e.outerRadius-e.innerRadius})},update:function(e){return e},leave:function(e){return a({},e,{innerRadius:e.innerRadius-e.outerRadius+e.innerRadius,outerRadius:e.innerRadius})}}},g=function(e,n){return r.useMemo((function(){var t=f[e];return{enter:function(e){return a({progress:0},t.enter(e.arc),n?n.enter(e):{})},update:function(e){return a({progress:1},t.update(e.arc),n?n.update(e):{})},leave:function(e){return a({progress:0},t.leave(e.arc),n?n.leave(e):{})}}}),[e,n])},p=function(e,t){var r=n.midAngle(e)-Math.PI/2,o=e.innerRadius+(e.outerRadius-e.innerRadius)*t;return n.positionFromAngle(r,o)},A=function(n){return function(t,r,o,i){return e.to([t,r,o,i],(function(e,t,r,o){var i=p({startAngle:e,endAngle:t,innerRadius:r,outerRadius:o},n);return"translate("+i.x+","+i.y+")"}))}},x=function(t,r,o,i){void 0===r&&(r=.5),void 0===o&&(o="innerRadius");var a=n.useMotionConfig(),u=a.animate,s=a.config,l=g(o,i);return{transition:e.useTransition(t,{keys:function(e){return e.id},initial:l.update,from:l.enter,enter:l.update,update:l.update,leave:l.leave,config:s,immediate:!u}),interpolate:A(r)}},h=function(e){var n=e.data,t=e.offset,o=void 0===t?.5:t,i=e.skipAngle,u=void 0===i?0:i,s=e.computeExtraProps,l=void 0===s?function(){return{}}:s;return r.useMemo((function(){return d(n,u).map((function(e){var n=p(e.arc,o);return a({},l(e),{x:n.x,y:n.y,data:e})}))}),[n,o,u,l])},v=s,R=function(r){var o=r.label,i=r.style,u=n.useTheme();return t.jsxs(e.animated.g,{opacity:i.opacity,children:[t.jsx(e.animated.path,{fill:"none",stroke:i.linkColor,strokeWidth:i.thickness,d:i.path}),t.jsx(e.animated.text,{transform:i.textPosition,textAnchor:i.textAnchor,dominantBaseline:"central",style:a({},u.labels.text,{fill:i.textColor}),children:o})]})},m=function(e){var n=l(e.startAngle+(e.endAngle-e.startAngle)/2-Math.PI/2);return n<Math.PI/2||n>1.5*Math.PI?"start":"end"},y=function(e,t,r,o){var i,a,u=l(e.startAngle+(e.endAngle-e.startAngle)/2-Math.PI/2),s=n.positionFromAngle(u,e.outerRadius+t),d=n.positionFromAngle(u,e.outerRadius+t+r);return u<Math.PI/2||u>1.5*Math.PI?(i="after",a={x:d.x+o,y:d.y}):(i="before",a={x:d.x-o,y:d.y}),{side:i,points:[s,d,a]}},C=i.line().x((function(e){return e.x})).y((function(e){return e.y})),M=function(n,t,r,o,i,a,u){return e.to([n,t,r,o,i,a,u],(function(e,n,t,r,o,i,a){var u=y({startAngle:e,endAngle:n,innerRadius:t,outerRadius:r},o,i,a).points;return C(u)}))},k=function(n,t,r,o){return e.to([n,t,r,o],(function(e,n,t,r){return m({startAngle:e,endAngle:n,innerRadius:t,outerRadius:r})}))},L=function(n,t,r,o,i,a,u,s){return e.to([n,t,r,o,i,a,u,s],(function(e,n,t,r,o,i,a,u){var s=y({startAngle:e,endAngle:n,innerRadius:t,outerRadius:r},o,i,a),l=s.points,d=s.side,c=l[2];return"before"===d?c.x-=u:c.x+=u,"translate("+c.x+","+c.y+")"}))},b=function(t){var i=t.data,a=t.offset,u=void 0===a?0:a,s=t.diagonalLength,l=t.straightLength,c=t.skipAngle,f=void 0===c?0:c,g=t.textOffset,p=t.linkColor,A=t.textColor,x=n.useMotionConfig(),h=x.animate,v=x.config,R=n.useTheme(),m=o.useInheritedColor(p,R),y=o.useInheritedColor(A,R),C=function(e,n){return r.useMemo((function(){return d(e,n)}),[e,n])}(i,f),b=function(e){var n=e.offset,t=e.diagonalLength,o=e.straightLength,i=e.textOffset,a=e.getLinkColor,u=e.getTextColor;return r.useMemo((function(){return{enter:function(e){return{startAngle:e.arc.startAngle,endAngle:e.arc.endAngle,innerRadius:e.arc.innerRadius,outerRadius:e.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(e),textColor:u(e),opacity:0}},update:function(e){return{startAngle:e.arc.startAngle,endAngle:e.arc.endAngle,innerRadius:e.arc.innerRadius,outerRadius:e.arc.outerRadius,offset:n,diagonalLength:t,straightLength:o,textOffset:i,linkColor:a(e),textColor:u(e),opacity:1}},leave:function(e){return{startAngle:e.arc.startAngle,endAngle:e.arc.endAngle,innerRadius:e.arc.innerRadius,outerRadius:e.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(e),textColor:u(e),opacity:0}}}}),[t,o,i,a,u])}({offset:u,diagonalLength:s,straightLength:l,textOffset:g,getLinkColor:m,getTextColor:y});return{transition:e.useTransition(C,{keys:function(e){return e.id},initial:b.update,from:b.enter,enter:b.update,update:b.update,leave:b.leave,config:v,immediate:!h}),interpolateLink:M,interpolateTextAnchor:k,interpolateTextPosition:L}},T=function(e){var t=e.data,o=e.skipAngle,i=void 0===o?0:o,u=e.offset,s=void 0===u?.5:u,l=e.diagonalLength,d=e.straightLength,c=e.computeExtraProps,f=void 0===c?function(){return{}}:c,g=r.useMemo((function(){return t.filter((function(e){return Math.abs(n.radiansToDegrees(e.arc.endAngle-e.arc.startAngle))>=i})).map((function(e){return a({},y(e.arc,s,l,d),{data:e})}))}),[t,i,s,l,d]);return r.useMemo((function(){return g.map((function(e){return a({},f(e),e)}))}),[g,f])},P=R,I=["animated"],O=function(n){var o=n.datum,i=n.style,a=n.onClick,u=n.onMouseEnter,s=n.onMouseMove,l=n.onMouseLeave,d=r.useCallback((function(e){return null==a?void 0:a(o,e)}),[a,o]),c=r.useCallback((function(e){return null==u?void 0:u(o,e)}),[u,o]),f=r.useCallback((function(e){return null==s?void 0:s(o,e)}),[s,o]),g=r.useCallback((function(e){return null==l?void 0:l(o,e)}),[l,o]);return t.jsx(e.animated.path,{d:i.path,opacity:i.opacity,fill:o.fill||i.color,stroke:i.borderColor,strokeWidth:i.borderWidth,onClick:a?d:void 0,onMouseEnter:u?c:void 0,onMouseMove:s?f:void 0,onMouseLeave:l?g:void 0})},j=function(n,t,r,o,i){return e.to([n,t,r,o],(function(e,n,t,r){return i({startAngle:e,endAngle:n,innerRadius:Math.max(0,t),outerRadius:Math.max(0,r)})}))},E=function(t,r,o){void 0===r&&(r="innerRadius");var i=n.useMotionConfig(),a=i.animate,u=i.config,s=g(r,o);return{transition:e.useTransition(t,{keys:function(e){return e.id},initial:s.update,from:s.enter,enter:s.update,update:s.update,leave:s.leave,config:u,immediate:!a}),interpolate:j}},F=function(e,t,r,o,i,a){var u=n.getDistance(i,a,e,t);return u<r&&u>o};exports.ArcLabelComponent=v,exports.ArcLabelsLayer=function(e){var i=e.center,u=e.data,l=e.transitionMode,d=e.label,c=e.radiusOffset,f=e.skipAngle,g=e.textColor,p=e.component,A=void 0===p?s:p,h=n.usePropertyAccessor(d),v=n.useTheme(),R=o.useInheritedColor(g,v),m=r.useMemo((function(){return u.filter((function(e){return Math.abs(n.radiansToDegrees(e.arc.endAngle-e.arc.startAngle))>=f}))}),[u,f]),y=x(m,c,l),C=y.transition,M=y.interpolate,k=A;return t.jsx("g",{transform:"translate("+i[0]+","+i[1]+")",children:C((function(e,n){return r.createElement(k,{key:n.id,datum:n,label:h(n),style:a({},e,{transform:M(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius),textColor:R(n)})})}))})},exports.ArcLine=function(r){var o=r.animated,i=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(r,I);return t.jsx(e.animated.path,a({d:e.to([o.radius,o.startAngle,o.endAngle],(function(e,t,r){return function(e,t,r){var o=Math.min(t,r),i=Math.max(t,r),a=n.positionFromAngle(n.degreesToRadians(i),e),u=n.positionFromAngle(n.degreesToRadians(o),e);if(i-o>=360){var s=n.positionFromAngle(n.degreesToRadians(o+180),e);return["M "+a.x+" "+a.y,c(e,1,1,s.x,s.y),"M "+a.x+" "+a.y,c(e,1,0,s.x,s.y)].join(" ")}var l=i-o<=180?0:1;return["M "+a.x+" "+a.y,c(e,l,0,u.x,u.y)].join(" ")}(e,t,r)}))},i))},exports.ArcLinkLabelComponent=P,exports.ArcLinkLabelsLayer=function(e){var o=e.center,i=e.data,u=e.label,s=e.skipAngle,l=e.offset,d=e.diagonalLength,c=e.straightLength,f=e.strokeWidth,g=e.textOffset,p=e.textColor,A=e.linkColor,x=e.component,h=void 0===x?R:x,v=n.usePropertyAccessor(u),m=b({data:i,skipAngle:s,offset:l,diagonalLength:d,straightLength:c,textOffset:g,linkColor:A,textColor:p}),y=m.transition,C=m.interpolateLink,M=m.interpolateTextAnchor,k=m.interpolateTextPosition,L=h;return t.jsx("g",{transform:"translate("+o[0]+","+o[1]+")",children:y((function(e,n){return r.createElement(L,{key:n.id,datum:n,label:v(n),style:a({},e,{thickness:f,path:C(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius,e.offset,e.diagonalLength,e.straightLength),textAnchor:M(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius),textPosition:k(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius,e.offset,e.diagonalLength,e.straightLength,e.textOffset)})})}))})},exports.ArcShape=O,exports.ArcsLayer=function(e){var i=e.center,u=e.data,s=e.arcGenerator,l=e.borderWidth,d=e.borderColor,c=e.onClick,f=e.onMouseEnter,g=e.onMouseMove,p=e.onMouseLeave,A=e.transitionMode,x=e.component,h=void 0===x?O:x,v=n.useTheme(),R=o.useInheritedColor(d,v),m=E(u,A,{enter:function(e){return{opacity:0,color:e.color,borderColor:R(e)}},update:function(e){return{opacity:1,color:e.color,borderColor:R(e)}},leave:function(e){return{opacity:0,color:e.color,borderColor:R(e)}}}),y=m.transition,C=m.interpolate,M=h;return t.jsx("g",{transform:"translate("+i[0]+","+i[1]+")",children:y((function(e,n){return r.createElement(M,{key:n.id,datum:n,style:a({},e,{borderWidth:l,path:C(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius,s)}),onClick:c,onMouseEnter:f,onMouseMove:g,onMouseLeave:p})}))})},exports.arcTransitionModeById=f,exports.arcTransitionModes=["startAngle","middleAngle","endAngle","innerRadius","centerRadius","outerRadius","pushIn","pushOut"],exports.computeArcBoundingBox=function(e,t,r,o,i,a){void 0===a&&(a=!0);var u=[],s=n.positionFromAngle(n.degreesToRadians(o),r);u.push([s.x,s.y]);var l=n.positionFromAngle(n.degreesToRadians(i),r);u.push([l.x,l.y]);for(var d=Math.round(Math.min(o,i));d<=Math.round(Math.max(o,i));d++)if(d%90==0){var c=n.positionFromAngle(n.degreesToRadians(d),r);u.push([c.x,c.y])}u=u.map((function(n){var r=n[0],o=n[1];return[e+r,t+o]})),a&&u.push([e,t]);var f=u.map((function(e){return e[0]})),g=u.map((function(e){return e[1]})),p=Math.min.apply(Math,f),A=Math.max.apply(Math,f),x=Math.min.apply(Math,g);return{points:u,x:p,y:x,width:A-p,height:Math.max.apply(Math,g)-x}},exports.computeArcCenter=p,exports.computeArcLink=y,exports.computeArcLinkTextAnchor=m,exports.drawCanvasArcLabels=function(e,n,t){e.textAlign="center",e.textBaseline="middle",e.font=t.labels.text.fontSize+"px "+t.labels.text.fontFamily,n.forEach((function(n){e.fillStyle=n.textColor,e.fillText(""+n.label,n.x,n.y)}))},exports.drawCanvasArcLinkLabels=function(e,t,r,o){e.textBaseline="middle",e.font=r.labels.text.fontSize+"px "+r.labels.text.fontFamily,t.forEach((function(t){e.fillStyle=t.textColor,e.textAlign=n.textPropsByEngine.canvas.align[t.textAnchor],e.fillText(""+t.label,t.x,t.y),e.beginPath(),e.strokeStyle=t.linkColor,e.lineWidth=o,t.points.forEach((function(n,t){0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y)})),e.stroke()}))},exports.findArcUnderCursor=function(e,t,r,o,i,a,u){if(F(e,t,r,o,a,u)){var s=n.getAngle(a,u,e,t);return i.find((function(e){var n=e.startAngle,t=e.endAngle;return s>=n&&s<t}))}},exports.interpolateArc=j,exports.interpolateArcCenter=A,exports.isCursorInRing=F,exports.useAnimatedArc=function(t,r){var o=n.useMotionConfig(),i=o.animate,u=o.config,s=e.useSpring({startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,config:u,immediate:!i});return a({},s,{path:j(s.startAngle,s.endAngle,s.innerRadius,s.outerRadius,r)})},exports.useArcCenters=h,exports.useArcCentersTransition=x,exports.useArcGenerator=function(e){var n=void 0===e?{}:e,t=n.cornerRadius,o=void 0===t?0:t,a=n.padAngle,u=void 0===a?0:a;return r.useMemo((function(){return i.arc().innerRadius((function(e){return e.innerRadius})).outerRadius((function(e){return e.outerRadius})).cornerRadius(o).padAngle(u)}),[o,u])},exports.useArcLabels=function(e){var t=e.data,i=e.offset,a=e.skipAngle,u=e.label,s=e.textColor,l=n.usePropertyAccessor(u),d=n.useTheme(),c=o.useInheritedColor(s,d),f=r.useCallback((function(e){return{label:l(e),textColor:c(e)}}),[l,c]);return h({data:t,offset:i,skipAngle:a,computeExtraProps:f})},exports.useArcLinkLabels=function(e){var t=e.data,i=e.skipAngle,u=e.offset,s=e.diagonalLength,l=e.straightLength,d=e.textOffset,c=void 0===d?0:d,f=e.label,g=e.linkColor,p=e.textColor,A=n.usePropertyAccessor(f),x=n.useTheme(),h=o.useInheritedColor(g,x),v=o.useInheritedColor(p,x),R=r.useCallback((function(e){var n,t={x:e.points[2].x,y:e.points[2].y};return"before"===e.side?(t.x-=c,n="end"):(t.x+=c,n="start"),a({},t,{label:A(e.data),linkColor:h(e.data),textAnchor:n,textColor:v(e.data)})}),[A,h,v,c]);return T({data:t,skipAngle:i,offset:u,diagonalLength:s,straightLength:l,computeExtraProps:R})},exports.useArcLinkLabelsTransition=b,exports.useArcLinks=T,exports.useArcTransitionMode=g,exports.useArcsTransition=E; | ||
"use strict";var e=require("@react-spring/web"),n=require("@nivo/core"),t=require("react/jsx-runtime"),r=require("react"),o=require("@nivo/colors"),i=require("d3-shape");function a(){return a=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},a.apply(this,arguments)}var u={pointerEvents:"none"},s=function(r){var o=r.label,i=r.style,s=n.useTheme();return t.jsx(e.animated.g,{transform:i.transform,opacity:i.progress,style:u,children:t.jsx(e.animated.text,{textAnchor:"middle",dominantBaseline:"central",style:a({},s.labels.text,{fill:i.textColor}),children:o})})},l=function(e){var n=e%(2*Math.PI);return n<0&&(n+=2*Math.PI),n},d=function(e,t){return e.filter((function(e){return Math.abs(n.radiansToDegrees(e.arc.endAngle-e.arc.startAngle))>=t}))},c=function(e,n,t,r,o){return["A",e,e,0,n,t,r,o].join(" ")},f={startAngle:{enter:function(e){return a({},e,{endAngle:e.startAngle})},update:function(e){return e},leave:function(e){return a({},e,{startAngle:e.endAngle})}},middleAngle:{enter:function(e){var n=e.startAngle+(e.endAngle-e.startAngle)/2;return a({},e,{startAngle:n,endAngle:n})},update:function(e){return e},leave:function(e){var n=e.startAngle+(e.endAngle-e.startAngle)/2;return a({},e,{startAngle:n,endAngle:n})}},endAngle:{enter:function(e){return a({},e,{startAngle:e.endAngle})},update:function(e){return e},leave:function(e){return a({},e,{endAngle:e.startAngle})}},innerRadius:{enter:function(e){return a({},e,{outerRadius:e.innerRadius})},update:function(e){return e},leave:function(e){return a({},e,{innerRadius:e.outerRadius})}},centerRadius:{enter:function(e){var n=e.innerRadius+(e.outerRadius-e.innerRadius)/2;return a({},e,{innerRadius:n,outerRadius:n})},update:function(e){return e},leave:function(e){var n=e.innerRadius+(e.outerRadius-e.innerRadius)/2;return a({},e,{innerRadius:n,outerRadius:n})}},outerRadius:{enter:function(e){return a({},e,{innerRadius:e.outerRadius})},update:function(e){return e},leave:function(e){return a({},e,{outerRadius:e.innerRadius})}},pushIn:{enter:function(e){return a({},e,{innerRadius:e.innerRadius-e.outerRadius+e.innerRadius,outerRadius:e.innerRadius})},update:function(e){return e},leave:function(e){return a({},e,{innerRadius:e.outerRadius,outerRadius:e.outerRadius+e.outerRadius-e.innerRadius})}},pushOut:{enter:function(e){return a({},e,{innerRadius:e.outerRadius,outerRadius:e.outerRadius+e.outerRadius-e.innerRadius})},update:function(e){return e},leave:function(e){return a({},e,{innerRadius:e.innerRadius-e.outerRadius+e.innerRadius,outerRadius:e.innerRadius})}}},g=function(e,n){return r.useMemo((function(){var t=f[e];return{enter:function(e){return a({progress:0},t.enter(e.arc),n?n.enter(e):{})},update:function(e){return a({progress:1},t.update(e.arc),n?n.update(e):{})},leave:function(e){return a({progress:0},t.leave(e.arc),n?n.leave(e):{})}}}),[e,n])},p=function(e,t){var r=n.midAngle(e)-Math.PI/2,o=e.innerRadius+(e.outerRadius-e.innerRadius)*t;return n.positionFromAngle(r,o)},A=function(n){return function(t,r,o,i){return e.to([t,r,o,i],(function(e,t,r,o){var i=p({startAngle:e,endAngle:t,innerRadius:r,outerRadius:o},n);return"translate("+i.x+","+i.y+")"}))}},x=function(t,r,o,i){void 0===r&&(r=.5),void 0===o&&(o="innerRadius");var a=n.useMotionConfig(),u=a.animate,s=a.config,l=g(o,i);return{transition:e.useTransition(t,{keys:function(e){return e.id},initial:l.update,from:l.enter,enter:l.update,update:l.update,leave:l.leave,config:s,immediate:!u}),interpolate:A(r)}},h=function(e){var n=e.data,t=e.offset,o=void 0===t?.5:t,i=e.skipAngle,u=void 0===i?0:i,s=e.computeExtraProps,l=void 0===s?function(){return{}}:s;return r.useMemo((function(){return d(n,u).map((function(e){var n=p(e.arc,o);return a({},l(e),{x:n.x,y:n.y,data:e})}))}),[n,o,u,l])},v=s,R=function(r){var o=r.label,i=r.style,u=n.useTheme();return t.jsxs(e.animated.g,{opacity:i.opacity,children:[t.jsx(e.animated.path,{fill:"none",stroke:i.linkColor,strokeWidth:i.thickness,d:i.path}),t.jsx(e.animated.text,{transform:i.textPosition,textAnchor:i.textAnchor,dominantBaseline:"central",style:a({},u.labels.text,{fill:i.textColor}),children:o})]})},m=function(e){var n=l(e.startAngle+(e.endAngle-e.startAngle)/2-Math.PI/2);return n<Math.PI/2||n>1.5*Math.PI?"start":"end"},y=function(e,t,r,o){var i,a,u=l(e.startAngle+(e.endAngle-e.startAngle)/2-Math.PI/2),s=n.positionFromAngle(u,e.outerRadius+t),d=n.positionFromAngle(u,e.outerRadius+t+r);return u<Math.PI/2||u>1.5*Math.PI?(i="after",a={x:d.x+o,y:d.y}):(i="before",a={x:d.x-o,y:d.y}),{side:i,points:[s,d,a]}},C=i.line().x((function(e){return e.x})).y((function(e){return e.y})),M=function(n,t,r,o,i,a,u){return e.to([n,t,r,o,i,a,u],(function(e,n,t,r,o,i,a){var u=y({startAngle:e,endAngle:n,innerRadius:t,outerRadius:r},o,i,a).points;return C(u)}))},k=function(n,t,r,o){return e.to([n,t,r,o],(function(e,n,t,r){return m({startAngle:e,endAngle:n,innerRadius:t,outerRadius:r})}))},L=function(n,t,r,o,i,a,u,s){return e.to([n,t,r,o,i,a,u,s],(function(e,n,t,r,o,i,a,u){var s=y({startAngle:e,endAngle:n,innerRadius:t,outerRadius:r},o,i,a),l=s.points,d=s.side,c=l[2];return"before"===d?c.x-=u:c.x+=u,"translate("+c.x+","+c.y+")"}))},b=function(t){var i=t.data,a=t.offset,u=void 0===a?0:a,s=t.diagonalLength,l=t.straightLength,c=t.skipAngle,f=void 0===c?0:c,g=t.textOffset,p=t.linkColor,A=t.textColor,x=n.useMotionConfig(),h=x.animate,v=x.config,R=n.useTheme(),m=o.useInheritedColor(p,R),y=o.useInheritedColor(A,R),C=function(e,n){return r.useMemo((function(){return d(e,n)}),[e,n])}(i,f),b=function(e){var n=e.offset,t=e.diagonalLength,o=e.straightLength,i=e.textOffset,a=e.getLinkColor,u=e.getTextColor;return r.useMemo((function(){return{enter:function(e){return{startAngle:e.arc.startAngle,endAngle:e.arc.endAngle,innerRadius:e.arc.innerRadius,outerRadius:e.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(e),textColor:u(e),opacity:0}},update:function(e){return{startAngle:e.arc.startAngle,endAngle:e.arc.endAngle,innerRadius:e.arc.innerRadius,outerRadius:e.arc.outerRadius,offset:n,diagonalLength:t,straightLength:o,textOffset:i,linkColor:a(e),textColor:u(e),opacity:1}},leave:function(e){return{startAngle:e.arc.startAngle,endAngle:e.arc.endAngle,innerRadius:e.arc.innerRadius,outerRadius:e.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(e),textColor:u(e),opacity:0}}}}),[t,o,i,a,u])}({offset:u,diagonalLength:s,straightLength:l,textOffset:g,getLinkColor:m,getTextColor:y});return{transition:e.useTransition(C,{keys:function(e){return e.id},initial:b.update,from:b.enter,enter:b.update,update:b.update,leave:b.leave,config:v,immediate:!h}),interpolateLink:M,interpolateTextAnchor:k,interpolateTextPosition:L}},T=function(e){var t=e.data,o=e.skipAngle,i=void 0===o?0:o,u=e.offset,s=void 0===u?.5:u,l=e.diagonalLength,d=e.straightLength,c=e.computeExtraProps,f=void 0===c?function(){return{}}:c,g=r.useMemo((function(){return t.filter((function(e){return Math.abs(n.radiansToDegrees(e.arc.endAngle-e.arc.startAngle))>=i})).map((function(e){return a({},y(e.arc,s,l,d),{data:e})}))}),[t,i,s,l,d]);return r.useMemo((function(){return g.map((function(e){return a({},f(e),e)}))}),[g,f])},P=R,I=["animated"],O=function(n){var o=n.datum,i=n.style,a=n.onClick,u=n.onMouseEnter,s=n.onMouseMove,l=n.onMouseLeave,d=r.useCallback((function(e){return null==a?void 0:a(o,e)}),[a,o]),c=r.useCallback((function(e){return null==u?void 0:u(o,e)}),[u,o]),f=r.useCallback((function(e){return null==s?void 0:s(o,e)}),[s,o]),g=r.useCallback((function(e){return null==l?void 0:l(o,e)}),[l,o]);return t.jsx(e.animated.path,{d:i.path,opacity:i.opacity,fill:o.fill||i.color,stroke:i.borderColor,strokeWidth:i.borderWidth,onClick:a?d:void 0,onMouseEnter:u?c:void 0,onMouseMove:s?f:void 0,onMouseLeave:l?g:void 0})},j=function(n,t,r,o,i){return e.to([n,t,r,o],(function(e,n,t,r){return i({startAngle:e,endAngle:n,innerRadius:Math.max(0,t),outerRadius:Math.max(0,r)})}))},E=function(t,r,o){void 0===r&&(r="innerRadius");var i=n.useMotionConfig(),a=i.animate,u=i.config,s=g(r,o);return{transition:e.useTransition(t,{keys:function(e){return e.id},initial:s.update,from:s.enter,enter:s.update,update:s.update,leave:s.leave,config:u,immediate:!a}),interpolate:j}},F=function(e,t,r,o,i,a){var u=n.getDistance(i,a,e,t);return u<r&&u>o};exports.ArcLabelComponent=v,exports.ArcLabelsLayer=function(e){var i=e.center,u=e.data,l=e.transitionMode,d=e.label,c=e.radiusOffset,f=e.skipAngle,g=e.textColor,p=e.component,A=void 0===p?s:p,h=n.usePropertyAccessor(d),v=n.useTheme(),R=o.useInheritedColor(g,v),m=r.useMemo((function(){return u.filter((function(e){return Math.abs(n.radiansToDegrees(e.arc.endAngle-e.arc.startAngle))>=f}))}),[u,f]),y=x(m,c,l),C=y.transition,M=y.interpolate,k=A;return t.jsx("g",{transform:"translate("+i[0]+","+i[1]+")",children:C((function(e,n){return r.createElement(k,{key:n.id,datum:n,label:h(n),style:a({},e,{transform:M(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius),textColor:R(n)})})}))})},exports.ArcLine=function(r){var o=r.animated,i=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(r,I);return t.jsx(e.animated.path,a({d:e.to([o.radius,o.startAngle,o.endAngle],(function(e,t,r){return function(e,t,r){var o=Math.min(t,r),i=Math.max(t,r),a=n.positionFromAngle(n.degreesToRadians(i),e),u=n.positionFromAngle(n.degreesToRadians(o),e);if(i-o>=360){var s=n.positionFromAngle(n.degreesToRadians(o+180),e);return["M "+a.x+" "+a.y,c(e,1,1,s.x,s.y),"M "+a.x+" "+a.y,c(e,1,0,s.x,s.y)].join(" ")}var l=i-o<=180?0:1;return["M "+a.x+" "+a.y,c(e,l,0,u.x,u.y)].join(" ")}(e,t,r)}))},i))},exports.ArcLinkLabelComponent=P,exports.ArcLinkLabelsLayer=function(e){var o=e.center,i=e.data,u=e.label,s=e.skipAngle,l=e.offset,d=e.diagonalLength,c=e.straightLength,f=e.strokeWidth,g=e.textOffset,p=e.textColor,A=e.linkColor,x=e.component,h=void 0===x?R:x,v=n.usePropertyAccessor(u),m=b({data:i,skipAngle:s,offset:l,diagonalLength:d,straightLength:c,textOffset:g,linkColor:A,textColor:p}),y=m.transition,C=m.interpolateLink,M=m.interpolateTextAnchor,k=m.interpolateTextPosition,L=h;return t.jsx("g",{transform:"translate("+o[0]+","+o[1]+")",children:y((function(e,n){return r.createElement(L,{key:n.id,datum:n,label:v(n),style:a({},e,{thickness:f,path:C(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius,e.offset,e.diagonalLength,e.straightLength),textAnchor:M(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius),textPosition:k(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius,e.offset,e.diagonalLength,e.straightLength,e.textOffset)})})}))})},exports.ArcShape=O,exports.ArcsLayer=function(e){var i=e.center,u=e.data,s=e.arcGenerator,l=e.borderWidth,d=e.borderColor,c=e.onClick,f=e.onMouseEnter,g=e.onMouseMove,p=e.onMouseLeave,A=e.transitionMode,x=e.component,h=void 0===x?O:x,v=n.useTheme(),R=o.useInheritedColor(d,v),m=E(u,A,{enter:function(e){return{opacity:0,color:e.color,borderColor:R(e)}},update:function(e){return{opacity:1,color:e.color,borderColor:R(e)}},leave:function(e){return{opacity:0,color:e.color,borderColor:R(e)}}}),y=m.transition,C=m.interpolate,M=h;return t.jsx("g",{transform:"translate("+i[0]+","+i[1]+")",children:y((function(e,n){return r.createElement(M,{key:n.id,datum:n,style:a({},e,{borderWidth:l,path:C(e.startAngle,e.endAngle,e.innerRadius,e.outerRadius,s)}),onClick:c,onMouseEnter:f,onMouseMove:g,onMouseLeave:p})}))})},exports.arcTransitionModeById=f,exports.arcTransitionModes=["startAngle","middleAngle","endAngle","innerRadius","centerRadius","outerRadius","pushIn","pushOut"],exports.computeArcBoundingBox=function(e,t,r,o,i,a){void 0===a&&(a=!0);var u=[],s=n.positionFromAngle(n.degreesToRadians(o),r);u.push([s.x,s.y]);var l=n.positionFromAngle(n.degreesToRadians(i),r);u.push([l.x,l.y]);for(var d=Math.round(Math.min(o,i));d<=Math.round(Math.max(o,i));d++)if(d%90==0){var c=n.positionFromAngle(n.degreesToRadians(d),r);u.push([c.x,c.y])}u=u.map((function(n){var r=n[0],o=n[1];return[e+r,t+o]})),a&&u.push([e,t]);var f=u.map((function(e){return e[0]})),g=u.map((function(e){return e[1]})),p=Math.min.apply(Math,f),A=Math.max.apply(Math,f),x=Math.min.apply(Math,g);return{points:u,x:p,y:x,width:A-p,height:Math.max.apply(Math,g)-x}},exports.computeArcCenter=p,exports.computeArcLink=y,exports.computeArcLinkTextAnchor=m,exports.drawCanvasArcLabels=function(e,n,t){e.textAlign="center",e.textBaseline="middle",e.font=t.labels.text.fontSize+"px "+t.labels.text.fontFamily,n.forEach((function(n){e.fillStyle=n.textColor,e.fillText(""+n.label,n.x,n.y)}))},exports.drawCanvasArcLinkLabels=function(e,t,r,o){e.textBaseline="middle",e.font=r.labels.text.fontSize+"px "+r.labels.text.fontFamily,t.forEach((function(t){e.fillStyle=t.textColor,e.textAlign=n.textPropsByEngine.canvas.align[t.textAnchor],e.fillText(""+t.label,t.x,t.y),e.beginPath(),e.strokeStyle=t.linkColor,e.lineWidth=o,t.points.forEach((function(n,t){0===t?e.moveTo(n.x,n.y):e.lineTo(n.x,n.y)})),e.stroke()}))},exports.findArcUnderCursor=function(e,t,r,o,i,a,u){if(F(e,t,r,o,a,u)){var s=n.getAngle(a,u,e,t);return i.find((function(e){var n=e.startAngle,t=e.endAngle;return s>=n&&s<t}))}},exports.interpolateArc=j,exports.interpolateArcCenter=A,exports.isCursorInRing=F,exports.useAnimatedArc=function(t,r){var o=n.useMotionConfig(),i=o.animate,u=o.config,s=e.useSpring({startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,config:u,immediate:!i});return a({},s,{path:j(s.startAngle,s.endAngle,s.innerRadius,s.outerRadius,r)})},exports.useArcCenters=h,exports.useArcCentersTransition=x,exports.useArcGenerator=function(e){var n=void 0===e?{}:e,t=n.cornerRadius,o=void 0===t?0:t,a=n.padAngle,u=void 0===a?0:a;return r.useMemo((function(){return i.arc().innerRadius((function(e){return e.innerRadius})).outerRadius((function(e){return e.outerRadius})).cornerRadius(o).padAngle(u)}),[o,u])},exports.useArcLabels=function(e){var t=e.data,i=e.offset,a=e.skipAngle,u=e.label,s=e.textColor,l=n.usePropertyAccessor(u),d=n.useTheme(),c=o.useInheritedColor(s,d),f=r.useCallback((function(e){return{label:l(e),textColor:c(e)}}),[l,c]);return h({data:t,offset:i,skipAngle:a,computeExtraProps:f})},exports.useArcLinkLabels=function(e){var t=e.data,i=e.skipAngle,u=e.offset,s=e.diagonalLength,l=e.straightLength,d=e.textOffset,c=void 0===d?0:d,f=e.label,g=e.linkColor,p=e.textColor,A=n.usePropertyAccessor(f),x=n.useTheme(),h=o.useInheritedColor(g,x),v=o.useInheritedColor(p,x),R=r.useCallback((function(e){var n,t={x:e.points[2].x,y:e.points[2].y};return"before"===e.side?(t.x-=c,n="end"):(t.x+=c,n="start"),a({},t,{label:A(e.data),linkColor:h(e.data),textAnchor:n,textColor:v(e.data)})}),[A,h,v,c]);return T({data:t,skipAngle:i,offset:u,diagonalLength:s,straightLength:l,computeExtraProps:R})},exports.useArcLinkLabelsTransition=b,exports.useArcLinks=T,exports.useArcTransitionMode=g,exports.useArcsTransition=E; | ||
//# sourceMappingURL=nivo-arcs.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import{animated as t,to as n,useTransition as e,useSpring as r}from"@react-spring/web";import{useTheme as i,radiansToDegrees as a,positionFromAngle as o,degreesToRadians as u,midAngle as l,useMotionConfig as s,usePropertyAccessor as d,textPropsByEngine as f,getDistance as c,getAngle as g}from"@nivo/core";import{jsx as p,jsxs as h}from"react/jsx-runtime";import{useMemo as v,createElement as A,useCallback as x}from"react";import{useInheritedColor as R}from"@nivo/colors";import{line as m,arc as y}from"d3-shape";function M(){return M=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},M.apply(this,arguments)}var k={pointerEvents:"none"},C=function(n){var e=n.label,r=n.style,a=i();return p(t.g,{transform:r.transform,opacity:r.progress,style:k,children:p(t.text,{textAnchor:"middle",dominantBaseline:"central",style:M({},a.labels.text,{fill:r.textColor}),children:e})})},b=function(t){var n=t%(2*Math.PI);return n<0&&(n+=2*Math.PI),n},L=function(t,n){return t.filter((function(t){return Math.abs(a(t.arc.endAngle-t.arc.startAngle))>=n}))},P=function(t,n,e,r,i){return["A",t,t,0,n,e,r,i].join(" ")},O=["startAngle","middleAngle","endAngle","innerRadius","centerRadius","outerRadius","pushIn","pushOut"],E={startAngle:{enter:function(t){return M({},t,{endAngle:t.startAngle})},update:function(t){return t},leave:function(t){return M({},t,{startAngle:t.endAngle})}},middleAngle:{enter:function(t){var n=t.startAngle+(t.endAngle-t.startAngle)/2;return M({},t,{startAngle:n,endAngle:n})},update:function(t){return t},leave:function(t){var n=t.startAngle+(t.endAngle-t.startAngle)/2;return M({},t,{startAngle:n,endAngle:n})}},endAngle:{enter:function(t){return M({},t,{startAngle:t.endAngle})},update:function(t){return t},leave:function(t){return M({},t,{endAngle:t.startAngle})}},innerRadius:{enter:function(t){return M({},t,{outerRadius:t.innerRadius})},update:function(t){return t},leave:function(t){return M({},t,{innerRadius:t.outerRadius})}},centerRadius:{enter:function(t){var n=t.innerRadius+(t.outerRadius-t.innerRadius)/2;return M({},t,{innerRadius:n,outerRadius:n})},update:function(t){return t},leave:function(t){var n=t.innerRadius+(t.outerRadius-t.innerRadius)/2;return M({},t,{innerRadius:n,outerRadius:n})}},outerRadius:{enter:function(t){return M({},t,{innerRadius:t.outerRadius})},update:function(t){return t},leave:function(t){return M({},t,{outerRadius:t.innerRadius})}},pushIn:{enter:function(t){return M({},t,{innerRadius:t.innerRadius-t.outerRadius+t.innerRadius,outerRadius:t.innerRadius})},update:function(t){return t},leave:function(t){return M({},t,{innerRadius:t.outerRadius,outerRadius:t.outerRadius+t.outerRadius-t.innerRadius})}},pushOut:{enter:function(t){return M({},t,{innerRadius:t.outerRadius,outerRadius:t.outerRadius+t.outerRadius-t.innerRadius})},update:function(t){return t},leave:function(t){return M({},t,{innerRadius:t.innerRadius-t.outerRadius+t.innerRadius,outerRadius:t.innerRadius})}}},I=function(t,n){return v((function(){var e=E[t];return{enter:function(t){return M({progress:0},e.enter(t.arc),n?n.enter(t):{})},update:function(t){return M({progress:1},e.update(t.arc),n?n.update(t):{})},leave:function(t){return M({progress:0},e.leave(t.arc),n?n.leave(t):{})}}}),[t,n])},T=function(t,n){var e=l(t)-Math.PI/2,r=t.innerRadius+(t.outerRadius-t.innerRadius)*n;return o(e,r)},j=function(t){return function(e,r,i,a){return n([e,r,i,a],(function(n,e,r,i){var a=T({startAngle:n,endAngle:e,innerRadius:r,outerRadius:i},t);return"translate("+a.x+","+a.y+")"}))}},W=function(t,n,r,i){void 0===n&&(n=.5),void 0===r&&(r="innerRadius");var a=s(),o=a.animate,u=a.config,l=I(r,i);return{transition:e(t,{keys:function(t){return t.id},initial:l.update,from:l.enter,enter:l.update,update:l.update,leave:l.leave,config:u,immediate:!o}),interpolate:j(n)}},S=function(t){var n=t.data,e=t.offset,r=void 0===e?.5:e,i=t.skipAngle,a=void 0===i?0:i,o=t.computeExtraProps,u=void 0===o?function(){return{}}:o;return v((function(){return L(n,a).map((function(t){var n=T(t.arc,r);return M({},u(t),{x:n.x,y:n.y,data:t})}))}),[n,r,a,u])},B=function(t){var n=t.center,e=t.data,r=t.transitionMode,o=t.label,u=t.radiusOffset,l=t.skipAngle,s=t.textColor,f=t.component,c=void 0===f?C:f,g=d(o),h=i(),x=R(s,h),m=v((function(){return e.filter((function(t){return Math.abs(a(t.arc.endAngle-t.arc.startAngle))>=l}))}),[e,l]),y=W(m,u,r),k=y.transition,b=y.interpolate,L=c;return p("g",{transform:"translate("+n[0]+","+n[1]+")",children:k((function(t,n){return A(L,{key:n.id,datum:n,label:g(n),style:M({},t,{transform:b(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius),textColor:x(n)})})}))})},w=function(t,n,e){t.textAlign="center",t.textBaseline="middle",t.font=e.labels.text.fontSize+"px "+e.labels.text.fontFamily,n.forEach((function(n){t.fillStyle=n.textColor,t.fillText(""+n.label,n.x,n.y)}))},z=function(t){var n=t.data,e=t.offset,r=t.skipAngle,a=t.label,o=t.textColor,u=d(a),l=i(),s=R(o,l),f=x((function(t){return{label:u(t),textColor:s(t)}}),[u,s]);return S({data:n,offset:e,skipAngle:r,computeExtraProps:f})},F=C,G=function(n){var e=n.label,r=n.style,a=i();return h(t.g,{opacity:r.opacity,children:[p(t.path,{fill:"none",stroke:r.linkColor,strokeWidth:r.thickness,d:r.path}),p(t.text,{transform:r.textPosition,textAnchor:r.textAnchor,dominantBaseline:"central",style:M({},a.labels.text,{fill:r.textColor}),children:e})]})},q=function(t){var n=b(t.startAngle+(t.endAngle-t.startAngle)/2-Math.PI/2);return n<Math.PI/2||n>1.5*Math.PI?"start":"end"},D=function(t,n,e,r){var i,a,u=b(t.startAngle+(t.endAngle-t.startAngle)/2-Math.PI/2),l=o(u,t.outerRadius+n),s=o(u,t.outerRadius+n+e);return u<Math.PI/2||u>1.5*Math.PI?(i="after",a={x:s.x+r,y:s.y}):(i="before",a={x:s.x-r,y:s.y}),{side:i,points:[l,s,a]}},H=m().x((function(t){return t.x})).y((function(t){return t.y})),J=function(t,e,r,i,a,o,u){return n([t,e,r,i,a,o,u],(function(t,n,e,r,i,a,o){var u=D({startAngle:t,endAngle:n,innerRadius:e,outerRadius:r},i,a,o).points;return H(u)}))},K=function(t,e,r,i){return n([t,e,r,i],(function(t,n,e,r){return q({startAngle:t,endAngle:n,innerRadius:e,outerRadius:r})}))},N=function(t,e,r,i,a,o,u,l){return n([t,e,r,i,a,o,u,l],(function(t,n,e,r,i,a,o,u){var l=D({startAngle:t,endAngle:n,innerRadius:e,outerRadius:r},i,a,o),s=l.points,d=l.side,f=s[2];return"before"===d?f.x-=u:f.x+=u,"translate("+f.x+","+f.y+")"}))},Q=function(t){var n=t.data,r=t.offset,a=void 0===r?0:r,o=t.diagonalLength,u=t.straightLength,l=t.skipAngle,d=void 0===l?0:l,f=t.textOffset,c=t.linkColor,g=t.textColor,p=s(),h=p.animate,A=p.config,x=i(),m=R(c,x),y=R(g,x),M=function(t,n){return v((function(){return L(t,n)}),[t,n])}(n,d),k=function(t){var n=t.offset,e=t.diagonalLength,r=t.straightLength,i=t.textOffset,a=t.getLinkColor,o=t.getTextColor;return v((function(){return{enter:function(t){return{startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(t),textColor:o(t),opacity:0}},update:function(t){return{startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,offset:n,diagonalLength:e,straightLength:r,textOffset:i,linkColor:a(t),textColor:o(t),opacity:1}},leave:function(t){return{startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(t),textColor:o(t),opacity:0}}}}),[e,r,i,a,o])}({offset:a,diagonalLength:o,straightLength:u,textOffset:f,getLinkColor:m,getTextColor:y});return{transition:e(M,{keys:function(t){return t.id},initial:k.update,from:k.enter,enter:k.update,update:k.update,leave:k.leave,config:A,immediate:!h}),interpolateLink:J,interpolateTextAnchor:K,interpolateTextPosition:N}},U=function(t){var n=t.center,e=t.data,r=t.label,i=t.skipAngle,a=t.offset,o=t.diagonalLength,u=t.straightLength,l=t.strokeWidth,s=t.textOffset,f=t.textColor,c=t.linkColor,g=t.component,h=void 0===g?G:g,v=d(r),x=Q({data:e,skipAngle:i,offset:a,diagonalLength:o,straightLength:u,textOffset:s,linkColor:c,textColor:f}),R=x.transition,m=x.interpolateLink,y=x.interpolateTextAnchor,k=x.interpolateTextPosition,C=h;return p("g",{transform:"translate("+n[0]+","+n[1]+")",children:R((function(t,n){return A(C,{key:n.id,datum:n,label:v(n),style:M({},t,{thickness:l,path:m(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius,t.offset,t.diagonalLength,t.straightLength),textAnchor:y(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius),textPosition:k(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius,t.offset,t.diagonalLength,t.straightLength,t.textOffset)})})}))})},V=function(t,n,e,r){t.textBaseline="middle",t.font=e.labels.text.fontSize+"px "+e.labels.text.fontFamily,n.forEach((function(n){t.fillStyle=n.textColor,t.textAlign=f.canvas.align[n.textAnchor],t.fillText(""+n.label,n.x,n.y),t.beginPath(),t.strokeStyle=n.linkColor,t.lineWidth=r,n.points.forEach((function(n,e){0===e?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y)})),t.stroke()}))},X=function(t){var n=t.data,e=t.skipAngle,r=void 0===e?0:e,i=t.offset,o=void 0===i?.5:i,u=t.diagonalLength,l=t.straightLength,s=t.computeExtraProps,d=void 0===s?function(){return{}}:s,f=v((function(){return n.filter((function(t){return Math.abs(a(t.arc.endAngle-t.arc.startAngle))>=r})).map((function(t){return M({},D(t.arc,o,u,l),{data:t})}))}),[n,r,o,u,l]);return v((function(){return f.map((function(t){return M({},d(t),t)}))}),[f,d])},Y=function(t){var n=t.data,e=t.skipAngle,r=t.offset,a=t.diagonalLength,o=t.straightLength,u=t.textOffset,l=void 0===u?0:u,s=t.label,f=t.linkColor,c=t.textColor,g=d(s),p=i(),h=R(f,p),v=R(c,p),A=x((function(t){var n,e={x:t.points[2].x,y:t.points[2].y};return"before"===t.side?(e.x-=l,n="end"):(e.x+=l,n="start"),M({},e,{label:g(t.data),linkColor:h(t.data),textAnchor:n,textColor:v(t.data)})}),[g,h,v,l]);return X({data:n,skipAngle:e,offset:r,diagonalLength:a,straightLength:o,computeExtraProps:A})},Z=G,$=["animated"],_=function(e){var r=e.animated,i=function(t,n){if(null==t)return{};var e,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)e=a[r],n.indexOf(e)>=0||(i[e]=t[e]);return i}(e,$);return p(t.path,M({d:n([r.radius,r.startAngle,r.endAngle],(function(t,n,e){return function(t,n,e){var r=Math.min(n,e),i=Math.max(n,e),a=o(u(i),t),l=o(u(r),t);if(i-r>=360){var s=o(u(r+180),t);return["M "+a.x+" "+a.y,P(t,1,1,s.x,s.y),"M "+a.x+" "+a.y,P(t,1,0,s.x,s.y)].join(" ")}var d=i-r<=180?0:1;return["M "+a.x+" "+a.y,P(t,d,0,l.x,l.y)].join(" ")}(t,n,e)}))},i))},tt=function(n){var e=n.datum,r=n.style,i=n.onClick,a=n.onMouseEnter,o=n.onMouseMove,u=n.onMouseLeave,l=x((function(t){return null==i?void 0:i(e,t)}),[i,e]),s=x((function(t){return null==a?void 0:a(e,t)}),[a,e]),d=x((function(t){return null==o?void 0:o(e,t)}),[o,e]),f=x((function(t){return null==u?void 0:u(e,t)}),[u,e]);return p(t.path,{d:r.path,opacity:r.opacity,fill:e.fill||r.color,stroke:r.borderColor,strokeWidth:r.borderWidth,onClick:i?l:void 0,onMouseEnter:a?s:void 0,onMouseMove:o?d:void 0,onMouseLeave:u?f:void 0})},nt=function(t,e,r,i,a){return n([t,e,r,i],(function(t,n,e,r){return a({startAngle:t,endAngle:n,innerRadius:Math.max(0,e),outerRadius:Math.max(0,r)})}))},et=function(t,n,r){void 0===n&&(n="innerRadius");var i=s(),a=i.animate,o=i.config,u=I(n,r);return{transition:e(t,{keys:function(t){return t.id},initial:u.update,from:u.enter,enter:u.update,update:u.update,leave:u.leave,config:o,immediate:!a}),interpolate:nt}},rt=function(t){var n=t.center,e=t.data,r=t.arcGenerator,a=t.borderWidth,o=t.borderColor,u=t.onClick,l=t.onMouseEnter,s=t.onMouseMove,d=t.onMouseLeave,f=t.transitionMode,c=t.component,g=void 0===c?tt:c,h=i(),v=R(o,h),x=et(e,f,{enter:function(t){return{opacity:0,color:t.color,borderColor:v(t)}},update:function(t){return{opacity:1,color:t.color,borderColor:v(t)}},leave:function(t){return{opacity:0,color:t.color,borderColor:v(t)}}}),m=x.transition,y=x.interpolate,k=g;return p("g",{transform:"translate("+n[0]+","+n[1]+")",children:m((function(t,n){return A(k,{key:n.id,datum:n,style:M({},t,{borderWidth:a,path:y(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius,r)}),onClick:u,onMouseEnter:l,onMouseMove:s,onMouseLeave:d})}))})},it=function(t,n,e,r,i,a){void 0===a&&(a=!0);var l=[],s=o(u(r),e);l.push([s.x,s.y]);var d=o(u(i),e);l.push([d.x,d.y]);for(var f=Math.round(Math.min(r,i));f<=Math.round(Math.max(r,i));f++)if(f%90==0){var c=o(u(f),e);l.push([c.x,c.y])}l=l.map((function(e){var r=e[0],i=e[1];return[t+r,n+i]})),a&&l.push([t,n]);var g=l.map((function(t){return t[0]})),p=l.map((function(t){return t[1]})),h=Math.min.apply(Math,g),v=Math.max.apply(Math,g),A=Math.min.apply(Math,p);return{points:l,x:h,y:A,width:v-h,height:Math.max.apply(Math,p)-A}},at=function(t,n,e,r,i,a){var o=c(i,a,t,n);return o<e&&o>r},ot=function(t,n,e,r,i,a,o){if(at(t,n,e,r,a,o)){var u=g(a,o,t,n);return i.find((function(t){var n=t.startAngle,e=t.endAngle;return u>=n&&u<e}))}},ut=function(t,n){var e=s(),i=e.animate,a=e.config,o=r({startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,config:a,immediate:!i});return M({},o,{path:nt(o.startAngle,o.endAngle,o.innerRadius,o.outerRadius,n)})},lt=function(t){var n=void 0===t?{}:t,e=n.cornerRadius,r=void 0===e?0:e,i=n.padAngle,a=void 0===i?0:i;return v((function(){return y().innerRadius((function(t){return t.innerRadius})).outerRadius((function(t){return t.outerRadius})).cornerRadius(r).padAngle(a)}),[r,a])};export{F as ArcLabelComponent,B as ArcLabelsLayer,_ as ArcLine,Z as ArcLinkLabelComponent,U as ArcLinkLabelsLayer,tt as ArcShape,rt as ArcsLayer,E as arcTransitionModeById,O as arcTransitionModes,it as computeArcBoundingBox,T as computeArcCenter,D as computeArcLink,q as computeArcLinkTextAnchor,w as drawCanvasArcLabels,V as drawCanvasArcLinkLabels,ot as findArcUnderCursor,nt as interpolateArc,j as interpolateArcCenter,at as isCursorInRing,ut as useAnimatedArc,S as useArcCenters,W as useArcCentersTransition,lt as useArcGenerator,z as useArcLabels,Y as useArcLinkLabels,Q as useArcLinkLabelsTransition,X as useArcLinks,I as useArcTransitionMode,et as useArcsTransition}; | ||
import{animated as t,to as n,useTransition as e,useSpring as r}from"@react-spring/web";import{useTheme as i,radiansToDegrees as a,positionFromAngle as o,degreesToRadians as u,midAngle as l,useMotionConfig as s,usePropertyAccessor as d,textPropsByEngine as f,getDistance as c,getAngle as g}from"@nivo/core";import{jsx as p,jsxs as h}from"react/jsx-runtime";import{useMemo as v,createElement as A,useCallback as x}from"react";import{useInheritedColor as R}from"@nivo/colors";import{line as m,arc as y}from"d3-shape";function M(){return M=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},M.apply(this,arguments)}var k={pointerEvents:"none"},b=function(n){var e=n.label,r=n.style,a=i();return p(t.g,{transform:r.transform,opacity:r.progress,style:k,children:p(t.text,{textAnchor:"middle",dominantBaseline:"central",style:M({},a.labels.text,{fill:r.textColor}),children:e})})},C=function(t){var n=t%(2*Math.PI);return n<0&&(n+=2*Math.PI),n},L=function(t,n){return t.filter((function(t){return Math.abs(a(t.arc.endAngle-t.arc.startAngle))>=n}))},O=function(t,n,e,r,i){return["A",t,t,0,n,e,r,i].join(" ")},P=["startAngle","middleAngle","endAngle","innerRadius","centerRadius","outerRadius","pushIn","pushOut"],E={startAngle:{enter:function(t){return M({},t,{endAngle:t.startAngle})},update:function(t){return t},leave:function(t){return M({},t,{startAngle:t.endAngle})}},middleAngle:{enter:function(t){var n=t.startAngle+(t.endAngle-t.startAngle)/2;return M({},t,{startAngle:n,endAngle:n})},update:function(t){return t},leave:function(t){var n=t.startAngle+(t.endAngle-t.startAngle)/2;return M({},t,{startAngle:n,endAngle:n})}},endAngle:{enter:function(t){return M({},t,{startAngle:t.endAngle})},update:function(t){return t},leave:function(t){return M({},t,{endAngle:t.startAngle})}},innerRadius:{enter:function(t){return M({},t,{outerRadius:t.innerRadius})},update:function(t){return t},leave:function(t){return M({},t,{innerRadius:t.outerRadius})}},centerRadius:{enter:function(t){var n=t.innerRadius+(t.outerRadius-t.innerRadius)/2;return M({},t,{innerRadius:n,outerRadius:n})},update:function(t){return t},leave:function(t){var n=t.innerRadius+(t.outerRadius-t.innerRadius)/2;return M({},t,{innerRadius:n,outerRadius:n})}},outerRadius:{enter:function(t){return M({},t,{innerRadius:t.outerRadius})},update:function(t){return t},leave:function(t){return M({},t,{outerRadius:t.innerRadius})}},pushIn:{enter:function(t){return M({},t,{innerRadius:t.innerRadius-t.outerRadius+t.innerRadius,outerRadius:t.innerRadius})},update:function(t){return t},leave:function(t){return M({},t,{innerRadius:t.outerRadius,outerRadius:t.outerRadius+t.outerRadius-t.innerRadius})}},pushOut:{enter:function(t){return M({},t,{innerRadius:t.outerRadius,outerRadius:t.outerRadius+t.outerRadius-t.innerRadius})},update:function(t){return t},leave:function(t){return M({},t,{innerRadius:t.innerRadius-t.outerRadius+t.innerRadius,outerRadius:t.innerRadius})}}},I=function(t,n){return v((function(){var e=E[t];return{enter:function(t){return M({progress:0},e.enter(t.arc),n?n.enter(t):{})},update:function(t){return M({progress:1},e.update(t.arc),n?n.update(t):{})},leave:function(t){return M({progress:0},e.leave(t.arc),n?n.leave(t):{})}}}),[t,n])},T=function(t,n){var e=l(t)-Math.PI/2,r=t.innerRadius+(t.outerRadius-t.innerRadius)*n;return o(e,r)},j=function(t){return function(e,r,i,a){return n([e,r,i,a],(function(n,e,r,i){var a=T({startAngle:n,endAngle:e,innerRadius:r,outerRadius:i},t);return"translate("+a.x+","+a.y+")"}))}},W=function(t,n,r,i){void 0===n&&(n=.5),void 0===r&&(r="innerRadius");var a=s(),o=a.animate,u=a.config,l=I(r,i);return{transition:e(t,{keys:function(t){return t.id},initial:l.update,from:l.enter,enter:l.update,update:l.update,leave:l.leave,config:u,immediate:!o}),interpolate:j(n)}},S=function(t){var n=t.data,e=t.offset,r=void 0===e?.5:e,i=t.skipAngle,a=void 0===i?0:i,o=t.computeExtraProps,u=void 0===o?function(){return{}}:o;return v((function(){return L(n,a).map((function(t){var n=T(t.arc,r);return M({},u(t),{x:n.x,y:n.y,data:t})}))}),[n,r,a,u])},B=function(t){var n=t.center,e=t.data,r=t.transitionMode,o=t.label,u=t.radiusOffset,l=t.skipAngle,s=t.textColor,f=t.component,c=void 0===f?b:f,g=d(o),h=i(),x=R(s,h),m=v((function(){return e.filter((function(t){return Math.abs(a(t.arc.endAngle-t.arc.startAngle))>=l}))}),[e,l]),y=W(m,u,r),k=y.transition,C=y.interpolate,L=c;return p("g",{transform:"translate("+n[0]+","+n[1]+")",children:k((function(t,n){return A(L,{key:n.id,datum:n,label:g(n),style:M({},t,{transform:C(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius),textColor:x(n)})})}))})},w=function(t,n,e){t.textAlign="center",t.textBaseline="middle",t.font=e.labels.text.fontSize+"px "+e.labels.text.fontFamily,n.forEach((function(n){t.fillStyle=n.textColor,t.fillText(""+n.label,n.x,n.y)}))},z=function(t){var n=t.data,e=t.offset,r=t.skipAngle,a=t.label,o=t.textColor,u=d(a),l=i(),s=R(o,l),f=x((function(t){return{label:u(t),textColor:s(t)}}),[u,s]);return S({data:n,offset:e,skipAngle:r,computeExtraProps:f})},F=b,G=function(n){var e=n.label,r=n.style,a=i();return h(t.g,{opacity:r.opacity,children:[p(t.path,{fill:"none",stroke:r.linkColor,strokeWidth:r.thickness,d:r.path}),p(t.text,{transform:r.textPosition,textAnchor:r.textAnchor,dominantBaseline:"central",style:M({},a.labels.text,{fill:r.textColor}),children:e})]})},q=function(t){var n=C(t.startAngle+(t.endAngle-t.startAngle)/2-Math.PI/2);return n<Math.PI/2||n>1.5*Math.PI?"start":"end"},D=function(t,n,e,r){var i,a,u=C(t.startAngle+(t.endAngle-t.startAngle)/2-Math.PI/2),l=o(u,t.outerRadius+n),s=o(u,t.outerRadius+n+e);return u<Math.PI/2||u>1.5*Math.PI?(i="after",a={x:s.x+r,y:s.y}):(i="before",a={x:s.x-r,y:s.y}),{side:i,points:[l,s,a]}},H=m().x((function(t){return t.x})).y((function(t){return t.y})),J=function(t,e,r,i,a,o,u){return n([t,e,r,i,a,o,u],(function(t,n,e,r,i,a,o){var u=D({startAngle:t,endAngle:n,innerRadius:e,outerRadius:r},i,a,o).points;return H(u)}))},K=function(t,e,r,i){return n([t,e,r,i],(function(t,n,e,r){return q({startAngle:t,endAngle:n,innerRadius:e,outerRadius:r})}))},N=function(t,e,r,i,a,o,u,l){return n([t,e,r,i,a,o,u,l],(function(t,n,e,r,i,a,o,u){var l=D({startAngle:t,endAngle:n,innerRadius:e,outerRadius:r},i,a,o),s=l.points,d=l.side,f=s[2];return"before"===d?f.x-=u:f.x+=u,"translate("+f.x+","+f.y+")"}))},Q=function(t){var n=t.data,r=t.offset,a=void 0===r?0:r,o=t.diagonalLength,u=t.straightLength,l=t.skipAngle,d=void 0===l?0:l,f=t.textOffset,c=t.linkColor,g=t.textColor,p=s(),h=p.animate,A=p.config,x=i(),m=R(c,x),y=R(g,x),M=function(t,n){return v((function(){return L(t,n)}),[t,n])}(n,d),k=function(t){var n=t.offset,e=t.diagonalLength,r=t.straightLength,i=t.textOffset,a=t.getLinkColor,o=t.getTextColor;return v((function(){return{enter:function(t){return{startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(t),textColor:o(t),opacity:0}},update:function(t){return{startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,offset:n,diagonalLength:e,straightLength:r,textOffset:i,linkColor:a(t),textColor:o(t),opacity:1}},leave:function(t){return{startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,offset:n,diagonalLength:0,straightLength:0,textOffset:i,linkColor:a(t),textColor:o(t),opacity:0}}}}),[e,r,i,a,o])}({offset:a,diagonalLength:o,straightLength:u,textOffset:f,getLinkColor:m,getTextColor:y});return{transition:e(M,{keys:function(t){return t.id},initial:k.update,from:k.enter,enter:k.update,update:k.update,leave:k.leave,config:A,immediate:!h}),interpolateLink:J,interpolateTextAnchor:K,interpolateTextPosition:N}},U=function(t){var n=t.center,e=t.data,r=t.label,i=t.skipAngle,a=t.offset,o=t.diagonalLength,u=t.straightLength,l=t.strokeWidth,s=t.textOffset,f=t.textColor,c=t.linkColor,g=t.component,h=void 0===g?G:g,v=d(r),x=Q({data:e,skipAngle:i,offset:a,diagonalLength:o,straightLength:u,textOffset:s,linkColor:c,textColor:f}),R=x.transition,m=x.interpolateLink,y=x.interpolateTextAnchor,k=x.interpolateTextPosition,b=h;return p("g",{transform:"translate("+n[0]+","+n[1]+")",children:R((function(t,n){return A(b,{key:n.id,datum:n,label:v(n),style:M({},t,{thickness:l,path:m(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius,t.offset,t.diagonalLength,t.straightLength),textAnchor:y(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius),textPosition:k(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius,t.offset,t.diagonalLength,t.straightLength,t.textOffset)})})}))})},V=function(t,n,e,r){t.textBaseline="middle",t.font=e.labels.text.fontSize+"px "+e.labels.text.fontFamily,n.forEach((function(n){t.fillStyle=n.textColor,t.textAlign=f.canvas.align[n.textAnchor],t.fillText(""+n.label,n.x,n.y),t.beginPath(),t.strokeStyle=n.linkColor,t.lineWidth=r,n.points.forEach((function(n,e){0===e?t.moveTo(n.x,n.y):t.lineTo(n.x,n.y)})),t.stroke()}))},X=function(t){var n=t.data,e=t.skipAngle,r=void 0===e?0:e,i=t.offset,o=void 0===i?.5:i,u=t.diagonalLength,l=t.straightLength,s=t.computeExtraProps,d=void 0===s?function(){return{}}:s,f=v((function(){return n.filter((function(t){return Math.abs(a(t.arc.endAngle-t.arc.startAngle))>=r})).map((function(t){return M({},D(t.arc,o,u,l),{data:t})}))}),[n,r,o,u,l]);return v((function(){return f.map((function(t){return M({},d(t),t)}))}),[f,d])},Y=function(t){var n=t.data,e=t.skipAngle,r=t.offset,a=t.diagonalLength,o=t.straightLength,u=t.textOffset,l=void 0===u?0:u,s=t.label,f=t.linkColor,c=t.textColor,g=d(s),p=i(),h=R(f,p),v=R(c,p),A=x((function(t){var n,e={x:t.points[2].x,y:t.points[2].y};return"before"===t.side?(e.x-=l,n="end"):(e.x+=l,n="start"),M({},e,{label:g(t.data),linkColor:h(t.data),textAnchor:n,textColor:v(t.data)})}),[g,h,v,l]);return X({data:n,skipAngle:e,offset:r,diagonalLength:a,straightLength:o,computeExtraProps:A})},Z=G,$=["animated"],_=function(e){var r=e.animated,i=function(t,n){if(null==t)return{};var e,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)e=a[r],n.indexOf(e)>=0||(i[e]=t[e]);return i}(e,$);return p(t.path,M({d:n([r.radius,r.startAngle,r.endAngle],(function(t,n,e){return function(t,n,e){var r=Math.min(n,e),i=Math.max(n,e),a=o(u(i),t),l=o(u(r),t);if(i-r>=360){var s=o(u(r+180),t);return["M "+a.x+" "+a.y,O(t,1,1,s.x,s.y),"M "+a.x+" "+a.y,O(t,1,0,s.x,s.y)].join(" ")}var d=i-r<=180?0:1;return["M "+a.x+" "+a.y,O(t,d,0,l.x,l.y)].join(" ")}(t,n,e)}))},i))},tt=function(n){var e=n.datum,r=n.style,i=n.onClick,a=n.onMouseEnter,o=n.onMouseMove,u=n.onMouseLeave,l=x((function(t){return null==i?void 0:i(e,t)}),[i,e]),s=x((function(t){return null==a?void 0:a(e,t)}),[a,e]),d=x((function(t){return null==o?void 0:o(e,t)}),[o,e]),f=x((function(t){return null==u?void 0:u(e,t)}),[u,e]);return p(t.path,{d:r.path,opacity:r.opacity,fill:e.fill||r.color,stroke:r.borderColor,strokeWidth:r.borderWidth,onClick:i?l:void 0,onMouseEnter:a?s:void 0,onMouseMove:o?d:void 0,onMouseLeave:u?f:void 0})},nt=function(t,e,r,i,a){return n([t,e,r,i],(function(t,n,e,r){return a({startAngle:t,endAngle:n,innerRadius:Math.max(0,e),outerRadius:Math.max(0,r)})}))},et=function(t,n,r){void 0===n&&(n="innerRadius");var i=s(),a=i.animate,o=i.config,u=I(n,r);return{transition:e(t,{keys:function(t){return t.id},initial:u.update,from:u.enter,enter:u.update,update:u.update,leave:u.leave,config:o,immediate:!a}),interpolate:nt}},rt=function(t){var n=t.center,e=t.data,r=t.arcGenerator,a=t.borderWidth,o=t.borderColor,u=t.onClick,l=t.onMouseEnter,s=t.onMouseMove,d=t.onMouseLeave,f=t.transitionMode,c=t.component,g=void 0===c?tt:c,h=i(),v=R(o,h),x=et(e,f,{enter:function(t){return{opacity:0,color:t.color,borderColor:v(t)}},update:function(t){return{opacity:1,color:t.color,borderColor:v(t)}},leave:function(t){return{opacity:0,color:t.color,borderColor:v(t)}}}),m=x.transition,y=x.interpolate,k=g;return p("g",{transform:"translate("+n[0]+","+n[1]+")",children:m((function(t,n){return A(k,{key:n.id,datum:n,style:M({},t,{borderWidth:a,path:y(t.startAngle,t.endAngle,t.innerRadius,t.outerRadius,r)}),onClick:u,onMouseEnter:l,onMouseMove:s,onMouseLeave:d})}))})},it=function(t,n,e,r,i,a){void 0===a&&(a=!0);var l=[],s=o(u(r),e);l.push([s.x,s.y]);var d=o(u(i),e);l.push([d.x,d.y]);for(var f=Math.round(Math.min(r,i));f<=Math.round(Math.max(r,i));f++)if(f%90==0){var c=o(u(f),e);l.push([c.x,c.y])}l=l.map((function(e){var r=e[0],i=e[1];return[t+r,n+i]})),a&&l.push([t,n]);var g=l.map((function(t){return t[0]})),p=l.map((function(t){return t[1]})),h=Math.min.apply(Math,g),v=Math.max.apply(Math,g),A=Math.min.apply(Math,p);return{points:l,x:h,y:A,width:v-h,height:Math.max.apply(Math,p)-A}},at=function(t,n,e,r,i,a){var o=c(i,a,t,n);return o<e&&o>r},ot=function(t,n,e,r,i,a,o){if(at(t,n,e,r,a,o)){var u=g(a,o,t,n);return i.find((function(t){var n=t.startAngle,e=t.endAngle;return u>=n&&u<e}))}},ut=function(t,n){var e=s(),i=e.animate,a=e.config,o=r({startAngle:t.arc.startAngle,endAngle:t.arc.endAngle,innerRadius:t.arc.innerRadius,outerRadius:t.arc.outerRadius,config:a,immediate:!i});return M({},o,{path:nt(o.startAngle,o.endAngle,o.innerRadius,o.outerRadius,n)})},lt=function(t){var n=void 0===t?{}:t,e=n.cornerRadius,r=void 0===e?0:e,i=n.padAngle,a=void 0===i?0:i;return v((function(){return y().innerRadius((function(t){return t.innerRadius})).outerRadius((function(t){return t.outerRadius})).cornerRadius(r).padAngle(a)}),[r,a])};export{F as ArcLabelComponent,B as ArcLabelsLayer,_ as ArcLine,Z as ArcLinkLabelComponent,U as ArcLinkLabelsLayer,tt as ArcShape,rt as ArcsLayer,E as arcTransitionModeById,P as arcTransitionModes,it as computeArcBoundingBox,T as computeArcCenter,D as computeArcLink,q as computeArcLinkTextAnchor,w as drawCanvasArcLabels,V as drawCanvasArcLinkLabels,ot as findArcUnderCursor,nt as interpolateArc,j as interpolateArcCenter,at as isCursorInRing,ut as useAnimatedArc,S as useArcCenters,W as useArcCentersTransition,lt as useArcGenerator,z as useArcLabels,Y as useArcLinkLabels,Q as useArcLinkLabelsTransition,X as useArcLinks,I as useArcTransitionMode,et as useArcsTransition}; | ||
//# sourceMappingURL=nivo-arcs.es.js.map |
@@ -7,3 +7,3 @@ /// <reference types="react" /> | ||
import { ArcLabelProps } from './ArcLabel'; | ||
export declare type ArcLabelComponent<Datum extends DatumWithArcAndColor> = (props: ArcLabelProps<Datum>) => JSX.Element; | ||
export type ArcLabelComponent<Datum extends DatumWithArcAndColor> = (props: ArcLabelProps<Datum>) => JSX.Element; | ||
interface ArcLabelsLayerProps<Datum extends DatumWithArcAndColor> { | ||
@@ -10,0 +10,0 @@ center: [number, number]; |
/// <reference types="react" /> | ||
export declare const ArcLabelComponent: <Datum extends import("..").DatumWithArcAndColor>({ label, style, }: import("./ArcLabel").ArcLabelProps<Datum>) => JSX.Element; | ||
export declare const ArcLabelComponent: <Datum extends import("../types").DatumWithArcAndColor>({ label, style, }: import("./ArcLabel").ArcLabelProps<Datum>) => JSX.Element; | ||
export * from './ArcLabelsLayer'; | ||
@@ -4,0 +4,0 @@ export * from './canvas'; |
@@ -5,3 +5,3 @@ /// <reference types="react" /> | ||
import { ArcLinkLabelProps } from './ArcLinkLabel'; | ||
export declare type ArcLinkLabelComponent<Datum extends DatumWithArcAndColor> = (props: ArcLinkLabelProps<Datum>) => JSX.Element; | ||
export type ArcLinkLabelComponent<Datum extends DatumWithArcAndColor> = (props: ArcLinkLabelProps<Datum>) => JSX.Element; | ||
interface ArcLinkLabelsLayerProps<Datum extends DatumWithArcAndColor> { | ||
@@ -8,0 +8,0 @@ center: [number, number]; |
/// <reference types="react" /> | ||
export declare const ArcLinkLabelComponent: <Datum extends import("..").DatumWithArcAndColor>({ label, style, }: import("./ArcLinkLabel").ArcLinkLabelProps<Datum>) => JSX.Element; | ||
export declare const ArcLinkLabelComponent: <Datum extends import("../types").DatumWithArcAndColor>({ label, style, }: import("./ArcLinkLabel").ArcLinkLabelProps<Datum>) => JSX.Element; | ||
export * from './ArcLinkLabelsLayer'; | ||
@@ -4,0 +4,0 @@ export * from './canvas'; |
import { SpringValue } from '@react-spring/web'; | ||
import { InheritedColorConfig } from '@nivo/colors'; | ||
import { DatumWithArcAndColor } from '../types'; | ||
declare type AnimatedProps = { | ||
type AnimatedProps = { | ||
startAngle: number; | ||
@@ -6,0 +6,0 @@ endAngle: number; |
/// <reference types="react" /> | ||
import { animated, AnimatedProps } from '@react-spring/web'; | ||
import { ExtractProps } from '@nivo/core'; | ||
declare type ArcLineProps = { | ||
type ArcLineProps = { | ||
animated: AnimatedProps<{ | ||
@@ -6,0 +6,0 @@ radius: number; |
@@ -1,5 +0,5 @@ | ||
import * as React from 'react'; | ||
import { MouseEvent } from 'react'; | ||
import { SpringValue, Interpolation } from '@react-spring/web'; | ||
import { DatumWithArcAndColor } from './types'; | ||
export declare type ArcMouseHandler<Datum extends DatumWithArcAndColor> = (datum: Datum, event: React.MouseEvent<SVGPathElement>) => void; | ||
export type ArcMouseHandler<Datum extends DatumWithArcAndColor> = (datum: Datum, event: MouseEvent<SVGPathElement>) => void; | ||
export interface ArcShapeProps<Datum extends DatumWithArcAndColor> { | ||
@@ -6,0 +6,0 @@ datum: Datum; |
@@ -6,3 +6,3 @@ /// <reference types="react" /> | ||
import { ArcMouseHandler, ArcShapeProps } from './ArcShape'; | ||
export declare type ArcComponent<Datum extends DatumWithArcAndColor> = (props: ArcShapeProps<Datum>) => JSX.Element; | ||
export type ArcComponent<Datum extends DatumWithArcAndColor> = (props: ArcShapeProps<Datum>) => JSX.Element; | ||
interface ArcsLayerProps<Datum extends DatumWithArcAndColor> { | ||
@@ -9,0 +9,0 @@ center: [number, number]; |
@@ -8,3 +8,3 @@ import { Arc, DatumWithArc } from './types'; | ||
export declare const arcTransitionModes: readonly ["startAngle", "middleAngle", "endAngle", "innerRadius", "centerRadius", "outerRadius", "pushIn", "pushOut"]; | ||
export declare type ArcTransitionMode = typeof arcTransitionModes[number]; | ||
export type ArcTransitionMode = (typeof arcTransitionModes)[number]; | ||
export declare const arcTransitionModeById: Record<ArcTransitionMode, ArcTransitionModeConfig>; | ||
@@ -11,0 +11,0 @@ export interface TransitionExtra<Datum extends DatumWithArc, ExtraProps> { |
@@ -20,3 +20,3 @@ import { Arc as D3Arc } from 'd3-shape'; | ||
} | ||
export declare type ArcGenerator = D3Arc<any, Arc>; | ||
export type ArcGenerator = D3Arc<any, Arc>; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@nivo/arcs", | ||
"version": "0.81.0", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Raphaël Benitte", | ||
"url": "https://github.com/plouc" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/plouc/nivo.git", | ||
"directory": "packages/arcs" | ||
}, | ||
"keywords": [ | ||
"nivo", | ||
"dataviz", | ||
"react", | ||
"d3", | ||
"arcs" | ||
], | ||
"main": "./dist/nivo-arcs.cjs.js", | ||
"module": "./dist/nivo-arcs.es.js", | ||
"typings": "./dist/types/index.d.ts", | ||
"files": [ | ||
"README.md", | ||
"LICENSE.md", | ||
"dist/", | ||
"!dist/tsconfig.tsbuildinfo" | ||
], | ||
"dependencies": { | ||
"@nivo/colors": "0.81.0", | ||
"@react-spring/web": "9.4.5 || ^9.7.2", | ||
"d3-shape": "^1.3.5" | ||
}, | ||
"devDependencies": { | ||
"@nivo/core": "0.81.0", | ||
"@types/d3-shape": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@nivo/core": "0.81.0", | ||
"react": ">= 16.14.0 < 19.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "56db9cb7738f406a21085c11ab28716044fceb5b" | ||
"name": "@nivo/arcs", | ||
"version": "0.82.0", | ||
"license": "MIT", | ||
"author": { | ||
"name": "Raphaël Benitte", | ||
"url": "https://github.com/plouc" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/plouc/nivo.git", | ||
"directory": "packages/arcs" | ||
}, | ||
"keywords": [ | ||
"nivo", | ||
"dataviz", | ||
"react", | ||
"d3", | ||
"arcs" | ||
], | ||
"main": "./dist/nivo-arcs.cjs.js", | ||
"module": "./dist/nivo-arcs.es.js", | ||
"types": "./dist/types/index.d.ts", | ||
"files": [ | ||
"README.md", | ||
"LICENSE.md", | ||
"dist/", | ||
"!dist/tsconfig.tsbuildinfo" | ||
], | ||
"dependencies": { | ||
"@nivo/colors": "0.82.0", | ||
"@react-spring/web": "9.4.5 || ^9.7.2", | ||
"d3-shape": "^1.3.5" | ||
}, | ||
"devDependencies": { | ||
"@nivo/core": "0.82.0", | ||
"@types/d3-shape": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"@nivo/core": "workspace:*", | ||
"react": ">= 16.14.0 < 19.0.0" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "579fc012df24e154a387243559165e344b6523da" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
432695
68
1550
+ Added@nivo/colors@0.82.0(transitive)
+ Added@types/d3-color@2.0.6(transitive)
+ Added@types/d3-scale@3.3.5(transitive)
+ Added@types/d3-scale-chromatic@2.0.4(transitive)
+ Added@types/d3-time@2.1.4(transitive)
+ Added@types/prop-types@15.7.13(transitive)
+ Addedd3-format@2.0.0(transitive)
- Removed@nivo/colors@0.81.0(transitive)
- Removed@nivo/core@0.81.0(transitive)
- Removed@nivo/recompose@0.81.0(transitive)
- Removed@nivo/tooltip@0.81.0(transitive)
- Removedd3-format@1.4.5(transitive)
- Removedreact-lifecycles-compat@3.0.4(transitive)
Updated@nivo/colors@0.82.0