@tensor_1/react 2.10.0 → 2.12.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 (81) hide show
  1. package/README.md +10 -1
  2. package/dist/ChartCore-Bt1C84ty.d.cts +22 -0
  3. package/dist/chart-preset.cjs +168 -0
  4. package/dist/chart-preset.d.cts +9 -0
  5. package/dist/chart-preset.d.ts +9 -0
  6. package/dist/chart-preset.js +35 -0
  7. package/dist/chart.cjs +58 -41
  8. package/dist/chart.d.cts +6 -21
  9. package/dist/chart.d.ts +2 -1
  10. package/dist/components/Alert.js +7 -15
  11. package/dist/components/AppShell.d.ts +1 -3
  12. package/dist/components/AppShell.js +1 -3
  13. package/dist/components/Avatar.js +1 -2
  14. package/dist/components/Button.js +16 -32
  15. package/dist/components/Card.d.ts +1 -3
  16. package/dist/components/Card.js +2 -2
  17. package/dist/components/Chart.d.ts +6 -21
  18. package/dist/components/Chart.js +5 -85
  19. package/dist/components/ChartCore.d.ts +33 -0
  20. package/dist/components/ChartCore.js +100 -0
  21. package/dist/components/CommandPalette.d.ts +2 -4
  22. package/dist/components/CommandPalette.js +13 -66
  23. package/dist/components/Comments.d.ts +1 -5
  24. package/dist/components/Comments.js +1 -1
  25. package/dist/components/Composer.d.ts +1 -8
  26. package/dist/components/Composer.js +2 -7
  27. package/dist/components/DetailLayout.js +1 -1
  28. package/dist/components/Drawer.d.ts +4 -3
  29. package/dist/components/Drawer.js +4 -6
  30. package/dist/components/Field.js +3 -6
  31. package/dist/components/Inbox.d.ts +3 -13
  32. package/dist/components/Inbox.js +3 -62
  33. package/dist/components/Input.d.ts +2 -13
  34. package/dist/components/Input.js +5 -20
  35. package/dist/components/Kanban.d.ts +3 -15
  36. package/dist/components/Kanban.js +10 -42
  37. package/dist/components/Meter.d.ts +1 -3
  38. package/dist/components/Meter.js +1 -10
  39. package/dist/components/Modal.d.ts +5 -3
  40. package/dist/components/Modal.js +4 -6
  41. package/dist/components/NavFavourites.js +35 -119
  42. package/dist/components/PageHeader.d.ts +1 -3
  43. package/dist/components/PageHeader.js +2 -2
  44. package/dist/components/Peek.d.ts +4 -3
  45. package/dist/components/Peek.js +6 -9
  46. package/dist/components/Progress.d.ts +1 -3
  47. package/dist/components/Progress.js +3 -5
  48. package/dist/components/Radio.d.ts +1 -3
  49. package/dist/components/Radio.js +2 -6
  50. package/dist/components/Segmented.js +3 -2
  51. package/dist/components/Sidebar.js +2 -4
  52. package/dist/components/Spinner.d.ts +1 -3
  53. package/dist/components/Spinner.js +3 -3
  54. package/dist/components/Stat.js +1 -5
  55. package/dist/components/States.d.ts +1 -3
  56. package/dist/components/States.js +2 -8
  57. package/dist/components/Table.d.ts +2 -9
  58. package/dist/components/Table.js +8 -11
  59. package/dist/components/Tabs.d.ts +1 -13
  60. package/dist/components/Tabs.js +4 -78
  61. package/dist/components/Timeline.d.ts +3 -3
  62. package/dist/components/Timeline.js +3 -3
  63. package/dist/components/Toast.js +5 -42
  64. package/dist/components/Tooltip.d.ts +1 -3
  65. package/dist/components/Tooltip.js +5 -44
  66. package/dist/components/Tree.d.ts +0 -2
  67. package/dist/components/Tree.js +4 -26
  68. package/dist/hooks/useDialog.d.ts +1 -1
  69. package/dist/hooks/useDialog.js +2 -17
  70. package/dist/hooks/useTable.d.ts +0 -5
  71. package/dist/hooks/useTable.js +12 -27
  72. package/dist/hooks/useVirtualRows.d.ts +27 -0
  73. package/dist/hooks/useVirtualRows.js +50 -0
  74. package/dist/index.cjs +291 -760
  75. package/dist/index.d.cts +61 -127
  76. package/dist/index.d.ts +3 -2
  77. package/dist/index.js +4 -3
  78. package/dist/table-engine.js +8 -6
  79. package/dist/tree-model.d.ts +0 -4
  80. package/dist/tree-model.js +0 -8
  81. package/package.json +16 -2
