@dreamtree-org/twreact-ui 1.3.1 → 1.3.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.
Files changed (60) hide show
  1. package/DESIGN.md +2 -2
  2. package/README.md +80 -1
  3. package/ai-skills/dreamtree-ui.md +40 -3
  4. package/charts/package.json +5 -0
  5. package/dist/_shared/cn-DPPQUJu1.js +138 -0
  6. package/dist/ai-schema.json +638 -0
  7. package/dist/charts/index.d.ts +9 -0
  8. package/dist/charts/index.d.ts.map +1 -0
  9. package/dist/charts/index.js +769 -0
  10. package/dist/components/charts/AreaChart.d.ts +4 -0
  11. package/dist/components/charts/AreaChart.d.ts.map +1 -0
  12. package/dist/components/charts/BarChart.d.ts +4 -0
  13. package/dist/components/charts/BarChart.d.ts.map +1 -0
  14. package/dist/components/charts/CartesianChart.d.ts +5 -0
  15. package/dist/components/charts/CartesianChart.d.ts.map +1 -0
  16. package/dist/components/charts/ChartFrame.d.ts +18 -0
  17. package/dist/components/charts/ChartFrame.d.ts.map +1 -0
  18. package/dist/components/charts/DonutChart.d.ts +4 -0
  19. package/dist/components/charts/DonutChart.d.ts.map +1 -0
  20. package/dist/components/charts/LineChart.d.ts +4 -0
  21. package/dist/components/charts/LineChart.d.ts.map +1 -0
  22. package/dist/components/charts/Sparkline.d.ts +5 -0
  23. package/dist/components/charts/Sparkline.d.ts.map +1 -0
  24. package/dist/components/charts/chartTheme.d.ts +26 -0
  25. package/dist/components/charts/chartTheme.d.ts.map +1 -0
  26. package/dist/components/rich-text/RichTextEditor.d.ts +4 -0
  27. package/dist/components/rich-text/RichTextEditor.d.ts.map +1 -0
  28. package/dist/components/rich-text/RichTextToolbar.d.ts +219 -0
  29. package/dist/components/rich-text/RichTextToolbar.d.ts.map +1 -0
  30. package/dist/esm/charts/index.js +5 -0
  31. package/dist/esm/components/charts/AreaChart.js +16 -0
  32. package/dist/esm/components/charts/BarChart.js +16 -0
  33. package/dist/esm/components/charts/CartesianChart.js +250 -0
  34. package/dist/esm/components/charts/ChartFrame.js +170 -0
  35. package/dist/esm/components/charts/DonutChart.js +119 -0
  36. package/dist/esm/components/charts/LineChart.js +16 -0
  37. package/dist/esm/components/charts/Sparkline.js +110 -0
  38. package/dist/esm/components/charts/chartTheme.js +109 -0
  39. package/dist/esm/components/rich-text/RichTextEditor.js +244 -0
  40. package/dist/esm/components/rich-text/RichTextToolbar.js +397 -0
  41. package/dist/esm/rich-text/index.js +1 -0
  42. package/dist/index.css +1 -1
  43. package/dist/index.esm.css +1 -1
  44. package/dist/index.esm.js +17 -4
  45. package/dist/index.js +17 -4
  46. package/dist/rich-text/index.d.ts +5 -0
  47. package/dist/rich-text/index.d.ts.map +1 -0
  48. package/dist/rich-text/index.js +654 -0
  49. package/dist/tokens/brands/studio.css +14 -0
  50. package/dist/tokens/brands/studio.json +20 -0
  51. package/dist/types/charts.d.ts +97 -0
  52. package/dist/types/charts.d.ts.map +1 -0
  53. package/dist/types/rich-text.d.ts +50 -0
  54. package/dist/types/rich-text.d.ts.map +1 -0
  55. package/doc/README.md +13 -0
  56. package/mcp/catalog.snapshot.json +1009 -3
  57. package/mcp/server-core.mjs +30 -1
  58. package/package.json +38 -2
  59. package/rich-text/package.json +5 -0
  60. package/tokens/brands/studio.json +20 -0
