@tensor_1/react 2.19.2 → 2.21.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 (70) hide show
  1. package/README.md +14 -0
  2. package/dist/{ChartCore-Do6gRBN3.d.cts → ChartCore-DzWe10bN.d.cts} +16 -1
  3. package/dist/chart-preset.cjs +25 -13
  4. package/dist/chart-preset.d.cts +2 -2
  5. package/dist/chart-preset.d.ts +1 -1
  6. package/dist/chart-preset.js +2 -1
  7. package/dist/chart.cjs +25 -13
  8. package/dist/chart.d.cts +2 -2
  9. package/dist/chart.d.ts +1 -1
  10. package/dist/chart.js +2 -1
  11. package/dist/components/AppShell.d.ts +5 -1
  12. package/dist/components/AppShell.js +4 -2
  13. package/dist/components/Avatar.d.ts +3 -1
  14. package/dist/components/Avatar.js +2 -2
  15. package/dist/components/BrandProfiles.d.ts +29 -2
  16. package/dist/components/BrandProfiles.js +45 -20
  17. package/dist/components/BuilderCanvas.d.ts +27 -2
  18. package/dist/components/BuilderCanvas.js +45 -22
  19. package/dist/components/Chart.d.ts +1 -1
  20. package/dist/components/Chart.js +2 -1
  21. package/dist/components/ChartCore.d.ts +17 -2
  22. package/dist/components/ChartCore.js +24 -13
  23. package/dist/components/ColorPicker.d.ts +24 -2
  24. package/dist/components/ColorPicker.js +38 -20
  25. package/dist/components/CommandPalette.d.ts +3 -1
  26. package/dist/components/CommandPalette.js +2 -2
  27. package/dist/components/CopyButton.d.ts +25 -0
  28. package/dist/components/CopyButton.js +52 -0
  29. package/dist/components/DateRangePicker.d.ts +21 -2
  30. package/dist/components/DateRangePicker.js +26 -6
  31. package/dist/components/DetailPage.d.ts +22 -3
  32. package/dist/components/DetailPage.js +33 -3
  33. package/dist/components/DiffViewer.d.ts +34 -3
  34. package/dist/components/DiffViewer.js +60 -40
  35. package/dist/components/Drawer.d.ts +3 -1
  36. package/dist/components/Drawer.js +2 -2
  37. package/dist/components/Inbox.d.ts +3 -1
  38. package/dist/components/Inbox.js +2 -2
  39. package/dist/components/MatchReview.d.ts +49 -2
  40. package/dist/components/MatchReview.js +72 -30
  41. package/dist/components/Meter.d.ts +3 -1
  42. package/dist/components/Meter.js +3 -2
  43. package/dist/components/Pagination.d.ts +10 -2
  44. package/dist/components/Pagination.js +11 -4
  45. package/dist/components/Peek.d.ts +7 -1
  46. package/dist/components/Peek.js +4 -4
  47. package/dist/components/RelationshipGraph.js +6 -2
  48. package/dist/components/RuleBuilder.d.ts +42 -2
  49. package/dist/components/RuleBuilder.js +71 -37
  50. package/dist/components/SchedulingCalendar.d.ts +25 -2
  51. package/dist/components/SchedulingCalendar.js +38 -15
  52. package/dist/components/Stat.d.ts +24 -3
  53. package/dist/components/Stat.js +51 -10
  54. package/dist/components/Table.d.ts +11 -3
  55. package/dist/components/Table.js +5 -8
  56. package/dist/components/Tabs.d.ts +14 -1
  57. package/dist/components/Tabs.js +88 -19
  58. package/dist/components/Toast.d.ts +6 -2
  59. package/dist/components/Toast.js +4 -4
  60. package/dist/components/Tree.d.ts +9 -1
  61. package/dist/components/Tree.js +55 -8
  62. package/dist/copy-model.d.ts +12 -0
  63. package/dist/copy-model.js +12 -0
  64. package/dist/fill-label.d.ts +7 -0
  65. package/dist/fill-label.js +9 -0
  66. package/dist/index.cjs +1480 -1004
  67. package/dist/index.d.cts +387 -30
  68. package/dist/index.d.ts +11 -10
  69. package/dist/index.js +20 -9
  70. package/package.json +1 -1