@@ -1,90 +1,10 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useRef, useEffect, useId } from "react";
2
+ import { jsx } from "react/jsx-runtime";
4
3
  import * as echarts from "echarts";
5
- import { cx } from "../cx.js";
6
- function readToken(name) {
7
- if (typeof getComputedStyle === "undefined") return "";
8
- return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
9
- }
10
- function uixChartPalette() {
11
- return [1, 2, 3, 4, 5, 6, 7, 8].map((i) => readToken(`--uix-chart-${i}`));
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
- function Chart({
20
- option,
21
- title,
22
- subtitle,
23
- height = 280,
24
- className,
25
- style,
26
- ariaLabel,
27
- tableData,
28
- tableHeaders,
29
- onReady,
30
- header
31
- }) {
32
- const containerRef = useRef(null);
33
- const chartRef = useRef(null);
34
- const tableId = useId();
35
- useEffect(() => {
36
- const el = containerRef.current;
37
- if (!el) return;
38
- const chart = echarts.init(el, null, { renderer: "svg" });
39
- chartRef.current = chart;
40
- chart.setOption(motionSafe(option));
41
- 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
- const ro = new ResizeObserver(() => chart.resize());
46
- ro.observe(el);
47
- return () => {
48
- ro.disconnect();
49
- chart.dispose();
50
- chartRef.current = null;
51
- };
52
- }, []);
53
- useEffect(() => {
54
- chartRef.current?.setOption(motionSafe(option), { notMerge: false });
55
- }, [option]);
56
- const heightVal = typeof height === "number" ? `${height}px` : height;
57
- const effectiveAriaLabel = ariaLabel ?? title ?? "Chart";
58
- const hasTable = tableData && tableData.length > 0 && tableHeaders && tableHeaders.length > 0;
59
- return /* @__PURE__ */ jsxs("div", { className: cx("uix-chart", className), style, children: [
60
- (title != null || subtitle != null || header != null) && /* @__PURE__ */ jsxs("div", { children: [
61
- header,
62
- title && /* @__PURE__ */ jsx("div", { className: "uix-chart__title", children: title }),
63
- subtitle && /* @__PURE__ */ jsx("div", { className: "uix-chart__subtitle", children: subtitle })
64
- ] }),
65
- /* @__PURE__ */ jsx(
66
- "div",
67
- {
68
- ref: containerRef,
69
- style: { height: heightVal },
70
- role: "img",
71
- "aria-label": effectiveAriaLabel,
72
- "aria-describedby": hasTable ? tableId : void 0
73
- }
74
- ),
75
- hasTable && /* @__PURE__ */ jsxs(
76
- "table",
77
- {
78
- id: tableId,
79
- className: "uix-visually-hidden",
80
- "aria-label": `${effectiveAriaLabel} \u2014 data table`,
81
- children: [
82
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ jsx("th", { scope: "col", children: h }, h)) }) }),
83
- /* @__PURE__ */ jsx("tbody", { children: tableData.map((row, i) => /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((h) => /* @__PURE__ */ jsx("td", { children: row[h] }, h)) }, i)) })
84
- ]
85
- }
86
- )
87
- ] });
4
+ import { ChartCore } from "./ChartCore.js";
5
+ import { uixChartPalette } from "./ChartCore.js";
6
+ function Chart(props) {
7
+ return /* @__PURE__ */ jsx(ChartCore, { ...props, engine: echarts });
88
8
  }
