impact-nova 3.0.0-alpha.20 → 3.0.0-alpha.22
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/_virtual/index.js +4 -4
- package/dist/_virtual/index2.js +4 -4
- package/dist/components/data/ag-grid-react/cell-renderers/editors/select-cell-editor.js +32 -31
- package/dist/components/data-display/chart/chart-heatmap-layout.d.ts +31 -0
- package/dist/components/data-display/chart/chart-heatmap-layout.js +72 -0
- package/dist/components/data-display/chart/chart.category-cluster-heatmap.stories-data.d.ts +1 -1
- package/dist/components/data-display/chart/chart.js +165 -150
- package/dist/components/data-display/chart/chart.types.d.ts +17 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid-play.d.ts +9 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.d.ts +32 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.js +93 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.layout.d.ts +46 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.layout.js +80 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.types.d.ts +54 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.variants.d.ts +18 -0
- package/dist/components/data-display/heatmap-grid/heatmap-grid.variants.js +80 -0
- package/dist/components/data-display/heatmap-grid/index.d.ts +3 -0
- package/dist/components/data-display/heatmap-grid/index.js +14 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-cell.d.ts +14 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-cell.js +39 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-context.d.ts +29 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-context.js +33 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-tooltip.d.ts +4 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-tooltip.js +49 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-viewport.d.ts +3 -0
- package/dist/components/data-display/heatmap-grid/internals/heatmap-grid-viewport.js +173 -0
- package/dist/components/data-display/heatmap-grid/internals/use-heatmap-grid-viewport.d.ts +12 -0
- package/dist/components/data-display/heatmap-grid/internals/use-heatmap-grid-viewport.js +161 -0
- package/dist/i18n/defaultMessages.d.ts +6 -0
- package/dist/i18n/defaultMessages.js +16 -11
- package/dist/i18n/locales/de.js +5 -0
- package/dist/i18n/locales/es.js +5 -0
- package/dist/i18n/locales/hi.js +5 -0
- package/dist/i18n/locales/kn.js +5 -0
- package/dist/impact-nova.css +1 -1
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const x = 36, d = 72, l = 152, m = 56, P = 112;
|
|
2
|
+
function c(e) {
|
|
3
|
+
return e.viewportPx <= 0 ? e.minSizePx : Math.max(e.minSizePx, e.viewportPx / Math.max(e.count, 1));
|
|
4
|
+
}
|
|
5
|
+
function w(e) {
|
|
6
|
+
const r = c({
|
|
7
|
+
count: e.columnCount,
|
|
8
|
+
viewportPx: Math.max(e.viewportWidthPx - e.rowHeaderWidthPx, 0),
|
|
9
|
+
minSizePx: e.minColumnSizePx
|
|
10
|
+
}), n = c({
|
|
11
|
+
count: e.rowCount,
|
|
12
|
+
viewportPx: Math.max(e.viewportHeightPx - e.columnHeaderHeightPx, 0),
|
|
13
|
+
minSizePx: e.minRowSizePx
|
|
14
|
+
}), t = e.rowHeaderWidthPx + r * e.columnCount, a = n * e.rowCount, o = e.isFetchingMore === !0 ? e.minRowSizePx : 0;
|
|
15
|
+
return {
|
|
16
|
+
rowSizePx: n,
|
|
17
|
+
columnSizePx: r,
|
|
18
|
+
contentWidthPx: t,
|
|
19
|
+
bodyHeightPx: a,
|
|
20
|
+
overflowsX: t > e.viewportWidthPx + 0.5,
|
|
21
|
+
overflowsY: a + e.columnHeaderHeightPx + o > e.viewportHeightPx + 0.5
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function i(e) {
|
|
25
|
+
const r = Math.max(e.columnHeaderHeightPx - 14, 24), n = Math.floor(
|
|
26
|
+
Math.min(e.columnSizePx - 10, r) * Math.SQRT2
|
|
27
|
+
);
|
|
28
|
+
return Math.max(n, 32);
|
|
29
|
+
}
|
|
30
|
+
function u(e) {
|
|
31
|
+
if (e.rowCount <= 0 || e.columnCount <= 0)
|
|
32
|
+
return null;
|
|
33
|
+
const r = e.rowCount - 1, n = e.columnCount - 1, { rowIndex: t, columnIndex: a } = e.current, o = { rowIndex: t, columnIndex: a };
|
|
34
|
+
switch (e.key) {
|
|
35
|
+
case "ArrowRight":
|
|
36
|
+
o.columnIndex += 1;
|
|
37
|
+
break;
|
|
38
|
+
case "ArrowLeft":
|
|
39
|
+
o.columnIndex -= 1;
|
|
40
|
+
break;
|
|
41
|
+
case "ArrowDown":
|
|
42
|
+
o.rowIndex += 1;
|
|
43
|
+
break;
|
|
44
|
+
case "ArrowUp":
|
|
45
|
+
o.rowIndex -= 1;
|
|
46
|
+
break;
|
|
47
|
+
case "Home":
|
|
48
|
+
o.columnIndex = 0, o.rowIndex = e.ctrlKey ? 0 : t;
|
|
49
|
+
break;
|
|
50
|
+
case "End":
|
|
51
|
+
o.columnIndex = n, o.rowIndex = e.ctrlKey ? r : t;
|
|
52
|
+
break;
|
|
53
|
+
default:
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return o.rowIndex < 0 || o.columnIndex < 0 || o.rowIndex > r || o.columnIndex > n ? null : o;
|
|
57
|
+
}
|
|
58
|
+
function I(e) {
|
|
59
|
+
return `${e.rowIndex}:${e.columnIndex}`;
|
|
60
|
+
}
|
|
61
|
+
function s(e) {
|
|
62
|
+
const r = e?.closest("[data-heatmap-cell]");
|
|
63
|
+
return r ? {
|
|
64
|
+
rowIndex: Number(r.dataset.rowIndex),
|
|
65
|
+
columnIndex: Number(r.dataset.columnIndex)
|
|
66
|
+
} : null;
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
m as HEATMAP_GRID_DEFAULT_COLUMN_HEADER_HEIGHT_PX,
|
|
70
|
+
d as HEATMAP_GRID_DEFAULT_MIN_COLUMN_SIZE_PX,
|
|
71
|
+
x as HEATMAP_GRID_DEFAULT_MIN_ROW_SIZE_PX,
|
|
72
|
+
l as HEATMAP_GRID_DEFAULT_ROW_HEADER_WIDTH_PX,
|
|
73
|
+
P as HEATMAP_GRID_HORIZONTAL_LABEL_MIN_COLUMN_PX,
|
|
74
|
+
I as readHeatmapGridCellKey,
|
|
75
|
+
s as readHeatmapGridCellPosition,
|
|
76
|
+
i as readHeatmapGridColumnLabelMaxWidthPx,
|
|
77
|
+
w as readHeatmapGridLayout,
|
|
78
|
+
c as readHeatmapGridTrackSizePx,
|
|
79
|
+
u as readNextHeatmapGridFocusCell
|
|
80
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
/** Semantic fill. Maps to feedback surface tokens; use `color` only for custom scales. */
|
|
3
|
+
export type HeatmapGridTone = "positive" | "warning" | "negative" | "neutral";
|
|
4
|
+
export type HeatmapGridCell = {
|
|
5
|
+
label: string;
|
|
6
|
+
tone?: HeatmapGridTone;
|
|
7
|
+
/** Custom background (CSS color or `var(--token)`). Wins over `tone`. */
|
|
8
|
+
color?: string;
|
|
9
|
+
/** Missing metric. Renders muted and ignores `tone` / `color`. */
|
|
10
|
+
isEmpty?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type HeatmapGridCellPosition = {
|
|
13
|
+
rowIndex: number;
|
|
14
|
+
columnIndex: number;
|
|
15
|
+
};
|
|
16
|
+
export type HeatmapGridProps = Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
17
|
+
rowCount: number;
|
|
18
|
+
columnCount: number;
|
|
19
|
+
getRowLabel: (rowIndex: number) => string;
|
|
20
|
+
getColumnLabel: (columnIndex: number) => string;
|
|
21
|
+
/** Called only for painted cells. Keep it O(1) (index into a dense array). */
|
|
22
|
+
getCell: (rowIndex: number, columnIndex: number) => HeatmapGridCell | undefined;
|
|
23
|
+
/** Replaces the cell label. Receives the resolved cell and its position. */
|
|
24
|
+
renderCell?: (cell: HeatmapGridCell, position: HeatmapGridCellPosition) => React.ReactNode;
|
|
25
|
+
/** Default tooltip body. `HeatmapGridTooltip` children override it. */
|
|
26
|
+
renderTooltip?: (position: HeatmapGridCellPosition) => React.ReactNode;
|
|
27
|
+
/** Row track floor. Rows stretch above this to fill the viewport. */
|
|
28
|
+
minRowSizePx?: number;
|
|
29
|
+
/** Column track floor. Columns stretch above this to fill the viewport. */
|
|
30
|
+
minColumnSizePx?: number;
|
|
31
|
+
rowHeaderWidthPx?: number;
|
|
32
|
+
columnHeaderHeightPx?: number;
|
|
33
|
+
/** More rows exist after `rowCount`. Enables `onEndReached`. */
|
|
34
|
+
hasMore?: boolean;
|
|
35
|
+
/** Next page is loading. Shows a skeleton row and pauses `onEndReached`. */
|
|
36
|
+
isFetchingMore?: boolean;
|
|
37
|
+
/** Fires once per `rowCount` when the last painted row is within `endReachedThreshold`. */
|
|
38
|
+
onEndReached?: () => void;
|
|
39
|
+
/** Rows from the end that trigger `onEndReached`. Default `2`. */
|
|
40
|
+
endReachedThreshold?: number;
|
|
41
|
+
/** Roving-focus cell (controlled). */
|
|
42
|
+
activeCell?: HeatmapGridCellPosition;
|
|
43
|
+
defaultActiveCell?: HeatmapGridCellPosition;
|
|
44
|
+
onActiveCellChange?: (position: HeatmapGridCellPosition) => void;
|
|
45
|
+
/** Screen-reader label for the row header column. */
|
|
46
|
+
rowHeaderLabel?: string;
|
|
47
|
+
/** Custom composition of `HeatmapGridViewport` / `HeatmapGridTooltip`. */
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
};
|
|
50
|
+
export type HeatmapGridViewportProps = React.HTMLAttributes<HTMLDivElement>;
|
|
51
|
+
export type HeatmapGridTooltipProps = Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
52
|
+
/** Tooltip body for the hovered or focused cell. Falls back to root `renderTooltip`. */
|
|
53
|
+
children?: (position: HeatmapGridCellPosition) => React.ReactNode;
|
|
54
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const heatmapGridRootVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
2
|
+
export declare const heatmapGridViewportVariants: (props?: ({
|
|
3
|
+
overflowX?: boolean | null | undefined;
|
|
4
|
+
overflowY?: boolean | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
export declare const heatmapGridRowHeaderVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
7
|
+
export declare const heatmapGridCellVariants: (props?: ({
|
|
8
|
+
tone?: "warning" | "neutral" | "empty" | "positive" | "negative" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
export declare const heatmapGridColumnHeaderRowVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
11
|
+
export declare const heatmapGridColumnHeaderVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
12
|
+
export declare const heatmapGridColumnLabelVariants: (props?: ({
|
|
13
|
+
orientation?: "horizontal" | "rotated" | null | undefined;
|
|
14
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
15
|
+
export declare const heatmapGridFetchingRowVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
16
|
+
export declare const heatmapGridTooltipVariants: (props?: ({
|
|
17
|
+
side?: "top" | "bottom" | null | undefined;
|
|
18
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { cva as e } from "class-variance-authority";
|
|
2
|
+
const a = e(
|
|
3
|
+
"relative flex h-full min-h-0 w-full min-w-0 flex-col"
|
|
4
|
+
), o = e(
|
|
5
|
+
"relative min-h-0 min-w-0 flex-1 overscroll-contain rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring",
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
overflowX: {
|
|
9
|
+
true: "overflow-x-auto",
|
|
10
|
+
false: "overflow-x-hidden"
|
|
11
|
+
},
|
|
12
|
+
overflowY: {
|
|
13
|
+
true: "overflow-y-auto",
|
|
14
|
+
false: "overflow-y-hidden"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
overflowX: !1,
|
|
19
|
+
overflowY: !1
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
), n = e(
|
|
23
|
+
"sticky left-0 z-[1] flex h-full shrink-0 items-center justify-end bg-canvas-elevated pe-2 text-xs font-semibold text-content"
|
|
24
|
+
), r = e(
|
|
25
|
+
"absolute top-0 box-border flex h-full items-center justify-center overflow-hidden rounded-lg border-4 border-canvas-elevated bg-clip-padding text-xs font-semibold outline-none transition-[filter] duration-150 hover:brightness-95 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-ring motion-reduce:transition-none",
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
tone: {
|
|
29
|
+
positive: "bg-feedback-success-surface text-content",
|
|
30
|
+
warning: "bg-feedback-warning-surface text-content",
|
|
31
|
+
negative: "bg-feedback-error-surface text-content",
|
|
32
|
+
neutral: "bg-canvas-subtle text-content",
|
|
33
|
+
empty: "bg-canvas-muted text-content-tertiary"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
defaultVariants: {
|
|
37
|
+
tone: "neutral"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
), i = e(
|
|
41
|
+
"sticky bottom-0 z-[2] bg-canvas-elevated"
|
|
42
|
+
), s = e(
|
|
43
|
+
"absolute top-0 h-full text-[11px] font-semibold leading-snug text-content-title"
|
|
44
|
+
), l = e("truncate", {
|
|
45
|
+
variants: {
|
|
46
|
+
orientation: {
|
|
47
|
+
horizontal: "absolute inset-x-1 top-2 w-auto text-center",
|
|
48
|
+
rotated: "absolute bottom-3 start-2.5 origin-bottom-left -rotate-45 text-start"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
orientation: "rotated"
|
|
53
|
+
}
|
|
54
|
+
}), d = e(
|
|
55
|
+
"absolute animate-pulse rounded-lg border-4 border-canvas-elevated bg-canvas-muted bg-clip-padding motion-reduce:animate-none"
|
|
56
|
+
), c = e(
|
|
57
|
+
"pointer-events-none absolute z-20 flex max-w-[240px] -translate-x-1/2 flex-col gap-0.5 rounded-lg border border-stroke bg-canvas-elevated px-3 py-2 text-xs text-content shadow-elevation-card",
|
|
58
|
+
{
|
|
59
|
+
variants: {
|
|
60
|
+
side: {
|
|
61
|
+
top: "-translate-y-full",
|
|
62
|
+
bottom: ""
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
defaultVariants: {
|
|
66
|
+
side: "top"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
export {
|
|
71
|
+
r as heatmapGridCellVariants,
|
|
72
|
+
i as heatmapGridColumnHeaderRowVariants,
|
|
73
|
+
s as heatmapGridColumnHeaderVariants,
|
|
74
|
+
l as heatmapGridColumnLabelVariants,
|
|
75
|
+
d as heatmapGridFetchingRowVariants,
|
|
76
|
+
a as heatmapGridRootVariants,
|
|
77
|
+
n as heatmapGridRowHeaderVariants,
|
|
78
|
+
c as heatmapGridTooltipVariants,
|
|
79
|
+
o as heatmapGridViewportVariants
|
|
80
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { HeatmapGrid, HeatmapGridTooltip, HeatmapGridViewport } from './heatmap-grid';
|
|
2
|
+
export type { HeatmapGridCell, HeatmapGridCellPosition, HeatmapGridProps, HeatmapGridTone, HeatmapGridTooltipProps, HeatmapGridViewportProps, } from './heatmap-grid.types';
|
|
3
|
+
export { HEATMAP_GRID_DEFAULT_COLUMN_HEADER_HEIGHT_PX, HEATMAP_GRID_DEFAULT_MIN_COLUMN_SIZE_PX, HEATMAP_GRID_DEFAULT_MIN_ROW_SIZE_PX, HEATMAP_GRID_DEFAULT_ROW_HEADER_WIDTH_PX, readHeatmapGridLayout, } from './heatmap-grid.layout';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HeatmapGrid as r } from "./heatmap-grid.js";
|
|
2
|
+
import { HEATMAP_GRID_DEFAULT_COLUMN_HEADER_HEIGHT_PX as H, HEATMAP_GRID_DEFAULT_MIN_COLUMN_SIZE_PX as o, HEATMAP_GRID_DEFAULT_MIN_ROW_SIZE_PX as t, HEATMAP_GRID_DEFAULT_ROW_HEADER_WIDTH_PX as D, readHeatmapGridLayout as T } from "./heatmap-grid.layout.js";
|
|
3
|
+
import { HeatmapGridTooltip as e } from "./internals/heatmap-grid-tooltip.js";
|
|
4
|
+
import { HeatmapGridViewport as I } from "./internals/heatmap-grid-viewport.js";
|
|
5
|
+
export {
|
|
6
|
+
H as HEATMAP_GRID_DEFAULT_COLUMN_HEADER_HEIGHT_PX,
|
|
7
|
+
o as HEATMAP_GRID_DEFAULT_MIN_COLUMN_SIZE_PX,
|
|
8
|
+
t as HEATMAP_GRID_DEFAULT_MIN_ROW_SIZE_PX,
|
|
9
|
+
D as HEATMAP_GRID_DEFAULT_ROW_HEADER_WIDTH_PX,
|
|
10
|
+
r as HeatmapGrid,
|
|
11
|
+
e as HeatmapGridTooltip,
|
|
12
|
+
I as HeatmapGridViewport,
|
|
13
|
+
T as readHeatmapGridLayout
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { HeatmapGridTone } from '../heatmap-grid.types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type HeatmapGridCellViewProps = {
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
columnIndex: number;
|
|
6
|
+
startPx: number;
|
|
7
|
+
widthPx: number;
|
|
8
|
+
tone: HeatmapGridTone | "empty";
|
|
9
|
+
color: string | undefined;
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
/** Pointer, focus and keyboard events are delegated to the viewport. */
|
|
14
|
+
export declare const HeatmapGridCellView: React.NamedExoticComponent<HeatmapGridCellViewProps>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { cn as c } from "../../../../lib/utils.js";
|
|
4
|
+
import { heatmapGridCellVariants as n } from "../heatmap-grid.variants.js";
|
|
5
|
+
const v = p.memo(function({
|
|
6
|
+
rowIndex: r,
|
|
7
|
+
columnIndex: t,
|
|
8
|
+
startPx: d,
|
|
9
|
+
widthPx: m,
|
|
10
|
+
tone: a,
|
|
11
|
+
color: e,
|
|
12
|
+
isActive: i,
|
|
13
|
+
children: o
|
|
14
|
+
}) {
|
|
15
|
+
return /* @__PURE__ */ l(
|
|
16
|
+
"div",
|
|
17
|
+
{
|
|
18
|
+
role: "gridcell",
|
|
19
|
+
"aria-colindex": t + 2,
|
|
20
|
+
tabIndex: i ? 0 : -1,
|
|
21
|
+
"data-heatmap-cell": "",
|
|
22
|
+
"data-row-index": r,
|
|
23
|
+
"data-column-index": t,
|
|
24
|
+
"data-tone": a === "empty" ? void 0 : a,
|
|
25
|
+
"data-empty": a === "empty" ? "" : void 0,
|
|
26
|
+
"data-active": i ? "" : void 0,
|
|
27
|
+
className: c(n({ tone: a })),
|
|
28
|
+
style: {
|
|
29
|
+
left: d,
|
|
30
|
+
width: m,
|
|
31
|
+
...e && a !== "empty" ? { backgroundColor: e } : {}
|
|
32
|
+
},
|
|
33
|
+
children: o
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
v as HeatmapGridCellView
|
|
39
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { HeatmapGridCellPosition, HeatmapGridProps } from '../heatmap-grid.types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type HeatmapGridHoverTarget = HeatmapGridCellPosition & {
|
|
4
|
+
/** Cell center, relative to the root. */
|
|
5
|
+
anchorX: number;
|
|
6
|
+
anchorTop: number;
|
|
7
|
+
anchorBottom: number;
|
|
8
|
+
rootWidthPx: number;
|
|
9
|
+
};
|
|
10
|
+
export type HeatmapGridHoverStore = {
|
|
11
|
+
get: () => HeatmapGridHoverTarget | null;
|
|
12
|
+
set: (next: HeatmapGridHoverTarget | null) => void;
|
|
13
|
+
subscribe: (listener: () => void) => () => void;
|
|
14
|
+
};
|
|
15
|
+
/** External store so hover never re-renders the cells; only the tooltip subscribes. */
|
|
16
|
+
export declare function createHeatmapGridHoverStore(): HeatmapGridHoverStore;
|
|
17
|
+
export type HeatmapGridContextValue = Required<Pick<HeatmapGridProps, "rowCount" | "columnCount" | "getRowLabel" | "getColumnLabel" | "getCell" | "minRowSizePx" | "minColumnSizePx" | "rowHeaderWidthPx" | "columnHeaderHeightPx" | "hasMore" | "isFetchingMore" | "endReachedThreshold" | "rowHeaderLabel">> & Pick<HeatmapGridProps, "renderCell" | "renderTooltip" | "onEndReached"> & {
|
|
18
|
+
gridLabel: string;
|
|
19
|
+
loadingMoreLabel: string;
|
|
20
|
+
activeCell: HeatmapGridCellPosition;
|
|
21
|
+
setActiveCell: (position: HeatmapGridCellPosition) => void;
|
|
22
|
+
hoverStore: HeatmapGridHoverStore;
|
|
23
|
+
rootRef: React.RefObject<HTMLDivElement | null>;
|
|
24
|
+
};
|
|
25
|
+
export declare function HeatmapGridProvider({ value, children, }: {
|
|
26
|
+
value: HeatmapGridContextValue;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare function useHeatmapGridContext(): HeatmapGridContextValue;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
function s() {
|
|
4
|
+
let t = null;
|
|
5
|
+
const e = /* @__PURE__ */ new Set();
|
|
6
|
+
return {
|
|
7
|
+
get: () => t,
|
|
8
|
+
set: (r) => {
|
|
9
|
+
t !== r && (t = r, e.forEach((a) => a()));
|
|
10
|
+
},
|
|
11
|
+
subscribe: (r) => (e.add(r), () => {
|
|
12
|
+
e.delete(r);
|
|
13
|
+
})
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const o = n.createContext(null);
|
|
17
|
+
function c({
|
|
18
|
+
value: t,
|
|
19
|
+
children: e
|
|
20
|
+
}) {
|
|
21
|
+
return /* @__PURE__ */ i(o.Provider, { value: t, children: e });
|
|
22
|
+
}
|
|
23
|
+
function d() {
|
|
24
|
+
const t = n.useContext(o);
|
|
25
|
+
if (!t)
|
|
26
|
+
throw new Error("HeatmapGrid parts must be used within HeatmapGrid");
|
|
27
|
+
return t;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
c as HeatmapGridProvider,
|
|
31
|
+
s as createHeatmapGridHoverStore,
|
|
32
|
+
d as useHeatmapGridContext
|
|
33
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare const HeatmapGridTooltip: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
3
|
+
children?: (position: import('..').HeatmapGridCellPosition) => React.ReactNode;
|
|
4
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import * as T from "react";
|
|
3
|
+
import { createComponent as f } from "../../../../lib/primitives/create-component.js";
|
|
4
|
+
import { cn as h } from "../../../../lib/utils.js";
|
|
5
|
+
import { heatmapGridTooltipVariants as I } from "../heatmap-grid.variants.js";
|
|
6
|
+
import { useHeatmapGridContext as _ } from "./heatmap-grid-context.js";
|
|
7
|
+
const c = 6, x = 72, i = 120;
|
|
8
|
+
function H(r, t) {
|
|
9
|
+
return t <= i * 2 ? t / 2 : Math.min(
|
|
10
|
+
Math.max(r, i),
|
|
11
|
+
t - i
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
const g = f(
|
|
15
|
+
"HeatmapGridTooltip",
|
|
16
|
+
({ className: r, style: t, children: m, ...s }, l) => {
|
|
17
|
+
const { hoverStore: n, renderTooltip: d } = _(), o = T.useSyncExternalStore(
|
|
18
|
+
n.subscribe,
|
|
19
|
+
n.get,
|
|
20
|
+
n.get
|
|
21
|
+
);
|
|
22
|
+
if (!o)
|
|
23
|
+
return null;
|
|
24
|
+
const p = { rowIndex: o.rowIndex, columnIndex: o.columnIndex }, e = m ? m(p) : d?.(p);
|
|
25
|
+
if (e == null)
|
|
26
|
+
return null;
|
|
27
|
+
const a = o.anchorTop < x ? "bottom" : "top";
|
|
28
|
+
return /* @__PURE__ */ u(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
ref: l,
|
|
32
|
+
role: "tooltip",
|
|
33
|
+
"data-component": "heatmap-grid-tooltip",
|
|
34
|
+
"data-side": a,
|
|
35
|
+
className: h(I({ side: a }), r),
|
|
36
|
+
style: {
|
|
37
|
+
left: H(o.anchorX, o.rootWidthPx),
|
|
38
|
+
top: a === "top" ? o.anchorTop - c : o.anchorBottom + c,
|
|
39
|
+
...t
|
|
40
|
+
},
|
|
41
|
+
...s,
|
|
42
|
+
children: e
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
export {
|
|
48
|
+
g as HeatmapGridTooltip
|
|
49
|
+
};
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsxs as n, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { OverflowTooltip as m } from "../../../feedback/tooltip/overflow-tooltip.js";
|
|
3
|
+
import { useComposedRefs as z } from "../../../../lib/compose-refs.js";
|
|
4
|
+
import { createComponent as L } from "../../../../lib/primitives/create-component.js";
|
|
5
|
+
import { cn as h } from "../../../../lib/utils.js";
|
|
6
|
+
import { HEATMAP_GRID_HORIZONTAL_LABEL_MIN_COLUMN_PX as G, readHeatmapGridColumnLabelMaxWidthPx as S } from "../heatmap-grid.layout.js";
|
|
7
|
+
import { heatmapGridRowHeaderVariants as R, heatmapGridFetchingRowVariants as V, heatmapGridColumnLabelVariants as M, heatmapGridColumnHeaderVariants as W, heatmapGridColumnHeaderRowVariants as A, heatmapGridViewportVariants as _ } from "../heatmap-grid.variants.js";
|
|
8
|
+
import { HeatmapGridCellView as k } from "./heatmap-grid-cell.js";
|
|
9
|
+
import { useHeatmapGridViewport as O } from "./use-heatmap-grid-viewport.js";
|
|
10
|
+
const U = L(
|
|
11
|
+
"HeatmapGridViewport",
|
|
12
|
+
({ className: p, style: w, ...u }, g) => {
|
|
13
|
+
const {
|
|
14
|
+
context: e,
|
|
15
|
+
scrollRef: f,
|
|
16
|
+
layout: i,
|
|
17
|
+
rowItems: P,
|
|
18
|
+
columnItems: d,
|
|
19
|
+
activeCell: s,
|
|
20
|
+
isActiveCellPainted: b,
|
|
21
|
+
handlers: v
|
|
22
|
+
} = O(), { rowHeaderWidthPx: o, columnHeaderHeightPx: c } = e, C = z(f, g), y = i.contentWidthPx - o, x = i.columnSizePx >= G ? "horizontal" : "rotated", H = S({
|
|
23
|
+
columnSizePx: i.columnSizePx,
|
|
24
|
+
columnHeaderHeightPx: c
|
|
25
|
+
});
|
|
26
|
+
return /* @__PURE__ */ n(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
ref: C,
|
|
30
|
+
role: "grid",
|
|
31
|
+
"aria-label": e.gridLabel,
|
|
32
|
+
"aria-rowcount": e.rowCount + 1,
|
|
33
|
+
"aria-colcount": e.columnCount + 1,
|
|
34
|
+
"aria-busy": e.isFetchingMore || void 0,
|
|
35
|
+
tabIndex: b ? -1 : 0,
|
|
36
|
+
"data-component": "heatmap-grid-viewport",
|
|
37
|
+
"data-testid": "heatmap-grid-scroll",
|
|
38
|
+
className: h(
|
|
39
|
+
_({
|
|
40
|
+
overflowX: i.overflowsX,
|
|
41
|
+
overflowY: i.overflowsY
|
|
42
|
+
}),
|
|
43
|
+
p
|
|
44
|
+
),
|
|
45
|
+
style: w,
|
|
46
|
+
...v,
|
|
47
|
+
...u,
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ n(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
role: "rowgroup",
|
|
53
|
+
className: "relative",
|
|
54
|
+
style: {
|
|
55
|
+
width: i.contentWidthPx,
|
|
56
|
+
height: i.bodyHeightPx + (e.isFetchingMore ? e.minRowSizePx : 0)
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
P.map((a) => /* @__PURE__ */ n(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
role: "row",
|
|
63
|
+
"aria-rowindex": a.index + 1,
|
|
64
|
+
className: "absolute left-0 top-0 flex",
|
|
65
|
+
style: {
|
|
66
|
+
width: i.contentWidthPx,
|
|
67
|
+
height: i.rowSizePx,
|
|
68
|
+
transform: `translate3d(0, ${a.index * i.rowSizePx}px, 0)`
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
/* @__PURE__ */ t(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
role: "rowheader",
|
|
75
|
+
"aria-colindex": 1,
|
|
76
|
+
className: R(),
|
|
77
|
+
style: { width: o },
|
|
78
|
+
children: /* @__PURE__ */ t(m, { triggerClassName: "block max-w-full truncate text-end", children: e.getRowLabel(a.index) })
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
d.map((l) => {
|
|
82
|
+
const r = e.getCell(a.index, l.index), N = { rowIndex: a.index, columnIndex: l.index };
|
|
83
|
+
return /* @__PURE__ */ t(
|
|
84
|
+
k,
|
|
85
|
+
{
|
|
86
|
+
rowIndex: a.index,
|
|
87
|
+
columnIndex: l.index,
|
|
88
|
+
startPx: o + l.index * i.columnSizePx,
|
|
89
|
+
widthPx: i.columnSizePx,
|
|
90
|
+
tone: !r || r.isEmpty ? "empty" : r.tone ?? "neutral",
|
|
91
|
+
color: r?.color,
|
|
92
|
+
isActive: s.rowIndex === a.index && s.columnIndex === l.index,
|
|
93
|
+
children: r && e.renderCell ? e.renderCell(r, N) : r?.label
|
|
94
|
+
},
|
|
95
|
+
l.key
|
|
96
|
+
);
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
a.key
|
|
101
|
+
)),
|
|
102
|
+
e.isFetchingMore ? /* @__PURE__ */ t(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
role: "row",
|
|
106
|
+
"aria-label": e.loadingMoreLabel,
|
|
107
|
+
"data-testid": "heatmap-grid-fetching-more",
|
|
108
|
+
className: V(),
|
|
109
|
+
style: {
|
|
110
|
+
left: o,
|
|
111
|
+
top: i.bodyHeightPx,
|
|
112
|
+
width: y,
|
|
113
|
+
height: e.minRowSizePx
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
) : null
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
/* @__PURE__ */ n(
|
|
121
|
+
"div",
|
|
122
|
+
{
|
|
123
|
+
role: "row",
|
|
124
|
+
"aria-rowindex": e.rowCount + 1,
|
|
125
|
+
className: A(),
|
|
126
|
+
style: { width: i.contentWidthPx, height: c },
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ t(
|
|
129
|
+
"div",
|
|
130
|
+
{
|
|
131
|
+
role: "columnheader",
|
|
132
|
+
"aria-colindex": 1,
|
|
133
|
+
className: "sticky left-0 z-[1] h-full bg-canvas-elevated",
|
|
134
|
+
style: { width: o },
|
|
135
|
+
children: /* @__PURE__ */ t("span", { className: "sr-only", children: e.rowHeaderLabel })
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
d.map((a) => /* @__PURE__ */ t(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
role: "columnheader",
|
|
142
|
+
"aria-colindex": a.index + 2,
|
|
143
|
+
className: W(),
|
|
144
|
+
style: {
|
|
145
|
+
left: o + a.index * i.columnSizePx,
|
|
146
|
+
width: i.columnSizePx,
|
|
147
|
+
"--heatmap-grid-column-label-max-w": `${H}px`
|
|
148
|
+
},
|
|
149
|
+
children: /* @__PURE__ */ t(
|
|
150
|
+
m,
|
|
151
|
+
{
|
|
152
|
+
content: e.getColumnLabel(a.index),
|
|
153
|
+
triggerClassName: h(
|
|
154
|
+
M({ orientation: x }),
|
|
155
|
+
x === "rotated" && "max-w-[var(--heatmap-grid-column-label-max-w)]"
|
|
156
|
+
),
|
|
157
|
+
children: e.getColumnLabel(a.index)
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
},
|
|
161
|
+
a.key
|
|
162
|
+
))
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
export {
|
|
172
|
+
U as HeatmapGridViewport
|
|
173
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HeatmapGridCellPosition } from '../heatmap-grid.types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export declare function useHeatmapGridViewport(): {
|
|
4
|
+
context: import('./heatmap-grid-context').HeatmapGridContextValue;
|
|
5
|
+
scrollRef: React.RefObject<HTMLDivElement | null>;
|
|
6
|
+
layout: import('../heatmap-grid.layout').HeatmapGridLayout;
|
|
7
|
+
rowItems: import('@tanstack/virtual-core').VirtualItem[];
|
|
8
|
+
columnItems: import('@tanstack/virtual-core').VirtualItem[];
|
|
9
|
+
activeCell: HeatmapGridCellPosition;
|
|
10
|
+
isActiveCellPainted: boolean;
|
|
11
|
+
handlers: Pick<React.HTMLAttributes<HTMLDivElement>, "onFocus" | "onBlur" | "onKeyDown" | "onPointerLeave" | "onPointerOver" | "onScroll">;
|
|
12
|
+
};
|