@tensor_1/react 2.30.0 → 2.32.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 (122) hide show
  1. package/README.md +430 -0
  2. package/dist/attachment-labels.d.ts +16 -0
  3. package/dist/attachment-labels.js +9 -0
  4. package/dist/calendar-model.d.ts +141 -1
  5. package/dist/calendar-model.js +200 -11
  6. package/dist/chart-preset.cjs +127 -7
  7. package/dist/chart-preset.d.cts +2 -2
  8. package/dist/chart-preset.d.ts +1 -0
  9. package/dist/chart-preset.js +6 -1
  10. package/dist/chart-theme-Cl0IrkKQ.d.cts +112 -0
  11. package/dist/chart-theme.d.ts +51 -0
  12. package/dist/chart-theme.js +99 -0
  13. package/dist/chart.cjs +127 -7
  14. package/dist/chart.d.cts +2 -2
  15. package/dist/chart.d.ts +1 -0
  16. package/dist/chart.js +6 -2
  17. package/dist/components/Alert.d.ts +17 -1
  18. package/dist/components/Alert.js +9 -4
  19. package/dist/components/AlertDismiss.d.ts +14 -0
  20. package/dist/components/AlertDismiss.js +11 -0
  21. package/dist/components/Attachment.d.ts +58 -0
  22. package/dist/components/Attachment.js +69 -0
  23. package/dist/components/AttachmentParts.d.ts +24 -0
  24. package/dist/components/AttachmentParts.js +20 -0
  25. package/dist/components/Chart.d.ts +1 -0
  26. package/dist/components/Chart.js +6 -1
  27. package/dist/components/ChartCore.d.ts +6 -1
  28. package/dist/components/ChartCore.js +23 -5
  29. package/dist/components/Chip.d.ts +17 -2
  30. package/dist/components/Chip.js +35 -11
  31. package/dist/components/ChipRemove.d.ts +17 -0
  32. package/dist/components/ChipRemove.js +13 -0
  33. package/dist/components/CollapsibleParts.d.ts +29 -0
  34. package/dist/components/CollapsibleParts.js +20 -0
  35. package/dist/components/CollapsibleSection.d.ts +30 -3
  36. package/dist/components/CollapsibleSection.js +7 -11
  37. package/dist/components/CollapsibleSectionState.d.ts +1 -1
  38. package/dist/components/CollapsibleSectionState.js +54 -27
  39. package/dist/components/DashboardGrid.d.ts +60 -0
  40. package/dist/components/DashboardGrid.js +40 -0
  41. package/dist/components/DateRangePicker.d.ts +7 -1
  42. package/dist/components/DateRangePicker.js +5 -1
  43. package/dist/components/DescriptionList.d.ts +12 -1
  44. package/dist/components/DescriptionList.js +5 -5
  45. package/dist/components/Dialogs.d.ts +24 -3
  46. package/dist/components/Dialogs.js +74 -16
  47. package/dist/components/EntityPicker.d.ts +56 -0
  48. package/dist/components/EntityPicker.js +168 -0
  49. package/dist/components/FileIcon.d.ts +9 -0
  50. package/dist/components/FileIcon.js +17 -0
  51. package/dist/components/FileUpload.d.ts +95 -0
  52. package/dist/components/FileUpload.js +145 -0
  53. package/dist/components/FilterEditor.d.ts +55 -0
  54. package/dist/components/FilterEditor.js +186 -0
  55. package/dist/components/Heartbeat.d.ts +31 -0
  56. package/dist/components/Heartbeat.js +28 -0
  57. package/dist/components/Lightbox.d.ts +45 -0
  58. package/dist/components/Lightbox.js +102 -0
  59. package/dist/components/Menu.d.ts +53 -5
  60. package/dist/components/Menu.js +104 -4
  61. package/dist/components/Meter.d.ts +7 -3
  62. package/dist/components/Meter.js +2 -1
  63. package/dist/components/Popover.d.ts +21 -2
  64. package/dist/components/Popover.js +94 -17
  65. package/dist/components/Prose.d.ts +6 -2
  66. package/dist/components/Prose.js +1 -1
  67. package/dist/components/RuleBuilder.d.ts +52 -4
  68. package/dist/components/RuleBuilder.js +109 -24
  69. package/dist/components/SchedulingCalendar.d.ts +142 -11
  70. package/dist/components/SchedulingCalendar.js +234 -57
  71. package/dist/components/SchedulingTimeline.d.ts +1 -0
  72. package/dist/components/SearchSuggest.d.ts +6 -2
  73. package/dist/components/SearchSuggest.js +4 -0
  74. package/dist/components/Segmented.d.ts +17 -3
  75. package/dist/components/Segmented.js +59 -5
  76. package/dist/components/Select.d.ts +66 -2
  77. package/dist/components/Select.js +800 -10
  78. package/dist/components/Spinner.d.ts +2 -1
  79. package/dist/components/Spinner.js +1 -1
  80. package/dist/components/StatusPill.d.ts +8 -2
  81. package/dist/components/StatusPill.js +2 -2
  82. package/dist/components/Steps.d.ts +28 -4
  83. package/dist/components/Steps.js +46 -16
  84. package/dist/components/TableControls.js +4 -3
  85. package/dist/components/Tabs.d.ts +7 -2
  86. package/dist/components/Tabs.js +14 -1
  87. package/dist/components/TextDiff.d.ts +49 -0
  88. package/dist/components/TextDiff.js +124 -0
  89. package/dist/{emoji-image-6mPZ15Zy.d.cts → emoji-image-DjCKpdwE.d.cts} +1 -1
  90. package/dist/emoji.cjs +169 -27
  91. package/dist/emoji.d.cts +3 -3
  92. package/dist/file-model.d.ts +56 -0
  93. package/dist/file-model.js +52 -0
  94. package/dist/filter-model.d.ts +112 -0
  95. package/dist/filter-model.js +103 -0
  96. package/dist/hooks/useAnchoredPosition.d.ts +24 -1
  97. package/dist/hooks/useAnchoredPosition.js +58 -8
  98. package/dist/hooks/useVirtualRows.d.ts +17 -2
  99. package/dist/hooks/useVirtualRows.js +6 -5
  100. package/dist/icons/Icon.d.ts +14 -14
  101. package/dist/index.cjs +4938 -1631
  102. package/dist/index.d.cts +1622 -178
  103. package/dist/index.d.ts +20 -6
  104. package/dist/index.js +88 -4
  105. package/dist/labels-context.d.ts +28 -0
  106. package/dist/{overlay-position-Cjv5E7mn.d.cts → overlay-position-2Afke51l.d.cts} +20 -0
  107. package/dist/overlay-position.d.ts +20 -0
  108. package/dist/overlay-position.js +17 -2
  109. package/dist/rich-text.cjs +169 -27
  110. package/dist/rich-text.d.cts +3 -3
  111. package/dist/rule-builder-model.d.ts +34 -2
  112. package/dist/rule-builder-model.js +48 -12
  113. package/dist/scheduling-calendar-model.d.ts +66 -0
  114. package/dist/scheduling-calendar-model.js +82 -0
  115. package/dist/select-model.d.ts +80 -0
  116. package/dist/select-model.js +109 -0
  117. package/dist/table-engine.d.ts +7 -0
  118. package/dist/table-engine.js +2 -1
  119. package/dist/text-diff-model.d.ts +71 -0
  120. package/dist/text-diff-model.js +261 -0
  121. package/package.json +1 -1
  122. package/dist/ChartCore-DzWe10bN.d.cts +0 -59