89
9
  export {
90
10
  Chart,
@@ -0,0 +1,33 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties, ReactNode } from 'react';
3
+ import { EChartsOption, ECharts } from 'echarts';
4
+
5
+ interface ChartEngine {
6
+ init(element: HTMLElement, theme?: string | null, options?: {
7
+ renderer?: 'svg' | 'canvas';
8
+ }): ECharts;
9
+ }
10
+ declare function uixChartPalette(): string[];
11
+ interface ChartTableRow {
12
+ [key: string]: string | number;
13
+ }
14
+ interface ChartProps {
15
+ option: EChartsOption;
16
+ title?: string;
17
+ subtitle?: string;
18
+ height?: string | number;
19
+ className?: string;
20
+ style?: CSSProperties;
21
+ ariaLabel?: string;
22
+ tableData?: ChartTableRow[];
23
+ tableHeaders?: string[];
24
+ onReady?: (chart: ECharts) => void;
25
+ header?: ReactNode;
26
+ }
27
+ interface ChartCoreProps extends ChartProps {
28
+ engine: ChartEngine;
29
+ }
30
+ /** Shared chart lifecycle. Runtime adapters only choose the ECharts build. */
31
+ declare function ChartCore({ engine, option, title, subtitle, height, className, style, ariaLabel, tableData, tableHeaders, onReady, header, }: ChartCoreProps): react.JSX.Element;
32
+
33
+ export { ChartCore, type ChartEngine, type ChartProps, type ChartTableRow, uixChartPalette };
@@ -0,0 +1,100 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useRef } from "react";
4
+ import { cx } from "../cx.js";
5
+ function readToken(name) {
6
+ if (typeof getComputedStyle === "undefined") return "";
7
+ return getComputedStyle(document.documentElement).getPropertyValue(name).trim();
8
+ }
9
+ function uixChartPalette() {
10
+ return [1, 2, 3, 4, 5, 6, 7, 8].map((i) => readToken(`--uix-chart-${i}`));
11
+ }
12
+ function ChartCore({
13
+ engine,
14
+ option,
15
+ title,
16
+ subtitle,
17
+ height = 280,
18
+ className,
19
+ style,
20
+ ariaLabel,
21
+ tableData,
22
+ tableHeaders,
23
+ onReady,
24
+ header
25
+ }) {
26
+ const containerRef = useRef(null);
27
+ const chartRef = useRef(null);
28
+ const appliedOptionRef = useRef(null);
29
+ const latestOptionRef = useRef(option);
30
+ const onReadyRef = useRef(onReady);
31
+ const tableId = useId();
32
+ latestOptionRef.current = option;
33
+ onReadyRef.current = onReady;
34
+ useEffect(() => {
35
+ const element = containerRef.current;
36
+ if (!element) return;
37
+ const chart = engine.init(element, null, { renderer: "svg" });
38
+ chartRef.current = chart;
39
+ chart.setOption(latestOptionRef.current);
40
+ appliedOptionRef.current = latestOptionRef.current;
41
+ onReadyRef.current?.(chart);
42
+ let frame = 0;
43
+ let width = element.clientWidth;
44
+ let height2 = element.clientHeight;
45
+ const observer = new ResizeObserver(() => {
46
+ const nextWidth = element.clientWidth;
47
+ const nextHeight = element.clientHeight;
48
+ if (nextWidth === width && nextHeight === height2) return;
49
+ width = nextWidth;
50
+ height2 = nextHeight;
51
+ if (frame) return;
52
+ frame = requestAnimationFrame(() => {
53
+ frame = 0;
54
+ chart.resize();
55
+ });
56
+ });
57
+ observer.observe(element);
58
+ return () => {
59
+ observer.disconnect();
60
+ if (frame) cancelAnimationFrame(frame);
61
+ chart.dispose();
62
+ chartRef.current = null;
63
+ appliedOptionRef.current = null;
64
+ };
65
+ }, [engine]);
66
+ useEffect(() => {
67
+ const chart = chartRef.current;
68
+ if (!chart || appliedOptionRef.current === option) return;
69
+ chart.setOption(option, { notMerge: false });
70
+ appliedOptionRef.current = option;
71
+ }, [option]);
72
+ const heightValue = typeof height === "number" ? `${height}px` : height;
73
+ const effectiveAriaLabel = ariaLabel ?? title ?? "Chart";
74
+ const hasTable = Boolean(tableData?.length && tableHeaders?.length);
75
+ return /* @__PURE__ */ jsxs("div", { className: cx("uix-chart", className), style, children: [
76
+ title != null || subtitle != null || header != null ? /* @__PURE__ */ jsxs("div", { children: [
77
+ header,
78
+ title ? /* @__PURE__ */ jsx("div", { className: "uix-chart__title", children: title }) : null,
79
+ subtitle ? /* @__PURE__ */ jsx("div", { className: "uix-chart__subtitle", children: subtitle }) : null
80
+ ] }) : null,
81
+ /* @__PURE__ */ jsx(
82
+ "div",
83
+ {
84
+ ref: containerRef,
85
+ style: { height: heightValue },
86
+ role: "img",
87
+ "aria-label": effectiveAriaLabel,
88
+ "aria-describedby": hasTable ? tableId : void 0
89
+ }
90
+ ),
91
+ hasTable ? /* @__PURE__ */ jsxs("table", { id: tableId, className: "sr-only", "aria-label": `${effectiveAriaLabel} \u2014 data table`, children: [
92
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((label) => /* @__PURE__ */ jsx("th", { scope: "col", children: label }, label)) }) }),
93
+ /* @__PURE__ */ jsx("tbody", { children: tableData.map((row, index) => /* @__PURE__ */ jsx("tr", { children: tableHeaders.map((label) => /* @__PURE__ */ jsx("td", { children: row[label] }, label)) }, index)) })
94
+ ] }) : null
95
+ ] });
96
+ }
97
+ export {
98
+ ChartCore,
99
+ uixChartPalette
100
+ };
@@ -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,10 @@
1
- "use client";
2
1
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { createContext, useContext, useId, useMemo, useRef, useState } from "react";
4
2
  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 });
