@tensor_1/react 2.47.0 → 2.49.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 (204) hide show
  1. package/README.md +540 -2
  2. package/dist/{SchedulingCalendar-B6TakO2h.d.ts → SchedulingCalendar-WWyFL3Eo.d.ts} +51 -2
  3. package/dist/announce.d.ts +10 -0
  4. package/dist/announce.js +30 -0
  5. package/dist/chart-analytic.cjs +33 -25
  6. package/dist/chart-preset.cjs +23 -15
  7. package/dist/chart.cjs +23 -15
  8. package/dist/combobox-model.d.ts +10 -1
  9. package/dist/combobox-model.js +15 -0
  10. package/dist/command-palette-model.d.ts +44 -0
  11. package/dist/command-palette-model.js +36 -0
  12. package/dist/components/AccountMenu.d.ts +44 -0
  13. package/dist/components/AccountMenu.js +43 -0
  14. package/dist/components/AppShell.d.ts +45 -2
  15. package/dist/components/AppShell.js +116 -5
  16. package/dist/components/AuditLog.d.ts +128 -0
  17. package/dist/components/AuditLog.js +196 -0
  18. package/dist/components/BrandProfiles.js +4 -3
  19. package/dist/components/Breadcrumbs.d.ts +9 -2
  20. package/dist/components/Breadcrumbs.js +3 -2
  21. package/dist/components/Button.d.ts +12 -5
  22. package/dist/components/Button.js +7 -3
  23. package/dist/components/Card.d.ts +18 -1
  24. package/dist/components/Card.js +5 -1
  25. package/dist/components/ChangeHighlight.d.ts +30 -0
  26. package/dist/components/ChangeHighlight.js +21 -0
  27. package/dist/components/ChartCore.js +2 -1
  28. package/dist/components/Checkbox.d.ts +27 -1
  29. package/dist/components/Checkbox.js +31 -2
  30. package/dist/components/Chip.d.ts +7 -3
  31. package/dist/components/Chip.js +2 -2
  32. package/dist/components/CodeDisplay.d.ts +65 -0
  33. package/dist/components/CodeDisplay.js +124 -0
  34. package/dist/components/Combobox.d.ts +27 -6
  35. package/dist/components/Combobox.js +195 -58
  36. package/dist/components/CommandPalette.d.ts +36 -1
  37. package/dist/components/CommandPalette.js +254 -2
  38. package/dist/components/ContactCard.d.ts +66 -0
  39. package/dist/components/ContactCard.js +74 -0
  40. package/dist/components/Count.d.ts +24 -0
  41. package/dist/components/Count.js +32 -0
  42. package/dist/components/DashboardCanvas.js +14 -0
  43. package/dist/components/DataWorkspace.d.ts +167 -0
  44. package/dist/components/DataWorkspace.js +380 -0
  45. package/dist/components/DateFieldParts.d.ts +2 -1
  46. package/dist/components/DateFieldParts.js +7 -0
  47. package/dist/components/DatePicker.d.ts +9 -2
  48. package/dist/components/DatePicker.js +67 -28
  49. package/dist/components/DateRangePicker.d.ts +12 -2
  50. package/dist/components/DateRangePicker.js +13 -12
  51. package/dist/components/DetailPage.d.ts +7 -1
  52. package/dist/components/DetailPage.js +2 -1
  53. package/dist/components/Dialogs.d.ts +71 -10
  54. package/dist/components/Dialogs.js +130 -30
  55. package/dist/components/DiffViewer.d.ts +23 -3
  56. package/dist/components/DiffViewer.js +26 -12
  57. package/dist/components/DiscardPrompt.js +16 -0
  58. package/dist/components/DisplayPreferences.d.ts +83 -0
  59. package/dist/components/DisplayPreferences.js +185 -0
  60. package/dist/components/EditorialHome.d.ts +23 -3
  61. package/dist/components/EditorialHome.js +16 -11
  62. package/dist/components/EntityPicker.d.ts +20 -3
  63. package/dist/components/EntityPicker.js +32 -13
  64. package/dist/components/FilterEditor.d.ts +18 -4
  65. package/dist/components/FilterEditor.js +141 -19
  66. package/dist/components/FocusOnMount.d.ts +282 -0
  67. package/dist/components/FocusOnMount.js +12 -0
  68. package/dist/components/InfoTip.js +11 -12
  69. package/dist/components/InlineEdit.d.ts +87 -20
  70. package/dist/components/InlineEdit.js +197 -54
  71. package/dist/components/Input.d.ts +12 -2
  72. package/dist/components/Input.js +5 -3
  73. package/dist/components/Kanban.d.ts +14 -3
  74. package/dist/components/Kanban.js +9 -4
  75. package/dist/components/Kbd.d.ts +6 -1
  76. package/dist/components/Kbd.js +6 -6
  77. package/dist/components/Lightbox.d.ts +41 -5
  78. package/dist/components/Lightbox.js +95 -9
  79. package/dist/components/MatchReview.d.ts +40 -1
  80. package/dist/components/MatchReview.js +130 -4
  81. package/dist/components/MetricInput.js +3 -2
  82. package/dist/components/Modal.d.ts +2 -1
  83. package/dist/components/Modal.js +13 -4
  84. package/dist/components/MotionList.d.ts +303 -0
  85. package/dist/components/MotionList.js +175 -0
  86. package/dist/components/NavFavourites.d.ts +5 -0
  87. package/dist/components/NavFavourites.js +7 -7
  88. package/dist/components/OtpInput.d.ts +33 -0
  89. package/dist/components/OtpInput.js +123 -0
  90. package/dist/components/PageHeader.d.ts +7 -1
  91. package/dist/components/PageHeader.js +2 -2
  92. package/dist/components/Pagination.js +6 -5
  93. package/dist/components/PasswordInput.d.ts +34 -0
  94. package/dist/components/PasswordInput.js +101 -0
  95. package/dist/components/Peek.js +3 -3
  96. package/dist/components/Popover.js +11 -0
  97. package/dist/components/PrintLayout.d.ts +63 -0
  98. package/dist/components/PrintLayout.js +114 -0
  99. package/dist/components/QrCode.d.ts +47 -0
  100. package/dist/components/QrCode.js +55 -0
  101. package/dist/components/QrScanner.d.ts +95 -0
  102. package/dist/components/QrScanner.js +266 -0
  103. package/dist/components/RelationshipGraph.d.ts +32 -1
  104. package/dist/components/RelationshipGraph.js +22 -6
  105. package/dist/components/RelationshipGraphLayered.d.ts +1 -1
  106. package/dist/components/RelationshipGraphLayered.js +268 -118
  107. package/dist/components/RelationshipGraphList.js +33 -6
  108. package/dist/components/RuleBuilder.js +39 -7
  109. package/dist/components/SchedulingAgenda.d.ts +3 -1
  110. package/dist/components/SchedulingCalendar.d.ts +3 -1
  111. package/dist/components/SchedulingCalendar.js +43 -4
  112. package/dist/components/SchedulingResourceDay.d.ts +57 -0
  113. package/dist/components/SchedulingResourceDay.js +287 -0
  114. package/dist/components/SchedulingTimeGrid.d.ts +3 -1
  115. package/dist/components/SchedulingTimeline.d.ts +3 -1
  116. package/dist/components/SearchSuggest.d.ts +23 -3
  117. package/dist/components/SearchSuggest.js +56 -18
  118. package/dist/components/Segmented.d.ts +39 -4
  119. package/dist/components/Segmented.js +39 -5
  120. package/dist/components/Select.d.ts +3 -2
  121. package/dist/components/Select.js +7 -1
  122. package/dist/components/ShortcutHint.d.ts +11 -10
  123. package/dist/components/ShortcutHint.js +44 -38
  124. package/dist/components/Sidebar.d.ts +36 -4
  125. package/dist/components/Sidebar.js +37 -12
  126. package/dist/components/SortableList.d.ts +45 -0
  127. package/dist/components/SortableList.js +147 -0
  128. package/dist/components/Stat.d.ts +28 -3
  129. package/dist/components/Stat.js +13 -3
  130. package/dist/components/States.d.ts +33 -1
  131. package/dist/components/States.js +43 -1
  132. package/dist/components/StatusPill.d.ts +14 -3
  133. package/dist/components/StatusPill.js +11 -3
  134. package/dist/components/Steps.js +2 -1
  135. package/dist/components/Table.d.ts +9 -2
  136. package/dist/components/Table.js +4 -2
  137. package/dist/components/TableControls.js +18 -58
  138. package/dist/components/TableOverflowProbe.d.ts +12 -0
  139. package/dist/components/TableOverflowProbe.js +27 -0
  140. package/dist/components/Tabs.d.ts +2 -1
  141. package/dist/components/Tabs.js +10 -2
  142. package/dist/components/TagInput.d.ts +67 -0
  143. package/dist/components/TagInput.js +342 -0
  144. package/dist/components/Textarea.d.ts +5 -0
  145. package/dist/components/Textarea.js +2 -2
  146. package/dist/components/TimePicker.d.ts +80 -0
  147. package/dist/components/TimePicker.js +347 -0
  148. package/dist/components/Toast.d.ts +1 -1
  149. package/dist/components/Toast.js +109 -4
  150. package/dist/components/Tooltip.d.ts +8 -4
  151. package/dist/components/Tooltip.js +86 -28
  152. package/dist/components/Tree.d.ts +8 -0
  153. package/dist/components/Tree.js +11 -5
  154. package/dist/display-preferences-model.d.ts +53 -0
  155. package/dist/display-preferences-model.js +64 -0
  156. package/dist/emoji.cjs +143 -49
  157. package/dist/filter-model.d.ts +59 -3
  158. package/dist/filter-model.js +67 -2
  159. package/dist/hooks/useAnchoredPosition.js +14 -2
  160. package/dist/hooks/useChangeHighlight.d.ts +33 -0
  161. package/dist/hooks/useChangeHighlight.js +44 -0
  162. package/dist/hooks/useDeferredReorder.d.ts +32 -0
  163. package/dist/hooks/useDeferredReorder.js +47 -0
  164. package/dist/hooks/useDialog.d.ts +5 -0
  165. package/dist/hooks/useDialog.js +17 -3
  166. package/dist/hooks/useKeyboardGrab.d.ts +58 -0
  167. package/dist/hooks/useKeyboardGrab.js +118 -0
  168. package/dist/hooks/useOptimisticValue.d.ts +51 -0
  169. package/dist/hooks/useOptimisticValue.js +61 -0
  170. package/dist/hooks/useReducedMotion.d.ts +4 -1
  171. package/dist/hooks/useReducedMotion.js +7 -1
  172. package/dist/hooks/useResolvedFilterLabels.d.ts +15 -0
  173. package/dist/hooks/useResolvedFilterLabels.js +34 -0
  174. package/dist/hooks/useSlidingIndicator.d.ts +18 -0
  175. package/dist/hooks/useSlidingIndicator.js +80 -0
  176. package/dist/hooks/useVirtualRows.d.ts +21 -2
  177. package/dist/hooks/useVirtualRows.js +30 -3
  178. package/dist/icons/Icon.d.ts +1 -1
  179. package/dist/index.cjs +19687 -13423
  180. package/dist/index.d.cts +3419 -651
  181. package/dist/index.d.ts +48 -18
  182. package/dist/index.js +153 -9
  183. package/dist/labels-context.d.ts +93 -3
  184. package/dist/motion.d.ts +11 -0
  185. package/dist/motion.js +35 -0
  186. package/dist/overlay-stack.d.ts +6 -0
  187. package/dist/overlay-stack.js +13 -0
  188. package/dist/qr-model.d.ts +65 -0
  189. package/dist/qr-model.js +323 -0
  190. package/dist/relationship-graph-model.d.ts +92 -3
  191. package/dist/relationship-graph-model.js +134 -15
  192. package/dist/reorder.d.ts +30 -0
  193. package/dist/reorder.js +74 -0
  194. package/dist/rich-text.cjs +46 -4
  195. package/dist/scheduling-resource-model.d.ts +76 -0
  196. package/dist/scheduling-resource-model.js +74 -0
  197. package/dist/search-suggest-model.js +3 -1
  198. package/dist/shell-context.d.ts +11 -0
  199. package/dist/shell-context.js +7 -0
  200. package/dist/time-field-model.d.ts +46 -0
  201. package/dist/time-field-model.js +152 -0
  202. package/dist/toast-store.d.ts +22 -3
  203. package/dist/toast-store.js +26 -9
  204. package/package.json +2 -1
