@datatechsolutions/ui 2.11.51 → 2.11.52

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.
@@ -1,19 +1,19 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunkVZHQMOVM_js = require('../chunk-VZHQMOVM.js');
5
- require('../chunk-2IOPJ5BM.js');
6
- require('../chunk-UZ3CMNUJ.js');
7
- require('../chunk-YXN2K77G.js');
4
+ var chunkAFVXNLGI_js = require('../chunk-AFVXNLGI.js');
5
+ require('../chunk-2BUYACAN.js');
8
6
  require('../chunk-S7KHTUHA.js');
7
+ require('../chunk-UZ3CMNUJ.js');
9
8
  require('../chunk-P4YYEM4B.js');
10
9
  require('../chunk-PWBWP5FJ.js');
10
+ require('../chunk-YXN2K77G.js');
11
11
 
12
12
 
13
13
 
14
14
  Object.defineProperty(exports, "Workspace", {
15
15
  enumerable: true,
16
- get: function () { return chunkVZHQMOVM_js.Workspace; }
16
+ get: function () { return chunkAFVXNLGI_js.Workspace; }
17
17
  });
18
18
  //# sourceMappingURL=workflow-canvas.js.map
19
19
  //# sourceMappingURL=workflow-canvas.js.map
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- export { Workspace } from '../chunk-XRTBXSQY.mjs';
3
- import '../chunk-MDD6H63O.mjs';
4
- import '../chunk-D2JF6C3E.mjs';
5
- import '../chunk-7VJ7CMMT.mjs';
2
+ export { Workspace } from '../chunk-HOCGFL5J.mjs';
3
+ import '../chunk-F2V7GC3Y.mjs';
6
4
  import '../chunk-QWG2FMUN.mjs';
5
+ import '../chunk-D2JF6C3E.mjs';
7
6
  import '../chunk-OZNTQROP.mjs';
8
7
  import '../chunk-TLPPVL3W.mjs';
8
+ import '../chunk-7VJ7CMMT.mjs';
9
9
  //# sourceMappingURL=workflow-canvas.mjs.map
10
10
  //# sourceMappingURL=workflow-canvas.mjs.map
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
+ var chunkS7KHTUHA_js = require('./chunk-S7KHTUHA.js');
4
5
  var chunkUZ3CMNUJ_js = require('./chunk-UZ3CMNUJ.js');
5
6
  var chunkYXN2K77G_js = require('./chunk-YXN2K77G.js');
6
- var chunkS7KHTUHA_js = require('./chunk-S7KHTUHA.js');
7
7
  var Headless6 = require('@headlessui/react');
8
8
  var clsx = require('clsx');
9
9
  var React12 = require('react');
@@ -2032,6 +2032,222 @@ 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
+ }
2035
2251
  function AgentAnalysisCard({ name, avatar, duration, output }) {
2036
2252
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "liquid-surface rounded-xl p-3 transition-all duration-300", children: [
2037
2253
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 mb-1.5", children: [
@@ -20257,6 +20473,7 @@ exports.CardTitle = CardTitle;
20257
20473
  exports.CategoryBadge = CategoryBadge;
20258
20474
  exports.CategoryTab = CategoryTab;
20259
20475
  exports.CategoryTabs = CategoryTabs;
20476
+ exports.ChartRenderer = ChartRenderer;
20260
20477
  exports.ChipPicker = ChipPicker;
20261
20478
  exports.CircularRefreshIndicator = CircularRefreshIndicator;
20262
20479
  exports.Code = Code;
@@ -20628,6 +20845,8 @@ exports.buttonTap = buttonTap;
20628
20845
  exports.cardHover = cardHover;
20629
20846
  exports.cardHoverReduced = cardHoverReduced;
20630
20847
  exports.cardPress = cardPress;
20848
+ exports.computeDomain = computeDomain;
20849
+ exports.computeSeries = computeSeries;
20631
20850
  exports.createMotionProps = createMotionProps;
20632
20851
  exports.durations = durations;
20633
20852
  exports.durationsReduced = durationsReduced;
@@ -20890,5 +21109,7 @@ exports.useGeoMapState = useGeoMapState;
20890
21109
  exports.useNotifications = useNotifications;
20891
21110
  exports.usePlatformShellStore = usePlatformShellStore;
20892
21111
  exports.usePullToRefresh = usePullToRefresh;
20893
- //# sourceMappingURL=chunk-2IOPJ5BM.js.map
20894
- //# sourceMappingURL=chunk-2IOPJ5BM.js.map
21112
+ exports.xScale = xScale;
21113
+ exports.yScale = yScale;
21114
+ //# sourceMappingURL=chunk-2BUYACAN.js.map
21115
+ //# sourceMappingURL=chunk-2BUYACAN.js.map