@galaxy-io/dls 1.2.6 → 1.3.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 (297) hide show
  1. package/README.md +2 -0
  2. package/dist/avatar/Avatar.d.ts +2 -1
  3. package/dist/avatar/Avatar.js +103 -14
  4. package/dist/buttons/Button.d.ts +6 -1
  5. package/dist/buttons/Button.js +8 -4
  6. package/dist/charts/BarChart.d.ts +30 -20
  7. package/dist/charts/BarChart.js +216 -250
  8. package/dist/charts/ChartAxis.d.ts +47 -22
  9. package/dist/charts/ChartAxis.js +81 -60
  10. package/dist/charts/ChartEmptyState.d.ts +17 -0
  11. package/dist/charts/ChartEmptyState.js +29 -0
  12. package/dist/charts/ChartFrame.d.ts +82 -0
  13. package/dist/charts/ChartFrame.js +86 -0
  14. package/dist/charts/ChartLegend.d.ts +27 -4
  15. package/dist/charts/ChartLegend.js +46 -23
  16. package/dist/charts/ChartPrimitives.d.ts +195 -0
  17. package/dist/charts/ChartPrimitives.js +268 -0
  18. package/dist/charts/ChartTooltip.d.ts +27 -6
  19. package/dist/charts/ChartTooltip.js +56 -50
  20. package/dist/charts/LineChart.d.ts +42 -20
  21. package/dist/charts/LineChart.js +186 -237
  22. package/dist/charts/PieChart.d.ts +48 -32
  23. package/dist/charts/PieChart.js +159 -171
  24. package/dist/charts/barChartGeometry.d.ts +87 -0
  25. package/dist/charts/barChartGeometry.js +218 -0
  26. package/dist/charts/chartFormat.d.ts +19 -0
  27. package/dist/charts/chartFormat.js +59 -0
  28. package/dist/charts/chartScales.d.ts +84 -0
  29. package/dist/charts/chartScales.js +111 -0
  30. package/dist/charts/chartTheme.d.ts +18 -0
  31. package/dist/charts/chartTheme.js +26 -0
  32. package/dist/charts/constants.d.ts +225 -18
  33. package/dist/charts/constants.js +240 -32
  34. package/dist/charts/lineChartGeometry.d.ts +54 -0
  35. package/dist/charts/lineChartGeometry.js +143 -0
  36. package/dist/charts/pieChartGeometry.d.ts +48 -0
  37. package/dist/charts/pieChartGeometry.js +89 -0
  38. package/dist/charts/types.d.ts +522 -54
  39. package/dist/charts/types.js +136 -0
  40. package/dist/charts/useChartDimensions.d.ts +40 -0
  41. package/dist/charts/useChartDimensions.js +53 -0
  42. package/dist/charts/useChartFormatters.d.ts +19 -0
  43. package/dist/charts/useChartFormatters.js +20 -0
  44. package/dist/charts/useChartInteraction.d.ts +71 -0
  45. package/dist/charts/useChartInteraction.js +130 -0
  46. package/dist/charts/useChartTooltipPosition.d.ts +53 -0
  47. package/dist/charts/useChartTooltipPosition.js +39 -0
  48. package/dist/hooks/useElementClientSize.d.ts +20 -0
  49. package/dist/hooks/useElementClientSize.js +43 -0
  50. package/dist/inputs/CheckboxInput.d.ts +7 -2
  51. package/dist/inputs/CheckboxInput.js +30 -14
  52. package/dist/inputs/Input.d.ts +5 -2
  53. package/dist/inputs/Input.js +20 -17
  54. package/dist/inputs/MultiSelectInput.js +1 -1
  55. package/dist/inputs/RadioInput.js +7 -2
  56. package/dist/styles.css +68 -75
  57. package/dist/table/InfiniteSpreadsheet.d.ts +6 -0
  58. package/dist/table/InfiniteSpreadsheet.js +235 -0
  59. package/dist/table/InfiniteTable.d.ts +7 -88
  60. package/dist/table/InfiniteTable.js +366 -577
  61. package/dist/{spreadsheet → table}/SpreadsheetCell.d.ts +6 -4
  62. package/dist/table/SpreadsheetCell.js +71 -0
  63. package/dist/{spreadsheet → table}/SpreadsheetCellEditor.js +27 -21
  64. package/dist/table/SpreadsheetHeaderCell.d.ts +23 -0
  65. package/dist/table/SpreadsheetHeaderCell.js +91 -0
  66. package/dist/table/SpreadsheetMenuItem.d.ts +14 -0
  67. package/dist/table/SpreadsheetMenuItem.js +33 -0
  68. package/dist/table/SpreadsheetPrimitives.d.ts +172 -0
  69. package/dist/table/SpreadsheetPrimitives.js +105 -0
  70. package/dist/table/SpreadsheetRow.d.ts +33 -0
  71. package/dist/table/SpreadsheetRow.js +73 -0
  72. package/dist/{spreadsheet → table}/SpreadsheetRowActionCell.d.ts +5 -7
  73. package/dist/table/SpreadsheetRowActionCell.js +51 -0
  74. package/dist/table/TableExpandCell.d.ts +11 -0
  75. package/dist/table/TableExpandCell.js +24 -0
  76. package/dist/table/TableExpandedRow.d.ts +16 -0
  77. package/dist/table/TableExpandedRow.js +77 -0
  78. package/dist/table/TableHeaderCellContent.d.ts +30 -0
  79. package/dist/table/TableHeaderCellContent.js +48 -0
  80. package/dist/table/TablePrimitives.d.ts +307 -0
  81. package/dist/table/TablePrimitives.js +298 -0
  82. package/dist/table/TableSelectCell.d.ts +18 -0
  83. package/dist/table/TableSelectCell.js +26 -0
  84. package/dist/table/TableStatusRow.d.ts +18 -0
  85. package/dist/table/TableStatusRow.js +50 -0
  86. package/dist/table/VirtualizedInfiniteTable.d.ts +11 -27
  87. package/dist/table/VirtualizedInfiniteTable.js +182 -317
  88. package/dist/table/types.d.ts +249 -0
  89. package/dist/table/types.js +51 -0
  90. package/dist/table/useInfiniteScrollSentinel.d.ts +24 -0
  91. package/dist/table/useInfiniteScrollSentinel.js +53 -0
  92. package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.d.ts +1 -1
  93. package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.js +1 -1
  94. package/dist/table/useTableColumnLayout.d.ts +28 -0
  95. package/dist/table/useTableColumnLayout.js +63 -0
  96. package/dist/table/useTableColumnResize.d.ts +38 -0
  97. package/dist/table/useTableColumnResize.js +155 -0
  98. package/dist/table/useTableKeyboardNavigation.d.ts +25 -0
  99. package/dist/table/useTableKeyboardNavigation.js +83 -0
  100. package/dist/table/useTableRowExpansion.d.ts +24 -0
  101. package/dist/table/useTableRowExpansion.js +62 -0
  102. package/dist/table/useTableRowSelection.d.ts +27 -0
  103. package/dist/table/useTableRowSelection.js +94 -0
  104. package/dist/table/utils.d.ts +50 -0
  105. package/dist/table/utils.js +78 -0
  106. package/dist/text/MarkdownText.js +45 -27
  107. package/dist/theme/variants/dark.js +1 -1
  108. package/dist/widget/Widget.d.ts +2 -0
  109. package/dist/widget/Widget.js +14 -7
  110. package/package.json +1 -5
  111. package/dist/assets/components/enrichment/PerplexityIcon.d.ts +0 -3
  112. package/dist/assets/components/enrichment/PerplexityIcon.js +0 -35
  113. package/dist/assets/components/enrichment/TavilyIcon.d.ts +0 -3
  114. package/dist/assets/components/enrichment/TavilyIcon.js +0 -15
  115. package/dist/assets/components/onboarding/TenantSetupDark.d.ts +0 -3
  116. package/dist/assets/components/onboarding/TenantSetupDark.js +0 -498
  117. package/dist/assets/components/onboarding/TenantSetupLight.d.ts +0 -3
  118. package/dist/assets/components/onboarding/TenantSetupLight.js +0 -482
  119. package/dist/assets/components/onboarding/UserSetupDark.d.ts +0 -3
  120. package/dist/assets/components/onboarding/UserSetupDark.js +0 -1086
  121. package/dist/assets/components/onboarding/UserSetupLight.d.ts +0 -3
  122. package/dist/assets/components/onboarding/UserSetupLight.js +0 -1024
  123. package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.d.ts +0 -3
  124. package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.js +0 -466
  125. package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.d.ts +0 -3
  126. package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.js +0 -460
  127. package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.d.ts +0 -3
  128. package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.js +0 -336
  129. package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.d.ts +0 -3
  130. package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.js +0 -336
  131. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.d.ts +0 -3
  132. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.js +0 -153
  133. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.d.ts +0 -3
  134. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.js +0 -153
  135. package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.d.ts +0 -3
  136. package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.js +0 -117
  137. package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.d.ts +0 -3
  138. package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.js +0 -117
  139. package/dist/assets/components/projects/MappingMethodBlankDark.d.ts +0 -3
  140. package/dist/assets/components/projects/MappingMethodBlankDark.js +0 -150
  141. package/dist/assets/components/projects/MappingMethodBlankDarkHovered.d.ts +0 -3
  142. package/dist/assets/components/projects/MappingMethodBlankDarkHovered.js +0 -150
  143. package/dist/assets/components/projects/MappingMethodBlankLight.d.ts +0 -3
  144. package/dist/assets/components/projects/MappingMethodBlankLight.js +0 -150
  145. package/dist/assets/components/projects/MappingMethodBlankLightHovered.d.ts +0 -3
  146. package/dist/assets/components/projects/MappingMethodBlankLightHovered.js +0 -150
  147. package/dist/assets/components/projects/MappingMethodJsonDark.d.ts +0 -3
  148. package/dist/assets/components/projects/MappingMethodJsonDark.js +0 -90
  149. package/dist/assets/components/projects/MappingMethodJsonDarkHovered.d.ts +0 -3
  150. package/dist/assets/components/projects/MappingMethodJsonDarkHovered.js +0 -90
  151. package/dist/assets/components/projects/MappingMethodJsonLight.d.ts +0 -3
  152. package/dist/assets/components/projects/MappingMethodJsonLight.js +0 -90
  153. package/dist/assets/components/projects/MappingMethodJsonLightHovered.d.ts +0 -3
  154. package/dist/assets/components/projects/MappingMethodJsonLightHovered.js +0 -90
  155. package/dist/assets/components/projects/ProjectsEmptyStateDark.d.ts +0 -3
  156. package/dist/assets/components/projects/ProjectsEmptyStateDark.js +0 -454
  157. package/dist/assets/components/projects/ProjectsEmptyStateLight.d.ts +0 -3
  158. package/dist/assets/components/projects/ProjectsEmptyStateLight.js +0 -456
  159. package/dist/assets/components/root/CreateProjectActionCardDark.d.ts +0 -3
  160. package/dist/assets/components/root/CreateProjectActionCardDark.js +0 -1796
  161. package/dist/assets/components/root/CreateProjectActionCardDarkHovered.d.ts +0 -3
  162. package/dist/assets/components/root/CreateProjectActionCardDarkHovered.js +0 -1796
  163. package/dist/assets/components/root/CreateProjectActionCardLight.d.ts +0 -3
  164. package/dist/assets/components/root/CreateProjectActionCardLight.js +0 -1786
  165. package/dist/assets/components/root/CreateProjectActionCardLightHovered.d.ts +0 -3
  166. package/dist/assets/components/root/CreateProjectActionCardLightHovered.js +0 -1786
  167. package/dist/assets/components/root/CreateSourceActionCardDark.d.ts +0 -3
  168. package/dist/assets/components/root/CreateSourceActionCardDark.js +0 -879
  169. package/dist/assets/components/root/CreateSourceActionCardDarkHovered.d.ts +0 -3
  170. package/dist/assets/components/root/CreateSourceActionCardDarkHovered.js +0 -879
  171. package/dist/assets/components/root/CreateSourceActionCardLight.d.ts +0 -3
  172. package/dist/assets/components/root/CreateSourceActionCardLight.js +0 -889
  173. package/dist/assets/components/root/CreateSourceActionCardLightHovered.d.ts +0 -3
  174. package/dist/assets/components/root/CreateSourceActionCardLightHovered.js +0 -889
  175. package/dist/assets/components/sources/AttioIcon.d.ts +0 -3
  176. package/dist/assets/components/sources/AttioIcon.js +0 -11
  177. package/dist/assets/components/sources/BigquerySourceIcon.d.ts +0 -3
  178. package/dist/assets/components/sources/BigquerySourceIcon.js +0 -39
  179. package/dist/assets/components/sources/BrowserbaseSourceIcon.d.ts +0 -3
  180. package/dist/assets/components/sources/BrowserbaseSourceIcon.js +0 -35
  181. package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.d.ts +0 -3
  182. package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.js +0 -13
  183. package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.d.ts +0 -3
  184. package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.js +0 -13
  185. package/dist/assets/components/sources/ConfluenceSourceIcon.d.ts +0 -3
  186. package/dist/assets/components/sources/ConfluenceSourceIcon.js +0 -30
  187. package/dist/assets/components/sources/GithubSourceIcon.d.ts +0 -3
  188. package/dist/assets/components/sources/GithubSourceIcon.js +0 -27
  189. package/dist/assets/components/sources/GoogleDriveIcon.d.ts +0 -3
  190. package/dist/assets/components/sources/GoogleDriveIcon.js +0 -45
  191. package/dist/assets/components/sources/HubspotSourceIcon.d.ts +0 -3
  192. package/dist/assets/components/sources/HubspotSourceIcon.js +0 -14
  193. package/dist/assets/components/sources/JiraSourceIcon.d.ts +0 -3
  194. package/dist/assets/components/sources/JiraSourceIcon.js +0 -54
  195. package/dist/assets/components/sources/LinearSourceIcon.d.ts +0 -3
  196. package/dist/assets/components/sources/LinearSourceIcon.js +0 -14
  197. package/dist/assets/components/sources/MysqlLogoSourceIconDark.d.ts +0 -3
  198. package/dist/assets/components/sources/MysqlLogoSourceIconDark.js +0 -17
  199. package/dist/assets/components/sources/NetsuiteSourceIcon.d.ts +0 -3
  200. package/dist/assets/components/sources/NetsuiteSourceIcon.js +0 -32
  201. package/dist/assets/components/sources/NotionIcon.d.ts +0 -3
  202. package/dist/assets/components/sources/NotionIcon.js +0 -20
  203. package/dist/assets/components/sources/PostgresqlIcon.d.ts +0 -3
  204. package/dist/assets/components/sources/PostgresqlIcon.js +0 -61
  205. package/dist/assets/components/sources/S3Icon.d.ts +0 -3
  206. package/dist/assets/components/sources/S3Icon.js +0 -76
  207. package/dist/assets/components/sources/SalesforceSourceIcon.d.ts +0 -3
  208. package/dist/assets/components/sources/SalesforceSourceIcon.js +0 -23
  209. package/dist/assets/components/sources/SlackIcon.d.ts +0 -3
  210. package/dist/assets/components/sources/SlackIcon.js +0 -32
  211. package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.d.ts +0 -3
  212. package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.js +0 -14
  213. package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.d.ts +0 -3
  214. package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.js +0 -14
  215. package/dist/assets/components/sources/WikipediaSourceIcon.d.ts +0 -3
  216. package/dist/assets/components/sources/WikipediaSourceIcon.js +0 -1490
  217. package/dist/avatar/AvatarEmpty.d.ts +0 -7
  218. package/dist/avatar/AvatarEmpty.js +0 -99
  219. package/dist/avatar/types.d.ts +0 -5
  220. package/dist/avatar/types.js +0 -9
  221. package/dist/charts/utils.d.ts +0 -29
  222. package/dist/charts/utils.js +0 -62
  223. package/dist/icons/BackIcon.d.ts +0 -3
  224. package/dist/icons/BackIcon.js +0 -13
  225. package/dist/icons/CloseIcon.d.ts +0 -3
  226. package/dist/icons/CloseIcon.js +0 -13
  227. package/dist/icons/CreateIcon.d.ts +0 -3
  228. package/dist/icons/CreateIcon.js +0 -13
  229. package/dist/icons/ForwardIcon.d.ts +0 -3
  230. package/dist/icons/ForwardIcon.js +0 -13
  231. package/dist/icons/HelpIcon.d.ts +0 -3
  232. package/dist/icons/HelpIcon.js +0 -14
  233. package/dist/icons/ProjectsIcon.d.ts +0 -3
  234. package/dist/icons/ProjectsIcon.js +0 -12
  235. package/dist/icons/SearchIcon.d.ts +0 -3
  236. package/dist/icons/SearchIcon.js +0 -12
  237. package/dist/icons/SourcesIcon.d.ts +0 -3
  238. package/dist/icons/SourcesIcon.js +0 -12
  239. package/dist/icons/TextIcon.d.ts +0 -4
  240. package/dist/icons/TextIcon.js +0 -22
  241. package/dist/icons/WebScrapeIcon.d.ts +0 -4
  242. package/dist/icons/WebScrapeIcon.js +0 -22
  243. package/dist/icons/WebhookIcon.d.ts +0 -4
  244. package/dist/icons/WebhookIcon.js +0 -22
  245. package/dist/icons/sources/AttioLogomark.d.ts +0 -4
  246. package/dist/icons/sources/AttioLogomark.js +0 -8
  247. package/dist/icons/sources/BrowserbaseLogomark.d.ts +0 -4
  248. package/dist/icons/sources/BrowserbaseLogomark.js +0 -8
  249. package/dist/icons/sources/ClickhouseLogomark.d.ts +0 -4
  250. package/dist/icons/sources/ClickhouseLogomark.js +0 -16
  251. package/dist/icons/sources/ConfluenceLogomark.d.ts +0 -4
  252. package/dist/icons/sources/ConfluenceLogomark.js +0 -8
  253. package/dist/icons/sources/GithubLogomark.d.ts +0 -4
  254. package/dist/icons/sources/GithubLogomark.js +0 -8
  255. package/dist/icons/sources/GoogleBigqueryLogomark.d.ts +0 -4
  256. package/dist/icons/sources/GoogleBigqueryLogomark.js +0 -8
  257. package/dist/icons/sources/GoogleDriveLogomark.d.ts +0 -4
  258. package/dist/icons/sources/GoogleDriveLogomark.js +0 -8
  259. package/dist/icons/sources/HubspotLogomark.d.ts +0 -4
  260. package/dist/icons/sources/HubspotLogomark.js +0 -8
  261. package/dist/icons/sources/JiraLogomark.d.ts +0 -4
  262. package/dist/icons/sources/JiraLogomark.js +0 -8
  263. package/dist/icons/sources/LinearLogomark.d.ts +0 -4
  264. package/dist/icons/sources/LinearLogomark.js +0 -8
  265. package/dist/icons/sources/MySQLLogomark.d.ts +0 -4
  266. package/dist/icons/sources/MySQLLogomark.js +0 -8
  267. package/dist/icons/sources/NetsuiteLogomark.d.ts +0 -4
  268. package/dist/icons/sources/NetsuiteLogomark.js +0 -8
  269. package/dist/icons/sources/NotionLogomark.d.ts +0 -4
  270. package/dist/icons/sources/NotionLogomark.js +0 -8
  271. package/dist/icons/sources/PostgresLogomark.d.ts +0 -4
  272. package/dist/icons/sources/PostgresLogomark.js +0 -8
  273. package/dist/icons/sources/S3Logomark.d.ts +0 -4
  274. package/dist/icons/sources/S3Logomark.js +0 -8
  275. package/dist/icons/sources/SalesforceLogomark.d.ts +0 -4
  276. package/dist/icons/sources/SalesforceLogomark.js +0 -8
  277. package/dist/icons/sources/SlackLogoIconmark.d.ts +0 -4
  278. package/dist/icons/sources/SlackLogoIconmark.js +0 -8
  279. package/dist/icons/sources/SnowflakeLogomark.d.ts +0 -4
  280. package/dist/icons/sources/SnowflakeLogomark.js +0 -16
  281. package/dist/icons/sources/WikipediaLogomark.d.ts +0 -4
  282. package/dist/icons/sources/WikipediaLogomark.js +0 -8
  283. package/dist/spreadsheet/InfiniteSpreadsheet.d.ts +0 -3
  284. package/dist/spreadsheet/InfiniteSpreadsheet.js +0 -265
  285. package/dist/spreadsheet/SpreadsheetAddColumnButton.d.ts +0 -6
  286. package/dist/spreadsheet/SpreadsheetAddColumnButton.js +0 -32
  287. package/dist/spreadsheet/SpreadsheetCell.js +0 -115
  288. package/dist/spreadsheet/SpreadsheetHeaderCell.d.ts +0 -18
  289. package/dist/spreadsheet/SpreadsheetHeaderCell.js +0 -141
  290. package/dist/spreadsheet/SpreadsheetRow.d.ts +0 -21
  291. package/dist/spreadsheet/SpreadsheetRow.js +0 -68
  292. package/dist/spreadsheet/SpreadsheetRowActionCell.js +0 -78
  293. package/dist/spreadsheet/hooks/useColumnResize.d.ts +0 -6
  294. package/dist/spreadsheet/hooks/useColumnResize.js +0 -46
  295. package/dist/spreadsheet/types.d.ts +0 -92
  296. package/dist/spreadsheet/types.js +0 -21
  297. /package/dist/{spreadsheet → table}/SpreadsheetCellEditor.d.ts +0 -0