@@ -1,8 +1,22 @@
1
1
  import { RefObject } from 'react';
2
2
 
3
3
  interface UseVirtualRowsOptions {
4
- /** Fixed rendered row height in pixels. */
4
+ /**
5
+ * Rendered row height in pixels. With `measureRows` it is the estimate for the first paint,
6
+ * until the mounted rows have been measured.
7
+ */
5
8
  rowHeight: number;
9
+ /**
10
+ * A selector for the mounted data rows inside the container, e.g. `'tbody > tr[data-row]'`
11
+ * (HAR-1829). With it the hook sizes its spacers and window from the rows' real pitch (their
12
+ * mean `offsetHeight`) instead of trusting `rowHeight`, which only has to be close: a row's
13
+ * height comes from CSS and content (kit padding, a second line, density), and a wrong number
14
+ * gives a short scrollbar and a window that drifts away from the rows on screen. It measures
15
+ * when windowing starts, when `rowHeight` changes (a density switch) and when the container
16
+ * resizes, never while scrolling, so the spacers do not move under the reader. Spacer rows
17
+ * must not match it.
18
+ */
19
+ measureRows?: string;
6
20
  /** Rows rendered beyond each viewport edge. Default: 6. */
7
21
  overscan?: number;
8
22
  /**
@@ -30,6 +44,11 @@ interface UseVirtualRowsResult<T> {
30
44
  padBottom: number;
31
45
  totalHeight: number;
32
46
  virtualized: boolean;
47
+ /**
48
+ * The row height in use: the measured pitch with `measureRows`, else the `rowHeight` option.
49
+ * Scroll a keyboard-focused row into view with it (`index * rowHeight`).
50
+ */
51
+ rowHeight: number;
33
52
  }
