@arcfusionz/arc-analytic-ui 0.0.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.
Files changed (156) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +13 -0
  2. package/dist/components/AnomalyCard/AnomalyCard.chart.d.ts +64 -0
  3. package/dist/components/AnomalyCard/AnomalyCard.chart.js +341 -0
  4. package/dist/components/AnomalyCard/AnomalyCard.d.ts +169 -0
  5. package/dist/components/AnomalyCard/AnomalyCard.js +1019 -0
  6. package/dist/components/AnomalyCard/AnomalyCard.model.d.ts +508 -0
  7. package/dist/components/AnomalyCard/AnomalyCard.model.js +553 -0
  8. package/dist/components/AnomalyCard/index.d.ts +4 -0
  9. package/dist/components/AnomalyCard/index.js +4 -0
  10. package/dist/components/ChartCard/ChartCard.chart.d.ts +72 -0
  11. package/dist/components/ChartCard/ChartCard.chart.js +1333 -0
  12. package/dist/components/ChartCard/ChartCard.d.ts +206 -0
  13. package/dist/components/ChartCard/ChartCard.js +718 -0
  14. package/dist/components/ChartCard/ChartCard.model.d.ts +452 -0
  15. package/dist/components/ChartCard/ChartCard.model.js +1223 -0
  16. package/dist/components/ChartCard/index.d.ts +4 -0
  17. package/dist/components/ChartCard/index.js +4 -0
  18. package/dist/components/ComparisonCard/ComparisonCard.chart.d.ts +80 -0
  19. package/dist/components/ComparisonCard/ComparisonCard.chart.js +337 -0
  20. package/dist/components/ComparisonCard/ComparisonCard.d.ts +200 -0
  21. package/dist/components/ComparisonCard/ComparisonCard.js +1325 -0
  22. package/dist/components/ComparisonCard/ComparisonCard.model.d.ts +309 -0
  23. package/dist/components/ComparisonCard/ComparisonCard.model.js +263 -0
  24. package/dist/components/ComparisonCard/index.d.ts +4 -0
  25. package/dist/components/ComparisonCard/index.js +4 -0
  26. package/dist/components/ForecastCard/ForecastCard.chart.d.ts +82 -0
  27. package/dist/components/ForecastCard/ForecastCard.chart.js +416 -0
  28. package/dist/components/ForecastCard/ForecastCard.d.ts +148 -0
  29. package/dist/components/ForecastCard/ForecastCard.js +1029 -0
  30. package/dist/components/ForecastCard/ForecastCard.model.d.ts +497 -0
  31. package/dist/components/ForecastCard/ForecastCard.model.js +554 -0
  32. package/dist/components/ForecastCard/index.d.ts +4 -0
  33. package/dist/components/ForecastCard/index.js +4 -0
  34. package/dist/components/HighlightCard/HighlightCard.chart.d.ts +122 -0
  35. package/dist/components/HighlightCard/HighlightCard.chart.js +660 -0
  36. package/dist/components/HighlightCard/HighlightCard.d.ts +202 -0
  37. package/dist/components/HighlightCard/HighlightCard.js +1286 -0
  38. package/dist/components/HighlightCard/HighlightCard.model.d.ts +692 -0
  39. package/dist/components/HighlightCard/HighlightCard.model.js +875 -0
  40. package/dist/components/HighlightCard/index.d.ts +4 -0
  41. package/dist/components/HighlightCard/index.js +4 -0
  42. package/dist/components/InsightCard/InsightCard.chart.d.ts +91 -0
  43. package/dist/components/InsightCard/InsightCard.chart.js +471 -0
  44. package/dist/components/InsightCard/InsightCard.d.ts +161 -0
  45. package/dist/components/InsightCard/InsightCard.js +961 -0
  46. package/dist/components/InsightCard/InsightCard.model.d.ts +405 -0
  47. package/dist/components/InsightCard/InsightCard.model.js +421 -0
  48. package/dist/components/InsightCard/index.d.ts +4 -0
  49. package/dist/components/InsightCard/index.js +4 -0
  50. package/dist/components/MetricCard/MetricCard.chart.d.ts +79 -0
  51. package/dist/components/MetricCard/MetricCard.chart.js +435 -0
  52. package/dist/components/MetricCard/MetricCard.d.ts +227 -0
  53. package/dist/components/MetricCard/MetricCard.js +1293 -0
  54. package/dist/components/MetricCard/MetricCard.model.d.ts +521 -0
  55. package/dist/components/MetricCard/MetricCard.model.js +627 -0
  56. package/dist/components/MetricCard/index.d.ts +4 -0
  57. package/dist/components/MetricCard/index.js +4 -0
  58. package/dist/components/ProfileCard/ProfileCard.chart.d.ts +64 -0
  59. package/dist/components/ProfileCard/ProfileCard.chart.js +427 -0
  60. package/dist/components/ProfileCard/ProfileCard.d.ts +140 -0
  61. package/dist/components/ProfileCard/ProfileCard.js +735 -0
  62. package/dist/components/ProfileCard/ProfileCard.model.d.ts +279 -0
  63. package/dist/components/ProfileCard/ProfileCard.model.js +244 -0
  64. package/dist/components/ProfileCard/index.d.ts +4 -0
  65. package/dist/components/ProfileCard/index.js +4 -0
  66. package/dist/components/ProgressCard/ProgressCard.chart.d.ts +73 -0
  67. package/dist/components/ProgressCard/ProgressCard.chart.js +373 -0
  68. package/dist/components/ProgressCard/ProgressCard.d.ts +137 -0
  69. package/dist/components/ProgressCard/ProgressCard.js +908 -0
  70. package/dist/components/ProgressCard/ProgressCard.model.d.ts +385 -0
  71. package/dist/components/ProgressCard/ProgressCard.model.js +389 -0
  72. package/dist/components/ProgressCard/index.d.ts +4 -0
  73. package/dist/components/ProgressCard/index.js +4 -0
  74. package/dist/components/ReportCard/ReportCard.chart.d.ts +45 -0
  75. package/dist/components/ReportCard/ReportCard.chart.js +231 -0
  76. package/dist/components/ReportCard/ReportCard.d.ts +153 -0
  77. package/dist/components/ReportCard/ReportCard.js +1118 -0
  78. package/dist/components/ReportCard/ReportCard.model.d.ts +392 -0
  79. package/dist/components/ReportCard/ReportCard.model.js +399 -0
  80. package/dist/components/ReportCard/index.d.ts +4 -0
  81. package/dist/components/ReportCard/index.js +4 -0
  82. package/dist/components/SankeyCard/SankeyCard.chart.d.ts +75 -0
  83. package/dist/components/SankeyCard/SankeyCard.chart.js +249 -0
  84. package/dist/components/SankeyCard/SankeyCard.d.ts +185 -0
  85. package/dist/components/SankeyCard/SankeyCard.js +788 -0
  86. package/dist/components/SankeyCard/SankeyCard.model.d.ts +501 -0
  87. package/dist/components/SankeyCard/SankeyCard.model.js +789 -0
  88. package/dist/components/SankeyCard/index.d.ts +4 -0
  89. package/dist/components/SankeyCard/index.js +4 -0
  90. package/dist/components/StatusCard/StatusCard.chart.d.ts +60 -0
  91. package/dist/components/StatusCard/StatusCard.chart.js +188 -0
  92. package/dist/components/StatusCard/StatusCard.d.ts +176 -0
  93. package/dist/components/StatusCard/StatusCard.js +989 -0
  94. package/dist/components/StatusCard/StatusCard.model.d.ts +555 -0
  95. package/dist/components/StatusCard/StatusCard.model.js +776 -0
  96. package/dist/components/StatusCard/index.d.ts +4 -0
  97. package/dist/components/StatusCard/index.js +4 -0
  98. package/dist/components/TableCard/TableCard.chart.d.ts +53 -0
  99. package/dist/components/TableCard/TableCard.chart.js +192 -0
  100. package/dist/components/TableCard/TableCard.d.ts +140 -0
  101. package/dist/components/TableCard/TableCard.js +811 -0
  102. package/dist/components/TableCard/TableCard.model.d.ts +381 -0
  103. package/dist/components/TableCard/TableCard.model.js +475 -0
  104. package/dist/components/TableCard/index.d.ts +4 -0
  105. package/dist/components/TableCard/index.js +4 -0
  106. package/dist/components/TargetCard/TargetCard.chart.d.ts +52 -0
  107. package/dist/components/TargetCard/TargetCard.chart.js +273 -0
  108. package/dist/components/TargetCard/TargetCard.d.ts +143 -0
  109. package/dist/components/TargetCard/TargetCard.js +910 -0
  110. package/dist/components/TargetCard/TargetCard.model.d.ts +468 -0
  111. package/dist/components/TargetCard/TargetCard.model.js +581 -0
  112. package/dist/components/TargetCard/index.d.ts +4 -0
  113. package/dist/components/TargetCard/index.js +4 -0
  114. package/dist/components/TreeCard/TreeCard.chart.d.ts +80 -0
  115. package/dist/components/TreeCard/TreeCard.chart.js +178 -0
  116. package/dist/components/TreeCard/TreeCard.d.ts +182 -0
  117. package/dist/components/TreeCard/TreeCard.js +1187 -0
  118. package/dist/components/TreeCard/TreeCard.model.d.ts +330 -0
  119. package/dist/components/TreeCard/TreeCard.model.js +401 -0
  120. package/dist/components/TreeCard/index.d.ts +4 -0
  121. package/dist/components/TreeCard/index.js +4 -0
  122. package/dist/components/TrendCard/TrendCard.chart.d.ts +75 -0
  123. package/dist/components/TrendCard/TrendCard.chart.js +393 -0
  124. package/dist/components/TrendCard/TrendCard.d.ts +224 -0
  125. package/dist/components/TrendCard/TrendCard.js +1053 -0
  126. package/dist/components/TrendCard/TrendCard.model.d.ts +545 -0
  127. package/dist/components/TrendCard/TrendCard.model.js +623 -0
  128. package/dist/components/TrendCard/index.d.ts +4 -0
  129. package/dist/components/TrendCard/index.js +4 -0
  130. package/dist/index.d.ts +76 -0
  131. package/dist/index.js +57 -0
  132. package/dist/lib/vega/ArcVegaChart.d.ts +24 -0
  133. package/dist/lib/vega/ArcVegaChart.js +42 -0
  134. package/dist/lib/vega/ArcVegaSurface.d.ts +13 -0
  135. package/dist/lib/vega/ArcVegaSurface.js +38 -0
  136. package/dist/lib/vega/axisTicks.js +156 -0
  137. package/dist/lib/vega/config.d.ts +29 -0
  138. package/dist/lib/vega/config.js +113 -0
  139. package/dist/lib/vega/embed.d.ts +29 -0
  140. package/dist/lib/vega/embed.js +29 -0
  141. package/dist/lib/vega/engine.d.ts +10 -0
  142. package/dist/lib/vega/engine.js +6 -0
  143. package/dist/lib/vega/formatters.d.ts +125 -0
  144. package/dist/lib/vega/formatters.js +277 -0
  145. package/dist/lib/vega/index.d.ts +11 -0
  146. package/dist/lib/vega/load.d.ts +13 -0
  147. package/dist/lib/vega/load.js +21 -0
  148. package/dist/lib/vega/time.d.ts +45 -0
  149. package/dist/lib/vega/time.js +105 -0
  150. package/dist/lib/vega/tokens.d.ts +73 -0
  151. package/dist/lib/vega/tokens.js +137 -0
  152. package/dist/lib/vega/tooltip.d.ts +45 -0
  153. package/dist/lib/vega/tooltip.js +124 -0
  154. package/dist/lib/vega/useArcVega.d.ts +43 -0
  155. package/dist/lib/vega/useArcVega.js +121 -0
  156. package/package.json +60 -0
