@datatechsolutions/ui 2.11.51 → 2.11.53
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/dist/astrlabe/index.d.mts +2 -18
- package/dist/astrlabe/index.d.ts +2 -18
- package/dist/astrlabe/index.js +142 -185
- package/dist/astrlabe/index.js.map +1 -1
- package/dist/astrlabe/index.mjs +7 -49
- package/dist/astrlabe/index.mjs.map +1 -1
- package/dist/astrlabe/workflow-canvas.js +4 -4
- package/dist/astrlabe/workflow-canvas.mjs +3 -3
- package/dist/{chunk-2IOPJ5BM.js → chunk-5N6QYUAA.js} +363 -3
- package/dist/chunk-5N6QYUAA.js.map +1 -0
- package/dist/{chunk-VZHQMOVM.js → chunk-7LCEP4X5.js} +52 -52
- package/dist/{chunk-VZHQMOVM.js.map → chunk-7LCEP4X5.js.map} +1 -1
- package/dist/{chunk-MDD6H63O.mjs → chunk-GWLWSE2C.mjs} +357 -4
- package/dist/chunk-GWLWSE2C.mjs.map +1 -0
- package/dist/{chunk-XRTBXSQY.mjs → chunk-PEBQWL6R.mjs} +3 -3
- package/dist/{chunk-XRTBXSQY.mjs.map → chunk-PEBQWL6R.mjs.map} +1 -1
- package/dist/dynamic-island-confirm-BKsZkAEP.d.mts +17 -0
- package/dist/dynamic-island-confirm-BKsZkAEP.d.ts +17 -0
- package/dist/index.d.mts +232 -7
- package/dist/index.d.ts +232 -7
- package/dist/index.js +742 -714
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-2IOPJ5BM.js.map +0 -1
- package/dist/chunk-MDD6H63O.mjs.map +0 -1
- package/dist/dynamic-island-confirm-Bw24Ll2r.d.mts +0 -114
- package/dist/dynamic-island-confirm-Bw24Ll2r.d.ts +0 -114
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-UZ3CMNUJ.js');
|
|
4
|
+
var chunk7LCEP4X5_js = require('../chunk-7LCEP4X5.js');
|
|
5
|
+
require('../chunk-5N6QYUAA.js');
|
|
7
6
|
require('../chunk-YXN2K77G.js');
|
|
8
7
|
require('../chunk-S7KHTUHA.js');
|
|
8
|
+
require('../chunk-UZ3CMNUJ.js');
|
|
9
9
|
require('../chunk-P4YYEM4B.js');
|
|
10
10
|
require('../chunk-PWBWP5FJ.js');
|
|
11
11
|
|
|
@@ -13,7 +13,7 @@ require('../chunk-PWBWP5FJ.js');
|
|
|
13
13
|
|
|
14
14
|
Object.defineProperty(exports, "Workspace", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunk7LCEP4X5_js.Workspace; }
|
|
17
17
|
});
|
|
18
18
|
//# sourceMappingURL=workflow-canvas.js.map
|
|
19
19
|
//# sourceMappingURL=workflow-canvas.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { Workspace } from '../chunk-
|
|
3
|
-
import '../chunk-
|
|
4
|
-
import '../chunk-D2JF6C3E.mjs';
|
|
2
|
+
export { Workspace } from '../chunk-PEBQWL6R.mjs';
|
|
3
|
+
import '../chunk-GWLWSE2C.mjs';
|
|
5
4
|
import '../chunk-7VJ7CMMT.mjs';
|
|
6
5
|
import '../chunk-QWG2FMUN.mjs';
|
|
6
|
+
import '../chunk-D2JF6C3E.mjs';
|
|
7
7
|
import '../chunk-OZNTQROP.mjs';
|
|
8
8
|
import '../chunk-TLPPVL3W.mjs';
|
|
9
9
|
//# sourceMappingURL=workflow-canvas.mjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var chunkUZ3CMNUJ_js = require('./chunk-UZ3CMNUJ.js');
|
|
5
4
|
var chunkYXN2K77G_js = require('./chunk-YXN2K77G.js');
|
|
6
5
|
var chunkS7KHTUHA_js = require('./chunk-S7KHTUHA.js');
|
|
6
|
+
var chunkUZ3CMNUJ_js = require('./chunk-UZ3CMNUJ.js');
|
|
7
7
|
var Headless6 = require('@headlessui/react');
|
|
8
8
|
var clsx = require('clsx');
|
|
9
9
|
var React12 = require('react');
|
|
@@ -2032,6 +2032,359 @@ function MetricCard({
|
|
|
2032
2032
|
icon && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex h-10 w-10 items-center justify-center rounded-lg ${iconStyles[variant]}`, children: icon })
|
|
2033
2033
|
] }) });
|
|
2034
2034
|
}
|
|
2035
|
+
|
|
2036
|
+
// src/types/chart-spec.ts
|
|
2037
|
+
var DEFAULT_COLORS = [
|
|
2038
|
+
"#6366f1",
|
|
2039
|
+
// indigo-500
|
|
2040
|
+
"#10b981",
|
|
2041
|
+
// emerald-500
|
|
2042
|
+
"#f59e0b",
|
|
2043
|
+
// amber-500
|
|
2044
|
+
"#ef4444",
|
|
2045
|
+
// red-500
|
|
2046
|
+
"#0ea5e9",
|
|
2047
|
+
// sky-500
|
|
2048
|
+
"#8b5cf6"
|
|
2049
|
+
// violet-500
|
|
2050
|
+
];
|
|
2051
|
+
function computeSeries(spec) {
|
|
2052
|
+
return spec.series.map((series, index) => ({
|
|
2053
|
+
name: series.name,
|
|
2054
|
+
color: series.color ?? DEFAULT_COLORS[index % DEFAULT_COLORS.length] ?? DEFAULT_COLORS[0],
|
|
2055
|
+
values: spec.data.map((point) => {
|
|
2056
|
+
const raw = point[series.name];
|
|
2057
|
+
const num = typeof raw === "number" ? raw : Number(raw);
|
|
2058
|
+
return Number.isFinite(num) ? num : 0;
|
|
2059
|
+
})
|
|
2060
|
+
}));
|
|
2061
|
+
}
|
|
2062
|
+
function computeDomain(spec, series) {
|
|
2063
|
+
if (spec.yAxis.domain) return spec.yAxis.domain;
|
|
2064
|
+
const allValues = series.flatMap((row) => row.values);
|
|
2065
|
+
if (allValues.length === 0) return [0, 1];
|
|
2066
|
+
const min = Math.min(...allValues);
|
|
2067
|
+
const max = Math.max(...allValues);
|
|
2068
|
+
if (min === max) {
|
|
2069
|
+
const padded = Math.abs(min) * 0.1 || 1;
|
|
2070
|
+
return [min - padded, max + padded];
|
|
2071
|
+
}
|
|
2072
|
+
const padding = (max - min) * 0.1;
|
|
2073
|
+
return [min - padding, max + padding];
|
|
2074
|
+
}
|
|
2075
|
+
function yScale(value, domain, height) {
|
|
2076
|
+
const [min, max] = domain;
|
|
2077
|
+
if (max === min) return height / 2;
|
|
2078
|
+
const normalized = (value - min) / (max - min);
|
|
2079
|
+
return height - normalized * height;
|
|
2080
|
+
}
|
|
2081
|
+
function xScale(index, count, width) {
|
|
2082
|
+
if (count <= 1) return width / 2;
|
|
2083
|
+
return index / (count - 1) * width;
|
|
2084
|
+
}
|
|
2085
|
+
var MARGIN = { top: 24, right: 16, bottom: 32, left: 48 };
|
|
2086
|
+
function ChartRenderer({ spec, width = 640, height = 280, className }) {
|
|
2087
|
+
const innerWidth = width - MARGIN.left - MARGIN.right;
|
|
2088
|
+
const innerHeight = height - MARGIN.top - MARGIN.bottom;
|
|
2089
|
+
const seriesComputed = computeSeries(spec);
|
|
2090
|
+
const domain = computeDomain(spec, seriesComputed);
|
|
2091
|
+
const count = spec.data.length;
|
|
2092
|
+
const yTicks = buildTicks(domain[0], domain[1], 4);
|
|
2093
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: className ?? "w-full", children: [
|
|
2094
|
+
/* @__PURE__ */ jsxRuntime.jsxs("figcaption", { className: "mb-2", children: [
|
|
2095
|
+
/* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-sm font-semibold text-slate-900 dark:text-slate-100", children: spec.title }),
|
|
2096
|
+
spec.subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-slate-500 dark:text-slate-400", children: spec.subtitle })
|
|
2097
|
+
] }),
|
|
2098
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2099
|
+
"svg",
|
|
2100
|
+
{
|
|
2101
|
+
role: "img",
|
|
2102
|
+
"aria-label": spec.title,
|
|
2103
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
2104
|
+
className: "w-full overflow-visible text-slate-600 dark:text-slate-400",
|
|
2105
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("g", { transform: `translate(${MARGIN.left},${MARGIN.top})`, children: [
|
|
2106
|
+
yTicks.map((tick) => {
|
|
2107
|
+
const y = yScale(tick, domain, innerHeight);
|
|
2108
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
2109
|
+
/* @__PURE__ */ jsxRuntime.jsx("line", { x1: 0, x2: innerWidth, y1: y, y2: y, stroke: "currentColor", strokeOpacity: 0.08 }),
|
|
2110
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2111
|
+
"text",
|
|
2112
|
+
{
|
|
2113
|
+
x: -8,
|
|
2114
|
+
y,
|
|
2115
|
+
textAnchor: "end",
|
|
2116
|
+
dominantBaseline: "middle",
|
|
2117
|
+
className: "fill-current text-[10px] font-mono",
|
|
2118
|
+
children: formatTick(tick, spec.yAxis.unit)
|
|
2119
|
+
}
|
|
2120
|
+
)
|
|
2121
|
+
] }, `y-${tick}`);
|
|
2122
|
+
}),
|
|
2123
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2124
|
+
"line",
|
|
2125
|
+
{
|
|
2126
|
+
x1: 0,
|
|
2127
|
+
x2: innerWidth,
|
|
2128
|
+
y1: innerHeight,
|
|
2129
|
+
y2: innerHeight,
|
|
2130
|
+
stroke: "currentColor",
|
|
2131
|
+
strokeOpacity: 0.2
|
|
2132
|
+
}
|
|
2133
|
+
),
|
|
2134
|
+
count > 0 && renderXLabels(spec.data, count, innerWidth, innerHeight),
|
|
2135
|
+
seriesComputed.map(
|
|
2136
|
+
(series, index) => spec.type === "bar" ? renderBars(series, index, seriesComputed.length, count, domain, innerWidth, innerHeight) : renderLine(series, spec.type, count, domain, innerWidth, innerHeight)
|
|
2137
|
+
),
|
|
2138
|
+
spec.annotations?.map((annotation, index) => {
|
|
2139
|
+
const xIndex = spec.data.findIndex((point) => point.x === annotation.x);
|
|
2140
|
+
if (xIndex < 0) return null;
|
|
2141
|
+
const x = xScale(xIndex, count, innerWidth);
|
|
2142
|
+
const color = annotation.color ?? "#f43f5e";
|
|
2143
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
2144
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2145
|
+
"line",
|
|
2146
|
+
{
|
|
2147
|
+
x1: x,
|
|
2148
|
+
x2: x,
|
|
2149
|
+
y1: 0,
|
|
2150
|
+
y2: innerHeight,
|
|
2151
|
+
stroke: color,
|
|
2152
|
+
strokeDasharray: "4 3",
|
|
2153
|
+
strokeWidth: 1
|
|
2154
|
+
}
|
|
2155
|
+
),
|
|
2156
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2157
|
+
"text",
|
|
2158
|
+
{
|
|
2159
|
+
x: x + 4,
|
|
2160
|
+
y: 10,
|
|
2161
|
+
fill: color,
|
|
2162
|
+
className: "text-[10px] font-medium",
|
|
2163
|
+
children: annotation.label
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
] }, `ann-${index}`);
|
|
2167
|
+
})
|
|
2168
|
+
] })
|
|
2169
|
+
}
|
|
2170
|
+
),
|
|
2171
|
+
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "mt-2 flex flex-wrap gap-3 text-xs text-slate-600 dark:text-slate-400", children: seriesComputed.map((series) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-center gap-1.5", children: [
|
|
2172
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2173
|
+
"span",
|
|
2174
|
+
{
|
|
2175
|
+
className: "inline-block h-2 w-2 rounded-full",
|
|
2176
|
+
style: { backgroundColor: series.color },
|
|
2177
|
+
"aria-hidden": true
|
|
2178
|
+
}
|
|
2179
|
+
),
|
|
2180
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: series.name })
|
|
2181
|
+
] }, series.name)) })
|
|
2182
|
+
] });
|
|
2183
|
+
}
|
|
2184
|
+
function buildTicks(min, max, count) {
|
|
2185
|
+
const step = (max - min) / (count - 1);
|
|
2186
|
+
const ticks = [];
|
|
2187
|
+
for (let index = 0; index < count; index += 1) {
|
|
2188
|
+
ticks.push(min + step * index);
|
|
2189
|
+
}
|
|
2190
|
+
return ticks;
|
|
2191
|
+
}
|
|
2192
|
+
function formatTick(value, unit) {
|
|
2193
|
+
const formatted = Math.abs(value) >= 1e3 ? value.toFixed(0) : value.toFixed(Math.abs(value) < 10 ? 2 : 1);
|
|
2194
|
+
return unit ? `${formatted}${unit}` : formatted;
|
|
2195
|
+
}
|
|
2196
|
+
function renderXLabels(data, count, width, height) {
|
|
2197
|
+
const indexes = count > 6 ? [0, Math.floor(count / 3), Math.floor(2 * count / 3), count - 1] : Array.from({ length: count }, (_, index) => index);
|
|
2198
|
+
return indexes.map((index) => {
|
|
2199
|
+
const x = xScale(index, count, width);
|
|
2200
|
+
const label = String(data[index]?.x ?? "");
|
|
2201
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2202
|
+
"text",
|
|
2203
|
+
{
|
|
2204
|
+
x,
|
|
2205
|
+
y: height + 16,
|
|
2206
|
+
textAnchor: "middle",
|
|
2207
|
+
className: "fill-current text-[10px] font-mono",
|
|
2208
|
+
children: label
|
|
2209
|
+
},
|
|
2210
|
+
`x-${index}`
|
|
2211
|
+
);
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
function renderLine(series, type, count, domain, width, height) {
|
|
2215
|
+
const points = series.values.map((value, index) => ({
|
|
2216
|
+
x: xScale(index, count, width),
|
|
2217
|
+
y: yScale(value, domain, height)
|
|
2218
|
+
}));
|
|
2219
|
+
const linePath = points.reduce((acc, point, index) => index === 0 ? `M${point.x},${point.y}` : `${acc} L${point.x},${point.y}`, "");
|
|
2220
|
+
const areaPath = type === "area" && points.length > 0 ? `${linePath} L${points[points.length - 1]?.x ?? 0},${height} L${points[0]?.x ?? 0},${height} Z` : null;
|
|
2221
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("g", { children: [
|
|
2222
|
+
areaPath && /* @__PURE__ */ jsxRuntime.jsx("path", { d: areaPath, fill: series.color, fillOpacity: 0.15 }),
|
|
2223
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: linePath, stroke: series.color, strokeWidth: 2, fill: "none" }),
|
|
2224
|
+
points.map((point, index) => /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: point.x, cy: point.y, r: 2.5, fill: series.color }, `${series.name}-${index}`))
|
|
2225
|
+
] }, series.name);
|
|
2226
|
+
}
|
|
2227
|
+
function renderBars(series, seriesIndex, seriesCount, count, domain, width, height) {
|
|
2228
|
+
const slot = count > 1 ? width / (count - 1) : width;
|
|
2229
|
+
const barWidth = Math.max(2, slot * 0.8 / seriesCount);
|
|
2230
|
+
const offset = seriesCount * barWidth / 2;
|
|
2231
|
+
return /* @__PURE__ */ jsxRuntime.jsx("g", { children: series.values.map((value, index) => {
|
|
2232
|
+
const cx = xScale(index, count, width);
|
|
2233
|
+
const barX = cx - offset + seriesIndex * barWidth;
|
|
2234
|
+
const y = yScale(value, domain, height);
|
|
2235
|
+
const barHeight = height - y;
|
|
2236
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2237
|
+
"rect",
|
|
2238
|
+
{
|
|
2239
|
+
x: barX,
|
|
2240
|
+
y,
|
|
2241
|
+
width: barWidth,
|
|
2242
|
+
height: Math.max(0, barHeight),
|
|
2243
|
+
fill: series.color,
|
|
2244
|
+
fillOpacity: 0.85,
|
|
2245
|
+
rx: 2
|
|
2246
|
+
},
|
|
2247
|
+
`${series.name}-${index}`
|
|
2248
|
+
);
|
|
2249
|
+
}) }, series.name);
|
|
2250
|
+
}
|
|
2251
|
+
function DashboardView({ spec, className }) {
|
|
2252
|
+
const layout = spec.layout ?? "grid";
|
|
2253
|
+
const hasCharts = (spec.charts?.length ?? 0) > 0;
|
|
2254
|
+
const chartGrid = layout === "grid" && (spec.charts?.length ?? 0) > 1 ? "grid grid-cols-1 gap-4 lg:grid-cols-2" : "grid grid-cols-1 gap-4";
|
|
2255
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: className ?? "space-y-6", children: [
|
|
2256
|
+
/* @__PURE__ */ jsxRuntime.jsxs("header", { children: [
|
|
2257
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { className: "text-xl font-semibold text-slate-900 dark:text-slate-100", children: spec.title }),
|
|
2258
|
+
spec.subtitle && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-slate-500 dark:text-slate-400", children: spec.subtitle })
|
|
2259
|
+
] }),
|
|
2260
|
+
spec.kpis && spec.kpis.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2261
|
+
"section",
|
|
2262
|
+
{
|
|
2263
|
+
className: spec.kpis.length > 3 ? "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4" : "grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
2264
|
+
children: spec.kpis.map((kpi, index) => /* @__PURE__ */ jsxRuntime.jsx(KpiCard, { kpi }, `${kpi.label}-${index}`))
|
|
2265
|
+
}
|
|
2266
|
+
),
|
|
2267
|
+
hasCharts && /* @__PURE__ */ jsxRuntime.jsx("section", { className: chartGrid, children: spec.charts?.map((chart, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2268
|
+
"div",
|
|
2269
|
+
{
|
|
2270
|
+
className: "rounded-xl border border-zinc-950/10 bg-white p-4 dark:border-white/10 dark:bg-zinc-900",
|
|
2271
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChartRenderer, { spec: chart })
|
|
2272
|
+
},
|
|
2273
|
+
`${chart.title}-${index}`
|
|
2274
|
+
)) }),
|
|
2275
|
+
spec.table && spec.table.rows.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "rounded-xl border border-zinc-950/10 bg-white dark:border-white/10 dark:bg-zinc-900", children: [
|
|
2276
|
+
spec.table.title && /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "border-b border-zinc-950/10 px-5 py-3 text-sm font-semibold text-slate-900 dark:border-white/10 dark:text-slate-100", children: spec.table.title }),
|
|
2277
|
+
/* @__PURE__ */ jsxRuntime.jsx(DashboardTableView, { table: spec.table })
|
|
2278
|
+
] }),
|
|
2279
|
+
spec.recommendation && spec.recommendation.trim().length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("section", { className: "rounded-xl border border-indigo-500/20 bg-indigo-500/5 p-4 dark:border-indigo-400/30 dark:bg-indigo-500/10", children: [
|
|
2280
|
+
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-sm font-semibold text-indigo-700 dark:text-indigo-300", children: "Recommendation" }),
|
|
2281
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-indigo-900 dark:text-indigo-100", children: spec.recommendation })
|
|
2282
|
+
] }),
|
|
2283
|
+
spec.meta && Object.keys(spec.meta).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("footer", { className: "flex flex-wrap gap-4 text-[10px] text-slate-400 dark:text-slate-500", children: Object.entries(spec.meta).map(([key, value]) => /* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
2284
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-semibold uppercase tracking-wide", children: key }),
|
|
2285
|
+
": ",
|
|
2286
|
+
value
|
|
2287
|
+
] }, key)) })
|
|
2288
|
+
] });
|
|
2289
|
+
}
|
|
2290
|
+
function KpiCard({ kpi }) {
|
|
2291
|
+
const value = typeof kpi.value === "number" ? formatNumber(kpi.value) : kpi.value;
|
|
2292
|
+
const displayValue = kpi.unit ? `${value}${kpi.unit}` : value;
|
|
2293
|
+
const variant = kpi.tone ?? "default";
|
|
2294
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2295
|
+
MetricCard,
|
|
2296
|
+
{
|
|
2297
|
+
title: kpi.label,
|
|
2298
|
+
value: displayValue,
|
|
2299
|
+
variant,
|
|
2300
|
+
trend: kpi.deltaPct !== void 0 ? { value: kpi.deltaPct } : void 0
|
|
2301
|
+
}
|
|
2302
|
+
);
|
|
2303
|
+
}
|
|
2304
|
+
function DashboardTableView({ table }) {
|
|
2305
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "min-w-full divide-y divide-zinc-200 text-sm dark:divide-zinc-700", children: [
|
|
2306
|
+
/* @__PURE__ */ jsxRuntime.jsx("thead", { className: "bg-zinc-50 dark:bg-zinc-800/50", children: /* @__PURE__ */ jsxRuntime.jsx("tr", { children: table.columns.map((column) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2307
|
+
"th",
|
|
2308
|
+
{
|
|
2309
|
+
scope: "col",
|
|
2310
|
+
className: `px-4 py-2 text-xs font-medium uppercase tracking-wide text-slate-500 dark:text-slate-400 ${columnAlign(column.align)}`,
|
|
2311
|
+
children: column.label
|
|
2312
|
+
},
|
|
2313
|
+
column.key
|
|
2314
|
+
)) }) }),
|
|
2315
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-zinc-100 dark:divide-zinc-800", children: table.rows.map((row, rowIndex) => /* @__PURE__ */ jsxRuntime.jsx("tr", { className: "hover:bg-zinc-50/70 dark:hover:bg-zinc-800/30", children: table.columns.map((column) => {
|
|
2316
|
+
const raw = row[column.key] ?? "";
|
|
2317
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2318
|
+
"td",
|
|
2319
|
+
{
|
|
2320
|
+
className: `px-4 py-2 text-slate-700 dark:text-slate-300 ${columnAlign(column.align)}`,
|
|
2321
|
+
children: formatCell(raw, column.format)
|
|
2322
|
+
},
|
|
2323
|
+
column.key
|
|
2324
|
+
);
|
|
2325
|
+
}) }, rowIndex)) })
|
|
2326
|
+
] }) });
|
|
2327
|
+
}
|
|
2328
|
+
function columnAlign(align) {
|
|
2329
|
+
if (align === "right") return "text-right";
|
|
2330
|
+
if (align === "center") return "text-center";
|
|
2331
|
+
return "text-left";
|
|
2332
|
+
}
|
|
2333
|
+
function formatCell(value, format3) {
|
|
2334
|
+
if (value === null || value === void 0 || value === "") return "\u2014";
|
|
2335
|
+
if (format3 === "currency" && typeof value === "number") {
|
|
2336
|
+
return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(value);
|
|
2337
|
+
}
|
|
2338
|
+
if (format3 === "percent" && typeof value === "number") {
|
|
2339
|
+
return `${(value * 100).toFixed(1)}%`;
|
|
2340
|
+
}
|
|
2341
|
+
if (format3 === "number" && typeof value === "number") {
|
|
2342
|
+
return formatNumber(value);
|
|
2343
|
+
}
|
|
2344
|
+
return String(value);
|
|
2345
|
+
}
|
|
2346
|
+
function formatNumber(value) {
|
|
2347
|
+
if (Math.abs(value) >= 1e3) return new Intl.NumberFormat("en-US").format(Math.round(value));
|
|
2348
|
+
return value.toFixed(Math.abs(value) < 10 ? 2 : 1);
|
|
2349
|
+
}
|
|
2350
|
+
|
|
2351
|
+
// src/types/dashboard-spec.ts
|
|
2352
|
+
function validateDashboardSpec(spec) {
|
|
2353
|
+
const issues = [];
|
|
2354
|
+
const hasCharts = (spec.charts?.length ?? 0) > 0;
|
|
2355
|
+
const hasKpis = (spec.kpis?.length ?? 0) > 0;
|
|
2356
|
+
const hasTable = (spec.table?.rows.length ?? 0) > 0;
|
|
2357
|
+
const hasRecommendation = Boolean(spec.recommendation?.trim());
|
|
2358
|
+
if (!hasCharts && !hasKpis && !hasTable && !hasRecommendation) {
|
|
2359
|
+
issues.push({ kind: "empty", message: "Dashboard has no content (no charts, KPIs, table, or recommendation)." });
|
|
2360
|
+
}
|
|
2361
|
+
spec.charts?.forEach((chart, chartIndex) => {
|
|
2362
|
+
if (chart.series.length === 0) {
|
|
2363
|
+
issues.push({
|
|
2364
|
+
kind: "chartSeriesMissing",
|
|
2365
|
+
chartIndex,
|
|
2366
|
+
message: `Chart "${chart.title}" has no series.`
|
|
2367
|
+
});
|
|
2368
|
+
}
|
|
2369
|
+
});
|
|
2370
|
+
if (spec.table) {
|
|
2371
|
+
const columnKeys = new Set(spec.table.columns.map((column) => column.key));
|
|
2372
|
+
const reported = /* @__PURE__ */ new Set();
|
|
2373
|
+
for (const row of spec.table.rows) {
|
|
2374
|
+
for (const key of Object.keys(row)) {
|
|
2375
|
+
if (!columnKeys.has(key) && !reported.has(key)) {
|
|
2376
|
+
reported.add(key);
|
|
2377
|
+
issues.push({
|
|
2378
|
+
kind: "tableColumnMissing",
|
|
2379
|
+
column: key,
|
|
2380
|
+
message: `Table row references column "${key}" not declared in columns.`
|
|
2381
|
+
});
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
return issues;
|
|
2387
|
+
}
|
|
2035
2388
|
function AgentAnalysisCard({ name, avatar, duration, output }) {
|
|
2036
2389
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liquid-surface rounded-xl p-3 transition-all duration-300", children: [
|
|
2037
2390
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
|
|
@@ -20257,6 +20610,7 @@ exports.CardTitle = CardTitle;
|
|
|
20257
20610
|
exports.CategoryBadge = CategoryBadge;
|
|
20258
20611
|
exports.CategoryTab = CategoryTab;
|
|
20259
20612
|
exports.CategoryTabs = CategoryTabs;
|
|
20613
|
+
exports.ChartRenderer = ChartRenderer;
|
|
20260
20614
|
exports.ChipPicker = ChipPicker;
|
|
20261
20615
|
exports.CircularRefreshIndicator = CircularRefreshIndicator;
|
|
20262
20616
|
exports.Code = Code;
|
|
@@ -20272,6 +20626,7 @@ exports.CountPill = CountPill;
|
|
|
20272
20626
|
exports.CreateActionButton = CreateActionButton;
|
|
20273
20627
|
exports.DE_THEME_CONFIG = DE_THEME_CONFIG;
|
|
20274
20628
|
exports.DashboardProgressShell = DashboardProgressShell;
|
|
20629
|
+
exports.DashboardView = DashboardView;
|
|
20275
20630
|
exports.DataPagination = DataPagination;
|
|
20276
20631
|
exports.DatePicker = DatePicker;
|
|
20277
20632
|
exports.DeleteSwipeAction = DeleteSwipeAction;
|
|
@@ -20628,6 +20983,8 @@ exports.buttonTap = buttonTap;
|
|
|
20628
20983
|
exports.cardHover = cardHover;
|
|
20629
20984
|
exports.cardHoverReduced = cardHoverReduced;
|
|
20630
20985
|
exports.cardPress = cardPress;
|
|
20986
|
+
exports.computeDomain = computeDomain;
|
|
20987
|
+
exports.computeSeries = computeSeries;
|
|
20631
20988
|
exports.createMotionProps = createMotionProps;
|
|
20632
20989
|
exports.durations = durations;
|
|
20633
20990
|
exports.durationsReduced = durationsReduced;
|
|
@@ -20890,5 +21247,8 @@ exports.useGeoMapState = useGeoMapState;
|
|
|
20890
21247
|
exports.useNotifications = useNotifications;
|
|
20891
21248
|
exports.usePlatformShellStore = usePlatformShellStore;
|
|
20892
21249
|
exports.usePullToRefresh = usePullToRefresh;
|
|
20893
|
-
|
|
20894
|
-
|
|
21250
|
+
exports.validateDashboardSpec = validateDashboardSpec;
|
|
21251
|
+
exports.xScale = xScale;
|
|
21252
|
+
exports.yScale = yScale;
|
|
21253
|
+
//# sourceMappingURL=chunk-5N6QYUAA.js.map
|
|
21254
|
+
//# sourceMappingURL=chunk-5N6QYUAA.js.map
|