@@ -5,7 +5,7 @@ import { cx } from "../cx.js";
5
5
  import { flattenTree, treeNav } from "../tree-model.js";
6
6
  import { virtualWindow, shouldVirtualize } from "../table-engine.js";
7
7
  const ChevronIcon = () => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4" }) });
8
- function TreeNode({ node, expanded, selected, selectable, tabbableId, onToggle, onSelect, onFocusNode, level = 1 }) {
8
+ function TreeNode({ node, expanded, selected, selectable, tabbableId, onToggle, onSelect, onFocusNode, level = 1, rowToggles = true }) {
9
9
  const hasChildren = Array.isArray(node.children) && node.children.length > 0;
10
10
  const isExpanded = expanded.has(node.id);
11
11
  return /* @__PURE__ */ jsxs(
@@ -23,13 +23,32 @@ function TreeNode({ node, expanded, selected, selectable, tabbableId, onToggle,
23
23
  },
24
24
  onClick: (e) => {
25
25
  e.stopPropagation();
26
- if (hasChildren) onToggle(node.id);
26
+ if (hasChildren && rowToggles) onToggle(node.id);
27
27
  onSelect?.(node.id);
28
28
  onFocusNode(node.id);
29
29
  },
30
30
  children: [
31
31
  /* @__PURE__ */ jsxs("span", { className: "uix-tree__row", children: [
32
- /* @__PURE__ */ jsx("span", { className: "uix-tree__toggle", children: hasChildren && /* @__PURE__ */ jsx(ChevronIcon, {}) }),
32
+ hasChildren ? (
33
+ // TENSOR RX-125 (UIX-09): the chevron is its own pointer target, so a
34
+ // branch can be expanded without selecting it. Keyboard users toggle with
35
+ // the arrow keys on the treeitem, so it stays out of the tab order.
36
+ /* @__PURE__ */ jsx(
37
+ "button",
38
+ {
39
+ type: "button",
40
+ tabIndex: -1,
41
+ "aria-hidden": "true",
42
+ className: "uix-tree__toggle",
43
+ onClick: (e) => {
44
+ e.stopPropagation();
45
+ onToggle(node.id);
46
+ onFocusNode(node.id);
47
+ },
48
+ children: /* @__PURE__ */ jsx(ChevronIcon, {})
49
+ }
50
+ )
51
+ ) : /* @__PURE__ */ jsx("span", { className: "uix-tree__toggle" }),
33
52
  node.icon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: node.icon }),
34
53
  /* @__PURE__ */ jsx("span", { className: "uix-tree__label", children: node.label })
35
54
  ] }),
@@ -44,7 +63,8 @@ function TreeNode({ node, expanded, selected, selectable, tabbableId, onToggle,
44
63
  onToggle,
45
64
  onSelect,
46
65
  onFocusNode,
47
- level: level + 1
66
+ level: level + 1,
67
+ rowToggles
48
68
  },
49
69
  child.id
50
70
  )) })
