@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,22 +1,44 @@
1
- import type { CurveFactory } from "d3-shape";
2
- import type { BaseChartProps } from "./types";
3
- export declare enum LineChartMode {
4
- NORMAL = "NORMAL",
5
- STACKED = "STACKED"
6
- }
7
- export interface LineChartProps extends BaseChartProps {
8
- /** Normal or stacked line mode */
9
- mode?: LineChartMode;
10
- /** Line stroke width in px */
1
+ import { LineChartCurve } from "./types";
2
+ import type { BaseCartesianChartProps, ChartSeriesStyles, ChartSize, LineChartLineDatum } from "./types";
3
+ export type LineChartProps<TMetric extends string> = BaseCartesianChartProps & ChartSize & {
4
+ /**
5
+ * Presentation for every metric, keyed by metric.
6
+ *
7
+ * `TMetric` is inferred from these keys alone — `lines` wraps it in
8
+ * `NoInfer` so a mistyped metric is a compile error rather than a line
9
+ * that silently fails to draw.
10
+ */
11
+ series: ChartSeriesStyles<TMetric>;
12
+ /** One entry per line. Lines may be sparse. */
13
+ lines: LineChartLineDatum<NoInfer<TMetric>>[];
14
+ /**
15
+ * Explicit category order along the x-axis.
16
+ *
17
+ * Worth supplying whenever the lines are sparse: the inferred order is the
18
+ * union of each line's categories in first-seen order, which is only
19
+ * correct if some line covers them all.
20
+ */
21
+ categories?: string[];
22
+ /** @default LineChartCurve.SMOOTH */
23
+ curve?: LineChartCurve;
24
+ /** Default stroke width in px, overridable per line. */
11
25
  strokeWidth?: number;
12
- /** Data-point dot radius in px (0 to hide dots) */
13
- dotRadius?: number;
14
- /** Show grid lines */
15
- showGrid?: boolean;
16
- /** Fill area under lines */
17
- showArea?: boolean;
18
- /** D3 curve factory for line interpolation */
19
- curveType?: CurveFactory;
20
- }
21
- declare const LineChart: ({ data, series, width, height, margin: marginOverride, fillWidth, aspectRatio, mode, strokeWidth, dotRadius, valueFormatter, labelFormatter, tooltipRenderer, noTooltip, showLegend, showGrid, showArea, curveType, ariaLabel, }: LineChartProps) => import("react").JSX.Element;
26
+ /** Draw a vertical rule at the active category. @default true */
27
+ showCursor?: boolean;
28
+ /**
29
+ * Notified when a category is pinned or unpinned by a click.
30
+ *
31
+ * The index is a position on the category axis.
32
+ */
33
+ onPinnedChange?: (categoryIndex: number | null) => void;
34
+ };
35
+ /**
36
+ * Line chart over a categorical x-axis.
37
+ *
38
+ * Hit testing is per category column rather than per stroke: the tooltip
39
+ * reports every line at the hovered category at once, which is almost always
40
+ * what a reader wants, and it avoids the proximity search a
41
+ * nearest-point-to-cursor model needs.
42
+ */
43
+ declare const LineChart: <TMetric extends string>({ series, lines, categories, width, height, fillWidth, fillHeight, aspectRatio, margin, curve, strokeWidth, showCursor, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid, showLegend, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, onPinnedChange, }: LineChartProps<TMetric>) => import("react").JSX.Element;
22
44
  export default LineChart;