@@ -15,6 +15,7 @@ function supportsAnchoring() {
15
15
  }
16
16
  return anchoringSupported;
17
17
  }
18
+ const ANCHOR_BAND = 64;
18
19
  let anchorCount = 0;
19
20
  const namesOf = (value) => value.split(",").map((n) => n.trim()).filter((n) => n.startsWith("--"));
20
21
  function addAnchorName(el, name) {
@@ -39,9 +40,12 @@ function translationOf(el) {
39
40
  }
40
41
  const signed = (n) => `${n < 0 ? "-" : "+"} ${Math.round(Math.abs(n) * 100) / 100}px`;
41
42
  const prepared = /* @__PURE__ */ new WeakSet();
42
- function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-start", offset = 6, padding = 8 }) {
43
- const opts = useRef({ placement, offset, padding });
44
- opts.current = { placement, offset, padding };
43
+ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-start", offset = 6, padding = 8, shiftMainAxis = true, capHeight = false, onAnchorHidden }) {
44
+ const opts = useRef({ placement, offset, padding, shiftMainAxis, capHeight });
45
+ opts.current = { placement, offset, padding, shiftMainAxis, capHeight };
46
+ const onAnchorHiddenRef = useRef(onAnchorHidden);
47
+ onAnchorHiddenRef.current = onAnchorHidden;
48
+ const heightCap = useRef(null);
45
49
  const session = useRef(false);
46
50
  const side = useRef(null);
47
51
  const written = useRef("");
@@ -65,6 +69,15 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
65
69
  }