@@ -62,6 +82,7 @@ function Tree({
62
82
  virtualize,
63
83
  rowHeight = 32,
64
84
  maxHeight = 384,
85
+ toggleOnRowClick,
65
86
  className,
66
87
  ...props
67
88
  }) {
@@ -70,6 +91,7 @@ function Tree({
70
91
  const rootRef = useRef(null);
71
92
  const [focusedId, setFocusedId] = useState(void 0);
72
93
  const selectable = selected !== void 0 || onSelect != null;
94
+ const rowToggles = toggleOnRowClick ?? !selectable;
73
95
  const handleToggle = useCallback((id) => {
74
96
  if (!controlledExpanded) {
75
97
  setInternalExpanded((prev) => {
@@ -98,6 +120,7 @@ function Tree({
98
120
  onSelect,
99
121
  focusedId,
100
122
  setFocusedId,
123
+ rowToggles,
101
124
  className,
102
125
  ...props
103
126
  }
@@ -173,7 +196,8 @@ function Tree({
173
196
  onToggle: handleToggle,
174
197
  onSelect,
175
198
  onFocusNode: setFocusedId,
176
- level: 1
199
+ level: 1,
200
+ rowToggles
177
201
  },
178
202
  node.id
179
203
  )) });
@@ -189,6 +213,7 @@ function VirtualTreeView({
189
213
  onSelect,
190
214
  focusedId,
191
215
  setFocusedId,
216
+ rowToggles,
192
217
  className,
193
218
  ...props
194
219
  }) {
@@ -262,7 +287,10 @@ function VirtualTreeView({
262
287
  children: [
263
288
  win.padTop > 0 && /* @__PURE__ */ jsx("li", { role: "presentation", "aria-hidden": "true", style: { height: win.padTop } }),
264
289
  rows.map((f, i) => {
265
- const rowStyle = { height: rowHeight, paddingLeft: `calc(${f.level - 1} * var(--uix-space-5))` };
290
+ const rowStyle = {
291
+ height: rowHeight,
292
+ paddingLeft: `calc(${Math.min(f.level - 1, 4)} * var(--uix-space-5) + ${Math.max(0, f.level - 5)} * var(--uix-space-1))`
293
+ };
266
294
  return /* @__PURE__ */ jsx(
267
295
  "li",
268
296
  {
@@ -280,12 +308,31 @@ function VirtualTreeView({
280
308
  },
281
309
  onClick: (e) => {
282
310
  e.stopPropagation();
283
- if (f.hasChildren) onToggle(f.node.id);
311
+ if (f.hasChildren && rowToggles) onToggle(f.node.id);
284
312
  onSelect?.(f.node.id);
285
313
  setFocusedId(f.node.id);
286
314
  },
287
315
  children: /* @__PURE__ */ jsxs("span", { className: "uix-tree__row", style: rowStyle, children: [
288
- /* @__PURE__ */ jsx("span", { className: "uix-tree__toggle", children: f.hasChildren && /* @__PURE__ */ jsx(ChevronIcon, {}) }),
316
+ f.hasChildren ? (
317
+ // TENSOR RX-125 (UIX-09): the chevron is its own pointer target, so a
318
+ // branch can be expanded without selecting it. Keyboard users toggle with
319
+ // the arrow keys on the treeitem, so it stays out of the tab order.
320
+ /* @__PURE__ */ jsx(
321
+ "button",
322
+ {
323
+ type: "button",
324
+ tabIndex: -1,
325
+ "aria-hidden": "true",
326
+ className: "uix-tree__toggle",
327
+ onClick: (e) => {
328
+ e.stopPropagation();
329
+ onToggle(f.node.id);
330
+ setFocusedId(f.node.id);
331
+ },
332
+ children: /* @__PURE__ */ jsx(ChevronIcon, {})
333
+ }
334
+ )
335
+ ) : /* @__PURE__ */ jsx("span", { className: "uix-tree__toggle" }),
289
336
  f.node.icon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: f.node.icon }),
290
337
  /* @__PURE__ */ jsx("span", { className: "uix-tree__label", children: f.node.label })
291
338
  ] })
@@ -0,0 +1,12 @@
1
+ /** The part of the async Clipboard API that CopyButton needs. */
2
+ interface ClipboardWriter {
3
+ writeText(text: string): Promise<void>;
4
+ }
5
+ /**
6
+ * Copies `value` and reports whether the write succeeded. It never throws: there may be no
7
+ * clipboard (an insecure context or an old browser), or the write may be refused (no
8
+ * permission, or the document isn't focused).
9
+ */
10
+ declare function copyText(value: string, clipboard?: ClipboardWriter | undefined): Promise<boolean>;
11
+
12
+ export { type ClipboardWriter, copyText };
@@ -0,0 +1,12 @@
1
+ async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
2
+ if (!clipboard || typeof clipboard.writeText !== "function") return false;
3
+ try {
4
+ await clipboard.writeText(value);
5
+ return true;
6
+ } catch {
7
+ return false;
8
+ }
9
+ }
10
+ export {
11
+ copyText
12
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * TENSOR RX-125 (UIX-12) — fill `{name}` placeholders in a translatable label, so a
3
+ * sentence such as "Move {label} up" can be reordered by a translation.
4
+ */
5
+ declare function fillLabel(template: string, values: Readonly<Record<string, string | number>>): string;
6
+
7
+ export { fillLabel };
@@ -0,0 +1,9 @@
1
+ function fillLabel(template, values) {
2
+ return template.replace(
3
+ /\{(\w+)\}/g,
4
+ (match, key) => Object.prototype.hasOwnProperty.call(values, key) ? String(values[key]) : match
5
+ );
6
+ }
7
+ export {
8
+ fillLabel
9
+ };