@@ -1,250 +1,199 @@
1
- import { useGalaxyTheme, withTheme } from "../theme/GalaxyTheme.js";
2
- import FlexWrapper, { FlexDirection } from "../containers/FlexWrapper.js";
3
- import { useElementWidth } from "../hooks/useElementWidth.js";
4
- import Wrapper from "../containers/Wrapper.js";
5
- import { getChartPalette } from "./constants.js";
6
- import { buildLinearScale, buildPointScale, defaultLabelFormatter, defaultValueFormatter, getGroupedMax, getPlotDimensions, getStackedMax, resolveMargin, resolveSeriesColor } from "./utils.js";
7
- import ChartLegend from "./ChartLegend.js";
8
- import ChartTooltip from "./ChartTooltip.js";
9
- import { XAxisPoint, YAxis } from "./ChartAxis.js";
10
- /* empty css */
11
- import { styled } from "@linaria/react";
12
- import { useCallback, useMemo, useRef, useState } from "react";
13
- import { jsx, jsxs } from "react/jsx-runtime";
14
- import { area, curveMonotoneX, line } from "d3-shape";
1
+ import { useGalaxyTheme } from "../theme/GalaxyTheme.js";
2
+ import { ChartMarkState, LineChartCurve } from "./types.js";
3
+ import { LINE_AREA_OPACITY, LINE_POINT_RADIUS } from "./constants.js";
4
+ import { addAxisTitleSpace, getValueTicks } from "./chartScales.js";
5
+ import { useChartInteraction } from "./useChartInteraction.js";
6
+ import { useChartFormatters } from "./useChartFormatters.js";
7
+ import { useChartDimensions } from "./useChartDimensions.js";
8
+ import { buildLineChartGeometry } from "./lineChartGeometry.js";
9
+ import { resolveSeriesColor } from "./chartTheme.js";
10
+ import { ChartAreaPath, ChartCursorLine, ChartHitTarget, ChartLinePath, ChartPointCircle } from "./ChartPrimitives.js";
11
+ import ChartFrame from "./ChartFrame.js";
12
+ import { ChartCategoryAxis, ChartValueAxis } from "./ChartAxis.js";
13
+ import { useCallback, useMemo, useRef } from "react";
14
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
15
  //#region src/charts/LineChart.tsx