66
70
  removeAnchorName(current.anchor, current.name);
67
71
  }, [floatingRef]);
72
+ const uncap = useCallback(() => {
73
+ const cap = heightCap.current;
74
+ if (!cap) return;
75
+ heightCap.current = null;
76
+ const floating = floatingRef.current;
77
+ if (!floating) return;
78
+ floating.style.maxHeight = cap.inlineMaxHeight;
79
+ if (cap.setOverflow) floating.style.overflowY = cap.inlineOverflowY;
80
+ }, [floatingRef]);
68
81
  const reposition = useCallback(() => {
69
82
  const anchorEl = resolveAnchor(anchor);
70
83
  const floating = floatingRef.current;
@@ -77,14 +90,36 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
77
90
  prepared.add(floating);
78
91
  written.current = "";
79
92
  }
93
+ const { placement: p, offset: o, padding: pad, shiftMainAxis: keepInView, capHeight: cap } = opts.current;
94
+ if (cap) {
95
+ if (!heightCap.current) {
96
+ const own = getComputedStyle(floating);
97
+ const setOverflow = !own.overflowY || own.overflowY === "visible";
98
+ heightCap.current = {
99
+ inlineMaxHeight: s.maxHeight,
100
+ inlineOverflowY: s.overflowY,
101
+ ownMaxHeight: own.maxHeight && own.maxHeight !== "none" ? own.maxHeight : "",
102
+ setOverflow,
103
+ written: ""
104
+ };
105
+ if (setOverflow) s.overflowY = "auto";
106
+ }
107
+ const room = `${Math.max(0, window.innerHeight - 2 * pad)}px`;
108
+ const max = heightCap.current.ownMaxHeight ? `min(${room}, ${heightCap.current.ownMaxHeight})` : room;
109
+ if (max !== heightCap.current.written) {
110
+ s.maxHeight = max;
111
+ heightCap.current.written = max;
112
+ }
113
+ } else if (heightCap.current) {
114
+ uncap();
115
+ }
80
116
  const a = anchorEl.getBoundingClientRect();
81
117
  const size = { width: floating.offsetWidth, height: floating.offsetHeight };
82
- const { placement: p, offset: o, padding: pad } = opts.current;
83
118
  const pos = computePosition(
84
119
  { x: a.x, y: a.y, width: a.width, height: a.height },
85
120
  size,
86
121
  { width: window.innerWidth, height: window.innerHeight },
87
- { placement: p, offset: o, padding: pad, stickySide: side.current ?? void 0 }
122
+ { placement: p, offset: o, padding: pad, shiftMainAxis: keepInView, stickySide: side.current ?? void 0 }
88
123
  );
89
124
  const measured = size.width > 0 || size.height > 0;
90
125
  if (measured && session.current) side.current = pos.side;
@@ -98,7 +133,10 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
98
133
  s.top = top2;
99
134
  written.current = key2;
100
135
  };
101
- if (anchoringFailed.current || !supportsAnchoring()) {
136
+ const limit = pos.mainAxisRange;
137
+ const nearLimit = limit !== null && (pos.mainAxisNatural < limit[0] + ANCHOR_BAND || pos.mainAxisNatural > limit[1] - ANCHOR_BAND);
138
+ if (anchoringFailed.current || nearLimit || !supportsAnchoring()) {
139
+ if (anchoring.current) release(false);
102
140
  writeFixed(pos);
103
141
  return;
104
142
  }
@@ -135,7 +173,7 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
135
173
  writeFixed(pos);
136
174
  }
137
175
  }
