@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,174 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { m } from "motion/react";
|
|
4
|
+
import { useId, useMemo } from "react";
|
|
5
|
+
import { chartCssVars, useChartStable } from "./chart-context";
|
|
6
|
+
import {
|
|
7
|
+
computeWeekendIndexRuns,
|
|
8
|
+
computeWeekendRanges,
|
|
9
|
+
DEFAULT_WEEKEND_DAYS
|
|
10
|
+
} from "./date-ranges";
|
|
11
|
+
import { renderPatternPreset } from "./pattern-preset";
|
|
12
|
+
import { useCategorySlots } from "./use-category-slots";
|
|
13
|
+
import { isReferenceAreaVisiblePhase } from "./y-domain-utils";
|
|
14
|
+
const DAY_MS = 24 * 60 * 60 * 1e3;
|
|
15
|
+
const ENTER_FADE_MS = 420;
|
|
16
|
+
function resolveAutoAlign(hasColumns, firstX, utc) {
|
|
17
|
+
if (!(hasColumns && firstX) || Number.isNaN(firstX.getTime())) {
|
|
18
|
+
return "calendar";
|
|
19
|
+
}
|
|
20
|
+
const hours = utc ? firstX.getUTCHours() : firstX.getHours();
|
|
21
|
+
const minutes = utc ? firstX.getUTCMinutes() : firstX.getMinutes();
|
|
22
|
+
return hours === 0 && minutes === 0 ? "centered" : "calendar";
|
|
23
|
+
}
|
|
24
|
+
function bandScaleWeekendRects(slots, weekendDays, utc, minDayWidth, { innerWidth, innerHeight }) {
|
|
25
|
+
if (slots.step < minDayWidth) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const extent = slots.axis === "x" ? innerWidth : innerHeight;
|
|
29
|
+
return computeWeekendIndexRuns(slots.dates, { weekendDays, utc }).flatMap(
|
|
30
|
+
([first, last]) => {
|
|
31
|
+
const start = Math.max(0, slots.slotStart(first));
|
|
32
|
+
const end = Math.min(extent, slots.slotStart(last) + slots.step);
|
|
33
|
+
if (end <= start) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
return slots.axis === "x" ? [{ x: start, y: 0, width: end - start, height: innerHeight }] : [{ x: 0, y: start, width: innerWidth, height: end - start }];
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function timeScaleWeekendRects(xScale, weekendDays, utc, align, minDayWidth, { innerWidth, innerHeight }) {
|
|
41
|
+
const [d0, d1] = xScale.domain();
|
|
42
|
+
if (!(d0 && d1)) {
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
const spanMs = Math.abs(d1.getTime() - d0.getTime());
|
|
46
|
+
if (spanMs <= 0 || innerWidth * DAY_MS / spanMs < minDayWidth) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return computeWeekendRanges(d0, d1, { weekendDays, utc, align }).flatMap(
|
|
50
|
+
({ start, end }) => {
|
|
51
|
+
const a = xScale(start);
|
|
52
|
+
const b = xScale(end);
|
|
53
|
+
const x0 = Math.max(0, Math.min(a, b));
|
|
54
|
+
const x1 = Math.min(innerWidth, Math.max(a, b));
|
|
55
|
+
return x1 > x0 ? [{ x: x0, y: 0, width: x1 - x0, height: innerHeight }] : [];
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function Weekends({
|
|
60
|
+
weekendDays = DEFAULT_WEEKEND_DAYS,
|
|
61
|
+
fillType = "pattern",
|
|
62
|
+
fill = chartCssVars.foregroundMuted,
|
|
63
|
+
fillOpacity,
|
|
64
|
+
pattern = "diagonal-up",
|
|
65
|
+
patternScale = 1.5,
|
|
66
|
+
patternStrokeWidth = 1,
|
|
67
|
+
align = "auto",
|
|
68
|
+
utc = false,
|
|
69
|
+
minDayWidth = 2,
|
|
70
|
+
dateKey,
|
|
71
|
+
className
|
|
72
|
+
}) {
|
|
73
|
+
const {
|
|
74
|
+
innerWidth,
|
|
75
|
+
innerHeight,
|
|
76
|
+
xScale,
|
|
77
|
+
barScale,
|
|
78
|
+
composedBarDataKeys,
|
|
79
|
+
data,
|
|
80
|
+
xAccessor,
|
|
81
|
+
chartPhase,
|
|
82
|
+
enterTransition
|
|
83
|
+
} = useChartStable();
|
|
84
|
+
const slots = useCategorySlots(dateKey);
|
|
85
|
+
const patternId = `chart-weekends-pattern-${useId().replace(/:/g, "")}`;
|
|
86
|
+
const firstRow = data[0];
|
|
87
|
+
const resolvedAlign = align === "auto" ? resolveAutoAlign(
|
|
88
|
+
(composedBarDataKeys?.length ?? 0) > 0,
|
|
89
|
+
firstRow && !barScale ? xAccessor(firstRow) : void 0,
|
|
90
|
+
utc
|
|
91
|
+
) : align;
|
|
92
|
+
const weekendKey = weekendDays.join(",");
|
|
93
|
+
const rects = useMemo(() => {
|
|
94
|
+
const days = weekendKey ? weekendKey.split(",").map(Number) : [];
|
|
95
|
+
if (innerWidth <= 0 || innerHeight <= 0) {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
if (slots) {
|
|
99
|
+
return bandScaleWeekendRects(slots, days, utc, minDayWidth, {
|
|
100
|
+
innerWidth,
|
|
101
|
+
innerHeight
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (barScale) {
|
|
105
|
+
return [];
|
|
106
|
+
}
|
|
107
|
+
return timeScaleWeekendRects(
|
|
108
|
+
xScale,
|
|
109
|
+
days,
|
|
110
|
+
utc,
|
|
111
|
+
resolvedAlign,
|
|
112
|
+
minDayWidth,
|
|
113
|
+
{
|
|
114
|
+
innerWidth,
|
|
115
|
+
innerHeight
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
}, [
|
|
119
|
+
weekendKey,
|
|
120
|
+
innerWidth,
|
|
121
|
+
innerHeight,
|
|
122
|
+
slots,
|
|
123
|
+
barScale,
|
|
124
|
+
xScale,
|
|
125
|
+
utc,
|
|
126
|
+
resolvedAlign,
|
|
127
|
+
minDayWidth
|
|
128
|
+
]);
|
|
129
|
+
const usesPattern = fillType === "pattern" && pattern !== "none";
|
|
130
|
+
const patternNode = useMemo(
|
|
131
|
+
() => usesPattern ? renderPatternPreset(pattern, patternId, {
|
|
132
|
+
color: fill,
|
|
133
|
+
scale: patternScale,
|
|
134
|
+
strokeWidth: patternStrokeWidth
|
|
135
|
+
}) : null,
|
|
136
|
+
[usesPattern, pattern, patternId, fill, patternScale, patternStrokeWidth]
|
|
137
|
+
);
|
|
138
|
+
if (rects.length === 0) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
const opacity = fillOpacity ?? (usesPattern ? 0.45 : 0.08);
|
|
142
|
+
const rectFill = patternNode ? `url(#${patternId})` : fill;
|
|
143
|
+
const visible = isReferenceAreaVisiblePhase(chartPhase);
|
|
144
|
+
const fadeTransition = enterTransition && typeof enterTransition === "object" ? enterTransition : { duration: ENTER_FADE_MS / 1e3, ease: "easeOut" };
|
|
145
|
+
return /* @__PURE__ */ jsxs(
|
|
146
|
+
m.g,
|
|
147
|
+
{
|
|
148
|
+
animate: { opacity: visible ? 1 : 0 },
|
|
149
|
+
"aria-hidden": "true",
|
|
150
|
+
className: className ?? "chart-weekends",
|
|
151
|
+
initial: { opacity: 0 },
|
|
152
|
+
transition: fadeTransition,
|
|
153
|
+
children: [
|
|
154
|
+
patternNode,
|
|
155
|
+
/* @__PURE__ */ jsx("g", { fill: rectFill, opacity, children: rects.map((rect) => /* @__PURE__ */ jsx(
|
|
156
|
+
"rect",
|
|
157
|
+
{
|
|
158
|
+
height: rect.height,
|
|
159
|
+
width: rect.width,
|
|
160
|
+
x: rect.x,
|
|
161
|
+
y: rect.y
|
|
162
|
+
},
|
|
163
|
+
`${rect.x}:${rect.y}`
|
|
164
|
+
)) })
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
Weekends.displayName = "Weekends";
|
|
170
|
+
var weekends_default = Weekends;
|
|
171
|
+
export {
|
|
172
|
+
Weekends,
|
|
173
|
+
weekends_default as default
|
|
174
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function xAxisLabelOpacity(label, x, crosshairX, hoveredLabel, tickerHalfWidth) {
|
|
2
|
+
if (crosshairX === null) {
|
|
3
|
+
return 1;
|
|
4
|
+
}
|
|
5
|
+
const fadeBuffer = 20;
|
|
6
|
+
const fadeRadius = tickerHalfWidth + fadeBuffer;
|
|
7
|
+
const distance = Math.abs(x - crosshairX);
|
|
8
|
+
if (distance < tickerHalfWidth) {
|
|
9
|
+
return 0;
|
|
10
|
+
}
|
|
11
|
+
if (hoveredLabel && label === hoveredLabel) {
|
|
12
|
+
return 0;
|
|
13
|
+
}
|
|
14
|
+
if (distance < fadeRadius) {
|
|
15
|
+
return (distance - tickerHalfWidth) / fadeBuffer;
|
|
16
|
+
}
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
function xAxisLabelHighlight(label, x, crosshairX, hoveredLabel, radius) {
|
|
20
|
+
if (crosshairX === null) {
|
|
21
|
+
return { active: false, strength: 0 };
|
|
22
|
+
}
|
|
23
|
+
if (hoveredLabel && label === hoveredLabel) {
|
|
24
|
+
return { active: true, strength: 1 };
|
|
25
|
+
}
|
|
26
|
+
if (radius <= 0) {
|
|
27
|
+
return { active: false, strength: 0 };
|
|
28
|
+
}
|
|
29
|
+
const distance = Math.abs(x - crosshairX);
|
|
30
|
+
const strength = Math.max(0, 1 - distance / radius);
|
|
31
|
+
return { active: false, strength: Math.round(strength * 100) / 100 };
|
|
32
|
+
}
|
|
33
|
+
function xAxisLabelColor({ active, strength }, activeColor, nearbyColor) {
|
|
34
|
+
if (active) {
|
|
35
|
+
return activeColor;
|
|
36
|
+
}
|
|
37
|
+
if (strength <= 0) {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
return `color-mix(in oklab, ${nearbyColor} ${Math.round(strength * 100)}%, var(--chart-label))`;
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
xAxisLabelColor,
|
|
44
|
+
xAxisLabelHighlight,
|
|
45
|
+
xAxisLabelOpacity
|
|
46
|
+
};
|