@nous-research/ui 0.13.2 → 0.14.0
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/dist/assets/filler-bg0.webp +0 -0
- package/dist/assets.d.ts +38 -0
- package/dist/fonts.d.ts +0 -1
- package/dist/fonts.js +5 -7
- package/dist/hooks/use-capped-frame.d.ts +0 -1
- package/dist/hooks/use-capped-frame.js +12 -13
- package/dist/hooks/use-css-var-dims.d.ts +0 -1
- package/dist/hooks/use-css-var-dims.js +26 -21
- package/dist/hooks/use-gpu-tier.d.ts +0 -1
- package/dist/hooks/use-gpu-tier.js +90 -110
- package/dist/hooks/use-render-loop.d.ts +0 -1
- package/dist/hooks/use-render-loop.js +58 -58
- package/dist/hooks/use-smooth-controls.d.ts +0 -1
- package/dist/hooks/use-smooth-controls.js +204 -206
- package/dist/index.d.ts +0 -1
- package/dist/index.js +84 -58
- package/dist/ui/basic-page.d.ts +1 -2
- package/dist/ui/basic-page.js +15 -7
- package/dist/ui/components/animated-count.d.ts +1 -2
- package/dist/ui/components/animated-count.js +109 -85
- package/dist/ui/components/ascii.d.ts +2 -3
- package/dist/ui/components/ascii.js +75 -59
- package/dist/ui/components/badge.d.ts +1 -2
- package/dist/ui/components/badge.js +35 -18
- package/dist/ui/components/badges/nous-girl.d.ts +1 -2
- package/dist/ui/components/badges/nous-girl.js +80 -3
- package/dist/ui/components/blend-mode.d.ts +1 -2
- package/dist/ui/components/blend-mode.js +55 -63
- package/dist/ui/components/blink.d.ts +1 -2
- package/dist/ui/components/blink.js +15 -6
- package/dist/ui/components/button.d.ts +2 -3
- package/dist/ui/components/button.js +139 -90
- package/dist/ui/components/command-block.d.ts +2 -3
- package/dist/ui/components/command-block.js +52 -24
- package/dist/ui/components/cursor.d.ts +1 -2
- package/dist/ui/components/cursor.js +93 -54
- package/dist/ui/components/dropdown-menu.d.ts +1 -2
- package/dist/ui/components/dropdown-menu.js +99 -51
- package/dist/ui/components/fit-text/index.d.ts +0 -1
- package/dist/ui/components/fit-text/index.js +21 -13
- package/dist/ui/components/graphs/bar-chart.d.ts +1 -2
- package/dist/ui/components/graphs/bar-chart.js +116 -63
- package/dist/ui/components/graphs/index.d.ts +0 -1
- package/dist/ui/components/graphs/index.js +3 -4
- package/dist/ui/components/graphs/line-chart.d.ts +1 -2
- package/dist/ui/components/graphs/line-chart.js +159 -102
- package/dist/ui/components/graphs/utils.d.ts +2 -3
- package/dist/ui/components/graphs/utils.js +147 -114
- package/dist/ui/components/grid/index.d.ts +0 -1
- package/dist/ui/components/grid/index.js +12 -9
- package/dist/ui/components/hover-bg.d.ts +0 -1
- package/dist/ui/components/hover-bg.js +11 -6
- package/dist/ui/components/icons/arrow.d.ts +1 -2
- package/dist/ui/components/icons/arrow.js +42 -5
- package/dist/ui/components/icons/chevron.d.ts +1 -2
- package/dist/ui/components/icons/chevron.js +49 -5
- package/dist/ui/components/icons/discord.d.ts +1 -2
- package/dist/ui/components/icons/discord.js +12 -4
- package/dist/ui/components/icons/eye.d.ts +1 -2
- package/dist/ui/components/icons/eye.js +5 -3
- package/dist/ui/components/icons/gear.d.ts +1 -2
- package/dist/ui/components/icons/gear.js +28 -14
- package/dist/ui/components/icons/github.d.ts +1 -2
- package/dist/ui/components/icons/github.js +12 -4
- package/dist/ui/components/icons/hamburger.d.ts +1 -2
- package/dist/ui/components/icons/hamburger.js +54 -5
- package/dist/ui/components/icons/heart.d.ts +1 -2
- package/dist/ui/components/icons/heart.js +8 -3
- package/dist/ui/components/icons/index.d.ts +0 -1
- package/dist/ui/components/icons/index.js +11 -12
- package/dist/ui/components/icons/link.d.ts +1 -2
- package/dist/ui/components/icons/link.js +10 -3
- package/dist/ui/components/icons/minus.d.ts +1 -2
- package/dist/ui/components/icons/minus.js +10 -3
- package/dist/ui/components/icons/search.d.ts +1 -2
- package/dist/ui/components/icons/search.js +30 -3
- package/dist/ui/components/image-distortion.d.ts +1 -2
- package/dist/ui/components/image-distortion.js +300 -265
- package/dist/ui/components/leva-client.d.ts +1 -2
- package/dist/ui/components/leva-client.js +9 -10
- package/dist/ui/components/list-item.d.ts +0 -1
- package/dist/ui/components/list-item.js +26 -10
- package/dist/ui/components/modal/index.d.ts +1 -2
- package/dist/ui/components/modal/index.js +33 -14
- package/dist/ui/components/overlays/blend-modes.d.ts +0 -1
- package/dist/ui/components/overlays/blend-modes.js +11 -12
- package/dist/ui/components/overlays/glitch.d.ts +1 -2
- package/dist/ui/components/overlays/glitch.js +115 -110
- package/dist/ui/components/overlays/greys.d.ts +1 -2
- package/dist/ui/components/overlays/greys.js +200 -179
- package/dist/ui/components/overlays/index.d.ts +1 -2
- package/dist/ui/components/overlays/index.js +31 -17
- package/dist/ui/components/overlays/lens-layers.d.ts +1 -2
- package/dist/ui/components/overlays/lens-layers.js +89 -65
- package/dist/ui/components/overlays/lens.d.ts +0 -1
- package/dist/ui/components/overlays/lens.js +46 -52
- package/dist/ui/components/overlays/noise.d.ts +1 -2
- package/dist/ui/components/overlays/noise.js +112 -113
- package/dist/ui/components/overlays/vignette.d.ts +1 -2
- package/dist/ui/components/overlays/vignette.js +44 -38
- package/dist/ui/components/poster.d.ts +1 -2
- package/dist/ui/components/poster.js +240 -87
- package/dist/ui/components/progress.d.ts +1 -2
- package/dist/ui/components/progress.js +52 -12
- package/dist/ui/components/scene-canvas.d.ts +1 -2
- package/dist/ui/components/scene-canvas.js +169 -119
- package/dist/ui/components/scramble.d.ts +1 -2
- package/dist/ui/components/scramble.js +60 -59
- package/dist/ui/components/segmented.d.ts +2 -3
- package/dist/ui/components/segmented.js +47 -12
- package/dist/ui/components/select.d.ts +1 -2
- package/dist/ui/components/select.js +207 -120
- package/dist/ui/components/selection-switcher.d.ts +0 -1
- package/dist/ui/components/selection-switcher.js +29 -25
- package/dist/ui/components/shader.d.ts +1 -2
- package/dist/ui/components/shader.js +56 -38
- package/dist/ui/components/socials.d.ts +1 -2
- package/dist/ui/components/socials.js +18 -7
- package/dist/ui/components/spinner.d.ts +1 -2
- package/dist/ui/components/spinner.js +36 -25
- package/dist/ui/components/stats.d.ts +1 -2
- package/dist/ui/components/stats.js +33 -9
- package/dist/ui/components/switch.d.ts +0 -1
- package/dist/ui/components/switch.js +35 -11
- package/dist/ui/components/tabs.d.ts +3 -4
- package/dist/ui/components/tabs.js +38 -12
- package/dist/ui/components/terminal-demo.d.ts +1 -2
- package/dist/ui/components/terminal-demo.js +119 -74
- package/dist/ui/components/theme-toggle.d.ts +1 -2
- package/dist/ui/components/theme-toggle.js +63 -8
- package/dist/ui/components/tier-card.d.ts +1 -2
- package/dist/ui/components/tier-card.js +144 -24
- package/dist/ui/components/tv.d.ts +1 -2
- package/dist/ui/components/tv.js +138 -90
- package/dist/ui/components/typography/h1.d.ts +0 -1
- package/dist/ui/components/typography/h1.js +17 -8
- package/dist/ui/components/typography/h2.d.ts +0 -1
- package/dist/ui/components/typography/h2.js +17 -8
- package/dist/ui/components/typography/index.d.ts +0 -1
- package/dist/ui/components/typography/index.js +35 -24
- package/dist/ui/components/typography/legend.d.ts +1 -2
- package/dist/ui/components/typography/legend.js +18 -6
- package/dist/ui/components/typography/small.d.ts +0 -1
- package/dist/ui/components/typography/small.js +8 -7
- package/dist/ui/components/watchlist.d.ts +1 -2
- package/dist/ui/components/watchlist.js +77 -25
- package/dist/ui/fonts.css +7 -7
- package/dist/ui/footer.d.ts +1 -2
- package/dist/ui/footer.js +61 -25
- package/dist/ui/header.d.ts +1 -2
- package/dist/ui/header.js +255 -60
- package/dist/ui/layout-wrapper.d.ts +1 -2
- package/dist/ui/layout-wrapper.js +5 -4
- package/dist/utils/color.d.ts +0 -1
- package/dist/utils/color.js +8 -9
- package/dist/utils/index.d.ts +0 -1
- package/dist/utils/index.js +37 -38
- package/dist/utils/poly.d.ts +0 -1
- package/dist/utils/poly.js +1 -2
- package/package.json +41 -24
- package/dist/assets/filler-bg0.jpg +0 -0
- package/dist/fonts.d.ts.map +0 -1
- package/dist/fonts.js.map +0 -1
- package/dist/hooks/use-capped-frame.d.ts.map +0 -1
- package/dist/hooks/use-capped-frame.js.map +0 -1
- package/dist/hooks/use-css-var-dims.d.ts.map +0 -1
- package/dist/hooks/use-css-var-dims.js.map +0 -1
- package/dist/hooks/use-gpu-tier.d.ts.map +0 -1
- package/dist/hooks/use-gpu-tier.js.map +0 -1
- package/dist/hooks/use-render-loop.d.ts.map +0 -1
- package/dist/hooks/use-render-loop.js.map +0 -1
- package/dist/hooks/use-smooth-controls.d.ts.map +0 -1
- package/dist/hooks/use-smooth-controls.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/ui/basic-page.d.ts.map +0 -1
- package/dist/ui/basic-page.js.map +0 -1
- package/dist/ui/components/animated-count.d.ts.map +0 -1
- package/dist/ui/components/animated-count.js.map +0 -1
- package/dist/ui/components/ascii.d.ts.map +0 -1
- package/dist/ui/components/ascii.js.map +0 -1
- package/dist/ui/components/badge.d.ts.map +0 -1
- package/dist/ui/components/badge.js.map +0 -1
- package/dist/ui/components/badges/nous-girl.d.ts.map +0 -1
- package/dist/ui/components/badges/nous-girl.js.map +0 -1
- package/dist/ui/components/blend-mode.d.ts.map +0 -1
- package/dist/ui/components/blend-mode.js.map +0 -1
- package/dist/ui/components/blink.d.ts.map +0 -1
- package/dist/ui/components/blink.js.map +0 -1
- package/dist/ui/components/button.d.ts.map +0 -1
- package/dist/ui/components/button.js.map +0 -1
- package/dist/ui/components/command-block.d.ts.map +0 -1
- package/dist/ui/components/command-block.js.map +0 -1
- package/dist/ui/components/cursor.d.ts.map +0 -1
- package/dist/ui/components/cursor.js.map +0 -1
- package/dist/ui/components/dropdown-menu.d.ts.map +0 -1
- package/dist/ui/components/dropdown-menu.js.map +0 -1
- package/dist/ui/components/fit-text/index.d.ts.map +0 -1
- package/dist/ui/components/fit-text/index.js.map +0 -1
- package/dist/ui/components/graphs/bar-chart.d.ts.map +0 -1
- package/dist/ui/components/graphs/bar-chart.js.map +0 -1
- package/dist/ui/components/graphs/index.d.ts.map +0 -1
- package/dist/ui/components/graphs/index.js.map +0 -1
- package/dist/ui/components/graphs/line-chart.d.ts.map +0 -1
- package/dist/ui/components/graphs/line-chart.js.map +0 -1
- package/dist/ui/components/graphs/utils.d.ts.map +0 -1
- package/dist/ui/components/graphs/utils.js.map +0 -1
- package/dist/ui/components/grid/index.d.ts.map +0 -1
- package/dist/ui/components/grid/index.js.map +0 -1
- package/dist/ui/components/hover-bg.d.ts.map +0 -1
- package/dist/ui/components/hover-bg.js.map +0 -1
- package/dist/ui/components/icons/arrow.d.ts.map +0 -1
- package/dist/ui/components/icons/arrow.js.map +0 -1
- package/dist/ui/components/icons/chevron.d.ts.map +0 -1
- package/dist/ui/components/icons/chevron.js.map +0 -1
- package/dist/ui/components/icons/discord.d.ts.map +0 -1
- package/dist/ui/components/icons/discord.js.map +0 -1
- package/dist/ui/components/icons/eye.d.ts.map +0 -1
- package/dist/ui/components/icons/eye.js.map +0 -1
- package/dist/ui/components/icons/gear.d.ts.map +0 -1
- package/dist/ui/components/icons/gear.js.map +0 -1
- package/dist/ui/components/icons/github.d.ts.map +0 -1
- package/dist/ui/components/icons/github.js.map +0 -1
- package/dist/ui/components/icons/hamburger.d.ts.map +0 -1
- package/dist/ui/components/icons/hamburger.js.map +0 -1
- package/dist/ui/components/icons/heart.d.ts.map +0 -1
- package/dist/ui/components/icons/heart.js.map +0 -1
- package/dist/ui/components/icons/index.d.ts.map +0 -1
- package/dist/ui/components/icons/index.js.map +0 -1
- package/dist/ui/components/icons/link.d.ts.map +0 -1
- package/dist/ui/components/icons/link.js.map +0 -1
- package/dist/ui/components/icons/minus.d.ts.map +0 -1
- package/dist/ui/components/icons/minus.js.map +0 -1
- package/dist/ui/components/icons/search.d.ts.map +0 -1
- package/dist/ui/components/icons/search.js.map +0 -1
- package/dist/ui/components/image-distortion.d.ts.map +0 -1
- package/dist/ui/components/image-distortion.js.map +0 -1
- package/dist/ui/components/leva-client.d.ts.map +0 -1
- package/dist/ui/components/leva-client.js.map +0 -1
- package/dist/ui/components/list-item.d.ts.map +0 -1
- package/dist/ui/components/list-item.js.map +0 -1
- package/dist/ui/components/modal/index.d.ts.map +0 -1
- package/dist/ui/components/modal/index.js.map +0 -1
- package/dist/ui/components/overlays/blend-modes.d.ts.map +0 -1
- package/dist/ui/components/overlays/blend-modes.js.map +0 -1
- package/dist/ui/components/overlays/glitch.d.ts.map +0 -1
- package/dist/ui/components/overlays/glitch.js.map +0 -1
- package/dist/ui/components/overlays/greys.d.ts.map +0 -1
- package/dist/ui/components/overlays/greys.js.map +0 -1
- package/dist/ui/components/overlays/index.d.ts.map +0 -1
- package/dist/ui/components/overlays/index.js.map +0 -1
- package/dist/ui/components/overlays/lens-layers.d.ts.map +0 -1
- package/dist/ui/components/overlays/lens-layers.js.map +0 -1
- package/dist/ui/components/overlays/lens.d.ts.map +0 -1
- package/dist/ui/components/overlays/lens.js.map +0 -1
- package/dist/ui/components/overlays/noise.d.ts.map +0 -1
- package/dist/ui/components/overlays/noise.js.map +0 -1
- package/dist/ui/components/overlays/vignette.d.ts.map +0 -1
- package/dist/ui/components/overlays/vignette.js.map +0 -1
- package/dist/ui/components/poster.d.ts.map +0 -1
- package/dist/ui/components/poster.js.map +0 -1
- package/dist/ui/components/progress.d.ts.map +0 -1
- package/dist/ui/components/progress.js.map +0 -1
- package/dist/ui/components/scene-canvas.d.ts.map +0 -1
- package/dist/ui/components/scene-canvas.js.map +0 -1
- package/dist/ui/components/scramble.d.ts.map +0 -1
- package/dist/ui/components/scramble.js.map +0 -1
- package/dist/ui/components/segmented.d.ts.map +0 -1
- package/dist/ui/components/segmented.js.map +0 -1
- package/dist/ui/components/select.d.ts.map +0 -1
- package/dist/ui/components/select.js.map +0 -1
- package/dist/ui/components/selection-switcher.d.ts.map +0 -1
- package/dist/ui/components/selection-switcher.js.map +0 -1
- package/dist/ui/components/shader.d.ts.map +0 -1
- package/dist/ui/components/shader.js.map +0 -1
- package/dist/ui/components/socials.d.ts.map +0 -1
- package/dist/ui/components/socials.js.map +0 -1
- package/dist/ui/components/spinner.d.ts.map +0 -1
- package/dist/ui/components/spinner.js.map +0 -1
- package/dist/ui/components/stats.d.ts.map +0 -1
- package/dist/ui/components/stats.js.map +0 -1
- package/dist/ui/components/switch.d.ts.map +0 -1
- package/dist/ui/components/switch.js.map +0 -1
- package/dist/ui/components/tabs.d.ts.map +0 -1
- package/dist/ui/components/tabs.js.map +0 -1
- package/dist/ui/components/terminal-demo.d.ts.map +0 -1
- package/dist/ui/components/terminal-demo.js.map +0 -1
- package/dist/ui/components/theme-toggle.d.ts.map +0 -1
- package/dist/ui/components/theme-toggle.js.map +0 -1
- package/dist/ui/components/tier-card.d.ts.map +0 -1
- package/dist/ui/components/tier-card.js.map +0 -1
- package/dist/ui/components/tv.d.ts.map +0 -1
- package/dist/ui/components/tv.js.map +0 -1
- package/dist/ui/components/typography/h1.d.ts.map +0 -1
- package/dist/ui/components/typography/h1.js.map +0 -1
- package/dist/ui/components/typography/h2.d.ts.map +0 -1
- package/dist/ui/components/typography/h2.js.map +0 -1
- package/dist/ui/components/typography/index.d.ts.map +0 -1
- package/dist/ui/components/typography/index.js.map +0 -1
- package/dist/ui/components/typography/legend.d.ts.map +0 -1
- package/dist/ui/components/typography/legend.js.map +0 -1
- package/dist/ui/components/typography/small.d.ts.map +0 -1
- package/dist/ui/components/typography/small.js.map +0 -1
- package/dist/ui/components/watchlist.d.ts.map +0 -1
- package/dist/ui/components/watchlist.js.map +0 -1
- package/dist/ui/footer.d.ts.map +0 -1
- package/dist/ui/footer.js.map +0 -1
- package/dist/ui/header.d.ts.map +0 -1
- package/dist/ui/header.js.map +0 -1
- package/dist/ui/layout-wrapper.d.ts.map +0 -1
- package/dist/ui/layout-wrapper.js.map +0 -1
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/color.js.map +0 -1
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/poly.d.ts.map +0 -1
- package/dist/utils/poly.js.map +0 -1
|
@@ -1,117 +1,174 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx
|
|
3
|
-
import * as Plot from
|
|
4
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from
|
|
5
|
-
import { cn } from
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as Plot from "@observablehq/plot";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { cn } from "../../../utils/index.js";
|
|
6
|
+
import {
|
|
7
|
+
accessor,
|
|
8
|
+
CHART_MARGINS,
|
|
9
|
+
CHART_STYLE,
|
|
10
|
+
Crosshair,
|
|
11
|
+
setupCrosshair,
|
|
12
|
+
stylePlot,
|
|
13
|
+
useDims,
|
|
14
|
+
withChartBlend
|
|
15
|
+
} from "./utils.js";
|
|
16
|
+
export const LineChart = withChartBlend(
|
|
17
|
+
({
|
|
18
|
+
backgroundColor: _,
|
|
19
|
+
className,
|
|
20
|
+
color: strokeColor,
|
|
21
|
+
curve = "natural",
|
|
22
|
+
data = [],
|
|
23
|
+
formatTooltip,
|
|
24
|
+
formatX: formatXProp,
|
|
25
|
+
formatY: formatYProp,
|
|
26
|
+
series = "series",
|
|
27
|
+
showArea = false,
|
|
28
|
+
x = "label",
|
|
29
|
+
xTicks,
|
|
30
|
+
y = "value",
|
|
31
|
+
yDomain = [0, 0.5],
|
|
32
|
+
yTicks = 4,
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
8
35
|
const ref = useRef(null);
|
|
9
36
|
const plotRef = useRef(null);
|
|
10
37
|
const [hovered, setHovered] = useState(null);
|
|
11
38
|
const [crosshair, setCrosshair] = useState({ x: null });
|
|
12
39
|
const dims = useDims(ref);
|
|
13
|
-
const formatX = useCallback(
|
|
14
|
-
|
|
15
|
-
|
|
40
|
+
const formatX = useCallback(
|
|
41
|
+
(v) => formatXProp?.(v) ?? (v >= 1e3 ? `${v / 1e3}k` : `${v}`),
|
|
42
|
+
[formatXProp]
|
|
43
|
+
);
|
|
44
|
+
const formatY = useCallback(
|
|
45
|
+
(v) => formatYProp?.(v) ?? `${Math.round(v * 100)}%`,
|
|
46
|
+
[formatYProp]
|
|
47
|
+
);
|
|
16
48
|
const getX = useMemo(() => accessor(x), [x]);
|
|
17
49
|
const getY = useMemo(() => accessor(y), [y]);
|
|
18
50
|
const getZ = useCallback((d) => d[series], [series]);
|
|
19
51
|
useEffect(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
52
|
+
if (!ref.current || !plotRef.current || !data.length || !dims.h || !dims.w) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
plotRef.current.innerHTML = "";
|
|
56
|
+
const hasSeries = data.some((d) => d[series] !== void 0);
|
|
57
|
+
const seriesIdx = hasSeries ? data.reduce(
|
|
58
|
+
(acc, d, i) => (acc[d[series]] ??= i, acc),
|
|
59
|
+
{}
|
|
60
|
+
) : {};
|
|
61
|
+
const n = Object.keys(seriesIdx).length;
|
|
62
|
+
const opacity = (d) => {
|
|
63
|
+
if (!hasSeries) {
|
|
64
|
+
return 1;
|
|
26
65
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const opacity = (d) => {
|
|
34
|
-
if (!hasSeries) {
|
|
35
|
-
return 1;
|
|
36
|
-
}
|
|
37
|
-
if (hovered) {
|
|
38
|
-
return d[series] === hovered[series] ? 1 : 0.2;
|
|
39
|
-
}
|
|
40
|
-
return 1 - (seriesIdx[d[series]] / Math.max(n - 1, 1)) * 0.2;
|
|
41
|
-
};
|
|
42
|
-
const lineOpts = {
|
|
43
|
-
curve,
|
|
44
|
-
x: getX,
|
|
45
|
-
y: getY,
|
|
46
|
-
...(hasSeries && { z: getZ })
|
|
47
|
-
};
|
|
48
|
-
const plot = Plot.plot({
|
|
49
|
-
...CHART_MARGINS,
|
|
50
|
-
height: dims.h,
|
|
51
|
-
marks: [
|
|
52
|
-
...(showArea
|
|
53
|
-
? [
|
|
54
|
-
Plot.areaY(data, {
|
|
55
|
-
...lineOpts,
|
|
56
|
-
fill: strokeColor,
|
|
57
|
-
fillOpacity: 0.15,
|
|
58
|
-
y1: yDomain[0]
|
|
59
|
-
})
|
|
60
|
-
]
|
|
61
|
-
: []),
|
|
62
|
-
Plot.lineY(data, {
|
|
63
|
-
...lineOpts,
|
|
64
|
-
stroke: 'transparent',
|
|
65
|
-
strokeWidth: 16
|
|
66
|
-
}),
|
|
67
|
-
Plot.lineY(data, {
|
|
68
|
-
...lineOpts,
|
|
69
|
-
stroke: strokeColor,
|
|
70
|
-
strokeOpacity: opacity,
|
|
71
|
-
strokeWidth: 1.5
|
|
72
|
-
})
|
|
73
|
-
],
|
|
74
|
-
style: { ...CHART_STYLE, fontStretch: 'expanded' },
|
|
75
|
-
width: dims.w,
|
|
76
|
-
x: { label: null, tickFormat: formatX, ticks: xTicks },
|
|
77
|
-
y: {
|
|
78
|
-
domain: yDomain,
|
|
79
|
-
grid: true,
|
|
80
|
-
label: null,
|
|
81
|
-
tickFormat: formatY,
|
|
82
|
-
ticks: yTicks
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
plot.addEventListener('input', () => setHovered(plot.value));
|
|
86
|
-
stylePlot(plot);
|
|
87
|
-
plot.querySelectorAll('g[aria-label="line"] path').forEach(el => Object.assign(el.style, {
|
|
88
|
-
transition: 'stroke-opacity 0.2s'
|
|
89
|
-
}));
|
|
90
|
-
plotRef.current.appendChild(plot);
|
|
91
|
-
const cleanup = setupCrosshair(ref.current, data, d => getX(d), getY, yDomain, d => formatTooltip?.(d) ?? `${formatX(getX(d))}: ${formatY(getY(d))}`, setCrosshair, hasSeries ? d => getZ(d) : undefined);
|
|
92
|
-
return () => {
|
|
93
|
-
cleanup();
|
|
94
|
-
plot.parentNode && plot.remove();
|
|
95
|
-
};
|
|
96
|
-
}, [
|
|
66
|
+
if (hovered) {
|
|
67
|
+
return d[series] === hovered[series] ? 1 : 0.2;
|
|
68
|
+
}
|
|
69
|
+
return 1 - seriesIdx[d[series]] / Math.max(n - 1, 1) * 0.2;
|
|
70
|
+
};
|
|
71
|
+
const lineOpts = {
|
|
97
72
|
curve,
|
|
73
|
+
x: getX,
|
|
74
|
+
y: getY,
|
|
75
|
+
...hasSeries && { z: getZ }
|
|
76
|
+
};
|
|
77
|
+
const plot = Plot.plot({
|
|
78
|
+
...CHART_MARGINS,
|
|
79
|
+
height: dims.h,
|
|
80
|
+
marks: [
|
|
81
|
+
...showArea ? [
|
|
82
|
+
Plot.areaY(data, {
|
|
83
|
+
...lineOpts,
|
|
84
|
+
fill: strokeColor,
|
|
85
|
+
fillOpacity: 0.15,
|
|
86
|
+
y1: yDomain[0]
|
|
87
|
+
})
|
|
88
|
+
] : [],
|
|
89
|
+
Plot.lineY(data, {
|
|
90
|
+
...lineOpts,
|
|
91
|
+
stroke: "transparent",
|
|
92
|
+
strokeWidth: 16
|
|
93
|
+
}),
|
|
94
|
+
Plot.lineY(data, {
|
|
95
|
+
...lineOpts,
|
|
96
|
+
stroke: strokeColor,
|
|
97
|
+
strokeOpacity: opacity,
|
|
98
|
+
strokeWidth: 1.5
|
|
99
|
+
})
|
|
100
|
+
],
|
|
101
|
+
style: { ...CHART_STYLE, fontStretch: "expanded" },
|
|
102
|
+
width: dims.w,
|
|
103
|
+
x: { label: null, tickFormat: formatX, ticks: xTicks },
|
|
104
|
+
y: {
|
|
105
|
+
domain: yDomain,
|
|
106
|
+
grid: true,
|
|
107
|
+
label: null,
|
|
108
|
+
tickFormat: formatY,
|
|
109
|
+
ticks: yTicks
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
plot.addEventListener("input", () => setHovered(plot.value));
|
|
113
|
+
stylePlot(plot);
|
|
114
|
+
plot.querySelectorAll('g[aria-label="line"] path').forEach(
|
|
115
|
+
(el) => Object.assign(el.style, {
|
|
116
|
+
transition: "stroke-opacity 0.2s"
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
plotRef.current.appendChild(plot);
|
|
120
|
+
const cleanup = setupCrosshair(
|
|
121
|
+
ref.current,
|
|
98
122
|
data,
|
|
99
|
-
|
|
100
|
-
dims.w,
|
|
101
|
-
formatTooltip,
|
|
102
|
-
formatX,
|
|
103
|
-
formatY,
|
|
104
|
-
getX,
|
|
123
|
+
(d) => getX(d),
|
|
105
124
|
getY,
|
|
106
|
-
getZ,
|
|
107
|
-
hovered,
|
|
108
|
-
series,
|
|
109
|
-
showArea,
|
|
110
|
-
strokeColor,
|
|
111
|
-
xTicks,
|
|
112
125
|
yDomain,
|
|
113
|
-
|
|
126
|
+
(d) => formatTooltip?.(d) ?? `${formatX(getX(d))}: ${formatY(getY(d))}`,
|
|
127
|
+
setCrosshair,
|
|
128
|
+
hasSeries ? (d) => getZ(d) : void 0
|
|
129
|
+
);
|
|
130
|
+
return () => {
|
|
131
|
+
cleanup();
|
|
132
|
+
plot.parentNode && plot.remove();
|
|
133
|
+
};
|
|
134
|
+
}, [
|
|
135
|
+
curve,
|
|
136
|
+
data,
|
|
137
|
+
dims.h,
|
|
138
|
+
dims.w,
|
|
139
|
+
formatTooltip,
|
|
140
|
+
formatX,
|
|
141
|
+
formatY,
|
|
142
|
+
getX,
|
|
143
|
+
getY,
|
|
144
|
+
getZ,
|
|
145
|
+
hovered,
|
|
146
|
+
series,
|
|
147
|
+
showArea,
|
|
148
|
+
strokeColor,
|
|
149
|
+
xTicks,
|
|
150
|
+
yDomain,
|
|
151
|
+
yTicks
|
|
114
152
|
]);
|
|
115
|
-
return
|
|
116
|
-
|
|
117
|
-
|
|
153
|
+
return /* @__PURE__ */ jsxs(
|
|
154
|
+
"div",
|
|
155
|
+
{
|
|
156
|
+
className: cn("relative aspect-4/1 w-full overflow-clip", className),
|
|
157
|
+
ref,
|
|
158
|
+
...props,
|
|
159
|
+
children: [
|
|
160
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0", ref: plotRef }),
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
162
|
+
Crosshair,
|
|
163
|
+
{
|
|
164
|
+
color: strokeColor,
|
|
165
|
+
containerWidth: dims.w,
|
|
166
|
+
height: dims.h,
|
|
167
|
+
...crosshair
|
|
168
|
+
}
|
|
169
|
+
)
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
);
|
|
@@ -23,10 +23,10 @@ export declare const Crosshair: ({ color, containerWidth, height, points, x }: C
|
|
|
23
23
|
color?: string;
|
|
24
24
|
containerWidth: number;
|
|
25
25
|
height: number;
|
|
26
|
-
}) => import("react
|
|
26
|
+
}) => import("react").JSX.Element | null;
|
|
27
27
|
export declare const setupCrosshair: <T extends DataPoint>(container: HTMLElement, data: T[], getX: (d: T) => number, getY: (d: T) => number, yDomain: [number, number], formatTooltip: (d: T) => string, onUpdate: (state: CrosshairState) => void, getZ?: (d: T) => unknown) => () => void;
|
|
28
28
|
export declare const withChartBlend: <P extends BlendModeProps>(Component: ComponentType<P>) => {
|
|
29
|
-
(props: Omit<P, keyof BlendColors>): import("react
|
|
29
|
+
(props: Omit<P, keyof BlendColors>): import("react").JSX.Element;
|
|
30
30
|
displayName: string;
|
|
31
31
|
};
|
|
32
32
|
export type DataPoint = Record<string, unknown>;
|
|
@@ -50,4 +50,3 @@ export interface ChartProps<T = DataPoint> extends Omit<HTMLAttributes<HTMLDivEl
|
|
|
50
50
|
yDomain?: [number, number];
|
|
51
51
|
yTicks?: number | number[];
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,128 +1,161 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import {
|
|
4
|
+
useEffect,
|
|
5
|
+
useState
|
|
6
|
+
} from "react";
|
|
7
|
+
import { useSmoothControls } from "../../../hooks/use-smooth-controls.js";
|
|
8
|
+
export const accessor = (key) => typeof key === "function" ? key : (d) => d[key];
|
|
6
9
|
export const CHART_MARGINS = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
marginBottom: 24,
|
|
11
|
+
marginLeft: 36,
|
|
12
|
+
marginRight: 12,
|
|
13
|
+
marginTop: 8
|
|
11
14
|
};
|
|
12
15
|
export const CHART_STYLE = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
background: "transparent",
|
|
17
|
+
color: "var(--midground)",
|
|
18
|
+
fontFamily: "var(--font-mono), monospace",
|
|
19
|
+
fontSize: "11px",
|
|
20
|
+
overflow: "hidden"
|
|
18
21
|
};
|
|
19
22
|
export const stylePlot = (plot) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
plot.querySelectorAll('[aria-label*="grid"] line').forEach(
|
|
24
|
+
(el) => Object.assign(el.style, {
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeDasharray: "2,4",
|
|
27
|
+
strokeOpacity: "0.3"
|
|
28
|
+
})
|
|
29
|
+
);
|
|
30
|
+
plot.querySelectorAll("text").forEach(
|
|
31
|
+
(el) => Object.assign(el.style, {
|
|
32
|
+
fontSize: "11px",
|
|
33
|
+
fontWeight: "600"
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
plot.querySelectorAll('[aria-label*="label"] text').forEach((el) => el.style.opacity = "0.4");
|
|
37
|
+
const svg = plot.querySelector("svg");
|
|
38
|
+
svg && (svg.style.display = "block");
|
|
34
39
|
};
|
|
35
40
|
export const useDims = (ref) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
const update = () => {
|
|
42
|
-
const { height: h, width: w } = ref.current.getBoundingClientRect();
|
|
43
|
-
const [rh, rw] = [Math.round(h), Math.round(w)];
|
|
44
|
-
rh &&
|
|
45
|
-
rw &&
|
|
46
|
-
setDims(st => (st.h === rh && st.w === rw ? st : { h: rh, w: rw }));
|
|
47
|
-
};
|
|
48
|
-
update();
|
|
49
|
-
const ro = new ResizeObserver(update);
|
|
50
|
-
ro.observe(ref.current);
|
|
51
|
-
return () => ro.disconnect();
|
|
52
|
-
}, [ref]);
|
|
53
|
-
return dims;
|
|
54
|
-
};
|
|
55
|
-
export const Crosshair = ({ color = 'var(--foreground)', containerWidth, height, points, x }) => {
|
|
56
|
-
if (x === null) {
|
|
57
|
-
return null;
|
|
41
|
+
const [dims, setDims] = useState({ h: 0, w: 0 });
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!ref.current) {
|
|
44
|
+
return;
|
|
58
45
|
}
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
const update = () => {
|
|
47
|
+
const { height: h, width: w } = ref.current.getBoundingClientRect();
|
|
48
|
+
const [rh, rw] = [Math.round(h), Math.round(w)];
|
|
49
|
+
rh && rw && setDims((st) => st.h === rh && st.w === rw ? st : { h: rh, w: rw });
|
|
50
|
+
};
|
|
51
|
+
update();
|
|
52
|
+
const ro = new ResizeObserver(update);
|
|
53
|
+
ro.observe(ref.current);
|
|
54
|
+
return () => ro.disconnect();
|
|
55
|
+
}, [ref]);
|
|
56
|
+
return dims;
|
|
57
|
+
};
|
|
58
|
+
export const Crosshair = ({
|
|
59
|
+
color = "var(--foreground)",
|
|
60
|
+
containerWidth,
|
|
61
|
+
height,
|
|
62
|
+
points,
|
|
63
|
+
x
|
|
64
|
+
}) => {
|
|
65
|
+
if (x === null) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const nearRight = x > containerWidth * 0.7;
|
|
69
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"div",
|
|
72
|
+
{
|
|
73
|
+
className: "pointer-events-none absolute top-0 w-px",
|
|
74
|
+
style: { background: color, height, left: x, opacity: 0.4 }
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
points?.map((pt, i) => /* @__PURE__ */ jsx(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: "pointer-events-none absolute size-2 -translate-x-1/2 -translate-y-1/2 rounded-full",
|
|
81
|
+
style: { background: color, left: x, top: pt.dotY }
|
|
82
|
+
},
|
|
83
|
+
i
|
|
84
|
+
)),
|
|
85
|
+
points?.map((pt, i) => /* @__PURE__ */ jsx(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "tooltip absolute -translate-y-1/2",
|
|
89
|
+
style: {
|
|
90
|
+
left: nearRight ? void 0 : x + 12,
|
|
91
|
+
right: nearRight ? containerWidth - x + 12 : void 0,
|
|
92
|
+
top: pt.dotY
|
|
93
|
+
},
|
|
94
|
+
children: pt.tooltip
|
|
95
|
+
},
|
|
96
|
+
i
|
|
97
|
+
))
|
|
98
|
+
] });
|
|
65
99
|
};
|
|
66
100
|
export const setupCrosshair = (container, data, getX, getY, yDomain, formatTooltip, onUpdate, getZ) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
const { marginBottom, marginLeft, marginRight, marginTop } = CHART_MARGINS;
|
|
71
|
-
const seriesMap = data.reduce((m, d) => {
|
|
72
|
-
const key = getZ?.(d) ?? '__single__';
|
|
73
|
-
m.set(key, [...(m.get(key) ?? []), d]);
|
|
74
|
-
return m;
|
|
75
|
-
}, new Map());
|
|
76
|
-
const sortedSeries = [...seriesMap.values()].map(s => [...s].sort((a, b) => getX(a) - getX(b)));
|
|
77
|
-
const allX = data.map(getX);
|
|
78
|
-
const [xMin, xMax] = [Math.min(...allX), Math.max(...allX)];
|
|
79
|
-
const onMove = (e) => {
|
|
80
|
-
const rect = container.getBoundingClientRect();
|
|
81
|
-
const [localX, localY] = [e.clientX - rect.left, e.clientY - rect.top];
|
|
82
|
-
if (localX < 0 ||
|
|
83
|
-
localX > rect.width ||
|
|
84
|
-
localY < 0 ||
|
|
85
|
-
localY > rect.height) {
|
|
86
|
-
return onUpdate({ x: null });
|
|
87
|
-
}
|
|
88
|
-
const [chartLeft, chartRight] = [marginLeft, rect.width - marginRight];
|
|
89
|
-
const [chartTop, chartBottom] = [marginTop, rect.height - marginBottom];
|
|
90
|
-
if (localX < chartLeft || localX > chartRight) {
|
|
91
|
-
return onUpdate({ x: null });
|
|
92
|
-
}
|
|
93
|
-
const pct = (localX - chartLeft) / (chartRight - chartLeft);
|
|
94
|
-
const xVal = xMin + pct * (xMax - xMin);
|
|
95
|
-
const points = sortedSeries.map(sorted => {
|
|
96
|
-
const idx = sorted.findIndex(d => getX(d) >= xVal);
|
|
97
|
-
const [closest, yVal] = idx <= 0
|
|
98
|
-
? [sorted[0], getY(sorted[0])]
|
|
99
|
-
: idx >= sorted.length
|
|
100
|
-
? [sorted.at(-1), getY(sorted.at(-1))]
|
|
101
|
-
: (() => {
|
|
102
|
-
const [left, right] = [sorted[idx - 1], sorted[idx]];
|
|
103
|
-
const t = (xVal - getX(left)) / (getX(right) - getX(left));
|
|
104
|
-
return [
|
|
105
|
-
t < 0.5 ? left : right,
|
|
106
|
-
getY(left) + t * (getY(right) - getY(left))
|
|
107
|
-
];
|
|
108
|
-
})();
|
|
109
|
-
const yPct = (yVal - yDomain[0]) / (yDomain[1] - yDomain[0]);
|
|
110
|
-
return {
|
|
111
|
-
dotY: chartBottom - yPct * (chartBottom - chartTop),
|
|
112
|
-
tooltip: formatTooltip(closest)
|
|
113
|
-
};
|
|
114
|
-
});
|
|
115
|
-
onUpdate({ points, x: localX });
|
|
101
|
+
if (!data.length) {
|
|
102
|
+
return () => {
|
|
116
103
|
};
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
}
|
|
105
|
+
const { marginBottom, marginLeft, marginRight, marginTop } = CHART_MARGINS;
|
|
106
|
+
const seriesMap = data.reduce((m, d) => {
|
|
107
|
+
const key = getZ?.(d) ?? "__single__";
|
|
108
|
+
m.set(key, [...m.get(key) ?? [], d]);
|
|
109
|
+
return m;
|
|
110
|
+
}, /* @__PURE__ */ new Map());
|
|
111
|
+
const sortedSeries = [...seriesMap.values()].map(
|
|
112
|
+
(s) => [...s].sort((a, b) => getX(a) - getX(b))
|
|
113
|
+
);
|
|
114
|
+
const allX = data.map(getX);
|
|
115
|
+
const [xMin, xMax] = [Math.min(...allX), Math.max(...allX)];
|
|
116
|
+
const onMove = (e) => {
|
|
117
|
+
const rect = container.getBoundingClientRect();
|
|
118
|
+
const [localX, localY] = [e.clientX - rect.left, e.clientY - rect.top];
|
|
119
|
+
if (localX < 0 || localX > rect.width || localY < 0 || localY > rect.height) {
|
|
120
|
+
return onUpdate({ x: null });
|
|
121
|
+
}
|
|
122
|
+
const [chartLeft, chartRight] = [marginLeft, rect.width - marginRight];
|
|
123
|
+
const [chartTop, chartBottom] = [marginTop, rect.height - marginBottom];
|
|
124
|
+
if (localX < chartLeft || localX > chartRight) {
|
|
125
|
+
return onUpdate({ x: null });
|
|
126
|
+
}
|
|
127
|
+
const pct = (localX - chartLeft) / (chartRight - chartLeft);
|
|
128
|
+
const xVal = xMin + pct * (xMax - xMin);
|
|
129
|
+
const points = sortedSeries.map((sorted) => {
|
|
130
|
+
const idx = sorted.findIndex((d) => getX(d) >= xVal);
|
|
131
|
+
const [closest, yVal] = idx <= 0 ? [sorted[0], getY(sorted[0])] : idx >= sorted.length ? [sorted.at(-1), getY(sorted.at(-1))] : (() => {
|
|
132
|
+
const [left, right] = [sorted[idx - 1], sorted[idx]];
|
|
133
|
+
const t = (xVal - getX(left)) / (getX(right) - getX(left));
|
|
134
|
+
return [
|
|
135
|
+
t < 0.5 ? left : right,
|
|
136
|
+
getY(left) + t * (getY(right) - getY(left))
|
|
137
|
+
];
|
|
138
|
+
})();
|
|
139
|
+
const yPct = (yVal - yDomain[0]) / (yDomain[1] - yDomain[0]);
|
|
140
|
+
return {
|
|
141
|
+
dotY: chartBottom - yPct * (chartBottom - chartTop),
|
|
142
|
+
tooltip: formatTooltip(closest)
|
|
143
|
+
};
|
|
144
|
+
});
|
|
145
|
+
onUpdate({ points, x: localX });
|
|
146
|
+
};
|
|
147
|
+
document.addEventListener("mousemove", onMove);
|
|
148
|
+
return () => document.removeEventListener("mousemove", onMove);
|
|
119
149
|
};
|
|
120
150
|
export const withChartBlend = (Component) => {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
151
|
+
const Wrapped = (props) => {
|
|
152
|
+
const { color } = useSmoothControls(
|
|
153
|
+
"Charts",
|
|
154
|
+
{ color: { value: "#709fea" } },
|
|
155
|
+
{ collapsed: true }
|
|
156
|
+
);
|
|
157
|
+
return /* @__PURE__ */ jsx(Component, { ...props, color });
|
|
158
|
+
};
|
|
159
|
+
Wrapped.displayName = `withChartBlend(${Component.displayName ?? Component.name})`;
|
|
160
|
+
return Wrapped;
|
|
127
161
|
};
|
|
128
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { createElement } from
|
|
2
|
-
import { cn, polyRef } from
|
|
3
|
-
export const Grid = polyRef(
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { cn, polyRef } from "../../../utils/index.js";
|
|
3
|
+
export const Grid = polyRef(
|
|
4
|
+
({ as, className, ...rest }, ref) => createElement(as ?? "div", {
|
|
4
5
|
...rest,
|
|
5
|
-
className: cn(
|
|
6
|
+
className: cn("g", className),
|
|
6
7
|
ref
|
|
7
|
-
})
|
|
8
|
-
|
|
8
|
+
})
|
|
9
|
+
);
|
|
10
|
+
export const Cell = polyRef(
|
|
11
|
+
({ as, className, ...rest }, ref) => createElement(as ?? "div", {
|
|
9
12
|
...rest,
|
|
10
|
-
className: cn(
|
|
13
|
+
className: cn("gc", className),
|
|
11
14
|
ref
|
|
12
|
-
})
|
|
13
|
-
|
|
15
|
+
})
|
|
16
|
+
);
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { createElement } from
|
|
2
|
-
import { cn, polyRef } from
|
|
3
|
-
export const HoverBg = polyRef(
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { cn, polyRef } from "../../utils/index.js";
|
|
3
|
+
export const HoverBg = polyRef(
|
|
4
|
+
({ as, className, ...rest }, ref) => createElement(as ?? "span", {
|
|
4
5
|
...rest,
|
|
5
|
-
className: cn(
|
|
6
|
+
className: cn(
|
|
7
|
+
"absolute inset-1 bg-midground pointer-events-none",
|
|
8
|
+
"opacity-5 transition-opacity duration-250 group-hover:opacity-5 opacity-0 group-hover:duration-0",
|
|
9
|
+
className
|
|
10
|
+
),
|
|
6
11
|
ref
|
|
7
|
-
})
|
|
8
|
-
|
|
12
|
+
})
|
|
13
|
+
);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { SVGProps } from 'react';
|
|
2
|
-
export declare function ArrowIcon({ className, direction, ...props }: ArrowIconProps): import("react
|
|
2
|
+
export declare function ArrowIcon({ className, direction, ...props }: ArrowIconProps): import("react").JSX.Element;
|
|
3
3
|
interface ArrowIconProps extends SVGProps<SVGSVGElement> {
|
|
4
4
|
direction?: 'down' | 'left' | 'right' | 'up';
|
|
5
5
|
}
|
|
6
6
|
export {};
|
|
7
|
-
//# sourceMappingURL=arrow.d.ts.map
|