gridsmith-ui 0.14.0 → 0.16.0

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/dist/charts.d.ts +20 -1
  2. package/dist/charts.js +65 -29
  3. package/dist/charts.js.map +1 -1
  4. package/dist/chat.js +5 -5
  5. package/dist/{chunk-JSQPVRHQ.js → chunk-2U2X6E2X.js} +39 -16
  6. package/dist/chunk-2U2X6E2X.js.map +1 -0
  7. package/dist/{chunk-X4CNZFWC.js → chunk-4LDYR7QP.js} +7 -7
  8. package/dist/chunk-4LDYR7QP.js.map +1 -0
  9. package/dist/chunk-5XOJZQIP.js +427 -0
  10. package/dist/chunk-5XOJZQIP.js.map +1 -0
  11. package/dist/{chunk-PKLVP5ZB.js → chunk-7Q46JXSK.js} +5 -4
  12. package/dist/chunk-7Q46JXSK.js.map +1 -0
  13. package/dist/{chunk-IYD6ZDM2.js → chunk-EMCSARQO.js} +7 -6
  14. package/dist/chunk-EMCSARQO.js.map +1 -0
  15. package/dist/{chunk-CR2KF73R.js → chunk-OENJCGTJ.js} +3 -3
  16. package/dist/{chunk-CR2KF73R.js.map → chunk-OENJCGTJ.js.map} +1 -1
  17. package/dist/{chunk-U2JT37GJ.js → chunk-PVTGMCVR.js} +4 -4
  18. package/dist/{chunk-U2JT37GJ.js.map → chunk-PVTGMCVR.js.map} +1 -1
  19. package/dist/{chunk-QJBCZ7BR.js → chunk-XGSQOMEY.js} +4 -4
  20. package/dist/{chunk-QJBCZ7BR.js.map → chunk-XGSQOMEY.js.map} +1 -1
  21. package/dist/{chunk-M3AARGLI.js → chunk-Z63OSN64.js} +9 -8
  22. package/dist/chunk-Z63OSN64.js.map +1 -0
  23. package/dist/data-grid.js +4 -4
  24. package/dist/editor.js +32 -8
  25. package/dist/editor.js.map +1 -1
  26. package/dist/{feather-B65FI6CY.js → feather-2JFSFLXN.js} +3 -2
  27. package/dist/feather-2JFSFLXN.js.map +1 -0
  28. package/dist/{heroicons-DIR7PXCR.js → heroicons-4AQ4YBVG.js} +3 -2
  29. package/dist/heroicons-4AQ4YBVG.js.map +1 -0
  30. package/dist/icons.d.ts +1 -1
  31. package/dist/icons.js +1 -1
  32. package/dist/index.d.ts +75 -6
  33. package/dist/index.js +1371 -603
  34. package/dist/index.js.map +1 -1
  35. package/dist/kanban.d.ts +11 -1
  36. package/dist/kanban.js +227 -115
  37. package/dist/kanban.js.map +1 -1
  38. package/dist/{lucide-JH2R3TFV.js → lucide-RZC2FEMS.js} +3 -2
  39. package/dist/lucide-RZC2FEMS.js.map +1 -0
  40. package/dist/{phosphor-HCVUMVT5.js → phosphor-CEN25FLM.js} +3 -2
  41. package/dist/phosphor-CEN25FLM.js.map +1 -0
  42. package/dist/resizable.d.ts +11 -1
  43. package/dist/resizable.js +81 -23
  44. package/dist/resizable.js.map +1 -1
  45. package/dist/roots.css +11 -8
  46. package/dist/{tabler-HHIXSM73.js → tabler-YXXC7Y6B.js} +3 -2
  47. package/dist/tabler-YXXC7Y6B.js.map +1 -0
  48. package/package.json +1 -1
  49. package/dist/chunk-IYD6ZDM2.js.map +0 -1
  50. package/dist/chunk-JSQPVRHQ.js.map +0 -1
  51. package/dist/chunk-M3AARGLI.js.map +0 -1
  52. package/dist/chunk-NHQCMOAN.js +0 -137
  53. package/dist/chunk-NHQCMOAN.js.map +0 -1
  54. package/dist/chunk-PKLVP5ZB.js.map +0 -1
  55. package/dist/chunk-X4CNZFWC.js.map +0 -1
  56. package/dist/feather-B65FI6CY.js.map +0 -1
  57. package/dist/heroicons-DIR7PXCR.js.map +0 -1
  58. package/dist/lucide-JH2R3TFV.js.map +0 -1
  59. package/dist/phosphor-HCVUMVT5.js.map +0 -1
  60. package/dist/tabler-HHIXSM73.js.map +0 -1
