@databricks/appkit-ui 0.0.2
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/CLAUDE.md +3 -0
- package/DCO +25 -0
- package/LICENSE +203 -0
- package/NOTICE.md +73 -0
- package/README.md +35 -0
- package/bin/setup-claude.js +190 -0
- package/dist/js/arrow/arrow-client.d.ts +64 -0
- package/dist/js/arrow/arrow-client.d.ts.map +1 -0
- package/dist/js/arrow/arrow-client.js +181 -0
- package/dist/js/arrow/arrow-client.js.map +1 -0
- package/dist/js/arrow/index.js +3 -0
- package/dist/js/arrow/lazy-arrow.d.ts +23 -0
- package/dist/js/arrow/lazy-arrow.d.ts.map +1 -0
- package/dist/js/arrow/lazy-arrow.js +86 -0
- package/dist/js/arrow/lazy-arrow.js.map +1 -0
- package/dist/js/constants.d.ts +10 -0
- package/dist/js/constants.d.ts.map +1 -0
- package/dist/js/constants.js +30 -0
- package/dist/js/constants.js.map +1 -0
- package/dist/js/index.d.ts +8 -0
- package/dist/js/index.js +8 -0
- package/dist/js/sse/connect-sse.d.ts +14 -0
- package/dist/js/sse/connect-sse.d.ts.map +1 -0
- package/dist/js/sse/connect-sse.js +128 -0
- package/dist/js/sse/connect-sse.js.map +1 -0
- package/dist/js/sse/types.d.ts +34 -0
- package/dist/js/sse/types.d.ts.map +1 -0
- package/dist/react/charts/area/index.d.ts +33 -0
- package/dist/react/charts/area/index.d.ts.map +1 -0
- package/dist/react/charts/area/index.js +29 -0
- package/dist/react/charts/area/index.js.map +1 -0
- package/dist/react/charts/bar/index.d.ts +43 -0
- package/dist/react/charts/bar/index.d.ts.map +1 -0
- package/dist/react/charts/bar/index.js +39 -0
- package/dist/react/charts/bar/index.js.map +1 -0
- package/dist/react/charts/base.d.ts +89 -0
- package/dist/react/charts/base.d.ts.map +1 -0
- package/dist/react/charts/base.js +123 -0
- package/dist/react/charts/base.js.map +1 -0
- package/dist/react/charts/chart-error-boundary.js +37 -0
- package/dist/react/charts/chart-error-boundary.js.map +1 -0
- package/dist/react/charts/constants.d.ts +22 -0
- package/dist/react/charts/constants.d.ts.map +1 -0
- package/dist/react/charts/constants.js +86 -0
- package/dist/react/charts/constants.js.map +1 -0
- package/dist/react/charts/create-chart.d.ts +26 -0
- package/dist/react/charts/create-chart.d.ts.map +1 -0
- package/dist/react/charts/create-chart.js +55 -0
- package/dist/react/charts/create-chart.js.map +1 -0
- package/dist/react/charts/empty.js +16 -0
- package/dist/react/charts/empty.js.map +1 -0
- package/dist/react/charts/error.js +16 -0
- package/dist/react/charts/error.js.map +1 -0
- package/dist/react/charts/heatmap/index.d.ts +42 -0
- package/dist/react/charts/heatmap/index.d.ts.map +1 -0
- package/dist/react/charts/heatmap/index.js +38 -0
- package/dist/react/charts/heatmap/index.js.map +1 -0
- package/dist/react/charts/index.js +18 -0
- package/dist/react/charts/line/index.d.ts +34 -0
- package/dist/react/charts/line/index.d.ts.map +1 -0
- package/dist/react/charts/line/index.js +30 -0
- package/dist/react/charts/line/index.js.map +1 -0
- package/dist/react/charts/loading.js +13 -0
- package/dist/react/charts/loading.js.map +1 -0
- package/dist/react/charts/normalize.d.ts +37 -0
- package/dist/react/charts/normalize.d.ts.map +1 -0
- package/dist/react/charts/normalize.js +256 -0
- package/dist/react/charts/normalize.js.map +1 -0
- package/dist/react/charts/options.d.ts +39 -0
- package/dist/react/charts/options.d.ts.map +1 -0
- package/dist/react/charts/options.js +212 -0
- package/dist/react/charts/options.js.map +1 -0
- package/dist/react/charts/pie/index.d.ts +57 -0
- package/dist/react/charts/pie/index.d.ts.map +1 -0
- package/dist/react/charts/pie/index.js +50 -0
- package/dist/react/charts/pie/index.js.map +1 -0
- package/dist/react/charts/radar/index.d.ts +32 -0
- package/dist/react/charts/radar/index.d.ts.map +1 -0
- package/dist/react/charts/radar/index.js +28 -0
- package/dist/react/charts/radar/index.js.map +1 -0
- package/dist/react/charts/scatter/index.d.ts +32 -0
- package/dist/react/charts/scatter/index.d.ts.map +1 -0
- package/dist/react/charts/scatter/index.js +28 -0
- package/dist/react/charts/scatter/index.js.map +1 -0
- package/dist/react/charts/theme.d.ts +23 -0
- package/dist/react/charts/theme.d.ts.map +1 -0
- package/dist/react/charts/theme.js +96 -0
- package/dist/react/charts/theme.js.map +1 -0
- package/dist/react/charts/types.d.ts +160 -0
- package/dist/react/charts/types.d.ts.map +1 -0
- package/dist/react/charts/types.js +17 -0
- package/dist/react/charts/types.js.map +1 -0
- package/dist/react/charts/utils.d.ts +36 -0
- package/dist/react/charts/utils.d.ts.map +1 -0
- package/dist/react/charts/utils.js +77 -0
- package/dist/react/charts/utils.js.map +1 -0
- package/dist/react/charts/wrapper.d.ts +65 -0
- package/dist/react/charts/wrapper.d.ts.map +1 -0
- package/dist/react/charts/wrapper.js +94 -0
- package/dist/react/charts/wrapper.js.map +1 -0
- package/dist/react/hooks/index.js +2 -0
- package/dist/react/hooks/types.d.ts +101 -0
- package/dist/react/hooks/types.d.ts.map +1 -0
- package/dist/react/hooks/use-analytics-query.d.ts +33 -0
- package/dist/react/hooks/use-analytics-query.d.ts.map +1 -0
- package/dist/react/hooks/use-analytics-query.js +146 -0
- package/dist/react/hooks/use-analytics-query.js.map +1 -0
- package/dist/react/hooks/use-chart-data.d.ts +54 -0
- package/dist/react/hooks/use-chart-data.d.ts.map +1 -0
- package/dist/react/hooks/use-chart-data.js +80 -0
- package/dist/react/hooks/use-chart-data.js.map +1 -0
- package/dist/react/hooks/use-mobile.js +21 -0
- package/dist/react/hooks/use-mobile.js.map +1 -0
- package/dist/react/hooks/use-query-hmr.js +19 -0
- package/dist/react/hooks/use-query-hmr.js.map +1 -0
- package/dist/react/index.d.ts +75 -0
- package/dist/react/index.js +79 -0
- package/dist/react/lib/format.js +42 -0
- package/dist/react/lib/format.js.map +1 -0
- package/dist/react/lib/utils.js +11 -0
- package/dist/react/lib/utils.js.map +1 -0
- package/dist/react/table/data-table.d.ts +47 -0
- package/dist/react/table/data-table.d.ts.map +1 -0
- package/dist/react/table/data-table.js +205 -0
- package/dist/react/table/data-table.js.map +1 -0
- package/dist/react/table/empty.js +16 -0
- package/dist/react/table/empty.js.map +1 -0
- package/dist/react/table/error.js +16 -0
- package/dist/react/table/error.js.map +1 -0
- package/dist/react/table/index.js +1 -0
- package/dist/react/table/loading.js +50 -0
- package/dist/react/table/loading.js.map +1 -0
- package/dist/react/table/table-wrapper.js +143 -0
- package/dist/react/table/table-wrapper.js.map +1 -0
- package/dist/react/table/types.d.ts +55 -0
- package/dist/react/table/types.d.ts.map +1 -0
- package/dist/react/ui/accordion.d.ts +25 -0
- package/dist/react/ui/accordion.d.ts.map +1 -0
- package/dist/react/ui/accordion.js +45 -0
- package/dist/react/ui/accordion.js.map +1 -0
- package/dist/react/ui/alert-dialog.d.ts +49 -0
- package/dist/react/ui/alert-dialog.d.ts.map +1 -0
- package/dist/react/ui/alert-dialog.js +82 -0
- package/dist/react/ui/alert-dialog.js.map +1 -0
- package/dist/react/ui/alert.d.ts +25 -0
- package/dist/react/ui/alert.d.ts.map +1 -0
- package/dist/react/ui/alert.js +38 -0
- package/dist/react/ui/alert.js.map +1 -0
- package/dist/react/ui/aspect-ratio.d.ts +10 -0
- package/dist/react/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/react/ui/aspect-ratio.js +16 -0
- package/dist/react/ui/aspect-ratio.js.map +1 -0
- package/dist/react/ui/avatar.d.ts +20 -0
- package/dist/react/ui/avatar.d.ts.map +1 -0
- package/dist/react/ui/avatar.js +30 -0
- package/dist/react/ui/avatar.js.map +1 -0
- package/dist/react/ui/badge.d.ts +20 -0
- package/dist/react/ui/badge.d.ts.map +1 -0
- package/dist/react/ui/badge.js +26 -0
- package/dist/react/ui/badge.js.map +1 -0
- package/dist/react/ui/breadcrumb.d.ts +38 -0
- package/dist/react/ui/breadcrumb.d.ts.map +1 -0
- package/dist/react/ui/breadcrumb.js +71 -0
- package/dist/react/ui/breadcrumb.js.map +1 -0
- package/dist/react/ui/button-group.d.ts +29 -0
- package/dist/react/ui/button-group.d.ts.map +1 -0
- package/dist/react/ui/button-group.js +41 -0
- package/dist/react/ui/button-group.js.map +1 -0
- package/dist/react/ui/button.d.ts +22 -0
- package/dist/react/ui/button.d.ts.map +1 -0
- package/dist/react/ui/button.js +45 -0
- package/dist/react/ui/button.js.map +1 -0
- package/dist/react/ui/calendar.d.ts +27 -0
- package/dist/react/ui/calendar.d.ts.map +1 -0
- package/dist/react/ui/calendar.js +109 -0
- package/dist/react/ui/calendar.js.map +1 -0
- package/dist/react/ui/card.d.ts +35 -0
- package/dist/react/ui/card.d.ts.map +1 -0
- package/dist/react/ui/card.js +57 -0
- package/dist/react/ui/card.js.map +1 -0
- package/dist/react/ui/carousel.d.ts +48 -0
- package/dist/react/ui/carousel.d.ts.map +1 -0
- package/dist/react/ui/carousel.js +134 -0
- package/dist/react/ui/carousel.js.map +1 -0
- package/dist/react/ui/chart.d.ts +80 -0
- package/dist/react/ui/chart.d.ts.map +1 -0
- package/dist/react/ui/chart.js +143 -0
- package/dist/react/ui/chart.js.map +1 -0
- package/dist/react/ui/checkbox.d.ts +12 -0
- package/dist/react/ui/checkbox.d.ts.map +1 -0
- package/dist/react/ui/checkbox.js +24 -0
- package/dist/react/ui/checkbox.js.map +1 -0
- package/dist/react/ui/collapsible.d.ts +16 -0
- package/dist/react/ui/collapsible.d.ts.map +1 -0
- package/dist/react/ui/collapsible.js +26 -0
- package/dist/react/ui/collapsible.js.map +1 -0
- package/dist/react/ui/command.d.ts +53 -0
- package/dist/react/ui/command.d.ts.map +1 -0
- package/dist/react/ui/command.js +87 -0
- package/dist/react/ui/command.js.map +1 -0
- package/dist/react/ui/context-menu.d.ts +77 -0
- package/dist/react/ui/context-menu.d.ts.map +1 -0
- package/dist/react/ui/context-menu.js +125 -0
- package/dist/react/ui/context-menu.js.map +1 -0
- package/dist/react/ui/dialog.d.ts +48 -0
- package/dist/react/ui/dialog.d.ts.map +1 -0
- package/dist/react/ui/dialog.js +87 -0
- package/dist/react/ui/dialog.js.map +1 -0
- package/dist/react/ui/drawer.d.ts +45 -0
- package/dist/react/ui/drawer.d.ts.map +1 -0
- package/dist/react/ui/drawer.js +81 -0
- package/dist/react/ui/drawer.js.map +1 -0
- package/dist/react/ui/dropdown-menu.d.ts +78 -0
- package/dist/react/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/react/ui/dropdown-menu.js +124 -0
- package/dist/react/ui/dropdown-menu.js.map +1 -0
- package/dist/react/ui/empty.d.ts +36 -0
- package/dist/react/ui/empty.d.ts.map +1 -0
- package/dist/react/ui/empty.js +62 -0
- package/dist/react/ui/empty.js.map +1 -0
- package/dist/react/ui/field.d.ts +65 -0
- package/dist/react/ui/field.d.ts.map +1 -0
- package/dist/react/ui/field.js +120 -0
- package/dist/react/ui/field.js.map +1 -0
- package/dist/react/ui/form.d.ts +46 -0
- package/dist/react/ui/form.d.ts.map +1 -0
- package/dist/react/ui/form.js +92 -0
- package/dist/react/ui/form.js.map +1 -0
- package/dist/react/ui/hover-card.d.ts +20 -0
- package/dist/react/ui/hover-card.d.ts.map +1 -0
- package/dist/react/ui/hover-card.js +35 -0
- package/dist/react/ui/hover-card.js.map +1 -0
- package/dist/react/ui/index.js +53 -0
- package/dist/react/ui/input-group.d.ts +44 -0
- package/dist/react/ui/input-group.d.ts.map +1 -0
- package/dist/react/ui/input-group.js +82 -0
- package/dist/react/ui/input-group.js.map +1 -0
- package/dist/react/ui/input-otp.d.ts +29 -0
- package/dist/react/ui/input-otp.d.ts.map +1 -0
- package/dist/react/ui/input-otp.js +47 -0
- package/dist/react/ui/input-otp.js.map +1 -0
- package/dist/react/ui/input.d.ts +12 -0
- package/dist/react/ui/input.d.ts.map +1 -0
- package/dist/react/ui/input.js +16 -0
- package/dist/react/ui/input.js.map +1 -0
- package/dist/react/ui/item.d.ts +63 -0
- package/dist/react/ui/item.d.ts.map +1 -0
- package/dist/react/ui/item.js +118 -0
- package/dist/react/ui/item.js.map +1 -0
- package/dist/react/ui/kbd.d.ts +14 -0
- package/dist/react/ui/kbd.d.ts.map +1 -0
- package/dist/react/ui/kbd.js +22 -0
- package/dist/react/ui/kbd.js.map +1 -0
- package/dist/react/ui/label.d.ts +12 -0
- package/dist/react/ui/label.d.ts.map +1 -0
- package/dist/react/ui/label.js +18 -0
- package/dist/react/ui/label.js.map +1 -0
- package/dist/react/ui/menubar.d.ts +85 -0
- package/dist/react/ui/menubar.d.ts.map +1 -0
- package/dist/react/ui/menubar.js +134 -0
- package/dist/react/ui/menubar.js.map +1 -0
- package/dist/react/ui/navigation-menu.d.ts +47 -0
- package/dist/react/ui/navigation-menu.d.ts.map +1 -0
- package/dist/react/ui/navigation-menu.js +82 -0
- package/dist/react/ui/navigation-menu.js.map +1 -0
- package/dist/react/ui/pagination.d.ts +40 -0
- package/dist/react/ui/pagination.d.ts.map +1 -0
- package/dist/react/ui/pagination.js +80 -0
- package/dist/react/ui/pagination.js.map +1 -0
- package/dist/react/ui/popover.d.ts +23 -0
- package/dist/react/ui/popover.d.ts.map +1 -0
- package/dist/react/ui/popover.js +38 -0
- package/dist/react/ui/popover.js.map +1 -0
- package/dist/react/ui/progress.d.ts +13 -0
- package/dist/react/ui/progress.d.ts.map +1 -0
- package/dist/react/ui/progress.js +21 -0
- package/dist/react/ui/progress.js.map +1 -0
- package/dist/react/ui/radio-group.d.ts +16 -0
- package/dist/react/ui/radio-group.d.ts.map +1 -0
- package/dist/react/ui/radio-group.js +31 -0
- package/dist/react/ui/radio-group.js.map +1 -0
- package/dist/react/ui/resizable.d.ts +22 -0
- package/dist/react/ui/resizable.d.ts.map +1 -0
- package/dist/react/ui/resizable.js +34 -0
- package/dist/react/ui/resizable.js.map +1 -0
- package/dist/react/ui/scroll-area.d.ts +18 -0
- package/dist/react/ui/scroll-area.d.ts.map +1 -0
- package/dist/react/ui/scroll-area.js +39 -0
- package/dist/react/ui/scroll-area.js.map +1 -0
- package/dist/react/ui/select.d.ts +53 -0
- package/dist/react/ui/select.d.ts.map +1 -0
- package/dist/react/ui/select.js +98 -0
- package/dist/react/ui/select.js.map +1 -0
- package/dist/react/ui/separator.d.ts +14 -0
- package/dist/react/ui/separator.d.ts.map +1 -0
- package/dist/react/ui/separator.js +20 -0
- package/dist/react/ui/separator.js.map +1 -0
- package/dist/react/ui/sheet.d.ts +41 -0
- package/dist/react/ui/sheet.d.ts.map +1 -0
- package/dist/react/ui/sheet.js +83 -0
- package/dist/react/ui/sheet.js.map +1 -0
- package/dist/react/ui/sidebar.d.ts +167 -0
- package/dist/react/ui/sidebar.d.ts.map +1 -0
- package/dist/react/ui/sidebar.js +379 -0
- package/dist/react/ui/sidebar.js.map +1 -0
- package/dist/react/ui/skeleton.d.ts +10 -0
- package/dist/react/ui/skeleton.d.ts.map +1 -0
- package/dist/react/ui/skeleton.js +15 -0
- package/dist/react/ui/skeleton.js.map +1 -0
- package/dist/react/ui/slider.d.ts +16 -0
- package/dist/react/ui/slider.d.ts.map +1 -0
- package/dist/react/ui/slider.js +40 -0
- package/dist/react/ui/slider.js.map +1 -0
- package/dist/react/ui/sonner.d.ts +10 -0
- package/dist/react/ui/sonner.d.ts.map +1 -0
- package/dist/react/ui/sonner.js +31 -0
- package/dist/react/ui/sonner.js.map +1 -0
- package/dist/react/ui/spinner.d.ts +10 -0
- package/dist/react/ui/spinner.d.ts.map +1 -0
- package/dist/react/ui/spinner.js +17 -0
- package/dist/react/ui/spinner.js.map +1 -0
- package/dist/react/ui/switch.d.ts +12 -0
- package/dist/react/ui/switch.d.ts.map +1 -0
- package/dist/react/ui/switch.js +22 -0
- package/dist/react/ui/switch.js.map +1 -0
- package/dist/react/ui/table.d.ts +39 -0
- package/dist/react/ui/table.d.ts.map +1 -0
- package/dist/react/ui/table.js +68 -0
- package/dist/react/ui/table.js.map +1 -0
- package/dist/react/ui/tabs.d.ts +24 -0
- package/dist/react/ui/tabs.d.ts.map +1 -0
- package/dist/react/ui/tabs.js +39 -0
- package/dist/react/ui/tabs.js.map +1 -0
- package/dist/react/ui/textarea.d.ts +11 -0
- package/dist/react/ui/textarea.d.ts.map +1 -0
- package/dist/react/ui/textarea.js +15 -0
- package/dist/react/ui/textarea.js.map +1 -0
- package/dist/react/ui/toggle-group.d.ts +27 -0
- package/dist/react/ui/toggle-group.d.ts.map +1 -0
- package/dist/react/ui/toggle-group.js +50 -0
- package/dist/react/ui/toggle-group.js.map +1 -0
- package/dist/react/ui/toggle.d.ts +20 -0
- package/dist/react/ui/toggle.d.ts.map +1 -0
- package/dist/react/ui/toggle.js +38 -0
- package/dist/react/ui/toggle.js.map +1 -0
- package/dist/react/ui/tooltip.d.ts +24 -0
- package/dist/react/ui/tooltip.d.ts.map +1 -0
- package/dist/react/ui/tooltip.js +39 -0
- package/dist/react/ui/tooltip.js.map +1 -0
- package/dist/shared/src/sql/helpers.d.ts +160 -0
- package/dist/shared/src/sql/helpers.d.ts.map +1 -0
- package/dist/shared/src/sql/helpers.js +103 -0
- package/dist/shared/src/sql/helpers.js.map +1 -0
- package/dist/shared/src/sql/types.d.ts +34 -0
- package/dist/shared/src/sql/types.d.ts.map +1 -0
- package/dist/styles.css +425 -0
- package/llms.txt +193 -0
- package/package.json +98 -0
- package/scripts/postinstall.js +6 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AreaChartProps } from "../types.js";
|
|
2
|
+
import * as react_jsx_runtime274 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/charts/area/index.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Area Chart component.
|
|
8
|
+
* Supports both JSON and Arrow data formats with automatic format selection.
|
|
9
|
+
*
|
|
10
|
+
* @example Simple usage
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <AreaChart
|
|
13
|
+
* queryKey="traffic_data"
|
|
14
|
+
* parameters={{ period: "weekly" }}
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Stacked area chart
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <AreaChart
|
|
21
|
+
* queryKey="revenue_breakdown"
|
|
22
|
+
* parameters={{ groupBy: "product" }}
|
|
23
|
+
* stacked={true}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
declare const AreaChart: {
|
|
28
|
+
(props: AreaChartProps): react_jsx_runtime274.JSX.Element;
|
|
29
|
+
displayName: string;
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { AreaChart };
|
|
33
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/area/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAwBA;;;;;;;;;;;;;;;;;;cAAa"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createChart } from "../create-chart.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/charts/area/index.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Area Chart component.
|
|
6
|
+
* Supports both JSON and Arrow data formats with automatic format selection.
|
|
7
|
+
*
|
|
8
|
+
* @example Simple usage
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <AreaChart
|
|
11
|
+
* queryKey="traffic_data"
|
|
12
|
+
* parameters={{ period: "weekly" }}
|
|
13
|
+
* />
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Stacked area chart
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <AreaChart
|
|
19
|
+
* queryKey="revenue_breakdown"
|
|
20
|
+
* parameters={{ groupBy: "product" }}
|
|
21
|
+
* stacked={true}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
const AreaChart = createChart("area", "AreaChart");
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { AreaChart };
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/area/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { AreaChartProps } from \"../types\";\n\n/**\n * Area Chart component.\n * Supports both JSON and Arrow data formats with automatic format selection.\n *\n * @example Simple usage\n * ```tsx\n * <AreaChart\n * queryKey=\"traffic_data\"\n * parameters={{ period: \"weekly\" }}\n * />\n * ```\n *\n * @example Stacked area chart\n * ```tsx\n * <AreaChart\n * queryKey=\"revenue_breakdown\"\n * parameters={{ groupBy: \"product\" }}\n * stacked={true}\n * />\n * ```\n */\nexport const AreaChart = createChart<AreaChartProps>(\"area\", \"AreaChart\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,YAAY,YAA4B,QAAQ,YAAY"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BarChartProps } from "../types.js";
|
|
2
|
+
import * as react_jsx_runtime275 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/charts/bar/index.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Bar Chart component.
|
|
8
|
+
* Supports both JSON and Arrow data formats with automatic format selection.
|
|
9
|
+
*
|
|
10
|
+
* @example Query mode with auto format selection
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <BarChart
|
|
13
|
+
* queryKey="top_contributors"
|
|
14
|
+
* parameters={{ limit: 10 }}
|
|
15
|
+
* />
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Query mode with explicit Arrow format
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <BarChart
|
|
21
|
+
* queryKey="spend_data"
|
|
22
|
+
* parameters={{ startDate, endDate }}
|
|
23
|
+
* format="arrow"
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Data mode with JSON array
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <BarChart
|
|
30
|
+
* data={[
|
|
31
|
+
* { category: "A", value: 100 },
|
|
32
|
+
* { category: "B", value: 200 },
|
|
33
|
+
* ]}
|
|
34
|
+
* />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare const BarChart: {
|
|
38
|
+
(props: BarChartProps): react_jsx_runtime275.JSX.Element;
|
|
39
|
+
displayName: string;
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { BarChart };
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/react/charts/bar/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAkCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAa"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createChart } from "../create-chart.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/charts/bar/index.tsx
|
|
4
|
+
/**
|
|
5
|
+
* Bar Chart component.
|
|
6
|
+
* Supports both JSON and Arrow data formats with automatic format selection.
|
|
7
|
+
*
|
|
8
|
+
* @example Query mode with auto format selection
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <BarChart
|
|
11
|
+
* queryKey="top_contributors"
|
|
12
|
+
* parameters={{ limit: 10 }}
|
|
13
|
+
* />
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @example Query mode with explicit Arrow format
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <BarChart
|
|
19
|
+
* queryKey="spend_data"
|
|
20
|
+
* parameters={{ startDate, endDate }}
|
|
21
|
+
* format="arrow"
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @example Data mode with JSON array
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <BarChart
|
|
28
|
+
* data={[
|
|
29
|
+
* { category: "A", value: 100 },
|
|
30
|
+
* { category: "B", value: 200 },
|
|
31
|
+
* ]}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
const BarChart = createChart("bar", "BarChart");
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { BarChart };
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/react/charts/bar/index.tsx"],"sourcesContent":["import { createChart } from \"../create-chart\";\nimport type { BarChartProps } from \"../types\";\n\n/**\n * Bar Chart component.\n * Supports both JSON and Arrow data formats with automatic format selection.\n *\n * @example Query mode with auto format selection\n * ```tsx\n * <BarChart\n * queryKey=\"top_contributors\"\n * parameters={{ limit: 10 }}\n * />\n * ```\n *\n * @example Query mode with explicit Arrow format\n * ```tsx\n * <BarChart\n * queryKey=\"spend_data\"\n * parameters={{ startDate, endDate }}\n * format=\"arrow\"\n * />\n * ```\n *\n * @example Data mode with JSON array\n * ```tsx\n * <BarChart\n * data={[\n * { category: \"A\", value: 100 },\n * { category: \"B\", value: 200 },\n * ]}\n * />\n * ```\n */\nexport const BarChart = createChart<BarChartProps>(\"bar\", \"BarChart\");\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,WAAW,YAA2B,OAAO,WAAW"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ChartColorPalette, ChartData, ChartType, Orientation } from "./types.js";
|
|
2
|
+
import * as react_jsx_runtime282 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/charts/base.d.ts
|
|
5
|
+
interface BaseChartProps {
|
|
6
|
+
/** Chart data (Arrow Table or JSON array) - format is auto-detected */
|
|
7
|
+
data: ChartData;
|
|
8
|
+
/** Chart type */
|
|
9
|
+
chartType: ChartType;
|
|
10
|
+
/** X-axis field key (auto-detected from schema if not provided) */
|
|
11
|
+
xKey?: string;
|
|
12
|
+
/** Y-axis field key(s) (auto-detected from schema if not provided) */
|
|
13
|
+
yKey?: string | string[];
|
|
14
|
+
/** Chart orientation @default "vertical" */
|
|
15
|
+
orientation?: Orientation;
|
|
16
|
+
/** Chart height in pixels @default 300 */
|
|
17
|
+
height?: number;
|
|
18
|
+
/** Chart title */
|
|
19
|
+
title?: string;
|
|
20
|
+
/** Show legend @default true */
|
|
21
|
+
showLegend?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Color palette to use. Auto-selected based on chart type if not specified.
|
|
24
|
+
* - "categorical": Distinct colors for different categories (bar, pie, line)
|
|
25
|
+
* - "sequential": Gradient for magnitude (heatmap)
|
|
26
|
+
* - "diverging": Two-tone for positive/negative (correlation)
|
|
27
|
+
*/
|
|
28
|
+
colorPalette?: ChartColorPalette;
|
|
29
|
+
/** Custom colors (overrides colorPalette) */
|
|
30
|
+
colors?: string[];
|
|
31
|
+
/** Show data point symbols (line/area charts) @default false */
|
|
32
|
+
showSymbol?: boolean;
|
|
33
|
+
/** Smooth line curves (line/area charts) @default true */
|
|
34
|
+
smooth?: boolean;
|
|
35
|
+
/** Stack series @default false */
|
|
36
|
+
stacked?: boolean;
|
|
37
|
+
/** Symbol size for scatter charts @default 8 */
|
|
38
|
+
symbolSize?: number;
|
|
39
|
+
/** Show area fill for radar charts @default true */
|
|
40
|
+
showArea?: boolean;
|
|
41
|
+
/** Inner radius for pie/donut (0-100) @default 0 */
|
|
42
|
+
innerRadius?: number;
|
|
43
|
+
/** Show labels on pie/donut slices @default true */
|
|
44
|
+
showLabels?: boolean;
|
|
45
|
+
/** Label position for pie/donut @default "outside" */
|
|
46
|
+
labelPosition?: "outside" | "inside" | "center";
|
|
47
|
+
/** Y-axis field key for heatmap (the row dimension) */
|
|
48
|
+
yAxisKey?: string;
|
|
49
|
+
/** Min value for heatmap color scale */
|
|
50
|
+
min?: number;
|
|
51
|
+
/** Max value for heatmap color scale */
|
|
52
|
+
max?: number;
|
|
53
|
+
/** Additional ECharts options to merge */
|
|
54
|
+
options?: Record<string, unknown>;
|
|
55
|
+
/** Additional CSS classes */
|
|
56
|
+
className?: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Base chart component that handles both Arrow and JSON data.
|
|
60
|
+
* Renders using ECharts for consistent output across both formats.
|
|
61
|
+
*/
|
|
62
|
+
declare function BaseChart({
|
|
63
|
+
data,
|
|
64
|
+
chartType,
|
|
65
|
+
xKey,
|
|
66
|
+
yKey,
|
|
67
|
+
orientation,
|
|
68
|
+
height,
|
|
69
|
+
title,
|
|
70
|
+
showLegend,
|
|
71
|
+
colorPalette,
|
|
72
|
+
colors: customColors,
|
|
73
|
+
showSymbol,
|
|
74
|
+
smooth,
|
|
75
|
+
stacked,
|
|
76
|
+
symbolSize,
|
|
77
|
+
showArea,
|
|
78
|
+
innerRadius,
|
|
79
|
+
showLabels,
|
|
80
|
+
labelPosition,
|
|
81
|
+
yAxisKey,
|
|
82
|
+
min,
|
|
83
|
+
max,
|
|
84
|
+
options: customOptions,
|
|
85
|
+
className
|
|
86
|
+
}: BaseChartProps): react_jsx_runtime282.JSX.Element;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { BaseChart, BaseChartProps };
|
|
89
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":[],"sources":["../../../src/react/charts/base.tsx"],"sourcesContent":[],"mappings":";;;;UA0CiB,cAAA;;QAET;EAFS;EAAc,SAAA,EAIlB,SAJkB;;MAIlB,CAAA,EAAA,MAAA;;MAmBI,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;;EA0BC,WAAA,CAAA,EAvCF,WAuCE;EAaF;EAAS,MAAA,CAAA,EAAA,MAAA;;OAEvB,CAAA,EAAA,MAAA;;YAEA,CAAA,EAAA,OAAA;;;;;;;cAOA,CAAA,EAlDe,iBAkDf;;QAEA,CAAA,EAAA,MAAA,EAAA;;YAEA,CAAA,EAAA,OAAA;;QAEA,CAAA,EAAA,OAAA;;SAEA,CAAA,EAAA,OAAA;;YAEA,CAAA,EAAA,MAAA;;UAEA,CAAA,EAAA,OAAA;;aACe,CAAA,EAAA,MAAA;EAAA;;;;;;;;;;;YArCL;;;;;;;;iBAaI,SAAA;;;;;;;;;;UAUN;;;;;;;;;;;;WAYC;;GAER,iBAAc,oBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { normalizeChartData, normalizeHeatmapData } from "./normalize.js";
|
|
2
|
+
import { buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption } from "./options.js";
|
|
3
|
+
import { useThemeColors } from "./theme.js";
|
|
4
|
+
import ReactECharts from "echarts-for-react";
|
|
5
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/react/charts/base.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Determines the appropriate color palette for a chart type.
|
|
11
|
+
* - Heatmaps use sequential (low → high intensity)
|
|
12
|
+
* - All other charts use categorical (distinct categories)
|
|
13
|
+
*/
|
|
14
|
+
function getDefaultPalette(chartType) {
|
|
15
|
+
switch (chartType) {
|
|
16
|
+
case "heatmap": return "sequential";
|
|
17
|
+
default: return "categorical";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Base chart component that handles both Arrow and JSON data.
|
|
22
|
+
* Renders using ECharts for consistent output across both formats.
|
|
23
|
+
*/
|
|
24
|
+
function BaseChart({ data, chartType, xKey, yKey, orientation, height = 300, title, showLegend = true, colorPalette, colors: customColors, showSymbol = false, smooth = true, stacked = false, symbolSize = 8, showArea = true, innerRadius = 0, showLabels = true, labelPosition = "outside", yAxisKey, min, max, options: customOptions, className }) {
|
|
25
|
+
const themeColors = useThemeColors(colorPalette ?? getDefaultPalette(chartType));
|
|
26
|
+
const colors = customColors ?? themeColors;
|
|
27
|
+
const echartsInstanceRef = useRef(null);
|
|
28
|
+
const chartRefCallback = useCallback((node) => {
|
|
29
|
+
if (echartsInstanceRef.current && !echartsInstanceRef.current.isDisposed()) echartsInstanceRef.current.dispose();
|
|
30
|
+
if (node) echartsInstanceRef.current = node.getEchartsInstance();
|
|
31
|
+
else {
|
|
32
|
+
if (echartsInstanceRef.current && !echartsInstanceRef.current.isDisposed()) echartsInstanceRef.current.dispose();
|
|
33
|
+
echartsInstanceRef.current = null;
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
const normalized = useMemo(() => chartType === "heatmap" ? normalizeHeatmapData(data, xKey, yAxisKey, yKey) : normalizeChartData(data, xKey, yKey, orientation), [
|
|
37
|
+
data,
|
|
38
|
+
xKey,
|
|
39
|
+
yKey,
|
|
40
|
+
yAxisKey,
|
|
41
|
+
orientation,
|
|
42
|
+
chartType
|
|
43
|
+
]);
|
|
44
|
+
const option = useMemo(() => {
|
|
45
|
+
const { xData, yFields, chartType: detectedChartType } = normalized;
|
|
46
|
+
if (xData.length === 0) return null;
|
|
47
|
+
const isHeatmap = chartType === "heatmap";
|
|
48
|
+
const baseCtx = {
|
|
49
|
+
xData,
|
|
50
|
+
yDataMap: "yDataMap" in normalized ? normalized.yDataMap : {},
|
|
51
|
+
yFields,
|
|
52
|
+
colors,
|
|
53
|
+
title,
|
|
54
|
+
showLegend
|
|
55
|
+
};
|
|
56
|
+
const isPie = chartType === "pie" || chartType === "donut";
|
|
57
|
+
const isRadar = chartType === "radar";
|
|
58
|
+
const isHorizontal = !isPie && !isRadar && !isHeatmap && (orientation === "horizontal" || detectedChartType === "categorical" && !orientation && chartType === "bar");
|
|
59
|
+
const isTimeSeries = detectedChartType === "timeseries" && !isHorizontal && !isRadar && !isHeatmap;
|
|
60
|
+
let opt;
|
|
61
|
+
if (isHeatmap && "yAxisData" in normalized && "heatmapData" in normalized) {
|
|
62
|
+
const heatmapNorm = normalized;
|
|
63
|
+
opt = buildHeatmapOption({
|
|
64
|
+
...baseCtx,
|
|
65
|
+
yAxisData: heatmapNorm.yAxisData,
|
|
66
|
+
heatmapData: heatmapNorm.heatmapData,
|
|
67
|
+
min: min ?? heatmapNorm.min,
|
|
68
|
+
max: max ?? heatmapNorm.max,
|
|
69
|
+
showLabels
|
|
70
|
+
});
|
|
71
|
+
} else if (isRadar) opt = buildRadarOption(baseCtx, showArea);
|
|
72
|
+
else if (isPie) opt = buildPieOption(baseCtx, chartType, innerRadius, showLabels, labelPosition);
|
|
73
|
+
else if (isHorizontal) opt = buildHorizontalBarOption(baseCtx, stacked);
|
|
74
|
+
else opt = buildCartesianOption({
|
|
75
|
+
...baseCtx,
|
|
76
|
+
chartType,
|
|
77
|
+
isTimeSeries,
|
|
78
|
+
stacked,
|
|
79
|
+
smooth,
|
|
80
|
+
showSymbol,
|
|
81
|
+
symbolSize
|
|
82
|
+
});
|
|
83
|
+
return customOptions ? {
|
|
84
|
+
...opt,
|
|
85
|
+
...customOptions
|
|
86
|
+
} : opt;
|
|
87
|
+
}, [
|
|
88
|
+
normalized,
|
|
89
|
+
colors,
|
|
90
|
+
title,
|
|
91
|
+
showLegend,
|
|
92
|
+
chartType,
|
|
93
|
+
orientation,
|
|
94
|
+
innerRadius,
|
|
95
|
+
showLabels,
|
|
96
|
+
labelPosition,
|
|
97
|
+
stacked,
|
|
98
|
+
smooth,
|
|
99
|
+
showSymbol,
|
|
100
|
+
symbolSize,
|
|
101
|
+
showArea,
|
|
102
|
+
min,
|
|
103
|
+
max,
|
|
104
|
+
customOptions
|
|
105
|
+
]);
|
|
106
|
+
if (!option) return /* @__PURE__ */ jsx("div", {
|
|
107
|
+
className: "flex items-center justify-center h-full text-muted-foreground",
|
|
108
|
+
children: "No data"
|
|
109
|
+
});
|
|
110
|
+
return /* @__PURE__ */ jsx(ReactECharts, {
|
|
111
|
+
ref: chartRefCallback,
|
|
112
|
+
option,
|
|
113
|
+
style: { height },
|
|
114
|
+
className,
|
|
115
|
+
opts: { renderer: "canvas" },
|
|
116
|
+
notMerge: false,
|
|
117
|
+
lazyUpdate: true
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
export { BaseChart };
|
|
123
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","names":["baseCtx: OptionBuilderContext","opt: Record<string, unknown>"],"sources":["../../../src/react/charts/base.tsx"],"sourcesContent":["import type { ECharts } from \"echarts\";\nimport ReactECharts from \"echarts-for-react\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport { normalizeChartData, normalizeHeatmapData } from \"./normalize\";\nimport {\n buildCartesianOption,\n buildHeatmapOption,\n buildHorizontalBarOption,\n buildPieOption,\n buildRadarOption,\n type OptionBuilderContext,\n} from \"./options\";\nimport { useThemeColors } from \"./theme\";\nimport type {\n ChartColorPalette,\n ChartData,\n ChartType,\n Orientation,\n} from \"./types\";\n\n// ============================================================================\n// Palette Selection\n// ============================================================================\n\n/**\n * Determines the appropriate color palette for a chart type.\n * - Heatmaps use sequential (low → high intensity)\n * - All other charts use categorical (distinct categories)\n */\nfunction getDefaultPalette(chartType: ChartType): ChartColorPalette {\n switch (chartType) {\n case \"heatmap\":\n return \"sequential\";\n default:\n return \"categorical\";\n }\n}\n\n// ============================================================================\n// Component Props\n// ============================================================================\n\nexport interface BaseChartProps {\n /** Chart data (Arrow Table or JSON array) - format is auto-detected */\n data: ChartData;\n /** Chart type */\n chartType: ChartType;\n /** X-axis field key (auto-detected from schema if not provided) */\n xKey?: string;\n /** Y-axis field key(s) (auto-detected from schema if not provided) */\n yKey?: string | string[];\n /** Chart orientation @default \"vertical\" */\n orientation?: Orientation;\n /** Chart height in pixels @default 300 */\n height?: number;\n /** Chart title */\n title?: string;\n /** Show legend @default true */\n showLegend?: boolean;\n /**\n * Color palette to use. Auto-selected based on chart type if not specified.\n * - \"categorical\": Distinct colors for different categories (bar, pie, line)\n * - \"sequential\": Gradient for magnitude (heatmap)\n * - \"diverging\": Two-tone for positive/negative (correlation)\n */\n colorPalette?: ChartColorPalette;\n /** Custom colors (overrides colorPalette) */\n colors?: string[];\n /** Show data point symbols (line/area charts) @default false */\n showSymbol?: boolean;\n /** Smooth line curves (line/area charts) @default true */\n smooth?: boolean;\n /** Stack series @default false */\n stacked?: boolean;\n /** Symbol size for scatter charts @default 8 */\n symbolSize?: number;\n /** Show area fill for radar charts @default true */\n showArea?: boolean;\n /** Inner radius for pie/donut (0-100) @default 0 */\n innerRadius?: number;\n /** Show labels on pie/donut slices @default true */\n showLabels?: boolean;\n /** Label position for pie/donut @default \"outside\" */\n labelPosition?: \"outside\" | \"inside\" | \"center\";\n /** Y-axis field key for heatmap (the row dimension) */\n yAxisKey?: string;\n /** Min value for heatmap color scale */\n min?: number;\n /** Max value for heatmap color scale */\n max?: number;\n /** Additional ECharts options to merge */\n options?: Record<string, unknown>;\n /** Additional CSS classes */\n className?: string;\n}\n\n// ============================================================================\n// Base Chart Component\n// ============================================================================\n\n/**\n * Base chart component that handles both Arrow and JSON data.\n * Renders using ECharts for consistent output across both formats.\n */\nexport function BaseChart({\n data,\n chartType,\n xKey,\n yKey,\n orientation,\n height = 300,\n title,\n showLegend = true,\n colorPalette,\n colors: customColors,\n showSymbol = false,\n smooth = true,\n stacked = false,\n symbolSize = 8,\n showArea = true,\n innerRadius = 0,\n showLabels = true,\n labelPosition = \"outside\",\n yAxisKey,\n min,\n max,\n options: customOptions,\n className,\n}: BaseChartProps) {\n // Determine the appropriate color palette based on chart type\n const resolvedPalette = colorPalette ?? getDefaultPalette(chartType);\n const themeColors = useThemeColors(resolvedPalette);\n const colors = customColors ?? themeColors;\n\n // Store ECharts instance directly to avoid stale ref issues on unmount\n const echartsInstanceRef = useRef<ECharts | null>(null);\n\n // Callback ref pattern: captures the ECharts instance when ReactECharts mounts\n // This ensures we always have a stable reference to the actual instance\n const chartRefCallback = useCallback((node: ReactECharts | null) => {\n // Dispose previous instance if component is being replaced\n if (\n echartsInstanceRef.current &&\n !echartsInstanceRef.current.isDisposed()\n ) {\n echartsInstanceRef.current.dispose();\n }\n\n // Store the new instance\n if (node) {\n echartsInstanceRef.current = node.getEchartsInstance();\n } else {\n // Component unmounting - dispose the stored instance\n if (\n echartsInstanceRef.current &&\n !echartsInstanceRef.current.isDisposed()\n ) {\n echartsInstanceRef.current.dispose();\n }\n echartsInstanceRef.current = null;\n }\n }, []);\n\n // Memoize data normalization\n const normalized = useMemo(\n () =>\n chartType === \"heatmap\"\n ? normalizeHeatmapData(data, xKey, yAxisKey, yKey)\n : normalizeChartData(data, xKey, yKey, orientation),\n [data, xKey, yKey, yAxisKey, orientation, chartType],\n );\n\n // Memoize option building\n const option = useMemo(() => {\n const { xData, yFields, chartType: detectedChartType } = normalized;\n\n if (xData.length === 0) return null;\n\n // Determine chart mode first (needed to handle yDataMap)\n const isHeatmap = chartType === \"heatmap\";\n\n // Heatmaps use heatmapData instead of yDataMap\n // For other charts, yDataMap is required\n const yDataMap = \"yDataMap\" in normalized ? normalized.yDataMap : {};\n\n const baseCtx: OptionBuilderContext = {\n xData,\n yDataMap,\n yFields,\n colors,\n title,\n showLegend,\n };\n const isPie = chartType === \"pie\" || chartType === \"donut\";\n const isRadar = chartType === \"radar\";\n const isHorizontal =\n !isPie &&\n !isRadar &&\n !isHeatmap &&\n (orientation === \"horizontal\" ||\n (detectedChartType === \"categorical\" &&\n !orientation &&\n chartType === \"bar\"));\n const isTimeSeries =\n detectedChartType === \"timeseries\" &&\n !isHorizontal &&\n !isRadar &&\n !isHeatmap;\n\n // Build option based on chart type\n let opt: Record<string, unknown>;\n\n if (isHeatmap && \"yAxisData\" in normalized && \"heatmapData\" in normalized) {\n const heatmapNorm = normalized as {\n yAxisData: (string | number)[];\n heatmapData: [number, number, number][];\n min: number;\n max: number;\n } & typeof normalized;\n opt = buildHeatmapOption({\n ...baseCtx,\n yAxisData: heatmapNorm.yAxisData,\n heatmapData: heatmapNorm.heatmapData,\n min: min ?? heatmapNorm.min,\n max: max ?? heatmapNorm.max,\n showLabels,\n });\n } else if (isRadar) {\n opt = buildRadarOption(baseCtx, showArea);\n } else if (isPie) {\n opt = buildPieOption(\n baseCtx,\n chartType as \"pie\" | \"donut\",\n innerRadius,\n showLabels,\n labelPosition,\n );\n } else if (isHorizontal) {\n opt = buildHorizontalBarOption(baseCtx, stacked);\n } else {\n opt = buildCartesianOption({\n ...baseCtx,\n chartType,\n isTimeSeries,\n stacked,\n smooth,\n showSymbol,\n symbolSize,\n });\n }\n\n // Merge custom options\n return customOptions ? { ...opt, ...customOptions } : opt;\n }, [\n normalized,\n colors,\n title,\n showLegend,\n chartType,\n orientation,\n innerRadius,\n showLabels,\n labelPosition,\n stacked,\n smooth,\n showSymbol,\n symbolSize,\n showArea,\n min,\n max,\n customOptions,\n ]);\n\n if (!option) {\n return (\n <div className=\"flex items-center justify-center h-full text-muted-foreground\">\n No data\n </div>\n );\n }\n\n return (\n <ReactECharts\n ref={chartRefCallback}\n option={option}\n style={{ height }}\n className={className}\n opts={{ renderer: \"canvas\" }}\n notMerge={false}\n lazyUpdate={true}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA6BA,SAAS,kBAAkB,WAAyC;AAClE,SAAQ,WAAR;EACE,KAAK,UACH,QAAO;EACT,QACE,QAAO;;;;;;;AAsEb,SAAgB,UAAU,EACxB,MACA,WACA,MACA,MACA,aACA,SAAS,KACT,OACA,aAAa,MACb,cACA,QAAQ,cACR,aAAa,OACb,SAAS,MACT,UAAU,OACV,aAAa,GACb,WAAW,MACX,cAAc,GACd,aAAa,MACb,gBAAgB,WAChB,UACA,KACA,KACA,SAAS,eACT,aACiB;CAGjB,MAAM,cAAc,eADI,gBAAgB,kBAAkB,UAAU,CACjB;CACnD,MAAM,SAAS,gBAAgB;CAG/B,MAAM,qBAAqB,OAAuB,KAAK;CAIvD,MAAM,mBAAmB,aAAa,SAA8B;AAElE,MACE,mBAAmB,WACnB,CAAC,mBAAmB,QAAQ,YAAY,CAExC,oBAAmB,QAAQ,SAAS;AAItC,MAAI,KACF,oBAAmB,UAAU,KAAK,oBAAoB;OACjD;AAEL,OACE,mBAAmB,WACnB,CAAC,mBAAmB,QAAQ,YAAY,CAExC,oBAAmB,QAAQ,SAAS;AAEtC,sBAAmB,UAAU;;IAE9B,EAAE,CAAC;CAGN,MAAM,aAAa,cAEf,cAAc,YACV,qBAAqB,MAAM,MAAM,UAAU,KAAK,GAChD,mBAAmB,MAAM,MAAM,MAAM,YAAY,EACvD;EAAC;EAAM;EAAM;EAAM;EAAU;EAAa;EAAU,CACrD;CAGD,MAAM,SAAS,cAAc;EAC3B,MAAM,EAAE,OAAO,SAAS,WAAW,sBAAsB;AAEzD,MAAI,MAAM,WAAW,EAAG,QAAO;EAG/B,MAAM,YAAY,cAAc;EAMhC,MAAMA,UAAgC;GACpC;GACA,UAJe,cAAc,aAAa,WAAW,WAAW,EAAE;GAKlE;GACA;GACA;GACA;GACD;EACD,MAAM,QAAQ,cAAc,SAAS,cAAc;EACnD,MAAM,UAAU,cAAc;EAC9B,MAAM,eACJ,CAAC,SACD,CAAC,WACD,CAAC,cACA,gBAAgB,gBACd,sBAAsB,iBACrB,CAAC,eACD,cAAc;EACpB,MAAM,eACJ,sBAAsB,gBACtB,CAAC,gBACD,CAAC,WACD,CAAC;EAGH,IAAIC;AAEJ,MAAI,aAAa,eAAe,cAAc,iBAAiB,YAAY;GACzE,MAAM,cAAc;AAMpB,SAAM,mBAAmB;IACvB,GAAG;IACH,WAAW,YAAY;IACvB,aAAa,YAAY;IACzB,KAAK,OAAO,YAAY;IACxB,KAAK,OAAO,YAAY;IACxB;IACD,CAAC;aACO,QACT,OAAM,iBAAiB,SAAS,SAAS;WAChC,MACT,OAAM,eACJ,SACA,WACA,aACA,YACA,cACD;WACQ,aACT,OAAM,yBAAyB,SAAS,QAAQ;MAEhD,OAAM,qBAAqB;GACzB,GAAG;GACH;GACA;GACA;GACA;GACA;GACA;GACD,CAAC;AAIJ,SAAO,gBAAgB;GAAE,GAAG;GAAK,GAAG;GAAe,GAAG;IACrD;EACD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAEF,KAAI,CAAC,OACH,QACE,oBAAC;EAAI,WAAU;YAAgE;GAEzE;AAIV,QACE,oBAAC;EACC,KAAK;EACG;EACR,OAAO,EAAE,QAAQ;EACN;EACX,MAAM,EAAE,UAAU,UAAU;EAC5B,UAAU;EACV,YAAY;GACZ"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Component } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/charts/chart-error-boundary.tsx
|
|
5
|
+
var ErrorBoundary = class extends Component {
|
|
6
|
+
constructor(..._args) {
|
|
7
|
+
super(..._args);
|
|
8
|
+
this.state = { hasError: false };
|
|
9
|
+
}
|
|
10
|
+
static getDerivedStateFromError() {
|
|
11
|
+
return { hasError: true };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error) {
|
|
14
|
+
this.props.onError(error);
|
|
15
|
+
}
|
|
16
|
+
render() {
|
|
17
|
+
if (this.state.hasError) return this.props.fallback;
|
|
18
|
+
return this.props.children;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Error boundary component for charts
|
|
23
|
+
* @param children - The children to render
|
|
24
|
+
* @param fallback - The fallback component to render when an error occurs
|
|
25
|
+
* @returns - The rendered chart component with error boundary
|
|
26
|
+
*/
|
|
27
|
+
function ChartErrorBoundary({ children, fallback }) {
|
|
28
|
+
return /* @__PURE__ */ jsx(ErrorBoundary, {
|
|
29
|
+
fallback,
|
|
30
|
+
onError: (error) => console.error("Chart render error:", error),
|
|
31
|
+
children
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { ChartErrorBoundary };
|
|
37
|
+
//# sourceMappingURL=chart-error-boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-error-boundary.js","names":[],"sources":["../../../src/react/charts/chart-error-boundary.tsx"],"sourcesContent":["import { Component } from \"react\";\n\nclass ErrorBoundary extends Component<\n {\n children: React.ReactNode;\n fallback: React.ReactNode;\n onError: (error: Error) => void;\n },\n { hasError: boolean }\n> {\n state = { hasError: false };\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error) {\n this.props.onError(error);\n }\n\n render() {\n if (this.state.hasError) {\n return this.props.fallback;\n }\n return this.props.children;\n }\n}\n\n/**\n * Error boundary component for charts\n * @param children - The children to render\n * @param fallback - The fallback component to render when an error occurs\n * @returns - The rendered chart component with error boundary\n */\nexport function ChartErrorBoundary({\n children,\n fallback,\n}: {\n children: React.ReactNode;\n fallback: React.ReactNode;\n}) {\n return (\n <ErrorBoundary\n fallback={fallback}\n onError={(error) => console.error(\"Chart render error:\", error)}\n >\n {children}\n </ErrorBoundary>\n );\n}\n"],"mappings":";;;;AAEA,IAAM,gBAAN,cAA4B,UAO1B;;;eACQ,EAAE,UAAU,OAAO;;CAE3B,OAAO,2BAA2B;AAChC,SAAO,EAAE,UAAU,MAAM;;CAG3B,kBAAkB,OAAc;AAC9B,OAAK,MAAM,QAAQ,MAAM;;CAG3B,SAAS;AACP,MAAI,KAAK,MAAM,SACb,QAAO,KAAK,MAAM;AAEpB,SAAO,KAAK,MAAM;;;;;;;;;AAUtB,SAAgB,mBAAmB,EACjC,UACA,YAIC;AACD,QACE,oBAAC;EACW;EACV,UAAU,UAAU,QAAQ,MAAM,uBAAuB,MAAM;EAE9D;GACa"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DATE_FIELD_PATTERNS, METADATA_DATE_PATTERNS, NAME_FIELD_PATTERNS } from "../../js/constants.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/charts/constants.d.ts
|
|
4
|
+
/** CSS variable names for categorical chart colors (distinct categories) */
|
|
5
|
+
declare const CHART_COLOR_VARS_CATEGORICAL: readonly ["--chart-cat-1", "--chart-cat-2", "--chart-cat-3", "--chart-cat-4", "--chart-cat-5", "--chart-cat-6", "--chart-cat-7", "--chart-cat-8"];
|
|
6
|
+
/** CSS variable names for sequential chart colors (low → high) */
|
|
7
|
+
declare const CHART_COLOR_VARS_SEQUENTIAL: readonly ["--chart-seq-1", "--chart-seq-2", "--chart-seq-3", "--chart-seq-4", "--chart-seq-5", "--chart-seq-6", "--chart-seq-7", "--chart-seq-8"];
|
|
8
|
+
/** CSS variable names for diverging chart colors (negative ↔ positive) */
|
|
9
|
+
declare const CHART_COLOR_VARS_DIVERGING: readonly ["--chart-div-1", "--chart-div-2", "--chart-div-3", "--chart-div-4", "--chart-div-5", "--chart-div-6", "--chart-div-7", "--chart-div-8"];
|
|
10
|
+
/** Legacy: CSS variable names for chart colors (aliases to categorical) */
|
|
11
|
+
declare const CHART_COLOR_VARS: readonly ["--chart-1", "--chart-2", "--chart-3", "--chart-4", "--chart-5", "--chart-6", "--chart-7", "--chart-8"];
|
|
12
|
+
/** Fallback categorical colors */
|
|
13
|
+
declare const FALLBACK_COLORS_CATEGORICAL: string[];
|
|
14
|
+
/** Fallback sequential colors (light → dark blue) */
|
|
15
|
+
declare const FALLBACK_COLORS_SEQUENTIAL: string[];
|
|
16
|
+
/** Fallback diverging colors (blue → red) */
|
|
17
|
+
declare const FALLBACK_COLORS_DIVERGING: string[];
|
|
18
|
+
/** Legacy: Fallback colors (aliases to categorical) */
|
|
19
|
+
declare const FALLBACK_COLORS: string[];
|
|
20
|
+
//#endregion
|
|
21
|
+
export { CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, FALLBACK_COLORS, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL };
|
|
22
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","names":[],"sources":["../../../src/react/charts/constants.ts"],"sourcesContent":[],"mappings":";;;;cAgBa;AAAb;AAYa,cAAA,2BASH,EAAA,SAAA,CAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,CAAA;AAGV;AAYa,cAZA,0BAqBH,EAAA,SAAA,CAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,EAAA,eAAA,CAAA;AAOV;AAYa,cA5BA,gBAqCZ,EAAA,SAAA,CAAA,WAAA,EAAA,WAAA,EAAA,WAAA,EAAA,WAAA,EAAA,WAAA,EAAA,WAAA,EAAA,WAAA,EAAA,WAAA,CAAA;AAGD;AAYa,cApCA,2BAoC6C,EAAA,MAAA,EAAA;;cAxB7C;;cAYA;;cAYA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { DATE_FIELD_PATTERNS, METADATA_DATE_PATTERNS, NAME_FIELD_PATTERNS } from "../../js/constants.js";
|
|
2
|
+
|
|
3
|
+
//#region src/react/charts/constants.ts
|
|
4
|
+
/** CSS variable names for categorical chart colors (distinct categories) */
|
|
5
|
+
const CHART_COLOR_VARS_CATEGORICAL = [
|
|
6
|
+
"--chart-cat-1",
|
|
7
|
+
"--chart-cat-2",
|
|
8
|
+
"--chart-cat-3",
|
|
9
|
+
"--chart-cat-4",
|
|
10
|
+
"--chart-cat-5",
|
|
11
|
+
"--chart-cat-6",
|
|
12
|
+
"--chart-cat-7",
|
|
13
|
+
"--chart-cat-8"
|
|
14
|
+
];
|
|
15
|
+
/** CSS variable names for sequential chart colors (low → high) */
|
|
16
|
+
const CHART_COLOR_VARS_SEQUENTIAL = [
|
|
17
|
+
"--chart-seq-1",
|
|
18
|
+
"--chart-seq-2",
|
|
19
|
+
"--chart-seq-3",
|
|
20
|
+
"--chart-seq-4",
|
|
21
|
+
"--chart-seq-5",
|
|
22
|
+
"--chart-seq-6",
|
|
23
|
+
"--chart-seq-7",
|
|
24
|
+
"--chart-seq-8"
|
|
25
|
+
];
|
|
26
|
+
/** CSS variable names for diverging chart colors (negative ↔ positive) */
|
|
27
|
+
const CHART_COLOR_VARS_DIVERGING = [
|
|
28
|
+
"--chart-div-1",
|
|
29
|
+
"--chart-div-2",
|
|
30
|
+
"--chart-div-3",
|
|
31
|
+
"--chart-div-4",
|
|
32
|
+
"--chart-div-5",
|
|
33
|
+
"--chart-div-6",
|
|
34
|
+
"--chart-div-7",
|
|
35
|
+
"--chart-div-8"
|
|
36
|
+
];
|
|
37
|
+
/** Legacy: CSS variable names for chart colors (aliases to categorical) */
|
|
38
|
+
const CHART_COLOR_VARS = [
|
|
39
|
+
"--chart-1",
|
|
40
|
+
"--chart-2",
|
|
41
|
+
"--chart-3",
|
|
42
|
+
"--chart-4",
|
|
43
|
+
"--chart-5",
|
|
44
|
+
"--chart-6",
|
|
45
|
+
"--chart-7",
|
|
46
|
+
"--chart-8"
|
|
47
|
+
];
|
|
48
|
+
/** Fallback categorical colors */
|
|
49
|
+
const FALLBACK_COLORS_CATEGORICAL = [
|
|
50
|
+
"hsla(221, 83%, 53%, 1)",
|
|
51
|
+
"hsla(160, 60%, 45%, 1)",
|
|
52
|
+
"hsla(291, 47%, 51%, 1)",
|
|
53
|
+
"hsla(35, 92%, 55%, 1)",
|
|
54
|
+
"hsla(349, 72%, 52%, 1)",
|
|
55
|
+
"hsla(189, 75%, 42%, 1)",
|
|
56
|
+
"hsla(271, 55%, 60%, 1)",
|
|
57
|
+
"hsla(142, 55%, 45%, 1)"
|
|
58
|
+
];
|
|
59
|
+
/** Fallback sequential colors (light → dark blue) */
|
|
60
|
+
const FALLBACK_COLORS_SEQUENTIAL = [
|
|
61
|
+
"hsla(221, 70%, 94%, 1)",
|
|
62
|
+
"hsla(221, 72%, 85%, 1)",
|
|
63
|
+
"hsla(221, 74%, 74%, 1)",
|
|
64
|
+
"hsla(221, 76%, 63%, 1)",
|
|
65
|
+
"hsla(221, 78%, 52%, 1)",
|
|
66
|
+
"hsla(221, 80%, 42%, 1)",
|
|
67
|
+
"hsla(221, 82%, 32%, 1)",
|
|
68
|
+
"hsla(221, 84%, 24%, 1)"
|
|
69
|
+
];
|
|
70
|
+
/** Fallback diverging colors (blue → red) */
|
|
71
|
+
const FALLBACK_COLORS_DIVERGING = [
|
|
72
|
+
"hsla(221, 80%, 35%, 1)",
|
|
73
|
+
"hsla(221, 70%, 50%, 1)",
|
|
74
|
+
"hsla(221, 55%, 65%, 1)",
|
|
75
|
+
"hsla(221, 35%, 82%, 1)",
|
|
76
|
+
"hsla(10, 35%, 82%, 1)",
|
|
77
|
+
"hsla(10, 60%, 65%, 1)",
|
|
78
|
+
"hsla(10, 72%, 50%, 1)",
|
|
79
|
+
"hsla(10, 80%, 40%, 1)"
|
|
80
|
+
];
|
|
81
|
+
/** Legacy: Fallback colors (aliases to categorical) */
|
|
82
|
+
const FALLBACK_COLORS = FALLBACK_COLORS_CATEGORICAL;
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, FALLBACK_COLORS, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL };
|
|
86
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../../../src/react/charts/constants.ts"],"sourcesContent":["// ============================================================================\n// Shared Constants for Chart Components\n// ============================================================================\n\n// Re-export field patterns from shared constants\nexport {\n DATE_FIELD_PATTERNS,\n METADATA_DATE_PATTERNS,\n NAME_FIELD_PATTERNS,\n} from \"@/js/constants\";\n\n// ============================================================================\n// Chart Color Palettes\n// ============================================================================\n\n/** CSS variable names for categorical chart colors (distinct categories) */\nexport const CHART_COLOR_VARS_CATEGORICAL = [\n \"--chart-cat-1\",\n \"--chart-cat-2\",\n \"--chart-cat-3\",\n \"--chart-cat-4\",\n \"--chart-cat-5\",\n \"--chart-cat-6\",\n \"--chart-cat-7\",\n \"--chart-cat-8\",\n] as const;\n\n/** CSS variable names for sequential chart colors (low → high) */\nexport const CHART_COLOR_VARS_SEQUENTIAL = [\n \"--chart-seq-1\",\n \"--chart-seq-2\",\n \"--chart-seq-3\",\n \"--chart-seq-4\",\n \"--chart-seq-5\",\n \"--chart-seq-6\",\n \"--chart-seq-7\",\n \"--chart-seq-8\",\n] as const;\n\n/** CSS variable names for diverging chart colors (negative ↔ positive) */\nexport const CHART_COLOR_VARS_DIVERGING = [\n \"--chart-div-1\",\n \"--chart-div-2\",\n \"--chart-div-3\",\n \"--chart-div-4\",\n \"--chart-div-5\",\n \"--chart-div-6\",\n \"--chart-div-7\",\n \"--chart-div-8\",\n] as const;\n\n/** Legacy: CSS variable names for chart colors (aliases to categorical) */\nexport const CHART_COLOR_VARS = [\n \"--chart-1\",\n \"--chart-2\",\n \"--chart-3\",\n \"--chart-4\",\n \"--chart-5\",\n \"--chart-6\",\n \"--chart-7\",\n \"--chart-8\",\n] as const;\n\n// ============================================================================\n// Fallback Colors (when CSS variables unavailable)\n// ============================================================================\n\n/** Fallback categorical colors */\nexport const FALLBACK_COLORS_CATEGORICAL = [\n \"hsla(221, 83%, 53%, 1)\", // Blue\n \"hsla(160, 60%, 45%, 1)\", // Teal\n \"hsla(291, 47%, 51%, 1)\", // Purple\n \"hsla(35, 92%, 55%, 1)\", // Amber\n \"hsla(349, 72%, 52%, 1)\", // Rose\n \"hsla(189, 75%, 42%, 1)\", // Cyan\n \"hsla(271, 55%, 60%, 1)\", // Lavender\n \"hsla(142, 55%, 45%, 1)\", // Emerald\n];\n\n/** Fallback sequential colors (light → dark blue) */\nexport const FALLBACK_COLORS_SEQUENTIAL = [\n \"hsla(221, 70%, 94%, 1)\",\n \"hsla(221, 72%, 85%, 1)\",\n \"hsla(221, 74%, 74%, 1)\",\n \"hsla(221, 76%, 63%, 1)\",\n \"hsla(221, 78%, 52%, 1)\",\n \"hsla(221, 80%, 42%, 1)\",\n \"hsla(221, 82%, 32%, 1)\",\n \"hsla(221, 84%, 24%, 1)\",\n];\n\n/** Fallback diverging colors (blue → red) */\nexport const FALLBACK_COLORS_DIVERGING = [\n \"hsla(221, 80%, 35%, 1)\", // Strong negative\n \"hsla(221, 70%, 50%, 1)\",\n \"hsla(221, 55%, 65%, 1)\",\n \"hsla(221, 35%, 82%, 1)\", // Weak negative\n \"hsla(10, 35%, 82%, 1)\", // Weak positive\n \"hsla(10, 60%, 65%, 1)\",\n \"hsla(10, 72%, 50%, 1)\",\n \"hsla(10, 80%, 40%, 1)\", // Strong positive\n];\n\n/** Legacy: Fallback colors (aliases to categorical) */\nexport const FALLBACK_COLORS = FALLBACK_COLORS_CATEGORICAL;\n"],"mappings":";;;;AAgBA,MAAa,+BAA+B;CAC1C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,mBAAmB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAOD,MAAa,8BAA8B;CACzC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,6BAA6B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,4BAA4B;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;AAGD,MAAa,kBAAkB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ChartType, UnifiedChartProps } from "./types.js";
|
|
2
|
+
import * as react_jsx_runtime283 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react/charts/create-chart.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Factory function to create chart components.
|
|
8
|
+
* Eliminates boilerplate by generating components with the same pattern.
|
|
9
|
+
*
|
|
10
|
+
* @param chartType - The ECharts chart type
|
|
11
|
+
* @param displayName - Component display name for React DevTools
|
|
12
|
+
* @returns A typed chart component
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* export const BarChart = createChart<BarChartProps>("bar", "BarChart");
|
|
17
|
+
* export const LineChart = createChart<LineChartProps>("line", "LineChart");
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
declare function createChart<TProps extends UnifiedChartProps>(chartType: ChartType, displayName: string): {
|
|
21
|
+
(props: TProps): react_jsx_runtime283.JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { createChart };
|
|
26
|
+
//# sourceMappingURL=create-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-chart.d.ts","names":[],"sources":["../../../src/react/charts/create-chart.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAkBA;;;;;;;;;;;iBAAgB,2BAA2B,8BAC9B;UAGe,SAAM,oBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseChart } from "./base.js";
|
|
2
|
+
import { ChartWrapper } from "./wrapper.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region src/react/charts/create-chart.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Factory function to create chart components.
|
|
8
|
+
* Eliminates boilerplate by generating components with the same pattern.
|
|
9
|
+
*
|
|
10
|
+
* @param chartType - The ECharts chart type
|
|
11
|
+
* @param displayName - Component display name for React DevTools
|
|
12
|
+
* @returns A typed chart component
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* export const BarChart = createChart<BarChartProps>("bar", "BarChart");
|
|
17
|
+
* export const LineChart = createChart<LineChartProps>("line", "LineChart");
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
function createChart(chartType, displayName) {
|
|
21
|
+
const Component = (props) => {
|
|
22
|
+
const { queryKey, parameters, format, transformer, data, height = 300, className, ariaLabel, testId, ...chartProps } = props;
|
|
23
|
+
return /* @__PURE__ */ jsx(ChartWrapper, {
|
|
24
|
+
...data !== void 0 ? {
|
|
25
|
+
data,
|
|
26
|
+
height,
|
|
27
|
+
className,
|
|
28
|
+
ariaLabel,
|
|
29
|
+
testId
|
|
30
|
+
} : {
|
|
31
|
+
queryKey,
|
|
32
|
+
parameters,
|
|
33
|
+
format,
|
|
34
|
+
transformer,
|
|
35
|
+
height,
|
|
36
|
+
className,
|
|
37
|
+
ariaLabel,
|
|
38
|
+
testId: testId ?? `${chartType}-chart-${queryKey}`
|
|
39
|
+
},
|
|
40
|
+
children: (chartData) => /* @__PURE__ */ jsx(BaseChart, {
|
|
41
|
+
data: chartData,
|
|
42
|
+
chartType,
|
|
43
|
+
height,
|
|
44
|
+
className,
|
|
45
|
+
...chartProps
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
Component.displayName = displayName;
|
|
50
|
+
return Component;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { createChart };
|
|
55
|
+
//# sourceMappingURL=create-chart.js.map
|