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