16
- var LineChartMode = /* @__PURE__ */ function(LineChartMode) {
17
- LineChartMode["NORMAL"] = "NORMAL";
18
- LineChartMode["STACKED"] = "STACKED";
19
- return LineChartMode;
20
- }({});
21
- var _exp = () => ({ $fillWidth }) => $fillWidth ? "flex" : "inline-flex";
22
- var _exp2 = () => ({ $fillWidth }) => $fillWidth ? "100%" : "auto";
23
- var ChartWrapper = withTheme(/*#__PURE__*/ styled("div")({
24
- name: "ChartWrapper",
25
- class: "c8llr95",
26
- propsAsIs: false,
27
- vars: {
28
- "c8llr95-0": [_exp()],
29
- "c8llr95-1": [_exp2()]
30
- }
31
- }));
32
- var LineChart = ({ data, series, width, height, margin: marginOverride, fillWidth = false, aspectRatio, mode = "NORMAL", strokeWidth = 2, dotRadius = 4, valueFormatter = defaultValueFormatter, labelFormatter = defaultLabelFormatter, tooltipRenderer, noTooltip = false, showLegend = true, showGrid = true, showArea = false, curveType = curveMonotoneX, ariaLabel }) => {
16
+ /**
17
+ * Line chart over a categorical x-axis.
18
+ *
19
+ * Hit testing is per category column rather than per stroke: the tooltip
20
+ * reports every line at the hovered category at once, which is almost always
21
+ * what a reader wants, and it avoids the proximity search a
22
+ * nearest-point-to-cursor model needs.
23
+ */
24
+ var LineChart = ({ series, lines, categories, width, height, fillWidth, fillHeight, aspectRatio, margin, curve = LineChartCurve.SMOOTH, strokeWidth, showCursor = true, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid = true, showLegend = true, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription, onPinnedChange }) => {
33
25
  const { theme } = useGalaxyTheme();
34
26
  const containerRef = useRef(null);
35
- const svgRef = useRef(null);
36
- const [tooltip, setTooltip] = useState(null);
37
- const [hoveredDatumIndex, setHoveredDatumIndex] = useState(null);
38
- const measuredWidth = useElementWidth(containerRef);
39
- const resolvedWidth = fillWidth ? measuredWidth ?? 0 : width ?? 0;
40
- const resolvedHeight = aspectRatio ? resolvedWidth / aspectRatio : height ?? 0;
41
- const palette = useMemo(() => getChartPalette(theme), [theme]);
42
- const margin = useMemo(() => resolveMargin(marginOverride), [marginOverride]);
43
- const { plotWidth, plotHeight } = useMemo(() => getPlotDimensions(resolvedWidth, resolvedHeight, margin), [
44
- resolvedWidth,
45
- resolvedHeight,
46
- margin
27
+ const dimensions = useChartDimensions({
28
+ containerRef,
29
+ width,
30
+ height,
31
+ fillWidth,
32
+ fillHeight,
33
+ aspectRatio,
34
+ margin: addAxisTitleSpace(margin, {
35
+ hasValueTitle: Boolean(valueAxisTitle),
36
+ hasCategoryTitle: Boolean(categoryAxisTitle)
37
+ })
38
+ });
39
+ const { plotWidth, plotHeight } = dimensions;
40
+ const { formatValue, formatLabel } = useChartFormatters({
41
+ valueFormatter,
42
+ valueUnit,
43
+ labelFormatter
44
+ });
45
+ const metricKeys = useMemo(() => Object.keys(series), [series]);
46
+ const resolveColor = useCallback(({ metric }) => resolveSeriesColor(theme, metricKeys.indexOf(metric), series[metric]?.color), [
47
+ theme,
48
+ metricKeys,
49
+ series
47
50
  ]);
48
- const seriesKeys = useMemo(() => series.map((s) => s.key), [series]);
49
- const labels = useMemo(() => data.map((d) => d.label), [data]);
50
- const xScale = useMemo(() => buildPointScale(labels, [0, plotWidth]), [labels, plotWidth]);
51
- const yMax = useMemo(() => mode === "STACKED" ? getStackedMax(data, seriesKeys) : getGroupedMax(data, seriesKeys), [
52
- data,
53
- seriesKeys,
54
- mode
51
+ const geometry = useMemo(() => buildLineChartGeometry({
52
+ lines,
53
+ categories,
54
+ plotWidth,
55
+ plotHeight,
56
+ curve,
57
+ valueDomain,
58
+ strokeWidth,
59
+ resolveColor
60
+ }), [
61
+ lines,
62
+ categories,
63
+ plotWidth,
64
+ plotHeight,
65
+ curve,
66
+ valueDomain,
67
+ strokeWidth,
68
+ resolveColor
55
69
  ]);
56
- const yScale = useMemo(() => buildLinearScale(yMax, [plotHeight, 0]), [yMax, plotHeight]);
57
- const stackedValues = useMemo(() => {
58
- if (mode !== "STACKED") return null;
59
- return data.map((datum) => {
60
- let cumulative = 0;
61
- const values = {};
62
- for (const s of series) {
63
- const value = datum.values[s.key] ?? 0;
64
- values[s.key] = {
65
- y0: cumulative,
66
- y1: cumulative + value
67
- };
68
- cumulative += value;
69
- }
70
- return values;
71
- });
72
- }, [
73
- data,
70
+ const valueTicks = useMemo(() => getValueTicks(geometry.valueScale, valueDomain), [geometry.valueScale, valueDomain]);
71
+ const isEmpty = geometry.categories.length === 0 || lines.length === 0;
72
+ const legendItems = useMemo(() => metricKeys.map((metric, lineIndex) => ({
73
+ key: metric,
74
+ label: series[metric].label,
75
+ color: resolveColor({
76
+ metric,
77
+ lineIndex
78
+ })
79
+ })), [
80
+ metricKeys,
74
81
  series,
75
- mode
82
+ resolveColor
76
83
  ]);
77
- const handlePointMouseEnter = useCallback((datumIndex, x, y) => {
78
- const datum = data[datumIndex];
79
- if (!datum) return;
80
- setHoveredDatumIndex(datumIndex);
81
- setTooltip({
82
- label: datum.label,
83
- items: series.map((s, i) => ({
84
- seriesKey: s.key,
85
- seriesName: s.name,
86
- value: datum.values[s.key] ?? 0,
87
- color: resolveSeriesColor(s, i, palette)
88
- })),
89
- x: x + margin.left,
90
- y: y + margin.top
91
- });
84
+ const legendKeys = useMemo(() => legendItems.map((item) => item.key), [legendItems]);
85
+ const interaction = useChartInteraction({
86
+ categoryCount: geometry.columns.length,
87
+ seriesKeys: legendKeys,
88
+ disabled: noTooltip || isLoading || isEmpty,
89
+ onPinnedChange
90
+ });
91
+ const activeColumn = interaction.activeIndex === null ? null : geometry.columns[interaction.activeIndex];
92
+ const tooltipModel = useMemo(() => {
93
+ if (noTooltip || !activeColumn) return null;
94
+ const rows = [...activeColumn.points].sort((a, b) => b.value - a.value).map((point) => ({
95
+ key: point.id,
96
+ label: series[point.metric]?.label ?? point.metric,
97
+ value: point.value,
98
+ formattedValue: formatValue(point.value),
99
+ color: point.color
100
+ }));
101
+ return {
102
+ label: formatLabel(activeColumn.label),
103
+ rows,
104
+ anchorX: activeColumn.x,
105
+ anchorY: activeColumn.anchorY
106
+ };
92
107
  }, [
93
- data,
108
+ noTooltip,
109
+ activeColumn,
94
110
  series,
95
- palette,
96
- margin
111
+ formatValue,
112
+ formatLabel
97
113
  ]);
98
- const handlePointMouseLeave = useCallback(() => {
99
- setHoveredDatumIndex(null);
100
- setTooltip(null);
101
- }, []);
102
- if (resolvedWidth === 0 || resolvedHeight === 0) return /* @__PURE__ */ jsx(ChartWrapper, {
103
- ref: containerRef,
104
- $fillWidth: fillWidth
105
- });
106
- const renderNormalLines = () => {
107
- return series.map((s, seriesIndex) => {
108
- const color = resolveSeriesColor(s, seriesIndex, palette);
109
- const linePath = line().x((_, i) => xScale(data[i].label) ?? 0).y((_, i) => yScale(data[i].values[s.key] ?? 0)).curve(curveType)(data.map((_, i) => i)) ?? "";
110
- const areaPath = showArea ? area().x((_, i) => xScale(data[i].label) ?? 0).y0(plotHeight).y1((_, i) => yScale(data[i].values[s.key] ?? 0)).curve(curveType)(data.map((_, i) => i)) ?? "" : "";
111
- return /* @__PURE__ */ jsxs("g", { children: [
112
- showArea && /* @__PURE__ */ jsx("path", {
113
- d: areaPath,
114
- fill: color,
115
- opacity: .1,
116
- style: { transition: `opacity 150ms ease-in-out` }
117
- }),
118
- /* @__PURE__ */ jsx("path", {
119
- d: linePath,
120
- fill: "none",
121
- stroke: color,
122
- strokeWidth,
123
- style: { transition: `opacity 150ms ease-in-out` }
124
- }),
125
- data.map((datum, datumIndex) => {
126
- const cx = xScale(datum.label) ?? 0;
127
- const cy = yScale(datum.values[s.key] ?? 0);
128
- return /* @__PURE__ */ jsxs("g", { children: [dotRadius > 0 && /* @__PURE__ */ jsx("circle", {
129
- cx,
130
- cy,
131
- r: dotRadius,
132
- fill: color,
133
- opacity: hoveredDatumIndex !== null && hoveredDatumIndex !== datumIndex ? .3 : 1,
134
- style: { transition: `opacity 150ms ease-in-out` },
135
- role: "graphics-symbol",
136
- "aria-roledescription": "data point",
137
- "aria-label": `${s.name} for ${datum.label}: ${valueFormatter(datum.values[s.key] ?? 0)}`
138
- }), /* @__PURE__ */ jsx("circle", {
139
- cx,
140
- cy,
141
- r: dotRadius + 6,
142
- fill: "transparent",
143
- onMouseEnter: () => handlePointMouseEnter(datumIndex, cx, cy),
144
- onMouseLeave: handlePointMouseLeave,
145
- onFocus: () => handlePointMouseEnter(datumIndex, cx, cy),
146
- onBlur: handlePointMouseLeave,
147
- tabIndex: 0,
148
- style: { cursor: "pointer" }
149
- })] }, datum.label);
150
- })
151
- ] }, s.key);
152
- });
153
- };
154
- const renderStackedLines = () => {
155
- if (!stackedValues) return null;
156
- return series.map((s, seriesIndex) => {
157
- const color = resolveSeriesColor(s, seriesIndex, palette);
158
- const areaPath = area().x((_, i) => xScale(data[i].label) ?? 0).y0((_, i) => yScale(stackedValues[i][s.key].y0)).y1((_, i) => yScale(stackedValues[i][s.key].y1)).curve(curveType)(data.map((_, i) => i)) ?? "";
159
- const linePath = line().x((_, i) => xScale(data[i].label) ?? 0).y((_, i) => yScale(stackedValues[i][s.key].y1)).curve(curveType)(data.map((_, i) => i)) ?? "";
160
- return /* @__PURE__ */ jsxs("g", { children: [
161
- /* @__PURE__ */ jsx("path", {
162
- d: areaPath,
163
- fill: color,
164
- opacity: .3,
165
- style: { transition: `opacity 150ms ease-in-out` }
166
- }),
167
- /* @__PURE__ */ jsx("path", {
168
- d: linePath,
169
- fill: "none",
170
- stroke: color,
171
- strokeWidth,
172
- style: { transition: `opacity 150ms ease-in-out` }
173
- }),
174
- data.map((datum, datumIndex) => {
175
- const cx = xScale(datum.label) ?? 0;
176
- const cy = yScale(stackedValues[datumIndex][s.key].y1);
177
- return /* @__PURE__ */ jsxs("g", { children: [dotRadius > 0 && /* @__PURE__ */ jsx("circle", {
178
- cx,
179
- cy,
180
- r: dotRadius,
181
- fill: color,
182
- opacity: hoveredDatumIndex !== null && hoveredDatumIndex !== datumIndex ? .3 : 1,
183
- style: { transition: `opacity 150ms ease-in-out` },
184
- role: "graphics-symbol",
185
- "aria-roledescription": "data point",
186
- "aria-label": `${s.name} for ${datum.label}: ${valueFormatter(datum.values[s.key] ?? 0)}`
187
- }), /* @__PURE__ */ jsx("circle", {
188
- cx,
189
- cy,
190
- r: dotRadius + 6,
191
- fill: "transparent",
192
- onMouseEnter: () => handlePointMouseEnter(datumIndex, cx, cy),
193
- onMouseLeave: handlePointMouseLeave,
194
- onFocus: () => handlePointMouseEnter(datumIndex, cx, cy),
195
- onBlur: handlePointMouseLeave,
196
- tabIndex: 0,
197
- style: { cursor: "pointer" }
198
- })] }, datum.label);
199
- })
200
- ] }, s.key);
201
- });
202
- };
203
- const defaultAriaLabel = `Line chart with ${data.length} data points and ${series.length} series`;
204
- return /* @__PURE__ */ jsxs(ChartWrapper, {
205
- ref: containerRef,
206
- $fillWidth: fillWidth,
207
- children: [/* @__PURE__ */ jsxs(Wrapper, {
208
- position: "relative",
209
- children: [/* @__PURE__ */ jsx("svg", {
210
- ref: svgRef,
211
- width: resolvedWidth,
212
- height: resolvedHeight,
213
- role: "img",
214
- "aria-label": ariaLabel ?? defaultAriaLabel,
215
- children: /* @__PURE__ */ jsxs("g", {
216
- transform: `translate(${margin.left}, ${margin.top})`,
217
- children: [
218
- /* @__PURE__ */ jsx(YAxis, {
219
- scale: yScale,
220
- transform: "translate(0, 0)",
221
- plotWidth,
222
- formatter: valueFormatter,
223
- showGrid,
224
- theme
225
- }),
226
- /* @__PURE__ */ jsx(XAxisPoint, {
227
- scale: xScale,
228
- transform: `translate(0, ${plotHeight})`,
229
- plotWidth,
230
- formatter: labelFormatter
231
- }),
232
- mode === "STACKED" ? renderStackedLines() : renderNormalLines()
233
- ]
234
- })
235
- }), !noTooltip && (tooltipRenderer ? tooltip && tooltipRenderer(tooltip) : /* @__PURE__ */ jsx(ChartTooltip, {
236
- data: tooltip,
237
- valueFormatter
238
- }))]
239
- }), showLegend && /* @__PURE__ */ jsxs(FlexWrapper, {
240
- direction: FlexDirection.ROW,
241
- gap: 0,
242
- children: [/* @__PURE__ */ jsx(Wrapper, { minWidth: margin.left }), /* @__PURE__ */ jsx(ChartLegend, {
243
- series,
244
- palette
245
- })]
246
- })]
114
+ const categoryPositions = useMemo(() => geometry.columns.map((column) => column.x - geometry.step / 2), [geometry.columns, geometry.step]);
115
+ return /* @__PURE__ */ jsxs(ChartFrame, {
116
+ containerRef,
117
+ dimensions,
118
+ fillWidth,
119
+ fillHeight,
120
+ interaction,
121
+ ariaLabel: ariaLabel ?? `Line chart with ${geometry.categories.length} categories and ${lines.length} series`,
122
+ ariaDescription,
123
+ axes: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ChartValueAxis, {
124
+ ticks: valueTicks,
125
+ scale: geometry.valueScale,
126
+ plotWidth,
127
+ plotHeight,
128
+ marginLeft: dimensions.margin.left,
129
+ formatter: formatValue,
130
+ showGrid,
131
+ title: valueAxisTitle
132
+ }), /* @__PURE__ */ jsx(ChartCategoryAxis, {
133
+ labels: geometry.categories,
134
+ positions: categoryPositions,
135
+ step: geometry.step,
136
+ plotWidth,
137
+ plotHeight,
138
+ formatter: formatLabel,
139
+ mode: categoryLabelMode,
140
+ title: categoryAxisTitle
141
+ })] }),
142
+ noTooltip,
143
+ tooltipModel,
144
+ tooltipRenderer,
145
+ anchorHalfWidth: geometry.step / 2,
146
+ isEmpty,
147
+ isLoading,
148
+ contentWhenEmpty,
149
+ showLegend,
150
+ legendItems,
151
+ children: [
152
+ geometry.paths.map((linePath) => linePath.areaPath ? /* @__PURE__ */ jsx(ChartAreaPath, {
153
+ d: linePath.areaPath,
154
+ fill: linePath.color,
155
+ fillOpacity: LINE_AREA_OPACITY,
156
+ "data-state": isLoading ? ChartMarkState.MUTED : interaction.getMarkState({ seriesKey: linePath.metric })
157
+ }, `${linePath.id}:area`) : null),
158
+ showCursor && activeColumn && /* @__PURE__ */ jsx(ChartCursorLine, {
159
+ x1: activeColumn.x,
160
+ x2: activeColumn.x,
161
+ y1: 0,
162
+ y2: plotHeight
163
+ }),
164
+ geometry.paths.map((linePath) => /* @__PURE__ */ jsx(ChartLinePath, {
165
+ d: linePath.path,
166
+ stroke: linePath.color,
167
+ strokeWidth: linePath.strokeWidth,
168
+ strokeDasharray: linePath.dashArray,
169
+ "data-state": isLoading ? ChartMarkState.MUTED : interaction.getMarkState({ seriesKey: linePath.metric })
170
+ }, linePath.id)),
171
+ geometry.isolatedPoints.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
172
+ cx: point.x,
173
+ cy: point.y,
174
+ r: LINE_POINT_RADIUS,
175
+ fill: point.color,
176
+ "data-state": isLoading ? ChartMarkState.MUTED : interaction.getMarkState({ seriesKey: point.metric })
177
+ }, `${point.id}:isolated`)),
178
+ activeColumn?.points.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
179
+ cx: point.x,
180
+ cy: point.y,
181
+ r: LINE_POINT_RADIUS,
182
+ fill: point.color,
183
+ "data-state": interaction.getMarkState({ seriesKey: point.metric })
184
+ }, point.id)),
185
+ !noTooltip && !isLoading && geometry.columns.map((column) => /* @__PURE__ */ jsx(ChartHitTarget, {
186
+ x: column.bandX,
187
+ y: 0,
188
+ width: column.bandWidth,
189
+ height: plotHeight,
190
+ "data-interactive": "true",
191
+ onMouseEnter: () => interaction.onCategoryEnter(column.categoryIndex),
192
+ onMouseLeave: interaction.onCategoryLeave,
193
+ onClick: () => interaction.onCategoryClick(column.categoryIndex)
194
+ }, column.categoryIndex))
195
+ ]
247
196
  });
248
197
  };
249
198
  //#endregion
250
- export { LineChartMode, LineChart as default };
199
+ export { LineChart as default };
@@ -1,35 +1,51 @@
1
- import type { ChartLabelFormatter, ChartTooltipRenderer, ChartValueFormatter, PieSlice } from "./types";
2
- export interface PieChartProps {
3
- /** Slice data */
4
- slices: PieSlice[];
5
- /** Chart width in pixels. Optional when fillWidth is true. */
6
- width?: number;
7
- /** Chart height in pixels. Optional when aspectRatio is provided. */
8
- height?: number;
9
- /** When true, chart fills container width */
10
- fillWidth?: boolean;
11
- /** Aspect ratio (width/height). Used to auto-calculate height when fillWidth is true. */
12
- aspectRatio?: number;
13
- /** Inner radius for donut charts (0 = full pie) */
14
- innerRadius?: number;
15
- /** Gap between slices in radians */
1
+ import type { ReactNode } from "react";
2
+ import type { BaseChartProps, ChartSeriesStyles, ChartSize, PieChartSliceDatum } from "./types";
3
+ export type PieChartProps<TSlice extends string> = BaseChartProps & ChartSize & {
4
+ /**
5
+ * Presentation for every slice, keyed by slice.
6
+ *
7
+ * `TSlice` is inferred from these keys alone `slices` wraps it in
8
+ * `NoInfer` — so a mistyped key is a compile error rather than a slice that
9
+ * silently fails to draw.
10
+ */
11
+ series: ChartSeriesStyles<TSlice>;
12
+ /** Slices, rendered clockwise from 12 o'clock in array order. */
13
+ slices: PieChartSliceDatum<NoInfer<TSlice>>[];
14
+ /**
15
+ * Hole size as a fraction of the outer radius, 0–1.
16
+ * `0` is a solid pie. Defaults to a donut.
17
+ */
18
+ innerRadiusRatio?: number;
19
+ /** Gap between slices, in radians. */
16
20
  padAngle?: number;
17
- /** Rounded slice corners in px */
21
+ /** Slice corner radius in px. */
18
22
  cornerRadius?: number;
19
- /** Format values in tooltip/labels */
20
- valueFormatter?: ChartValueFormatter;
21
- /** Format labels in legend/tooltip */
22
- labelFormatter?: ChartLabelFormatter;
23
- /** Custom tooltip renderer */
24
- tooltipRenderer?: ChartTooltipRenderer;
25
- /** Disable tooltip */
26
- noTooltip?: boolean;
27
- /** Show legend */
28
- showLegend?: boolean;
29
- /** Show percentage labels on slices */
30
- showLabels?: boolean;
31
- /** Accessible label for the chart SVG */
32
- ariaLabel?: string;
33
- }
34
- declare const PieChart: ({ slices, width, height, fillWidth, aspectRatio, innerRadius, padAngle, cornerRadius, valueFormatter, labelFormatter, tooltipRenderer, noTooltip, showLegend, showLabels, ariaLabel, }: PieChartProps) => import("react").JSX.Element;
23
+ /**
24
+ * Slices below this share of the total are folded into one bucket.
25
+ * Set `0` to render every slice faithfully.
26
+ */
27
+ minSliceShare?: number;
28
+ /** Label for the folded bucket. @default "Other" */
29
+ aggregatedLabel?: string;
30
+ /**
31
+ * Content for the donut hole — a total, a headline percentage.
32
+ * Ignored when `innerRadiusRatio` is 0.
33
+ */
34
+ centerContent?: ReactNode;
35
+ /**
36
+ * Notified when a slice is pinned or unpinned by a click.
37
+ *
38
+ * The index is a position in the *rendered* arcs, which excludes folded
39
+ * slices and may include the aggregated bucket.
40
+ */
41
+ onPinnedChange?: (sliceIndex: number | null) => void;
42
+ };
43
+ /**
44
+ * Pie and donut chart.
45
+ *
46
+ * Unlike the cartesian charts there is no category axis to hit-test against, so
47
+ * each arc is its own target. Small slices are folded into an "Other" bucket by
48
+ * default, which keeps every remaining arc large enough to actually hit.
49
+ */
50
+ declare const PieChart: <TSlice extends string>({ series, slices, width, height, fillWidth, fillHeight, aspectRatio, margin, innerRadiusRatio, padAngle, cornerRadius, minSliceShare, aggregatedLabel, centerContent, valueUnit, valueFormatter, labelFormatter, showLegend, noTooltip, tooltipRenderer, isLoading, contentWhenEmpty, ariaLabel, ariaDescription, onPinnedChange, }: PieChartProps<TSlice>) => import("react").JSX.Element;
35
51
  export default PieChart;