@@ -0,0 +1,4 @@
1
+ import { BuildStatusDescriptionInput, BuildStatusExplanationInput, BuildStatusStripInput, CreateStatusFormattersInput, DEFAULT_STATUS_LABELS, DeriveStatusRunInput, DeriveStatusStateInput, FormatDurationOptions, STATUS_LEVELS, STATUS_SEVERITY, StatusCardLabels, StatusCardSize, StatusCardState, StatusCardStatus, StatusChartDescriptionInput, StatusDetailRow, StatusDurationUnits, StatusExplanationInput, StatusHeadline, StatusHold, StatusIncident, StatusIncidentRow, StatusLevel, StatusPeriod, StatusPolarity, StatusResolution, StatusRun, StatusSegment, StatusSla, StatusStrip, StatusStripRow, StatusTextFormatters, StatusUptimeMode, StatusVerdict, StatusWindow, StatusWindowInput, buildStatusChartDescription, buildStatusDescription, buildStatusDetailRows, buildStatusExplanation, buildStatusIncidentRows, buildStatusStrip, createStatusFormatters, deriveIncidents, deriveStatusRun, deriveStatusState, describeResolution, formatDuration, formatStripCell, normalizeHistory, resolveStatusHold, resolveStatusLabels, resolveStatusWindow, resolveStep, statusHue, statusLevelBreakdown, statusStepKey } from "./StatusCard.model.js";
2
+ import { StatusCard, StatusCardBaseProps, StatusCardLabelProps, StatusCardProps } from "./StatusCard.js";
3
+ import { STATUS_AXIS_ROW_PX, STATUS_CELL_GAP_MAX_PX, STATUS_CELL_GAP_MIN_PX, STATUS_CELL_GAP_RATIO, STATUS_HOVER_PARAM, STATUS_MAX_PARAM, STATUS_MIN_CELL_PX, STATUS_MIN_PARAM, STATUS_TABLE_DATASET, STATUS_WINDOW_DATASET, STATUS_X_TICKS_PARAM, StatusTimelineSpecOptions, buildStatusTimelineSpec } from "./StatusCard.chart.js";
4
+ export { type BuildStatusDescriptionInput, type BuildStatusExplanationInput, type BuildStatusStripInput, type CreateStatusFormattersInput, DEFAULT_STATUS_LABELS, type DeriveStatusRunInput, type DeriveStatusStateInput, type FormatDurationOptions, STATUS_AXIS_ROW_PX, STATUS_CELL_GAP_MAX_PX, STATUS_CELL_GAP_MIN_PX, STATUS_CELL_GAP_RATIO, STATUS_HOVER_PARAM, STATUS_LEVELS, STATUS_MAX_PARAM, STATUS_MIN_CELL_PX, STATUS_MIN_PARAM, STATUS_SEVERITY, STATUS_TABLE_DATASET, STATUS_WINDOW_DATASET, STATUS_X_TICKS_PARAM, StatusCard, type StatusCardBaseProps, type StatusCardLabelProps, type StatusCardLabels, type StatusCardProps, type StatusCardSize, type StatusCardState, type StatusCardStatus, type StatusChartDescriptionInput, type StatusDetailRow, type StatusDurationUnits, type StatusExplanationInput, type StatusHeadline, type StatusHold, type StatusIncident, type StatusIncidentRow, type StatusLevel, type StatusPeriod, type StatusPolarity, type StatusResolution, type StatusRun, type StatusSegment, type StatusSla, type StatusStrip, type StatusStripRow, type StatusTextFormatters, type StatusTimelineSpecOptions, type StatusUptimeMode, type StatusVerdict, type StatusWindow, type StatusWindowInput, buildStatusChartDescription, buildStatusDescription, buildStatusDetailRows, buildStatusExplanation, buildStatusIncidentRows, buildStatusStrip, buildStatusTimelineSpec, createStatusFormatters, deriveIncidents, deriveStatusRun, deriveStatusState, describeResolution, formatDuration, formatStripCell, normalizeHistory, resolveStatusHold, resolveStatusLabels, resolveStatusWindow, resolveStep, statusHue, statusLevelBreakdown, statusStepKey };
@@ -0,0 +1,4 @@
1
+ import { STATUS_AXIS_ROW_PX, STATUS_CELL_GAP_MAX_PX, STATUS_CELL_GAP_MIN_PX, STATUS_CELL_GAP_RATIO, STATUS_HOVER_PARAM, STATUS_MAX_PARAM, STATUS_MIN_CELL_PX, STATUS_MIN_PARAM, STATUS_TABLE_DATASET, STATUS_WINDOW_DATASET, STATUS_X_TICKS_PARAM, buildStatusTimelineSpec } from "./StatusCard.chart.js";
2
+ import { DEFAULT_STATUS_LABELS, STATUS_LEVELS, STATUS_SEVERITY, buildStatusChartDescription, buildStatusDescription, buildStatusDetailRows, buildStatusExplanation, buildStatusIncidentRows, buildStatusStrip, createStatusFormatters, deriveIncidents, deriveStatusRun, deriveStatusState, describeResolution, formatDuration, formatStripCell, normalizeHistory, resolveStatusHold, resolveStatusLabels, resolveStatusWindow, resolveStep, statusHue, statusLevelBreakdown, statusStepKey } from "./StatusCard.model.js";
3
+ import { StatusCard } from "./StatusCard.js";
4
+ export { DEFAULT_STATUS_LABELS, STATUS_AXIS_ROW_PX, STATUS_CELL_GAP_MAX_PX, STATUS_CELL_GAP_MIN_PX, STATUS_CELL_GAP_RATIO, STATUS_HOVER_PARAM, STATUS_LEVELS, STATUS_MAX_PARAM, STATUS_MIN_CELL_PX, STATUS_MIN_PARAM, STATUS_SEVERITY, STATUS_TABLE_DATASET, STATUS_WINDOW_DATASET, STATUS_X_TICKS_PARAM, StatusCard, buildStatusChartDescription, buildStatusDescription, buildStatusDetailRows, buildStatusExplanation, buildStatusIncidentRows, buildStatusStrip, buildStatusTimelineSpec, createStatusFormatters, deriveIncidents, deriveStatusRun, deriveStatusState, describeResolution, formatDuration, formatStripCell, normalizeHistory, resolveStatusHold, resolveStatusLabels, resolveStatusWindow, resolveStep, statusHue, statusLevelBreakdown, statusStepKey };
@@ -0,0 +1,53 @@
1
+ import { ChartTokens } from "../../lib/vega/tokens.js";
2
+ import { TableCardTrendMark } from "./TableCard.model.js";
3
+ import { arcVegaConfig } from "../../lib/vega/config.js";
4
+ import { TopLevelSpec } from "vega-lite";
5
+ //#region src/components/TableCard/TableCard.chart.d.ts
6
+ /** The readings: `{ x, y }` per `TableCardTrendPoint`. */
7
+ declare const TABLE_TREND_DATASET = "table";
8
+ /** Zero or one row — the last reading with a value, marked with a dot. */
9
+ declare const TABLE_TREND_LATEST_DATASET = "latest";
10
+ /** The nearest-point hover selection. */
11
+ declare const TABLE_TREND_HOVER_PARAM = "hover";
12
+ interface TableTrendSpecOptions {
13
+ /** `line` may crop its y domain; `area` and `bar` keep a zero baseline. */
14
+ mark: TableCardTrendMark;
15
+ /** Plot height in pixels — the row's content height, so the table's rhythm decides it. */
16
+ height: number;
17
+ /** Dot the last reading, so the cell's own value and the plot's right edge agree. */
18
+ latest: boolean;
19
+ /** Wire the nearest-point hover selection and the tooltip channel. */
20
+ tooltip: boolean;
21
+ /** `temporal` when the readings carry real dates, `ordinal` for categories, `quantitative` for an index. */
22
+ xType: "temporal" | "ordinal" | "quantitative";
23
+ /** Tooltip titles — the column's own header and the period's name. */
24
+ xTitle: string;
25
+ yTitle: string;
26
+ /** `arcNumber` grammar for the readings (`compact@en-US`). */
27
+ valueFormat: string;
28
+ /** `arcTime` grammar for a temporal x in the tooltip (`day@en-US@Asia/Bangkok`). */
29
+ timeFormat: string;
30
+ locale?: string;
31
+ timeZone?: string;
32
+ /** d3 locale definitions for the parts of Vega-Lite that still format through d3. */
33
+ vegaLocale?: ReturnType<typeof arcVegaConfig>["locale"];
34
+ }
35
+ /**
36
+ * Builds a table-cell sparkline: a bare line (or an area with a crisp line on
37
+ * top, or thin bars), the last reading as a dot, and a nearest-point hover
38
+ * layer carrying the tooltip. No axes, no grid, no legend, no title — the
39
+ * cell's own text and its neighbouring columns carry every number, so the
40
+ * plot is the shape and nothing else.
41
+ *
42
+ * `aria: false` on every mark: the plot is a redundant visual hint inside a
43
+ * cell whose reading is already text (the component hides it from the
44
+ * accessibility tree and puts the series' sentence in the cell instead), so
45
+ * a `graphics-symbol` node per reading × a row per table would be pure noise.
46
+ *
47
+ * Gaps stay gaps — Vega-Lite's default `invalid` handling breaks the path at a
48
+ * null reading rather than drawing through it, so a missing day never reads as
49
+ * a dip to zero.
50
+ */
51
+ declare function buildTableTrendSpec(options: TableTrendSpecOptions, tokens: ChartTokens): TopLevelSpec;
52
+ //#endregion
53
+ export { TABLE_TREND_DATASET, TABLE_TREND_HOVER_PARAM, TABLE_TREND_LATEST_DATASET, TableTrendSpecOptions, buildTableTrendSpec };
@@ -0,0 +1,192 @@
1
+ import { arcVegaConfig } from "../../lib/vega/config.js";
2
+ //#region src/components/TableCard/TableCard.chart.ts
3
+ /** The readings: `{ x, y }` per `TableCardTrendPoint`. */
4
+ const TABLE_TREND_DATASET = "table";
5
+ /** Zero or one row — the last reading with a value, marked with a dot. */
6
+ const TABLE_TREND_LATEST_DATASET = "latest";
7
+ /** The nearest-point hover selection. */
8
+ const TABLE_TREND_HOVER_PARAM = "hover";
9
+ const LINE_WIDTH = 1.5;
10
+ const POINT_SIZE = 28;
11
+ const PLOT_PADDING = 4;
12
+ const NOMINAL_WIDTH = 120;
13
+ const BAR_WIDTH_EXPR = "min(6, bandwidth('x') * 0.7)";
14
+ /**
15
+ * Builds a table-cell sparkline: a bare line (or an area with a crisp line on
16
+ * top, or thin bars), the last reading as a dot, and a nearest-point hover
17
+ * layer carrying the tooltip. No axes, no grid, no legend, no title — the
18
+ * cell's own text and its neighbouring columns carry every number, so the
19
+ * plot is the shape and nothing else.
20
+ *
21
+ * `aria: false` on every mark: the plot is a redundant visual hint inside a
22
+ * cell whose reading is already text (the component hides it from the
23
+ * accessibility tree and puts the series' sentence in the cell instead), so
24
+ * a `graphics-symbol` node per reading × a row per table would be pure noise.
25
+ *
26
+ * Gaps stay gaps — Vega-Lite's default `invalid` handling breaks the path at a
27
+ * null reading rather than drawing through it, so a missing day never reads as
28
+ * a dip to zero.
29
+ */
30
+ function buildTableTrendSpec(options, tokens) {
31
+ const { mark, height, latest, tooltip, xType, xTitle, yTitle, valueFormat, timeFormat, locale, timeZone, vegaLocale } = options;
32
+ const zero = mark !== "line";
33
+ const xField = mark === "bar" || xType === "ordinal" ? {
34
+ field: "x",
35
+ type: "ordinal",
36
+ sort: null,
37
+ axis: null
38
+ } : {
39
+ field: "x",
40
+ type: xType,
41
+ axis: null,
42
+ scale: {
43
+ nice: false,
44
+ ...xType === "quantitative" ? { zero: false } : {}
45
+ }
46
+ };
47
+ const yField = {
48
+ field: "y",
49
+ type: "quantitative",
50
+ axis: null,
51
+ scale: {
52
+ zero,
53
+ nice: false
54
+ }
55
+ };
56
+ const tooltipChannel = [xType === "temporal" ? {
57
+ field: "x",
58
+ type: "temporal",
59
+ title: xTitle,
60
+ format: timeFormat,
61
+ formatType: "arcTime"
62
+ } : xType === "quantitative" ? {
63
+ field: "x",
64
+ type: "quantitative",
65
+ title: xTitle,
66
+ format: "integer",
67
+ formatType: "arcNumber"
68
+ } : {
69
+ field: "x",
70
+ type: "nominal",
71
+ title: xTitle
72
+ }, {
73
+ field: "y",
74
+ type: "quantitative",
75
+ title: yTitle,
76
+ format: valueFormat,
77
+ formatType: "arcNumber"
78
+ }];
79
+ const layers = [];
80
+ if (mark === "bar") layers.push({
81
+ mark: {
82
+ type: "bar",
83
+ fill: tokens.emphasis,
84
+ cornerRadiusEnd: 1,
85
+ width: { expr: BAR_WIDTH_EXPR },
86
+ aria: false
87
+ },
88
+ encoding: {
89
+ x: xField,
90
+ y: yField
91
+ }
92
+ });
93
+ else {
94
+ if (mark === "area") layers.push({
95
+ mark: {
96
+ type: "area",
97
+ fill: tokens.emphasis,
98
+ fillOpacity: .12,
99
+ line: false,
100
+ interpolate: "linear",
101
+ aria: false
102
+ },
103
+ encoding: {
104
+ x: xField,
105
+ y: yField
106
+ }
107
+ });
108
+ layers.push({
109
+ mark: {
110
+ type: "line",
111
+ stroke: tokens.emphasis,
112
+ strokeWidth: LINE_WIDTH,
113
+ strokeCap: "round",
114
+ strokeJoin: "round",
115
+ interpolate: "linear",
116
+ aria: false
117
+ },
118
+ encoding: {
119
+ x: xField,
120
+ y: yField
121
+ }
122
+ });
123
+ }
124
+ if (latest) layers.push({
125
+ data: { name: TABLE_TREND_LATEST_DATASET },
126
+ mark: {
127
+ type: "point",
128
+ filled: true,
129
+ size: POINT_SIZE,
130
+ fill: tokens.emphasis,
131
+ stroke: tokens.background,
132
+ strokeWidth: 1,
133
+ aria: false
134
+ },
135
+ encoding: {
136
+ x: xField,
137
+ y: yField
138
+ }
139
+ });
140
+ if (tooltip) layers.push({
141
+ params: [{
142
+ name: TABLE_TREND_HOVER_PARAM,
143
+ select: {
144
+ type: "point",
145
+ on: "pointerover",
146
+ clear: "pointerout",
147
+ nearest: true,
148
+ encodings: ["x"]
149
+ }
150
+ }],
151
+ mark: {
152
+ type: "point",
153
+ filled: true,
154
+ size: POINT_SIZE,
155
+ fill: tokens.emphasis,
156
+ aria: false
157
+ },
158
+ encoding: {
159
+ x: xField,
160
+ y: yField,
161
+ opacity: {
162
+ condition: {
163
+ param: TABLE_TREND_HOVER_PARAM,
164
+ empty: false,
165
+ value: 1
166
+ },
167
+ value: 0
168
+ },
169
+ tooltip: tooltipChannel
170
+ }
171
+ });
172
+ return {
173
+ $schema: "https://vega.github.io/schema/vega-lite/v6.json",
174
+ data: { name: TABLE_TREND_DATASET },
175
+ autosize: {
176
+ type: "fit",
177
+ contains: "padding",
178
+ resize: true
179
+ },
180
+ padding: PLOT_PADDING,
181
+ width: NOMINAL_WIDTH,
182
+ height,
183
+ layer: layers,
184
+ config: arcVegaConfig(tokens, {
185
+ locale,
186
+ timeZone,
187
+ vegaLocale
188
+ })
189
+ };
190
+ }
191
+ //#endregion
192
+ export { TABLE_TREND_DATASET, TABLE_TREND_HOVER_PARAM, TABLE_TREND_LATEST_DATASET, buildTableTrendSpec };
@@ -0,0 +1,140 @@
1
+ import { ArcTimeGranularity } from "../../lib/vega/formatters.js";
2
+ import { TableCardColumn, TableCardLabels, TableCardRow, TableCardSize, TableCardSort, TableCardStatus, TableCardTrendColumn } from "./TableCard.model.js";
3
+ import { ReactNode } from "react";
4
+ import { BoxProps } from "@arcfusionz/arc-primitive-ui";
5
+ import { TopLevelSpec } from "vega-lite";
6
+ import { Result } from "vega-embed";
7
+ //#region src/components/TableCard/TableCard.d.ts
8
+ interface TableCardBaseProps extends Omit<BoxProps, "children" | "padding" | "title"> {
9
+ /** The table's name — the card's heading. Pass `name` too when this is not plain text. */
10
+ label: ReactNode;
11
+ /** Plain-text name used in the generated description, the table's caption and every control's accessible name. Required when `label` is not a string. */
12
+ name?: string;
13
+ /** What the table shows and how it is built, in a tooltip behind an info control beside the heading and read as that control's description. */
14
+ hint?: string;
15
+ /**
16
+ * The columns, in reading order. Each declares the `field` it reads on every
17
+ * row, its `header`, and the `kind` that decides how the cell encodes:
18
+ * `text` (identity), `number` (the exact reading), `bar` (magnitude on the
19
+ * column's own zero-based scale), `delta` (the change against a baseline),
20
+ * `trend` (the shape over time, the one Vega cell), `badge` (a category).
21
+ * The first `text` column becomes each row's header cell and the one that
22
+ * stays pinned when the table scrolls sideways.
23
+ */
24
+ columns: readonly TableCardColumn[];
25
+ /**
26
+ * The rows as plain records — `{ campaign: "Search", spend: 412000, … }` —
27
+ * read at each column's `field`. Values may be `null`: the cell prints a
28
+ * dash and sorts last, in either direction. Pass `[]` while loading;
29
+ * `expectedRows` skeleton rows are reserved.
30
+ */
31
+ rows: readonly TableCardRow[];
32
+ /** Field that identifies a row for selection and React keys. Default: the first `text` column's field. */
33
+ rowKey?: string;
34
+ /** What the consumer's transport reports. `loading` over existing rows is a refresh: the table stays, dimmed. Stamped as `data-status`. */
35
+ status?: TableCardStatus;
36
+ /** Body rows reserved by the loading skeleton, so the card does not resize when the data lands. Default 5. */
37
+ expectedRows?: number;
38
+ /** A filter is active, so no rows means the filters exclude everything (`no-match`) rather than there being no data (`empty`). */
39
+ filtered?: boolean;
40
+ /** Called by the no-match state's action. Omit it and the state renders without one. */
41
+ onClearFilters?: () => void;
42
+ /** Called by the error state's retry action. Omit it and the state renders without one. */
43
+ onRetry?: () => void;
44
+ /**
45
+ * The active order, controlled — pair with `onSortChange`. `null` keeps the
46
+ * consumer's own row order (and hides the rank column, since a place in an
47
+ * arbitrary order means nothing). Omit for the uncontrolled table
48
+ * (`defaultSort`).
49
+ */
50
+ sort?: TableCardSort | null;
51
+ /** The order on first render when `sort` is uncontrolled. Default: none — the consumer's order. */
52
+ defaultSort?: TableCardSort;
53
+ /** Called with the new order when the reader activates a column heading. */
54
+ onSortChange?: (sort: TableCardSort) => void;
55
+ /** Offer the column headings as sort controls. Default `true`; `false` for a fixed order. A column opts out with its own `sortable: false`. */
56
+ sortable?: boolean;
57
+ /** Number the rows in the current order — only meaningful in a sorted table, so it is ignored without a `sort`. Ties share a place. */
58
+ showRank?: boolean;
59
+ /**
60
+ * Cap the rows shown. The tail is cut off and counted in a caption
61
+ * ("Showing top 10 of 48"), never folded into an "Other" row: a table's
62
+ * columns are not all additive, so summing a rate would invent a number.
63
+ * Default 10 — which is also the trend column's view budget.
64
+ */
65
+ maxRows?: number;
66
+ /** The true row count behind the table when the consumer already capped or paged upstream, so the caption can be honest. Default: `rows.length`. */
67
+ totalRows?: number;
68
+ /** Called by the truncation caption's action. Omit it and the caption states the cap without offering one. */
69
+ onShowAll?: () => void;
70
+ /** Key of the highlighted row, controlled — pair with `onRowSelect`. Omit for the uncontrolled table (`defaultSelectedRow`). */
71
+ selectedRow?: string | null;
72
+ /** The highlighted row on first render when `selectedRow` is uncontrolled. */
73
+ defaultSelectedRow?: string | null;
74
+ /** Called with a row's key when the reader activates it. Providing it turns each row's header cell into a real button — the keyboard path to a drill-through. */
75
+ onRowSelect?: (key: string) => void;
76
+ /** Type ramp, padding, cell density, row height and plot height. Default `md`. */
77
+ size?: TableCardSize;
78
+ /** Maximum height of the scroll area as a CSS length. Set it to pin the header and scroll the body — without it the card grows to fit every row. */
79
+ maxHeight?: number | string;
80
+ /** Pin the first column while the table scrolls sideways, so each row keeps its identifying cell in view. Default `true`. */
81
+ stickyColumn?: boolean;
82
+ /** Give alternating body rows a supporting surface. Default `false` — dividers already separate them, and zebra stripes add ink a scan does not need. */
83
+ zebra?: boolean;
84
+ /** How the trend cells draw: `line` (default, may crop so a small move stays visible), `area` or `bar` (both keep a zero baseline). */
85
+ trendMark?: TableCardTrendColumn["mark"];
86
+ /** Dot the last reading of each trend cell, so the plot's right edge and the cell's number agree. Default `true`. */
87
+ trendLatest?: boolean;
88
+ /** The takeaway under the table — how far the leader stands above the median. Generated from the data; pass your own, or `false` for none. */
89
+ insight?: ReactNode | false;
90
+ /** Replaces the generated accessible description of the whole card. Prefer letting it generate. */
91
+ description?: string;
92
+ /** The table's own caption, read by assistive technology when navigating tables. Defaults to the card's `name`; visually hidden either way. */
93
+ caption?: ReactNode;
94
+ /** When the data was read. Renders the as-of line under the table and feeds the description. */
95
+ updatedAt?: string | number | Date;
96
+ /** Granularity of the as-of line. Default `day`. */
97
+ updatedAtFormat?: ArcTimeGranularity;
98
+ /** The data is older than the product's freshness rule (TanStack Query's `isStale`). Shows a badge and stamps `data-stale`. */
99
+ stale?: boolean;
100
+ /** BCP 47 tag for every number and date. Thai products on the Gregorian calendar pass `th-TH-u-ca-gregory` — a bare `th-TH` is the Buddhist calendar. */
101
+ locale?: string;
102
+ /** IANA zone for every date, so a product that reports in one business zone is deterministic. */
103
+ timeZone?: string;
104
+ /** Every rendered and announced string, for localisation. Sentences are functions. */
105
+ labels?: Partial<TableCardLabels>;
106
+ /** Trailing header slot — a ghost `Button` or `Menu` for export, drill-through or settings. */
107
+ action?: ReactNode;
108
+ /** Heading level of the card's label. Default 4. */
109
+ titleLevel?: 2 | 3 | 4 | 5 | 6;
110
+ /** Re-resolve the chart tokens when a subtree's theme changes rather than the document's. */
111
+ theme?: string;
112
+ /** Last word on the trend cells' compiled spec. Voids the token and accessibility guarantees for whatever it changes. */
113
+ patchSpec?: (spec: TopLevelSpec) => TopLevelSpec;
114
+ /** Called with vega-embed's result for each trend cell that mounts — the escape hatch to the View API. */
115
+ onEmbed?: (result: Result) => void;
116
+ }
117
+ type TableCardLabelProps = {
118
+ label: string;
119
+ name?: string;
120
+ } | {
121
+ label: ReactNode;
122
+ name: string;
123
+ };
124
+ type TableCardProps = TableCardBaseProps & TableCardLabelProps;
125
+ /**
126
+ * An analytical table for dashboard grids and analysis pages: many entities
127
+ * down the page, several measures across it, each column encoding what its
128
+ * kind calls for — exact numbers, magnitude bars on the column's own
129
+ * zero-based scale, signed deltas, categories, and a sparkline per row — with
130
+ * sortable headings, a rank, an honest cap, opt-in footer totals, every
131
+ * loading, empty, no-match, error and stale state, and a generated
132
+ * description and insight sentence.
133
+ *
134
+ * It is the family's form for the question a plot cannot take: more measures
135
+ * per entity than a chart can encode, exact values, and long names. Only the
136
+ * trend column is a chart; every other cell is an Arc primitive.
137
+ */
138
+ declare const TableCard: import("react").ForwardRefExoticComponent<TableCardProps & import("react").RefAttributes<HTMLElement>>;
139
+ //#endregion
140
+ export { TableCard, TableCardBaseProps, TableCardLabelProps, TableCardProps };