@shapesos/clay 0.16.0 → 0.17.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.
package/dist/chat.cjs CHANGED
@@ -1404,11 +1404,6 @@ function coerceNumericColumns(rows, numericKeys) {
1404
1404
 
1405
1405
  // src/components/chart/bar-chart/bar-chart.tsx
1406
1406
  var import_jsx_runtime12 = require("react/jsx-runtime");
1407
- var STACK_TOTAL_KEY = "__stackTotal";
1408
- var VALUE_LABEL_HEADROOM = 20;
1409
- function sumSeries(row, keys) {
1410
- return keys.reduce((sum, key) => sum + (Number(row[key]) || 0), 0);
1411
- }
1412
1407
  function BarChart({
1413
1408
  data,
1414
1409
  xKey,
@@ -1423,7 +1418,6 @@ function BarChart({
1423
1418
  showGrid = true,
1424
1419
  showXAxis = true,
1425
1420
  showYAxis = true,
1426
- showValueLabels,
1427
1421
  xAxisInterval = 0,
1428
1422
  xAxisAngle,
1429
1423
  xAxisTickFormatter
@@ -1434,24 +1428,14 @@ function BarChart({
1434
1428
  [data, seriesKeys]
1435
1429
  );
1436
1430
  const resolvedShowLegend = showLegend ?? series.length > 1;
1437
- const resolvedShowValueLabels = showValueLabels ?? true;
1438
- const plotData = (0, import_react9.useMemo)(() => {
1439
- if (!stacked || !resolvedShowValueLabels) return coercedData;
1440
- return coercedData.map((row) => ({ ...row, [STACK_TOTAL_KEY]: sumSeries(row, seriesKeys) }));
1441
- }, [coercedData, stacked, resolvedShowValueLabels, seriesKeys]);
1442
1431
  const resolvedAngle = xAxisAngle ?? (coercedData.length >= 8 ? -30 : 0);
1443
1432
  const resolvedTickFormatter = (0, import_react9.useMemo)(
1444
1433
  () => xAxisTickFormatter ?? defaultBarTickFormatter(coercedData.length),
1445
1434
  [xAxisTickFormatter, coercedData.length]
1446
1435
  );
1447
1436
  const angledLabelPad = resolvedAngle === 0 ? 0 : Math.min(Math.abs(resolvedAngle) * 0.7, 40);
1448
- const valueLabelHeadroom = resolvedShowValueLabels ? VALUE_LABEL_HEADROOM : 0;
1449
- const chartMargin = {
1450
- ...CHART_MARGIN,
1451
- top: CHART_MARGIN.top + valueLabelHeadroom,
1452
- bottom: CHART_MARGIN.bottom + angledLabelPad
1453
- };
1454
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartContainer, { height, width, className, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_recharts2.BarChart, { data: plotData, margin: chartMargin, barCategoryGap: "22%", children: [
1437
+ const chartMargin = { ...CHART_MARGIN, bottom: CHART_MARGIN.bottom + angledLabelPad };
1438
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartContainer, { height, width, className, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_recharts2.BarChart, { data: coercedData, margin: chartMargin, barCategoryGap: "22%", children: [
1455
1439
  showGrid ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts2.CartesianGrid, { ...CHART_GRID_PROPS }) : null,
1456
1440
  showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1457
1441
  import_recharts2.XAxis,
@@ -1478,23 +1462,17 @@ function BarChart({
1478
1462
  content: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartLegendContent, { iconType: "square" })
1479
1463
  }
1480
1464
  ) : null,
1481
- series.map((s, i) => {
1482
- const isTopSegment = i === series.length - 1;
1483
- const labelDataKey = stacked ? STACK_TOTAL_KEY : s.key;
1484
- const showLabel = resolvedShowValueLabels && (!stacked || isTopSegment);
1485
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1486
- import_recharts2.Bar,
1487
- {
1488
- dataKey: s.key,
1489
- name: s.label,
1490
- fill: colorForSeriesIndex(i, palette),
1491
- stackId: stacked ? "default" : s.key,
1492
- radius: barRadius(stacked, i, series.length),
1493
- children: showLabel ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts2.LabelList, { dataKey: labelDataKey, position: "top", style: CHART_VALUE_LABEL_STYLE }) : null
1494
- },
1495
- s.key
1496
- );
1497
- })
1465
+ series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1466
+ import_recharts2.Bar,
1467
+ {
1468
+ dataKey: s.key,
1469
+ name: s.label,
1470
+ fill: colorForSeriesIndex(i, palette),
1471
+ stackId: stacked ? "default" : s.key,
1472
+ radius: barRadius(stacked, i, series.length)
1473
+ },
1474
+ s.key
1475
+ ))
1498
1476
  ] }) });
1499
1477
  }
1500
1478
  function barRadius(stacked, seriesIndex, seriesCount) {