3
+ function Inbox({ children, className, ...props }) {
4
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-inbox", className), ...props, children });
7
5
  }
8
- const InboxListCtx = createContext({});
9
6
  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
- ) });
7
+ return /* @__PURE__ */ jsx("div", { className: cx("uix-inbox__list", className), role: "listbox", ...props, children });
61
8
  }
62
9
  function InboxItem({
63
10
  subject,
@@ -67,19 +14,13 @@ function InboxItem({
67
14
  selected,
68
15
  children,
69
16
  className,
70
- id,
71
17
  ...props
72
18
  }) {
73
- const autoId = useId();
74
- const itemId = id ?? autoId;
75
- const { activeId } = useContext(InboxListCtx);
76
19
  return /* @__PURE__ */ jsxs(
77
20
  "div",
78
21
  {
79
22
  role: "option",
80
- id: itemId,
81
23
  "aria-selected": selected ?? false,
82
- "data-active": activeId === itemId ? "" : void 0,
83
24
  className: cx("uix-inbox__item", className),
84
25
  ...unread ? { "data-unread": "" } : {},
85
26
  ...props,
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { InputHTMLAttributes, ReactNode, AriaAttributes } from 'react';
2
+ import { InputHTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
5
5
  size?: 'sm' | 'md';
@@ -12,18 +12,7 @@ interface InputGroupProps {
12
12
  leadingIcon?: ReactNode;
13
13
  trailingIcon?: ReactNode;
14
14
  className?: string;
15
- /** Injected by `<Field>` when it wraps the group; forwarded onto the child control. */
16
- id?: string;
17
- 'aria-describedby'?: string;
18
- 'aria-invalid'?: AriaAttributes['aria-invalid'];
19
- 'aria-required'?: AriaAttributes['aria-required'];
20
15
  }
21
- /**
22
- * Icon-adorned wrapper for a child `<Input>`. The control is passed as `children`, so
23
- * `<Field>`'s injected `id`/`aria-*` land on this wrapper — they're forwarded onto the
24
- * single child element (the child's own props win) so label/message association survives
25
- * the extra div (UIX-A11Y-3).
26
- */
27
- declare function InputGroup({ children, leadingIcon, trailingIcon, className, id, 'aria-describedby': describedBy, 'aria-invalid': invalid, 'aria-required': required, }: InputGroupProps): react.JSX.Element;
16
+ declare function InputGroup({ children, leadingIcon, trailingIcon, className }: InputGroupProps): react.JSX.Element;
28
17
 
29
18
  export { Input, InputGroup, type InputGroupProps, type InputProps };