@galaxy-io/dls 1.2.7 → 1.3.1

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 (305) 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 +183 -253
  8. package/dist/charts/ChartAxis.d.ts +47 -22
  9. package/dist/charts/ChartAxis.js +81 -60
  10. package/dist/charts/ChartCategoryTargets.d.ts +27 -0
  11. package/dist/charts/ChartCategoryTargets.js +75 -0
  12. package/dist/charts/ChartEmptyState.d.ts +17 -0
  13. package/dist/charts/ChartEmptyState.js +29 -0
  14. package/dist/charts/ChartFrame.d.ts +110 -0
  15. package/dist/charts/ChartFrame.js +143 -0
  16. package/dist/charts/ChartLegend.d.ts +27 -4
  17. package/dist/charts/ChartLegend.js +46 -23
  18. package/dist/charts/ChartPrimitives.d.ts +230 -0
  19. package/dist/charts/ChartPrimitives.js +305 -0
  20. package/dist/charts/ChartTooltip.d.ts +25 -4
  21. package/dist/charts/ChartTooltip.js +55 -49
  22. package/dist/charts/LineChart.d.ts +42 -20
  23. package/dist/charts/LineChart.js +175 -241
  24. package/dist/charts/PieChart.d.ts +48 -32
  25. package/dist/charts/PieChart.js +180 -170
  26. package/dist/charts/barChartGeometry.d.ts +120 -0
  27. package/dist/charts/barChartGeometry.js +210 -0
  28. package/dist/charts/barChartLegend.d.ts +25 -0
  29. package/dist/charts/barChartLegend.js +23 -0
  30. package/dist/charts/chartFormat.d.ts +27 -0
  31. package/dist/charts/chartFormat.js +71 -0
  32. package/dist/charts/chartScales.d.ts +120 -0
  33. package/dist/charts/chartScales.js +165 -0
  34. package/dist/charts/chartTheme.d.ts +18 -0
  35. package/dist/charts/chartTheme.js +26 -0
  36. package/dist/charts/constants.d.ts +241 -18
  37. package/dist/charts/constants.js +261 -32
  38. package/dist/charts/lineChartGeometry.d.ts +92 -0
  39. package/dist/charts/lineChartGeometry.js +134 -0
  40. package/dist/charts/pieChartGeometry.d.ts +60 -0
  41. package/dist/charts/pieChartGeometry.js +79 -0
  42. package/dist/charts/types.d.ts +428 -54
  43. package/dist/charts/types.js +155 -0
  44. package/dist/charts/useCartesianChartLayout.d.ts +70 -0
  45. package/dist/charts/useCartesianChartLayout.js +56 -0
  46. package/dist/charts/useChartDimensions.d.ts +47 -0
  47. package/dist/charts/useChartDimensions.js +63 -0
  48. package/dist/charts/useChartFormatters.d.ts +19 -0
  49. package/dist/charts/useChartFormatters.js +20 -0
  50. package/dist/charts/useChartInteraction.d.ts +76 -0
  51. package/dist/charts/useChartInteraction.js +126 -0
  52. package/dist/charts/useChartTooltipPosition.d.ts +53 -0
  53. package/dist/charts/useChartTooltipPosition.js +39 -0
  54. package/dist/charts/useSeriesColorResolver.d.ts +37 -0
  55. package/dist/charts/useSeriesColorResolver.js +27 -0
  56. package/dist/hooks/useElementClientSize.d.ts +20 -0
  57. package/dist/hooks/useElementClientSize.js +43 -0
  58. package/dist/inputs/CheckboxInput.d.ts +7 -2
  59. package/dist/inputs/CheckboxInput.js +30 -14
  60. package/dist/inputs/Input.d.ts +1 -1
  61. package/dist/inputs/Input.js +6 -2
  62. package/dist/inputs/MultiSelectInput.js +1 -1
  63. package/dist/inputs/RadioInput.js +7 -2
  64. package/dist/styles.css +69 -74
  65. package/dist/table/InfiniteSpreadsheet.d.ts +6 -0
  66. package/dist/table/InfiniteSpreadsheet.js +235 -0
  67. package/dist/table/InfiniteTable.d.ts +7 -88
  68. package/dist/table/InfiniteTable.js +366 -577
  69. package/dist/{spreadsheet → table}/SpreadsheetCell.d.ts +6 -4
  70. package/dist/table/SpreadsheetCell.js +71 -0
  71. package/dist/{spreadsheet → table}/SpreadsheetCellEditor.js +27 -21
  72. package/dist/table/SpreadsheetHeaderCell.d.ts +23 -0
  73. package/dist/table/SpreadsheetHeaderCell.js +91 -0
  74. package/dist/table/SpreadsheetMenuItem.d.ts +14 -0
  75. package/dist/table/SpreadsheetMenuItem.js +33 -0
  76. package/dist/table/SpreadsheetPrimitives.d.ts +172 -0
  77. package/dist/table/SpreadsheetPrimitives.js +105 -0
  78. package/dist/table/SpreadsheetRow.d.ts +33 -0
  79. package/dist/table/SpreadsheetRow.js +73 -0
  80. package/dist/{spreadsheet → table}/SpreadsheetRowActionCell.d.ts +5 -7
  81. package/dist/table/SpreadsheetRowActionCell.js +51 -0
  82. package/dist/table/TableExpandCell.d.ts +11 -0
  83. package/dist/table/TableExpandCell.js +24 -0
  84. package/dist/table/TableExpandedRow.d.ts +16 -0
  85. package/dist/table/TableExpandedRow.js +77 -0
  86. package/dist/table/TableHeaderCellContent.d.ts +30 -0
  87. package/dist/table/TableHeaderCellContent.js +48 -0
  88. package/dist/table/TablePrimitives.d.ts +307 -0
  89. package/dist/table/TablePrimitives.js +298 -0
  90. package/dist/table/TableSelectCell.d.ts +18 -0
  91. package/dist/table/TableSelectCell.js +26 -0
  92. package/dist/table/TableStatusRow.d.ts +18 -0
  93. package/dist/table/TableStatusRow.js +50 -0
  94. package/dist/table/VirtualizedInfiniteTable.d.ts +11 -27
  95. package/dist/table/VirtualizedInfiniteTable.js +182 -317
  96. package/dist/table/types.d.ts +249 -0
  97. package/dist/table/types.js +51 -0
  98. package/dist/table/useInfiniteScrollSentinel.d.ts +24 -0
  99. package/dist/table/useInfiniteScrollSentinel.js +53 -0
  100. package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.d.ts +1 -1
  101. package/dist/{spreadsheet/hooks → table}/useSpreadsheetEditing.js +1 -1
  102. package/dist/table/useTableColumnLayout.d.ts +28 -0
  103. package/dist/table/useTableColumnLayout.js +63 -0
  104. package/dist/table/useTableColumnResize.d.ts +38 -0
  105. package/dist/table/useTableColumnResize.js +155 -0
  106. package/dist/table/useTableKeyboardNavigation.d.ts +25 -0
  107. package/dist/table/useTableKeyboardNavigation.js +83 -0
  108. package/dist/table/useTableRowExpansion.d.ts +24 -0
  109. package/dist/table/useTableRowExpansion.js +62 -0
  110. package/dist/table/useTableRowSelection.d.ts +27 -0
  111. package/dist/table/useTableRowSelection.js +94 -0
  112. package/dist/table/utils.d.ts +50 -0
  113. package/dist/table/utils.js +78 -0
  114. package/dist/text/MarkdownText.js +45 -27
  115. package/dist/theme/variants/dark.js +1 -1
  116. package/dist/widget/Widget.d.ts +2 -0
  117. package/dist/widget/Widget.js +14 -7
  118. package/package.json +1 -5
  119. package/dist/assets/components/enrichment/PerplexityIcon.d.ts +0 -3
  120. package/dist/assets/components/enrichment/PerplexityIcon.js +0 -35
  121. package/dist/assets/components/enrichment/TavilyIcon.d.ts +0 -3
  122. package/dist/assets/components/enrichment/TavilyIcon.js +0 -15
  123. package/dist/assets/components/onboarding/TenantSetupDark.d.ts +0 -3
  124. package/dist/assets/components/onboarding/TenantSetupDark.js +0 -498
  125. package/dist/assets/components/onboarding/TenantSetupLight.d.ts +0 -3
  126. package/dist/assets/components/onboarding/TenantSetupLight.js +0 -482
  127. package/dist/assets/components/onboarding/UserSetupDark.d.ts +0 -3
  128. package/dist/assets/components/onboarding/UserSetupDark.js +0 -1086
  129. package/dist/assets/components/onboarding/UserSetupLight.d.ts +0 -3
  130. package/dist/assets/components/onboarding/UserSetupLight.js +0 -1024
  131. package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.d.ts +0 -3
  132. package/dist/assets/components/onboarding/WorkspaceSetupBuildDark.js +0 -466
  133. package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.d.ts +0 -3
  134. package/dist/assets/components/onboarding/WorkspaceSetupBuildLight.js +0 -460
  135. package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.d.ts +0 -3
  136. package/dist/assets/components/onboarding/WorkspaceSetupConnectDark.js +0 -336
  137. package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.d.ts +0 -3
  138. package/dist/assets/components/onboarding/WorkspaceSetupConnectLight.js +0 -336
  139. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.d.ts +0 -3
  140. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateDark.js +0 -153
  141. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.d.ts +0 -3
  142. package/dist/assets/components/onboarding/WorkspaceSetupIntegrateLight.js +0 -153
  143. package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.d.ts +0 -3
  144. package/dist/assets/components/projects/MappingMethodAutoIntrospectDark.js +0 -117
  145. package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.d.ts +0 -3
  146. package/dist/assets/components/projects/MappingMethodAutoIntrospectLight.js +0 -117
  147. package/dist/assets/components/projects/MappingMethodBlankDark.d.ts +0 -3
  148. package/dist/assets/components/projects/MappingMethodBlankDark.js +0 -150
  149. package/dist/assets/components/projects/MappingMethodBlankDarkHovered.d.ts +0 -3
  150. package/dist/assets/components/projects/MappingMethodBlankDarkHovered.js +0 -150
  151. package/dist/assets/components/projects/MappingMethodBlankLight.d.ts +0 -3
  152. package/dist/assets/components/projects/MappingMethodBlankLight.js +0 -150
  153. package/dist/assets/components/projects/MappingMethodBlankLightHovered.d.ts +0 -3
  154. package/dist/assets/components/projects/MappingMethodBlankLightHovered.js +0 -150
  155. package/dist/assets/components/projects/MappingMethodJsonDark.d.ts +0 -3
  156. package/dist/assets/components/projects/MappingMethodJsonDark.js +0 -90
  157. package/dist/assets/components/projects/MappingMethodJsonDarkHovered.d.ts +0 -3
  158. package/dist/assets/components/projects/MappingMethodJsonDarkHovered.js +0 -90
  159. package/dist/assets/components/projects/MappingMethodJsonLight.d.ts +0 -3
  160. package/dist/assets/components/projects/MappingMethodJsonLight.js +0 -90
  161. package/dist/assets/components/projects/MappingMethodJsonLightHovered.d.ts +0 -3
  162. package/dist/assets/components/projects/MappingMethodJsonLightHovered.js +0 -90
  163. package/dist/assets/components/projects/ProjectsEmptyStateDark.d.ts +0 -3
  164. package/dist/assets/components/projects/ProjectsEmptyStateDark.js +0 -454
  165. package/dist/assets/components/projects/ProjectsEmptyStateLight.d.ts +0 -3
  166. package/dist/assets/components/projects/ProjectsEmptyStateLight.js +0 -456
  167. package/dist/assets/components/root/CreateProjectActionCardDark.d.ts +0 -3
  168. package/dist/assets/components/root/CreateProjectActionCardDark.js +0 -1796
  169. package/dist/assets/components/root/CreateProjectActionCardDarkHovered.d.ts +0 -3
  170. package/dist/assets/components/root/CreateProjectActionCardDarkHovered.js +0 -1796
  171. package/dist/assets/components/root/CreateProjectActionCardLight.d.ts +0 -3
  172. package/dist/assets/components/root/CreateProjectActionCardLight.js +0 -1786
  173. package/dist/assets/components/root/CreateProjectActionCardLightHovered.d.ts +0 -3
  174. package/dist/assets/components/root/CreateProjectActionCardLightHovered.js +0 -1786
  175. package/dist/assets/components/root/CreateSourceActionCardDark.d.ts +0 -3
  176. package/dist/assets/components/root/CreateSourceActionCardDark.js +0 -879
  177. package/dist/assets/components/root/CreateSourceActionCardDarkHovered.d.ts +0 -3
  178. package/dist/assets/components/root/CreateSourceActionCardDarkHovered.js +0 -879
  179. package/dist/assets/components/root/CreateSourceActionCardLight.d.ts +0 -3
  180. package/dist/assets/components/root/CreateSourceActionCardLight.js +0 -889
  181. package/dist/assets/components/root/CreateSourceActionCardLightHovered.d.ts +0 -3
  182. package/dist/assets/components/root/CreateSourceActionCardLightHovered.js +0 -889
  183. package/dist/assets/components/sources/AttioIcon.d.ts +0 -3
  184. package/dist/assets/components/sources/AttioIcon.js +0 -11
  185. package/dist/assets/components/sources/BigquerySourceIcon.d.ts +0 -3
  186. package/dist/assets/components/sources/BigquerySourceIcon.js +0 -39
  187. package/dist/assets/components/sources/BrowserbaseSourceIcon.d.ts +0 -3
  188. package/dist/assets/components/sources/BrowserbaseSourceIcon.js +0 -35
  189. package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.d.ts +0 -3
  190. package/dist/assets/components/sources/ClickhouseLogoSourceIconDark.js +0 -13
  191. package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.d.ts +0 -3
  192. package/dist/assets/components/sources/ClickhouseLogoSourceIconLight.js +0 -13
  193. package/dist/assets/components/sources/ConfluenceSourceIcon.d.ts +0 -3
  194. package/dist/assets/components/sources/ConfluenceSourceIcon.js +0 -30
  195. package/dist/assets/components/sources/GithubSourceIcon.d.ts +0 -3
  196. package/dist/assets/components/sources/GithubSourceIcon.js +0 -27
  197. package/dist/assets/components/sources/GoogleDriveIcon.d.ts +0 -3
  198. package/dist/assets/components/sources/GoogleDriveIcon.js +0 -45
  199. package/dist/assets/components/sources/HubspotSourceIcon.d.ts +0 -3
  200. package/dist/assets/components/sources/HubspotSourceIcon.js +0 -14
  201. package/dist/assets/components/sources/JiraSourceIcon.d.ts +0 -3
  202. package/dist/assets/components/sources/JiraSourceIcon.js +0 -54
  203. package/dist/assets/components/sources/LinearSourceIcon.d.ts +0 -3
  204. package/dist/assets/components/sources/LinearSourceIcon.js +0 -14
  205. package/dist/assets/components/sources/MysqlLogoSourceIconDark.d.ts +0 -3
  206. package/dist/assets/components/sources/MysqlLogoSourceIconDark.js +0 -17
  207. package/dist/assets/components/sources/NetsuiteSourceIcon.d.ts +0 -3
  208. package/dist/assets/components/sources/NetsuiteSourceIcon.js +0 -32
  209. package/dist/assets/components/sources/NotionIcon.d.ts +0 -3
  210. package/dist/assets/components/sources/NotionIcon.js +0 -20
  211. package/dist/assets/components/sources/PostgresqlIcon.d.ts +0 -3
  212. package/dist/assets/components/sources/PostgresqlIcon.js +0 -61
  213. package/dist/assets/components/sources/S3Icon.d.ts +0 -3
  214. package/dist/assets/components/sources/S3Icon.js +0 -76
  215. package/dist/assets/components/sources/SalesforceSourceIcon.d.ts +0 -3
  216. package/dist/assets/components/sources/SalesforceSourceIcon.js +0 -23
  217. package/dist/assets/components/sources/SlackIcon.d.ts +0 -3
  218. package/dist/assets/components/sources/SlackIcon.js +0 -32
  219. package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.d.ts +0 -3
  220. package/dist/assets/components/sources/SnowflakeLogoSourceIconDark.js +0 -14
  221. package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.d.ts +0 -3
  222. package/dist/assets/components/sources/SnowflakeLogoSourceIconLight.js +0 -14
  223. package/dist/assets/components/sources/WikipediaSourceIcon.d.ts +0 -3
  224. package/dist/assets/components/sources/WikipediaSourceIcon.js +0 -1490
  225. package/dist/avatar/AvatarEmpty.d.ts +0 -7
  226. package/dist/avatar/AvatarEmpty.js +0 -99
  227. package/dist/avatar/types.d.ts +0 -5
  228. package/dist/avatar/types.js +0 -9
  229. package/dist/charts/utils.d.ts +0 -29
  230. package/dist/charts/utils.js +0 -62
  231. package/dist/icons/BackIcon.d.ts +0 -3
  232. package/dist/icons/BackIcon.js +0 -13
  233. package/dist/icons/CloseIcon.d.ts +0 -3
  234. package/dist/icons/CloseIcon.js +0 -13
  235. package/dist/icons/CreateIcon.d.ts +0 -3
  236. package/dist/icons/CreateIcon.js +0 -13
  237. package/dist/icons/ForwardIcon.d.ts +0 -3
  238. package/dist/icons/ForwardIcon.js +0 -13
  239. package/dist/icons/HelpIcon.d.ts +0 -3
  240. package/dist/icons/HelpIcon.js +0 -14
  241. package/dist/icons/ProjectsIcon.d.ts +0 -3
  242. package/dist/icons/ProjectsIcon.js +0 -12
  243. package/dist/icons/SearchIcon.d.ts +0 -3
  244. package/dist/icons/SearchIcon.js +0 -12
  245. package/dist/icons/SourcesIcon.d.ts +0 -3
  246. package/dist/icons/SourcesIcon.js +0 -12
  247. package/dist/icons/TextIcon.d.ts +0 -4
  248. package/dist/icons/TextIcon.js +0 -22
  249. package/dist/icons/WebScrapeIcon.d.ts +0 -4
  250. package/dist/icons/WebScrapeIcon.js +0 -22
  251. package/dist/icons/WebhookIcon.d.ts +0 -4
  252. package/dist/icons/WebhookIcon.js +0 -22
  253. package/dist/icons/sources/AttioLogomark.d.ts +0 -4
  254. package/dist/icons/sources/AttioLogomark.js +0 -8
  255. package/dist/icons/sources/BrowserbaseLogomark.d.ts +0 -4
  256. package/dist/icons/sources/BrowserbaseLogomark.js +0 -8
  257. package/dist/icons/sources/ClickhouseLogomark.d.ts +0 -4
  258. package/dist/icons/sources/ClickhouseLogomark.js +0 -16
  259. package/dist/icons/sources/ConfluenceLogomark.d.ts +0 -4
  260. package/dist/icons/sources/ConfluenceLogomark.js +0 -8
  261. package/dist/icons/sources/GithubLogomark.d.ts +0 -4
  262. package/dist/icons/sources/GithubLogomark.js +0 -8
  263. package/dist/icons/sources/GoogleBigqueryLogomark.d.ts +0 -4
  264. package/dist/icons/sources/GoogleBigqueryLogomark.js +0 -8
  265. package/dist/icons/sources/GoogleDriveLogomark.d.ts +0 -4
  266. package/dist/icons/sources/GoogleDriveLogomark.js +0 -8
  267. package/dist/icons/sources/HubspotLogomark.d.ts +0 -4
  268. package/dist/icons/sources/HubspotLogomark.js +0 -8
  269. package/dist/icons/sources/JiraLogomark.d.ts +0 -4
  270. package/dist/icons/sources/JiraLogomark.js +0 -8
  271. package/dist/icons/sources/LinearLogomark.d.ts +0 -4
  272. package/dist/icons/sources/LinearLogomark.js +0 -8
  273. package/dist/icons/sources/MySQLLogomark.d.ts +0 -4
  274. package/dist/icons/sources/MySQLLogomark.js +0 -8
  275. package/dist/icons/sources/NetsuiteLogomark.d.ts +0 -4
  276. package/dist/icons/sources/NetsuiteLogomark.js +0 -8
  277. package/dist/icons/sources/NotionLogomark.d.ts +0 -4
  278. package/dist/icons/sources/NotionLogomark.js +0 -8
  279. package/dist/icons/sources/PostgresLogomark.d.ts +0 -4
  280. package/dist/icons/sources/PostgresLogomark.js +0 -8
  281. package/dist/icons/sources/S3Logomark.d.ts +0 -4
  282. package/dist/icons/sources/S3Logomark.js +0 -8
  283. package/dist/icons/sources/SalesforceLogomark.d.ts +0 -4
  284. package/dist/icons/sources/SalesforceLogomark.js +0 -8
  285. package/dist/icons/sources/SlackLogoIconmark.d.ts +0 -4
  286. package/dist/icons/sources/SlackLogoIconmark.js +0 -8
  287. package/dist/icons/sources/SnowflakeLogomark.d.ts +0 -4
  288. package/dist/icons/sources/SnowflakeLogomark.js +0 -16
  289. package/dist/icons/sources/WikipediaLogomark.d.ts +0 -4
  290. package/dist/icons/sources/WikipediaLogomark.js +0 -8
  291. package/dist/spreadsheet/InfiniteSpreadsheet.d.ts +0 -3
  292. package/dist/spreadsheet/InfiniteSpreadsheet.js +0 -265
  293. package/dist/spreadsheet/SpreadsheetAddColumnButton.d.ts +0 -6
  294. package/dist/spreadsheet/SpreadsheetAddColumnButton.js +0 -32
  295. package/dist/spreadsheet/SpreadsheetCell.js +0 -115
  296. package/dist/spreadsheet/SpreadsheetHeaderCell.d.ts +0 -18
  297. package/dist/spreadsheet/SpreadsheetHeaderCell.js +0 -141
  298. package/dist/spreadsheet/SpreadsheetRow.d.ts +0 -21
  299. package/dist/spreadsheet/SpreadsheetRow.js +0 -68
  300. package/dist/spreadsheet/SpreadsheetRowActionCell.js +0 -78
  301. package/dist/spreadsheet/hooks/useColumnResize.d.ts +0 -6
  302. package/dist/spreadsheet/hooks/useColumnResize.js +0 -46
  303. package/dist/spreadsheet/types.d.ts +0 -92
  304. package/dist/spreadsheet/types.js +0 -21
  305. /package/dist/{spreadsheet → table}/SpreadsheetCellEditor.d.ts +0 -0
