@tensor_1/react 2.10.0 → 2.11.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 (66) hide show
  1. package/dist/chart.cjs +3 -12
  2. package/dist/components/Alert.js +7 -15
  3. package/dist/components/AppShell.d.ts +1 -3
  4. package/dist/components/AppShell.js +1 -3
  5. package/dist/components/Avatar.js +1 -2
  6. package/dist/components/Button.js +16 -32
  7. package/dist/components/Card.d.ts +1 -3
  8. package/dist/components/Card.js +2 -2
  9. package/dist/components/Chart.js +3 -12
  10. package/dist/components/CommandPalette.d.ts +2 -4
  11. package/dist/components/CommandPalette.js +13 -66
  12. package/dist/components/Comments.d.ts +1 -5
  13. package/dist/components/Comments.js +1 -1
  14. package/dist/components/Composer.d.ts +1 -8
  15. package/dist/components/Composer.js +2 -7
  16. package/dist/components/DetailLayout.js +1 -1
  17. package/dist/components/Drawer.d.ts +4 -3
  18. package/dist/components/Drawer.js +4 -6
  19. package/dist/components/Field.js +3 -6
  20. package/dist/components/Inbox.d.ts +3 -13
  21. package/dist/components/Inbox.js +3 -61
  22. package/dist/components/Input.d.ts +2 -13
  23. package/dist/components/Input.js +5 -20
  24. package/dist/components/Kanban.d.ts +3 -15
  25. package/dist/components/Kanban.js +10 -42
  26. package/dist/components/Meter.d.ts +1 -3
  27. package/dist/components/Meter.js +1 -9
  28. package/dist/components/Modal.d.ts +5 -3
  29. package/dist/components/Modal.js +4 -6
  30. package/dist/components/NavFavourites.js +0 -11
  31. package/dist/components/PageHeader.d.ts +1 -3
  32. package/dist/components/PageHeader.js +2 -2
  33. package/dist/components/Peek.d.ts +4 -3
  34. package/dist/components/Peek.js +6 -9
  35. package/dist/components/Progress.d.ts +1 -3
  36. package/dist/components/Progress.js +3 -5
  37. package/dist/components/Radio.d.ts +1 -3
  38. package/dist/components/Radio.js +2 -6
  39. package/dist/components/Sidebar.js +2 -4
  40. package/dist/components/Spinner.d.ts +1 -3
  41. package/dist/components/Spinner.js +3 -3
  42. package/dist/components/Stat.js +1 -5
  43. package/dist/components/States.d.ts +1 -3
  44. package/dist/components/States.js +2 -8
  45. package/dist/components/Table.d.ts +2 -9
  46. package/dist/components/Table.js +6 -10
  47. package/dist/components/Tabs.d.ts +1 -13
  48. package/dist/components/Tabs.js +3 -78
  49. package/dist/components/Timeline.d.ts +3 -3
  50. package/dist/components/Timeline.js +3 -3
  51. package/dist/components/Toast.js +5 -42
  52. package/dist/components/Tooltip.d.ts +1 -3
  53. package/dist/components/Tooltip.js +5 -44
  54. package/dist/components/Tree.d.ts +0 -2
  55. package/dist/components/Tree.js +4 -26
  56. package/dist/hooks/useDialog.d.ts +1 -1
  57. package/dist/hooks/useDialog.js +2 -17
  58. package/dist/hooks/useTable.d.ts +0 -5
  59. package/dist/hooks/useTable.js +1 -20
  60. package/dist/index.cjs +162 -616
  61. package/dist/index.d.cts +37 -127
  62. package/dist/index.d.ts +2 -2
  63. package/dist/index.js +1 -2
  64. package/dist/tree-model.d.ts +0 -4
  65. package/dist/tree-model.js +0 -8
  66. package/package.json +1 -1