@@ -1,80 +1,548 @@
1
1
  import type { ReactNode } from "react";
2
- /** A single data point with a category label and series values */
3
- export interface ChartDatum {
4
- /** Category label (x-axis for bar/line, slice label for pie) */
5
- label: string;
6
- /** Numeric values keyed by series key. e.g. { revenue: 150, cost: 80 } */
7
- values: Record<string, number>;
2
+ /**
3
+ * Shared types for the chart components (`BarChart`, `LineChart`, `PieChart`).
4
+ *
5
+ * Every data type is generic over its key unions, and the inference is
6
+ * deliberately one-directional: `TMetric` comes from the keys of the `series`
7
+ * record and from nowhere else, with {@link NoInfer} applied to every
8
+ * data-shaped prop.
9
+ *
10
+ * That asymmetry is what makes the guarantees real. Were `TMetric` also
11
+ * inferred from the data, an inline `{ metric: "revenue" }` would widen to
12
+ * `string`, TypeScript would pick the supertype, and every check below would
13
+ * quietly become a no-op — type safety that looks present but is not.
14
+ *
15
+ * ```ts
16
+ * <BarChart
17
+ * series={{
18
+ * revenue: { label: "Revenue" },
19
+ * cost: { label: "Cost" },
20
+ * }}
21
+ * groups={[
22
+ * { label: "Q1", bars: [{ metric: "revenu", components: [] }] },
23
+ * // ^ Type '"revenu"' is not assignable to
24
+ * // type '"revenue" | "cost"'.
25
+ * ]}
26
+ * />
27
+ * ```
28
+ *
29
+ * The same union then makes aggregates exhaustive, spell-checks legend and
30
+ * ordering props, and narrows callback parameters for `ts-pattern`.
31
+ */
32
+ /**
33
+ * Semantic color slot for a series, resolved against the active theme at render
34
+ * time by `resolveChartPaletteColor` in `chartTheme.ts`.
35
+ *
36
+ * Deliberately an enum of slots rather than a hex string: consumer data should
37
+ * never carry raw color, and every rendered color has to come from
38
+ * `theme.color.*` so both themes stay correct.
39
+ */
40
+ export declare enum ChartPalette {
41
+ PURPLE = "PURPLE",
42
+ PINK = "PINK",
43
+ BLUE = "BLUE",
44
+ TEAL = "TEAL",
45
+ LIME = "LIME",
46
+ ORANGE = "ORANGE",
47
+ YELLOW = "YELLOW",
48
+ GREEN = "GREEN",
49
+ RED = "RED"
8
50
  }
9
- /** Describes one series in the chart */
10
- export interface ChartSeriesConfig {
11
- /** Unique key matching a key in ChartDatum.values */
12
- key: string;
13
- /** Human-readable name shown in legend/tooltip */
14
- name: string;
15
- /** Override color (hex). Falls back to palette order. */
16
- color?: string;
17
- }
18
- /** A single slice in a pie/donut chart */
19
- export interface PieSlice {
20
- /** Slice label shown in legend/tooltip */
51
+ /**
52
+ * Built-in value formats. Supplies an `Intl`-based default for axis ticks,
53
+ * value labels and tooltip rows so callers don't have to write the same
54
+ * formatter three times.
55
+ *
56
+ * A `valueFormatter` prop always wins over this when both are given.
57
+ */
58
+ export declare enum ChartValueUnit {
59
+ /** Locale-grouped integer, e.g. `1,250`. */
60
+ PLAIN = "PLAIN",
61
+ /** Locale currency with no decimals, e.g. `$1,250`. */
62
+ CURRENCY = "CURRENCY",
63
+ /** Percentage of a 0–100 value, e.g. `42%`. */
64
+ PERCENT = "PERCENT",
65
+ /** Abbreviated magnitude, e.g. `1.3K`, `4.2M`. */
66
+ COMPACT = "COMPACT"
67
+ }
68
+ export type ChartValueFormatter = (value: number) => string;
69
+ export type ChartLabelFormatter = (label: string) => string;
70
+ /**
71
+ * How one series is presented: what to call it and which palette slot it owns.
72
+ *
73
+ * Holds no data and no key — the key is the record key in
74
+ * {@link ChartSeriesStyles}, which is exactly what makes that record
75
+ * exhaustive.
76
+ */
77
+ export interface ChartSeriesStyle {
78
+ /** Name shown in the legend, tooltip and accessible labels. */
21
79
  label: string;
22
- /** Numeric value determining slice size */
23
- value: number;
24
- /** Override color (hex). Falls back to palette order. */
25
- color?: string;
80
+ /**
81
+ * Palette slot. Defaults to the series' position in the record, walked
82
+ * through `CHART_PALETTE_ORDER`.
83
+ */
84
+ color?: ChartPalette;
26
85
  }
86
+ /**
87
+ * Presentation for every series, keyed by series key.
88
+ *
89
+ * A `Record` over the key union rather than an array of `{ key, name }` is the
90
+ * single most load-bearing decision in this model. An array can be wrong in
91
+ * four independent ways — missing entry, extra entry, duplicate key, misspelt
92
+ * key — and TypeScript catches none of them. A record catches all four, because
93
+ * its *keys are the type*.
94
+ */
95
+ export type ChartSeriesStyles<TKey extends string> = Record<TKey, ChartSeriesStyle>;
27
96
  export interface ChartMargin {
28
97
  top: number;
29
98
  right: number;
30
99
  bottom: number;
31
100
  left: number;
32
101
  }
33
- export type ChartValueFormatter = (value: number) => string;
34
- export type ChartLabelFormatter = (label: string) => string;
35
- export interface ChartTooltipItem {
36
- seriesKey: string;
37
- seriesName: string;
102
+ /** Override for the computed value axis domain. */
103
+ export interface ChartValueDomain {
104
+ /** Lower bound. Defaults to `min(0, smallest value)`. */
105
+ min: number;
106
+ /** Upper bound. Defaults to `max(0, largest value)`. */
107
+ max: number;
108
+ /** Approximate tick count passed to d3's `scale.ticks()`. */
109
+ tickCount: number;
110
+ }
111
+ /** How the category axis copes when labels outgrow their slots. */
112
+ export declare enum ChartCategoryLabelMode {
113
+ /** Render every label that fits; otherwise show every nth. The default. */
114
+ AUTO = "AUTO",
115
+ /** Render every label, ellipsizing any that overflow its slot. */
116
+ TRUNCATE = "TRUNCATE",
117
+ /** Render every label unconditionally, overlap included. */
118
+ ALL = "ALL"
119
+ }
120
+ /**
121
+ * Emphasis level of a rendered mark.
122
+ *
123
+ * Travels to the DOM as a `data-state` attribute rather than a styled-component
124
+ * prop: `@linaria/react` skips prop filtering entirely for SVG tags (its
125
+ * `allTagsSet` is built with a missing spread, so `has('rect')` is false and
126
+ * `propsAsIs` turns on), which would forward a `$`-prefixed prop straight to the
127
+ * DOM and trigger a React warning.
128
+ */
129
+ export declare enum ChartMarkState {
130
+ /** Full strength — the default, and the hovered or pinned category. */
131
+ ACTIVE = "active",
132
+ /** Softened, for categories other than the hovered one. */
133
+ MUTED = "muted",
134
+ /** Furthest back, for categories outside a pinned one. */
135
+ FADED = "faded"
136
+ }
137
+ /** Which pair of a rectangle's corners carries the radius. */
138
+ export declare enum BarCorners {
139
+ /** Cap for a bar growing up from the baseline. */
140
+ TOP = "TOP",
141
+ /** Cap for a bar growing down from the baseline. */
142
+ BOTTOM = "BOTTOM",
143
+ /** Interior stack segment — square on both ends. */
144
+ NONE = "NONE"
145
+ }
146
+ /**
147
+ * How bar values are scaled before rendering.
148
+ *
149
+ * Note there is no grouped-vs-stacked mode: with the group → bar → component
150
+ * hierarchy, several `bars` in a group render side by side and several
151
+ * `components` in a bar render on top of each other, so a chart can be grouped
152
+ * and stacked at the same time.
153
+ */
154
+ export declare enum BarChartNormalization {
155
+ /** Plot raw values. */
156
+ NONE = "NONE",
157
+ /** Scale each bar's components to fill the axis — a 100% stacked chart. */
158
+ PERCENT = "PERCENT"
159
+ }
160
+ /**
161
+ * One stacked segment of a bar.
162
+ *
163
+ * A bar with a single component is just a plain unstacked bar.
164
+ */
165
+ export interface BarChartComponentDatum<TComponentKey extends string = string> {
166
+ /** Identifies this segment; must be unique within its bar. */
167
+ key: TComponentKey;
168
+ /** Human-readable name, shown in the tooltip and legend. */
169
+ label: string;
170
+ /** Segment magnitude. Negative values stack below the zero baseline. */
171
+ value: number;
172
+ /** Palette slot override. Defaults to the segment's position in the palette. */
173
+ color?: ChartPalette;
174
+ }
175
+ /**
176
+ * One bar within a group: a stack of components for a single metric.
177
+ */
178
+ export interface BarChartBarDatum<TMetric extends string, TPivot extends string = string, TComponentKey extends string = string> {
179
+ /** Which metric this bar represents, e.g. `"prospected"`. */
180
+ metric: TMetric;
181
+ /** Optional dimension the bar is split by, e.g. `"persona"`. */
182
+ pivot?: TPivot;
183
+ /** Segments of the bar, stacked in array order outward from the baseline. */
184
+ components: BarChartComponentDatum<TComponentKey>[];
185
+ }
186
+ /**
187
+ * One category on the x-axis, holding one bar per metric.
188
+ */
189
+ export interface BarChartGroupDatum<TMetric extends string, TPivot extends string = string, TComponentKey extends string = string> {
190
+ /** Label rendered beneath this group on the category axis. */
191
+ label: string;
192
+ /** Bars in this group, rendered left to right in array order. */
193
+ bars: BarChartBarDatum<TMetric, TPivot, TComponentKey>[];
194
+ }
195
+ /**
196
+ * A single rendered rectangle.
197
+ *
198
+ * The geometry layer flattens the group/bar/component hierarchy into an array
199
+ * of these, so rendering is a plain `.map()` with no nested loops or
200
+ * accumulators in the component body.
201
+ */
202
+ export interface BarChartRect<TMetric extends string, TComponentKey extends string = string> {
203
+ /**
204
+ * React key: `${groupIndex}:${barIndex}:${componentKey}`.
205
+ *
206
+ * Deliberately index-based rather than label-based — group labels are free to
207
+ * repeat, and duplicated keys would silently drop rectangles.
208
+ */
209
+ id: string;
210
+ groupIndex: number;
211
+ barIndex: number;
212
+ metric: TMetric;
213
+ componentKey: TComponentKey;
214
+ /** The component's label, carried through for the tooltip. */
215
+ label: string;
216
+ /** The raw value, before any normalization. */
38
217
  value: number;
218
+ /**
219
+ * The `[from, to]` interval this segment occupies in value space.
220
+ * Under {@link BarChartNormalization.PERCENT} this is normalized to 0–1.
221
+ */
222
+ valueRange: [number, number];
223
+ x: number;
224
+ y: number;
225
+ width: number;
226
+ height: number;
227
+ /** Resolved from the theme — never a raw hex from consumer data. */
39
228
  color: string;
229
+ /** Interior stack segments get {@link BarCorners.NONE}. */
230
+ corners: BarCorners;
231
+ /** Corner radius in px, reduced for narrow bars so the curve can't dominate. */
232
+ radius: number;
40
233
  }
41
- export interface ChartTooltipData {
42
- /** The category label */
234
+ /**
235
+ * A category's invisible hit target and tooltip anchor.
236
+ *
237
+ * Hit testing happens per group rather than per rectangle: a two-pixel bar is
238
+ * then exactly as hoverable as a two-hundred-pixel one, and moving the pointer
239
+ * between segments inside one group fires nothing, so the tooltip stays put
240
+ * instead of jumping between segment tops.
241
+ */
242
+ export interface BarChartGroupBand {
243
+ groupIndex: number;
43
244
  label: string;
44
- /** Series values for this datum */
45
- items: ChartTooltipItem[];
46
- /** Pixel position for tooltip anchor */
245
+ /** Tiles edge to edge with its neighbours, so there are no dead gutters. */
246
+ x: number;
247
+ y: number;
248
+ width: number;
249
+ height: number;
250
+ /** Group centre, at the top of its tallest bar. Stable while hovering. */
251
+ anchorX: number;
252
+ anchorY: number;
253
+ /** True when every component in the group is zero or absent. */
254
+ isEmpty: boolean;
255
+ }
256
+ /** How the segments between points are interpolated. */
257
+ export declare enum LineChartCurve {
258
+ /** Straight segments. */
259
+ LINEAR = "LINEAR",
260
+ /** Monotone cubic — smooth without overshooting the data. */
261
+ SMOOTH = "SMOOTH",
262
+ /** Right-angled steps. */
263
+ STEP = "STEP"
264
+ }
265
+ /** One point on a line. */
266
+ export interface LineChartPointDatum {
267
+ /** Category this point sits on; must match a category on the axis. */
268
+ x: string;
269
+ /**
270
+ * Value on the value axis.
271
+ *
272
+ * `null` breaks the line into separate segments. That is deliberately not the
273
+ * same as `0`: a missing reading and a reading of zero are different claims,
274
+ * and plotting a gap as zero draws a spike to the baseline that never
275
+ * happened.
276
+ */
277
+ y: number | null;
278
+ }
279
+ /**
280
+ * One line in a line chart.
281
+ *
282
+ * Carries no label or colour — those come from the chart's `series` record,
283
+ * keyed by `metric`, so the legend, tooltip and stroke cannot disagree.
284
+ */
285
+ export interface LineChartLineDatum<TMetric extends string> {
286
+ /** Which metric this line represents. Must be a key of the `series` record. */
287
+ metric: TMetric;
288
+ /**
289
+ * Points in category order.
290
+ *
291
+ * Sparse series are fine — categories absent here are treated as gaps, and
292
+ * the category axis is the union across every line.
293
+ */
294
+ points: LineChartPointDatum[];
295
+ /** Stroke width in px. Defaults to the shared line width. */
296
+ strokeWidth?: number;
297
+ /** Dash length in px. Solid when omitted. */
298
+ dashSize?: number;
299
+ /** Fill the area between the line and the baseline. */
300
+ showArea?: boolean;
301
+ }
302
+ /** One line, resolved to SVG paths. */
303
+ export interface LineChartPath<TMetric extends string> {
304
+ /** React key. Equal to the metric, which is unique by construction. */
305
+ id: string;
306
+ metric: TMetric;
307
+ lineIndex: number;
308
+ /** `d` for the stroke. Empty when the line has no plottable points. */
309
+ path: string;
310
+ /** `d` for the area fill. Present only when the line opted into an area. */
311
+ areaPath?: string;
312
+ /** Pre-serialised `stroke-dasharray`. Absent for a solid line. */
313
+ dashArray?: string;
314
+ strokeWidth: number;
315
+ color: string;
316
+ }
317
+ /** One point, resolved to pixels. */
318
+ export interface LineChartPoint<TMetric extends string> {
319
+ /** React key. `${metric}:${categoryIndex}`. */
320
+ id: string;
321
+ metric: TMetric;
322
+ categoryIndex: number;
323
+ value: number;
47
324
  x: number;
48
325
  y: number;
326
+ color: string;
327
+ }
328
+ /**
329
+ * One category column: the hit target and everything the tooltip needs.
330
+ *
331
+ * Line charts hit-test by column rather than by proximity to a stroke, so the
332
+ * whole vertical band is a target and the tooltip reports every line at once.
333
+ */
334
+ export interface LineChartColumn<TMetric extends string> {
335
+ categoryIndex: number;
336
+ label: string;
337
+ /** x of the category tick. */
338
+ x: number;
339
+ /** Full-height hit target, tiling with its neighbours. */
340
+ bandX: number;
341
+ bandWidth: number;
342
+ /** Points present in this column, one per line that has a value here. */
343
+ points: LineChartPoint<TMetric>[];
344
+ /** Topmost point in the column — where the tooltip anchors. */
345
+ anchorY: number;
346
+ }
347
+ /**
348
+ * One slice of a pie or donut.
349
+ *
350
+ * Carries no label or colour — those come from the chart's `series` record,
351
+ * keyed by `key`, so the legend, tooltip and arc cannot disagree.
352
+ */
353
+ export interface PieChartSliceDatum<TSlice extends string> {
354
+ /** Which slice this is. Must be a key of the `series` record. */
355
+ key: TSlice;
356
+ /**
357
+ * Slice magnitude.
358
+ *
359
+ * A pie shows parts of a whole, so negative values have no meaning here and
360
+ * are coerced to zero rather than silently inverting an arc.
361
+ */
362
+ value: number;
363
+ }
364
+ /** React key used for the bucket that absorbs slices below the fold threshold. */
365
+ export declare const AGGREGATED_SLICE_KEY = "__other__";
366
+ /** One rendered arc. */
367
+ export interface PieChartArc<TSlice extends string> {
368
+ /** React key. The slice key, or {@link AGGREGATED_SLICE_KEY}. */
369
+ id: string;
370
+ /**
371
+ * The originating slice, or `null` for the aggregated bucket.
372
+ *
373
+ * Nullable rather than widened to `string` so callers must acknowledge the
374
+ * synthetic arc instead of accidentally treating it as a real slice key.
375
+ */
376
+ sliceKey: TSlice | null;
377
+ label: string;
378
+ /** Summed value for the aggregated bucket, the slice's own otherwise. */
379
+ value: number;
380
+ /** Share of the total, 0–1. */
381
+ share: number;
382
+ /** `d` for the arc. */
383
+ path: string;
384
+ /** Radians, clockwise from 12 o'clock. */
385
+ startAngle: number;
386
+ endAngle: number;
387
+ /** Anchor for the tooltip, just outside the arc's outer edge. */
388
+ anchorX: number;
389
+ anchorY: number;
390
+ color: string;
391
+ /** True for the bucket produced by folding small slices together. */
392
+ isAggregated: boolean;
393
+ }
394
+ /** One label/value row in the tooltip. */
395
+ export interface ChartTooltipRow {
396
+ /** React key, unique within the tooltip. */
397
+ key: string;
398
+ /** Row label — a component label, line label or slice label. */
399
+ label: string;
400
+ /** Optional grouping label, used when bars are split by a pivot. */
401
+ group?: string;
402
+ value: number;
403
+ /** Already run through the resolved formatter. */
404
+ formattedValue: string;
405
+ color: string;
406
+ }
407
+ /** Everything the tooltip needs to render, independent of chart type. */
408
+ export interface ChartTooltipModel {
409
+ /** Heading — the hovered category, or the slice label for a pie. */
410
+ label: string;
411
+ rows: ChartTooltipRow[];
412
+ /** Anchor in container coordinates, margins already applied. */
413
+ anchorX: number;
414
+ anchorY: number;
415
+ }
416
+ /**
417
+ * A tooltip model whose anchor is still in plot coordinates.
418
+ *
419
+ * Structurally identical to {@link ChartTooltipModel} — the difference is the
420
+ * coordinate space, which TypeScript cannot enforce. It carries its own name
421
+ * anyway, because `ChartFrame` accepting "container coordinates" and then adding
422
+ * a margin to them is exactly the sort of thing a reader has to be able to see
423
+ * from the signature.
424
+ *
425
+ * Charts build this; `ChartFrame` applies the margin translate once, in the
426
+ * component that already owns the `<g transform>`.
427
+ */
428
+ export interface ChartPlotTooltipModel {
429
+ label: string;
430
+ rows: ChartTooltipRow[];
431
+ /** Anchor in plot coordinates. */
432
+ anchorX: number;
433
+ anchorY: number;
49
434
  }
50
- /** Custom render function for tooltip body */
51
- export type ChartTooltipRenderer = (data: ChartTooltipData) => ReactNode;
52
- /** Base props shared by all chart components */
435
+ /** Render prop for replacing the tooltip body. Positioning stays with the chart. */
436
+ export type ChartTooltipRenderer = (model: ChartTooltipModel) => ReactNode;
437
+ /** One legend entry. */
438
+ export interface ChartLegendItem {
439
+ key: string;
440
+ label: string;
441
+ color: string;
442
+ }
443
+ /** Fixed-size chart: both dimensions given in px. */
444
+ export interface ChartFixedSize {
445
+ fillWidth?: false;
446
+ fillHeight?: false;
447
+ width: number;
448
+ height: number;
449
+ aspectRatio?: never;
450
+ }
451
+ /** Container-width chart with an explicit height. */
452
+ export interface ChartFluidFixedHeight {
453
+ fillWidth: true;
454
+ fillHeight?: false;
455
+ width?: never;
456
+ height: number;
457
+ aspectRatio?: never;
458
+ }
459
+ /** Container-width chart whose height follows its width. */
460
+ export interface ChartFluidRatioHeight {
461
+ fillWidth: true;
462
+ fillHeight?: false;
463
+ width?: never;
464
+ height?: never;
465
+ /** Width ÷ height. `2` is a 2:1 landscape plot. */
466
+ aspectRatio: number;
467
+ }
468
+ /** Fixed-width chart that takes its height from the container. */
469
+ export interface ChartFixedWidthFluidHeight {
470
+ fillWidth?: false;
471
+ fillHeight: true;
472
+ width: number;
473
+ height?: never;
474
+ aspectRatio?: never;
475
+ }
476
+ /** Chart that fills its container on both axes — a dashboard tile. */
477
+ export interface ChartFluidBothAxes {
478
+ fillWidth: true;
479
+ fillHeight: true;
480
+ width?: never;
481
+ height?: never;
482
+ aspectRatio?: never;
483
+ }
484
+ /**
485
+ * The five legal ways to size a chart.
486
+ *
487
+ * A union rather than independent optional props, because the failure mode of
488
+ * the optional version is a chart that resolves to 0×0 and renders as nothing at
489
+ * all, with no error anywhere. Here `<BarChart fillWidth />` with neither
490
+ * `height` nor `aspectRatio` simply does not compile, and neither does
491
+ * `fillHeight` alongside a `height` that would contradict it.
492
+ *
493
+ * **`fillHeight` is not the mirror of `fillWidth`, and carries a requirement the
494
+ * type system cannot check.** Width flows down from the parent, so `fillWidth`
495
+ * is satisfied by any block container. Height flows *up* from content, so
496
+ * `fillHeight` needs an ancestor with a definite height — an explicit size, a
497
+ * flex or grid track, or absolute positioning. Given one, the chart fills it;
498
+ * given a content-sized parent there is nothing to fill and the chart collapses,
499
+ * which `useChartDimensions` warns about in development.
500
+ */
501
+ export type ChartSize = ChartFixedSize | ChartFluidFixedHeight | ChartFluidRatioHeight | ChartFixedWidthFluidHeight | ChartFluidBothAxes;
502
+ /**
503
+ * Props common to every chart.
504
+ *
505
+ * Data props are declared per chart, since their shapes and generics differ.
506
+ */
53
507
  export interface BaseChartProps {
54
- /** The data to render */
55
- data: ChartDatum[];
56
- /** Series configuration (order determines stacking/legend order) */
57
- series: ChartSeriesConfig[];
58
- /** Chart width in pixels. Optional when fillWidth is true. */
59
- width?: number;
60
- /** Chart height in pixels. Optional when aspectRatio is provided. */
61
- height?: number;
62
- /** Margins around the plot area */
508
+ /** Space around the plot area. Merged over the defaults. */
63
509
  margin?: Partial<ChartMargin>;
64
- /** When true, chart fills container width */
65
- fillWidth?: boolean;
66
- /** Aspect ratio (width/height). Used to auto-calculate height when fillWidth is true. */
67
- aspectRatio?: number;
68
- /** Format y-axis / value labels. Default: toLocaleString() */
510
+ /** Built-in value format. Ignored when `valueFormatter` is given. */
511
+ valueUnit?: ChartValueUnit;
512
+ /** Full control over value rendering. Wins over `valueUnit`. */
69
513
  valueFormatter?: ChartValueFormatter;
70
- /** Format x-axis / category labels. Default: identity */
514
+ /** Format category labels. Applied to the axis *and* the tooltip heading. */
71
515
  labelFormatter?: ChartLabelFormatter;
72
- /** Custom tooltip renderer. If omitted, uses default ChartTooltip */
516
+ /** Replace the tooltip body. Collision handling stays with the chart. */
73
517
  tooltipRenderer?: ChartTooltipRenderer;
74
- /** Disable tooltip entirely */
518
+ /** Suppress the tooltip and its hit targets entirely. */
75
519
  noTooltip?: boolean;
76
- /** Show legend */
520
+ /** Show the legend beneath the plot. */
77
521
  showLegend?: boolean;
78
- /** Accessible label for the chart SVG */
522
+ /** Render the loading treatment instead of the data. */
523
+ isLoading?: boolean;
524
+ /** Shown when there is nothing to plot. Defaults to a centred "No data". */
525
+ contentWhenEmpty?: ReactNode;
526
+ /** Accessible name for the chart. */
79
527
  ariaLabel?: string;
528
+ /** Longer description, associated via `aria-describedby`. */
529
+ ariaDescription?: string;
530
+ }
531
+ /**
532
+ * Props shared by the two cartesian charts (bar and line).
533
+ *
534
+ * Composed into each chart's props with `&` rather than `extends`, since
535
+ * {@link ChartSize} is a union and an interface cannot extend one.
536
+ */
537
+ export interface BaseCartesianChartProps extends BaseChartProps {
538
+ /** Draw horizontal grid lines at each value tick. */
539
+ showGrid?: boolean;
540
+ /** Override the computed value axis domain and tick count. */
541
+ valueDomain?: Partial<ChartValueDomain>;
542
+ /** How the category axis handles labels too long or too many to fit. */
543
+ categoryLabelMode?: ChartCategoryLabelMode;
544
+ /** Title rendered alongside the category axis. */
545
+ categoryAxisTitle?: string;
546
+ /** Title rendered alongside the value axis. */
547
+ valueAxisTitle?: string;
80
548
  }