@aiconstructions/graficos 0.0.0-stage → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ALTERACOES.md +53 -0
- package/LICENSE-BKLIT +21 -0
- package/LICENSE-visx-pattern +21 -0
- package/README.md +188 -2
- package/dist/aic/cores.js +83 -0
- package/dist/aic/index.js +22 -0
- package/dist/aic/interacao.js +55 -0
- package/dist/charts/animation.js +55 -0
- package/dist/charts/arc-geometry.js +58 -0
- package/dist/charts/arc-path.js +15 -0
- package/dist/charts/area-chart-loading.js +89 -0
- package/dist/charts/area-chart.js +149 -0
- package/dist/charts/area-gradient-defs.js +90 -0
- package/dist/charts/area-value-label-layout.js +70 -0
- package/dist/charts/area-value-labels.js +211 -0
- package/dist/charts/area.js +272 -0
- package/dist/charts/background.js +198 -0
- package/dist/charts/band-config.js +82 -0
- package/dist/charts/band-geometry.js +186 -0
- package/dist/charts/band.js +346 -0
- package/dist/charts/bar-chart-loading.js +27 -0
- package/dist/charts/bar-chart.js +545 -0
- package/dist/charts/bar-depth-geometry.js +18 -0
- package/dist/charts/bar-depth.js +608 -0
- package/dist/charts/bar-lollipop.js +278 -0
- package/dist/charts/bar-squares-layout.js +66 -0
- package/dist/charts/bar-squares.js +467 -0
- package/dist/charts/bar-value-label-layout.js +42 -0
- package/dist/charts/bar-x-axis.js +133 -0
- package/dist/charts/bar-y-axis.js +116 -0
- package/dist/charts/bar.js +457 -0
- package/dist/charts/bollinger.js +49 -0
- package/dist/charts/candlestick-chart.js +370 -0
- package/dist/charts/candlestick.js +368 -0
- package/dist/charts/chart-brush-handle.js +91 -0
- package/dist/charts/chart-brush-layout.js +91 -0
- package/dist/charts/chart-brush-selection-overlay.js +87 -0
- package/dist/charts/chart-brush-state.js +253 -0
- package/dist/charts/chart-brush-track-overlay.js +103 -0
- package/dist/charts/chart-brush.js +517 -0
- package/dist/charts/chart-center-typography.js +8 -0
- package/dist/charts/chart-child-passthrough.js +119 -0
- package/dist/charts/chart-config-context.js +56 -0
- package/dist/charts/chart-context.js +337 -0
- package/dist/charts/chart-crosshair.js +262 -0
- package/dist/charts/chart-data-override.js +186 -0
- package/dist/charts/chart-defs.js +56 -0
- package/dist/charts/chart-formatters.js +77 -0
- package/dist/charts/chart-legend-hover.js +27 -0
- package/dist/charts/chart-legend.js +163 -0
- package/dist/charts/chart-loading-label.js +52 -0
- package/dist/charts/chart-parent-size.js +138 -0
- package/dist/charts/chart-phase.js +29 -0
- package/dist/charts/chart-reveal-clip.js +62 -0
- package/dist/charts/chart-scale.js +19 -0
- package/dist/charts/chart-stat-flow.js +72 -0
- package/dist/charts/choropleth/choropleth-background.js +29 -0
- package/dist/charts/choropleth/choropleth-camera.js +379 -0
- package/dist/charts/choropleth/choropleth-chart.js +644 -0
- package/dist/charts/choropleth/choropleth-context.js +152 -0
- package/dist/charts/choropleth/choropleth-dot-grid.js +293 -0
- package/dist/charts/choropleth/choropleth-feature.js +291 -0
- package/dist/charts/choropleth/choropleth-graticule.js +40 -0
- package/dist/charts/choropleth/choropleth-marker.js +222 -0
- package/dist/charts/choropleth/choropleth-projection.js +37 -0
- package/dist/charts/choropleth/choropleth-tooltip.js +82 -0
- package/dist/charts/choropleth/choropleth-zoom-matrix.js +150 -0
- package/dist/charts/choropleth/index.js +44 -0
- package/dist/charts/choropleth/use-choropleth-zoom-state.js +636 -0
- package/dist/charts/composed-chart.js +346 -0
- package/dist/charts/crosshair-store.js +49 -0
- package/dist/charts/dash-tail-stroke.js +58 -0
- package/dist/charts/date-pill-store.js +50 -0
- package/dist/charts/date-ranges.js +131 -0
- package/dist/charts/deadline.js +295 -0
- package/dist/charts/decimate-time-series.js +112 -0
- package/dist/charts/fade-edges.js +171 -0
- package/dist/charts/fast-path.js +78 -0
- package/dist/charts/filter-data-by-x-domain.js +45 -0
- package/dist/charts/funnel-chart.js +773 -0
- package/dist/charts/gauge-arc-layers.js +479 -0
- package/dist/charts/gauge-dial.js +329 -0
- package/dist/charts/gauge-label-layout.js +148 -0
- package/dist/charts/gauge.js +946 -0
- package/dist/charts/generate-chart-skeleton-data.js +27 -0
- package/dist/charts/gradients.js +158 -0
- package/dist/charts/grid-lines.js +114 -0
- package/dist/charts/grid.js +225 -0
- package/dist/charts/heatmap/generate-heatmap-skeleton-data.js +13 -0
- package/dist/charts/heatmap/heatmap-animation.js +128 -0
- package/dist/charts/heatmap/heatmap-cells.js +519 -0
- package/dist/charts/heatmap/heatmap-chart-loading.js +44 -0
- package/dist/charts/heatmap/heatmap-chart.js +548 -0
- package/dist/charts/heatmap/heatmap-colors.js +127 -0
- package/dist/charts/heatmap/heatmap-context.js +107 -0
- package/dist/charts/heatmap/heatmap-legend-gradient.js +97 -0
- package/dist/charts/heatmap/heatmap-legend-swatch.js +76 -0
- package/dist/charts/heatmap/heatmap-legend.js +165 -0
- package/dist/charts/heatmap/heatmap-pattern-defs.js +37 -0
- package/dist/charts/heatmap/heatmap-rect-cells.js +39 -0
- package/dist/charts/heatmap/heatmap-resolve-separator.js +84 -0
- package/dist/charts/heatmap/heatmap-separator.js +168 -0
- package/dist/charts/heatmap/heatmap-tooltip.js +73 -0
- package/dist/charts/heatmap/heatmap-utils.js +633 -0
- package/dist/charts/heatmap/heatmap-x-axis.js +79 -0
- package/dist/charts/heatmap/heatmap-y-axis.js +72 -0
- package/dist/charts/heatmap/index.js +208 -0
- package/dist/charts/highlight-segment-bounds.js +34 -0
- package/dist/charts/highlight-segment.js +119 -0
- package/dist/charts/index.js +944 -0
- package/dist/charts/indicator-fade.js +44 -0
- package/dist/charts/legend/index.js +22 -0
- package/dist/charts/legend/legend-context.js +47 -0
- package/dist/charts/legend/legend-item.js +30 -0
- package/dist/charts/legend/legend-label.js +14 -0
- package/dist/charts/legend/legend-marker.js +18 -0
- package/dist/charts/legend/legend-progress.js +39 -0
- package/dist/charts/legend/legend-value.js +31 -0
- package/dist/charts/legend/legend.js +69 -0
- package/dist/charts/line-backdrop.js +129 -0
- package/dist/charts/line-chart-loading.js +85 -0
- package/dist/charts/line-chart.js +182 -0
- package/dist/charts/line-loading-pulse.js +185 -0
- package/dist/charts/line-loading-timing.js +12 -0
- package/dist/charts/line-path.js +58 -0
- package/dist/charts/line-series-terminal-marker.js +75 -0
- package/dist/charts/line.js +499 -0
- package/dist/charts/live-line-chart.js +494 -0
- package/dist/charts/live-line.js +277 -0
- package/dist/charts/live-x-axis.js +116 -0
- package/dist/charts/live-y-axis.js +164 -0
- package/dist/charts/loading-sweep.js +344 -0
- package/dist/charts/local-point.js +56 -0
- package/dist/charts/markers/chart-markers.js +149 -0
- package/dist/charts/markers/index.js +14 -0
- package/dist/charts/markers/marker-group.js +411 -0
- package/dist/charts/motion-utils.js +29 -0
- package/dist/charts/notch-gauge-shared.js +146 -0
- package/dist/charts/particle-line.js +1340 -0
- package/dist/charts/path-stroke-utils.js +51 -0
- package/dist/charts/pattern-area.js +127 -0
- package/dist/charts/pattern-preset.js +287 -0
- package/dist/charts/pattern-tile.js +31 -0
- package/dist/charts/patterns/circles.js +62 -0
- package/dist/charts/patterns/constants.js +9 -0
- package/dist/charts/patterns/hexagons.js +38 -0
- package/dist/charts/patterns/index.js +16 -0
- package/dist/charts/patterns/lines.js +65 -0
- package/dist/charts/patterns/path.js +37 -0
- package/dist/charts/patterns/pattern.js +16 -0
- package/dist/charts/patterns/waves.js +40 -0
- package/dist/charts/pie-center-shell.js +127 -0
- package/dist/charts/pie-center.js +87 -0
- package/dist/charts/pie-chart.js +377 -0
- package/dist/charts/pie-context.js +116 -0
- package/dist/charts/pie-slice.js +394 -0
- package/dist/charts/pie-ticks.js +332 -0
- package/dist/charts/profit-loss-legend-hover.js +18 -0
- package/dist/charts/profit-loss-legend.js +53 -0
- package/dist/charts/profit-loss-line.js +162 -0
- package/dist/charts/profit-loss-segments.js +88 -0
- package/dist/charts/projection-config.js +90 -0
- package/dist/charts/projection-line-end-marker.js +50 -0
- package/dist/charts/projection-line.js +466 -0
- package/dist/charts/projection-utils.js +303 -0
- package/dist/charts/radar-area.js +192 -0
- package/dist/charts/radar-axis.js +41 -0
- package/dist/charts/radar-chart.js +184 -0
- package/dist/charts/radar-context.js +104 -0
- package/dist/charts/radar-grid.js +121 -0
- package/dist/charts/radar-labels.js +62 -0
- package/dist/charts/radial-area.js +498 -0
- package/dist/charts/radial-axis.js +652 -0
- package/dist/charts/radial-bar.js +316 -0
- package/dist/charts/radial-center.js +67 -0
- package/dist/charts/radial-chart.js +740 -0
- package/dist/charts/radial-dot-bar-layout.js +68 -0
- package/dist/charts/radial-dot-bar.js +387 -0
- package/dist/charts/radial-geometry.js +114 -0
- package/dist/charts/radial-legend.js +66 -0
- package/dist/charts/radial-line.js +280 -0
- package/dist/charts/radial-ring-bar.js +255 -0
- package/dist/charts/radial-scrubber.js +120 -0
- package/dist/charts/radial-series-color.js +10 -0
- package/dist/charts/reference-area-config.js +43 -0
- package/dist/charts/reference-area-geometry.js +76 -0
- package/dist/charts/reference-area-registration-context.js +10 -0
- package/dist/charts/reference-area.js +241 -0
- package/dist/charts/responsive-chart-label-count.js +18 -0
- package/dist/charts/ring-center.js +78 -0
- package/dist/charts/ring-chart.js +362 -0
- package/dist/charts/ring-context.js +122 -0
- package/dist/charts/ring-grid.js +175 -0
- package/dist/charts/ring-labels.js +109 -0
- package/dist/charts/ring.js +237 -0
- package/dist/charts/sankey/index.js +22 -0
- package/dist/charts/sankey/sankey-chart.js +199 -0
- package/dist/charts/sankey/sankey-context.js +32 -0
- package/dist/charts/sankey/sankey-link.js +232 -0
- package/dist/charts/sankey/sankey-node.js +348 -0
- package/dist/charts/sankey/sankey-tooltip.js +94 -0
- package/dist/charts/scatter-chart-shell.js +279 -0
- package/dist/charts/scatter-chart.js +150 -0
- package/dist/charts/scatter-jitter.js +86 -0
- package/dist/charts/scatter-svg.js +17 -0
- package/dist/charts/scatter.js +92 -0
- package/dist/charts/segment.js +107 -0
- package/dist/charts/series-bar-layout.js +42 -0
- package/dist/charts/series-bar.js +241 -0
- package/dist/charts/series-dash-tail-overlay.js +53 -0
- package/dist/charts/series-highlight-layer.js +43 -0
- package/dist/charts/series-hover-dim.js +32 -0
- package/dist/charts/series-markers.js +239 -0
- package/dist/charts/series-path-utils.js +185 -0
- package/dist/charts/series-point-marker.js +150 -0
- package/dist/charts/sparkline-geometry.js +197 -0
- package/dist/charts/sparkline.js +910 -0
- package/dist/charts/static-chart-preview-context.js +16 -0
- package/dist/charts/sunburst-breadcrumb.js +33 -0
- package/dist/charts/sunburst-center.js +37 -0
- package/dist/charts/sunburst-chart.js +408 -0
- package/dist/charts/sunburst-context.js +140 -0
- package/dist/charts/sunburst-data.js +0 -0
- package/dist/charts/sunburst-hint.js +42 -0
- package/dist/charts/sunburst-labels.js +130 -0
- package/dist/charts/sunburst-segment.js +144 -0
- package/dist/charts/sunburst.js +419 -0
- package/dist/charts/time-series-chart-shell.js +688 -0
- package/dist/charts/tooltip/chart-tooltip.js +516 -0
- package/dist/charts/tooltip/cursor-tooltip-box.js +183 -0
- package/dist/charts/tooltip/date-ticker.js +376 -0
- package/dist/charts/tooltip/index.js +32 -0
- package/dist/charts/tooltip/liquid-glass.js +142 -0
- package/dist/charts/tooltip/tooltip-box.js +502 -0
- package/dist/charts/tooltip/tooltip-content.js +59 -0
- package/dist/charts/tooltip/tooltip-dot.js +170 -0
- package/dist/charts/tooltip/tooltip-indicator.js +175 -0
- package/dist/charts/tooltip/use-delayed-tooltip-data.js +41 -0
- package/dist/charts/tooltip/use-velocity-stretch.js +52 -0
- package/dist/charts/trend-line-utils.js +64 -0
- package/dist/charts/trend-line.js +318 -0
- package/dist/charts/use-animated-band.js +175 -0
- package/dist/charts/use-animated-series-path.js +208 -0
- package/dist/charts/use-animated-y-domains.js +192 -0
- package/dist/charts/use-category-slots.js +29 -0
- package/dist/charts/use-chart-interaction.js +296 -0
- package/dist/charts/use-chart-phase-orchestrator.js +183 -0
- package/dist/charts/use-enter-complete.js +18 -0
- package/dist/charts/use-grid-shimmer.js +88 -0
- package/dist/charts/use-highlight-segment.js +65 -0
- package/dist/charts/use-mount-progress.js +23 -0
- package/dist/charts/use-scatter-chart-interaction.js +364 -0
- package/dist/charts/use-scheduled-tooltip.js +84 -0
- package/dist/charts/visx-pattern.js +30 -0
- package/dist/charts/weekends.js +174 -0
- package/dist/charts/x-axis-hover.js +46 -0
- package/dist/charts/x-axis.js +523 -0
- package/dist/charts/y-axis-scales.js +71 -0
- package/dist/charts/y-axis-ticks.js +22 -0
- package/dist/charts/y-axis.js +233 -0
- package/dist/charts/y-domain-utils.js +189 -0
- package/dist/index.d.ts +7346 -0
- package/dist/index.js +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/shimmering-text.js +54 -0
- package/package.json +78 -4
- package/tema.css +202 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo
|
|
7
|
+
} from "react";
|
|
8
|
+
const pieCssVars = {
|
|
9
|
+
background: "var(--chart-background)",
|
|
10
|
+
foreground: "var(--chart-foreground)",
|
|
11
|
+
foregroundMuted: "var(--chart-foreground-muted)",
|
|
12
|
+
label: "var(--chart-label)",
|
|
13
|
+
// Default slice colors from chart palette
|
|
14
|
+
slice1: "var(--chart-1)",
|
|
15
|
+
slice2: "var(--chart-2)",
|
|
16
|
+
slice3: "var(--chart-3)",
|
|
17
|
+
slice4: "var(--chart-4)",
|
|
18
|
+
slice5: "var(--chart-5)"
|
|
19
|
+
};
|
|
20
|
+
const defaultPieColors = [
|
|
21
|
+
pieCssVars.slice1,
|
|
22
|
+
pieCssVars.slice2,
|
|
23
|
+
pieCssVars.slice3,
|
|
24
|
+
pieCssVars.slice4,
|
|
25
|
+
pieCssVars.slice5
|
|
26
|
+
];
|
|
27
|
+
const PieStableContext = createContext(null);
|
|
28
|
+
const PieHoverContext = createContext(null);
|
|
29
|
+
function PieProvider({
|
|
30
|
+
children,
|
|
31
|
+
value
|
|
32
|
+
}) {
|
|
33
|
+
const stable = useMemo(
|
|
34
|
+
() => ({
|
|
35
|
+
data: value.data,
|
|
36
|
+
arcs: value.arcs,
|
|
37
|
+
size: value.size,
|
|
38
|
+
center: value.center,
|
|
39
|
+
outerRadius: value.outerRadius,
|
|
40
|
+
innerRadius: value.innerRadius,
|
|
41
|
+
padAngle: value.padAngle,
|
|
42
|
+
cornerRadius: value.cornerRadius,
|
|
43
|
+
hoverOffset: value.hoverOffset,
|
|
44
|
+
animationKey: value.animationKey,
|
|
45
|
+
isLoaded: value.isLoaded,
|
|
46
|
+
enterTransition: value.enterTransition,
|
|
47
|
+
enterStaggerScale: value.enterStaggerScale,
|
|
48
|
+
containerRef: value.containerRef,
|
|
49
|
+
totalValue: value.totalValue,
|
|
50
|
+
getColor: value.getColor,
|
|
51
|
+
getFill: value.getFill,
|
|
52
|
+
geometryScrubbing: value.geometryScrubbing,
|
|
53
|
+
scrubSlicePaths: value.scrubSlicePaths
|
|
54
|
+
}),
|
|
55
|
+
[
|
|
56
|
+
value.data,
|
|
57
|
+
value.arcs,
|
|
58
|
+
value.size,
|
|
59
|
+
value.center,
|
|
60
|
+
value.outerRadius,
|
|
61
|
+
value.innerRadius,
|
|
62
|
+
value.padAngle,
|
|
63
|
+
value.cornerRadius,
|
|
64
|
+
value.hoverOffset,
|
|
65
|
+
value.animationKey,
|
|
66
|
+
value.isLoaded,
|
|
67
|
+
value.enterTransition,
|
|
68
|
+
value.enterStaggerScale,
|
|
69
|
+
value.containerRef,
|
|
70
|
+
value.totalValue,
|
|
71
|
+
value.getColor,
|
|
72
|
+
value.getFill,
|
|
73
|
+
value.geometryScrubbing,
|
|
74
|
+
value.scrubSlicePaths
|
|
75
|
+
]
|
|
76
|
+
);
|
|
77
|
+
const hover = useMemo(
|
|
78
|
+
() => ({
|
|
79
|
+
hoveredIndex: value.hoveredIndex,
|
|
80
|
+
setHoveredIndex: value.setHoveredIndex
|
|
81
|
+
}),
|
|
82
|
+
[value.hoveredIndex, value.setHoveredIndex]
|
|
83
|
+
);
|
|
84
|
+
return /* @__PURE__ */ jsx(PieStableContext.Provider, { value: stable, children: /* @__PURE__ */ jsx(PieHoverContext.Provider, { value: hover, children }) });
|
|
85
|
+
}
|
|
86
|
+
function usePieStable() {
|
|
87
|
+
const context = useContext(PieStableContext);
|
|
88
|
+
if (!context) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
"usePieStable must be used within a PieProvider. Make sure your component is wrapped in <PieChart>."
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return context;
|
|
94
|
+
}
|
|
95
|
+
function usePieHover() {
|
|
96
|
+
const context = useContext(PieHoverContext);
|
|
97
|
+
if (!context) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
"usePieHover must be used within a PieProvider. Make sure your component is wrapped in <PieChart>."
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
return context;
|
|
103
|
+
}
|
|
104
|
+
function usePie() {
|
|
105
|
+
return { ...usePieStable(), ...usePieHover() };
|
|
106
|
+
}
|
|
107
|
+
var pie_context_default = PieStableContext;
|
|
108
|
+
export {
|
|
109
|
+
PieProvider,
|
|
110
|
+
pie_context_default as default,
|
|
111
|
+
defaultPieColors,
|
|
112
|
+
pieCssVars,
|
|
113
|
+
usePie,
|
|
114
|
+
usePieHover,
|
|
115
|
+
usePieStable
|
|
116
|
+
};
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { m, useSpring, useTransform } from "motion/react";
|
|
4
|
+
import { memo, useEffect } from "react";
|
|
5
|
+
import { arcPath } from "./arc-path";
|
|
6
|
+
import { usePieHover, usePieStable } from "./pie-context";
|
|
7
|
+
import { estaEsmaecido, useInteracaoAic } from "../aic/interacao";
|
|
8
|
+
import { useEnterComplete } from "./use-enter-complete";
|
|
9
|
+
import { useMountProgress } from "./use-mount-progress";
|
|
10
|
+
function getSliceOffset(startAngle, endAngle, distance) {
|
|
11
|
+
const midAngle = (startAngle + endAngle) / 2;
|
|
12
|
+
return {
|
|
13
|
+
x: Math.sin(midAngle) * distance,
|
|
14
|
+
y: -Math.cos(midAngle) * distance
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function AnimatedSliceTranslate({
|
|
18
|
+
index,
|
|
19
|
+
innerRadius,
|
|
20
|
+
outerRadius,
|
|
21
|
+
startAngle,
|
|
22
|
+
endAngle,
|
|
23
|
+
cornerRadius,
|
|
24
|
+
padAngle,
|
|
25
|
+
fill,
|
|
26
|
+
color,
|
|
27
|
+
isHovered,
|
|
28
|
+
isFaded,
|
|
29
|
+
animationKey,
|
|
30
|
+
showGlow,
|
|
31
|
+
hoverOffset
|
|
32
|
+
}) {
|
|
33
|
+
const {
|
|
34
|
+
enterTransition,
|
|
35
|
+
enterStaggerScale,
|
|
36
|
+
animationKey: pieAnimationKey
|
|
37
|
+
} = usePieStable();
|
|
38
|
+
const animationDelay = (0.1 + index * 0.08) * enterStaggerScale;
|
|
39
|
+
const mountProgress = useMountProgress(
|
|
40
|
+
enterTransition,
|
|
41
|
+
animationDelay,
|
|
42
|
+
pieAnimationKey
|
|
43
|
+
);
|
|
44
|
+
const enterComplete = useEnterComplete(mountProgress);
|
|
45
|
+
const animatedPath = useTransform(mountProgress, (mount) => {
|
|
46
|
+
const currentEndAngle = startAngle + (endAngle - startAngle) * mount;
|
|
47
|
+
if (currentEndAngle <= startAngle + 0.01) {
|
|
48
|
+
return "";
|
|
49
|
+
}
|
|
50
|
+
return arcPath(
|
|
51
|
+
innerRadius,
|
|
52
|
+
outerRadius,
|
|
53
|
+
startAngle,
|
|
54
|
+
currentEndAngle,
|
|
55
|
+
cornerRadius,
|
|
56
|
+
padAngle
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
const offset = getSliceOffset(startAngle, endAngle, hoverOffset);
|
|
60
|
+
const glowColor = color;
|
|
61
|
+
const hitboxPath = arcPath(
|
|
62
|
+
innerRadius,
|
|
63
|
+
outerRadius,
|
|
64
|
+
startAngle,
|
|
65
|
+
endAngle,
|
|
66
|
+
cornerRadius,
|
|
67
|
+
padAngle
|
|
68
|
+
);
|
|
69
|
+
if (enterComplete) {
|
|
70
|
+
const shouldTranslate = isHovered;
|
|
71
|
+
return /* @__PURE__ */ jsx(
|
|
72
|
+
m.path,
|
|
73
|
+
{
|
|
74
|
+
animate: {
|
|
75
|
+
opacity: isFaded ? 0.4 : 1,
|
|
76
|
+
x: shouldTranslate ? offset.x : 0,
|
|
77
|
+
y: shouldTranslate ? offset.y : 0
|
|
78
|
+
},
|
|
79
|
+
d: hitboxPath,
|
|
80
|
+
fill,
|
|
81
|
+
initial: false,
|
|
82
|
+
pointerEvents: "none",
|
|
83
|
+
style: {
|
|
84
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${glowColor})` : "none"
|
|
85
|
+
},
|
|
86
|
+
transition: {
|
|
87
|
+
opacity: { duration: 0.15 },
|
|
88
|
+
x: { type: "spring", stiffness: 400, damping: 25 },
|
|
89
|
+
y: { type: "spring", stiffness: 400, damping: 25 }
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
return /* @__PURE__ */ jsx(
|
|
95
|
+
m.path,
|
|
96
|
+
{
|
|
97
|
+
animate: {
|
|
98
|
+
opacity: isFaded ? 0.4 : 1,
|
|
99
|
+
x: isHovered ? offset.x : 0,
|
|
100
|
+
y: isHovered ? offset.y : 0
|
|
101
|
+
},
|
|
102
|
+
d: animatedPath,
|
|
103
|
+
fill,
|
|
104
|
+
initial: false,
|
|
105
|
+
pointerEvents: "none",
|
|
106
|
+
style: {
|
|
107
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${glowColor})` : "none"
|
|
108
|
+
},
|
|
109
|
+
transition: {
|
|
110
|
+
opacity: { duration: 0.15 },
|
|
111
|
+
x: { type: "spring", stiffness: 400, damping: 25 },
|
|
112
|
+
y: { type: "spring", stiffness: 400, damping: 25 }
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
`slice-${animationKey}-${index}`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function AnimatedSliceGrow({
|
|
119
|
+
index,
|
|
120
|
+
innerRadius,
|
|
121
|
+
outerRadius,
|
|
122
|
+
startAngle,
|
|
123
|
+
endAngle,
|
|
124
|
+
cornerRadius,
|
|
125
|
+
padAngle,
|
|
126
|
+
fill,
|
|
127
|
+
color,
|
|
128
|
+
isHovered,
|
|
129
|
+
isFaded,
|
|
130
|
+
animationKey,
|
|
131
|
+
showGlow,
|
|
132
|
+
hoverOffset
|
|
133
|
+
}) {
|
|
134
|
+
const {
|
|
135
|
+
enterTransition,
|
|
136
|
+
enterStaggerScale,
|
|
137
|
+
animationKey: pieAnimationKey
|
|
138
|
+
} = usePieStable();
|
|
139
|
+
const animationDelay = (0.1 + index * 0.08) * enterStaggerScale;
|
|
140
|
+
const mountProgress = useMountProgress(
|
|
141
|
+
enterTransition,
|
|
142
|
+
animationDelay,
|
|
143
|
+
pieAnimationKey
|
|
144
|
+
);
|
|
145
|
+
const enterComplete = useEnterComplete(mountProgress);
|
|
146
|
+
const growSpring = useSpring(outerRadius, {
|
|
147
|
+
stiffness: 400,
|
|
148
|
+
damping: 25
|
|
149
|
+
});
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
growSpring.set(isHovered ? outerRadius + hoverOffset : outerRadius);
|
|
152
|
+
}, [isHovered, hoverOffset, outerRadius, growSpring]);
|
|
153
|
+
const animatedPath = useTransform(
|
|
154
|
+
[mountProgress, growSpring],
|
|
155
|
+
([mount, currentOuterRadius]) => {
|
|
156
|
+
const currentEndAngle = startAngle + (endAngle - startAngle) * mount;
|
|
157
|
+
if (currentEndAngle <= startAngle + 0.01) {
|
|
158
|
+
return "";
|
|
159
|
+
}
|
|
160
|
+
return arcPath(
|
|
161
|
+
innerRadius,
|
|
162
|
+
currentOuterRadius,
|
|
163
|
+
startAngle,
|
|
164
|
+
currentEndAngle,
|
|
165
|
+
cornerRadius,
|
|
166
|
+
padAngle
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
);
|
|
170
|
+
const glowColor = color;
|
|
171
|
+
const grownOuterRadius = isHovered ? outerRadius + hoverOffset : outerRadius;
|
|
172
|
+
const grownPath = arcPath(
|
|
173
|
+
innerRadius,
|
|
174
|
+
grownOuterRadius,
|
|
175
|
+
startAngle,
|
|
176
|
+
endAngle,
|
|
177
|
+
cornerRadius,
|
|
178
|
+
padAngle
|
|
179
|
+
);
|
|
180
|
+
if (enterComplete) {
|
|
181
|
+
return /* @__PURE__ */ jsx(
|
|
182
|
+
m.path,
|
|
183
|
+
{
|
|
184
|
+
animate: {
|
|
185
|
+
opacity: isFaded ? 0.4 : 1,
|
|
186
|
+
d: grownPath
|
|
187
|
+
},
|
|
188
|
+
d: grownPath,
|
|
189
|
+
fill,
|
|
190
|
+
initial: false,
|
|
191
|
+
pointerEvents: "none",
|
|
192
|
+
style: {
|
|
193
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${glowColor})` : "none"
|
|
194
|
+
},
|
|
195
|
+
transition: {
|
|
196
|
+
opacity: { duration: 0.15 },
|
|
197
|
+
d: { type: "spring", stiffness: 400, damping: 25 }
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return /* @__PURE__ */ jsx(
|
|
203
|
+
m.path,
|
|
204
|
+
{
|
|
205
|
+
animate: {
|
|
206
|
+
opacity: isFaded ? 0.4 : 1
|
|
207
|
+
},
|
|
208
|
+
d: animatedPath,
|
|
209
|
+
fill,
|
|
210
|
+
initial: false,
|
|
211
|
+
pointerEvents: "none",
|
|
212
|
+
style: {
|
|
213
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${glowColor})` : "none"
|
|
214
|
+
},
|
|
215
|
+
transition: {
|
|
216
|
+
opacity: { duration: 0.15 }
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
`slice-${animationKey}-${index}`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
const PieSlice = memo(function PieSlice2({
|
|
223
|
+
index,
|
|
224
|
+
color: colorProp,
|
|
225
|
+
fill: fillProp,
|
|
226
|
+
animate = true,
|
|
227
|
+
showGlow = false,
|
|
228
|
+
hoverEffect = "translate",
|
|
229
|
+
hoverOffset: hoverOffsetProp
|
|
230
|
+
}) {
|
|
231
|
+
const {
|
|
232
|
+
arcs,
|
|
233
|
+
innerRadius,
|
|
234
|
+
outerRadius,
|
|
235
|
+
cornerRadius,
|
|
236
|
+
hoverOffset: contextHoverOffset,
|
|
237
|
+
animationKey,
|
|
238
|
+
geometryScrubbing,
|
|
239
|
+
scrubSlicePaths,
|
|
240
|
+
getColor,
|
|
241
|
+
getFill
|
|
242
|
+
} = usePieStable();
|
|
243
|
+
const { hoveredIndex, setHoveredIndex } = usePieHover();
|
|
244
|
+
const aic = useInteracaoAic();
|
|
245
|
+
const hoverOffset = hoverOffsetProp ?? contextHoverOffset;
|
|
246
|
+
const arcData = arcs[index];
|
|
247
|
+
if (!arcData) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
const color = colorProp || getColor(index);
|
|
251
|
+
const fill = fillProp || getFill(index);
|
|
252
|
+
if (geometryScrubbing) {
|
|
253
|
+
const scrubPath = scrubSlicePaths?.[index];
|
|
254
|
+
if (!scrubPath) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
return /* @__PURE__ */ jsx("path", { d: scrubPath, fill, pointerEvents: "none" });
|
|
258
|
+
}
|
|
259
|
+
const isHovered = hoveredIndex === index;
|
|
260
|
+
const isFaded = estaEsmaecido(index, hoveredIndex, aic.selecionados);
|
|
261
|
+
const offset = getSliceOffset(
|
|
262
|
+
arcData.startAngle,
|
|
263
|
+
arcData.endAngle,
|
|
264
|
+
hoverOffset
|
|
265
|
+
);
|
|
266
|
+
const hitboxPath = arcPath(
|
|
267
|
+
innerRadius,
|
|
268
|
+
outerRadius,
|
|
269
|
+
arcData.startAngle,
|
|
270
|
+
arcData.endAngle,
|
|
271
|
+
cornerRadius,
|
|
272
|
+
arcData.padAngle
|
|
273
|
+
);
|
|
274
|
+
const grownOuterRadius = isHovered ? outerRadius + hoverOffset : outerRadius;
|
|
275
|
+
const grownPath = arcPath(
|
|
276
|
+
innerRadius,
|
|
277
|
+
grownOuterRadius,
|
|
278
|
+
arcData.startAngle,
|
|
279
|
+
arcData.endAngle,
|
|
280
|
+
cornerRadius,
|
|
281
|
+
arcData.padAngle
|
|
282
|
+
);
|
|
283
|
+
const renderAnimatedSlice = () => {
|
|
284
|
+
if (hoverEffect === "grow") {
|
|
285
|
+
return /* @__PURE__ */ jsx(
|
|
286
|
+
AnimatedSliceGrow,
|
|
287
|
+
{
|
|
288
|
+
animationKey,
|
|
289
|
+
color,
|
|
290
|
+
cornerRadius,
|
|
291
|
+
endAngle: arcData.endAngle,
|
|
292
|
+
fill,
|
|
293
|
+
hoverOffset,
|
|
294
|
+
index,
|
|
295
|
+
innerRadius,
|
|
296
|
+
isFaded,
|
|
297
|
+
isHovered,
|
|
298
|
+
outerRadius,
|
|
299
|
+
padAngle: arcData.padAngle,
|
|
300
|
+
showGlow,
|
|
301
|
+
startAngle: arcData.startAngle
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
return /* @__PURE__ */ jsx(
|
|
306
|
+
AnimatedSliceTranslate,
|
|
307
|
+
{
|
|
308
|
+
animationKey,
|
|
309
|
+
color,
|
|
310
|
+
cornerRadius,
|
|
311
|
+
endAngle: arcData.endAngle,
|
|
312
|
+
fill,
|
|
313
|
+
hoverOffset: hoverEffect === "none" ? 0 : hoverOffset,
|
|
314
|
+
index,
|
|
315
|
+
innerRadius,
|
|
316
|
+
isFaded,
|
|
317
|
+
isHovered,
|
|
318
|
+
outerRadius,
|
|
319
|
+
padAngle: arcData.padAngle,
|
|
320
|
+
showGlow,
|
|
321
|
+
startAngle: arcData.startAngle
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
};
|
|
325
|
+
const renderStaticSlice = () => {
|
|
326
|
+
if (hoverEffect === "grow") {
|
|
327
|
+
return /* @__PURE__ */ jsx(
|
|
328
|
+
m.path,
|
|
329
|
+
{
|
|
330
|
+
animate: {
|
|
331
|
+
opacity: isFaded ? 0.4 : 1,
|
|
332
|
+
d: grownPath
|
|
333
|
+
},
|
|
334
|
+
d: hitboxPath,
|
|
335
|
+
fill,
|
|
336
|
+
initial: false,
|
|
337
|
+
pointerEvents: "none",
|
|
338
|
+
style: {
|
|
339
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${color})` : "none"
|
|
340
|
+
},
|
|
341
|
+
transition: {
|
|
342
|
+
opacity: { duration: 0.15 },
|
|
343
|
+
d: { type: "spring", stiffness: 400, damping: 25 }
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
const shouldTranslate = hoverEffect !== "none" && isHovered;
|
|
349
|
+
const translateX = shouldTranslate ? offset.x : 0;
|
|
350
|
+
const translateY = shouldTranslate ? offset.y : 0;
|
|
351
|
+
return /* @__PURE__ */ jsx(
|
|
352
|
+
m.path,
|
|
353
|
+
{
|
|
354
|
+
animate: {
|
|
355
|
+
opacity: isFaded ? 0.4 : 1,
|
|
356
|
+
x: translateX,
|
|
357
|
+
y: translateY
|
|
358
|
+
},
|
|
359
|
+
d: hitboxPath,
|
|
360
|
+
fill,
|
|
361
|
+
initial: false,
|
|
362
|
+
pointerEvents: "none",
|
|
363
|
+
style: {
|
|
364
|
+
filter: showGlow && isHovered ? `drop-shadow(0 0 12px ${color})` : "none"
|
|
365
|
+
},
|
|
366
|
+
transition: {
|
|
367
|
+
opacity: { duration: 0.15 },
|
|
368
|
+
x: { type: "spring", stiffness: 400, damping: 25 },
|
|
369
|
+
y: { type: "spring", stiffness: 400, damping: 25 }
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
return /* @__PURE__ */ jsxs("g", { style: { cursor: "pointer" }, children: [
|
|
375
|
+
/* @__PURE__ */ jsx(
|
|
376
|
+
"path",
|
|
377
|
+
{
|
|
378
|
+
d: hitboxPath,
|
|
379
|
+
fill: "transparent",
|
|
380
|
+
onClick: aic.aoClicar ? () => aic.aoClicar?.(index) : void 0,
|
|
381
|
+
onMouseEnter: () => setHoveredIndex(index),
|
|
382
|
+
style: aic.aoClicar ? { cursor: "pointer" } : void 0,
|
|
383
|
+
onMouseLeave: () => setHoveredIndex(null)
|
|
384
|
+
}
|
|
385
|
+
),
|
|
386
|
+
animate ? renderAnimatedSlice() : renderStaticSlice()
|
|
387
|
+
] });
|
|
388
|
+
});
|
|
389
|
+
PieSlice.displayName = "PieSlice";
|
|
390
|
+
var pie_slice_default = PieSlice;
|
|
391
|
+
export {
|
|
392
|
+
PieSlice,
|
|
393
|
+
pie_slice_default as default
|
|
394
|
+
};
|