package/dist/chart.cjs CHANGED
@@ -53,12 +53,6 @@ function readToken(name) {
53
53
  function uixChartPalette() {
54
54
  return [1, 2, 3, 4, 5, 6, 7, 8].map((i) => readToken(`--uix-chart-${i}`));
55
55
  }
56
- function motionSafe(option) {
57
- if (typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches) {
58
- return { ...option, animation: false };
59
- }
60
- return option;
61
- }
62
56
  function Chart({
63
57
  option,
64
58
  title,
@@ -80,11 +74,8 @@ function Chart({
80
74
  if (!el) return;
81
75
  const chart = echarts.init(el, null, { renderer: "svg" });
82
76
  chartRef.current = chart;
83
- chart.setOption(motionSafe(option));
77
+ chart.setOption(option);
84
78
  onReady?.(chart);
85
- if (!ariaLabel && !title && !(tableData && tableData.length > 0)) {
86
- console.warn("[uix] Chart has no text alternative \u2014 provide ariaLabel, title, or tableData.");
87
- }
88
79
  const ro = new ResizeObserver(() => chart.resize());
89
80
  ro.observe(el);
90
81
  return () => {
@@ -94,7 +85,7 @@ function Chart({
94
85
  };
95
86
  }, []);
96
87
  (0, import_react.useEffect)(() => {
97
- chartRef.current?.setOption(motionSafe(option), { notMerge: false });
88
+ chartRef.current?.setOption(option, { notMerge: false });
98
89
  }, [option]);
99
90
  const heightVal = typeof height === "number" ? `${height}px` : height;
100
91
  const effectiveAriaLabel = ariaLabel ?? title ?? "Chart";
@@ -119,7 +110,7 @@ function Chart({
119
110
  "table",
120
111
  {
121
112
  id: tableId,
122
- className: "uix-visually-hidden",
113
+ className: "sr-only",
123
114
  "aria-label": `${effectiveAriaLabel} \u2014 data table`,
124
115
  children: [
125
116
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { scope: "col", children: h }, h)) }) }),
@@ -1,21 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cx } from "../cx.js";
3
3
  function Alert({ tone, title, icon, children, className, ...props }) {
4
- return /* @__PURE__ */ jsxs(
5
- "div",
6
- {
7
- className: cx("uix-alert", tone && tone !== "neutral" && `uix-alert--${tone}`, className),
8
- role: tone === "danger" || tone === "warning" ? "alert" : "status",
9
- ...props,
10
- children: [
11
- icon && /* @__PURE__ */ jsx("div", { className: "uix-alert__icon", children: icon }),
12
- /* @__PURE__ */ jsxs("div", { children: [
13
- title && /* @__PURE__ */ jsx("div", { className: "uix-alert__title", children: title }),
14
- children && /* @__PURE__ */ jsx("div", { className: "uix-alert__body", children })
15
- ] })
16
- ]
17
- }
18
- );
4
+ return /* @__PURE__ */ jsxs("div", { className: cx("uix-alert", tone && tone !== "neutral" && `uix-alert--${tone}`, className), ...props, children: [
5
+ icon && /* @__PURE__ */ jsx("div", { className: "uix-alert__icon", children: icon }),
6
+ /* @__PURE__ */ jsxs("div", { children: [
7
+ title && /* @__PURE__ */ jsx("div", { className: "uix-alert__title", children: title }),
8
+ children && /* @__PURE__ */ jsx("div", { className: "uix-alert__body", children })
9
+ ] })
10
+ ] });
19
11
  }
20
12
  export {
21
13
  Alert
@@ -17,12 +17,10 @@ interface AppShellProps extends HTMLAttributes<HTMLDivElement> {
17
17
  onExitFocus?: () => void;
18
18
  /** Drop the content gutter so a genuinely wide table runs edge-to-edge. */
19
19
  mainBleed?: boolean;
20
- /** id given to `<main>` and targeted by the skip link. Override on collision (UIX-A11Y-2). */
21
- mainId?: string;
22
20
  sidebar?: ReactNode;
23
21
  topbar?: ReactNode;
24
22
  children?: ReactNode;
25
23
  }
26
- declare function AppShell({ nav, collapsed, focus, onExitFocus, mainBleed, mainId, sidebar, topbar, children, className, ...props }: AppShellProps): react.JSX.Element;
24
+ declare function AppShell({ nav, collapsed, focus, onExitFocus, mainBleed, sidebar, topbar, children, className, ...props }: AppShellProps): react.JSX.Element;
27
25
 
28
26
  export { AppShell, type AppShellProps, type ShellNav };
@@ -8,7 +8,6 @@ function AppShell({
8
8
  focus,
9
9
  onExitFocus,
10
10
  mainBleed,
11
- mainId = "uix-main",
12
11
  sidebar,
13
12
  topbar,
14
13
  children,
@@ -33,10 +32,9 @@ function AppShell({
33
32
  "data-focus": focus || void 0,
34
33
  ...props,
35
34
  children: [
36
- /* @__PURE__ */ jsx("a", { className: "uix-skiplink", href: `#${mainId}`, children: "Skip to content" }),
37
35
  sidebar && /* @__PURE__ */ jsx("div", { className: "uix-shell__sidebar", children: sidebar }),
38
36
  topbar && /* @__PURE__ */ jsx("div", { className: "uix-shell__topbar", children: topbar }),
39
- /* @__PURE__ */ jsx("main", { id: mainId, tabIndex: -1, className: cx("uix-shell__main", mainBleed && "uix-shell__main--bleed"), children }),
37
+ /* @__PURE__ */ jsx("main", { className: cx("uix-shell__main", mainBleed && "uix-shell__main--bleed"), children }),
40
38
  focus && onExitFocus && /* @__PURE__ */ jsx("div", { className: "uix-shell__focus-exit", children: /* @__PURE__ */ jsx("button", { type: "button", className: "uix-btn uix-btn--secondary uix-btn--sm", onClick: onExitFocus, children: "Esc \xB7 Exit focus" }) })
41
39
  ]
42
40
  }
@@ -3,8 +3,7 @@ import { cx } from "../cx.js";
3
3
  function Avatar({ size = "md", src, alt, children, status, className, ...props }) {
4
4
  return /* @__PURE__ */ jsxs("span", { className: cx("uix-avatar", size !== "md" && `uix-avatar--${size}`, className), ...props, children: [
5
5
  src ? /* @__PURE__ */ jsx("img", { src, alt: alt ?? "" }) : children,
6
- status && /* @__PURE__ */ jsx("span", { className: "uix-avatar__status", "aria-hidden": "true" }),
7
- status && /* @__PURE__ */ jsx("span", { className: "uix-visually-hidden", children: "online" })
6
+ status && /* @__PURE__ */ jsx("span", { className: "uix-avatar__status" })
8
7
  ] });
9
8
  }
10
9
  function AvatarGroup({ children, className, ...props }) {
@@ -1,40 +1,24 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { cx } from "../cx.js";
4
- let warnedIconButton = false;
5
4
  const Button = forwardRef(
6
- ({ variant = "secondary", size = "md", icon = false, loading = false, className, children, disabled, onClick, ...props }, ref) => {
7
- if (!warnedIconButton && icon && children == null && !props["aria-label"] && !props["aria-labelledby"] && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
8
- warnedIconButton = true;
9
- console.warn("uix: icon-only <Button> has no accessible name \u2014 pass aria-label or aria-labelledby.");
5
+ ({ variant = "secondary", size = "md", icon = false, loading = false, className, children, disabled, ...props }, ref) => /* @__PURE__ */ jsx(
6
+ "button",
7
+ {
8
+ ref,
9
+ className: cx(
10
+ "uix-btn",
11
+ `uix-btn--${variant}`,
12
+ size !== "md" && `uix-btn--${size}`,
13
+ icon && "uix-btn--icon",
14
+ className
15
+ ),
16
+ disabled: disabled || loading,
17
+ "data-loading": loading || void 0,
18
+ ...props,
19
+ children
10
20
  }
11
- return /* @__PURE__ */ jsx(
12
- "button",
13
- {
14
- ref,
15
- className: cx(
16
- "uix-btn",
17
- `uix-btn--${variant}`,
18
- size !== "md" && `uix-btn--${size}`,
19
- icon && "uix-btn--icon",
20
- className
21
- ),
22
- disabled,
23
- "aria-disabled": loading || void 0,
24
- "aria-busy": loading || void 0,
25
- "data-loading": loading || void 0,
26
- onClick: loading || onClick ? (e) => {
27
- if (loading) {
28
- e.preventDefault();
29
- return;
30
- }
31
- onClick?.(e);
32
- } : void 0,
33
- ...props,
34
- children
35
- }
36
- );
37
- }
21
+ )
38
22
  );
39
23
  Button.displayName = "Button";
40
24
  function ButtonGroup({ children, className }) {
@@ -3,13 +3,11 @@ import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
5
5
  title?: ReactNode;
6
- /** Element for the title — pick a real heading to slot the card into the page outline (UIX-A11Y-4). Default `div` keeps legacy rendering. */
7
- titleAs?: 'h2' | 'h3' | 'h4' | 'div';
8
6
  subtitle?: ReactNode;
9
7
  headerAction?: ReactNode;
10
8
  footer?: ReactNode;
11
9
  children?: ReactNode;
12
10
  }
13
- declare function Card({ title, titleAs: TitleTag, subtitle, headerAction, footer, children, className, ...props }: CardProps): react.JSX.Element;
11
+ declare function Card({ title, subtitle, headerAction, footer, children, className, ...props }: CardProps): react.JSX.Element;
14
12
 
15
13
  export { Card, type CardProps };
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cx } from "../cx.js";
3
- function Card({ title, titleAs: TitleTag = "div", subtitle, headerAction, footer, children, className, ...props }) {
3
+ function Card({ title, subtitle, headerAction, footer, children, className, ...props }) {
4
4
  const hasHeader = title != null || subtitle != null || headerAction != null;
5
5
  return /* @__PURE__ */ jsxs("div", { className: cx("uix-card", className), ...props, children: [
6
6
  hasHeader && /* @__PURE__ */ jsxs("div", { className: "uix-card__header", children: [
7
7
  /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
8
- title && /* @__PURE__ */ jsx(TitleTag, { className: "uix-card__title", children: title }),
8
+ title && /* @__PURE__ */ jsx("div", { className: "uix-card__title", children: title }),
9
9
  subtitle && /* @__PURE__ */ jsx("div", { className: "uix-card__subtitle", children: subtitle })
10
10
  ] }),
11
11
  headerAction
@@ -10,12 +10,6 @@ function readToken(name) {
10
10
  function uixChartPalette() {
11
11
  return [1, 2, 3, 4, 5, 6, 7, 8].map((i) => readToken(`--uix-chart-${i}`));
12
12
  }
13
- function motionSafe(option) {
14
- if (typeof matchMedia !== "undefined" && matchMedia("(prefers-reduced-motion: reduce)").matches) {
15
- return { ...option, animation: false };
16
- }
17
- return option;
18
- }
19
13
  function Chart({
20
14
  option,
21
15
  title,
@@ -37,11 +31,8 @@ function Chart({
37
31
  if (!el) return;
38
32
  const chart = echarts.init(el, null, { renderer: "svg" });
39
33
  chartRef.current = chart;
40
- chart.setOption(motionSafe(option));
34
+ chart.setOption(option);
41
35
  onReady?.(chart);
42
- if (!ariaLabel && !title && !(tableData && tableData.length > 0)) {
43
- console.warn("[uix] Chart has no text alternative \u2014 provide ariaLabel, title, or tableData.");
44
- }
45
36
  const ro = new ResizeObserver(() => chart.resize());
46
37
  ro.observe(el);
47
38
  return () => {
@@ -51,7 +42,7 @@ function Chart({
51
42
  };
52
43
  }, []);
53
44
  useEffect(() => {
54
- chartRef.current?.setOption(motionSafe(option), { notMerge: false });
45
+ chartRef.current?.setOption(option, { notMerge: false });
55
46
  }, [option]);
56
47
  const heightVal = typeof height === "number" ? `${height}px` : height;
57
48
  const effectiveAriaLabel = ariaLabel ?? title ?? "Chart";
@@ -76,7 +67,7 @@ function Chart({
76
67
  "table",
77
68
  {
78
69
  id: tableId,
79
- className: "uix-visually-hidden",
70
+ className: "sr-only",
80
71
  "aria-label": `${effectiveAriaLabel} \u2014 data table`,
81
72
  children: [
82
73
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ jsx("th", { scope: "col", children: h }, h)) }) }),
@@ -8,9 +8,7 @@ interface CommandPaletteProps extends HTMLAttributes<HTMLDivElement> {
8
8
  }
9
9
  /**
10
10
  * ⌘K command palette surface over `.uix-cmdk`. Presentational: mount it inside a
11
- * Modal/Popover and wire search + keyboard selection in the consumer. The input is
12
- * a combobox over the listbox of `CommandItem`s; spreads override every default, so
13
- * consumers already passing their own roles/labels keep working.
11
+ * Modal/Popover and wire search + keyboard selection in the consumer.
14
12
  */
15
13
  declare function CommandPalette({ inputProps, children, className, ...props }: CommandPaletteProps): react.JSX.Element;
16
14
  interface CommandGroupProps {
@@ -27,6 +25,6 @@ interface CommandItemProps extends HTMLAttributes<HTMLDivElement> {
27
25
  children?: ReactNode;
28
26
  }
29
27
  /** A single command row over `.uix-cmdk__item`. */
30
- declare function CommandItem({ icon, shortcut, active, children, className, id, ...props }: CommandItemProps): react.JSX.Element;
28
+ declare function CommandItem({ icon, shortcut, active, children, className, ...props }: CommandItemProps): react.JSX.Element;
31
29
 
32
30
  export { CommandGroup, type CommandGroupProps, CommandItem, type CommandItemProps, CommandPalette, type CommandPaletteProps };
@@ -1,76 +1,23 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { createContext, useCallback, useContext, useEffect, useId, useMemo, useState } from "react";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
2
  import { cx } from "../cx.js";
5
- const CmdkContext = createContext(null);
6
3
  function CommandPalette({ inputProps, children, className, ...props }) {
7
- const listId = useId();
8
- const [activeId, setActiveId] = useState(null);
9
- const [count, setCount] = useState(0);
10
- const [announced, setAnnounced] = useState("");
11
- const setActive = useCallback((id, active) => {
12
- setActiveId((cur) => active ? id : cur === id ? null : cur);
13
- }, []);
14
- const registerItem = useCallback(() => {
15
- setCount((c) => c + 1);
16
- return () => setCount((c) => c - 1);
17
- }, []);
18
- useEffect(() => {
19
- const t = window.setTimeout(() => setAnnounced(`${count} result${count === 1 ? "" : "s"}`), 150);
20
- return () => clearTimeout(t);
21
- }, [count]);
22
- const ctx = useMemo(() => ({ listId, setActive, registerItem }), [listId, setActive, registerItem]);
23
- return /* @__PURE__ */ jsx(CmdkContext.Provider, { value: ctx, children: /* @__PURE__ */ jsxs("div", { className: cx("uix-cmdk", className), ...props, children: [
24
- /* @__PURE__ */ jsx(
25
- "input",
26
- {
27
- className: "uix-cmdk__input",
28
- role: "combobox",
29
- "aria-expanded": "true",
30
- "aria-autocomplete": "list",
31
- "aria-controls": listId,
32
- "aria-activedescendant": activeId ?? void 0,
33
- "aria-label": "Command palette",
34
- ...inputProps
35
- }
36
- ),
37
- /* @__PURE__ */ jsx("div", { className: "uix-cmdk__list", role: "listbox", id: listId, children }),
38
- /* @__PURE__ */ jsx("span", { className: "uix-visually-hidden", role: "status", children: announced })
39
- ] }) });
4
+ return /* @__PURE__ */ jsxs("div", { className: cx("uix-cmdk", className), ...props, children: [
5
+ /* @__PURE__ */ jsx("input", { className: "uix-cmdk__input", ...inputProps }),
6
+ /* @__PURE__ */ jsx("div", { className: "uix-cmdk__list", children })
7
+ ] });
40
8
  }
41
9
  function CommandGroup({ label, children }) {
42
- const labelId = useId();
43
- return /* @__PURE__ */ jsxs("div", { role: "group", "aria-labelledby": label != null ? labelId : void 0, children: [
44
- label != null && /* @__PURE__ */ jsx("div", { className: "uix-cmdk__group", id: labelId, children: label }),
10
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
11
+ label != null && /* @__PURE__ */ jsx("div", { className: "uix-cmdk__group", children: label }),
45
12
  children
46
13
  ] });
47
14
  }
48
- function CommandItem({ icon, shortcut, active, children, className, id, ...props }) {
49
- const ctx = useContext(CmdkContext);
50
- const autoId = useId();
51
- const itemId = id ?? autoId;
52
- useEffect(() => ctx?.registerItem(), [ctx]);
53
- useEffect(() => {
54
- if (!ctx || !active) return;
55
- ctx.setActive(itemId, true);
56
- return () => ctx.setActive(itemId, false);
57
- }, [ctx, itemId, active]);
58
- return /* @__PURE__ */ jsxs(
59
- "div",
60
- {
61
- className: cx("uix-cmdk__item", className),
62
- "data-active": active || void 0,
63
- id: itemId,
64
- role: "option",
65
- "aria-selected": !!active,
66
- ...props,
67
- children: [
68
- icon,
69
- /* @__PURE__ */ jsx("span", { children }),
70
- shortcut
71
- ]
72
- }
73
- );
15
+ function CommandItem({ icon, shortcut, active, children, className, ...props }) {
16
+ return /* @__PURE__ */ jsxs("div", { className: cx("uix-cmdk__item", className), "data-active": active || void 0, ...props, children: [
17
+ icon,
18
+ /* @__PURE__ */ jsx("span", { children }),
19
+ shortcut
20
+ ] });
74
21
  }
75
22
  export {
76
23
  CommandGroup,
@@ -4,11 +4,7 @@ import { HTMLAttributes, ReactNode } from 'react';
4
4
  interface CommentsProps extends HTMLAttributes<HTMLDivElement> {
5
5
  children?: ReactNode;
6
6
  }
7
- /**
8
- * Comment thread container over `.uix-comments`. role="log" is an implicit polite
9
- * live region: comments appended after initial render are announced, the initial
10
- * list is not (UIX-A11Y-3). Pass `role` to override.
11
- */
7
+ /** Comment thread container over `.uix-comments`. */
12
8
  declare function Comments({ children, className, ...props }: CommentsProps): react.JSX.Element;
13
9
  interface CommentProps extends HTMLAttributes<HTMLDivElement> {
14
10
  /** Usually an `<Avatar />` (the grid reserves the leading column). */
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { cx } from "../cx.js";
3
3
  function Comments({ children, className, ...props }) {
4
- return /* @__PURE__ */ jsx("div", { role: "log", className: cx("uix-comments", className), ...props, children });
4
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-comments", className), ...props, children });
5
5
  }
6
6
  function Comment({ avatar, author, meta, children, className, ...props }) {
7
7
  return /* @__PURE__ */ jsxs("div", { className: cx("uix-comment", className), ...props, children: [
@@ -3,8 +3,6 @@ import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  interface ComposerProps extends HTMLAttributes<HTMLDivElement> {
5
5
  children?: ReactNode;
6
- /** Accessible name for the child `<textarea>`; applied as its `aria-label`. */
7
- label?: string;
8
6
  }
9
7
  /**
10
8
  * Composer surface over `.uix-composer` — a single box that owns the
@@ -12,13 +10,8 @@ interface ComposerProps extends HTMLAttributes<HTMLDivElement> {
12
10
  * `<ComposerBar>` inside; the descendant `textarea` picks up the composer's
13
11
  * padding/typography automatically, so the input never reads as a second
14
12
  * nested box.
15
- *
16
- * A placeholder is not an accessible name, so the composer labels a bare child
17
- * `<textarea>` with `label` (default "Add a comment"); a textarea that brings its
18
- * own `aria-label`/`aria-labelledby` — or an `id` (likely tied to an external
19
- * `<label htmlFor>`) — is left untouched (UIX-A11Y-3).
20
13
  */
21
- declare function Composer({ children, className, label, ...props }: ComposerProps): react.JSX.Element;
14
+ declare function Composer({ children, className, ...props }: ComposerProps): react.JSX.Element;
22
15
  interface ComposerBarProps extends HTMLAttributes<HTMLDivElement> {
23
16
  children?: ReactNode;
24
17
  }
@@ -1,12 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Children, cloneElement, isValidElement } from "react";
3
2
  import { cx } from "../cx.js";
4
- function Composer({ children, className, label = "Add a comment", ...props }) {
5
- return /* @__PURE__ */ jsx("div", { className: cx("uix-composer", className), ...props, children: Children.map(children, (child) => {
6
- if (!isValidElement(child) || child.type !== "textarea") return child;
7
- const p = child.props;
8
- return p["aria-label"] || p["aria-labelledby"] || p.id ? child : cloneElement(child, { "aria-label": label });
9
- }) });
3
+ function Composer({ children, className, ...props }) {
4
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-composer", className), ...props, children });
10
5
  }
11
6
  function ComposerBar({ children, className, ...props }) {
12
7
  return /* @__PURE__ */ jsx("div", { className: cx("uix-composer__bar", className), ...props, children });
@@ -3,7 +3,7 @@ import { cx } from "../cx.js";
3
3
  function DetailLayout({ side, children, className, ...props }) {
4
4
  return /* @__PURE__ */ jsxs("div", { className: cx("uix-detail", className), ...props, children: [
5
5
  /* @__PURE__ */ jsx("div", { className: "uix-detail__main", children }),
6
- side != null && /* @__PURE__ */ jsx("aside", { className: "uix-detail__side", children: side })
6
+ side != null && /* @__PURE__ */ jsx("div", { className: "uix-detail__side", children: side })
7
7
  ] });
8
8
  }
9
9
  export {
@@ -1,13 +1,14 @@
1
1
  import * as react from 'react';
2
- import { HTMLAttributes, ReactNode } from 'react';
2
+ import { ReactNode } from 'react';
3
3
 
4
- interface DrawerProps extends Omit<HTMLAttributes<HTMLDialogElement>, 'title'> {
4
+ interface DrawerProps {
5
5
  open: boolean;
6
6
  onClose?: () => void;
7
7
  title?: ReactNode;
8
8
  children?: ReactNode;
9
9
  footer?: ReactNode;
10
+ className?: string;
10
11
  }
11
- declare function Drawer({ open, onClose, title, children, footer, className, ...rest }: DrawerProps): react.JSX.Element;
12
+ declare function Drawer({ open, onClose, title, children, footer, className }: DrawerProps): react.JSX.Element;
12
13
 
13
14
  export { Drawer, type DrawerProps };
@@ -1,15 +1,13 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useId } from "react";
4
3
  import { cx } from "../cx.js";
5
4
  import { useDialog } from "../hooks/useDialog.js";
6
5
  const CloseIcon = () => /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) });
7
- function Drawer({ open, onClose, title, children, footer, className, ...rest }) {
8
- const ref = useDialog(open, onClose);
9
- const titleId = useId();
10
- return /* @__PURE__ */ jsxs("dialog", { ref, className: cx("uix-drawer", className), "aria-labelledby": title ? titleId : void 0, ...rest, children: [
6
+ function Drawer({ open, onClose, title, children, footer, className }) {
7
+ const ref = useDialog(open);
8
+ return /* @__PURE__ */ jsxs("dialog", { ref, className: cx("uix-drawer", className), onClose, children: [
11
9
  (title != null || onClose) && /* @__PURE__ */ jsxs("div", { className: "uix-drawer__header", children: [
12
- title && /* @__PURE__ */ jsx("h2", { id: titleId, style: { fontWeight: 600, fontSize: "var(--uix-text-h3)", fontFamily: "inherit", letterSpacing: "inherit", lineHeight: "inherit" }, children: title }),
10
+ title && /* @__PURE__ */ jsx("div", { style: { fontWeight: 600, fontSize: "var(--uix-text-h3)" }, children: title }),
13
11
  onClose && /* @__PURE__ */ jsx(
14
12
  "button",
15
13
  {
@@ -5,17 +5,14 @@ function Field({ label, hint, error, success, required, children, className, htm
5
5
  const uid = useId();
6
6
  const msgId = `${uid}-msg`;
7
7
  const describedBy = error || success || hint ? msgId : void 0;
8
- const controlId = isValidElement(children) ? children.props.id ?? `${uid}-ctl` : void 0;
9
8
  const control = isValidElement(children) ? cloneElement(children, {
10
- id: controlId,
11
9
  "aria-describedby": [children.props["aria-describedby"], describedBy].filter(Boolean).join(" ") || void 0,
12
- "aria-invalid": error ? true : children.props["aria-invalid"],
13
- "aria-required": children.props["aria-required"] ?? (required || void 0)
10
+ "aria-invalid": error ? true : children.props["aria-invalid"]
14
11
  }) : children;
15
12
  return /* @__PURE__ */ jsxs("div", { className: cx("uix-field", className), children: [
16
- label && /* @__PURE__ */ jsx("label", { className: "uix-field__label", htmlFor: htmlFor ?? controlId, "data-required": required || void 0, children: label }),
13
+ label && /* @__PURE__ */ jsx("label", { className: "uix-field__label", htmlFor, "data-required": required || void 0, children: label }),
17
14
  control,
18
- /* @__PURE__ */ jsx("div", { className: "uix-field__msg", id: msgId, children: error ? /* @__PURE__ */ jsx("span", { className: "uix-field__error", role: "alert", children: error }) : success ? /* @__PURE__ */ jsx("span", { className: "uix-field__success", role: "status", children: success }) : hint ? /* @__PURE__ */ jsx("span", { className: "uix-field__hint", children: hint }) : null })
15
+ /* @__PURE__ */ jsx("div", { className: "uix-field__msg", id: msgId, children: error ? /* @__PURE__ */ jsx("span", { className: "uix-field__error", role: "alert", children: error }) : success ? /* @__PURE__ */ jsx("span", { className: "uix-field__success", children: success }) : hint ? /* @__PURE__ */ jsx("span", { className: "uix-field__hint", children: hint }) : null })
19
16
  ] });
20
17
  }
21
18
  export {
@@ -2,24 +2,14 @@ import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  interface InboxProps extends HTMLAttributes<HTMLDivElement> {
5
- /**
6
- * Which pane a narrow viewport (<700px) shows: 'list' (default, matches the old
7
- * behaviour) or 'detail'. Consumers should render a Back control in the detail pane
8
- * on narrow viewports to return to the list (UIX-A11Y-2).
9
- */
10
- view?: 'list' | 'detail';
11
5
  children?: ReactNode;
12
6
  }
13
7
  /** Two-pane inbox master-detail container backed by `.uix-inbox`. Place `<InboxList>` and `<InboxDetail>` as children. */
14
- declare function Inbox({ view, children, className, ...props }: InboxProps): react.JSX.Element;
8
+ declare function Inbox({ children, className, ...props }: InboxProps): react.JSX.Element;
15
9
  interface InboxListProps extends HTMLAttributes<HTMLDivElement> {
16
10
  children?: ReactNode;
17
11
  }
18
- /**
19
- * Left-pane item list. Place `<InboxItem>` children here. A keyboard listbox
20
- * (UIX-A11Y-2): the list is the single tab stop; ArrowUp/ArrowDown/Home/End move the
21
- * active option via `aria-activedescendant`, Enter/Space click it.
22
- */
12
+ /** Left-pane item list. Place `<InboxItem>` children here. */
23
13
  declare function InboxList({ children, className, ...props }: InboxListProps): react.JSX.Element;
24
14
  interface InboxItemProps extends HTMLAttributes<HTMLDivElement> {
25
15
  /** Primary subject / title line. */
@@ -35,7 +25,7 @@ interface InboxItemProps extends HTMLAttributes<HTMLDivElement> {
35
25
  children?: ReactNode;
36
26
  }
37
27
  /** A single inbox row with subject, preview excerpt, optional leading slot, and unread/selected states. */
38
- declare function InboxItem({ subject, preview, leading, unread, selected, children, className, id, ...props }: InboxItemProps): react.JSX.Element;
28
+ declare function InboxItem({ subject, preview, leading, unread, selected, children, className, ...props }: InboxItemProps): react.JSX.Element;
39
29
  interface InboxDetailProps extends HTMLAttributes<HTMLDivElement> {
40
30
  children?: ReactNode;
41
31
  }
@@ -1,63 +1,11 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { createContext, useContext, useId, useMemo, useRef, useState } from "react";
4
3
  import { cx } from "../cx.js";
5
- function Inbox({ view, children, className, ...props }) {
6
- return /* @__PURE__ */ jsx("div", { className: cx("uix-inbox", className), "data-view": view, ...props, children });
4
+ function Inbox({ children, className, ...props }) {
5
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-inbox", className), ...props, children });
7
6
  }
8
- const InboxListCtx = createContext({});
9
7
  function InboxList({ children, className, ...props }) {
10
- const listRef = useRef(null);
11
- const [activeId, setActiveId] = useState(void 0);
12
- const ctx = useMemo(() => ({ activeId }), [activeId]);
13
- const onKeyDown = (e) => {
14
- const opts = Array.from(listRef.current?.querySelectorAll('[role="option"]') ?? []);
15
- if (opts.length === 0) return;
16
- const idx = opts.findIndex((el2) => el2.id === activeId);
17
- let next;
18
- switch (e.key) {
19
- case "ArrowDown":
20
- next = Math.min(idx + 1, opts.length - 1);
21
- break;
22
- case "ArrowUp":
23
- next = idx < 0 ? 0 : Math.max(idx - 1, 0);
24
- break;
25
- case "Home":
26
- next = 0;
27
- break;
28
- case "End":
29
- next = opts.length - 1;
30
- break;
31
- case "Enter":
32
- case " ":
33
- if (idx >= 0) {
34
- e.preventDefault();
35
- opts[idx]?.click();
36
- }
37
- return;
38
- default:
39
- return;
40
- }
41
- e.preventDefault();
42
- const el = opts[next];
43
- if (!el || !el.id) return;
44
- setActiveId(el.id);
45
- el.scrollIntoView({ block: "nearest" });
46
- };
47
- return /* @__PURE__ */ jsx(InboxListCtx.Provider, { value: ctx, children: /* @__PURE__ */ jsx(
48
- "div",
49
- {
50
- ref: listRef,
51
- className: cx("uix-inbox__list", className),
52
- role: "listbox",
53
- tabIndex: 0,
54
- "aria-label": "Inbox",
55
- "aria-activedescendant": activeId,
56
- onKeyDown,
57
- ...props,
58
- children
59
- }
60
- ) });
8
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-inbox__list", className), role: "listbox", ...props, children });
61
9
  }
62
10
  function InboxItem({
63
11
  subject,
@@ -67,19 +15,13 @@ function InboxItem({
67
15
  selected,
68
16
  children,
69
17
  className,
70
- id,
71
18
  ...props
72
19
  }) {
73
- const autoId = useId();
74
- const itemId = id ?? autoId;
75
- const { activeId } = useContext(InboxListCtx);
76
20
  return /* @__PURE__ */ jsxs(
77
21
  "div",
78
22
  {
79
23
  role: "option",
80
- id: itemId,
81
24
  "aria-selected": selected ?? false,
82
- "data-active": activeId === itemId ? "" : void 0,
83
25
  className: cx("uix-inbox__item", className),
84
26
  ...unread ? { "data-unread": "" } : {},
85
27
  ...props,