@@ -0,0 +1,4 @@
1
+ export default AreaChart;
2
+ declare const AreaChart: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
4
+ //# sourceMappingURL=AreaChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AreaChart.d.ts","sourceRoot":"","sources":["../../../src/components/charts/AreaChart.jsx"],"names":[],"mappings":";AAGA,mFAAwG;kBAHtF,OAAO"}
@@ -0,0 +1,4 @@
1
+ export default BarChart;
2
+ declare const BarChart: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
4
+ //# sourceMappingURL=BarChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BarChart.d.ts","sourceRoot":"","sources":["../../../src/components/charts/BarChart.jsx"],"names":[],"mappings":";AAGA,kFAAsG;kBAHpF,OAAO"}
@@ -0,0 +1,5 @@
1
+ export default CartesianChart;
2
+ /** Shared implementation of LineChart / BarChart / AreaChart. */
3
+ declare const CartesianChart: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
4
+ import React from "react";
5
+ //# sourceMappingURL=CartesianChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CartesianChart.d.ts","sourceRoot":"","sources":["../../../src/components/charts/CartesianChart.jsx"],"names":[],"mappings":";AA0DA,iEAAiE;AACjE,wFAwHG;kBAnLe,OAAO"}
@@ -0,0 +1,18 @@
1
+ export function ChartLegend({ items }: {
2
+ items: any;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ export function ChartTooltipContent({ active, payload, label, valueFormatter, hideLabel }: {
5
+ active: any;
6
+ payload: any;
7
+ label: any;
8
+ valueFormatter: any;
9
+ hideLabel?: boolean | undefined;
10
+ }): import("react/jsx-runtime").JSX.Element | null;
11
+ /**
12
+ * The accessible shell every chart renders: the SVG lives in a `role="img"`
13
+ * region named by `title` and described by `description`; the numbers are
14
+ * repeated in a visually-hidden table (recharts' SVG has no accessible content).
15
+ */
16
+ export const ChartFrame: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
17
+ import React from "react";
18
+ //# sourceMappingURL=ChartFrame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/components/charts/ChartFrame.jsx"],"names":[],"mappings":"AASA;;4CAWC;AAED;;;;;;mDAgBC;AA8BD;;;;GAIG;AACH,mFA4DG;kBArI0B,OAAO"}
@@ -0,0 +1,4 @@
1
+ export default DonutChart;
2
+ declare const DonutChart: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
4
+ //# sourceMappingURL=DonutChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DonutChart.d.ts","sourceRoot":"","sources":["../../../src/components/charts/DonutChart.jsx"],"names":[],"mappings":";AAKA,oFA8EE;kBAnFgB,OAAO"}
@@ -0,0 +1,4 @@
1
+ export default LineChart;
2
+ declare const LineChart: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
4
+ //# sourceMappingURL=LineChart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LineChart.d.ts","sourceRoot":"","sources":["../../../src/components/charts/LineChart.jsx"],"names":[],"mappings":";AAGA,mFAAwG;kBAHtF,OAAO"}
@@ -0,0 +1,5 @@
1
+ export default Sparkline;
2
+ /** A word-sized trend line: no axes, grid or legend — just the shape of the data. */
3
+ declare const Sparkline: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
4
+ import React from "react";
5
+ //# sourceMappingURL=Sparkline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../../src/components/charts/Sparkline.jsx"],"names":[],"mappings":";AAKA,qFAAqF;AACrF,mFAqEE;kBA3EgB,OAAO"}
@@ -0,0 +1,26 @@
1
+ /** `"primary"` → `"--dt-primary-500"`, `"error-300"` → `"--dt-error-300"`; null for anything else. */
2
+ export function tokenVar(color: any): string | null;
3
+ /**
4
+ * A series colour: a palette token (`primary`, `success-600`, …) resolves to the
5
+ * matching `--dt-*` variable; any other string is treated as a CSS colour supplied
6
+ * by the consumer (e.g. a colour stored with the data).
7
+ */
8
+ export function resolveColor(color: any): any;
9
+ export function seriesColors(categories: any, colors: any): any;
10
+ /**
11
+ * Chart chrome + series colours, re-read whenever the theme flips (the `dark`
12
+ * class or `data-theme` on <html>) so axes and series follow dark mode without
13
+ * a remount.
14
+ */
15
+ export function useChartTheme(categories: any, colors: any): {
16
+ chrome: {
17
+ [k: string]: string;
18
+ };
19
+ series: any;
20
+ };
21
+ /** `true` while the user asks the OS for reduced motion; follows changes live. */
22
+ export function useReducedMotion(): boolean;
23
+ export const CHART_PALETTES: string[];
24
+ export const DEFAULT_CHART_COLORS: string[];
25
+ export function defaultValueFormatter(value: any): string;
26
+ //# sourceMappingURL=chartTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chartTheme.d.ts","sourceRoot":"","sources":["../../../src/components/charts/chartTheme.js"],"names":[],"mappings":"AAgBA,sGAAsG;AACtG,oDAGC;AAeD;;;;GAIG;AACH,8CAGC;AAED,gEAGC;AAMD;;;;GAIG;AACH;;;;;EAaC;AAED,kFAAkF;AAClF,4CAYC;AApFD,sCAAsG;AAEtG,4CAA4G;AAoFrG,0DACkF"}
@@ -0,0 +1,4 @@
1
+ export default RichTextEditor;
2
+ declare const RichTextEditor: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
+ import React from "react";
4
+ //# sourceMappingURL=RichTextEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../../src/components/rich-text/RichTextEditor.jsx"],"names":[],"mappings":";AA2BA,wFAsLE;kBAjN+E,OAAO"}
@@ -0,0 +1,219 @@
1
+ /** Toolbar state derived from the editor on every transaction (via useEditorState). */
2
+ export function selectToolbarState(editor: any): {
3
+ isEmpty: any;
4
+ bold: any;
5
+ italic: any;
6
+ strike: any;
7
+ code: any;
8
+ heading1: any;
9
+ heading2: any;
10
+ heading3: any;
11
+ bulletList: any;
12
+ orderedList: any;
13
+ blockquote: any;
14
+ codeBlock: any;
15
+ link: any;
16
+ undo: any;
17
+ redo: any;
18
+ } | null;
19
+ /** Normalises a typed URL; returns null for schemes we refuse (javascript:, data:, …). */
20
+ export function normalizeUrl(raw: any): string | null;
21
+ /**
22
+ * A WAI-ARIA toolbar: one tab stop, arrow keys / Home / End move between the
23
+ * buttons (roving tabindex), toggles report `aria-pressed`.
24
+ */
25
+ export function RichTextToolbar({ editor, state, items, disabled, controlsId, label }: {
26
+ editor: any;
27
+ state: any;
28
+ items: any;
29
+ disabled: any;
30
+ controlsId: any;
31
+ label?: string | undefined;
32
+ }): import("react/jsx-runtime").JSX.Element;
33
+ export namespace TOOLBAR_ITEMS {
34
+ namespace bold {
35
+ export let label: string;
36
+ export { Bold as icon };
37
+ export let group: string;
38
+ export let shortcut: string;
39
+ export let toggle: boolean;
40
+ export function run(c: any): any;
41
+ }
42
+ namespace italic {
43
+ let label_1: string;
44
+ export { label_1 as label };
45
+ export { Italic as icon };
46
+ let group_1: string;
47
+ export { group_1 as group };
48
+ let shortcut_1: string;
49
+ export { shortcut_1 as shortcut };
50
+ let toggle_1: boolean;
51
+ export { toggle_1 as toggle };
52
+ export function run_1(c: any): any;
53
+ export { run_1 as run };
54
+ }
55
+ namespace strike {
56
+ let label_2: string;
57
+ export { label_2 as label };
58
+ export { Strikethrough as icon };
59
+ let group_2: string;
60
+ export { group_2 as group };
61
+ let shortcut_2: string;
62
+ export { shortcut_2 as shortcut };
63
+ let toggle_2: boolean;
64
+ export { toggle_2 as toggle };
65
+ export function run_2(c: any): any;
66
+ export { run_2 as run };
67
+ }
68
+ namespace code {
69
+ let label_3: string;
70
+ export { label_3 as label };
71
+ export { Code as icon };
72
+ let group_3: string;
73
+ export { group_3 as group };
74
+ let shortcut_3: string;
75
+ export { shortcut_3 as shortcut };
76
+ let toggle_3: boolean;
77
+ export { toggle_3 as toggle };
78
+ export function run_3(c: any): any;
79
+ export { run_3 as run };
80
+ }
81
+ namespace heading1 {
82
+ let label_4: string;
83
+ export { label_4 as label };
84
+ export { Heading1 as icon };
85
+ let group_4: string;
86
+ export { group_4 as group };
87
+ let shortcut_4: string;
88
+ export { shortcut_4 as shortcut };
89
+ let toggle_4: boolean;
90
+ export { toggle_4 as toggle };
91
+ export function run_4(c: any): any;
92
+ export { run_4 as run };
93
+ }
94
+ namespace heading2 {
95
+ let label_5: string;
96
+ export { label_5 as label };
97
+ export { Heading2 as icon };
98
+ let group_5: string;
99
+ export { group_5 as group };
100
+ let shortcut_5: string;
101
+ export { shortcut_5 as shortcut };
102
+ let toggle_5: boolean;
103
+ export { toggle_5 as toggle };
104
+ export function run_5(c: any): any;
105
+ export { run_5 as run };
106
+ }
107
+ namespace heading3 {
108
+ let label_6: string;
109
+ export { label_6 as label };
110
+ export { Heading3 as icon };
111
+ let group_6: string;
112
+ export { group_6 as group };
113
+ let shortcut_6: string;
114
+ export { shortcut_6 as shortcut };
115
+ let toggle_6: boolean;
116
+ export { toggle_6 as toggle };
117
+ export function run_6(c: any): any;
118
+ export { run_6 as run };
119
+ }
120
+ namespace bulletList {
121
+ let label_7: string;
122
+ export { label_7 as label };
123
+ export { List as icon };
124
+ let group_7: string;
125
+ export { group_7 as group };
126
+ let shortcut_7: string;
127
+ export { shortcut_7 as shortcut };
128
+ let toggle_7: boolean;
129
+ export { toggle_7 as toggle };
130
+ export function run_7(c: any): any;
131
+ export { run_7 as run };
132
+ }
133
+ namespace orderedList {
134
+ let label_8: string;
135
+ export { label_8 as label };
136
+ export { ListOrdered as icon };
137
+ let group_8: string;
138
+ export { group_8 as group };
139
+ let shortcut_8: string;
140
+ export { shortcut_8 as shortcut };
141
+ let toggle_8: boolean;
142
+ export { toggle_8 as toggle };
143
+ export function run_8(c: any): any;
144
+ export { run_8 as run };
145
+ }
146
+ namespace blockquote {
147
+ let label_9: string;
148
+ export { label_9 as label };
149
+ export { Quote as icon };
150
+ let group_9: string;
151
+ export { group_9 as group };
152
+ let shortcut_9: string;
153
+ export { shortcut_9 as shortcut };
154
+ let toggle_9: boolean;
155
+ export { toggle_9 as toggle };
156
+ export function run_9(c: any): any;
157
+ export { run_9 as run };
158
+ }
159
+ namespace codeBlock {
160
+ let label_10: string;
161
+ export { label_10 as label };
162
+ export { SquareCode as icon };
163
+ let group_10: string;
164
+ export { group_10 as group };
165
+ let shortcut_10: string;
166
+ export { shortcut_10 as shortcut };
167
+ let toggle_10: boolean;
168
+ export { toggle_10 as toggle };
169
+ export function run_10(c: any): any;
170
+ export { run_10 as run };
171
+ }
172
+ namespace link {
173
+ let label_11: string;
174
+ export { label_11 as label };
175
+ export { LinkIcon as icon };
176
+ let group_11: string;
177
+ export { group_11 as group };
178
+ let toggle_11: boolean;
179
+ export { toggle_11 as toggle };
180
+ }
181
+ namespace undo {
182
+ let label_12: string;
183
+ export { label_12 as label };
184
+ export { Undo as icon };
185
+ let group_12: string;
186
+ export { group_12 as group };
187
+ let shortcut_11: string;
188
+ export { shortcut_11 as shortcut };
189
+ export function run_11(c: any): any;
190
+ export { run_11 as run };
191
+ }
192
+ namespace redo {
193
+ let label_13: string;
194
+ export { label_13 as label };
195
+ export { Redo as icon };
196
+ let group_13: string;
197
+ export { group_13 as group };
198
+ let shortcut_12: string;
199
+ export { shortcut_12 as shortcut };
200
+ export function run_12(c: any): any;
201
+ export { run_12 as run };
202
+ }
203
+ }
204
+ export const DEFAULT_TOOLBAR: string[];
205
+ import { Bold } from "lucide-react";
206
+ import { Italic } from "lucide-react";
207
+ import { Strikethrough } from "lucide-react";
208
+ import { Code } from "lucide-react";
209
+ import { Heading1 } from "lucide-react";
210
+ import { Heading2 } from "lucide-react";
211
+ import { Heading3 } from "lucide-react";
212
+ import { List } from "lucide-react";
213
+ import { ListOrdered } from "lucide-react";
214
+ import { Quote } from "lucide-react";
215
+ import { SquareCode } from "lucide-react";
216
+ import { Link as LinkIcon } from "lucide-react";
217
+ import { Undo } from "lucide-react";
218
+ import { Redo } from "lucide-react";
219
+ //# sourceMappingURL=RichTextToolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RichTextToolbar.d.ts","sourceRoot":"","sources":["../../../src/components/rich-text/RichTextToolbar.jsx"],"names":[],"mappings":"AAuDA,uFAAuF;AACvF;;;;;;;;;;;;;;;;SAmBC;AAKD,0FAA0F;AAC1F,sDAMC;AAsFD;;;GAGG;AACH;;;;;;;4CAkFC;;;;;;;;QA3O0F,iCAAqB;;;;;;;;;;;;QACf,mCAAuB;;;;;;;;;;;;;QACH,mCAAuB;;;;;;;;;;;;;QAC1C,mCAAqB;;;;;;;;;;;;;QACV,mCAAoC;;;;;;;;;;;;;QACpC,mCAAoC;;;;;;;;;;;;;QACpC,mCAAoC;;;;;;;;;;;;;QAChC,mCAA2B;;;;;;;;;;;;;QACnB,mCAA4B;;;;;;;;;;;;;QAC3C,mCAA2B;;;;;;;;;;;;;QACpB,oCAA0B;;;;;;;;;;;;;;;;;;;;QAE5D,oCAAe;;;;;;;;;;;QACT,oCAAe;;;;AAGpG,uCAaE;qBArCK,cAAc;uBAAd,cAAc;8BAAd,cAAc;qBAAd,cAAc;yBAAd,cAAc;yBAAd,cAAc;yBAAd,cAAc;qBAAd,cAAc;4BAAd,cAAc;sBAAd,cAAc;2BAAd,cAAc;iCAAd,cAAc;qBAAd,cAAc;qBAAd,cAAc"}
@@ -0,0 +1,5 @@
1
+ export { default as LineChart } from '../components/charts/LineChart.js';
2
+ export { default as BarChart } from '../components/charts/BarChart.js';
3
+ export { default as AreaChart } from '../components/charts/AreaChart.js';
4
+ export { default as DonutChart } from '../components/charts/DonutChart.js';
5
+ export { default as Sparkline } from '../components/charts/Sparkline.js';
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React from 'react';
5
+ import CartesianChart from './CartesianChart.js';
6
+
7
+ var AreaChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
8
+ return jsx(CartesianChart, _objectSpread2(_objectSpread2({
9
+ ref: ref
10
+ }, props), {}, {
11
+ kind: "area"
12
+ }));
13
+ });
14
+ AreaChart.displayName = "AreaChart";
15
+
16
+ export { AreaChart as default };
@@ -0,0 +1,16 @@
1
+ 'use client';
2
+ import { objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import React from 'react';
5
+ import CartesianChart from './CartesianChart.js';
6
+
7
+ var BarChart = /*#__PURE__*/React.forwardRef(function (props, ref) {
8
+ return jsx(CartesianChart, _objectSpread2(_objectSpread2({
9
+ ref: ref
10
+ }, props), {}, {
11
+ kind: "bar"
12
+ }));
13
+ });
14
+ BarChart.displayName = "BarChart";
15
+
16
+ export { BarChart as default };
@@ -0,0 +1,250 @@
1
+ 'use client';
2
+ import { objectWithoutProperties as _objectWithoutProperties, objectSpread2 as _objectSpread2, toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+ import React from 'react';
5
+ import { ResponsiveContainer, AreaChart, BarChart, LineChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar, Area, Line } from 'recharts';
6
+ import { ChartFrame, ChartTooltipContent } from './ChartFrame.js';
7
+ import { useChartTheme, useReducedMotion, defaultValueFormatter } from './chartTheme.js';
8
+
9
+ var _excluded = ["kind", "data", "index", "categories", "colors", "valueFormatter", "xAxisFormatter", "height", "showLegend", "showTooltip", "showXAxis", "showYAxis", "showGrid", "yAxisWidth", "curveType", "stacked", "horizontal", "showDots", "connectNulls", "animate", "title", "description", "emptyState", "accessibleTable", "className"];
10
+ var ROOTS = {
11
+ line: LineChart,
12
+ bar: BarChart,
13
+ area: AreaChart
14
+ };
15
+ var TITLES = {
16
+ line: "Line chart",
17
+ bar: "Bar chart",
18
+ area: "Area chart"
19
+ };
20
+ var CURVES = {
21
+ linear: "linear",
22
+ monotone: "monotone",
23
+ step: "step",
24
+ natural: "natural"
25
+ };
26
+ function renderSeries(kind, _ref) {
27
+ var category = _ref.category,
28
+ color = _ref.color,
29
+ curve = _ref.curve,
30
+ stacked = _ref.stacked,
31
+ showDots = _ref.showDots,
32
+ connectNulls = _ref.connectNulls,
33
+ animate = _ref.animate,
34
+ horizontal = _ref.horizontal,
35
+ barRadius = _ref.barRadius;
36
+ var common = {
37
+ dataKey: category,
38
+ name: category,
39
+ isAnimationActive: animate
40
+ };
41
+ if (kind === "bar") {
42
+ var radius = horizontal ? [0, barRadius, barRadius, 0] : [barRadius, barRadius, 0, 0];
43
+ return jsx(Bar, _objectSpread2(_objectSpread2({}, common), {}, {
44
+ fill: color,
45
+ stackId: stacked ? "stack" : undefined,
46
+ radius: stacked ? 0 : radius,
47
+ maxBarSize: 48
48
+ }), category);
49
+ }
50
+ if (kind === "area") {
51
+ return jsx(Area, _objectSpread2(_objectSpread2({}, common), {}, {
52
+ type: curve,
53
+ stroke: color,
54
+ fill: color,
55
+ fillOpacity: stacked ? 0.4 : 0.15,
56
+ strokeWidth: 2,
57
+ stackId: stacked ? "stack" : undefined,
58
+ dot: showDots ? {
59
+ r: 3,
60
+ fill: color,
61
+ strokeWidth: 0
62
+ } : false,
63
+ activeDot: {
64
+ r: 4,
65
+ strokeWidth: 0,
66
+ fill: color
67
+ },
68
+ connectNulls: connectNulls
69
+ }), category);
70
+ }
71
+ return jsx(Line, _objectSpread2(_objectSpread2({}, common), {}, {
72
+ type: curve,
73
+ stroke: color,
74
+ strokeWidth: 2,
75
+ dot: showDots ? {
76
+ r: 3,
77
+ fill: color,
78
+ strokeWidth: 0
79
+ } : false,
80
+ activeDot: {
81
+ r: 4,
82
+ strokeWidth: 0,
83
+ fill: color
84
+ },
85
+ connectNulls: connectNulls
86
+ }), category);
87
+ }
88
+ /** Shared implementation of LineChart / BarChart / AreaChart. */
89
+ var CartesianChart = /*#__PURE__*/React.forwardRef(function CartesianChart(_ref2, ref) {
90
+ var kind = _ref2.kind,
91
+ data = _ref2.data,
92
+ index = _ref2.index,
93
+ _ref2$categories = _ref2.categories,
94
+ categories = _ref2$categories === void 0 ? [] : _ref2$categories,
95
+ colors = _ref2.colors,
96
+ _ref2$valueFormatter = _ref2.valueFormatter,
97
+ valueFormatter = _ref2$valueFormatter === void 0 ? defaultValueFormatter : _ref2$valueFormatter,
98
+ xAxisFormatter = _ref2.xAxisFormatter,
99
+ _ref2$height = _ref2.height,
100
+ height = _ref2$height === void 0 ? 300 : _ref2$height,
101
+ _ref2$showLegend = _ref2.showLegend,
102
+ showLegend = _ref2$showLegend === void 0 ? true : _ref2$showLegend,
103
+ _ref2$showTooltip = _ref2.showTooltip,
104
+ showTooltip = _ref2$showTooltip === void 0 ? true : _ref2$showTooltip,
105
+ _ref2$showXAxis = _ref2.showXAxis,
106
+ showXAxis = _ref2$showXAxis === void 0 ? true : _ref2$showXAxis,
107
+ _ref2$showYAxis = _ref2.showYAxis,
108
+ showYAxis = _ref2$showYAxis === void 0 ? true : _ref2$showYAxis,
109
+ _ref2$showGrid = _ref2.showGrid,
110
+ showGrid = _ref2$showGrid === void 0 ? true : _ref2$showGrid,
111
+ _ref2$yAxisWidth = _ref2.yAxisWidth,
112
+ yAxisWidth = _ref2$yAxisWidth === void 0 ? 48 : _ref2$yAxisWidth,
113
+ _ref2$curveType = _ref2.curveType,
114
+ curveType = _ref2$curveType === void 0 ? "monotone" : _ref2$curveType,
115
+ _ref2$stacked = _ref2.stacked,
116
+ stacked = _ref2$stacked === void 0 ? false : _ref2$stacked,
117
+ _ref2$horizontal = _ref2.horizontal,
118
+ horizontal = _ref2$horizontal === void 0 ? false : _ref2$horizontal,
119
+ _ref2$showDots = _ref2.showDots,
120
+ showDots = _ref2$showDots === void 0 ? false : _ref2$showDots,
121
+ _ref2$connectNulls = _ref2.connectNulls,
122
+ connectNulls = _ref2$connectNulls === void 0 ? false : _ref2$connectNulls,
123
+ _ref2$animate = _ref2.animate,
124
+ animate = _ref2$animate === void 0 ? true : _ref2$animate,
125
+ title = _ref2.title,
126
+ description = _ref2.description,
127
+ emptyState = _ref2.emptyState,
128
+ _ref2$accessibleTable = _ref2.accessibleTable,
129
+ accessibleTable = _ref2$accessibleTable === void 0 ? true : _ref2$accessibleTable,
130
+ className = _ref2.className,
131
+ rest = _objectWithoutProperties(_ref2, _excluded);
132
+ var _useChartTheme = useChartTheme(categories, colors),
133
+ chrome = _useChartTheme.chrome,
134
+ series = _useChartTheme.series;
135
+ var reducedMotion = useReducedMotion();
136
+ var Root = ROOTS[kind];
137
+ var isHorizontalBars = kind === "bar" && horizontal;
138
+ var curve = CURVES[curveType] || "monotone";
139
+ var tick = {
140
+ fill: chrome.axis,
141
+ fontSize: 12
142
+ };
143
+ var formatIndex = xAxisFormatter || function (v) {
144
+ return v == null ? "" : String(v);
145
+ };
146
+ var categoryAxis = {
147
+ dataKey: index,
148
+ tick: tick,
149
+ tickLine: false,
150
+ axisLine: false,
151
+ tickFormatter: xAxisFormatter,
152
+ hide: !showXAxis,
153
+ minTickGap: 8
154
+ };
155
+ var valueAxis = {
156
+ tick: tick,
157
+ tickLine: false,
158
+ axisLine: false,
159
+ tickFormatter: valueFormatter,
160
+ hide: !showYAxis,
161
+ width: yAxisWidth
162
+ };
163
+ return jsx(ChartFrame, _objectSpread2(_objectSpread2({
164
+ ref: ref,
165
+ className: className,
166
+ title: title,
167
+ description: description,
168
+ defaultTitle: TITLES[kind],
169
+ data: data,
170
+ height: height,
171
+ emptyState: emptyState,
172
+ accessibleTable: accessibleTable,
173
+ legend: showLegend ? categories.map(function (c, i) {
174
+ return {
175
+ name: c,
176
+ color: series[i]
177
+ };
178
+ }) : null,
179
+ tableColumns: [{
180
+ key: index,
181
+ label: index,
182
+ format: formatIndex
183
+ }].concat(_toConsumableArray(categories.map(function (c) {
184
+ return {
185
+ key: c,
186
+ label: c,
187
+ format: valueFormatter
188
+ };
189
+ })))
190
+ }, rest), {}, {
191
+ children: jsx(ResponsiveContainer, {
192
+ width: "100%",
193
+ height: "100%",
194
+ minWidth: 0,
195
+ children: jsxs(Root, {
196
+ data: data,
197
+ layout: isHorizontalBars ? "vertical" : "horizontal",
198
+ margin: {
199
+ top: 8,
200
+ right: 8,
201
+ bottom: 0,
202
+ left: 0
203
+ },
204
+ accessibilityLayer: false,
205
+ children: [showGrid && jsx(CartesianGrid, {
206
+ stroke: chrome.grid,
207
+ strokeDasharray: "3 3",
208
+ vertical: isHorizontalBars,
209
+ horizontal: !isHorizontalBars
210
+ }), isHorizontalBars ? jsx(XAxis, _objectSpread2(_objectSpread2({
211
+ type: "number"
212
+ }, valueAxis), {}, {
213
+ hide: !showXAxis,
214
+ width: undefined
215
+ })) : jsx(XAxis, _objectSpread2({}, categoryAxis)), isHorizontalBars ? jsx(YAxis, _objectSpread2(_objectSpread2({
216
+ type: "category"
217
+ }, categoryAxis), {}, {
218
+ hide: !showYAxis,
219
+ width: yAxisWidth,
220
+ interval: 0
221
+ })) : jsx(YAxis, _objectSpread2({}, valueAxis)), showTooltip && jsx(Tooltip, {
222
+ cursor: kind === "bar" ? {
223
+ fill: chrome.grid,
224
+ fillOpacity: 0.4
225
+ } : {
226
+ stroke: chrome.grid
227
+ },
228
+ isAnimationActive: false,
229
+ content: jsx(ChartTooltipContent, {
230
+ valueFormatter: valueFormatter
231
+ })
232
+ }), categories.map(function (category, i) {
233
+ return renderSeries(kind, {
234
+ category: category,
235
+ color: series[i],
236
+ curve: curve,
237
+ stacked: stacked,
238
+ showDots: showDots,
239
+ connectNulls: connectNulls,
240
+ animate: animate && !reducedMotion,
241
+ horizontal: isHorizontalBars,
242
+ barRadius: 4
243
+ });
244
+ })]
245
+ })
246
+ })
247
+ }));
248
+ });
249
+
250
+ export { CartesianChart as default };