34
53
  /**
35
54
  * Owns scroll/resize observation and exposes the small visible row window.
@@ -37,6 +56,6 @@ interface UseVirtualRowsResult<T> {
37
56
  * When the row count shrinks under a large scroll position the window is clamped to the new
38
57
  * count in the same render, so `padTop` never exceeds the list (HAR-1616).
39
58
  */
40
- declare function useVirtualRows<T>(rows: readonly T[], { rowHeight, overscan, threshold, estimatedViewportHeight, enabled }: UseVirtualRowsOptions): UseVirtualRowsResult<T>;
59
+ declare function useVirtualRows<T>(rows: readonly T[], { rowHeight: estimate, overscan, threshold, estimatedViewportHeight, enabled, measureRows }: UseVirtualRowsOptions): UseVirtualRowsResult<T>;
41
60
 
42
61
  export { type UseVirtualRowsOptions, type UseVirtualRowsResult, useVirtualRows };
@@ -1,9 +1,12 @@
1
1
  "use client";
2
2
  import { useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import { shouldVirtualize, virtualWindow } from "../table-engine.js";
4
- function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100, estimatedViewportHeight = 0, enabled = true }) {
4
+ function useVirtualRows(rows, { rowHeight: estimate, overscan = 6, threshold = 100, estimatedViewportHeight = 0, enabled = true, measureRows }) {
5
5
  const containerRef = useRef(null);
6
6
  const [viewport, setViewport] = useState({ scrollTop: 0, height: 0 });
7
+ const [measured, setMeasured] = useState(null);
8
+ const measureRowsRef = useRef(() => {
9
+ });
7
10
  useLayoutEffect(() => {
8
11
  const element = containerRef.current;
9
12
  if (!element) return;
@@ -21,7 +24,10 @@ function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100, estima
21
24
  };
22
25
  commitMeasurement();
23
26
  element.addEventListener("scroll", measure, { passive: true });
24
- const observer = new ResizeObserver(measure);
27
+ const observer = new ResizeObserver(() => {
28
+ measure();
29
+ measureRowsRef.current();
30
+ });
25
31
  observer.observe(element);
26
32
  return () => {
27
33
  element.removeEventListener("scroll", measure);
@@ -31,6 +37,26 @@ function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100, estima
31
37
  }, []);
32
38
  const height = viewport.height > 0 ? viewport.height : Math.max(0, estimatedViewportHeight);
33
39
  const virtualized = enabled && height > 0 && shouldVirtualize(rows.length, threshold);
40
+ const rowHeight = measureRows && measured && measured.estimate === estimate ? measured.height : estimate;
41
+ measureRowsRef.current = () => {
42
+ const element = containerRef.current;
43
+ if (!element || !measureRows || !virtualized) return;
44
+ let total = 0;
45
+ let count = 0;
46
+ for (const row of Array.from(element.querySelectorAll(measureRows))) {
47
+ const h = row.offsetHeight;
48
+ if (h > 0) {
49
+ total += h;
50
+ count += 1;
51
+ }
52
+ }
53
+ if (count === 0) return;
54
+ const next = Math.round(total / count * 100) / 100;
55
+ setMeasured((current) => current && current.estimate === estimate && current.height === next ? current : { height: next, estimate });
56
+ };
57
+ useLayoutEffect(() => {
58
+ measureRowsRef.current();
59
+ }, [virtualized, estimate, measureRows]);
34
60
  const window = useMemo(
35
61
  () => virtualized ? virtualWindow(viewport.scrollTop, height, rowHeight, rows.length, overscan) : { start: 0, end: rows.length, padTop: 0, padBottom: 0, total: rows.length * rowHeight },
36
62
  [virtualized, overscan, rowHeight, rows.length, height, viewport.scrollTop]
@@ -43,7 +69,8 @@ function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100, estima
43
69
  padTop: window.padTop,
44
70
  padBottom: window.padBottom,
45
71
  totalHeight: window.total,
46
- virtualized
72
+ virtualized,
73
+ rowHeight
47
74
  };
48
75
  }
49
76
  export {
@@ -269,6 +269,7 @@ declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, cl
269
269
  clip?: number | string | undefined | undefined;
270
270
  stroke: string;
271
271
  href?: string | undefined | undefined;
272
+ d?: string | undefined | undefined;
272
273
  capHeight?: number | string | undefined | undefined;
273
274
  dy?: number | string | undefined | undefined;
274
275
  dx?: number | string | undefined | undefined;
@@ -306,7 +307,6 @@ declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, cl
306
307
  contentStyleType?: number | string | undefined | undefined;
307
308
  cx?: number | string | undefined | undefined;
308
309
  cy?: number | string | undefined | undefined;
309
- d?: string | undefined | undefined;
310
310
  decelerate?: number | string | undefined | undefined;
311
311
  descent?: number | string | undefined | undefined;
312
312
  diffuseConstant?: number | string | undefined | undefined;