@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,44 @@
|
|
|
1
|
+
function resolveVerticalFadeSides(fade) {
|
|
2
|
+
if (fade === false || fade === "none") {
|
|
3
|
+
return { top: false, bottom: false, any: false };
|
|
4
|
+
}
|
|
5
|
+
if (fade === true || fade === "both") {
|
|
6
|
+
return { top: true, bottom: true, any: true };
|
|
7
|
+
}
|
|
8
|
+
if (fade === "top") {
|
|
9
|
+
return { top: true, bottom: false, any: true };
|
|
10
|
+
}
|
|
11
|
+
return { top: false, bottom: true, any: true };
|
|
12
|
+
}
|
|
13
|
+
function indicatorFadeGradientStops(sides, fadeLengthPercent = 10) {
|
|
14
|
+
const fade = Math.min(40, Math.max(2, fadeLengthPercent));
|
|
15
|
+
const innerEnd = 100 - fade;
|
|
16
|
+
if (!sides.any) {
|
|
17
|
+
return [{ offset: "0%", opacity: 1 }];
|
|
18
|
+
}
|
|
19
|
+
if (sides.top && sides.bottom) {
|
|
20
|
+
return [
|
|
21
|
+
{ offset: "0%", opacity: 0 },
|
|
22
|
+
{ offset: `${fade}%`, opacity: 1 },
|
|
23
|
+
{ offset: "50%", opacity: 1 },
|
|
24
|
+
{ offset: `${innerEnd}%`, opacity: 1 },
|
|
25
|
+
{ offset: "100%", opacity: 0 }
|
|
26
|
+
];
|
|
27
|
+
}
|
|
28
|
+
if (sides.top) {
|
|
29
|
+
return [
|
|
30
|
+
{ offset: "0%", opacity: 0 },
|
|
31
|
+
{ offset: `${fade}%`, opacity: 1 },
|
|
32
|
+
{ offset: "100%", opacity: 1 }
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
return [
|
|
36
|
+
{ offset: "0%", opacity: 1 },
|
|
37
|
+
{ offset: `${innerEnd}%`, opacity: 1 },
|
|
38
|
+
{ offset: "100%", opacity: 0 }
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
indicatorFadeGradientStops,
|
|
43
|
+
resolveVerticalFadeSides
|
|
44
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Legend } from "./legend";
|
|
2
|
+
import {
|
|
3
|
+
legendCssVars,
|
|
4
|
+
useLegend,
|
|
5
|
+
useLegendItem
|
|
6
|
+
} from "./legend-context";
|
|
7
|
+
import { LegendItem } from "./legend-item";
|
|
8
|
+
import { LegendLabel } from "./legend-label";
|
|
9
|
+
import { LegendMarker } from "./legend-marker";
|
|
10
|
+
import { LegendProgress } from "./legend-progress";
|
|
11
|
+
import { LegendValue } from "./legend-value";
|
|
12
|
+
export {
|
|
13
|
+
Legend,
|
|
14
|
+
LegendItem,
|
|
15
|
+
LegendLabel,
|
|
16
|
+
LegendMarker,
|
|
17
|
+
LegendProgress,
|
|
18
|
+
LegendValue,
|
|
19
|
+
legendCssVars,
|
|
20
|
+
useLegend,
|
|
21
|
+
useLegendItem
|
|
22
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
const legendCssVars = {
|
|
5
|
+
background: "var(--legend)",
|
|
6
|
+
foreground: "var(--legend-foreground)",
|
|
7
|
+
muted: "var(--legend-muted)",
|
|
8
|
+
mutedForeground: "var(--legend-muted-foreground)",
|
|
9
|
+
track: "var(--legend-track)"
|
|
10
|
+
};
|
|
11
|
+
const LegendContext = createContext(null);
|
|
12
|
+
const LegendItemContext = createContext(null);
|
|
13
|
+
function LegendProvider({
|
|
14
|
+
children,
|
|
15
|
+
value
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ jsx(LegendContext.Provider, { value, children });
|
|
18
|
+
}
|
|
19
|
+
function LegendItemProvider({
|
|
20
|
+
children,
|
|
21
|
+
value
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(LegendItemContext.Provider, { value, children });
|
|
24
|
+
}
|
|
25
|
+
function useLegend() {
|
|
26
|
+
const context = useContext(LegendContext);
|
|
27
|
+
if (!context) {
|
|
28
|
+
throw new Error("useLegend must be used within a <Legend> component.");
|
|
29
|
+
}
|
|
30
|
+
return context;
|
|
31
|
+
}
|
|
32
|
+
function useLegendItem() {
|
|
33
|
+
const context = useContext(LegendItemContext);
|
|
34
|
+
if (!context) {
|
|
35
|
+
throw new Error(
|
|
36
|
+
"useLegendItem must be used within a <LegendItem> component."
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
return context;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
LegendItemProvider,
|
|
43
|
+
LegendProvider,
|
|
44
|
+
legendCssVars,
|
|
45
|
+
useLegend,
|
|
46
|
+
useLegendItem
|
|
47
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { useLegend, useLegendItem } from "./legend-context";
|
|
5
|
+
function LegendItem({ className = "", children }) {
|
|
6
|
+
const { setHoveredIndex } = useLegend();
|
|
7
|
+
const { index, isHovered } = useLegendItem();
|
|
8
|
+
return (
|
|
9
|
+
// biome-ignore lint/a11y/noNoninteractiveElementInteractions: Legend item hover interaction
|
|
10
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: Legend item hover interaction
|
|
11
|
+
/* @__PURE__ */ jsx(
|
|
12
|
+
"div",
|
|
13
|
+
{
|
|
14
|
+
className: cn(
|
|
15
|
+
"cursor-pointer rounded-lg px-2 py-1.5 transition-all duration-150 ease-out",
|
|
16
|
+
isHovered && "bg-legend-muted",
|
|
17
|
+
className
|
|
18
|
+
),
|
|
19
|
+
"data-hovered": isHovered ? "" : void 0,
|
|
20
|
+
onMouseEnter: () => setHoveredIndex(index),
|
|
21
|
+
onMouseLeave: () => setHoveredIndex(null),
|
|
22
|
+
children
|
|
23
|
+
}
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
LegendItem.displayName = "LegendItem";
|
|
28
|
+
export {
|
|
29
|
+
LegendItem
|
|
30
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { useLegendItem } from "./legend-context";
|
|
5
|
+
function LegendLabel({
|
|
6
|
+
className = "text-sm font-medium"
|
|
7
|
+
}) {
|
|
8
|
+
const { item } = useLegendItem();
|
|
9
|
+
return /* @__PURE__ */ jsx("span", { className: cn("text-legend-foreground", className), children: item.label });
|
|
10
|
+
}
|
|
11
|
+
LegendLabel.displayName = "LegendLabel";
|
|
12
|
+
export {
|
|
13
|
+
LegendLabel
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { useLegendItem } from "./legend-context";
|
|
5
|
+
function LegendMarker({ className = "h-2.5 w-2.5" }) {
|
|
6
|
+
const { item } = useLegendItem();
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
"div",
|
|
9
|
+
{
|
|
10
|
+
className: cn("shrink-0 rounded-full", className),
|
|
11
|
+
style: { backgroundColor: item.color }
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
LegendMarker.displayName = "LegendMarker";
|
|
16
|
+
export {
|
|
17
|
+
LegendMarker
|
|
18
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Progress } from "@base-ui/react/progress";
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
|
+
import { useLegendItem } from "./legend-context";
|
|
6
|
+
function LegendProgress({
|
|
7
|
+
trackClassName = "",
|
|
8
|
+
indicatorClassName = "",
|
|
9
|
+
height = "h-1.5"
|
|
10
|
+
}) {
|
|
11
|
+
const { item } = useLegendItem();
|
|
12
|
+
if (!item.maxValue) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
return /* @__PURE__ */ jsx(Progress.Root, { max: item.maxValue, value: item.value, children: /* @__PURE__ */ jsx(
|
|
16
|
+
Progress.Track,
|
|
17
|
+
{
|
|
18
|
+
className: cn(
|
|
19
|
+
"w-full overflow-hidden rounded-full bg-legend-track",
|
|
20
|
+
height,
|
|
21
|
+
trackClassName
|
|
22
|
+
),
|
|
23
|
+
children: /* @__PURE__ */ jsx(
|
|
24
|
+
Progress.Indicator,
|
|
25
|
+
{
|
|
26
|
+
className: cn(
|
|
27
|
+
"h-full rounded-full transition-all duration-500",
|
|
28
|
+
indicatorClassName
|
|
29
|
+
),
|
|
30
|
+
style: { backgroundColor: item.color }
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
) });
|
|
35
|
+
}
|
|
36
|
+
LegendProgress.displayName = "LegendProgress";
|
|
37
|
+
export {
|
|
38
|
+
LegendProgress
|
|
39
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
import { intFmt } from "../chart-formatters";
|
|
5
|
+
import { useLegendItem } from "./legend-context";
|
|
6
|
+
function LegendValue({
|
|
7
|
+
className = "text-sm tabular-nums",
|
|
8
|
+
showPercentage = false,
|
|
9
|
+
percentageClassName = "text-xs tabular-nums",
|
|
10
|
+
formatValue = intFmt,
|
|
11
|
+
formatPercentage = (p) => `${p.toFixed(0)}%`
|
|
12
|
+
}) {
|
|
13
|
+
const { item, percentage } = useLegendItem();
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
className: cn(
|
|
18
|
+
"flex items-center gap-2 text-legend-muted-foreground",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ jsx("span", { children: formatValue(item.value) }),
|
|
23
|
+
showPercentage && item.maxValue && /* @__PURE__ */ jsx("span", { className: percentageClassName, children: formatPercentage(percentage) })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
LegendValue.displayName = "LegendValue";
|
|
29
|
+
export {
|
|
30
|
+
LegendValue
|
|
31
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
cloneElement,
|
|
5
|
+
isValidElement,
|
|
6
|
+
useState
|
|
7
|
+
} from "react";
|
|
8
|
+
import { cn } from "../../lib/utils";
|
|
9
|
+
import { useChartDataOverride } from "../chart-data-override";
|
|
10
|
+
import {
|
|
11
|
+
LegendItemProvider,
|
|
12
|
+
LegendProvider
|
|
13
|
+
} from "./legend-context";
|
|
14
|
+
function Legend({
|
|
15
|
+
items: itemsProp,
|
|
16
|
+
hoveredIndex: controlledHoveredIndex,
|
|
17
|
+
onHoverChange,
|
|
18
|
+
title,
|
|
19
|
+
titleClassName = "text-sm font-semibold",
|
|
20
|
+
className = "",
|
|
21
|
+
children
|
|
22
|
+
}) {
|
|
23
|
+
const { items } = useChartDataOverride("Legend", { items: itemsProp });
|
|
24
|
+
const [internalHoveredIndex, setInternalHoveredIndex] = useState(null);
|
|
25
|
+
const isControlled = controlledHoveredIndex !== void 0;
|
|
26
|
+
const hoveredIndex = isControlled ? controlledHoveredIndex : internalHoveredIndex;
|
|
27
|
+
const setHoveredIndex = (index) => {
|
|
28
|
+
if (isControlled) {
|
|
29
|
+
onHoverChange?.(index);
|
|
30
|
+
} else {
|
|
31
|
+
setInternalHoveredIndex(index);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const contextValue = {
|
|
35
|
+
items,
|
|
36
|
+
hoveredIndex,
|
|
37
|
+
setHoveredIndex
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ jsx(LegendProvider, { value: contextValue, children: /* @__PURE__ */ jsxs(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: cn("legend-container flex flex-col gap-2", className),
|
|
43
|
+
"data-chart-legend": "",
|
|
44
|
+
children: [
|
|
45
|
+
title && /* @__PURE__ */ jsx("h3", { className: cn("mb-1 text-legend-foreground", titleClassName), children: title }),
|
|
46
|
+
items.map((item, index) => {
|
|
47
|
+
const isHovered = hoveredIndex === index;
|
|
48
|
+
const isFaded = hoveredIndex !== null && hoveredIndex !== index;
|
|
49
|
+
const percentage = item.maxValue ? item.value / item.maxValue * 100 : 0;
|
|
50
|
+
const itemContext = {
|
|
51
|
+
item,
|
|
52
|
+
index,
|
|
53
|
+
isHovered,
|
|
54
|
+
isFaded,
|
|
55
|
+
percentage
|
|
56
|
+
};
|
|
57
|
+
if (isValidElement(children)) {
|
|
58
|
+
return /* @__PURE__ */ jsx(LegendItemProvider, { value: itemContext, children: cloneElement(children) }, item.label);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
})
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
) });
|
|
65
|
+
}
|
|
66
|
+
Legend.displayName = "Legend";
|
|
67
|
+
export {
|
|
68
|
+
Legend
|
|
69
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { curveNatural } from "d3-shape";
|
|
4
|
+
import { m } from "motion/react";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import {
|
|
7
|
+
chartCssVars,
|
|
8
|
+
useChartStable,
|
|
9
|
+
useSettledYScale,
|
|
10
|
+
useYScale
|
|
11
|
+
} from "./chart-context";
|
|
12
|
+
import { useAnimatedSeriesPath } from "./use-animated-series-path";
|
|
13
|
+
const BACKDROP_ENTER_FADE_MS = 420;
|
|
14
|
+
const DEFAULT_STOPS = [
|
|
15
|
+
{ offset: 0, color: chartCssVars.linePrimary, opacity: 0.35 },
|
|
16
|
+
{ offset: 1, color: chartCssVars.linePrimary, opacity: 0 }
|
|
17
|
+
];
|
|
18
|
+
const DEFAULT_CENTER = { x: 0.5, y: 1 };
|
|
19
|
+
const DEFAULT_RADIUS = { x: 0.75, y: 1 };
|
|
20
|
+
const PATH_START_X_RE = /^M\s*(-?[\d.]+(?:e[-+]?\d+)?)/i;
|
|
21
|
+
function seriesRegionPath(pathD, edgeY) {
|
|
22
|
+
const match = PATH_START_X_RE.exec(pathD);
|
|
23
|
+
if (!match) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
return `${pathD}V${edgeY}H${match[1]}Z`;
|
|
27
|
+
}
|
|
28
|
+
function LineBackdrop({
|
|
29
|
+
dataKey,
|
|
30
|
+
yAxisId,
|
|
31
|
+
side = "above",
|
|
32
|
+
curve = curveNatural,
|
|
33
|
+
animate = true,
|
|
34
|
+
stops = DEFAULT_STOPS,
|
|
35
|
+
center = DEFAULT_CENTER,
|
|
36
|
+
radius = DEFAULT_RADIUS,
|
|
37
|
+
opacity = 1,
|
|
38
|
+
children
|
|
39
|
+
}) {
|
|
40
|
+
const {
|
|
41
|
+
renderData,
|
|
42
|
+
xScale,
|
|
43
|
+
innerHeight,
|
|
44
|
+
innerWidth,
|
|
45
|
+
xAccessor,
|
|
46
|
+
chartPhase,
|
|
47
|
+
yDomainTweenDuration,
|
|
48
|
+
isLoaded,
|
|
49
|
+
enterTransition
|
|
50
|
+
} = useChartStable();
|
|
51
|
+
const yScale = useYScale(yAxisId);
|
|
52
|
+
const settledYScale = useSettledYScale(yAxisId);
|
|
53
|
+
const { pathD } = useAnimatedSeriesPath({
|
|
54
|
+
chartPhase,
|
|
55
|
+
curve,
|
|
56
|
+
dataKey,
|
|
57
|
+
durationMs: yDomainTweenDuration,
|
|
58
|
+
enabled: animate && chartPhase === "ready",
|
|
59
|
+
innerWidth,
|
|
60
|
+
renderData,
|
|
61
|
+
settledYScale,
|
|
62
|
+
xAccessor,
|
|
63
|
+
xScale,
|
|
64
|
+
yScale
|
|
65
|
+
});
|
|
66
|
+
const reactId = useId();
|
|
67
|
+
const clipId = `line-backdrop-clip-${dataKey}-${reactId}`;
|
|
68
|
+
const gradientId = `line-backdrop-gradient-${dataKey}-${reactId}`;
|
|
69
|
+
const showContent = chartPhase === "revealing" || chartPhase === "ready" || chartPhase === "exitingReady";
|
|
70
|
+
const regionD = seriesRegionPath(pathD, side === "above" ? 0 : innerHeight);
|
|
71
|
+
if (!(showContent && regionD) || innerWidth <= 0 || innerHeight <= 0) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const cx = innerWidth * center.x;
|
|
75
|
+
const cy = innerHeight * center.y;
|
|
76
|
+
const rx = Math.max(1, innerWidth * radius.x);
|
|
77
|
+
const ry = Math.max(1, innerHeight * radius.y);
|
|
78
|
+
const enterFade = enterTransition && typeof enterTransition === "object" ? enterTransition : { duration: BACKDROP_ENTER_FADE_MS / 1e3, ease: "easeOut" };
|
|
79
|
+
return /* @__PURE__ */ jsxs(
|
|
80
|
+
m.g,
|
|
81
|
+
{
|
|
82
|
+
animate: { opacity: isLoaded ? opacity : 0 },
|
|
83
|
+
initial: { opacity: 0 },
|
|
84
|
+
pointerEvents: "none",
|
|
85
|
+
transition: isLoaded ? enterFade : { duration: 0 },
|
|
86
|
+
children: [
|
|
87
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
88
|
+
/* @__PURE__ */ jsx("clipPath", { id: clipId, children: /* @__PURE__ */ jsx("path", { d: regionD }) }),
|
|
89
|
+
children ? null : /* @__PURE__ */ jsx(
|
|
90
|
+
"radialGradient",
|
|
91
|
+
{
|
|
92
|
+
cx,
|
|
93
|
+
cy,
|
|
94
|
+
gradientTransform: `translate(${cx} ${cy}) scale(1 ${ry / rx}) translate(${-cx} ${-cy})`,
|
|
95
|
+
gradientUnits: "userSpaceOnUse",
|
|
96
|
+
id: gradientId,
|
|
97
|
+
r: rx,
|
|
98
|
+
children: stops.map((stop) => /* @__PURE__ */ jsx(
|
|
99
|
+
"stop",
|
|
100
|
+
{
|
|
101
|
+
offset: stop.offset,
|
|
102
|
+
style: {
|
|
103
|
+
stopColor: stop.color,
|
|
104
|
+
stopOpacity: stop.opacity ?? 1
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
`${stop.offset}-${stop.color}`
|
|
108
|
+
))
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ jsx("g", { clipPath: `url(#${clipId})`, children: children ?? /* @__PURE__ */ jsx(
|
|
113
|
+
"rect",
|
|
114
|
+
{
|
|
115
|
+
fill: `url(#${gradientId})`,
|
|
116
|
+
height: innerHeight,
|
|
117
|
+
width: innerWidth
|
|
118
|
+
}
|
|
119
|
+
) })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
LineBackdrop.displayName = "LineBackdrop";
|
|
125
|
+
var line_backdrop_default = LineBackdrop;
|
|
126
|
+
export {
|
|
127
|
+
LineBackdrop,
|
|
128
|
+
line_backdrop_default as default
|
|
129
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { curveNatural } from "d3-shape";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_SKELETON_DATA_KEY,
|
|
7
|
+
DEFAULT_SKELETON_POINT_COUNT,
|
|
8
|
+
generateChartSkeletonData
|
|
9
|
+
} from "./generate-chart-skeleton-data";
|
|
10
|
+
import { Grid } from "./grid";
|
|
11
|
+
import { Line } from "./line";
|
|
12
|
+
import { LineChart } from "./line-chart";
|
|
13
|
+
const LOADING_DATA_KEY = DEFAULT_SKELETON_DATA_KEY;
|
|
14
|
+
const DEFAULT_LOADING_STROKE = "var(--chart-foreground)";
|
|
15
|
+
const DEFAULT_LOADING_GRID_STROKE = "color-mix(in oklch, var(--chart-grid) 50%, transparent)";
|
|
16
|
+
const DEFAULT_LOADING_GRID_SHIMMER_STROKE = "color-mix(in oklch, var(--chart-foreground) 68%, transparent)";
|
|
17
|
+
const DEFAULT_LOADING_STROKE_OPACITY = 0.5;
|
|
18
|
+
function LineChartLoading({
|
|
19
|
+
margin,
|
|
20
|
+
stroke = DEFAULT_LOADING_STROKE,
|
|
21
|
+
strokeOpacity = DEFAULT_LOADING_STROKE_OPACITY,
|
|
22
|
+
gridStroke = DEFAULT_LOADING_GRID_STROKE,
|
|
23
|
+
gridShimmerStroke = DEFAULT_LOADING_GRID_SHIMMER_STROKE,
|
|
24
|
+
gridShimmer = true,
|
|
25
|
+
gridShimmerLength,
|
|
26
|
+
gridShimmerSpeed,
|
|
27
|
+
gridShimmerSync = false,
|
|
28
|
+
loadingStyle = "pulse",
|
|
29
|
+
label = "Carregando",
|
|
30
|
+
aspectRatio = "2 / 1",
|
|
31
|
+
className = ""
|
|
32
|
+
}) {
|
|
33
|
+
const data = useMemo(
|
|
34
|
+
() => generateChartSkeletonData({
|
|
35
|
+
dataKey: DEFAULT_SKELETON_DATA_KEY,
|
|
36
|
+
pointCount: DEFAULT_SKELETON_POINT_COUNT
|
|
37
|
+
}),
|
|
38
|
+
[]
|
|
39
|
+
);
|
|
40
|
+
return /* @__PURE__ */ jsxs(
|
|
41
|
+
LineChart,
|
|
42
|
+
{
|
|
43
|
+
animationDuration: 0,
|
|
44
|
+
aspectRatio,
|
|
45
|
+
className,
|
|
46
|
+
data,
|
|
47
|
+
loadingLabel: label,
|
|
48
|
+
margin,
|
|
49
|
+
status: "loading",
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
Grid,
|
|
53
|
+
{
|
|
54
|
+
horizontal: true,
|
|
55
|
+
shimmer: loadingStyle === "sweep" ? false : gridShimmer,
|
|
56
|
+
shimmerLength: gridShimmerLength,
|
|
57
|
+
shimmerSpeed: gridShimmerSpeed,
|
|
58
|
+
shimmerStroke: gridShimmerStroke,
|
|
59
|
+
shimmerSync: gridShimmerSync,
|
|
60
|
+
stroke: gridStroke
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
Line,
|
|
65
|
+
{
|
|
66
|
+
curve: curveNatural,
|
|
67
|
+
dataKey: LOADING_DATA_KEY,
|
|
68
|
+
fadeEdges: false,
|
|
69
|
+
loadingStroke: stroke,
|
|
70
|
+
loadingStrokeOpacity: strokeOpacity,
|
|
71
|
+
loadingStyle,
|
|
72
|
+
showHighlight: false,
|
|
73
|
+
stroke: "transparent",
|
|
74
|
+
strokeWidth: 2.5
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
var line_chart_loading_default = LineChartLoading;
|
|
82
|
+
export {
|
|
83
|
+
LineChartLoading,
|
|
84
|
+
line_chart_loading_default as default
|
|
85
|
+
};
|