impact-nova 3.0.0-alpha.20 → 3.0.0-alpha.23
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/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/components/data-display/hex-tilemap/hex-tilemap.js +35 -33
- package/dist/components/data-display/hex-tilemap/hex-tilemap.types.d.ts +2 -0
- package/dist/components/data-display/hex-tilemap/internals/hex-camera.js +30 -28
- package/dist/components/data-display/hex-tilemap/internals/hex-tilemap-context.d.ts +1 -0
- package/dist/components/data-display/hex-tilemap/internals/hex-tilemap-viewport.js +36 -34
- package/dist/components/data-display/hex-tilemap/internals/use-hex-camera.d.ts +2 -1
- package/dist/components/data-display/hex-tilemap/internals/use-hex-camera.js +87 -84
- package/dist/components/flows/iris-chat/iris-chat-chrome.js +203 -185
- 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/lib/primitives/use-field-chrome.js +22 -22
- package/dist/llms/rules/installation.js +1 -1
- package/dist/llms/rules/requirements.js +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function playHeatmapGridFill({ canvasElement, }: {
|
|
2
|
+
canvasElement: HTMLElement;
|
|
3
|
+
}): Promise<void>;
|
|
4
|
+
export declare function playHeatmapGridLarge({ canvasElement, }: {
|
|
5
|
+
canvasElement: HTMLElement;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
export declare function playHeatmapGridComposition({ canvasElement, }: {
|
|
8
|
+
canvasElement: HTMLElement;
|
|
9
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { HeatmapGridCellPosition } from './heatmap-grid.types';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type { HeatmapGridCell, HeatmapGridCellPosition, HeatmapGridProps, HeatmapGridTone, HeatmapGridTooltipProps, HeatmapGridViewportProps, } from './heatmap-grid.types';
|
|
4
|
+
export { HeatmapGridTooltip } from './internals/heatmap-grid-tooltip';
|
|
5
|
+
export { HeatmapGridViewport } from './internals/heatmap-grid-viewport';
|
|
6
|
+
/**
|
|
7
|
+
* Windowed heatmap. Paints only visible rows × columns; small grids stretch to fill.
|
|
8
|
+
* Compose `HeatmapGridViewport` and `HeatmapGridTooltip` as children to customise layout.
|
|
9
|
+
*/
|
|
10
|
+
declare const HeatmapGrid: React.ForwardRefExoticComponent<Omit<React.HTMLAttributes<HTMLDivElement>, "children"> & {
|
|
11
|
+
rowCount: number;
|
|
12
|
+
columnCount: number;
|
|
13
|
+
getRowLabel: (rowIndex: number) => string;
|
|
14
|
+
getColumnLabel: (columnIndex: number) => string;
|
|
15
|
+
getCell: (rowIndex: number, columnIndex: number) => import('./heatmap-grid.types').HeatmapGridCell | undefined;
|
|
16
|
+
renderCell?: (cell: import('./heatmap-grid.types').HeatmapGridCell, position: HeatmapGridCellPosition) => React.ReactNode;
|
|
17
|
+
renderTooltip?: (position: HeatmapGridCellPosition) => React.ReactNode;
|
|
18
|
+
minRowSizePx?: number;
|
|
19
|
+
minColumnSizePx?: number;
|
|
20
|
+
rowHeaderWidthPx?: number;
|
|
21
|
+
columnHeaderHeightPx?: number;
|
|
22
|
+
hasMore?: boolean;
|
|
23
|
+
isFetchingMore?: boolean;
|
|
24
|
+
onEndReached?: () => void;
|
|
25
|
+
endReachedThreshold?: number;
|
|
26
|
+
activeCell?: HeatmapGridCellPosition;
|
|
27
|
+
defaultActiveCell?: HeatmapGridCellPosition;
|
|
28
|
+
onActiveCellChange?: (position: HeatmapGridCellPosition) => void;
|
|
29
|
+
rowHeaderLabel?: string;
|
|
30
|
+
children?: React.ReactNode;
|
|
31
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
32
|
+
export { HeatmapGrid };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx as e, jsxs as N, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { useControllableState as U } from "@radix-ui/react-use-controllable-state";
|
|
4
|
+
import { useImpactNovaI18n as x } from "../../../i18n/use-impact-nova-i18n.js";
|
|
5
|
+
import { useComposedRefs as F } from "../../../lib/compose-refs.js";
|
|
6
|
+
import { createComponent as O } from "../../../lib/primitives/create-component.js";
|
|
7
|
+
import { cn as w } from "../../../lib/utils.js";
|
|
8
|
+
import { HEATMAP_GRID_DEFAULT_COLUMN_HEADER_HEIGHT_PX as X, HEATMAP_GRID_DEFAULT_ROW_HEADER_WIDTH_PX as W, HEATMAP_GRID_DEFAULT_MIN_COLUMN_SIZE_PX as j, HEATMAP_GRID_DEFAULT_MIN_ROW_SIZE_PX as V } from "./heatmap-grid.layout.js";
|
|
9
|
+
import { heatmapGridRootVariants as Z } from "./heatmap-grid.variants.js";
|
|
10
|
+
import { createHeatmapGridHoverStore as k, HeatmapGridProvider as q } from "./internals/heatmap-grid-context.js";
|
|
11
|
+
import { HeatmapGridTooltip as y } from "./internals/heatmap-grid-tooltip.js";
|
|
12
|
+
import { HeatmapGridViewport as z } from "./internals/heatmap-grid-viewport.js";
|
|
13
|
+
const B = { rowIndex: 0, columnIndex: 0 }, ie = O(
|
|
14
|
+
"HeatmapGrid",
|
|
15
|
+
({
|
|
16
|
+
className: m,
|
|
17
|
+
children: i,
|
|
18
|
+
rowCount: p,
|
|
19
|
+
columnCount: l,
|
|
20
|
+
getRowLabel: n,
|
|
21
|
+
getColumnLabel: d,
|
|
22
|
+
getCell: s,
|
|
23
|
+
renderCell: _,
|
|
24
|
+
renderTooltip: c,
|
|
25
|
+
minRowSizePx: f = V,
|
|
26
|
+
minColumnSizePx: H = j,
|
|
27
|
+
rowHeaderWidthPx: E = W,
|
|
28
|
+
columnHeaderHeightPx: G = X,
|
|
29
|
+
hasMore: I = !1,
|
|
30
|
+
isFetchingMore: R = !1,
|
|
31
|
+
onEndReached: A,
|
|
32
|
+
endReachedThreshold: L = 2,
|
|
33
|
+
activeCell: D,
|
|
34
|
+
defaultActiveCell: o = B,
|
|
35
|
+
onActiveCellChange: T,
|
|
36
|
+
rowHeaderLabel: h,
|
|
37
|
+
"aria-label": C,
|
|
38
|
+
...M
|
|
39
|
+
}, P) => {
|
|
40
|
+
const { t: r } = x(), t = a.useRef(null), u = F(t, P), [v] = a.useState(k), [b, g] = U({
|
|
41
|
+
prop: D,
|
|
42
|
+
defaultProp: o,
|
|
43
|
+
onChange: T
|
|
44
|
+
});
|
|
45
|
+
return /* @__PURE__ */ e(
|
|
46
|
+
q,
|
|
47
|
+
{
|
|
48
|
+
value: {
|
|
49
|
+
rowCount: p,
|
|
50
|
+
columnCount: l,
|
|
51
|
+
getRowLabel: n,
|
|
52
|
+
getColumnLabel: d,
|
|
53
|
+
getCell: s,
|
|
54
|
+
renderCell: _,
|
|
55
|
+
renderTooltip: c,
|
|
56
|
+
minRowSizePx: f,
|
|
57
|
+
minColumnSizePx: H,
|
|
58
|
+
rowHeaderWidthPx: E,
|
|
59
|
+
columnHeaderHeightPx: G,
|
|
60
|
+
hasMore: I,
|
|
61
|
+
isFetchingMore: R,
|
|
62
|
+
onEndReached: A,
|
|
63
|
+
endReachedThreshold: L,
|
|
64
|
+
rowHeaderLabel: h ?? r("heatmapGrid.rowHeaderLabel"),
|
|
65
|
+
gridLabel: C ?? r("heatmapGrid.gridLabel"),
|
|
66
|
+
loadingMoreLabel: r("heatmapGrid.loadingMore"),
|
|
67
|
+
activeCell: b ?? o,
|
|
68
|
+
setActiveCell: g,
|
|
69
|
+
hoverStore: v,
|
|
70
|
+
rootRef: t
|
|
71
|
+
},
|
|
72
|
+
children: /* @__PURE__ */ e(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
ref: u,
|
|
76
|
+
"data-component": "heatmap-grid",
|
|
77
|
+
className: w(Z(), m),
|
|
78
|
+
...M,
|
|
79
|
+
children: i ?? /* @__PURE__ */ N(S, { children: [
|
|
80
|
+
/* @__PURE__ */ e(z, {}),
|
|
81
|
+
/* @__PURE__ */ e(y, {})
|
|
82
|
+
] })
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
export {
|
|
90
|
+
ie as HeatmapGrid,
|
|
91
|
+
y as HeatmapGridTooltip,
|
|
92
|
+
z as HeatmapGridViewport
|
|
93
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { HeatmapGridCellPosition } from './heatmap-grid.types';
|
|
2
|
+
export declare const HEATMAP_GRID_DEFAULT_MIN_ROW_SIZE_PX = 36;
|
|
3
|
+
export declare const HEATMAP_GRID_DEFAULT_MIN_COLUMN_SIZE_PX = 72;
|
|
4
|
+
export declare const HEATMAP_GRID_DEFAULT_ROW_HEADER_WIDTH_PX = 152;
|
|
5
|
+
export declare const HEATMAP_GRID_DEFAULT_COLUMN_HEADER_HEIGHT_PX = 56;
|
|
6
|
+
/** Columns at least this wide show horizontal labels; narrower ones rotate. */
|
|
7
|
+
export declare const HEATMAP_GRID_HORIZONTAL_LABEL_MIN_COLUMN_PX = 112;
|
|
8
|
+
export type HeatmapGridLayout = {
|
|
9
|
+
rowSizePx: number;
|
|
10
|
+
columnSizePx: number;
|
|
11
|
+
contentWidthPx: number;
|
|
12
|
+
bodyHeightPx: number;
|
|
13
|
+
overflowsX: boolean;
|
|
14
|
+
overflowsY: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function readHeatmapGridTrackSizePx(input: {
|
|
17
|
+
count: number;
|
|
18
|
+
viewportPx: number;
|
|
19
|
+
minSizePx: number;
|
|
20
|
+
}): number;
|
|
21
|
+
/** Fill-or-scroll: tracks stretch to the viewport, never below their floor. */
|
|
22
|
+
export declare function readHeatmapGridLayout(input: {
|
|
23
|
+
rowCount: number;
|
|
24
|
+
columnCount: number;
|
|
25
|
+
viewportWidthPx: number;
|
|
26
|
+
viewportHeightPx: number;
|
|
27
|
+
minRowSizePx: number;
|
|
28
|
+
minColumnSizePx: number;
|
|
29
|
+
rowHeaderWidthPx: number;
|
|
30
|
+
columnHeaderHeightPx: number;
|
|
31
|
+
isFetchingMore?: boolean;
|
|
32
|
+
}): HeatmapGridLayout;
|
|
33
|
+
/** Longest rotated (-45°) label that fits the column and header band. */
|
|
34
|
+
export declare function readHeatmapGridColumnLabelMaxWidthPx(input: {
|
|
35
|
+
columnSizePx: number;
|
|
36
|
+
columnHeaderHeightPx: number;
|
|
37
|
+
}): number;
|
|
38
|
+
export declare function readNextHeatmapGridFocusCell(input: {
|
|
39
|
+
current: HeatmapGridCellPosition;
|
|
40
|
+
rowCount: number;
|
|
41
|
+
columnCount: number;
|
|
42
|
+
key: string;
|
|
43
|
+
ctrlKey?: boolean;
|
|
44
|
+
}): HeatmapGridCellPosition | null;
|
|
45
|
+
export declare function readHeatmapGridCellKey(position: HeatmapGridCellPosition): string;
|
|
46
|
+
export declare function readHeatmapGridCellPosition(element: Element | null): HeatmapGridCellPosition | null;
|
|
@@ -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
|
+
};
|