@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/artifacts.js CHANGED
@@ -11,11 +11,11 @@ import {
11
11
  artifactToClipboardText,
12
12
  artifactTypes,
13
13
  isSafeDownloadUrl
14
- } from "./chunk-2YCBDSPK.js";
14
+ } from "./chunk-6YZ65KPW.js";
15
15
  import "./chunk-PYDVANWI.js";
16
16
  import "./chunk-LXYCT4YO.js";
17
17
  import "./chunk-OLJIJYB5.js";
18
- import "./chunk-U3IXCSV6.js";
18
+ import "./chunk-PUVZ2S3F.js";
19
19
  import "./chunk-C77QMQNT.js";
20
20
  import "./chunk-UXT2H3FM.js";
21
21
  import "./chunk-JF3P66JF.js";
package/dist/blocks.cjs CHANGED
@@ -1395,11 +1395,6 @@ function coerceNumericColumns(rows, numericKeys) {
1395
1395
 
1396
1396
  // src/components/chart/bar-chart/bar-chart.tsx
1397
1397
  var import_jsx_runtime12 = require("react/jsx-runtime");
1398
- var STACK_TOTAL_KEY = "__stackTotal";
1399
- var VALUE_LABEL_HEADROOM = 20;
1400
- function sumSeries(row, keys) {
1401
- return keys.reduce((sum, key) => sum + (Number(row[key]) || 0), 0);
1402
- }
1403
1398
  function BarChart({
1404
1399
  data,
1405
1400
  xKey,
@@ -1414,7 +1409,6 @@ function BarChart({
1414
1409
  showGrid = true,
1415
1410
  showXAxis = true,
1416
1411
  showYAxis = true,
1417
- showValueLabels,
1418
1412
  xAxisInterval = 0,
1419
1413
  xAxisAngle,
1420
1414
  xAxisTickFormatter
@@ -1425,24 +1419,14 @@ function BarChart({
1425
1419
  [data, seriesKeys]
1426
1420
  );
1427
1421
  const resolvedShowLegend = showLegend ?? series.length > 1;
1428
- const resolvedShowValueLabels = showValueLabels ?? true;
1429
- const plotData = (0, import_react9.useMemo)(() => {
1430
- if (!stacked || !resolvedShowValueLabels) return coercedData;
1431
- return coercedData.map((row) => ({ ...row, [STACK_TOTAL_KEY]: sumSeries(row, seriesKeys) }));
1432
- }, [coercedData, stacked, resolvedShowValueLabels, seriesKeys]);
1433
1422
  const resolvedAngle = xAxisAngle ?? (coercedData.length >= 8 ? -30 : 0);
1434
1423
  const resolvedTickFormatter = (0, import_react9.useMemo)(
1435
1424
  () => xAxisTickFormatter ?? defaultBarTickFormatter(coercedData.length),
1436
1425
  [xAxisTickFormatter, coercedData.length]
1437
1426
  );
1438
1427
  const angledLabelPad = resolvedAngle === 0 ? 0 : Math.min(Math.abs(resolvedAngle) * 0.7, 40);
1439
- const valueLabelHeadroom = resolvedShowValueLabels ? VALUE_LABEL_HEADROOM : 0;
1440
- const chartMargin = {
1441
- ...CHART_MARGIN,
1442
- top: CHART_MARGIN.top + valueLabelHeadroom,
1443
- bottom: CHART_MARGIN.bottom + angledLabelPad
1444
- };
1445
- 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: [
1428
+ const chartMargin = { ...CHART_MARGIN, bottom: CHART_MARGIN.bottom + angledLabelPad };
1429
+ 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: [
1446
1430
  showGrid ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts2.CartesianGrid, { ...CHART_GRID_PROPS }) : null,
1447
1431
  showXAxis ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1448
1432
  import_recharts2.XAxis,
@@ -1469,23 +1453,17 @@ function BarChart({
1469
1453
  content: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ChartLegendContent, { iconType: "square" })
1470
1454
  }
1471
1455
  ) : null,
1472
- series.map((s, i) => {
1473
- const isTopSegment = i === series.length - 1;
1474
- const labelDataKey = stacked ? STACK_TOTAL_KEY : s.key;
1475
- const showLabel = resolvedShowValueLabels && (!stacked || isTopSegment);
1476
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1477
- import_recharts2.Bar,
1478
- {
1479
- dataKey: s.key,
1480
- name: s.label,
1481
- fill: colorForSeriesIndex(i, palette),
1482
- stackId: stacked ? "default" : s.key,
1483
- radius: barRadius(stacked, i, series.length),
1484
- children: showLabel ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_recharts2.LabelList, { dataKey: labelDataKey, position: "top", style: CHART_VALUE_LABEL_STYLE }) : null
1485
- },
1486
- s.key
1487
- );
1488
- })
1456
+ series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1457
+ import_recharts2.Bar,
1458
+ {
1459
+ dataKey: s.key,
1460
+ name: s.label,
1461
+ fill: colorForSeriesIndex(i, palette),
1462
+ stackId: stacked ? "default" : s.key,
1463
+ radius: barRadius(stacked, i, series.length)
1464
+ },
1465
+ s.key
1466
+ ))
1489
1467
  ] }) });
1490
1468
  }
1491
1469
  function barRadius(stacked, seriesIndex, seriesCount) {