@xenosystem/components 0.8.0 → 0.8.1

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/catalog.json CHANGED
@@ -1078,7 +1078,7 @@
1078
1078
  {
1079
1079
  "name": "RowList",
1080
1080
  "file": "rows.tsx",
1081
- "doc": "A vertical list container for {@link Row}s.\r\n\n@example\r\n```tsx\r\n<RowList role=\"listbox\" aria-label=\"Layers\">\r\n {items.map((it) => <Row key={it.id} …/>)}\r\n</RowList>\r\n```",
1081
+ "doc": "A vertical list container for {@link Row}s.\n\n@example\n```tsx\n<RowList role=\"listbox\" aria-label=\"Layers\">\n {items.map((it) => <Row key={it.id} …/>)}\n</RowList>\n```",
1082
1082
  "props": "RowListProps",
1083
1083
  "propList": [
1084
1084
  {
@@ -1104,7 +1104,7 @@
1104
1104
  {
1105
1105
  "name": "Row",
1106
1106
  "file": "rows.tsx",
1107
- "doc": "One dense list row.\r\n\nInteraction contract: when `onClick` is supplied the row becomes keyboard-operable\r\n(`tabIndex=0`, Enter/Space activate). When `disabled`, pointer and keyboard activation are both\r\nsuppressed — the handler is not called, rather than being called and ignored.\r\n\n@example\r\n```tsx\r\n<Row\r\n icon={<EyeIcon />}\r\n label={layer.name}\r\n meta={layer.kind}\r\n trailing={<Badge>{layer.opacity}%</Badge>}\r\n depth={layer.depth}\r\n selected={layer.id === selectedId}\r\n onClick={() => select(layer.id)}\r\n/>\r\n```",
1107
+ "doc": "One dense list row.\n\nInteraction contract: when `onClick` is supplied the row becomes keyboard-operable\n(`tabIndex=0`, Enter/Space activate). When `disabled`, pointer and keyboard activation are both\nsuppressed — the handler is not called, rather than being called and ignored.\n\n@example\n```tsx\n<Row\n icon={<EyeIcon />}\n label={layer.name}\n meta={layer.kind}\n trailing={<Badge>{layer.opacity}%</Badge>}\n depth={layer.depth}\n selected={layer.id === selectedId}\n onClick={() => select(layer.id)}\n/>\n```",
1108
1108
  "props": "RowProps",
1109
1109
  "propList": [
1110
1110
  {
@@ -376,7 +376,6 @@ declare function iconButtonClass(state?: {
376
376
  * @module
377
377
  */
378
378
 
379
- /** Props for {@link RowList}. */
380
379
  interface RowListProps extends HTMLAttributes<HTMLDivElement> {
381
380
  /** Rows. */
382
381
  children?: ReactNode;
@@ -1470,7 +1470,9 @@ function Section({
1470
1470
  }
1471
1471
 
1472
1472
  // src/chrome/rows.tsx
1473
+ import { createContext, useContext } from "react";
1473
1474
  import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
1475
+ var RowListContext = createContext(null);
1474
1476
  function RowList({
1475
1477
  children,
1476
1478
  divided = false,
@@ -1479,7 +1481,7 @@ function RowList({
1479
1481
  ...rest
1480
1482
  }) {
1481
1483
  usePanelPrimitives();
1482
- return /* @__PURE__ */ jsx4(
1484
+ return /* @__PURE__ */ jsx4(RowListContext.Provider, { value: role, children: /* @__PURE__ */ jsx4(
1483
1485
  "div",
1484
1486
  {
1485
1487
  role,
@@ -1487,7 +1489,7 @@ function RowList({
1487
1489
  ...rest,
1488
1490
  children
1489
1491
  }
1490
- );
1492
+ ) });
1491
1493
  }
1492
1494
  function Row({
1493
1495
  icon,
@@ -1509,6 +1511,9 @@ function Row({
1509
1511
  }) {
1510
1512
  usePanelPrimitives();
1511
1513
  const interactive = onClick != null && !disabled;
1514
+ const listRole = useContext(RowListContext);
1515
+ const resolvedRole = role ?? (listRole === "listbox" ? "option" : listRole === "tree" ? "treeitem" : listRole ? "listitem" : void 0);
1516
+ const selectable = resolvedRole === "option" || resolvedRole === "treeitem";
1512
1517
  const handleKeyDown = (e) => {
1513
1518
  onKeyDown?.(e);
1514
1519
  if (!interactive || e.defaultPrevented) return;
@@ -1520,8 +1525,9 @@ function Row({
1520
1525
  return /* @__PURE__ */ jsxs4(
1521
1526
  "div",
1522
1527
  {
1523
- role: role ?? (selected !== void 0 ? "option" : "listitem"),
1524
- "aria-selected": selected,
1528
+ role: resolvedRole,
1529
+ "aria-selected": selectable ? selected : void 0,
1530
+ "aria-current": !selectable && selected ? true : void 0,
1525
1531
  "aria-disabled": disabled || void 0,
1526
1532
  tabIndex: interactive ? 0 : void 0,
1527
1533
  className: rowClass({ selected, active, disabled, interactive }, className),
@@ -1786,14 +1792,14 @@ function gallery() {
1786
1792
  "line ",
1787
1793
  i + 1
1788
1794
  ] }, i)) }));
1789
- form("RowList", "divided", () => /* @__PURE__ */ jsxs7(RowList, { divided: true, children: [
1790
- /* @__PURE__ */ jsx7(Row, { label: "Background", meta: "raster" }),
1795
+ form("RowList", "divided", () => /* @__PURE__ */ jsxs7(RowList, { divided: true, role: "listbox", "aria-label": "Layers", children: [
1796
+ /* @__PURE__ */ jsx7(Row, { label: "Background", meta: "raster", selected: false }),
1791
1797
  /* @__PURE__ */ jsx7(Row, { label: "Title", meta: "text", selected: true }),
1792
- /* @__PURE__ */ jsx7(Row, { label: "Logo", meta: "vector" })
1798
+ /* @__PURE__ */ jsx7(Row, { label: "Logo", meta: "vector", selected: false })
1793
1799
  ] }));
1794
- form("Row", "default", () => /* @__PURE__ */ jsx7(Row, { icon: /* @__PURE__ */ jsx7(IconFrame, { icon: /* @__PURE__ */ jsx7(SearchGlyph, {}) }), label: "Layer", meta: "raster", trailing: /* @__PURE__ */ jsx7(Badge, { children: "3" }) }));
1795
- form("Row", "selected", () => /* @__PURE__ */ jsx7(Row, { label: "Layer", meta: "raster", selected: true }));
1796
- form("Row", "disabled", () => /* @__PURE__ */ jsx7(Row, { label: "Layer", meta: "raster", disabled: true }));
1800
+ form("Row", "default", () => /* @__PURE__ */ jsx7(RowList, { "aria-label": "Layers", children: /* @__PURE__ */ jsx7(Row, { icon: /* @__PURE__ */ jsx7(IconFrame, { icon: /* @__PURE__ */ jsx7(SearchGlyph, {}) }), label: "Layer", meta: "raster", trailing: /* @__PURE__ */ jsx7(Badge, { children: "3" }) }) }));
1801
+ form("Row", "selected", () => /* @__PURE__ */ jsx7(RowList, { role: "listbox", "aria-label": "Layers", children: /* @__PURE__ */ jsx7(Row, { label: "Layer", meta: "raster", selected: true }) }));
1802
+ form("Row", "disabled", () => /* @__PURE__ */ jsx7(RowList, { "aria-label": "Layers", children: /* @__PURE__ */ jsx7(Row, { label: "Layer", meta: "raster", disabled: true }) }));
1797
1803
  form("Section", "default", () => /* @__PURE__ */ jsx7(Section, { title: "Fill", children: /* @__PURE__ */ jsx7("p", { style: { margin: 0 }, children: "Solid \xB7 white" }) }));
1798
1804
  form("Section", "badge-actions", () => /* @__PURE__ */ jsx7(Section, { title: "Effects", badge: /* @__PURE__ */ jsx7(Badge, { children: "2" }), actions: /* @__PURE__ */ jsx7(TextButton, { onClick: noop, children: "Add" }), children: /* @__PURE__ */ jsx7("p", { style: { margin: 0 }, children: "Drop shadow" }) }));
1799
1805
  door("EmptyState", "default", () => /* @__PURE__ */ jsx7(EmptyState, { title: "No runs yet", hint: "Trigger a workflow and its runs appear here." }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenosystem/components",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "XENO Components \u2014 rung 2 of the front ladder: molecules composed from @xenosystem/elements, with no host contract. Families as subpaths: /auth, /navigation, /feedback, /data.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",