138
- }, [anchor, floatingRef, release]);
176
+ }, [anchor, floatingRef, release, uncap]);
139
177
  useIsomorphicLayoutEffect(() => {
140
178
  if (!open) return;
141
179
  session.current = true;
@@ -164,8 +202,20 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
164
202
  side.current = null;
165
203
  anchoringFailed.current = false;
166
204
  release(true);
205
+ uncap();
167
206
  };
168
- }, [open, reposition, anchor, floatingRef, release]);
207
+ }, [open, reposition, anchor, floatingRef, release, uncap]);
208
+ const watchAnchor = open && !!onAnchorHidden;
209
+ useEffect(() => {
210
+ const anchorEl = resolveAnchor(anchor);
211
+ if (!watchAnchor || !anchorEl || typeof IntersectionObserver !== "function") return;
212
+ const observer = new IntersectionObserver((entries) => {
213
+ const latest = entries[entries.length - 1];
214
+ if (latest && !latest.isIntersecting) onAnchorHiddenRef.current?.();
215
+ });
216
+ observer.observe(anchorEl);
217
+ return () => observer.disconnect();
218
+ }, [watchAnchor, anchor]);
169
219
  useEffect(() => () => release(false), [release]);
170
220
  return reposition;
171
221
  }
@@ -5,8 +5,21 @@ interface UseVirtualRowsOptions {
5
5
  rowHeight: number;
6
6
  /** Rows rendered beyond each viewport edge. Default: 6. */
7
7
  overscan?: number;
8
- /** Render all rows at or below this count. Default: 100. */
8
+ /**
9
+ * Render all rows at or below this count: rows are windowed only when
10
+ * `rows.length > threshold` (so exactly `threshold` rows are still rendered whole).
11
+ * Default: 100.
12
+ */
9
13
  threshold?: number;
14
+ /**
15
+ * Viewport height in pixels to assume until the scroll element has been measured, and
16
+ * whenever it measures 0 (first render, a hidden tab, a test without layout). With it, a
17
+ * 5,000-row table mounts with one window of rows; without it every row is rendered until
18
+ * the first measurement, as before (HAR-1616).
19
+ */
20
+ estimatedViewportHeight?: number;
21
+ /** `false` renders every row with no spacers, whatever the count. Default: `true`. */
22
+ enabled?: boolean;
10
23
  }
11
24
  interface UseVirtualRowsResult<T> {
12
25
  /** Attach to the scrolling TableWrap. */
@@ -21,7 +34,9 @@ interface UseVirtualRowsResult<T> {
21
34
  /**
22
35
  * Owns scroll/resize observation and exposes the small visible row window.
23
36
  * Consumers render padTop/padBottom spacer rows inside their existing tbody.
37
+ * When the row count shrinks under a large scroll position the window is clamped to the new
38
+ * count in the same render, so `padTop` never exceeds the list (HAR-1616).
24
39
  */
25
- declare function useVirtualRows<T>(rows: readonly T[], { rowHeight, overscan, threshold }: UseVirtualRowsOptions): UseVirtualRowsResult<T>;
40
+ declare function useVirtualRows<T>(rows: readonly T[], { rowHeight, overscan, threshold, estimatedViewportHeight, enabled }: UseVirtualRowsOptions): UseVirtualRowsResult<T>;
26
41
 
27
42
  export { type UseVirtualRowsOptions, type UseVirtualRowsResult, useVirtualRows };
@@ -1,7 +1,7 @@
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 }) {
4
+ function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100, estimatedViewportHeight = 0, enabled = true }) {
5
5
  const containerRef = useRef(null);
6
6
  const [viewport, setViewport] = useState({ scrollTop: 0, height: 0 });
7
7
  useLayoutEffect(() => {
@@ -29,10 +29,11 @@ function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100 }) {
29
29
  if (frame) cancelAnimationFrame(frame);
30
30
  };
31
31
  }, []);
32
- const enabled = viewport.height > 0 && shouldVirtualize(rows.length, threshold);
32
+ const height = viewport.height > 0 ? viewport.height : Math.max(0, estimatedViewportHeight);
33
+ const virtualized = enabled && height > 0 && shouldVirtualize(rows.length, threshold);
33
34
  const window = useMemo(
34
- () => enabled ? virtualWindow(viewport.scrollTop, viewport.height, rowHeight, rows.length, overscan) : { start: 0, end: rows.length, padTop: 0, padBottom: 0, total: rows.length * rowHeight },
35
- [enabled, overscan, rowHeight, rows.length, viewport.height, viewport.scrollTop]
35
+ () => virtualized ? virtualWindow(viewport.scrollTop, height, rowHeight, rows.length, overscan) : { start: 0, end: rows.length, padTop: 0, padBottom: 0, total: rows.length * rowHeight },
36
+ [virtualized, overscan, rowHeight, rows.length, height, viewport.scrollTop]
36
37
  );