package/dist/charts.d.ts CHANGED
@@ -8,6 +8,12 @@ interface BarDef {
8
8
  dataKey: string;
9
9
  label?: string;
10
10
  soft?: boolean;
11
+ /**
12
+ * Bars with the same stackId stack into one column (Sprint 25.7, C4); a bar without one stands alone. BarChart's
13
+ * `stacked` puts every bar without a stackId into one stack. The same field works in CompositeChart, where lines
14
+ * draw over the stacks.
15
+ */
16
+ stackId?: string;
11
17
  }
12
18
  interface BarChartProps {
13
19
  /**
@@ -21,6 +27,7 @@ interface BarChartProps {
21
27
  bars: BarDef[];
22
28
  xAxisKey: string;
23
29
  height?: "sm" | "md" | "lg" | number;
30
+ /** Every bar without a stackId joins one stack. */
24
31
  stacked?: boolean;
25
32
  horizontal?: boolean;
26
33
  showGrid?: boolean;
@@ -124,6 +131,13 @@ interface CompositeChartProps {
124
131
  lines: LineDef[];
125
132
  xAxisKey: string;
126
133
  height?: "sm" | "md" | "lg" | number;
134
+ /** Every bar without a stackId joins one stack; lines draw over it (Sprint 25.7, C4). A bar's stackId works too. */
135
+ stacked?: boolean;
136
+ /**
137
+ * The lines on a second axis of their own, on the right, for a line whose unit differs from the bars'. Default: true
138
+ * for bars side by side, false once the bars stack (`stacked` or a bar's stackId), so a capacity or a target line
139
+ * reads against the stack's own scale. An explicit value wins.
140
+ */
127
141
  dualAxis?: boolean;
128
142
  showGrid?: boolean;
129
143
  showTooltip?: boolean;
@@ -262,7 +276,12 @@ interface SparklineProps {
262
276
  declare const Sparkline: react.ForwardRefExoticComponent<SparklineProps & react.RefAttributes<HTMLDivElement>>;
263
277
 
264
278
  interface ChartContainerProps {
265
- height?: "sm" | "md" | "lg";
279
+ /**
280
+ * "fill" (Sprint 25.7, C4): the container fills its row — beside a table in a grid or a flex row — with the chart
281
+ * placed absolutely inside a minimum-height area, so it adds no height of its own: the row takes the table's height,
282
+ * and the chart grows and shrinks with it.
283
+ */
284
+ height?: "sm" | "md" | "lg" | "fill";
266
285
  title?: string;
267
286
  loading?: boolean;
268
287
  emptyState?: ReactNode;
package/dist/charts.js CHANGED
@@ -1,8 +1,8 @@
1
- import { Skeleton } from './chunk-M3AARGLI.js';
2
- import { mergeRefs } from './chunk-PKLVP5ZB.js';
1
+ import { Skeleton } from './chunk-Z63OSN64.js';
2
+ import { mergeRefs } from './chunk-7Q46JXSK.js';
3
3
  import { cn, GLASS_SURFACE } from './chunk-4KVFH5KC.js';
4
4
  import { createContext, forwardRef, useRef, useId, useContext, useMemo, useState, useEffect, useSyncExternalStore, useLayoutEffect } from 'react';
5
- import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Bar, LineChart as LineChart$1, Line, AreaChart as AreaChart$1, Area, PieChart as PieChart$1, Pie, Cell, ComposedChart, ScatterChart as ScatterChart$1, ZAxis, Scatter, RadarChart as RadarChart$1, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, RadialBarChart as RadialBarChart$1, RadialBar, FunnelChart as FunnelChart$1, Funnel, LabelList, Treemap, Sankey, Text } from 'recharts';
5
+ import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Legend, Bar, LineChart as LineChart$1, Line, AreaChart as AreaChart$1, Area, PieChart as PieChart$1, Pie, Cell, ComposedChart, ScatterChart as ScatterChart$1, ZAxis, Scatter, RadarChart as RadarChart$1, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Radar, RadialBarChart as RadialBarChart$1, RadialBar, FunnelChart as FunnelChart$1, Funnel, LabelList, Treemap, Sankey, Text, Rectangle } from 'recharts';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
7
 
8
8
  var CHART_TOKENS = [
@@ -169,6 +169,10 @@ function ChartTooltipContent({ active, payload, label }) {
169
169
  }
170
170
  );
171
171
  }
172
+ function swatchEdge(entry) {
173
+ const stroke = entry.payload?.stroke;
174
+ return typeof stroke === "string" ? stroke : entry.color;
175
+ }
172
176
  function ChartLegendContent({ payload }) {
173
177
  const textSecondary = useResolvedToken("--ds-text-secondary");
174
178
  if (!payload?.length) return null;
@@ -177,7 +181,7 @@ function ChartLegendContent({ payload }) {
177
181
  "span",
178
182
  {
179
183
  className: "shrink-0 rounded-[var(--ds-radius-full)]",
180
- style: { width: 8, height: 8, backgroundColor: entry.color }
184
+ style: { width: 10, height: 10, backgroundColor: entry.color, border: `1.5px solid ${swatchEdge(entry)}` }
181
185
  }
182
186
  ),
183
187
  /* @__PURE__ */ jsx("span", { style: { color: textSecondary }, children: entry.value })
@@ -282,6 +286,29 @@ var ChartWrapper = forwardRef(function ChartWrapper2({ height = "md", className,
282
286
  const heightValue = typeof height === "number" ? `${height}px` : HEIGHT_MAP[height];
283
287
  return /* @__PURE__ */ jsx("div", { ref, className: cn("w-full", className), style: { height: heightValue }, ...ariaLabel ? { role: "img", "aria-label": ariaLabel } : {}, children });
284
288
  });
289
+ function barStackOf(bar, stacked) {
290
+ return bar.stackId ?? (stacked ? "stack" : void 0);
291
+ }
292
+ function anyStack(bars, stacked) {
293
+ return bars.some((bar) => barStackOf(bar, stacked) != null);
294
+ }
295
+ function barShape(bars, index, stacked, radius, horizontal = false) {
296
+ const round = horizontal ? [0, radius, radius, 0] : [radius, radius, 0, 0];
297
+ const square = [0, 0, 0, 0];
298
+ const stack = barStackOf(bars[index], stacked);
299
+ const above = stack == null ? [] : bars.filter((b, j) => j > index && barStackOf(b, stacked) === stack);
300
+ const Shape = (props) => {
301
+ const p = props;
302
+ const row = p.payload ?? {};
303
+ const down = Number(row[bars[index].dataKey]) < 0;
304
+ const onTop = above.every((b) => {
305
+ const value = Number(row[b.dataKey]);
306
+ return !(down ? value < 0 : value > 0);
307
+ });
308
+ return /* @__PURE__ */ jsx(Rectangle, { ...props, radius: onTop ? round : square });
309
+ };
310
+ return Shape;
311
+ }
285
312
  var BarChart = forwardRef(function BarChart2({
286
313
  data,
287
314
  bars,
@@ -309,14 +336,6 @@ var BarChart = forwardRef(function BarChart2({
309
336
  const radius = useRadius();
310
337
  const legendVisible = showLegend ?? bars.length >= 2;
311
338
  const layout = horizontal ? "vertical" : "horizontal";
312
- function getBarRadius(index) {
313
- if (!stacked) {
314
- return horizontal ? [0, radius, radius, 0] : [radius, radius, 0, 0];
315
- }
316
- const isTopmost = index === bars.length - 1;
317
- if (!isTopmost) return [0, 0, 0, 0];
318
- return horizontal ? [0, radius, radius, 0] : [radius, radius, 0, 0];
319
- }
320
339
  const axisLabelStyle = { fontSize: "var(--ds-font-size-xs)", fontFamily: "var(--ds-font-sans)", fill: axisStyle.tick.fill };
321
340
  if (!data?.length) return null;
322
341
  return /* @__PURE__ */ jsx(ChartWrapper, { ref: mergeRefs(ref, wrapperRef), height, className, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(
@@ -324,6 +343,7 @@ var BarChart = forwardRef(function BarChart2({
324
343
  {
325
344
  data,
326
345
  layout,
346
+ stackOffset: anyStack(bars, stacked) ? "sign" : void 0,
327
347
  margin: { top: 4, right: xTicks.endMargin, bottom: 4, left: 4 },
328
348
  accessibilityLayer: true,
329
349
  children: [
@@ -385,8 +405,10 @@ var BarChart = forwardRef(function BarChart2({
385
405
  dataKey: bar.dataKey,
386
406
  name: bar.label ?? bar.dataKey,
387
407
  fill: bar.soft ? softColors[i] : solidColors[i],
388
- radius: getBarRadius(i),
389
- stackId: stacked ? "stack" : void 0,
408
+ stroke: bar.soft ? solidColors[i] : void 0,
409
+ strokeWidth: bar.soft ? 1 : void 0,
410
+ shape: barShape(bars, i, stacked, radius, horizontal),
411
+ stackId: barStackOf(bar, stacked),
390
412
  isAnimationActive: isAnimated
391
413
  },
392
414
  bar.dataKey
@@ -588,7 +610,8 @@ var CompositeChart = forwardRef(function CompositeChart2({
588
610
  xAxisKey,
589
611
  xAxisInterval,
590
612
  height = "md",
591
- dualAxis = true,
613
+ stacked = false,
614
+ dualAxis = !anyStack(bars, stacked),
592
615
  showGrid = true,
593
616
  showTooltip = true,
594
617
  showLegend = true,
@@ -601,6 +624,7 @@ var CompositeChart = forwardRef(function CompositeChart2({
601
624
  const wrapperRef = useRef(null);
602
625
  const xTicks = useCategoryTicks(data, xAxisKey, wrapperRef, xAxisInterval);
603
626
  const barSoftColors = useChartColors(bars.length, true);
627
+ const barSolidColors = useChartColors(bars.length, false);
604
628
  const lineColors = useChartColors(lines.length, false);
605
629
  const gridStroke = useGridStroke();
606
630
  const axisStyle = useAxisStyle();
@@ -608,7 +632,7 @@ var CompositeChart = forwardRef(function CompositeChart2({
608
632
  const radius = useRadius();
609
633
  const axisLabelStyle = { fontSize: "var(--ds-font-size-xs)", fontFamily: "var(--ds-font-sans)", fill: axisStyle.tick.fill };
610
634
  if (!data?.length) return null;
611
- return /* @__PURE__ */ jsx(ChartWrapper, { ref: mergeRefs(ref, wrapperRef), height, className, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data, margin: { top: 4, right: xTicks.endMargin, bottom: 4, left: 4 }, accessibilityLayer: true, children: [
635
+ return /* @__PURE__ */ jsx(ChartWrapper, { ref: mergeRefs(ref, wrapperRef), height, className, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ComposedChart, { data, stackOffset: anyStack(bars, stacked) ? "sign" : void 0, margin: { top: 4, right: xTicks.endMargin, bottom: 4, left: 4 }, accessibilityLayer: true, children: [
612
636
  showGrid && /* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3", stroke: gridStroke }),
613
637
  /* @__PURE__ */ jsx(
614
638
  XAxis,
@@ -644,7 +668,10 @@ var CompositeChart = forwardRef(function CompositeChart2({
644
668
  dataKey: bar.dataKey,
645
669
  name: bar.label ?? bar.dataKey,
646
670
  fill: barSoftColors[i],
647
- radius: [radius, radius, 0, 0],
671
+ stroke: barSolidColors[i],
672
+ strokeWidth: 1,
673
+ shape: barShape(bars, i, stacked, radius),
674
+ stackId: barStackOf(bar, stacked),
648
675
  yAxisId: "left",
649
676
  isAnimationActive: isAnimated
650
677
  },
@@ -1071,11 +1098,13 @@ function ChartContainer({
1071
1098
  children,
1072
1099
  className
1073
1100
  }) {
1101
+ const fill = height === "fill";
1074
1102
  return /* @__PURE__ */ jsxs(
1075
1103
  "div",
1076
1104
  {
1077
1105
  "data-card": "",
1078
1106
  className: cn(
1107
+ fill && "h-full flex flex-col",
1079
1108
  variant === "ghost" ? "bg-transparent" : cn(
1080
1109
  "rounded-[var(--ds-radius-md)] p-ds-4",
1081
1110
  "bg-[var(--ds-bg-surface)] border-[length:var(--ds-border-width)] border-[var(--ds-border-subtle)]",
@@ -1085,18 +1114,25 @@ function ChartContainer({
1085
1114
  ),
1086
1115
  children: [
1087
1116
  title && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-[var(--ds-text-primary)] mb-ds-4", children: title }),
1088
- /* @__PURE__ */ jsx("div", { style: { height: HEIGHT_MAP2[height] }, className: "relative", children: loading ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-end h-full gap-ds-2 px-ds-2", children: [
1089
- /* @__PURE__ */ jsx("div", { className: "flex items-end h-full gap-ds-1", children: [65, 40, 80, 55, 72, 45, 60].map((h, i) => /* @__PURE__ */ jsx(
1090
- Skeleton,
1091
- {
1092
- variant: "custom",
1093
- className: "flex-1",
1094
- height: `${h}%`
1095
- },
1096
- i
1097
- )) }),
1098
- /* @__PURE__ */ jsx(Skeleton, { variant: "text", lines: 1, className: "w-full" })
1099
- ] }) : children ? /* @__PURE__ */ jsx(ChartContainerContext.Provider, { value: true, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full", children }) }) : emptyState ? /* @__PURE__ */ jsx("div", { className: "h-full w-full flex items-center justify-center", children: emptyState }) : null })
1117
+ /* @__PURE__ */ jsx(
1118
+ "div",
1119
+ {
1120
+ style: fill ? { minHeight: HEIGHT_MAP2.sm } : { height: HEIGHT_MAP2[height] },
1121
+ className: cn("relative", fill && "flex-1"),
1122
+ children: /* @__PURE__ */ jsx("div", { className: fill ? "absolute inset-0" : "h-full", children: loading ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-end h-full gap-ds-2 px-ds-2", children: [
1123
+ /* @__PURE__ */ jsx("div", { className: "flex items-end h-full gap-ds-1", children: [65, 40, 80, 55, 72, 45, 60].map((h, i) => /* @__PURE__ */ jsx(
1124
+ Skeleton,
1125
+ {
1126
+ variant: "custom",
1127
+ className: "flex-1",
1128
+ height: `${h}%`
1129
+ },
1130
+ i
1131
+ )) }),
1132
+ /* @__PURE__ */ jsx(Skeleton, { variant: "text", lines: 1, className: "w-full" })
1133
+ ] }) : children ? /* @__PURE__ */ jsx(ChartContainerContext.Provider, { value: true, children: /* @__PURE__ */ jsx("div", { className: "h-full w-full", children }) }) : emptyState ? /* @__PURE__ */ jsx("div", { className: "h-full w-full flex items-center justify-center", children: emptyState }) : null })
1134
+ }
1135
+ )
1100
1136
  ]
1101
1137
  }
1102
1138
  );