grafana-react 0.0.0 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -2
  3. package/build/cli/cli.test.d.ts +8 -0
  4. package/build/cli/cli.test.js +78 -0
  5. package/build/cli/index.d.ts +13 -0
  6. package/build/cli/index.js +266 -0
  7. package/build/components/annotation/annotation.d.ts +27 -0
  8. package/build/components/annotation/annotation.js +12 -0
  9. package/build/components/base.d.ts +23 -0
  10. package/build/components/base.js +28 -0
  11. package/build/components/dashboard/dashboard.d.ts +33 -0
  12. package/build/components/dashboard/dashboard.js +11 -0
  13. package/build/components/index.d.ts +44 -0
  14. package/build/components/index.js +54 -0
  15. package/build/components/link/link.d.ts +25 -0
  16. package/build/components/link/link.js +10 -0
  17. package/build/components/override/override.d.ts +22 -0
  18. package/build/components/override/override.js +11 -0
  19. package/build/components/panels/core/alert-list/alert-list.d.ts +33 -0
  20. package/build/components/panels/core/alert-list/alert-list.js +15 -0
  21. package/build/components/panels/core/annotations-list/annotations-list.d.ts +31 -0
  22. package/build/components/panels/core/annotations-list/annotations-list.js +15 -0
  23. package/build/components/panels/core/bar-chart/bar-chart.d.ts +47 -0
  24. package/build/components/panels/core/bar-chart/bar-chart.js +16 -0
  25. package/build/components/panels/core/bar-gauge/bar-gauge.d.ts +68 -0
  26. package/build/components/panels/core/bar-gauge/bar-gauge.js +30 -0
  27. package/build/components/panels/core/candlestick/candlestick.d.ts +42 -0
  28. package/build/components/panels/core/candlestick/candlestick.js +17 -0
  29. package/build/components/panels/core/canvas/canvas.d.ts +18 -0
  30. package/build/components/panels/core/canvas/canvas.js +12 -0
  31. package/build/components/panels/core/dashboard-list/dashboard-list.d.ts +35 -0
  32. package/build/components/panels/core/dashboard-list/dashboard-list.js +15 -0
  33. package/build/components/panels/core/datagrid/datagrid.d.ts +16 -0
  34. package/build/components/panels/core/datagrid/datagrid.js +12 -0
  35. package/build/components/panels/core/flame-graph/flame-graph.d.ts +16 -0
  36. package/build/components/panels/core/flame-graph/flame-graph.js +12 -0
  37. package/build/components/panels/core/gauge/gauge.d.ts +64 -0
  38. package/build/components/panels/core/gauge/gauge.js +30 -0
  39. package/build/components/panels/core/geomap/geomap.d.ts +20 -0
  40. package/build/components/panels/core/geomap/geomap.js +12 -0
  41. package/build/components/panels/core/heatmap/heatmap.d.ts +25 -0
  42. package/build/components/panels/core/heatmap/heatmap.js +16 -0
  43. package/build/components/panels/core/histogram/histogram.d.ts +39 -0
  44. package/build/components/panels/core/histogram/histogram.js +16 -0
  45. package/build/components/panels/core/logs/logs.d.ts +33 -0
  46. package/build/components/panels/core/logs/logs.js +17 -0
  47. package/build/components/panels/core/news/news.d.ts +20 -0
  48. package/build/components/panels/core/news/news.js +14 -0
  49. package/build/components/panels/core/node-graph/node-graph.d.ts +18 -0
  50. package/build/components/panels/core/node-graph/node-graph.js +12 -0
  51. package/build/components/panels/core/pie-chart/pie-chart.d.ts +33 -0
  52. package/build/components/panels/core/pie-chart/pie-chart.js +16 -0
  53. package/build/components/panels/core/stat/stat.d.ts +54 -0
  54. package/build/components/panels/core/stat/stat.js +18 -0
  55. package/build/components/panels/core/state-timeline/state-timeline.d.ts +37 -0
  56. package/build/components/panels/core/state-timeline/state-timeline.js +16 -0
  57. package/build/components/panels/core/status-history/status-history.d.ts +35 -0
  58. package/build/components/panels/core/status-history/status-history.js +16 -0
  59. package/build/components/panels/core/table/table.d.ts +63 -0
  60. package/build/components/panels/core/table/table.js +25 -0
  61. package/build/components/panels/core/text/text.d.ts +16 -0
  62. package/build/components/panels/core/text/text.js +10 -0
  63. package/build/components/panels/core/timeseries/timeseries.d.ts +103 -0
  64. package/build/components/panels/core/timeseries/timeseries.js +31 -0
  65. package/build/components/panels/core/traces/traces.d.ts +18 -0
  66. package/build/components/panels/core/traces/traces.js +12 -0
  67. package/build/components/panels/core/trend/trend.d.ts +39 -0
  68. package/build/components/panels/core/trend/trend.js +16 -0
  69. package/build/components/panels/core/xy-chart/xy-chart.d.ts +44 -0
  70. package/build/components/panels/core/xy-chart/xy-chart.js +17 -0
  71. package/build/components/panels/index.d.ts +32 -0
  72. package/build/components/panels/index.js +38 -0
  73. package/build/components/panels/plugins/business-variable-panel/business-variable-panel.d.ts +85 -0
  74. package/build/components/panels/plugins/business-variable-panel/business-variable-panel.js +15 -0
  75. package/build/components/plugin-panel/plugin-panel.d.ts +25 -0
  76. package/build/components/plugin-panel/plugin-panel.js +17 -0
  77. package/build/components/query/query.d.ts +33 -0
  78. package/build/components/query/query.js +19 -0
  79. package/build/components/row/row.d.ts +27 -0
  80. package/build/components/row/row.js +13 -0
  81. package/build/components/variable/variable.d.ts +32 -0
  82. package/build/components/variable/variable.js +12 -0
  83. package/build/index.d.ts +33 -0
  84. package/build/index.js +52 -0
  85. package/build/lib/index.d.ts +5 -0
  86. package/build/lib/index.js +5 -0
  87. package/build/lib/renderer.d.ts +24 -0
  88. package/build/lib/renderer.js +1531 -0
  89. package/build/lib/renderer.test.d.ts +4 -0
  90. package/build/lib/renderer.test.js +480 -0
  91. package/build/lib/utils.d.ts +70 -0
  92. package/build/lib/utils.js +229 -0
  93. package/build/lib/utils.test.d.ts +4 -0
  94. package/build/lib/utils.test.js +252 -0
  95. package/build/types/common/axis.d.ts +76 -0
  96. package/build/types/common/axis.js +8 -0
  97. package/build/types/common/enums.d.ts +50 -0
  98. package/build/types/common/enums.js +9 -0
  99. package/build/types/common/field-config.d.ts +123 -0
  100. package/build/types/common/field-config.js +8 -0
  101. package/build/types/common/index.d.ts +10 -0
  102. package/build/types/common/index.js +7 -0
  103. package/build/types/common/viz-options.d.ts +94 -0
  104. package/build/types/common/viz-options.js +8 -0
  105. package/build/types/display.d.ts +29 -0
  106. package/build/types/display.js +4 -0
  107. package/build/types/grafana-json.d.ts +147 -0
  108. package/build/types/grafana-json.js +6 -0
  109. package/build/types/index.d.ts +10 -0
  110. package/build/types/index.js +7 -0
  111. package/build/types/panel-base.d.ts +72 -0
  112. package/build/types/panel-base.js +4 -0
  113. package/package.json +67 -3
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Field configuration types
3
+ *
4
+ * Types for configuring how data fields are displayed in graph panels.
5
+ *
6
+ * @see https://github.com/grafana/grafana/blob/main/packages/grafana-schema/src/common/common.gen.ts
7
+ */
8
+ import type { StackingMode, GraphGradientMode, LineInterpolation, BarAlignment, VisibilityMode, LineStyleFill } from './enums.js';
9
+ import type { AxisConfig } from './axis.js';
10
+ import type { HideSeriesConfig } from './viz-options.js';
11
+ import type { ThresholdStyle } from '../display.js';
12
+ /**
13
+ * Stacking configuration
14
+ *
15
+ * Controls how series are stacked.
16
+ *
17
+ * @example
18
+ * // Normal stacking
19
+ * { mode: 'normal' }
20
+ *
21
+ * @example
22
+ * // Percent stacking with group
23
+ * { mode: 'percent', group: 'A' }
24
+ */
25
+ export interface StackingConfig {
26
+ /** Stacking mode */
27
+ mode: StackingMode;
28
+ /** Stack group identifier */
29
+ group?: string;
30
+ }
31
+ /**
32
+ * Line style configuration
33
+ *
34
+ * Controls the appearance of lines.
35
+ *
36
+ * @example
37
+ * // Solid line
38
+ * { fill: 'solid' }
39
+ *
40
+ * @example
41
+ * // Dashed line with custom pattern
42
+ * { fill: 'dash', dash: [10, 10] }
43
+ */
44
+ export interface LineStyleConfig {
45
+ /** Line fill style */
46
+ fill?: LineStyleFill;
47
+ /** Dash pattern array [dash, gap, dash, gap, ...] */
48
+ dash?: number[];
49
+ }
50
+ /**
51
+ * Graph thresholds style configuration
52
+ *
53
+ * Controls how thresholds are displayed on graphs.
54
+ */
55
+ export interface GraphThresholdsStyleConfig {
56
+ /** Threshold display mode */
57
+ mode: ThresholdStyle;
58
+ }
59
+ /**
60
+ * Graph field configuration
61
+ *
62
+ * Comprehensive configuration for graph panel fields (timeseries, barchart, etc.)
63
+ * This extends AxisConfig to include all axis options.
64
+ *
65
+ * @example
66
+ * // Line graph with area fill
67
+ * {
68
+ * drawStyle: 'line',
69
+ * lineWidth: 2,
70
+ * fillOpacity: 20,
71
+ * gradientMode: 'opacity'
72
+ * }
73
+ *
74
+ * @example
75
+ * // Bar chart with stacking
76
+ * {
77
+ * drawStyle: 'bars',
78
+ * barAlignment: 0,
79
+ * stacking: { mode: 'normal' }
80
+ * }
81
+ */
82
+ export interface GraphFieldConfig extends AxisConfig {
83
+ /** Draw style for the series */
84
+ drawStyle?: 'line' | 'bars' | 'points';
85
+ /** Gradient mode for fill */
86
+ gradientMode?: GraphGradientMode;
87
+ /** Threshold display style */
88
+ thresholdsStyle?: GraphThresholdsStyleConfig;
89
+ /** Line color override */
90
+ lineColor?: string;
91
+ /** Line width in pixels */
92
+ lineWidth?: number;
93
+ /** Line interpolation style */
94
+ lineInterpolation?: LineInterpolation;
95
+ /** Line style (solid, dash, dot) */
96
+ lineStyle?: LineStyleConfig;
97
+ /** Fill color override */
98
+ fillColor?: string;
99
+ /** Fill opacity (0-100) */
100
+ fillOpacity?: number;
101
+ /** Show points on lines */
102
+ showPoints?: VisibilityMode;
103
+ /** Point size in pixels */
104
+ pointSize?: number;
105
+ /** Point color override */
106
+ pointColor?: string;
107
+ /** Stacking configuration */
108
+ stacking?: StackingConfig;
109
+ /** Hide series from legend/tooltip/viz */
110
+ hideFrom?: HideSeriesConfig;
111
+ /** Bar alignment relative to time point */
112
+ barAlignment?: BarAlignment;
113
+ /** Maximum bar width in pixels */
114
+ barMaxWidth?: number;
115
+ /** Bar width factor (0-1) */
116
+ barWidthFactor?: number;
117
+ /** Connect null values (true, false, or threshold in ms) */
118
+ spanNulls?: boolean | number;
119
+ /** Insert nulls when time gap exceeds threshold (true, false, or threshold in ms) */
120
+ insertNulls?: boolean | number;
121
+ /** Transform values */
122
+ transform?: 'constant' | 'negative-Y';
123
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Field configuration types
3
+ *
4
+ * Types for configuring how data fields are displayed in graph panels.
5
+ *
6
+ * @see https://github.com/grafana/grafana/blob/main/packages/grafana-schema/src/common/common.gen.ts
7
+ */
8
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Common types export
3
+ *
4
+ * Grafana-aligned types for panel configuration.
5
+ * These types match the structures defined in @grafana/schema.
6
+ */
7
+ export type { VizOrientation, TooltipDisplayMode, SortOrder, VisibilityMode, AxisPlacement, AxisColorMode, LineInterpolation, BarAlignment, ScaleDistributionType, StackingMode, GraphGradientMode, BigValueJustifyMode, PercentChangeColorMode, BarGaugeSizing, BarGaugeDisplayMode, BarGaugeValueMode, BarGaugeNamePlacement, TableCellHeight, PieChartType, PieChartLabels, LineStyleFill, } from './enums.js';
8
+ export type { ScaleDistributionConfig, AxisConfig } from './axis.js';
9
+ export type { VizTooltipOptions, ReduceDataOptions, HideSeriesConfig, TextFormattingOptions, SingleStatBaseOptions, } from './viz-options.js';
10
+ export type { StackingConfig, LineStyleConfig, GraphThresholdsStyleConfig, GraphFieldConfig, } from './field-config.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Common types export
3
+ *
4
+ * Grafana-aligned types for panel configuration.
5
+ * These types match the structures defined in @grafana/schema.
6
+ */
7
+ export {};
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Visualization options types
3
+ *
4
+ * Types for configuring tooltips, legends, and data reduction.
5
+ *
6
+ * @see https://github.com/grafana/grafana/blob/main/packages/grafana-schema/src/common/common.gen.ts
7
+ */
8
+ import type { TooltipDisplayMode, SortOrder, VizOrientation } from './enums.js';
9
+ import type { LegendCalc } from '../display.js';
10
+ /**
11
+ * Tooltip configuration
12
+ *
13
+ * Controls how tooltips are displayed on hover.
14
+ *
15
+ * @example
16
+ * // Single series tooltip
17
+ * { mode: 'single', sort: 'none' }
18
+ *
19
+ * @example
20
+ * // Multi-series tooltip sorted descending
21
+ * { mode: 'multi', sort: 'desc', maxHeight: 300 }
22
+ */
23
+ export interface VizTooltipOptions {
24
+ /** Tooltip display mode */
25
+ mode: TooltipDisplayMode;
26
+ /** Sort order for values in tooltip (defaults to 'none') */
27
+ sort?: SortOrder;
28
+ /** Maximum tooltip height in pixels */
29
+ maxHeight?: number;
30
+ /** Maximum tooltip width in pixels */
31
+ maxWidth?: number;
32
+ }
33
+ /**
34
+ * Data reduction options
35
+ *
36
+ * Controls how multiple values are reduced to a single value.
37
+ *
38
+ * @example
39
+ * // Show last non-null value
40
+ * { calcs: ['lastNotNull'] }
41
+ *
42
+ * @example
43
+ * // Show mean and max
44
+ * { calcs: ['mean', 'max'] }
45
+ */
46
+ export interface ReduceDataOptions {
47
+ /** Calculations to perform (e.g., 'mean', 'max', 'last') */
48
+ calcs: (LegendCalc | string)[];
49
+ /** Field name or regex to match */
50
+ fields?: string;
51
+ /** Reduce all values, not just series */
52
+ values?: boolean;
53
+ /** Limit number of values */
54
+ limit?: number;
55
+ }
56
+ /**
57
+ * Hide series configuration
58
+ *
59
+ * Controls where a series is hidden from display.
60
+ *
61
+ * @example
62
+ * // Hide from legend only
63
+ * { legend: true, tooltip: false, viz: false }
64
+ */
65
+ export interface HideSeriesConfig {
66
+ /** Hide from legend */
67
+ legend: boolean;
68
+ /** Hide from tooltip */
69
+ tooltip: boolean;
70
+ /** Hide from visualization */
71
+ viz: boolean;
72
+ }
73
+ /**
74
+ * Text formatting options
75
+ *
76
+ * Font size options for single-stat style panels.
77
+ */
78
+ export interface TextFormattingOptions {
79
+ /** Title font size in pixels */
80
+ titleSize?: number;
81
+ /** Value font size in pixels */
82
+ valueSize?: number;
83
+ }
84
+ /**
85
+ * Single stat base options
86
+ *
87
+ * Base options shared by stat, gauge, and bar gauge panels.
88
+ */
89
+ export interface SingleStatBaseOptions extends TextFormattingOptions {
90
+ /** Data reduction options */
91
+ reduceOptions?: ReduceDataOptions;
92
+ /** Orientation of the visualization */
93
+ orientation?: VizOrientation;
94
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Visualization options types
3
+ *
4
+ * Types for configuring tooltips, legends, and data reduction.
5
+ *
6
+ * @see https://github.com/grafana/grafana/blob/main/packages/grafana-schema/src/common/common.gen.ts
7
+ */
8
+ export {};
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Common types used across components
3
+ */
4
+ /** Standard Grafana color names */
5
+ export type ThresholdColor = 'green' | 'yellow' | 'red' | 'orange' | 'blue' | 'transparent' | 'text';
6
+ /** Threshold display style on timeseries */
7
+ export type ThresholdStyle = 'off' | 'line' | 'area' | 'dashed' | 'line+area' | 'dashed+area';
8
+ /** Legend placement options */
9
+ export type LegendPlacement = 'right' | 'bottom';
10
+ /** Legend display modes */
11
+ export type LegendDisplayMode = 'table' | 'list' | 'hidden';
12
+ /** Legend calculation types */
13
+ export type LegendCalc = 'mean' | 'max' | 'min' | 'sum' | 'last' | 'lastNotNull' | 'first' | 'count';
14
+ /** Legend configuration */
15
+ export interface LegendConfig {
16
+ placement?: LegendPlacement;
17
+ displayMode?: LegendDisplayMode;
18
+ calcs?: LegendCalc[];
19
+ sortBy?: string;
20
+ sortDesc?: boolean;
21
+ }
22
+ /** Common Grafana units */
23
+ export type Unit = 'percent' | 'percentunit' | 'bytes' | 'decbytes' | 'bits' | 's' | 'ms' | 'ns' | 'dtdurations' | 'dthms' | 'Bps' | 'binBps' | 'bps' | 'reqps' | 'iops' | 'ops' | 'pps' | 'short' | 'none' | string;
24
+ /** Color modes for panels */
25
+ export type ColorMode = 'thresholds' | 'palette-classic' | 'palette-classic-by-name' | 'fixed' | 'continuous-GrYlRd';
26
+ /** Threshold specification formats */
27
+ export type ThresholdSpec = Record<number, ThresholdColor | string> | [number, ThresholdColor | string][];
28
+ /** Variable sort options */
29
+ export type VariableSort = 'disabled' | 'alpha' | 'alpha-desc' | 'num' | 'num-desc' | 'alpha-ci' | 'alpha-ci-desc';
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Common types used across components
3
+ */
4
+ export {};
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Grafana JSON output types
3
+ *
4
+ * These types represent the final Grafana dashboard JSON structure.
5
+ */
6
+ export interface GrafanaGridPos {
7
+ x: number;
8
+ y: number;
9
+ w: number;
10
+ h: number;
11
+ }
12
+ export interface GrafanaTarget {
13
+ refId: string;
14
+ expr: string;
15
+ legendFormat?: string;
16
+ instant?: boolean;
17
+ range?: boolean;
18
+ format?: 'time_series' | 'table' | 'heatmap';
19
+ hide?: boolean;
20
+ }
21
+ export interface GrafanaThreshold {
22
+ value: number | null;
23
+ color: string;
24
+ }
25
+ export interface GrafanaThresholds {
26
+ mode: 'absolute' | 'percentage';
27
+ steps: GrafanaThreshold[];
28
+ }
29
+ export interface GrafanaFieldConfig {
30
+ defaults: {
31
+ color?: {
32
+ mode: string;
33
+ fixedColor?: string;
34
+ };
35
+ custom?: Record<string, unknown>;
36
+ mappings?: unknown[];
37
+ thresholds?: GrafanaThresholds;
38
+ unit?: string;
39
+ decimals?: number;
40
+ min?: number;
41
+ max?: number;
42
+ noValue?: string;
43
+ };
44
+ overrides?: GrafanaOverride[];
45
+ }
46
+ export interface GrafanaOverride {
47
+ matcher: {
48
+ id: string;
49
+ options: string;
50
+ };
51
+ properties: Array<{
52
+ id: string;
53
+ value: unknown;
54
+ }>;
55
+ }
56
+ export interface GrafanaPanel {
57
+ id: number;
58
+ type: string;
59
+ title: string;
60
+ description?: string;
61
+ gridPos: GrafanaGridPos;
62
+ datasource?: {
63
+ uid: string;
64
+ type?: string;
65
+ };
66
+ targets?: GrafanaTarget[];
67
+ fieldConfig?: GrafanaFieldConfig;
68
+ options?: Record<string, unknown>;
69
+ transformations?: unknown[];
70
+ repeat?: string;
71
+ repeatDirection?: 'v' | 'h';
72
+ collapsed?: boolean;
73
+ panels?: GrafanaPanel[];
74
+ /** Plugin version (for plugin panels) */
75
+ pluginVersion?: string;
76
+ }
77
+ export interface GrafanaVariable {
78
+ name: string;
79
+ type: 'query' | 'constant' | 'custom' | 'datasource' | 'textbox';
80
+ label?: string;
81
+ query?: string | {
82
+ query: string;
83
+ refId?: string;
84
+ qryType?: number;
85
+ };
86
+ definition?: string;
87
+ current?: {
88
+ text: string | string[];
89
+ value: string | string[];
90
+ };
91
+ options?: unknown[];
92
+ multi?: boolean;
93
+ includeAll?: boolean;
94
+ allValue?: string;
95
+ refresh?: number;
96
+ sort?: number;
97
+ hide?: number;
98
+ regex?: string;
99
+ }
100
+ export interface GrafanaAnnotation {
101
+ name: string;
102
+ datasource: {
103
+ uid: string;
104
+ type?: string;
105
+ };
106
+ enable: boolean;
107
+ hide?: boolean;
108
+ iconColor: string;
109
+ expr?: string;
110
+ titleFormat?: string;
111
+ tagKeys?: string;
112
+ }
113
+ export interface GrafanaLink {
114
+ title: string;
115
+ url: string;
116
+ type: 'link' | 'dashboards';
117
+ icon?: string;
118
+ tooltip?: string;
119
+ keepTime?: boolean;
120
+ includeVars?: boolean;
121
+ targetBlank?: boolean;
122
+ tags?: string[];
123
+ asDropdown?: boolean;
124
+ }
125
+ export interface GrafanaDashboard {
126
+ uid: string;
127
+ title: string;
128
+ tags?: string[];
129
+ editable?: boolean;
130
+ refresh?: string | false;
131
+ time?: {
132
+ from: string;
133
+ to: string;
134
+ };
135
+ timezone?: 'browser' | 'utc' | string;
136
+ graphTooltip?: 0 | 1 | 2;
137
+ panels: GrafanaPanel[];
138
+ templating?: {
139
+ list: GrafanaVariable[];
140
+ };
141
+ annotations?: {
142
+ list: GrafanaAnnotation[];
143
+ };
144
+ links?: GrafanaLink[];
145
+ schemaVersion?: number;
146
+ fiscalYearStartMonth?: number;
147
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Grafana JSON output types
3
+ *
4
+ * These types represent the final Grafana dashboard JSON structure.
5
+ */
6
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type exports
3
+ *
4
+ * Shared types and Grafana output types.
5
+ * Component prop types are exported from components/index.js.
6
+ */
7
+ export type { ThresholdColor, ThresholdStyle, LegendPlacement, LegendDisplayMode, LegendCalc, LegendConfig, Unit, ColorMode, ThresholdSpec, VariableSort, } from './display.js';
8
+ export type { BasePanelProps, OverrideConfig, TableColumnOverride, Transformation, } from './panel-base.js';
9
+ export type { GrafanaDashboard, GrafanaPanel, GrafanaTarget, GrafanaVariable, GrafanaAnnotation, GrafanaLink, GrafanaGridPos, GrafanaThreshold, GrafanaThresholds, GrafanaFieldConfig, GrafanaOverride, } from './grafana-json.js';
10
+ export type { VizOrientation, TooltipDisplayMode, SortOrder, VisibilityMode, AxisPlacement, AxisColorMode, LineInterpolation, BarAlignment, ScaleDistributionType, StackingMode, GraphGradientMode, BigValueJustifyMode, PercentChangeColorMode, BarGaugeSizing, BarGaugeDisplayMode, BarGaugeValueMode, BarGaugeNamePlacement, TableCellHeight, PieChartType, PieChartLabels, LineStyleFill, ScaleDistributionConfig, AxisConfig, VizTooltipOptions, ReduceDataOptions, HideSeriesConfig, TextFormattingOptions, SingleStatBaseOptions, StackingConfig, LineStyleConfig, GraphThresholdsStyleConfig, GraphFieldConfig, } from './common/index.js';
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Type exports
3
+ *
4
+ * Shared types and Grafana output types.
5
+ * Component prop types are exported from components/index.js.
6
+ */
7
+ export {};
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Base panel prop types shared across all panels
3
+ */
4
+ import type { ReactNode } from 'react';
5
+ import type { ThresholdSpec } from './display.js';
6
+ export interface BasePanelProps {
7
+ /** Panel title */
8
+ title: string;
9
+ /** Panel description */
10
+ description?: string;
11
+ /** Override datasource for this panel (defaults to dashboard datasource) */
12
+ datasource?: string;
13
+ /** Panel width in grid units (1-24) */
14
+ width?: number;
15
+ /** Panel height in grid units */
16
+ height?: number;
17
+ /** X position (0-23) */
18
+ x?: number;
19
+ /** Y position */
20
+ y?: number;
21
+ /** Variable to repeat panel for */
22
+ repeat?: string;
23
+ /** Repeat direction */
24
+ repeatDirection?: 'v' | 'h';
25
+ /** Panel children (queries or query strings) */
26
+ children?: ReactNode;
27
+ }
28
+ /** Override configuration for field-specific styling */
29
+ export interface OverrideConfig {
30
+ /** Match by query refId */
31
+ refId?: string;
32
+ /** Match by exact field name */
33
+ fieldName?: string;
34
+ /** Match by field name regex */
35
+ fieldRegex?: string;
36
+ /** Fixed color */
37
+ color?: string;
38
+ /** Color mode (shades, fixed) */
39
+ colorMode?: 'shades' | 'fixed';
40
+ /** Override display name */
41
+ displayName?: string;
42
+ /** Override thresholds */
43
+ thresholds?: ThresholdSpec;
44
+ }
45
+ /** Table column override configuration */
46
+ export interface TableColumnOverride {
47
+ /** Column name to match */
48
+ name: string;
49
+ /** Display unit */
50
+ unit?: string;
51
+ /** Column width in pixels */
52
+ width?: number;
53
+ }
54
+ /** Transformation configuration */
55
+ export interface Transformation {
56
+ /** Transformation type ID */
57
+ id: string;
58
+ /** Transformation options */
59
+ options: Record<string, unknown>;
60
+ }
61
+ /** Utility props for field overrides */
62
+ export interface OverrideProps {
63
+ /** Field matcher */
64
+ match: {
65
+ field?: string;
66
+ regex?: string;
67
+ refId?: string;
68
+ };
69
+ /** Properties to override */
70
+ properties: Record<string, unknown>;
71
+ children?: ReactNode;
72
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Base panel prop types shared across all panels
3
+ */
4
+ export {};
package/package.json CHANGED
@@ -1,5 +1,69 @@
1
1
  {
2
2
  "name": "grafana-react",
3
- "version": "0.0.0",
4
- "description": "React DSL for Grafana dashboards - coming soon"
5
- }
3
+ "version": "0.0.2",
4
+ "description": "React-based DSL for creating Grafana dashboards",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "main": "./build/index.js",
8
+ "types": "./build/index.d.ts",
9
+ "bin": {
10
+ "grafana-react": "./build/cli/index.js"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./build/index.d.ts",
15
+ "import": "./build/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "build",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/kiwi-research/grafana-react.git"
26
+ },
27
+ "bugs": {
28
+ "url": "https://github.com/kiwi-research/grafana-react/issues"
29
+ },
30
+ "homepage": "https://github.com/kiwi-research/grafana-react#readme",
31
+ "keywords": [
32
+ "grafana",
33
+ "dashboard",
34
+ "react",
35
+ "jsx",
36
+ "dsl",
37
+ "monitoring",
38
+ "visualization",
39
+ "typescript"
40
+ ],
41
+ "scripts": {
42
+ "build": "tsc -p ./tsconfig.json",
43
+ "typecheck": "tsgo --noEmit -p ./tsconfig.json",
44
+ "lint": "pnpm run lint:prettier && pnpm run lint:eslint",
45
+ "lint:eslint": "eslint src/ --cache",
46
+ "lint:prettier": "prettier . --check",
47
+ "lint-fix": "pnpm run lint-fix:prettier && pnpm run lint-fix:eslint",
48
+ "lint-fix:eslint": "eslint src/ --cache --fix",
49
+ "lint-fix:prettier": "prettier . --write",
50
+ "test": "node --test build/**/*.test.js"
51
+ },
52
+ "dependencies": {},
53
+ "devDependencies": {
54
+ "react": "^19.2.3",
55
+ "tsx": "^4.21.0",
56
+ "@types/node": "^25.0.5",
57
+ "@types/react": "^19.2.7",
58
+ "@typescript/native-preview": "^7.0.0-dev.20260109.1",
59
+ "eslint": "^9.39.2",
60
+ "prettier": "^3.7.4",
61
+ "typescript": "^5.9.3",
62
+ "typescript-eslint": "^8.52.0"
63
+ },
64
+ "peerDependencies": {
65
+ "react": "^18.0.0 || ^19.0.0",
66
+ "tsx": "^4.0.0",
67
+ "typescript": "^5.0.0"
68
+ }
69
+ }