@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,18 +1,49 @@
1
1
  import Text, { TextSize, TextVariant } from "../text/Text.js";
2
2
  import FlexWrapper, { AlignItems, JustifyContent } from "../containers/FlexWrapper.js";
3
+ import { ChartCategoryLabelMode } from "./types.js";
3
4
  import "./constants.js";
4
- import { defaultLabelFormatter, defaultValueFormatter } from "./utils.js";
5
+ import { getCategoryLabelStride } from "./chartScales.js";
6
+ import { ChartAxisLabelBox, ChartGridLine } from "./ChartPrimitives.js";
5
7
  import { jsx, jsxs } from "react/jsx-runtime";
6
8
  //#region src/charts/ChartAxis.tsx
7
- var XAxis = ({ scale, transform, formatter = defaultLabelFormatter }) => {
8
- return /* @__PURE__ */ jsx("g", {
9
- transform,
10
- children: scale.domain().map((label) => {
11
- return /* @__PURE__ */ jsx("foreignObject", {
12
- x: (scale(label) ?? 0) + scale.bandwidth() / 2 - scale.bandwidth() / 2,
13
- y: 8,
14
- width: scale.bandwidth(),
15
- height: 24,
9
+ var ChartValueAxis = ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatter, showGrid = true, title }) => {
10
+ const titleBand = title ? 26 : 0;
11
+ const labelWidth = Math.max(0, marginLeft - titleBand - 12);
12
+ return /* @__PURE__ */ jsxs("g", {
13
+ "aria-hidden": true,
14
+ children: [ticks.map((tick) => /* @__PURE__ */ jsxs("g", {
15
+ transform: `translate(0, ${scale(tick)})`,
16
+ children: [showGrid && /* @__PURE__ */ jsx(ChartGridLine, {
17
+ x1: -12,
18
+ x2: plotWidth + 12,
19
+ y1: 0,
20
+ y2: 0
21
+ }), labelWidth > 0 && /* @__PURE__ */ jsx(ChartAxisLabelBox, {
22
+ x: -marginLeft + titleBand,
23
+ y: -20 / 2,
24
+ width: labelWidth,
25
+ height: 20,
26
+ children: /* @__PURE__ */ jsx(FlexWrapper, {
27
+ justifyContent: JustifyContent.END,
28
+ alignItems: AlignItems.CENTER,
29
+ fillWidth: true,
30
+ fillHeight: true,
31
+ children: /* @__PURE__ */ jsx(Text, {
32
+ size: TextSize.CAPTION,
33
+ variant: TextVariant.TERTIARY,
34
+ align: "right",
35
+ isEllipsis: true,
36
+ children: formatter(tick)
37
+ })
38
+ })
39
+ })]
40
+ }, tick)), title && /* @__PURE__ */ jsx("g", {
41
+ transform: `translate(${-marginLeft + 18 / 2}, ${plotHeight / 2}) rotate(-90)`,
42
+ children: /* @__PURE__ */ jsx(ChartAxisLabelBox, {
43
+ x: -plotHeight / 2,
44
+ y: -18 / 2,
45
+ width: plotHeight,
46
+ height: 18,
16
47
  children: /* @__PURE__ */ jsx(FlexWrapper, {
17
48
  justifyContent: JustifyContent.CENTER,
18
49
  alignItems: AlignItems.CENTER,
@@ -22,22 +53,28 @@ var XAxis = ({ scale, transform, formatter = defaultLabelFormatter }) => {
22
53
  size: TextSize.CAPTION,
23
54
  variant: TextVariant.TERTIARY,
24
55
  align: "center",
25
- children: formatter(label)
56
+ isEllipsis: true,
57
+ children: title
26
58
  })
27
59
  })
28
- }, label);
29
- })
60
+ })
61
+ })]
30
62
  });
31
63
  };
