@dreamtree-org/twreact-ui 2.0.4 → 2.0.6
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 +12 -4
- package/ai-skills/dreamtree-ui.md +4 -3
- package/dist/ai-schema.json +135 -0
- package/dist/charts/index.d.ts +2 -1
- package/dist/charts/index.js +298 -13
- package/dist/components/charts/ChartFrame.d.ts +1 -0
- package/dist/components/charts/ChartFrame.d.ts.map +1 -1
- package/dist/components/charts/ScatterChart.d.ts +4 -0
- package/dist/components/charts/ScatterChart.d.ts.map +1 -0
- package/dist/components/charts/ScatterTooltip.d.ts +14 -0
- package/dist/components/charts/ScatterTooltip.d.ts.map +1 -0
- package/dist/components/charts/scatterData.d.ts +17 -0
- package/dist/components/charts/scatterData.d.ts.map +1 -0
- package/dist/components/core/Popover.d.ts.map +1 -1
- package/dist/components/feedback/Tour.d.ts.map +1 -1
- package/dist/components/navigation/Sidebar.d.ts.map +1 -1
- package/dist/components/utility/Sortable.d.ts.map +1 -1
- package/dist/components/utility/SortableGroup.d.ts +15 -0
- package/dist/components/utility/SortableGroup.d.ts.map +1 -0
- package/dist/esm/charts/index.js +1 -0
- package/dist/esm/components/charts/ChartFrame.js +6 -6
- package/dist/esm/components/charts/ScatterChart.js +204 -0
- package/dist/esm/components/charts/ScatterTooltip.js +61 -0
- package/dist/esm/components/charts/scatterData.js +43 -0
- package/dist/esm/components/core/Accordion.js +2 -2
- package/dist/esm/components/core/DatePicker.js +3 -3
- package/dist/esm/components/core/DateRangePicker.js +3 -3
- package/dist/esm/components/core/Form.js +3 -3
- package/dist/esm/components/core/LocationPicker.js +1 -1
- package/dist/esm/components/core/Popover.js +1 -1
- package/dist/esm/components/core/Select.js +16 -16
- package/dist/esm/components/core/Table/Table.js +1 -1
- package/dist/esm/components/core/internal/Calendar.js +2 -2
- package/dist/esm/components/feedback/Drawer.js +5 -5
- package/dist/esm/components/feedback/Tour.js +1 -1
- package/dist/esm/components/rich-text/RichTextEditor.js +2 -2
- package/dist/esm/components/rich-text/RichTextToolbar.js +1 -1
- package/dist/esm/components/utility/Pagination.js +1 -1
- package/dist/esm/components/utility/Sortable.js +70 -48
- package/dist/esm/components/utility/SortableGroup.js +48 -0
- package/dist/esm/hooks/useSortable.js +96 -30
- package/dist/esm/hooks/useSortableGroup.js +268 -0
- package/dist/esm/index.js +1 -0
- package/dist/hooks/useSortable.d.ts +12 -3
- package/dist/hooks/useSortable.d.ts.map +1 -1
- package/dist/hooks/useSortableGroup.d.ts +43 -0
- package/dist/hooks/useSortableGroup.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +904 -513
- package/dist/index.js +904 -512
- package/dist/rich-text/index.js +3 -3
- package/dist/types/charts.d.ts +28 -0
- package/dist/types/charts.d.ts.map +1 -1
- package/dist/types/index.d.ts +33 -0
- package/dist/types/index.d.ts.map +1 -1
- package/doc/README.md +2 -0
- package/mcp/catalog.snapshot.json +248 -28
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ export function ChartTooltipContent({ active, payload, label, valueFormatter, hi
|
|
|
8
8
|
valueFormatter: any;
|
|
9
9
|
hideLabel?: boolean | undefined;
|
|
10
10
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export function swatch(size: any): string;
|
|
11
12
|
/**
|
|
12
13
|
* The accessible shell every chart renders: the SVG lives in a `role="img"`
|
|
13
14
|
* region named by `title` and described by `description`; the numbers are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/components/charts/ChartFrame.jsx"],"names":[],"mappings":"AAcA;;4CAWC;AAED;;;;;;mDAgBC;
|
|
1
|
+
{"version":3,"file":"ChartFrame.d.ts","sourceRoot":"","sources":["../../../src/components/charts/ChartFrame.jsx"],"names":[],"mappings":"AAcA;;4CAWC;AAED;;;;;;mDAgBC;AAtCM,0CAAwG;AAoE/G;;;;GAIG;AACH,mFA6DG;kBA3I0B,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScatterChart.d.ts","sourceRoot":"","sources":["../../../src/components/charts/ScatterChart.jsx"],"names":[],"mappings":";AASA,sFAyHG;kBAlIe,OAAO"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tooltip for one ScatterChart point: the entity (`index`) or series name as the
|
|
3
|
+
* heading, then the series (when both are set) and the formatted x and y values.
|
|
4
|
+
*/
|
|
5
|
+
export default function ScatterTooltipContent({ active, payload, index, category, colorFor, x, y }: {
|
|
6
|
+
active: any;
|
|
7
|
+
payload: any;
|
|
8
|
+
index: any;
|
|
9
|
+
category: any;
|
|
10
|
+
colorFor?: {} | undefined;
|
|
11
|
+
x: any;
|
|
12
|
+
y: any;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
14
|
+
//# sourceMappingURL=ScatterTooltip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScatterTooltip.d.ts","sourceRoot":"","sources":["../../../src/components/charts/ScatterTooltip.jsx"],"names":[],"mappings":"AAIA;;;GAGG;AACH;;;;;;;;mDA4BC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Axis domain. recharts draws a zero-width scale for a single distinct value, so
|
|
3
|
+
* pad around it; otherwise let recharts pick nice bounds.
|
|
4
|
+
*/
|
|
5
|
+
export function scatterDomain(values: any): string[] | number[];
|
|
6
|
+
/** Rows with a numeric x and y, split into series by the `category` key (first-seen order). */
|
|
7
|
+
export function groupScatter(data: any, { x, y, category }: {
|
|
8
|
+
x: any;
|
|
9
|
+
y: any;
|
|
10
|
+
category: any;
|
|
11
|
+
}): {
|
|
12
|
+
rows: any[];
|
|
13
|
+
names: any[];
|
|
14
|
+
groups: Map<any, any>;
|
|
15
|
+
};
|
|
16
|
+
export function textOf(v: any): string;
|
|
17
|
+
//# sourceMappingURL=scatterData.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scatterData.d.ts","sourceRoot":"","sources":["../../../src/components/charts/scatterData.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,gEAOC;AAED,+FAA+F;AAC/F;;;;;;;;EASC;AAzBM,uCAAkD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/core/Popover.jsx"],"names":[],"mappings":";AA0BA,
|
|
1
|
+
{"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/components/core/Popover.jsx"],"names":[],"mappings":";AA0BA,iFAuIG;kBAjK0D,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tour.d.ts","sourceRoot":"","sources":["../../../src/components/feedback/Tour.jsx"],"names":[],"mappings":";AAwCA,
|
|
1
|
+
{"version":3,"file":"Tour.d.ts","sourceRoot":"","sources":["../../../src/components/feedback/Tour.jsx"],"names":[],"mappings":";AAwCA,8EA8LG;kBAtOoF,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/Sidebar.jsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Sidebar.d.ts","sourceRoot":"","sources":["../../../src/components/navigation/Sidebar.jsx"],"names":[],"mappings":"AAoBA,oCAAqC,oBAAoB,CAAC;;AAoJ1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,iFAglBG;kBAzwBI,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sortable.d.ts","sourceRoot":"","sources":["../../../src/components/utility/Sortable.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Sortable.d.ts","sourceRoot":"","sources":["../../../src/components/utility/Sortable.jsx"],"names":[],"mappings":";AASA,kFAmIG;kBA5I0G,OAAO"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Where an item from another list would land; styled by whether `canDrop` allows it. */
|
|
2
|
+
export function SortablePlaceholder({ as: Tag, allowed }: {
|
|
3
|
+
as: any;
|
|
4
|
+
allowed: any;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default SortableGroup;
|
|
7
|
+
/**
|
|
8
|
+
* Connects several `<Sortable id="…">` lists so items can move between them
|
|
9
|
+
* (pointer drag, or the cross-axis arrow keys while an item is picked up).
|
|
10
|
+
* `canDrop(item, target, from)` is asked before a target is shown as droppable;
|
|
11
|
+
* a refused target is marked as such and dropping there does nothing.
|
|
12
|
+
*/
|
|
13
|
+
declare const SortableGroup: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
|
14
|
+
import React from "react";
|
|
15
|
+
//# sourceMappingURL=SortableGroup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SortableGroup.d.ts","sourceRoot":"","sources":["../../../src/components/utility/SortableGroup.jsx"],"names":[],"mappings":"AAuBA,yFAAyF;AACzF;;;4CAaC;;AAjCD;;;;;GAKG;AACH,uFASG;kBAnB+B,OAAO"}
|
package/dist/esm/charts/index.js
CHANGED
|
@@ -3,3 +3,4 @@ export { default as BarChart } from '../components/charts/BarChart.js';
|
|
|
3
3
|
export { default as AreaChart } from '../components/charts/AreaChart.js';
|
|
4
4
|
export { default as DonutChart } from '../components/charts/DonutChart.js';
|
|
5
5
|
export { default as Sparkline } from '../components/charts/Sparkline.js';
|
|
6
|
+
export { default as ScatterChart } from '../components/charts/ScatterChart.js';
|
|
@@ -50,7 +50,7 @@ function ChartTooltipContent(_ref2) {
|
|
|
50
50
|
hideLabel = _ref2$hideLabel === void 0 ? false : _ref2$hideLabel;
|
|
51
51
|
if (!active || !payload || !payload.length) return null;
|
|
52
52
|
return jsxs("div", {
|
|
53
|
-
className: "rounded-md border border-
|
|
53
|
+
className: "rounded-md border border-line bg-surface px-3 py-2 text-xs text-foreground shadow-md",
|
|
54
54
|
"data-chart-tooltip": "",
|
|
55
55
|
children: [!hideLabel && label != null && label !== "" && jsx("p", {
|
|
56
56
|
className: "mb-1 font-medium",
|
|
@@ -90,11 +90,11 @@ function ChartDataTable(_ref3) {
|
|
|
90
90
|
children: caption
|
|
91
91
|
}), jsx("thead", {
|
|
92
92
|
children: jsx("tr", {
|
|
93
|
-
children: columns.map(function (c) {
|
|
93
|
+
children: columns.map(function (c, i) {
|
|
94
94
|
return jsx("th", {
|
|
95
95
|
scope: "col",
|
|
96
96
|
children: c.label
|
|
97
|
-
}, c.key);
|
|
97
|
+
}, "".concat(c.key, "-").concat(i));
|
|
98
98
|
})
|
|
99
99
|
})
|
|
100
100
|
}), jsx("tbody", {
|
|
@@ -104,9 +104,9 @@ function ChartDataTable(_ref3) {
|
|
|
104
104
|
return i === 0 ? jsx("th", {
|
|
105
105
|
scope: "row",
|
|
106
106
|
children: c.format(row[c.key])
|
|
107
|
-
}, c.key) : jsx("td", {
|
|
107
|
+
}, "".concat(c.key, "-").concat(i)) : jsx("td", {
|
|
108
108
|
children: c.format(row[c.key])
|
|
109
|
-
}, c.key);
|
|
109
|
+
}, "".concat(c.key, "-").concat(i));
|
|
110
110
|
})
|
|
111
111
|
}, r);
|
|
112
112
|
})
|
|
@@ -174,4 +174,4 @@ var ChartFrame = /*#__PURE__*/React.forwardRef(function ChartFrame(_ref4, ref) {
|
|
|
174
174
|
}));
|
|
175
175
|
});
|
|
176
176
|
|
|
177
|
-
export { ChartFrame, ChartLegend, ChartTooltipContent };
|
|
177
|
+
export { ChartFrame, ChartLegend, ChartTooltipContent, swatch };
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, 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, ScatterChart as ScatterChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Scatter } from 'recharts';
|
|
6
|
+
import { ChartFrame } from './ChartFrame.js';
|
|
7
|
+
import ScatterTooltipContent from './ScatterTooltip.js';
|
|
8
|
+
import { useChartTheme, useChartId, defaultValueFormatter } from './chartTheme.js';
|
|
9
|
+
import { useElementWidth, tickGapFor, yAxisWidthFor } from './useChartLayout.js';
|
|
10
|
+
import { groupScatter, scatterDomain, textOf } from './scatterData.js';
|
|
11
|
+
import { useReducedMotion } from '../../hooks/useReducedMotion.js';
|
|
12
|
+
|
|
13
|
+
var _excluded = ["data", "x", "y", "index", "category", "colors", "valueFormatter", "xAxisFormatter", "xAxisLabel", "yAxisLabel", "height", "aspectRatio", "showLegend", "showTooltip", "showXAxis", "showYAxis", "showGrid", "yAxisWidth", "animate", "title", "description", "emptyState", "accessibleTable", "className"];
|
|
14
|
+
var ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(_ref, ref) {
|
|
15
|
+
var data = _ref.data,
|
|
16
|
+
x = _ref.x,
|
|
17
|
+
y = _ref.y,
|
|
18
|
+
index = _ref.index,
|
|
19
|
+
category = _ref.category,
|
|
20
|
+
colors = _ref.colors,
|
|
21
|
+
_ref$valueFormatter = _ref.valueFormatter,
|
|
22
|
+
valueFormatter = _ref$valueFormatter === void 0 ? defaultValueFormatter : _ref$valueFormatter,
|
|
23
|
+
_ref$xAxisFormatter = _ref.xAxisFormatter,
|
|
24
|
+
xAxisFormatter = _ref$xAxisFormatter === void 0 ? defaultValueFormatter : _ref$xAxisFormatter,
|
|
25
|
+
xAxisLabel = _ref.xAxisLabel,
|
|
26
|
+
yAxisLabel = _ref.yAxisLabel,
|
|
27
|
+
_ref$height = _ref.height,
|
|
28
|
+
height = _ref$height === void 0 ? 300 : _ref$height,
|
|
29
|
+
aspectRatio = _ref.aspectRatio,
|
|
30
|
+
_ref$showLegend = _ref.showLegend,
|
|
31
|
+
showLegend = _ref$showLegend === void 0 ? true : _ref$showLegend,
|
|
32
|
+
_ref$showTooltip = _ref.showTooltip,
|
|
33
|
+
showTooltip = _ref$showTooltip === void 0 ? true : _ref$showTooltip,
|
|
34
|
+
_ref$showXAxis = _ref.showXAxis,
|
|
35
|
+
showXAxis = _ref$showXAxis === void 0 ? true : _ref$showXAxis,
|
|
36
|
+
_ref$showYAxis = _ref.showYAxis,
|
|
37
|
+
showYAxis = _ref$showYAxis === void 0 ? true : _ref$showYAxis,
|
|
38
|
+
_ref$showGrid = _ref.showGrid,
|
|
39
|
+
showGrid = _ref$showGrid === void 0 ? true : _ref$showGrid,
|
|
40
|
+
yAxisWidth = _ref.yAxisWidth,
|
|
41
|
+
_ref$animate = _ref.animate,
|
|
42
|
+
animate = _ref$animate === void 0 ? true : _ref$animate,
|
|
43
|
+
title = _ref.title,
|
|
44
|
+
description = _ref.description,
|
|
45
|
+
emptyState = _ref.emptyState,
|
|
46
|
+
_ref$accessibleTable = _ref.accessibleTable,
|
|
47
|
+
accessibleTable = _ref$accessibleTable === void 0 ? true : _ref$accessibleTable,
|
|
48
|
+
className = _ref.className,
|
|
49
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
50
|
+
var _groupScatter = groupScatter(data, {
|
|
51
|
+
x: x,
|
|
52
|
+
y: y,
|
|
53
|
+
category: category
|
|
54
|
+
}),
|
|
55
|
+
rows = _groupScatter.rows,
|
|
56
|
+
names = _groupScatter.names,
|
|
57
|
+
groups = _groupScatter.groups;
|
|
58
|
+
var _useChartTheme = useChartTheme(names, colors),
|
|
59
|
+
chrome = _useChartTheme.chrome,
|
|
60
|
+
series = _useChartTheme.series;
|
|
61
|
+
var reducedMotion = useReducedMotion();
|
|
62
|
+
var chartId = useChartId();
|
|
63
|
+
var _useElementWidth = useElementWidth(),
|
|
64
|
+
_useElementWidth2 = _slicedToArray(_useElementWidth, 2),
|
|
65
|
+
measureRef = _useElementWidth2[0],
|
|
66
|
+
width = _useElementWidth2[1];
|
|
67
|
+
var tick = {
|
|
68
|
+
fill: chrome.axis,
|
|
69
|
+
fontSize: 12
|
|
70
|
+
};
|
|
71
|
+
var axisTitle = function axisTitle(value, angle) {
|
|
72
|
+
return value ? {
|
|
73
|
+
value: value,
|
|
74
|
+
angle: angle,
|
|
75
|
+
position: angle ? "insideLeft" : "insideBottom",
|
|
76
|
+
offset: angle ? 10 : -4,
|
|
77
|
+
fill: chrome.axis,
|
|
78
|
+
fontSize: 12
|
|
79
|
+
} : undefined;
|
|
80
|
+
};
|
|
81
|
+
var xLabel = xAxisLabel || x;
|
|
82
|
+
var yLabel = yAxisLabel || y;
|
|
83
|
+
return jsx(ChartFrame, _objectSpread2(_objectSpread2({
|
|
84
|
+
ref: ref,
|
|
85
|
+
className: className,
|
|
86
|
+
title: title,
|
|
87
|
+
description: description,
|
|
88
|
+
defaultTitle: "Scatter chart",
|
|
89
|
+
data: rows,
|
|
90
|
+
height: height,
|
|
91
|
+
aspectRatio: aspectRatio,
|
|
92
|
+
emptyState: emptyState,
|
|
93
|
+
accessibleTable: accessibleTable,
|
|
94
|
+
legend: showLegend && category ? names.map(function (name, i) {
|
|
95
|
+
return {
|
|
96
|
+
name: name,
|
|
97
|
+
color: series[i]
|
|
98
|
+
};
|
|
99
|
+
}) : null,
|
|
100
|
+
tableColumns: [].concat(_toConsumableArray(index ? [{
|
|
101
|
+
key: index,
|
|
102
|
+
label: index,
|
|
103
|
+
format: textOf
|
|
104
|
+
}] : []), _toConsumableArray(category && category !== index ? [{
|
|
105
|
+
key: category,
|
|
106
|
+
label: category,
|
|
107
|
+
format: textOf
|
|
108
|
+
}] : []), [{
|
|
109
|
+
key: x,
|
|
110
|
+
label: xLabel,
|
|
111
|
+
format: xAxisFormatter
|
|
112
|
+
}, {
|
|
113
|
+
key: y,
|
|
114
|
+
label: yLabel,
|
|
115
|
+
format: valueFormatter
|
|
116
|
+
}])
|
|
117
|
+
}, rest), {}, {
|
|
118
|
+
children: jsx("div", {
|
|
119
|
+
className: "h-full w-full",
|
|
120
|
+
ref: measureRef,
|
|
121
|
+
children: jsx(ResponsiveContainer, {
|
|
122
|
+
width: "100%",
|
|
123
|
+
height: "100%",
|
|
124
|
+
minWidth: 0,
|
|
125
|
+
children: jsxs(ScatterChart$1, {
|
|
126
|
+
id: chartId,
|
|
127
|
+
margin: {
|
|
128
|
+
top: 8,
|
|
129
|
+
right: 8,
|
|
130
|
+
bottom: xAxisLabel ? 16 : 0,
|
|
131
|
+
left: 0
|
|
132
|
+
},
|
|
133
|
+
accessibilityLayer: false,
|
|
134
|
+
children: [showGrid && jsx(CartesianGrid, {
|
|
135
|
+
stroke: chrome.grid,
|
|
136
|
+
strokeDasharray: "3 3"
|
|
137
|
+
}), jsx(XAxis, {
|
|
138
|
+
type: "number",
|
|
139
|
+
dataKey: x,
|
|
140
|
+
name: xLabel,
|
|
141
|
+
domain: scatterDomain(rows.map(function (row) {
|
|
142
|
+
return row[x];
|
|
143
|
+
})),
|
|
144
|
+
tick: tick,
|
|
145
|
+
tickLine: false,
|
|
146
|
+
axisLine: false,
|
|
147
|
+
tickFormatter: xAxisFormatter,
|
|
148
|
+
minTickGap: tickGapFor(width),
|
|
149
|
+
hide: !showXAxis,
|
|
150
|
+
label: axisTitle(xAxisLabel, 0)
|
|
151
|
+
}), jsx(YAxis, {
|
|
152
|
+
type: "number",
|
|
153
|
+
dataKey: y,
|
|
154
|
+
name: yLabel,
|
|
155
|
+
domain: scatterDomain(rows.map(function (row) {
|
|
156
|
+
return row[y];
|
|
157
|
+
})),
|
|
158
|
+
tick: tick,
|
|
159
|
+
tickLine: false,
|
|
160
|
+
axisLine: false,
|
|
161
|
+
tickFormatter: valueFormatter,
|
|
162
|
+
width: yAxisWidth !== null && yAxisWidth !== void 0 ? yAxisWidth : yAxisWidthFor(width),
|
|
163
|
+
hide: !showYAxis,
|
|
164
|
+
label: axisTitle(yAxisLabel, -90)
|
|
165
|
+
}), showTooltip && jsx(Tooltip, {
|
|
166
|
+
cursor: {
|
|
167
|
+
stroke: chrome.grid,
|
|
168
|
+
strokeDasharray: "3 3"
|
|
169
|
+
},
|
|
170
|
+
isAnimationActive: false,
|
|
171
|
+
content: jsx(ScatterTooltipContent, {
|
|
172
|
+
index: index,
|
|
173
|
+
category: category,
|
|
174
|
+
colorFor: Object.fromEntries(names.map(function (name, i) {
|
|
175
|
+
return [name, series[i]];
|
|
176
|
+
})),
|
|
177
|
+
x: {
|
|
178
|
+
key: x,
|
|
179
|
+
label: xLabel,
|
|
180
|
+
format: xAxisFormatter
|
|
181
|
+
},
|
|
182
|
+
y: {
|
|
183
|
+
key: y,
|
|
184
|
+
label: yLabel,
|
|
185
|
+
format: valueFormatter
|
|
186
|
+
}
|
|
187
|
+
})
|
|
188
|
+
}), names.map(function (name, i) {
|
|
189
|
+
return jsx(Scatter, {
|
|
190
|
+
id: "".concat(chartId, "-").concat(i),
|
|
191
|
+
name: name,
|
|
192
|
+
data: groups.get(name),
|
|
193
|
+
fill: series[i],
|
|
194
|
+
isAnimationActive: animate && !reducedMotion
|
|
195
|
+
}, name);
|
|
196
|
+
})]
|
|
197
|
+
})
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
}));
|
|
201
|
+
});
|
|
202
|
+
ScatterChart.displayName = "ScatterChart";
|
|
203
|
+
|
|
204
|
+
export { ScatterChart as default };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { toConsumableArray as _toConsumableArray, slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
|
5
|
+
import { swatch } from './ChartFrame.js';
|
|
6
|
+
import { textOf } from './scatterData.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Tooltip for one ScatterChart point: the entity (`index`) or series name as the
|
|
10
|
+
* heading, then the series (when both are set) and the formatted x and y values.
|
|
11
|
+
*/
|
|
12
|
+
function ScatterTooltipContent(_ref) {
|
|
13
|
+
var active = _ref.active,
|
|
14
|
+
payload = _ref.payload,
|
|
15
|
+
index = _ref.index,
|
|
16
|
+
category = _ref.category,
|
|
17
|
+
_ref$colorFor = _ref.colorFor,
|
|
18
|
+
colorFor = _ref$colorFor === void 0 ? {} : _ref$colorFor,
|
|
19
|
+
x = _ref.x,
|
|
20
|
+
y = _ref.y;
|
|
21
|
+
var row = active && payload && payload.length ? payload[0].payload : null;
|
|
22
|
+
if (!row) return null;
|
|
23
|
+
var seriesName = category ? textOf(row[category]) : null;
|
|
24
|
+
var heading = index ? textOf(row[index]) : seriesName;
|
|
25
|
+
var lines = [].concat(_toConsumableArray(index && seriesName ? [[category, seriesName]] : []), [[x.label, x.format(row[x.key])], [y.label, y.format(row[y.key])]]);
|
|
26
|
+
return jsxs("div", {
|
|
27
|
+
className: "rounded-md border border-line bg-surface px-3 py-2 text-xs text-foreground shadow-md",
|
|
28
|
+
"data-chart-tooltip": "",
|
|
29
|
+
children: [heading && jsxs("p", {
|
|
30
|
+
className: "mb-1 flex items-center gap-2 font-medium",
|
|
31
|
+
children: [seriesName && jsx("span", {
|
|
32
|
+
className: swatch("h-2 w-2"),
|
|
33
|
+
style: {
|
|
34
|
+
"--dt-chart-color": colorFor[seriesName]
|
|
35
|
+
},
|
|
36
|
+
"aria-hidden": "true"
|
|
37
|
+
}), jsx("span", {
|
|
38
|
+
children: heading
|
|
39
|
+
})]
|
|
40
|
+
}), jsx("ul", {
|
|
41
|
+
className: "space-y-0.5",
|
|
42
|
+
children: lines.map(function (_ref2) {
|
|
43
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
44
|
+
name = _ref3[0],
|
|
45
|
+
value = _ref3[1];
|
|
46
|
+
return jsxs("li", {
|
|
47
|
+
className: "flex items-center gap-2",
|
|
48
|
+
children: [jsx("span", {
|
|
49
|
+
className: "text-muted",
|
|
50
|
+
children: name
|
|
51
|
+
}), jsx("span", {
|
|
52
|
+
className: "ml-auto pl-3 font-medium tabular-nums",
|
|
53
|
+
children: value
|
|
54
|
+
})]
|
|
55
|
+
}, name);
|
|
56
|
+
})
|
|
57
|
+
})]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { ScatterTooltipContent as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { toConsumableArray as _toConsumableArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
|
|
3
|
+
// Internal to the charts entry point: data shaping for ScatterChart.
|
|
4
|
+
var isFiniteNumber = function isFiniteNumber(v) {
|
|
5
|
+
return typeof v === "number" && Number.isFinite(v);
|
|
6
|
+
};
|
|
7
|
+
var textOf = function textOf(v) {
|
|
8
|
+
return v == null ? "" : String(v);
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Axis domain. recharts draws a zero-width scale for a single distinct value, so
|
|
12
|
+
* pad around it; otherwise let recharts pick nice bounds.
|
|
13
|
+
*/
|
|
14
|
+
function scatterDomain(values) {
|
|
15
|
+
if (!values.length) return ["auto", "auto"];
|
|
16
|
+
var min = Math.min.apply(Math, _toConsumableArray(values));
|
|
17
|
+
var max = Math.max.apply(Math, _toConsumableArray(values));
|
|
18
|
+
if (min !== max) return ["auto", "auto"];
|
|
19
|
+
var pad = Math.abs(min) / 2 || 1;
|
|
20
|
+
return [min - pad, max + pad];
|
|
21
|
+
}
|
|
22
|
+
/** Rows with a numeric x and y, split into series by the `category` key (first-seen order). */
|
|
23
|
+
function groupScatter(data, _ref) {
|
|
24
|
+
var x = _ref.x,
|
|
25
|
+
y = _ref.y,
|
|
26
|
+
category = _ref.category;
|
|
27
|
+
var rows = (Array.isArray(data) ? data : []).filter(function (row) {
|
|
28
|
+
return isFiniteNumber(row === null || row === void 0 ? void 0 : row[x]) && isFiniteNumber(row === null || row === void 0 ? void 0 : row[y]);
|
|
29
|
+
});
|
|
30
|
+
var groups = new Map();
|
|
31
|
+
rows.forEach(function (row) {
|
|
32
|
+
var name = category ? textOf(row[category]) : y;
|
|
33
|
+
if (!groups.has(name)) groups.set(name, []);
|
|
34
|
+
groups.get(name).push(row);
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
rows: rows,
|
|
38
|
+
names: _toConsumableArray(groups.keys()),
|
|
39
|
+
groups: groups
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { groupScatter, scatterDomain, textOf };
|
|
@@ -173,7 +173,7 @@ var Accordion = /*#__PURE__*/forwardRef(function Accordion(_ref, ref) {
|
|
|
173
173
|
lg: "rounded-lg",
|
|
174
174
|
xl: "rounded-xl"
|
|
175
175
|
};
|
|
176
|
-
var wrapperClasses = cn(bordered ? "bg-
|
|
176
|
+
var wrapperClasses = cn(bordered ? "bg-surface text-foreground" : "bg-transparent", bordered ? "divide-y divide-line" : "", roundedMap[rounded] || roundedMap.md, "shadow-sm", className);
|
|
177
177
|
var renderLeftIcon = function renderLeftIcon(item, index) {
|
|
178
178
|
var left = item === null || item === void 0 ? void 0 : item.leftIcon;
|
|
179
179
|
if (!left) return null;
|
|
@@ -201,7 +201,7 @@ var Accordion = /*#__PURE__*/forwardRef(function Accordion(_ref, ref) {
|
|
|
201
201
|
var panelId = "".concat(uid, "accordion-panel-").concat(id);
|
|
202
202
|
var leftIconEl = renderLeftIcon(item, index);
|
|
203
203
|
return jsxs("div", {
|
|
204
|
-
className: "bg-
|
|
204
|
+
className: "bg-surface text-foreground",
|
|
205
205
|
children: [jsx("h3", {
|
|
206
206
|
children: jsx("button", {
|
|
207
207
|
ref: function ref(el) {
|
|
@@ -157,7 +157,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
157
157
|
edge: isSel
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
|
-
var actionClass = isSheet ? "rounded-md px-3 py-2 text-sm hover:bg-
|
|
160
|
+
var actionClass = isSheet ? "rounded-md px-3 py-2 text-sm hover:bg-line/50" : "rounded-md px-2 py-1 text-xs hover:bg-line/50";
|
|
161
161
|
var actions = jsxs("div", {
|
|
162
162
|
className: "flex gap-2",
|
|
163
163
|
children: [showClear && jsx("button", {
|
|
@@ -208,7 +208,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
208
208
|
"aria-labelledby": label ? "".concat(labelId, " ").concat(valueId) : valueId,
|
|
209
209
|
"aria-describedby": error ? errorId : helperText ? helperId : undefined,
|
|
210
210
|
"aria-invalid": error ? true : undefined,
|
|
211
|
-
className: cn("flex w-full items-center justify-between rounded-md border border-
|
|
211
|
+
className: cn("flex w-full items-center justify-between rounded-md border border-line bg-surface text-foreground px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:cursor-not-allowed disabled:opacity-50", {
|
|
212
212
|
"border-error-500 focus:ring-error-500": error,
|
|
213
213
|
// Empty: the placeholder reads muted, like Input's
|
|
214
214
|
// ::placeholder (#159). `className` still merges last.
|
|
@@ -244,7 +244,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
244
244
|
// this button unmounts once the value clears
|
|
245
245
|
(_triggerRef$current3 = triggerRef.current) === null || _triggerRef$current3 === void 0 || _triggerRef$current3.focus();
|
|
246
246
|
},
|
|
247
|
-
className: "absolute right-9 top-1/2 inline-flex -translate-y-1/2 items-center justify-center rounded-md p-1 text-primary-400 hover:bg-
|
|
247
|
+
className: "absolute right-9 top-1/2 inline-flex -translate-y-1/2 items-center justify-center rounded-md p-1 text-primary-400 hover:bg-line/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50",
|
|
248
248
|
children: jsx(X, {
|
|
249
249
|
className: "h-4 w-4",
|
|
250
250
|
"aria-hidden": "true"
|
|
@@ -298,12 +298,12 @@ var DateRangePicker = /*#__PURE__*/forwardRef(function DateRangePicker(_ref, ref
|
|
|
298
298
|
onClick: function onClick() {
|
|
299
299
|
return applyPreset(preset);
|
|
300
300
|
},
|
|
301
|
-
className: cn("shrink-0 rounded-full border px-3 text-xs font-medium transition-colors motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500", isSheet ? "min-h-11 text-sm" : "py-1", active ? "border-primary-600 bg-primary-600 text-white" : "border-
|
|
301
|
+
className: cn("shrink-0 rounded-full border px-3 text-xs font-medium transition-colors motion-reduce:transition-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500", isSheet ? "min-h-11 text-sm" : "py-1", active ? "border-primary-600 bg-primary-600 text-white" : "border-line hover:bg-line/50"),
|
|
302
302
|
children: preset.label
|
|
303
303
|
}, preset.label);
|
|
304
304
|
})
|
|
305
305
|
}) : null;
|
|
306
|
-
var actionClass = isSheet ? "rounded-md px-3 py-2 text-sm hover:bg-
|
|
306
|
+
var actionClass = isSheet ? "rounded-md px-3 py-2 text-sm hover:bg-line/50" : "rounded-md px-2 py-1 text-xs hover:bg-line/50";
|
|
307
307
|
var calendar = jsx(Calendar, {
|
|
308
308
|
month: currentMonth,
|
|
309
309
|
onMonthChange: setCurrentMonth,
|
|
@@ -358,7 +358,7 @@ var DateRangePicker = /*#__PURE__*/forwardRef(function DateRangePicker(_ref, ref
|
|
|
358
358
|
"aria-labelledby": label ? "".concat(labelId, " ").concat(valueId) : valueId,
|
|
359
359
|
"aria-describedby": error ? errorId : helperText ? helperId : undefined,
|
|
360
360
|
"aria-invalid": error ? true : undefined,
|
|
361
|
-
className: cn("flex w-full items-center justify-between rounded-md border border-
|
|
361
|
+
className: cn("flex w-full items-center justify-between rounded-md border border-line bg-surface text-foreground px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:cursor-not-allowed disabled:opacity-50", {
|
|
362
362
|
"border-error-500 focus:ring-error-500": error,
|
|
363
363
|
// Empty: the placeholder reads muted, like Input's
|
|
364
364
|
// ::placeholder (#159). `className` still merges last.
|
|
@@ -218,7 +218,7 @@ var Form = /*#__PURE__*/forwardRef(function Form(_ref2, ref) {
|
|
|
218
218
|
id: fieldId,
|
|
219
219
|
"aria-invalid": error ? true : undefined,
|
|
220
220
|
"aria-describedby": describedBy,
|
|
221
|
-
className: cn("flex w-full rounded-md border border-
|
|
221
|
+
className: cn("flex w-full rounded-md border border-line bg-surface text-foreground px-3 py-2 text-sm placeholder:text-primary-400 focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-transparent disabled:cursor-not-allowed disabled:opacity-50", {
|
|
222
222
|
"border-error-500 focus:ring-error-500": error
|
|
223
223
|
}),
|
|
224
224
|
placeholder: placeholder,
|
|
@@ -257,7 +257,7 @@ var Form = /*#__PURE__*/forwardRef(function Form(_ref2, ref) {
|
|
|
257
257
|
},
|
|
258
258
|
"aria-invalid": error ? true : undefined,
|
|
259
259
|
"aria-describedby": describedBy,
|
|
260
|
-
className: "rounded border-gray-300 text-primary-600 focus:ring-primary-500"
|
|
260
|
+
className: "rounded border-gray-300 text-primary-600 focus:ring-primary-500 dark:border-gray-600"
|
|
261
261
|
}), label && jsxs("label", {
|
|
262
262
|
htmlFor: fieldId,
|
|
263
263
|
className: "ml-2 text-sm",
|
|
@@ -354,7 +354,7 @@ var Form = /*#__PURE__*/forwardRef(function Form(_ref2, ref) {
|
|
|
354
354
|
className: "mt-1 flex items-center",
|
|
355
355
|
children: [jsxs("label", {
|
|
356
356
|
htmlFor: name,
|
|
357
|
-
className: cn("cursor-pointer inline-flex items-center px-4 py-2 border border-
|
|
357
|
+
className: cn("cursor-pointer inline-flex items-center px-4 py-2 border border-line rounded-md shadow-sm text-sm font-medium bg-surface text-foreground hover:bg-background focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500", {
|
|
358
358
|
"border-error-500": error
|
|
359
359
|
}),
|
|
360
360
|
children: [jsx("svg", {
|
|
@@ -204,7 +204,7 @@ var LocationPicker = /*#__PURE__*/forwardRef(function LocationPicker(_ref, ref)
|
|
|
204
204
|
}, inputProps), {}, {
|
|
205
205
|
value: text,
|
|
206
206
|
onChange: handleInputChange,
|
|
207
|
-
className: cn("rounded-md border border-
|
|
207
|
+
className: cn("rounded-md border border-line bg-surface py-2 px-3 text-sm text-foreground placeholder-gray-400 shadow-sm focus:border-primary-500 focus:ring-1 focus:ring-primary-500", "dark:placeholder-gray-500", "[@media(pointer:coarse)]:text-base", fullWidth ? "w-full" : "min-w-[200px]", status === "error" && "border-error-500 dark:border-error-400", inputProps.className, inputPaddingClass)
|
|
208
208
|
})), jsx("div", {
|
|
209
209
|
className: cn("absolute inset-y-0 flex items-center", iconPosition === "right" ? "right-2" : "left-2"),
|
|
210
210
|
children: iconButton
|
|
@@ -166,7 +166,7 @@ var Popover = /*#__PURE__*/React.forwardRef(function (_ref, _ref2) {
|
|
|
166
166
|
onKeyDown: handlePanelKeyDown,
|
|
167
167
|
"data-side": resolvedPlacement.split("-")[0],
|
|
168
168
|
"data-presentation": "popover",
|
|
169
|
-
className: cn("z-popover min-w-[12rem] max-w-sm rounded-lg border border-
|
|
169
|
+
className: cn("z-popover min-w-[12rem] max-w-sm rounded-lg border border-line bg-surface p-4 text-sm text-foreground shadow-lg focus:outline-none", "animate-fade-in motion-reduce:animate-none", className),
|
|
170
170
|
style: _objectSpread2(_objectSpread2({}, floatingStyles), style)
|
|
171
171
|
}, props), {}, {
|
|
172
172
|
children: [title && jsx("h2", {
|