37
38
  const visibleRows = useMemo(() => rows.slice(window.start, window.end), [rows, window.start, window.end]);
38
39
  return {
@@ -42,7 +43,7 @@ function useVirtualRows(rows, { rowHeight, overscan = 6, threshold = 100 }) {
42
43
  padTop: window.padTop,
43
44
  padBottom: window.padBottom,
44
45
  totalHeight: window.total,
45
- virtualized: enabled
46
+ virtualized
46
47
  };
47
48
  }
48
49
  export {
@@ -5,12 +5,22 @@ import { IconNode, UixIcon, IconProps } from './types.js';
5
5
  /** Renders a glyph as an inline SVG; the props contract shared by every icon. */
6
6
  declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, className, style, ...rest }: IconProps, ref?: unknown): react.ReactElement<{
7
7
  string?: number | string | undefined | undefined;
8
+ filter?: string | undefined | undefined;
9
+ values?: string | undefined | undefined;
10
+ fill: string;
11
+ color?: string | undefined | undefined;
12
+ fontStyle?: number | string | undefined | undefined;
13
+ fontWeight?: number | string | undefined | undefined;
14
+ fontSize?: number | string | undefined | undefined;
15
+ fontFamily?: string | undefined | undefined;
16
+ width?: number | string | undefined | undefined;
17
+ height?: number | string | undefined | undefined;
8
18
  type?: string | undefined | undefined;
9
- id?: string | undefined | undefined;
10
- name?: string | undefined | undefined;
11
19
  z?: number | string | undefined | undefined;
12
- color?: string | undefined | undefined;
13
20
  opacity?: number | string | undefined | undefined;
21
+ r?: number | string | undefined | undefined;
22
+ id?: string | undefined | undefined;
23
+ name?: string | undefined | undefined;
14
24
  x?: number | string | undefined | undefined;
15
25
  y?: number | string | undefined | undefined;
16
26
  cursor?: number | string | undefined | undefined;
@@ -18,11 +28,6 @@ declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, cl
18
28
  clipPath?: string | undefined | undefined;
19
29
  radius?: number | string | undefined | undefined;
20
30
  media?: string | undefined | undefined;
21
- fontStyle?: number | string | undefined | undefined;
22
- fontWeight?: number | string | undefined | undefined;
23
- fontSize?: number | string | undefined | undefined;
24
- fontFamily?: string | undefined | undefined;
25
- height?: number | string | undefined | undefined;
26
31
  suppressHydrationWarning?: boolean | undefined | undefined;
27
32
  lang?: string | undefined | undefined;
28
33
  tabIndex?: number | undefined | undefined;
@@ -249,13 +254,10 @@ declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, cl
249
254
  local?: number | string | undefined | undefined;
250
255
  hanging?: number | string | undefined | undefined;
251
256
  unicode?: number | string | undefined | undefined;
252
- fill: string;
253
257
  clip?: number | string | undefined | undefined;
254
258
  stroke: string;
255
- r?: number | string | undefined | undefined;
256
- filter?: string | undefined | undefined;
257
- values?: string | undefined | undefined;
258
259
  offset?: number | string | undefined | undefined;
260
+ capHeight?: number | string | undefined | undefined;
259
261
  dy?: number | string | undefined | undefined;
260
262
  dx?: number | string | undefined | undefined;
261
263
  transform?: string | undefined | undefined;
@@ -265,7 +267,6 @@ declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, cl
265
267
  method?: string | undefined | undefined;
266
268
  min?: number | string | undefined | undefined;
267
269
  target?: string | undefined | undefined;
268
- width?: number | string | undefined | undefined;
269
270
  crossOrigin?: "" | "anonymous" | "use-credentials" | undefined;
270
271
  accentHeight?: number | string | undefined | undefined;
271
272
  additive?: "replace" | "sum" | undefined | undefined;
@@ -286,7 +287,6 @@ declare function renderIcon(node: IconNode, { size, tone, label, strokeWidth, cl
286
287
  bias?: number | string | undefined | undefined;
287
288
  by?: number | string | undefined | undefined;
288
289
  calcMode?: number | string | undefined | undefined;
289
- capHeight?: number | string | undefined | undefined;
290
290
  clipPathUnits?: number | string | undefined | undefined;
291
291
  clipRule?: number | string | undefined | undefined;
292
292
  colorInterpolation?: number | string | undefined | undefined;