executable-stories-react 0.17.1 → 0.18.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/index.d.cts CHANGED
@@ -192,8 +192,13 @@ declare function DocTag({ entry }: {
192
192
  entry: ReportDocTag;
193
193
  }): react.JSX.Element;
194
194
 
195
- declare function DocKv({ entry }: {
196
- entry: ReportDocKv;
195
+ /**
196
+ * Consecutive `story.kv()` entries share one two-column grid so the values
197
+ * line up whatever the label lengths; a lone entry is just a one-row grid.
198
+ * `ReportDocEntries` groups the runs.
199
+ */
200
+ declare function DocKv({ entries }: {
201
+ entries: readonly ReportDocKv[];
197
202
  }): react.JSX.Element;
198
203
 
199
204
  declare function DocCode({ entry }: {
package/dist/index.d.ts CHANGED
@@ -192,8 +192,13 @@ declare function DocTag({ entry }: {
192
192
  entry: ReportDocTag;
193
193
  }): react.JSX.Element;
194
194
 
195
- declare function DocKv({ entry }: {
196
- entry: ReportDocKv;
195
+ /**
196
+ * Consecutive `story.kv()` entries share one two-column grid so the values
197
+ * line up whatever the label lengths; a lone entry is just a one-row grid.
198
+ * `ReportDocEntries` groups the runs.
199
+ */
200
+ declare function DocKv({ entries }: {
201
+ entries: readonly ReportDocKv[];
197
202
  }): react.JSX.Element;
198
203
 
199
204
  declare function DocCode({ entry }: {
package/dist/index.js CHANGED
@@ -341,11 +341,11 @@ function formatValue(value) {
341
341
  return String(value);
342
342
  }
343
343
  }
344
- function DocKv({ entry }) {
345
- return /* @__PURE__ */ jsxs2("dl", { className: "my-2 flex flex-wrap items-baseline gap-x-2 text-sm", children: [
344
+ function DocKv({ entries }) {
345
+ return /* @__PURE__ */ jsx6("dl", { className: "my-2 grid grid-cols-[max-content_1fr] gap-x-3 gap-y-1 text-sm", children: entries.map((entry, i) => /* @__PURE__ */ jsxs2("div", { className: "contents", children: [
346
346
  /* @__PURE__ */ jsx6("dt", { className: "font-semibold text-muted-foreground", children: entry.label }),
347
347
  /* @__PURE__ */ jsx6("dd", { className: "min-w-0 break-words font-mono text-foreground", children: formatValue(entry.value) })
348
- ] });
348
+ ] }, i)) });
349
349
  }
350
350
 
351
351
  // src/hooks/useRenderers.ts
@@ -432,7 +432,7 @@ function DocSection({ entry }) {
432
432
  if (renderers.section) {
433
433
  return /* @__PURE__ */ jsx10(Fragment2, { children: renderers.section(entry) });
434
434
  }
435
- const html = safeMarkdownHtml(entry.markdown);
435
+ const html = safeMarkdownHtml(dedent(entry.markdown));
436
436
  return /* @__PURE__ */ jsxs5("section", { className: "my-3 text-sm", "aria-label": entry.title, children: [
437
437
  entry.title ? /* @__PURE__ */ jsx10("h4", { className: "mb-1 font-semibold text-foreground", children: entry.title }) : null,
438
438
  /* @__PURE__ */ jsx10(
@@ -618,7 +618,7 @@ function DocEntry({ entry }) {
618
618
  case "tag":
619
619
  return /* @__PURE__ */ jsx17(DocTag, { entry });
620
620
  case "kv":
621
- return /* @__PURE__ */ jsx17(DocKv, { entry });
621
+ return /* @__PURE__ */ jsx17(DocKv, { entries: [entry] });
622
622
  case "code":
623
623
  return /* @__PURE__ */ jsx17(DocCode, { entry });
624
624
  case "table":
@@ -646,7 +646,15 @@ function DocEntry({ entry }) {
646
646
  import { Fragment as Fragment5, jsx as jsx18 } from "react/jsx-runtime";
647
647
  function ReportDocEntries({ entries }) {
648
648
  if (entries.length === 0) return null;
649
- return /* @__PURE__ */ jsx18(Fragment5, { children: entries.map((entry, i) => /* @__PURE__ */ jsx18(DocEntry, { entry }, i)) });
649
+ const groups = [];
650
+ for (const entry of entries) {
651
+ const last = groups[groups.length - 1];
652
+ if (entry.kind === "kv" && Array.isArray(last)) last.push(entry);
653
+ else groups.push(entry.kind === "kv" ? [entry] : entry);
654
+ }
655
+ return /* @__PURE__ */ jsx18(Fragment5, { children: groups.map(
656
+ (g, i) => Array.isArray(g) ? /* @__PURE__ */ jsx18(DocKv, { entries: g }, i) : /* @__PURE__ */ jsx18(DocEntry, { entry: g }, i)
657
+ ) });
650
658
  }
651
659
 
652
660
  // src/components/ReportSteps.tsx
@@ -1436,10 +1444,17 @@ function ReportFeatureIntro({ feature }) {
1436
1444
  dangerouslySetInnerHTML: { __html: safeMarkdownHtml(dedent(feature.narrative)) }
1437
1445
  }
1438
1446
  ) : null,
1439
- hasGlossary ? /* @__PURE__ */ jsx28("dl", { className: "grid gap-1.5", "aria-label": "Glossary", children: feature.glossary.map((entry) => /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap gap-x-2 text-xs", children: [
1440
- /* @__PURE__ */ jsx28("dt", { className: "font-medium text-foreground", children: entry.term }),
1441
- /* @__PURE__ */ jsx28("dd", { className: "flex-1 text-muted-foreground", children: entry.definition })
1442
- ] }, entry.term)) }) : null
1447
+ hasGlossary ? /* @__PURE__ */ jsx28(
1448
+ "dl",
1449
+ {
1450
+ className: "grid grid-cols-[max-content_1fr] gap-x-4 gap-y-1.5 text-xs",
1451
+ "aria-label": "Glossary",
1452
+ children: feature.glossary.map((entry) => /* @__PURE__ */ jsxs19("div", { className: "contents", children: [
1453
+ /* @__PURE__ */ jsx28("dt", { className: "font-medium text-foreground", children: entry.term }),
1454
+ /* @__PURE__ */ jsx28("dd", { className: "text-muted-foreground", children: entry.definition })
1455
+ ] }, entry.term))
1456
+ }
1457
+ ) : null
1443
1458
  ] });
1444
1459
  }
1445
1460
  function featureKindLabel(kind) {
@@ -1455,7 +1470,6 @@ function ReportFeature({ feature }) {
1455
1470
  const titleId = `${feature.id}-title`;
1456
1471
  const bodyId = `${feature.id}-body`;
1457
1472
  const s = feature.summary;
1458
- const skipped = s.skipped + s.pending;
1459
1473
  const collapse = useCollapse();
1460
1474
  const collapsed = collapse?.isCollapsed(feature.id) ?? false;
1461
1475
  const kindLabel = featureKindLabel(feature.kind);
@@ -1495,7 +1509,12 @@ function ReportFeature({ feature }) {
1495
1509
  "p",
1496
1510
  {
1497
1511
  className: "flex shrink-0 items-center gap-1.5 text-xs text-muted-foreground",
1498
- "aria-label": `${s.passed} passed, ${s.failed} failed, ${skipped} skipped`,
1512
+ "aria-label": [
1513
+ `${s.passed} passed`,
1514
+ `${s.failed} failed`,
1515
+ s.skipped > 0 && `${s.skipped} skipped`,
1516
+ s.pending > 0 && `${s.pending} pending`
1517
+ ].filter(Boolean).join(", "),
1499
1518
  children: [
1500
1519
  /* @__PURE__ */ jsxs20("span", { children: [
1501
1520
  s.passed,
@@ -1506,12 +1525,19 @@ function ReportFeature({ feature }) {
1506
1525
  s.failed,
1507
1526
  " failed"
1508
1527
  ] }),
1509
- skipped > 0 ? /* @__PURE__ */ jsxs20(Fragment9, { children: [
1528
+ s.skipped > 0 ? /* @__PURE__ */ jsxs20(Fragment9, { children: [
1510
1529
  /* @__PURE__ */ jsx29("span", { "aria-hidden": true, children: "\xB7" }),
1511
1530
  /* @__PURE__ */ jsxs20("span", { children: [
1512
- skipped,
1531
+ s.skipped,
1513
1532
  " skipped"
1514
1533
  ] })
1534
+ ] }) : null,
1535
+ s.pending > 0 ? /* @__PURE__ */ jsxs20(Fragment9, { children: [
1536
+ /* @__PURE__ */ jsx29("span", { "aria-hidden": true, children: "\xB7" }),
1537
+ /* @__PURE__ */ jsxs20("span", { children: [
1538
+ s.pending,
1539
+ " pending"
1540
+ ] })
1515
1541
  ] }) : null
1516
1542
  ]
1517
1543
  }