32
- var XAxisPoint = ({ scale, transform, formatter = defaultLabelFormatter }) => {
33
- const step = scale.step();
34
- return /* @__PURE__ */ jsx("g", {
35
- transform,
36
- children: scale.domain().map((label) => {
37
- return /* @__PURE__ */ jsx("foreignObject", {
38
- x: (scale(label) ?? 0) - step / 2,
64
+ var ChartCategoryAxis = ({ labels, positions, step, plotWidth, plotHeight, formatter, mode = ChartCategoryLabelMode.AUTO, title }) => {
65
+ const formatted = labels.map(formatter);
66
+ const stride = mode === ChartCategoryLabelMode.AUTO ? getCategoryLabelStride(formatted, step) : 1;
67
+ const labelWidth = step * stride;
68
+ const labelInset = (labelWidth - step) / 2;
69
+ return /* @__PURE__ */ jsxs("g", {
70
+ transform: `translate(0, ${plotHeight})`,
71
+ "aria-hidden": true,
72
+ children: [formatted.map((label, index) => {
73
+ if (index % stride !== 0) return null;
74
+ return /* @__PURE__ */ jsx(ChartAxisLabelBox, {
75
+ x: positions[index] - labelInset,
39
76
  y: 8,
40
- width: step,
77
+ width: labelWidth,
41
78
  height: 24,
42
79
  children: /* @__PURE__ */ jsx(FlexWrapper, {
43
80
  justifyContent: JustifyContent.CENTER,
@@ -48,47 +85,31 @@ var XAxisPoint = ({ scale, transform, formatter = defaultLabelFormatter }) => {
48
85
  size: TextSize.CAPTION,
49
86
  variant: TextVariant.TERTIARY,
50
87
  align: "center",
51
- children: formatter(label)
88
+ isEllipsis: mode !== ChartCategoryLabelMode.ALL,
89
+ children: label
52
90
  })
53
91
  })
54
- }, label);
55
- })
56
- });
57
- };
58
- var YAxis = ({ scale, transform, plotWidth, tickCount = 5, formatter = defaultValueFormatter, showGrid = true, theme }) => {
59
- return /* @__PURE__ */ jsx("g", {
60
- transform,
61
- children: scale.ticks(tickCount).map((tick) => {
62
- return /* @__PURE__ */ jsxs("g", {
63
- transform: `translate(0, ${scale(tick)})`,
64
- children: [/* @__PURE__ */ jsx("foreignObject", {
65
- x: -48,
66
- y: -10,
67
- width: 36,
68
- height: 20,
69
- children: /* @__PURE__ */ jsx(FlexWrapper, {
70
- justifyContent: JustifyContent.END,
71
- alignItems: AlignItems.CENTER,
72
- fillWidth: true,
73
- fillHeight: true,
74
- children: /* @__PURE__ */ jsx(Text, {
75
- size: TextSize.CAPTION,
76
- variant: TextVariant.TERTIARY,
77
- children: formatter(tick)
78
- })
79
- })
80
- }), showGrid && /* @__PURE__ */ jsx("line", {
81
- x1: 0,
82
- x2: plotWidth,
83
- y1: 0,
84
- y2: 0,
85
- stroke: theme.color.border.primary,
86
- strokeOpacity: .5,
87
- strokeDasharray: "2,2"
88
- })]
89
- }, tick);
90
- })
92
+ }, `${index}:${label}`);
93
+ }), title && /* @__PURE__ */ jsx(ChartAxisLabelBox, {
94
+ x: 0,
95
+ y: 32,
96
+ width: plotWidth,
97
+ height: 18,
98
+ children: /* @__PURE__ */ jsx(FlexWrapper, {
99
+ justifyContent: JustifyContent.CENTER,
100
+ alignItems: AlignItems.CENTER,
101
+ fillWidth: true,
102
+ fillHeight: true,
103
+ children: /* @__PURE__ */ jsx(Text, {
104
+ size: TextSize.CAPTION,
105
+ variant: TextVariant.TERTIARY,
106
+ align: "center",
107
+ isEllipsis: true,
108
+ children: title
109
+ })
110
+ })
111
+ })]
91
112
  });
92
113
  };
93
114
  //#endregion
94
- export { XAxis, XAxisPoint, YAxis };
115
+ export { ChartCategoryAxis, ChartValueAxis };
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from "react";
2
+ interface ChartEmptyStateProps {
3
+ /** Caller-supplied content. Falls back to a centred "No data". */
4
+ content?: ReactNode;
5
+ }
6
+ /**
7
+ * Overlay shown when a chart has nothing to plot.
8
+ *
9
+ * Rendered over the reserved plot box rather than in place of it, so the axes
10
+ * stay at full size and the chart does not resize when data arrives.
11
+ *
12
+ * What counts as empty is each chart's own call and deliberately inconsistent:
13
+ * a bar chart of all zeros is a flat chart with real data, while a pie of all
14
+ * zeros has no whole to apportion.
15
+ */
16
+ declare const ChartEmptyState: ({ content }: ChartEmptyStateProps) => import("react").JSX.Element;
17
+ export default ChartEmptyState;
@@ -0,0 +1,29 @@
1
+ import Text, { TextSize, TextVariant } from "../text/Text.js";
2
+ import FlexWrapper, { AlignItems, JustifyContent } from "../containers/FlexWrapper.js";
3
+ import { ChartEmptyOverlay } from "./ChartPrimitives.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/charts/ChartEmptyState.tsx
6
+ /**
7
+ * Overlay shown when a chart has nothing to plot.
8
+ *
9
+ * Rendered over the reserved plot box rather than in place of it, so the axes
10
+ * stay at full size and the chart does not resize when data arrives.
11
+ *
12
+ * What counts as empty is each chart's own call and deliberately inconsistent:
13
+ * a bar chart of all zeros is a flat chart with real data, while a pie of all
14
+ * zeros has no whole to apportion.
15
+ */
16
+ var ChartEmptyState = ({ content }) => /* @__PURE__ */ jsx(ChartEmptyOverlay, {
17
+ role: "status",
18
+ children: content ?? /* @__PURE__ */ jsx(FlexWrapper, {
19
+ justifyContent: JustifyContent.CENTER,
20
+ alignItems: AlignItems.CENTER,
21
+ children: /* @__PURE__ */ jsx(Text, {
22
+ size: TextSize.CAPTION,
23
+ variant: TextVariant.TERTIARY,
24
+ children: "No data"
25
+ })
26
+ })
27
+ });
28
+ //#endregion
29
+ export { ChartEmptyState as default };
@@ -0,0 +1,82 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ChartLegendItem, ChartPlotTooltipModel, ChartTooltipRenderer } from "./types";
3
+ import type { ChartDimensions } from "./useChartDimensions";
4
+ import type { ChartInteraction } from "./useChartInteraction";
5
+ import type { ChartTooltipVerticalAlign } from "./useChartTooltipPosition";
6
+ /**
7
+ * The shell every chart renders into: measured root, reserved plot box, SVG and
8
+ * its margin translate, the interactive plot group, the backdrop, the tooltip,
9
+ * the empty state and the legend.
10
+ *
11
+ * **The frame owns the plot translate.** Marks are drawn inside a
12
+ * `translate(margin.left, margin.top)` group, and every coordinate handed to
13
+ * this component — including the tooltip anchor and `placeAwayFromX` — is in
14
+ * that same plot space. Charts never add the margin themselves; three
15
+ * hand-written copies of `+ margin.left` is precisely what drifts silently.
16
+ *
17
+ * Knows nothing about scales, marks or geometry — all of that arrives through
18
+ * `axes` and `children`.
19
+ *
20
+ * @internal Published as a subpath only because this package has no barrel
21
+ * files, not because charts are meant to be composed out of it.
22
+ */
23
+ export interface ChartFrameProps {
24
+ /**
25
+ * The element `useChartDimensions` measures — the *plot box*, not the root.
26
+ *
27
+ * Measuring the plot box is what keeps `fillHeight` honest: the legend is a
28
+ * sibling in the root's flex column, so the box's height is already the space
29
+ * left over for the plot and no one has to subtract a wrapped legend. Width is
30
+ * unaffected, the box being `width: 100%` of the root either way.
31
+ *
32
+ * Created by the chart, not here: the chart needs the resulting dimensions
33
+ * during its own render — to size the geometry and to feed
34
+ * `useChartInteraction` — so the ref has to exist before this component does.
35
+ * A named prop rather than `ref` because ref-as-a-prop needs React 19 and this
36
+ * package still supports 18.
37
+ */
38
+ containerRef: React.RefObject<HTMLDivElement>;
39
+ dimensions: ChartDimensions;
40
+ fillWidth?: boolean;
41
+ fillHeight?: boolean;
42
+ interaction: ChartInteraction;
43
+ /** Already resolved — pass `ariaLabel ?? <chart-specific default>`. */
44
+ ariaLabel: string;
45
+ /** Long description, associated with the SVG via `aria-describedby`. */
46
+ ariaDescription?: string;
47
+ /**
48
+ * Axes, drawn inside the plot translate group *before* {@link children}, so
49
+ * grid lines paint under the marks. Radial charts pass nothing.
50
+ */
51
+ axes?: ReactNode;
52
+ /**
53
+ * Marks, drawn inside the plot group above the backdrop.
54
+ *
55
+ * Rendered only once measured, so no caller writes that guard. Note it is
56
+ * still *evaluated* on the unmeasured pass — as is the geometry it maps over,
57
+ * which each chart's `useMemo` already runs at a 0×0 plot. Geometry builders
58
+ * must stay total at zero; they already are.
59
+ */
60
+ children?: ReactNode;
61
+ /** HTML painted over the plot and under the tooltip — the donut centre. */
62
+ plotOverlay?: ReactNode;
63
+ noTooltip?: boolean;
64
+ /** Anchor in plot coordinates; the frame applies the margin translate. */
65
+ tooltipModel: ChartPlotTooltipModel | null;
66
+ tooltipRenderer?: ChartTooltipRenderer;
67
+ /** Half a category's width, so the tooltip sits beside the marks. */
68
+ anchorHalfWidth?: number;
69
+ /** Radial charts pass their centre, in plot coordinates. */
70
+ placeAwayFromX?: number;
71
+ verticalAlign?: ChartTooltipVerticalAlign;
72
+ /** Each chart defines "empty" for itself; the frame only renders the result. */
73
+ isEmpty: boolean;
74
+ isLoading?: boolean;
75
+ contentWhenEmpty?: ReactNode;
76
+ showLegend?: boolean;
77
+ legendItems: ChartLegendItem[];
78
+ /** Defaults to the left margin, aligning the legend with the plot, not the gutter. */
79
+ legendInset?: number;
80
+ }
81
+ declare const ChartFrame: ({ containerRef, dimensions, fillWidth, fillHeight, interaction, ariaLabel, ariaDescription, axes, children, plotOverlay, noTooltip, tooltipModel, tooltipRenderer, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading, contentWhenEmpty, showLegend, legendItems, legendInset, }: ChartFrameProps) => import("react").JSX.Element;
82
+ export default ChartFrame;
@@ -0,0 +1,86 @@
1
+ import { ChartBackdrop, ChartPlotBox, ChartPlotGroup, ChartRoot, ChartSvg } from "./ChartPrimitives.js";
2
+ import ChartEmptyState from "./ChartEmptyState.js";
3
+ import ChartLegend from "./ChartLegend.js";
4
+ import ChartHoverTooltip from "./ChartTooltip.js";
5
+ import { useId, useMemo } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/charts/ChartFrame.tsx
8
+ var ChartFrame = ({ containerRef, dimensions, fillWidth, fillHeight, interaction, ariaLabel, ariaDescription, axes, children, plotOverlay, noTooltip = false, tooltipModel, tooltipRenderer, anchorHalfWidth, placeAwayFromX, verticalAlign, isEmpty, isLoading = false, contentWhenEmpty, showLegend = false, legendItems, legendInset }) => {
9
+ const { width, height, plotWidth, plotHeight, margin, isMeasured, reservedHeight, reservedAspectRatio } = dimensions;
10
+ const generatedId = useId();
11
+ const descriptionId = ariaDescription ? `${generatedId}-desc` : void 0;
12
+ /**
13
+ * Plot space → container space, applied once, here.
14
+ *
15
+ * Memoized for correctness, not arithmetic cost. `ChartTooltip` retains the
16
+ * last model by *identity* so it can keep its content while fading out, and
17
+ * adjusts that state during render when the identity changes. A fresh object
18
+ * on every parent render would therefore trigger an extra render pass on
19
+ * every render — including every pointer move — without ever looping or
20
+ * visibly breaking.
21
+ */
22
+ const positionedTooltip = useMemo(() => tooltipModel === null ? null : {
23
+ ...tooltipModel,
24
+ anchorX: tooltipModel.anchorX + margin.left,
25
+ anchorY: tooltipModel.anchorY + margin.top
26
+ }, [
27
+ tooltipModel,
28
+ margin.left,
29
+ margin.top
30
+ ]);
31
+ return /* @__PURE__ */ jsxs(ChartRoot, {
32
+ $fillWidth: fillWidth,
33
+ $fillHeight: fillHeight,
34
+ children: [/* @__PURE__ */ jsxs(ChartPlotBox, {
35
+ ref: containerRef,
36
+ $reservedHeight: reservedHeight,
37
+ $reservedAspectRatio: reservedAspectRatio,
38
+ $fillHeight: fillHeight,
39
+ children: [
40
+ isMeasured && /* @__PURE__ */ jsxs(ChartSvg, {
41
+ width,
42
+ height,
43
+ role: "img",
44
+ "aria-label": ariaLabel,
45
+ "aria-describedby": descriptionId,
46
+ children: [ariaDescription && /* @__PURE__ */ jsx("desc", {
47
+ id: descriptionId,
48
+ children: ariaDescription
49
+ }), /* @__PURE__ */ jsxs("g", {
50
+ transform: `translate(${margin.left}, ${margin.top})`,
51
+ children: [axes, /* @__PURE__ */ jsxs(ChartPlotGroup, {
52
+ "data-active": interaction.isEngaged ? "true" : "false",
53
+ children: [/* @__PURE__ */ jsx(ChartBackdrop, {
54
+ width: plotWidth,
55
+ height: plotHeight,
56
+ "data-interactive": interaction.pinnedIndex !== null ? "true" : "false",
57
+ onClick: interaction.onBackdropClick
58
+ }), children]
59
+ })]
60
+ })]
61
+ }),
62
+ isMeasured && plotOverlay,
63
+ isMeasured && !noTooltip && /* @__PURE__ */ jsx(ChartHoverTooltip, {
64
+ model: positionedTooltip,
65
+ containerWidth: width,
66
+ containerHeight: height,
67
+ anchorHalfWidth,
68
+ placeAwayFromX: placeAwayFromX === void 0 ? void 0 : placeAwayFromX + margin.left,
69
+ verticalAlign,
70
+ renderer: tooltipRenderer
71
+ }),
72
+ isMeasured && isEmpty && !isLoading && /* @__PURE__ */ jsx(ChartEmptyState, { content: contentWhenEmpty })
73
+ ]
74
+ }), showLegend && /* @__PURE__ */ jsx(ChartLegend, {
75
+ items: legendItems,
76
+ inset: legendInset ?? margin.left,
77
+ hoveredKey: interaction.hoveredSeriesKey,
78
+ pinnedKey: interaction.pinnedSeriesKey,
79
+ onItemEnter: interaction.onSeriesEnter,
80
+ onItemLeave: interaction.onSeriesLeave,
81
+ onItemClick: interaction.onSeriesClick
82
+ })]
83
+ });
84
+ };
85
+ //#endregion
86
+ export { ChartFrame as default };
@@ -1,7 +1,30 @@
1
- import type { ChartSeriesConfig } from "./types";
1
+ import type { ChartLegendItem } from "./types";
2
2
  interface ChartLegendProps {
3
- series: ChartSeriesConfig[];
4
- palette: string[];
3
+ items: ChartLegendItem[];
4
+ /** Left padding aligning the legend with the plot, not the axis gutter. */
5
+ inset: number;
6
+ /** Series key currently hovered anywhere in the chart. */
7
+ hoveredKey?: string | null;
8
+ /** Series key currently pinned. Drives `aria-pressed`. */
9
+ pinnedKey?: string | null;
10
+ /**
11
+ * Supplying these makes the legend interactive. Omit them and it renders as
12
+ * inert text, with no button semantics for a screen reader to announce.
13
+ */
14
+ onItemEnter?: (key: string) => void;
15
+ onItemLeave?: () => void;
16
+ onItemClick?: (key: string) => void;
5
17
  }
6
- declare const ChartLegend: ({ series, palette }: ChartLegendProps) => import("react").JSX.Element;
18
+ /**
19
+ * Legend for the chart components.
20
+ *
21
+ * Hovering an entry isolates its series and clicking pins that isolation.
22
+ *
23
+ * Deliberately *not* a visibility toggle: hiding a series would have to rescale
24
+ * the value axis to stay honest — otherwise the remaining bars sit mysteriously
25
+ * short — and that belongs with the geometry layer rather than bolted on here.
26
+ * Isolation only changes opacity, so the domain is untouched and the numbers
27
+ * keep meaning what they did.
28
+ */
29
+ declare const ChartLegend: ({ items, inset, hoveredKey, pinnedKey, onItemEnter, onItemLeave, onItemClick, }: ChartLegendProps) => import("react").JSX.Element | null;
7
30
  export default ChartLegend;
@@ -1,28 +1,51 @@
1
- import Text, { TextSize, TextVariant } from "../text/Text.js";
2
- import FlexWrapper, { AlignItems, FlexDirection } from "../containers/FlexWrapper.js";
1
+ import Text, { TextSize } from "../text/Text.js";
3
2
  import Circle from "../shapes/Circle.js";
4
- import { resolveSeriesColor } from "./utils.js";
5
- import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { ChartMarkState } from "./types.js";
4
+ import { ChartLegendItemButton, ChartLegendItemStatic, ChartLegendRow } from "./ChartPrimitives.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/charts/ChartLegend.tsx
7
- var ChartLegend = ({ series, palette }) => {
8
- return /* @__PURE__ */ jsx(FlexWrapper, {
9
- direction: FlexDirection.ROW,
10
- alignItems: AlignItems.CENTER,
11
- gap: 16,
12
- children: series.map((s, i) => {
13
- const color = resolveSeriesColor(s, i, palette);
14
- return /* @__PURE__ */ jsxs(FlexWrapper, {
15
- alignItems: AlignItems.CENTER,
16
- gap: 6,
17
- children: [/* @__PURE__ */ jsx(Circle, {
18
- size: 8,
19
- hex: color
20
- }), /* @__PURE__ */ jsx(Text, {
21
- size: TextSize.CAPTION,
22
- variant: TextVariant.TERTIARY,
23
- children: s.name
24
- })]
25
- }, s.key);
7
+ /**
8
+ * Legend for the chart components.
9
+ *
10
+ * Hovering an entry isolates its series and clicking pins that isolation.
11
+ *
12
+ * Deliberately *not* a visibility toggle: hiding a series would have to rescale
13
+ * the value axis to stay honest — otherwise the remaining bars sit mysteriously
14
+ * short and that belongs with the geometry layer rather than bolted on here.
15
+ * Isolation only changes opacity, so the domain is untouched and the numbers
16
+ * keep meaning what they did.
17
+ */
18
+ var ChartLegend = ({ items, inset, hoveredKey = null, pinnedKey = null, onItemEnter, onItemLeave, onItemClick }) => {
19
+ if (items.length === 0) return null;
20
+ const isInteractive = Boolean(onItemEnter ?? onItemClick);
21
+ const activeKey = pinnedKey ?? hoveredKey;
22
+ return /* @__PURE__ */ jsx(ChartLegendRow, {
23
+ $inset: inset,
24
+ "data-active": activeKey !== null ? "true" : "false",
25
+ children: items.map((item) => {
26
+ const state = activeKey === null || item.key === activeKey ? ChartMarkState.ACTIVE : ChartMarkState.MUTED;
27
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Circle, {
28
+ size: 8,
29
+ hex: item.color
30
+ }), /* @__PURE__ */ jsx(Text, {
31
+ size: TextSize.BODY_SM,
32
+ children: item.label
33
+ })] });
34
+ if (!isInteractive) return /* @__PURE__ */ jsx(ChartLegendItemStatic, {
35
+ "data-state": state,
36
+ children: content
37
+ }, item.key);
38
+ return /* @__PURE__ */ jsx(ChartLegendItemButton, {
39
+ type: "button",
40
+ "data-state": state,
41
+ "aria-pressed": pinnedKey === item.key,
42
+ onMouseEnter: () => onItemEnter?.(item.key),
43
+ onMouseLeave: () => onItemLeave?.(),
44
+ onFocus: () => onItemEnter?.(item.key),
45
+ onBlur: () => onItemLeave?.(),
46
+ onClick: () => onItemClick?.(item.key),
47
+ children: content
48
+ }, item.key);
26
49
  })
27
50
  });
28
51
  };