@aiconstructions/graficos 0.0.0-stage → 0.2.2
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 +57 -0
- package/LICENSE-BKLIT +21 -0
- package/LICENSE-visx-pattern +21 -0
- package/README.md +189 -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,51 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
function findPathLengthAtX(path, pathLength, targetX) {
|
|
3
|
+
if (!path || pathLength === 0) {
|
|
4
|
+
return 0;
|
|
5
|
+
}
|
|
6
|
+
let low = 0;
|
|
7
|
+
let high = pathLength;
|
|
8
|
+
const tolerance = 0.5;
|
|
9
|
+
while (high - low > tolerance) {
|
|
10
|
+
const mid = (low + high) / 2;
|
|
11
|
+
const point = path.getPointAtLength(mid);
|
|
12
|
+
if (point.x < targetX) {
|
|
13
|
+
low = mid;
|
|
14
|
+
} else {
|
|
15
|
+
high = mid;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return (low + high) / 2;
|
|
19
|
+
}
|
|
20
|
+
const EMPTY_METRICS = { pathD: null, pathLength: 0 };
|
|
21
|
+
function usePathStrokeMetrics(pathRef, deps, enabled = true) {
|
|
22
|
+
const [metrics, setMetrics] = useState(EMPTY_METRICS);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
const path = pathRef.current;
|
|
25
|
+
if (!(enabled && path)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
const d = path.getAttribute("d");
|
|
29
|
+
const len = d ? path.getTotalLength() : 0;
|
|
30
|
+
setMetrics(
|
|
31
|
+
(prev) => prev.pathD === d && prev.pathLength === len ? prev : { pathD: d, pathLength: len }
|
|
32
|
+
);
|
|
33
|
+
}, [enabled, ...deps]);
|
|
34
|
+
return metrics;
|
|
35
|
+
}
|
|
36
|
+
function resolveDashTailBounds(dashFromIndex, dataLength) {
|
|
37
|
+
return dashFromIndex != null && dashFromIndex >= 0 && dashFromIndex < dataLength - 1;
|
|
38
|
+
}
|
|
39
|
+
function resolveDashStartX(data, dashFromIndex, xScale, xAccessor) {
|
|
40
|
+
const dashFromPoint = data[dashFromIndex];
|
|
41
|
+
if (!dashFromPoint) {
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
return xScale(xAccessor(dashFromPoint)) ?? 0;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
findPathLengthAtX,
|
|
48
|
+
resolveDashStartX,
|
|
49
|
+
resolveDashTailBounds,
|
|
50
|
+
usePathStrokeMetrics
|
|
51
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { curveMonotoneX } from "d3-shape";
|
|
4
|
+
import { useId, useMemo } from "react";
|
|
5
|
+
import { useChartStable } from "./chart-context";
|
|
6
|
+
import {
|
|
7
|
+
areaVerticalFadeStops,
|
|
8
|
+
fadeGradientStops,
|
|
9
|
+
resolveFadeSides,
|
|
10
|
+
viewportFadeGradientAttrs
|
|
11
|
+
} from "./fade-edges";
|
|
12
|
+
import { areaClosedD } from "./line-path";
|
|
13
|
+
function PatternArea({
|
|
14
|
+
dataKey,
|
|
15
|
+
fill,
|
|
16
|
+
curve = curveMonotoneX,
|
|
17
|
+
fillOpacity = 1,
|
|
18
|
+
fadeBottom = 0,
|
|
19
|
+
fadeEdges = false
|
|
20
|
+
}) {
|
|
21
|
+
const { renderData, xScale, yScale, xAccessor, innerWidth, innerHeight } = useChartStable();
|
|
22
|
+
const uid = useId();
|
|
23
|
+
const d = useMemo(
|
|
24
|
+
() => areaClosedD(renderData, {
|
|
25
|
+
curve,
|
|
26
|
+
x: (datum) => xScale(xAccessor(datum)) ?? 0,
|
|
27
|
+
y: (datum) => {
|
|
28
|
+
const v = datum[dataKey];
|
|
29
|
+
return typeof v === "number" ? yScale(v) ?? 0 : 0;
|
|
30
|
+
},
|
|
31
|
+
yScale
|
|
32
|
+
}),
|
|
33
|
+
[curve, dataKey, renderData, xAccessor, xScale, yScale]
|
|
34
|
+
);
|
|
35
|
+
const hasVerticalFade = fillOpacity !== 1 || fadeBottom > 0;
|
|
36
|
+
const sides = resolveFadeSides(fadeEdges);
|
|
37
|
+
const hasEdgeFade = sides.any && innerWidth > 0;
|
|
38
|
+
if (!(hasVerticalFade || hasEdgeFade)) {
|
|
39
|
+
return /* @__PURE__ */ jsx("path", { d, fill });
|
|
40
|
+
}
|
|
41
|
+
const baseId = `pattern-area-${dataKey}-${uid}`;
|
|
42
|
+
const verticalMaskId = `${baseId}-v`;
|
|
43
|
+
const edgeMaskId = `${baseId}-e`;
|
|
44
|
+
const verticalStops = areaVerticalFadeStops({
|
|
45
|
+
topOpacity: fillOpacity,
|
|
46
|
+
fadeBottom,
|
|
47
|
+
gradientToOpacity: fillOpacity
|
|
48
|
+
});
|
|
49
|
+
const path = /* @__PURE__ */ jsx(
|
|
50
|
+
"path",
|
|
51
|
+
{
|
|
52
|
+
d,
|
|
53
|
+
fill,
|
|
54
|
+
mask: hasVerticalFade ? `url(#${verticalMaskId})` : void 0
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
58
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
59
|
+
hasVerticalFade ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
"linearGradient",
|
|
62
|
+
{
|
|
63
|
+
id: `${verticalMaskId}-g`,
|
|
64
|
+
x1: "0",
|
|
65
|
+
x2: "0",
|
|
66
|
+
y1: "0",
|
|
67
|
+
y2: "1",
|
|
68
|
+
children: verticalStops.map((stop) => /* @__PURE__ */ jsx(
|
|
69
|
+
"stop",
|
|
70
|
+
{
|
|
71
|
+
offset: stop.offset,
|
|
72
|
+
stopColor: "white",
|
|
73
|
+
stopOpacity: stop.opacity
|
|
74
|
+
},
|
|
75
|
+
stop.offset
|
|
76
|
+
))
|
|
77
|
+
}
|
|
78
|
+
),
|
|
79
|
+
/* @__PURE__ */ jsx("mask", { id: verticalMaskId, maskContentUnits: "objectBoundingBox", children: /* @__PURE__ */ jsx("rect", { fill: `url(#${verticalMaskId}-g)`, height: "1", width: "1" }) })
|
|
80
|
+
] }) : null,
|
|
81
|
+
hasEdgeFade ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
"linearGradient",
|
|
84
|
+
{
|
|
85
|
+
id: `${edgeMaskId}-g`,
|
|
86
|
+
...viewportFadeGradientAttrs(innerWidth),
|
|
87
|
+
children: fadeGradientStops(sides).map((stop) => /* @__PURE__ */ jsx(
|
|
88
|
+
"stop",
|
|
89
|
+
{
|
|
90
|
+
offset: stop.offset,
|
|
91
|
+
stopColor: "white",
|
|
92
|
+
stopOpacity: stop.opacity
|
|
93
|
+
},
|
|
94
|
+
stop.offset
|
|
95
|
+
))
|
|
96
|
+
}
|
|
97
|
+
),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
"mask",
|
|
100
|
+
{
|
|
101
|
+
height: innerHeight,
|
|
102
|
+
id: edgeMaskId,
|
|
103
|
+
maskUnits: "userSpaceOnUse",
|
|
104
|
+
width: innerWidth,
|
|
105
|
+
x: "0",
|
|
106
|
+
y: "0",
|
|
107
|
+
children: /* @__PURE__ */ jsx(
|
|
108
|
+
"rect",
|
|
109
|
+
{
|
|
110
|
+
fill: `url(#${edgeMaskId}-g)`,
|
|
111
|
+
height: innerHeight,
|
|
112
|
+
width: innerWidth
|
|
113
|
+
}
|
|
114
|
+
)
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] }) : null
|
|
118
|
+
] }),
|
|
119
|
+
hasEdgeFade ? /* @__PURE__ */ jsx("g", { mask: `url(#${edgeMaskId})`, children: path }) : path
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
PatternArea.displayName = "PatternArea";
|
|
123
|
+
var pattern_area_default = PatternArea;
|
|
124
|
+
export {
|
|
125
|
+
PatternArea,
|
|
126
|
+
pattern_area_default as default
|
|
127
|
+
};
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { PatternTile } from "./pattern-tile";
|
|
4
|
+
const PATTERN_PRESET_DEFS = {
|
|
5
|
+
vertical: {
|
|
6
|
+
label: "Vertical",
|
|
7
|
+
family: "lines",
|
|
8
|
+
size: 6,
|
|
9
|
+
stroke: "M5.5 0V6M-0.5 0V6"
|
|
10
|
+
},
|
|
11
|
+
"vertical-dense": {
|
|
12
|
+
label: "Vertical dense",
|
|
13
|
+
family: "lines",
|
|
14
|
+
size: 3,
|
|
15
|
+
stroke: "M2.5 0V3M-0.5 0V3"
|
|
16
|
+
},
|
|
17
|
+
horizontal: {
|
|
18
|
+
label: "Horizontal",
|
|
19
|
+
family: "lines",
|
|
20
|
+
size: 6,
|
|
21
|
+
stroke: "M0 5.5H6M0 -0.5H6"
|
|
22
|
+
},
|
|
23
|
+
"horizontal-dense": {
|
|
24
|
+
label: "Horizontal dense",
|
|
25
|
+
family: "lines",
|
|
26
|
+
size: 3,
|
|
27
|
+
stroke: "M0 2.5H3M0 -0.5H3"
|
|
28
|
+
},
|
|
29
|
+
"diagonal-up": {
|
|
30
|
+
label: "Diagonal up",
|
|
31
|
+
family: "lines",
|
|
32
|
+
size: 6,
|
|
33
|
+
stroke: "M-2 1L1 -2M-1 6L6 -1M4 7L7 4"
|
|
34
|
+
},
|
|
35
|
+
"diagonal-up-sparse": {
|
|
36
|
+
label: "Diagonal up sparse",
|
|
37
|
+
family: "lines",
|
|
38
|
+
size: 12,
|
|
39
|
+
stroke: "M-2 1L1 -2M-1 12L12 -1M10 13L13 10"
|
|
40
|
+
},
|
|
41
|
+
"diagonal-down": {
|
|
42
|
+
label: "Diagonal down",
|
|
43
|
+
family: "lines",
|
|
44
|
+
size: 6,
|
|
45
|
+
stroke: "M-1 -1L7 7M-2 4L2 8M4 -2L8 2"
|
|
46
|
+
},
|
|
47
|
+
"diagonal-down-sparse": {
|
|
48
|
+
label: "Diagonal down sparse",
|
|
49
|
+
family: "lines",
|
|
50
|
+
size: 12,
|
|
51
|
+
stroke: "M-1 -1L13 13M-2 10L2 14M10 -2L14 2"
|
|
52
|
+
},
|
|
53
|
+
grid: {
|
|
54
|
+
label: "Grid",
|
|
55
|
+
family: "grids",
|
|
56
|
+
size: 6,
|
|
57
|
+
stroke: "M5.5 0V6M-0.5 0V6M0 5.5H6M0 -0.5H6"
|
|
58
|
+
},
|
|
59
|
+
"vertical-dashed": {
|
|
60
|
+
label: "Vertical dashed",
|
|
61
|
+
family: "dashed",
|
|
62
|
+
size: 6,
|
|
63
|
+
fill: "M6 1V4H5V1H6Z"
|
|
64
|
+
},
|
|
65
|
+
"horizontal-dashed": {
|
|
66
|
+
label: "Horizontal dashed",
|
|
67
|
+
family: "dashed",
|
|
68
|
+
size: 6,
|
|
69
|
+
fill: "M4 6L1 6L1 5L4 5L4 6Z"
|
|
70
|
+
},
|
|
71
|
+
"horizontal-dashed-dense": {
|
|
72
|
+
label: "Horizontal dashed dense",
|
|
73
|
+
family: "dashed",
|
|
74
|
+
size: 6,
|
|
75
|
+
fill: "M4 6L1 6L1 5L4 5L4 6ZM4 3L1 3L1 2L4 2L4 3Z"
|
|
76
|
+
},
|
|
77
|
+
"grid-dashed": {
|
|
78
|
+
label: "Grid dashed",
|
|
79
|
+
family: "dashed",
|
|
80
|
+
size: 6,
|
|
81
|
+
fill: "M6 1V4H5V1H6ZM4 6L1 6L1 5L4 5L4 6Z"
|
|
82
|
+
},
|
|
83
|
+
"grid-dotted": {
|
|
84
|
+
label: "Grid dotted",
|
|
85
|
+
family: "dashed",
|
|
86
|
+
size: 6,
|
|
87
|
+
fill: "M1 6V5H2V6H1ZM3 6V5H4V6H3ZM5 6V5H6V6H5ZM6 4H5V3H6V4ZM6 2H5V1H6V2Z"
|
|
88
|
+
},
|
|
89
|
+
dots: { label: "Dots", family: "dots", size: 6, fill: "M6 5H5V6H6V5Z" },
|
|
90
|
+
"dots-sparse": {
|
|
91
|
+
label: "Dots sparse",
|
|
92
|
+
family: "dots",
|
|
93
|
+
size: 12,
|
|
94
|
+
fill: "M12 11H11V12H12V11ZM6 5H5V6H6V5Z"
|
|
95
|
+
},
|
|
96
|
+
"diagonal-dots-up": {
|
|
97
|
+
label: "Diagonal dots up",
|
|
98
|
+
family: "dots",
|
|
99
|
+
size: 6,
|
|
100
|
+
fill: "M5 5h1v1h-1zM3 1h1v1h-1zM1 3h1v1h-1z"
|
|
101
|
+
},
|
|
102
|
+
"diagonal-dots-up-sparse": {
|
|
103
|
+
label: "Diagonal dots up sparse",
|
|
104
|
+
family: "dots",
|
|
105
|
+
size: 12,
|
|
106
|
+
fill: "M5 5h1v1h-1zM11 11h1v1h-1zM3 7h1v1h-1zM1 9h1v1h-1zM7 3h1v1h-1zM9 1h1v1h-1z"
|
|
107
|
+
},
|
|
108
|
+
"diagonal-dots-down": {
|
|
109
|
+
label: "Diagonal dots down",
|
|
110
|
+
family: "dots",
|
|
111
|
+
size: 6,
|
|
112
|
+
fill: "M5 5h1v1h-1zM3 3h1v1h-1zM1 1h1v1h-1z"
|
|
113
|
+
},
|
|
114
|
+
"diagonal-dots-down-sparse": {
|
|
115
|
+
label: "Diagonal dots down sparse",
|
|
116
|
+
family: "dots",
|
|
117
|
+
size: 12,
|
|
118
|
+
fill: "M11 11h1v1h-1zM9 9h1v1h-1zM7 7h1v1h-1zM5 5h1v1h-1zM3 3h1v1h-1zM1 1h1v1h-1z"
|
|
119
|
+
},
|
|
120
|
+
"circles-dense": {
|
|
121
|
+
label: "Circles dense",
|
|
122
|
+
family: "circles",
|
|
123
|
+
size: 6,
|
|
124
|
+
fill: "M1 2.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0z"
|
|
125
|
+
},
|
|
126
|
+
circles: {
|
|
127
|
+
label: "Circles",
|
|
128
|
+
family: "circles",
|
|
129
|
+
size: 12,
|
|
130
|
+
fill: "M4 5.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0z"
|
|
131
|
+
},
|
|
132
|
+
"circles-sparse": {
|
|
133
|
+
label: "Circles sparse",
|
|
134
|
+
family: "circles",
|
|
135
|
+
size: 24,
|
|
136
|
+
fill: "M4 5.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0zM16 17.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0-3 0z"
|
|
137
|
+
},
|
|
138
|
+
blocks: { label: "Blocks", family: "tiles", size: 6, fill: "M1 1h3v3h-3z" },
|
|
139
|
+
"checkerboard-xs": {
|
|
140
|
+
label: "Checkerboard XS",
|
|
141
|
+
family: "tiles",
|
|
142
|
+
size: 6,
|
|
143
|
+
fill: "M0 0h3v3h-3zM3 3h3v3h-3z"
|
|
144
|
+
},
|
|
145
|
+
"checkerboard-sm": {
|
|
146
|
+
label: "Checkerboard SM",
|
|
147
|
+
family: "tiles",
|
|
148
|
+
size: 8,
|
|
149
|
+
fill: "M0 0h4v4h-4zM4 4h4v4h-4z"
|
|
150
|
+
},
|
|
151
|
+
checkerboard: {
|
|
152
|
+
label: "Checkerboard",
|
|
153
|
+
family: "tiles",
|
|
154
|
+
size: 12,
|
|
155
|
+
fill: "M0 0h6v6h-6zM6 6h6v6h-6z"
|
|
156
|
+
},
|
|
157
|
+
"checkerboard-lg": {
|
|
158
|
+
label: "Checkerboard LG",
|
|
159
|
+
family: "tiles",
|
|
160
|
+
size: 24,
|
|
161
|
+
fill: "M12 0H0V12H12V0ZM24 12H12V24H24V12Z"
|
|
162
|
+
},
|
|
163
|
+
"checkerboard-inset": {
|
|
164
|
+
label: "Checkerboard inset",
|
|
165
|
+
family: "tiles",
|
|
166
|
+
size: 12,
|
|
167
|
+
fill: "M0 0h5v5h-5zM6 6h5v5h-5z"
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const PATTERN_PRESET_IDS = [
|
|
171
|
+
"none",
|
|
172
|
+
"vertical",
|
|
173
|
+
"vertical-dense",
|
|
174
|
+
"horizontal",
|
|
175
|
+
"horizontal-dense",
|
|
176
|
+
"diagonal-up",
|
|
177
|
+
"diagonal-up-sparse",
|
|
178
|
+
"diagonal-down",
|
|
179
|
+
"diagonal-down-sparse",
|
|
180
|
+
"grid",
|
|
181
|
+
"vertical-dashed",
|
|
182
|
+
"horizontal-dashed",
|
|
183
|
+
"horizontal-dashed-dense",
|
|
184
|
+
"grid-dashed",
|
|
185
|
+
"grid-dotted",
|
|
186
|
+
"dots",
|
|
187
|
+
"dots-sparse",
|
|
188
|
+
"diagonal-dots-up",
|
|
189
|
+
"diagonal-dots-up-sparse",
|
|
190
|
+
"diagonal-dots-down",
|
|
191
|
+
"diagonal-dots-down-sparse",
|
|
192
|
+
"circles-dense",
|
|
193
|
+
"circles",
|
|
194
|
+
"circles-sparse",
|
|
195
|
+
"blocks",
|
|
196
|
+
"checkerboard-xs",
|
|
197
|
+
"checkerboard-sm",
|
|
198
|
+
"checkerboard",
|
|
199
|
+
"checkerboard-lg",
|
|
200
|
+
"checkerboard-inset"
|
|
201
|
+
];
|
|
202
|
+
const LEGACY_PATTERN_PRESETS = {
|
|
203
|
+
diagonal: "diagonal-up",
|
|
204
|
+
cross: "grid",
|
|
205
|
+
accent: "diagonal-up"
|
|
206
|
+
};
|
|
207
|
+
function resolvePatternPresetId(preset) {
|
|
208
|
+
if (!preset) {
|
|
209
|
+
return "none";
|
|
210
|
+
}
|
|
211
|
+
if (preset in LEGACY_PATTERN_PRESETS) {
|
|
212
|
+
return LEGACY_PATTERN_PRESETS[preset];
|
|
213
|
+
}
|
|
214
|
+
return PATTERN_PRESET_IDS.includes(preset) ? preset : "none";
|
|
215
|
+
}
|
|
216
|
+
const PATTERN_PRESETS = Object.entries(PATTERN_PRESET_DEFS).map(([id, def]) => ({
|
|
217
|
+
id,
|
|
218
|
+
label: def.label,
|
|
219
|
+
family: def.family,
|
|
220
|
+
size: def.size
|
|
221
|
+
}));
|
|
222
|
+
function isCirclePattern(preset) {
|
|
223
|
+
const id = resolvePatternPresetId(preset);
|
|
224
|
+
return id !== "none" && PATTERN_PRESET_DEFS[id].family === "circles";
|
|
225
|
+
}
|
|
226
|
+
function isCirclesPattern(preset) {
|
|
227
|
+
return isCirclePattern(preset);
|
|
228
|
+
}
|
|
229
|
+
function patternPresetTileSize(preset, scale = 1) {
|
|
230
|
+
const id = resolvePatternPresetId(preset);
|
|
231
|
+
const def = id === "none" ? void 0 : PATTERN_PRESET_DEFS[id];
|
|
232
|
+
const size = (def?.size ?? 6) * scale;
|
|
233
|
+
return {
|
|
234
|
+
width: size,
|
|
235
|
+
height: size,
|
|
236
|
+
strokeWidth: def?.stroke ? scale : 0
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
function renderPatternPreset(preset, id, options = {}) {
|
|
240
|
+
const resolved = resolvePatternPresetId(preset);
|
|
241
|
+
if (resolved === "none") {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
const def = PATTERN_PRESET_DEFS[resolved];
|
|
245
|
+
const color = options.color ?? (preset === "accent" ? "#e879f9" : "var(--chart-1)");
|
|
246
|
+
return /* @__PURE__ */ jsxs(
|
|
247
|
+
PatternTile,
|
|
248
|
+
{
|
|
249
|
+
background: options.tileBackground,
|
|
250
|
+
color,
|
|
251
|
+
id,
|
|
252
|
+
opacity: options.opacity,
|
|
253
|
+
scale: options.scale,
|
|
254
|
+
size: def.size,
|
|
255
|
+
children: [
|
|
256
|
+
def.fill ? /* @__PURE__ */ jsx("path", { d: def.fill, fill: "currentColor" }) : null,
|
|
257
|
+
def.stroke ? /* @__PURE__ */ jsx(
|
|
258
|
+
"path",
|
|
259
|
+
{
|
|
260
|
+
d: def.stroke,
|
|
261
|
+
fill: "none",
|
|
262
|
+
stroke: "currentColor",
|
|
263
|
+
strokeWidth: options.strokeWidth ?? 1
|
|
264
|
+
}
|
|
265
|
+
) : null
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
function PatternPreset({
|
|
271
|
+
id,
|
|
272
|
+
preset = "diagonal-up",
|
|
273
|
+
...options
|
|
274
|
+
}) {
|
|
275
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderPatternPreset(preset, id, options) });
|
|
276
|
+
}
|
|
277
|
+
PatternPreset.displayName = "PatternPreset";
|
|
278
|
+
export {
|
|
279
|
+
PATTERN_PRESETS,
|
|
280
|
+
PATTERN_PRESET_IDS,
|
|
281
|
+
PatternPreset,
|
|
282
|
+
isCirclePattern,
|
|
283
|
+
isCirclesPattern,
|
|
284
|
+
patternPresetTileSize,
|
|
285
|
+
renderPatternPreset,
|
|
286
|
+
resolvePatternPresetId
|
|
287
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
function PatternTile({
|
|
4
|
+
id,
|
|
5
|
+
children,
|
|
6
|
+
size = 48,
|
|
7
|
+
scale = 1,
|
|
8
|
+
color = "var(--chart-1)",
|
|
9
|
+
opacity = 1,
|
|
10
|
+
background
|
|
11
|
+
}) {
|
|
12
|
+
const tile = size * scale;
|
|
13
|
+
return /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs(
|
|
14
|
+
"pattern",
|
|
15
|
+
{
|
|
16
|
+
height: tile,
|
|
17
|
+
id,
|
|
18
|
+
patternUnits: "userSpaceOnUse",
|
|
19
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
20
|
+
width: tile,
|
|
21
|
+
children: [
|
|
22
|
+
background ? /* @__PURE__ */ jsx("rect", { fill: background, height: size, width: size }) : null,
|
|
23
|
+
/* @__PURE__ */ jsx("g", { opacity, style: { color }, children })
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
) });
|
|
27
|
+
}
|
|
28
|
+
PatternTile.displayName = "PatternTile";
|
|
29
|
+
export {
|
|
30
|
+
PatternTile
|
|
31
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { Pattern } from "./pattern";
|
|
4
|
+
function Circles({
|
|
5
|
+
id,
|
|
6
|
+
width,
|
|
7
|
+
height,
|
|
8
|
+
radius = 2,
|
|
9
|
+
fill,
|
|
10
|
+
stroke,
|
|
11
|
+
strokeWidth,
|
|
12
|
+
strokeDasharray,
|
|
13
|
+
background,
|
|
14
|
+
complement = false,
|
|
15
|
+
className
|
|
16
|
+
}) {
|
|
17
|
+
let corners;
|
|
18
|
+
if (complement) {
|
|
19
|
+
corners = [
|
|
20
|
+
[0, 0],
|
|
21
|
+
[0, height],
|
|
22
|
+
[width, 0],
|
|
23
|
+
[width, height]
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsxs(Pattern, { height, id, width, children: [
|
|
27
|
+
!!background && /* @__PURE__ */ jsx("rect", { fill: background, height, width }),
|
|
28
|
+
/* @__PURE__ */ jsx(
|
|
29
|
+
"circle",
|
|
30
|
+
{
|
|
31
|
+
className: cn("visx-pattern-circle", className),
|
|
32
|
+
cx: width / 2,
|
|
33
|
+
cy: height / 2,
|
|
34
|
+
fill,
|
|
35
|
+
r: radius,
|
|
36
|
+
stroke,
|
|
37
|
+
strokeDasharray,
|
|
38
|
+
strokeWidth
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
corners?.map(([cornerX, cornerY]) => /* @__PURE__ */ jsx(
|
|
42
|
+
"circle",
|
|
43
|
+
{
|
|
44
|
+
className: cn(
|
|
45
|
+
"visx-pattern-circle visx-pattern-circle-complement",
|
|
46
|
+
className
|
|
47
|
+
),
|
|
48
|
+
cx: cornerX,
|
|
49
|
+
cy: cornerY,
|
|
50
|
+
fill,
|
|
51
|
+
r: radius,
|
|
52
|
+
stroke,
|
|
53
|
+
strokeDasharray,
|
|
54
|
+
strokeWidth
|
|
55
|
+
},
|
|
56
|
+
`${id}-complement-${cornerX}-${cornerY}`
|
|
57
|
+
))
|
|
58
|
+
] });
|
|
59
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
Circles
|
|
62
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { Path } from "./path";
|
|
4
|
+
function Hexagons({
|
|
5
|
+
id,
|
|
6
|
+
height,
|
|
7
|
+
fill,
|
|
8
|
+
stroke,
|
|
9
|
+
strokeWidth,
|
|
10
|
+
strokeDasharray,
|
|
11
|
+
strokeLinecap,
|
|
12
|
+
shapeRendering,
|
|
13
|
+
background,
|
|
14
|
+
className,
|
|
15
|
+
size = 3
|
|
16
|
+
}) {
|
|
17
|
+
const sqrtSize = Math.sqrt(size);
|
|
18
|
+
return /* @__PURE__ */ jsx(
|
|
19
|
+
Path,
|
|
20
|
+
{
|
|
21
|
+
background,
|
|
22
|
+
className: cn("visx-pattern-hexagon", className),
|
|
23
|
+
fill,
|
|
24
|
+
height: sqrtSize,
|
|
25
|
+
id,
|
|
26
|
+
path: `M ${height},0 l ${height},0 l ${height / 2},${height * sqrtSize / 2} l ${-height / 2},${height * sqrtSize / 2} l ${-height},0 l ${-height / 2},${-height * sqrtSize / 2} Z M 0,${height * sqrtSize / 2} l ${height / 2},0 M ${3 * height},${height * sqrtSize / 2} l ${-height / 2},0`,
|
|
27
|
+
shapeRendering,
|
|
28
|
+
stroke,
|
|
29
|
+
strokeDasharray,
|
|
30
|
+
strokeLinecap,
|
|
31
|
+
strokeWidth,
|
|
32
|
+
width: size
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
Hexagons
|
|
38
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Circles } from "./circles";
|
|
2
|
+
import { PatternOrientation } from "./constants";
|
|
3
|
+
import { Hexagons } from "./hexagons";
|
|
4
|
+
import { Lines } from "./lines";
|
|
5
|
+
import { Path } from "./path";
|
|
6
|
+
import { Pattern } from "./pattern";
|
|
7
|
+
import { Waves } from "./waves";
|
|
8
|
+
export {
|
|
9
|
+
Pattern,
|
|
10
|
+
Circles as PatternCircles,
|
|
11
|
+
Hexagons as PatternHexagons,
|
|
12
|
+
Lines as PatternLines,
|
|
13
|
+
PatternOrientation,
|
|
14
|
+
Path as PatternPath,
|
|
15
|
+
Waves as PatternWaves
|
|
16
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { PatternOrientation } from "./constants";
|
|
4
|
+
import { Pattern } from "./pattern";
|
|
5
|
+
function pathForOrientation({
|
|
6
|
+
height,
|
|
7
|
+
orientation
|
|
8
|
+
}) {
|
|
9
|
+
switch (orientation) {
|
|
10
|
+
case PatternOrientation.horizontal:
|
|
11
|
+
return `M 0,${height / 2} l ${height},0`;
|
|
12
|
+
case PatternOrientation.diagonal:
|
|
13
|
+
return `M 0,${height} l ${height},${-height} M ${-height / 4},${height / 4} l ${height / 2},${-height / 2}
|
|
14
|
+
M ${3 / 4 * height},${5 / 4 * height} l ${height / 2},${-height / 2}`;
|
|
15
|
+
case PatternOrientation.diagonalRightToLeft:
|
|
16
|
+
return `M 0,0 l ${height},${height}
|
|
17
|
+
M ${-height / 4},${3 / 4 * height} l ${height / 2},${height / 2}
|
|
18
|
+
M ${3 / 4 * height},${-height / 4} l ${height / 2},${height / 2}`;
|
|
19
|
+
default:
|
|
20
|
+
return `M ${height / 2}, 0 l 0, ${height}`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function Lines({
|
|
24
|
+
id,
|
|
25
|
+
width,
|
|
26
|
+
height,
|
|
27
|
+
stroke,
|
|
28
|
+
strokeWidth,
|
|
29
|
+
strokeDasharray,
|
|
30
|
+
strokeLinecap = "square",
|
|
31
|
+
shapeRendering = "auto",
|
|
32
|
+
orientation = ["vertical"],
|
|
33
|
+
background,
|
|
34
|
+
className
|
|
35
|
+
}) {
|
|
36
|
+
const orientations = Array.isArray(orientation) ? orientation : [orientation];
|
|
37
|
+
return /* @__PURE__ */ jsxs(Pattern, { height, id, width, children: [
|
|
38
|
+
!!background && /* @__PURE__ */ jsx(
|
|
39
|
+
"rect",
|
|
40
|
+
{
|
|
41
|
+
className: cn("visx-pattern-line-background"),
|
|
42
|
+
fill: background,
|
|
43
|
+
height,
|
|
44
|
+
width
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
orientations.map((o, i) => /* @__PURE__ */ jsx(
|
|
48
|
+
"path",
|
|
49
|
+
{
|
|
50
|
+
className: cn("visx-pattern-line", className),
|
|
51
|
+
d: pathForOrientation({ orientation: o, height }),
|
|
52
|
+
shapeRendering,
|
|
53
|
+
stroke,
|
|
54
|
+
strokeDasharray,
|
|
55
|
+
strokeLinecap,
|
|
56
|
+
strokeWidth
|
|
57
|
+
},
|
|
58
|
+
`visx-${id}-line-${o}-${i}`
|
|
59
|
+
))
|
|
60
|
+
] });
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
Lines,
|
|
64
|
+
pathForOrientation
|
|
65
|
+
};
|