@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/BarChart.js
CHANGED
|
@@ -1,264 +1,194 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
import { styled } from "@linaria/react";
|
|
13
|
-
import { useCallback, useMemo, useRef, useState } from "react";
|
|
14
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { BarChartNormalization, ChartKind, ChartTargetShape } from "./types.js";
|
|
2
|
+
import { useSeriesColorResolver } from "./useSeriesColorResolver.js";
|
|
3
|
+
import { useChartInteraction } from "./useChartInteraction.js";
|
|
4
|
+
import { useCartesianChartLayout } from "./useCartesianChartLayout.js";
|
|
5
|
+
import { getBarLegendItems } from "./barChartLegend.js";
|
|
6
|
+
import { buildBarChartGeometry, getBarValueDomain, roundedRectPath } from "./barChartGeometry.js";
|
|
7
|
+
import { ChartBarPath } 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/BarChart.tsx
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var
|
|
24
|
-
name: "ChartWrapper",
|
|
25
|
-
class: "c16zjhoz",
|
|
26
|
-
propsAsIs: false,
|
|
27
|
-
vars: {
|
|
28
|
-
"c16zjhoz-0": [_exp()],
|
|
29
|
-
"c16zjhoz-1": [_exp2()]
|
|
30
|
-
}
|
|
31
|
-
}));
|
|
32
|
-
var BarChart = ({ data, series, width, height, margin: marginOverride, fillWidth = false, aspectRatio, mode = "STACKED", barRadius = 4, barPaddingInner = DEFAULT_BAR_PADDING_INNER, barPaddingOuter = DEFAULT_BAR_PADDING_OUTER, valueFormatter = defaultValueFormatter, labelFormatter = defaultLabelFormatter, tooltipRenderer, noTooltip = false, showLegend = true, showValues = false, showGrid = true, ariaLabel }) => {
|
|
33
|
-
const { theme } = useGalaxyTheme();
|
|
13
|
+
/**
|
|
14
|
+
* Bar chart with a three-level data model.
|
|
15
|
+
*
|
|
16
|
+
* Grouping and stacking are properties of the data rather than a mode: several
|
|
17
|
+
* `bars` in a group render side by side, several `components` in a bar stack,
|
|
18
|
+
* and a chart doing both at once needs no extra configuration.
|
|
19
|
+
*/
|
|
20
|
+
var BarChart = ({ series, groups, width, height, fillWidth, fillHeight, aspectRatio, margin, normalization = BarChartNormalization.NONE, valueUnit, valueFormatter, labelFormatter, valueDomain, categoryLabelMode, categoryAxisTitle, valueAxisTitle, showGrid = true, showLegend = true, noTooltip = false, tooltipRenderer, isLoading = false, contentWhenEmpty, ariaLabel, ariaDescription, onPinnedChange }) => {
|
|
34
21
|
const containerRef = useRef(null);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
22
|
+
const colors = useSeriesColorResolver(series);
|
|
23
|
+
/**
|
|
24
|
+
* Axis-only formatting for a percent-normalized chart.
|
|
25
|
+
*
|
|
26
|
+
* Normalization rescales the *axis* into 0–1, so the caller's formatter —
|
|
27
|
+
* which describes their real units — would label it `0.2`, `0.4`. Unless they
|
|
28
|
+
* asked for something specific, show shares as percentages.
|
|
29
|
+
*
|
|
30
|
+
* Deliberately not used for the tooltip. `stackComponents` normalizes each
|
|
31
|
+
* segment's extent but leaves its `value` raw, so a tooltip row still carries
|
|
32
|
+
* the real number: the axis reports the share, the tooltip reports what the
|
|
33
|
+
* share is made of. Running a row through this would multiply a raw 200 into
|
|
34
|
+
* `20000%`.
|
|
35
|
+
*/
|
|
36
|
+
const deriveAxisFormatter = useCallback((formatValue) => {
|
|
37
|
+
if (normalization !== BarChartNormalization.PERCENT) return formatValue;
|
|
38
|
+
if (valueFormatter || valueUnit) return formatValue;
|
|
39
|
+
return (value) => `${Math.round(value * 100)}%`;
|
|
40
|
+
}, [
|
|
41
|
+
normalization,
|
|
42
|
+
valueFormatter,
|
|
43
|
+
valueUnit
|
|
47
44
|
]);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
const { dimensions, domain, valueTicks, formatValue, formatLabel, formatAxisValue } = useCartesianChartLayout({
|
|
46
|
+
containerRef,
|
|
47
|
+
rawDomain: useMemo(() => getBarValueDomain(groups, normalization), [groups, normalization]),
|
|
48
|
+
valueDomain,
|
|
49
|
+
width,
|
|
50
|
+
height,
|
|
51
|
+
fillWidth,
|
|
52
|
+
fillHeight,
|
|
53
|
+
aspectRatio,
|
|
54
|
+
margin,
|
|
55
|
+
valueUnit,
|
|
56
|
+
valueFormatter,
|
|
57
|
+
labelFormatter,
|
|
58
|
+
deriveAxisFormatter,
|
|
59
|
+
valueAxisTitle,
|
|
60
|
+
categoryAxisTitle
|
|
61
|
+
});
|
|
62
|
+
const { plotWidth, plotHeight } = dimensions;
|
|
63
|
+
/**
|
|
64
|
+
* True when any bar carries more than one component.
|
|
65
|
+
*
|
|
66
|
+
* This is what decides the colour grammar. In a stacked chart the segments
|
|
67
|
+
* are the thing being compared, so they take the palette and every stack
|
|
68
|
+
* repeats the same ramp; in an unstacked one the metrics are, so each bar
|
|
69
|
+
* takes its metric's colour. Applying the metric colour to a stack would
|
|
70
|
+
* paint every segment identically.
|
|
71
|
+
*/
|
|
72
|
+
const isStacked = useMemo(() => groups.some((group) => group.bars.some((bar) => bar.components.length > 1)), [groups]);
|
|
73
|
+
const resolveColor = useCallback(({ metric, componentIndex, isStacked: barIsStacked, explicit }) => barIsStacked ? colors.resolveByIndex(componentIndex, explicit) : colors.resolve(metric, explicit), [colors]);
|
|
74
|
+
const geometry = useMemo(() => buildBarChartGeometry({
|
|
75
|
+
groups,
|
|
52
76
|
plotWidth,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
mode,
|
|
67
|
-
seriesKeys,
|
|
68
|
-
xScale
|
|
77
|
+
plotHeight,
|
|
78
|
+
normalization,
|
|
79
|
+
isStacked,
|
|
80
|
+
domain,
|
|
81
|
+
resolveColor
|
|
82
|
+
}), [
|
|
83
|
+
groups,
|
|
84
|
+
plotWidth,
|
|
85
|
+
plotHeight,
|
|
86
|
+
normalization,
|
|
87
|
+
isStacked,
|
|
88
|
+
domain,
|
|
89
|
+
resolveColor
|
|
69
90
|
]);
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
seriesName: s.name,
|
|
79
|
-
value: datum.values[s.key] ?? 0,
|
|
80
|
-
color: resolveSeriesColor(s, i, palette)
|
|
81
|
-
})),
|
|
82
|
-
x: x + margin.left,
|
|
83
|
-
y: y + margin.top
|
|
84
|
-
});
|
|
85
|
-
}, [
|
|
86
|
-
data,
|
|
91
|
+
const isEmpty = groups.length === 0;
|
|
92
|
+
const legendItems = useMemo(() => getBarLegendItems({
|
|
93
|
+
isStacked,
|
|
94
|
+
series,
|
|
95
|
+
groups,
|
|
96
|
+
colors
|
|
97
|
+
}), [
|
|
98
|
+
isStacked,
|
|
87
99
|
series,
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
groups,
|
|
101
|
+
colors
|
|
90
102
|
]);
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const handleBarBlur = useCallback(() => {
|
|
99
|
-
handleBarMouseLeave();
|
|
100
|
-
}, [handleBarMouseLeave]);
|
|
101
|
-
if (resolvedWidth === 0 || resolvedHeight === 0) return /* @__PURE__ */ jsx(ChartWrapper, {
|
|
102
|
-
ref: containerRef,
|
|
103
|
-
$fillWidth: fillWidth
|
|
103
|
+
const legendKeys = useMemo(() => legendItems.map((item) => item.key), [legendItems]);
|
|
104
|
+
const interaction = useChartInteraction({
|
|
105
|
+
categoryCount: geometry.bands.length,
|
|
106
|
+
seriesKeys: legendKeys,
|
|
107
|
+
disabled: noTooltip || isLoading || isEmpty,
|
|
108
|
+
isLoading,
|
|
109
|
+
onPinnedChange
|
|
104
110
|
});
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
})
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
fill: color,
|
|
186
|
-
opacity: isDimmed ? .3 : 1,
|
|
187
|
-
style: { transition: `opacity 150ms ease-in-out` },
|
|
188
|
-
onMouseEnter: () => handleBarMouseEnter(datumIndex, groupX + barX + barWidth / 2, barY),
|
|
189
|
-
onMouseLeave: handleBarMouseLeave,
|
|
190
|
-
onFocus: () => handleBarFocus(datumIndex, groupX + barX + barWidth / 2, barY),
|
|
191
|
-
onBlur: handleBarBlur,
|
|
192
|
-
tabIndex: 0,
|
|
193
|
-
role: "graphics-symbol",
|
|
194
|
-
"aria-roledescription": "bar",
|
|
195
|
-
"aria-label": `${s.name} for ${datum.label}: ${valueFormatter(value)}`
|
|
196
|
-
}), showValues && /* @__PURE__ */ jsx("foreignObject", {
|
|
197
|
-
x: barX,
|
|
198
|
-
y: barY - 20,
|
|
199
|
-
width: barWidth,
|
|
200
|
-
height: 20,
|
|
201
|
-
children: /* @__PURE__ */ jsx(FlexWrapper, {
|
|
202
|
-
justifyContent: JustifyContent.CENTER,
|
|
203
|
-
alignItems: AlignItems.END,
|
|
204
|
-
fillWidth: true,
|
|
205
|
-
fillHeight: true,
|
|
206
|
-
children: /* @__PURE__ */ jsx(Text, {
|
|
207
|
-
size: TextSize.CAPTION,
|
|
208
|
-
weight: TextWeight.MEDIUM,
|
|
209
|
-
children: valueFormatter(value)
|
|
210
|
-
})
|
|
211
|
-
})
|
|
212
|
-
})] }, s.key);
|
|
213
|
-
})
|
|
214
|
-
}, datum.label);
|
|
215
|
-
});
|
|
216
|
-
};
|
|
217
|
-
const defaultAriaLabel = `Bar chart with ${data.length} categories and ${series.length} series`;
|
|
218
|
-
return /* @__PURE__ */ jsxs(ChartWrapper, {
|
|
219
|
-
ref: containerRef,
|
|
220
|
-
$fillWidth: fillWidth,
|
|
221
|
-
children: [/* @__PURE__ */ jsxs(Wrapper, {
|
|
222
|
-
position: "relative",
|
|
223
|
-
children: [/* @__PURE__ */ jsx("svg", {
|
|
224
|
-
ref: svgRef,
|
|
225
|
-
width: resolvedWidth,
|
|
226
|
-
height: resolvedHeight,
|
|
227
|
-
role: "img",
|
|
228
|
-
"aria-label": ariaLabel ?? defaultAriaLabel,
|
|
229
|
-
children: /* @__PURE__ */ jsxs("g", {
|
|
230
|
-
transform: `translate(${margin.left}, ${margin.top})`,
|
|
231
|
-
children: [
|
|
232
|
-
/* @__PURE__ */ jsx(YAxis, {
|
|
233
|
-
scale: yScale,
|
|
234
|
-
transform: "translate(0, 0)",
|
|
235
|
-
plotWidth,
|
|
236
|
-
formatter: valueFormatter,
|
|
237
|
-
showGrid,
|
|
238
|
-
theme
|
|
239
|
-
}),
|
|
240
|
-
/* @__PURE__ */ jsx(XAxis, {
|
|
241
|
-
scale: xScale,
|
|
242
|
-
transform: `translate(0, ${plotHeight})`,
|
|
243
|
-
plotWidth,
|
|
244
|
-
formatter: labelFormatter
|
|
245
|
-
}),
|
|
246
|
-
mode === "STACKED" ? renderStackedBars() : renderGroupedBars()
|
|
247
|
-
]
|
|
248
|
-
})
|
|
249
|
-
}), !noTooltip && (tooltipRenderer ? tooltip && tooltipRenderer(tooltip) : /* @__PURE__ */ jsx(ChartTooltip, {
|
|
250
|
-
data: tooltip,
|
|
251
|
-
valueFormatter
|
|
252
|
-
}))]
|
|
253
|
-
}), showLegend && /* @__PURE__ */ jsxs(FlexWrapper, {
|
|
254
|
-
direction: FlexDirection.ROW,
|
|
255
|
-
gap: 0,
|
|
256
|
-
children: [/* @__PURE__ */ jsx(Wrapper, { minWidth: margin.left }), /* @__PURE__ */ jsx(ChartLegend, {
|
|
257
|
-
series,
|
|
258
|
-
palette
|
|
259
|
-
})]
|
|
260
|
-
})]
|
|
111
|
+
const buildCategoryTooltip = useCallback((index) => {
|
|
112
|
+
const band = geometry.bands[index];
|
|
113
|
+
const group = groups[index];
|
|
114
|
+
if (!band || !group) return null;
|
|
115
|
+
const rows = geometry.rects.filter((rect) => rect.groupIndex === index).map((rect) => ({
|
|
116
|
+
key: rect.id,
|
|
117
|
+
label: rect.label,
|
|
118
|
+
value: rect.value,
|
|
119
|
+
formattedValue: formatValue(rect.value),
|
|
120
|
+
color: rect.color
|
|
121
|
+
}));
|
|
122
|
+
return {
|
|
123
|
+
label: formatLabel(group.label),
|
|
124
|
+
rows,
|
|
125
|
+
anchorX: band.anchorX,
|
|
126
|
+
anchorY: band.anchorY
|
|
127
|
+
};
|
|
128
|
+
}, [
|
|
129
|
+
geometry,
|
|
130
|
+
groups,
|
|
131
|
+
formatValue,
|
|
132
|
+
formatLabel
|
|
133
|
+
]);
|
|
134
|
+
const categoryPositions = useMemo(() => geometry.bands.map((band) => band.x), [geometry.bands]);
|
|
135
|
+
const categoryStep = geometry.bands[0]?.width ?? 0;
|
|
136
|
+
const categoryTargets = useMemo(() => geometry.bands.map((band) => ({
|
|
137
|
+
key: String(band.groupIndex),
|
|
138
|
+
shape: ChartTargetShape.RECT,
|
|
139
|
+
x: band.x,
|
|
140
|
+
y: band.y,
|
|
141
|
+
width: band.width,
|
|
142
|
+
height: band.height
|
|
143
|
+
})), [geometry.bands]);
|
|
144
|
+
return /* @__PURE__ */ jsx(ChartFrame, {
|
|
145
|
+
containerRef,
|
|
146
|
+
dimensions,
|
|
147
|
+
fillWidth,
|
|
148
|
+
fillHeight,
|
|
149
|
+
interaction,
|
|
150
|
+
kind: ChartKind.BAR,
|
|
151
|
+
categoryCount: groups.length,
|
|
152
|
+
ariaLabel,
|
|
153
|
+
ariaDescription,
|
|
154
|
+
axes: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ChartValueAxis, {
|
|
155
|
+
ticks: valueTicks,
|
|
156
|
+
scale: geometry.valueScale,
|
|
157
|
+
plotWidth,
|
|
158
|
+
plotHeight,
|
|
159
|
+
marginLeft: dimensions.margin.left,
|
|
160
|
+
formatter: formatAxisValue,
|
|
161
|
+
showGrid,
|
|
162
|
+
title: valueAxisTitle
|
|
163
|
+
}), /* @__PURE__ */ jsx(ChartCategoryAxis, {
|
|
164
|
+
labels: groups.map((group) => group.label),
|
|
165
|
+
positions: categoryPositions,
|
|
166
|
+
step: categoryStep,
|
|
167
|
+
plotWidth,
|
|
168
|
+
plotHeight,
|
|
169
|
+
formatter: formatLabel,
|
|
170
|
+
mode: categoryLabelMode,
|
|
171
|
+
title: categoryAxisTitle
|
|
172
|
+
})] }),
|
|
173
|
+
noTooltip,
|
|
174
|
+
buildCategoryTooltip,
|
|
175
|
+
tooltipRenderer,
|
|
176
|
+
categoryTargets,
|
|
177
|
+
anchorHalfWidth: categoryStep / 2,
|
|
178
|
+
isEmpty,
|
|
179
|
+
isLoading,
|
|
180
|
+
contentWhenEmpty,
|
|
181
|
+
showLegend,
|
|
182
|
+
legendItems,
|
|
183
|
+
children: geometry.rects.map((rect) => /* @__PURE__ */ jsx(ChartBarPath, {
|
|
184
|
+
d: roundedRectPath(rect.x, rect.y, rect.width, rect.height, rect.radius, rect.corners),
|
|
185
|
+
fill: rect.color,
|
|
186
|
+
"data-state": interaction.getMarkState({
|
|
187
|
+
categoryIndex: rect.groupIndex,
|
|
188
|
+
seriesKey: isStacked ? rect.componentKey : rect.metric
|
|
189
|
+
})
|
|
190
|
+
}, rect.id))
|
|
261
191
|
});
|
|
262
192
|
};
|
|
263
193
|
//#endregion
|
|
264
|
-
export {
|
|
194
|
+
export { BarChart as default };
|
|
@@ -1,28 +1,53 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Theme } from "../theme/types";
|
|
1
|
+
import { ChartCategoryLabelMode } from "./types";
|
|
3
2
|
import type { ChartLabelFormatter, ChartValueFormatter } from "./types";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Axes for the cartesian charts.
|
|
5
|
+
*
|
|
6
|
+
* Neither axis draws a domain line or tick marks — the grid lines carry the
|
|
7
|
+
* structure, and the one at zero is what makes bars read as resting on a
|
|
8
|
+
* baseline rather than floating.
|
|
9
|
+
*/
|
|
10
|
+
interface ChartValueAxisProps {
|
|
11
|
+
ticks: number[];
|
|
12
|
+
/** Maps a tick value to its y position in plot coordinates. */
|
|
13
|
+
scale: (value: number) => number;
|
|
7
14
|
plotWidth: number;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The chart's left margin. The label box is this minus the tick gap, so the
|
|
17
|
+
* axis follows the margin instead of hardcoding an offset — a custom margin
|
|
18
|
+
* used to push these labels outside the viewport.
|
|
19
|
+
*/
|
|
20
|
+
marginLeft: number;
|
|
21
|
+
/** Needed to centre a rotated axis title along the gutter. */
|
|
22
|
+
plotHeight: number;
|
|
23
|
+
formatter: ChartValueFormatter;
|
|
24
|
+
showGrid?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Rotated title in the left gutter.
|
|
27
|
+
*
|
|
28
|
+
* Space for it must already be reserved by `addAxisTitleSpace`, since the
|
|
29
|
+
* margin is resolved before this renders.
|
|
30
|
+
*/
|
|
31
|
+
title?: string;
|
|
16
32
|
}
|
|
17
|
-
export declare const
|
|
18
|
-
interface
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
export declare const ChartValueAxis: ({ ticks, scale, plotWidth, plotHeight, marginLeft, formatter, showGrid, title, }: ChartValueAxisProps) => import("react").JSX.Element;
|
|
34
|
+
interface ChartCategoryAxisProps {
|
|
35
|
+
labels: string[];
|
|
36
|
+
/** Left edge of each category's slot, in plot coordinates. */
|
|
37
|
+
positions: number[];
|
|
38
|
+
/** Width of one category slot. */
|
|
39
|
+
step: number;
|
|
40
|
+
/** Needed to span an axis title across the full plot. */
|
|
21
41
|
plotWidth: number;
|
|
22
|
-
|
|
23
|
-
formatter
|
|
24
|
-
|
|
25
|
-
|
|
42
|
+
plotHeight: number;
|
|
43
|
+
formatter: ChartLabelFormatter;
|
|
44
|
+
mode?: ChartCategoryLabelMode;
|
|
45
|
+
/**
|
|
46
|
+
* Title below the tick labels.
|
|
47
|
+
*
|
|
48
|
+
* Space for it must already be reserved by `addAxisTitleSpace`.
|
|
49
|
+
*/
|
|
50
|
+
title?: string;
|
|
26
51
|
}
|
|
27
|
-
export declare const
|
|
52
|
+
export declare const ChartCategoryAxis: ({ labels, positions, step, plotWidth, plotHeight, formatter, mode, title, }: ChartCategoryAxisProps) => import("react").JSX.Element;
|
|
28
53
|
export {};
|