@@ -1,64 +1,70 @@
1
- import { withTheme } from "../theme/GalaxyTheme.js";
2
1
  import Text, { TextSize, TextVariant, TextWeight } from "../text/Text.js";
2
+ import FlexItem from "../containers/FlexItem.js";
3
3
  import FlexWrapper, { AlignItems, FlexDirection, JustifyContent } from "../containers/FlexWrapper.js";
4
4
  import Circle from "../shapes/Circle.js";
5
- import { defaultValueFormatter } from "./utils.js";
6
- /* empty css */
7
- import { styled } from "@linaria/react";
5
+ import { useChartTooltipPosition } from "./useChartTooltipPosition.js";
6
+ import { ChartTooltipPositioner } from "./ChartPrimitives.js";
7
+ import { useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  //#region src/charts/ChartTooltip.tsx
10
- var _exp = () => ({ $x }) => $x;
11
- var _exp2 = () => ({ $y }) => $y;
12
- var _exp3 = () => ({ theme }) => theme.color.background.secondary;
13
- var _exp4 = () => ({ theme }) => theme.color.border.secondary;
14
- var _exp5 = () => ({ $visible }) => $visible ? 1 : 0;
15
- var TooltipContainer = withTheme(/*#__PURE__*/ styled("div")({
16
- name: "TooltipContainer",
17
- class: "ttysfji",
18
- propsAsIs: false,
19
- vars: {
20
- "ttysfji-0": [_exp(), "px"],
21
- "ttysfji-1": [_exp2(), "px"],
22
- "ttysfji-2": [_exp3()],
23
- "ttysfji-3": [_exp4()],
24
- "ttysfji-4": [_exp5()]
25
- }
26
- }));
27
- var ChartTooltip = ({ data, valueFormatter = defaultValueFormatter }) => {
28
- if (!data) return null;
29
- return /* @__PURE__ */ jsx(TooltipContainer, {
30
- $x: data.x,
31
- $y: data.y,
32
- $visible: true,
33
- children: /* @__PURE__ */ jsxs(FlexWrapper, {
10
+ var ChartTooltip = ({ model, containerWidth, containerHeight, anchorHalfWidth, placeAwayFromX, verticalAlign, renderer }) => {
11
+ const [retained, setRetained] = useState(model);
12
+ if (model !== null && model !== retained) setRetained(model);
13
+ const { tooltipRef, x, y, isMeasured } = useChartTooltipPosition({
14
+ anchorX: model?.anchorX ?? retained?.anchorX ?? 0,
15
+ anchorY: model?.anchorY ?? retained?.anchorY ?? 0,
16
+ containerWidth,
17
+ containerHeight,
18
+ anchorHalfWidth,
19
+ placeAwayFromX,
20
+ verticalAlign
21
+ });
22
+ const displayed = model ?? retained;
23
+ return /* @__PURE__ */ jsx(ChartTooltipPositioner, {
24
+ ref: tooltipRef,
25
+ $x: x,
26
+ $y: y,
27
+ $isVisible: model !== null && isMeasured,
28
+ role: "tooltip",
29
+ "aria-hidden": model === null,
30
+ children: !displayed ? null : renderer ? renderer(displayed) : /* @__PURE__ */ jsxs(FlexWrapper, {
34
31
  direction: FlexDirection.COLUMN,
35
- gap: 6,
32
+ gap: 8,
33
+ fillWidth: true,
36
34
  children: [/* @__PURE__ */ jsx(Text, {
37
35
  size: TextSize.BODY_SM,
38
- weight: TextWeight.MEDIUM,
39
- children: data.label
40
- }), data.items.map((item) => /* @__PURE__ */ jsxs(FlexWrapper, {
41
- alignItems: AlignItems.CENTER,
42
- justifyContent: JustifyContent.SPACE_BETWEEN,
43
- gap: 32,
36
+ variant: TextVariant.TERTIARY,
37
+ children: displayed.label
38
+ }), /* @__PURE__ */ jsx(FlexWrapper, {
39
+ direction: FlexDirection.COLUMN,
40
+ gap: 6,
44
41
  fillWidth: true,
45
- children: [/* @__PURE__ */ jsxs(FlexWrapper, {
42
+ children: displayed.rows.map((row) => /* @__PURE__ */ jsxs(FlexWrapper, {
46
43
  alignItems: AlignItems.CENTER,
47
- gap: 6,
48
- children: [/* @__PURE__ */ jsx(Circle, {
49
- size: 8,
50
- hex: item.color
44
+ justifyContent: JustifyContent.SPACE_BETWEEN,
45
+ gap: 16,
46
+ fillWidth: true,
47
+ children: [/* @__PURE__ */ jsxs(FlexWrapper, {
48
+ alignItems: AlignItems.CENTER,
49
+ gap: 6,
50
+ children: [/* @__PURE__ */ jsx(FlexItem, {
51
+ shrink: 0,
52
+ children: /* @__PURE__ */ jsx(Circle, {
53
+ size: 8,
54
+ hex: row.color
55
+ })
56
+ }), /* @__PURE__ */ jsx(Text, {
57
+ size: TextSize.BODY_SM,
58
+ isEllipsis: true,
59
+ children: row.label
60
+ })]
51
61
  }), /* @__PURE__ */ jsx(Text, {
52
- size: TextSize.CAPTION,
53
- variant: TextVariant.PRIMARY,
54
- children: item.seriesName
62
+ size: TextSize.BODY_SM,
63
+ weight: TextWeight.MEDIUM,
64
+ children: row.formattedValue
55
65
  })]
56
- }), /* @__PURE__ */ jsx(Text, {
57
- size: TextSize.CAPTION,
58
- weight: TextWeight.MEDIUM,
59
- children: valueFormatter(item.value)
60
- })]
61
- }, item.seriesKey))]
66
+ }, row.key))
67
+ })]
62
68
  })
63
69
  });
64
70
  };
@@ -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,184 @@
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 { ChartKind, ChartTargetShape, LineChartCurve } from "./types.js";
2
+ import { LINE_AREA_OPACITY, LINE_POINT_RADIUS } from "./constants.js";
3
+ import { useSeriesColorResolver } from "./useSeriesColorResolver.js";
4
+ import { useChartInteraction } from "./useChartInteraction.js";
5
+ import { useCartesianChartLayout } from "./useCartesianChartLayout.js";
6
+ import { buildLineChartGeometry, getLineValueDomain } from "./lineChartGeometry.js";
7
+ import { ChartAreaPath, ChartCursorLine, ChartLinePath, ChartPointCircle } from "./ChartPrimitives.js";
8
+ import ChartFrame from "./ChartFrame.js";
9
+ import { ChartCategoryAxis, ChartValueAxis } from "./ChartAxis.js";
10
+ import { useCallback, useMemo, useRef } from "react";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
15
12
  //#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 }) => {
33
- const { theme } = useGalaxyTheme();
13
+ /**
14
+ * Line chart over a categorical x-axis.
15
+ *
16
+ * Hit testing is per category column rather than per stroke: the tooltip
17
+ * reports every line at the hovered category at once, which is almost always
18
+ * what a reader wants, and it avoids the proximity search a
19
+ * nearest-point-to-cursor model needs.
20
+ */
21
+ 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 }) => {
34
22
  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
47
- ]);
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
55
- ]);
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,
74
- series,
75
- mode
23
+ const colors = useSeriesColorResolver(series);
24
+ const { dimensions, domain, valueTicks, formatValue, formatLabel } = useCartesianChartLayout({
25
+ containerRef,
26
+ rawDomain: useMemo(() => getLineValueDomain(lines), [lines]),
27
+ valueDomain,
28
+ width,
29
+ height,
30
+ fillWidth,
31
+ fillHeight,
32
+ aspectRatio,
33
+ margin,
34
+ valueUnit,
35
+ valueFormatter,
36
+ labelFormatter,
37
+ valueAxisTitle,
38
+ categoryAxisTitle
39
+ });
40
+ const { plotWidth, plotHeight } = dimensions;
41
+ const resolveColor = useCallback(({ metric }) => colors.resolve(metric), [colors]);
42
+ const geometry = useMemo(() => buildLineChartGeometry({
43
+ lines,
44
+ categories,
45
+ plotWidth,
46
+ plotHeight,
47
+ curve,
48
+ domain,
49
+ strokeWidth,
50
+ resolveColor
51
+ }), [
52
+ lines,
53
+ categories,
54
+ plotWidth,
55
+ plotHeight,
56
+ curve,
57
+ domain,
58
+ strokeWidth,
59
+ resolveColor
76
60
  ]);
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
- });
61
+ const isEmpty = geometry.categories.length === 0 || lines.length === 0;
62
+ const legendItems = useMemo(() => colors.keys.map((metric) => ({
63
+ key: metric,
64
+ label: series[metric].label,
65
+ color: colors.resolve(metric)
66
+ })), [colors, series]);
67
+ const legendKeys = useMemo(() => legendItems.map((item) => item.key), [legendItems]);
68
+ const interaction = useChartInteraction({
69
+ categoryCount: geometry.columns.length,
70
+ seriesKeys: legendKeys,
71
+ disabled: noTooltip || isLoading || isEmpty,
72
+ isLoading,
73
+ onPinnedChange
74
+ });
75
+ const activeColumn = interaction.activeIndex === null ? null : geometry.columns[interaction.activeIndex];
76
+ const buildCategoryTooltip = useCallback((index) => {
77
+ const column = geometry.columns[index];
78
+ if (!column) return null;
79
+ const rows = [...column.points].sort((a, b) => b.value - a.value).map((point) => ({
80
+ key: point.id,
81
+ label: series[point.metric]?.label ?? point.metric,
82
+ value: point.value,
83
+ formattedValue: formatValue(point.value),
84
+ color: point.color
85
+ }));
86
+ return {
87
+ label: formatLabel(column.label),
88
+ rows,
89
+ anchorX: column.x,
90
+ anchorY: column.anchorY
91
+ };
92
92
  }, [
93
- data,
93
+ geometry.columns,
94
94
  series,
95
- palette,
96
- margin
95
+ formatValue,
96
+ formatLabel
97
97
  ]);
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
- })]
98
+ const categoryPositions = useMemo(() => geometry.columns.map((column) => column.x - geometry.step / 2), [geometry.columns, geometry.step]);
99
+ const categoryTargets = useMemo(() => geometry.columns.map((column) => ({
100
+ key: String(column.categoryIndex),
101
+ shape: ChartTargetShape.RECT,
102
+ x: column.bandX,
103
+ y: 0,
104
+ width: column.bandWidth,
105
+ height: plotHeight
106
+ })), [geometry.columns, plotHeight]);
107
+ return /* @__PURE__ */ jsxs(ChartFrame, {
108
+ containerRef,
109
+ dimensions,
110
+ fillWidth,
111
+ fillHeight,
112
+ interaction,
113
+ kind: ChartKind.LINE,
114
+ categoryCount: geometry.categories.length,
115
+ ariaLabel,
116
+ ariaDescription,
117
+ axes: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ChartValueAxis, {
118
+ ticks: valueTicks,
119
+ scale: geometry.valueScale,
120
+ plotWidth,
121
+ plotHeight,
122
+ marginLeft: dimensions.margin.left,
123
+ formatter: formatValue,
124
+ showGrid,
125
+ title: valueAxisTitle
126
+ }), /* @__PURE__ */ jsx(ChartCategoryAxis, {
127
+ labels: geometry.categories,
128
+ positions: categoryPositions,
129
+ step: geometry.step,
130
+ plotWidth,
131
+ plotHeight,
132
+ formatter: formatLabel,
133
+ mode: categoryLabelMode,
134
+ title: categoryAxisTitle
135
+ })] }),
136
+ noTooltip,
137
+ buildCategoryTooltip,
138
+ tooltipRenderer,
139
+ categoryTargets,
140
+ anchorHalfWidth: geometry.step / 2,
141
+ isEmpty,
142
+ isLoading,
143
+ contentWhenEmpty,
144
+ showLegend,
145
+ legendItems,
146
+ children: [
147
+ geometry.paths.map((linePath) => linePath.areaPath ? /* @__PURE__ */ jsx(ChartAreaPath, {
148
+ d: linePath.areaPath,
149
+ fill: linePath.color,
150
+ fillOpacity: LINE_AREA_OPACITY,
151
+ "data-state": interaction.getMarkState({ seriesKey: linePath.metric })
152
+ }, `${linePath.id}:area`) : null),
153
+ showCursor && activeColumn && /* @__PURE__ */ jsx(ChartCursorLine, {
154
+ x1: activeColumn.x,
155
+ x2: activeColumn.x,
156
+ y1: 0,
157
+ y2: plotHeight
158
+ }),
159
+ geometry.paths.map((linePath) => /* @__PURE__ */ jsx(ChartLinePath, {
160
+ d: linePath.path,
161
+ stroke: linePath.color,
162
+ strokeWidth: linePath.strokeWidth,
163
+ strokeDasharray: linePath.dashArray,
164
+ "data-state": interaction.getMarkState({ seriesKey: linePath.metric })
165
+ }, linePath.id)),
166
+ geometry.isolatedPoints.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
167
+ cx: point.x,
168
+ cy: point.y,
169
+ r: LINE_POINT_RADIUS,
170
+ fill: point.color,
171
+ "data-state": interaction.getMarkState({ seriesKey: point.metric })
172
+ }, `${point.id}:isolated`)),
173
+ activeColumn?.points.map((point) => /* @__PURE__ */ jsx(ChartPointCircle, {
174
+ cx: point.x,
175
+ cy: point.y,
176
+ r: LINE_POINT_RADIUS,
177
+ fill: point.color,
178
+ "data-state": interaction.getMarkState({ seriesKey: point.metric })
179
+ }, point.id))
180
+ ]
247
181
  });
248
182
  };
249
183
  //#endregion
250
- export { LineChartMode, LineChart as default };
184
+ export { LineChart as default };