@tensor_1/react 2.58.0 → 2.61.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 (42) hide show
  1. package/README.md +4 -4
  2. package/component-inventory.json +4 -0
  3. package/dist/components/Button.d.ts +15 -0
  4. package/dist/components/Button.js +11 -6
  5. package/dist/components/Checkbox.js +1 -1
  6. package/dist/components/Drawer.js +104 -1
  7. package/dist/components/FileKindIcon.d.ts +5 -1
  8. package/dist/components/FileKindIcon.js +5 -1
  9. package/dist/components/Menu.js +10 -1
  10. package/dist/components/Popover.js +4 -1
  11. package/dist/components/Select.js +85 -11
  12. package/dist/components/Sidebar.js +29 -2
  13. package/dist/components/Tooltip.js +103 -16
  14. package/dist/emoji.cjs +263 -70
  15. package/dist/file-model.d.ts +14 -7
  16. package/dist/file-model.js +18 -6
  17. package/dist/hooks/useArrivalBlur.d.ts +14 -0
  18. package/dist/hooks/useArrivalBlur.js +47 -0
  19. package/dist/hooks/useHoverGlide.d.ts +28 -0
  20. package/dist/hooks/useHoverGlide.js +137 -0
  21. package/dist/icons/Icon.d.ts +4 -2
  22. package/dist/icons/Icon.js +6 -2
  23. package/dist/icons/NamedIcon.js +1 -1
  24. package/dist/icons/components.d.ts +2 -1
  25. package/dist/icons/components.js +2 -0
  26. package/dist/icons/glyphs.d.ts +3 -1
  27. package/dist/icons/glyphs.js +3 -0
  28. package/dist/icons/types.d.ts +11 -0
  29. package/dist/icons.cjs +12 -3
  30. package/dist/icons.d.cts +5 -3
  31. package/dist/icons.d.ts +1 -1
  32. package/dist/index.cjs +2956 -2333
  33. package/dist/index.d.cts +61 -11
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +3 -0
  36. package/dist/motion.d.ts +25 -1
  37. package/dist/motion.js +100 -0
  38. package/dist/rich-text.cjs +4 -1
  39. package/dist/{types-B593xJNf.d.cts → types-B7OIndwg.d.cts} +11 -0
  40. package/dist/usage-roles.d.ts +28 -0
  41. package/dist/usage-roles.js +28 -0
  42. package/package.json +1 -1
package/dist/emoji.cjs CHANGED
@@ -46,7 +46,7 @@ __export(emoji_exports, {
46
46
  module.exports = __toCommonJS(emoji_exports);
47
47
 
48
48
  // src/components/EmojiPicker.tsx
49
- var import_react4 = require("react");
49
+ var import_react5 = require("react");
50
50
 
51
51
  // src/cx.ts
52
52
  function cx(...args) {
@@ -54,7 +54,7 @@ function cx(...args) {
54
54
  }
55
55
 
56
56
  // src/components/Popover.tsx
57
- var import_react2 = require("react");
57
+ var import_react3 = require("react");
58
58
 
59
59
  // src/hooks/useAnchoredPosition.ts
60
60
  var import_react = require("react");
@@ -379,6 +379,14 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
379
379
  return reposition;
380
380
  }
381
381
 
382
+ // src/hooks/useReducedMotion.ts
383
+ var import_react2 = require("react");
384
+ var QUERY = "(prefers-reduced-motion: reduce)";
385
+ function prefersReducedMotion() {
386
+ if (typeof document !== "undefined" && document.documentElement.getAttribute("data-motion") === "reduce") return true;
387
+ return typeof matchMedia !== "undefined" && matchMedia(QUERY).matches;
388
+ }
389
+
382
390
  // src/motion.ts
383
391
  var KEY_OPENED = "data-uix-key-opened";
384
392
  var keyboard = false;
@@ -405,10 +413,106 @@ function tokenMs(name, fallback, el) {
405
413
  if (!m) return fallback;
406
414
  return m[2] === "s" ? Number(m[1]) * 1e3 : Number(m[1]);
407
415
  }
416
+ function tokenPx(name, fallback) {
417
+ if (typeof window === "undefined" || typeof document === "undefined") return fallback;
418
+ const raw = window.getComputedStyle(document.documentElement).getPropertyValue(name).trim();
419
+ const m = /^(-?\d*\.?\d+)px$/.exec(raw);
420
+ return m ? Number(m[1]) : fallback;
421
+ }
422
+ function bezier(x1, y1, x2, y2) {
423
+ const at = (a, b, t) => 3 * a * t * (1 - t) ** 2 + 3 * b * t * t * (1 - t) + t ** 3;
424
+ const slope = (a, b, t) => 3 * a * (1 - t) ** 2 + 6 * (b - a) * t * (1 - t) + 3 * (1 - b) * t * t;
425
+ return (x) => {
426
+ if (x <= 0) return 0;
427
+ if (x >= 1) return 1;
428
+ let t = x;
429
+ for (let i = 0; i < 6; i++) {
430
+ const d = slope(x1, x2, t);
431
+ if (Math.abs(d) < 1e-6) break;
432
+ t -= (at(x1, x2, t) - x) / d;
433
+ }
434
+ if (t < 0 || t > 1 || Math.abs(at(x1, x2, t) - x) > 1e-4) {
435
+ let lo = 0;
436
+ let hi = 1;
437
+ t = x;
438
+ for (let i = 0; i < 30; i++) {
439
+ if (at(x1, x2, t) < x) lo = t;
440
+ else hi = t;
441
+ t = (lo + hi) / 2;
442
+ }
443
+ }
444
+ return at(y1, y2, t);
445
+ };
446
+ }
447
+ function tokenEase(name) {
448
+ const fallback = bezier(0.23, 1, 0.32, 1);
449
+ if (typeof window === "undefined" || typeof document === "undefined") return fallback;
450
+ const raw = window.getComputedStyle(document.documentElement).getPropertyValue(name).trim();
451
+ const cb = /^cubic-bezier\(([^)]+)\)$/.exec(raw);
452
+ if (cb) {
453
+ const [a, b, c, d] = cb[1].split(",").map(Number);
454
+ if ([a, b, c, d].every(Number.isFinite)) return bezier(a, b, c, d);
455
+ }
456
+ const lin = /^linear\(([^)]+)\)$/.exec(raw);
457
+ if (lin) {
458
+ const pts = lin[1].split(",").map(Number);
459
+ if (pts.length > 1 && pts.every(Number.isFinite)) {
460
+ return (x) => {
461
+ if (x <= 0) return pts[0];
462
+ if (x >= 1) return pts[pts.length - 1];
463
+ const at = x * (pts.length - 1);
464
+ const i = Math.floor(at);
465
+ return pts[i] + (pts[i + 1] - pts[i]) * (at - i);
466
+ };
467
+ }
468
+ }
469
+ return fallback;
470
+ }
471
+ function blurIn(elements, options) {
472
+ const els = elements.slice();
473
+ if (typeof window === "undefined" || els.length === 0 || options.from <= 0 || options.duration <= 0) return () => {
474
+ };
475
+ const { from, duration, ease, delay = () => 0, leave = false, property } = options;
476
+ const write = (el, r) => {
477
+ if (property) {
478
+ if (r > 0.05) el.style.setProperty(property, `${r.toFixed(2)}px`);
479
+ else el.style.removeProperty(property);
480
+ } else el.style.filter = r > 0.05 ? `blur(${r.toFixed(2)}px)` : "";
481
+ };
482
+ const paint = (el, p) => write(el, leave ? from * ease(p) : from * (1 - ease(p)));
483
+ els.forEach((el) => paint(el, 0));
484
+ const view = window;
485
+ const start = view.performance.now();
486
+ let frame = 0;
487
+ let stopped = false;
488
+ const tick = () => {
489
+ if (stopped) return;
490
+ if (prefersReducedMotion()) {
491
+ stopped = true;
492
+ els.forEach((el) => write(el, 0));
493
+ return;
494
+ }
495
+ const now = view.performance.now();
496
+ let busy = false;
497
+ els.forEach((el, i) => {
498
+ const p = Math.min(1, Math.max(0, (now - start - delay(i)) / duration));
499
+ if (p < 1) busy = true;
500
+ paint(el, p);
501
+ });
502
+ if (busy) frame = view.requestAnimationFrame(tick);
503
+ else if (leave) els.forEach((el) => write(el, 0));
504
+ };
505
+ frame = view.requestAnimationFrame(tick);
506
+ return () => {
507
+ stopped = true;
508
+ view.cancelAnimationFrame(frame);
509
+ els.forEach((el) => write(el, 0));
510
+ };
511
+ }
408
512
 
409
513
  // src/components/Popover.tsx
410
514
  var import_jsx_runtime = require("react/jsx-runtime");
411
- var useIsomorphicLayoutEffect2 = typeof document !== "undefined" ? import_react2.useLayoutEffect : import_react2.useEffect;
515
+ var useIsomorphicLayoutEffect2 = typeof document !== "undefined" ? import_react3.useLayoutEffect : import_react3.useEffect;
412
516
  var PLACING = "data-uix-placing";
413
517
  var isPopoverOpen = (el) => {
414
518
  try {
@@ -439,10 +543,10 @@ function Popover({
439
543
  const popover = popoverProp ?? (hover ? "manual" : "auto");
440
544
  const openDelay = typeof openOnHover === "object" ? openOnHover.openDelay ?? 300 : 300;
441
545
  const closeDelay = typeof openOnHover === "object" ? openOnHover.closeDelay ?? 150 : 150;
442
- const ref = (0, import_react2.useRef)(null);
443
- const [open, setOpen] = (0, import_react2.useState)(false);
444
- const openRef = (0, import_react2.useRef)(false);
445
- const onAnchorHiddenRef = (0, import_react2.useRef)(onAnchorHidden);
546
+ const ref = (0, import_react3.useRef)(null);
547
+ const [open, setOpen] = (0, import_react3.useState)(false);
548
+ const openRef = (0, import_react3.useRef)(false);
549
+ const onAnchorHiddenRef = (0, import_react3.useRef)(onAnchorHidden);
446
550
  onAnchorHiddenRef.current = onAnchorHidden;
447
551
  const popoverAttr = { popover };
448
552
  const reposition = useAnchoredPosition(anchor ?? null, ref, {
@@ -459,15 +563,18 @@ function Popover({
459
563
  el.hidePopover();
460
564
  } : void 0
461
565
  });
462
- (0, import_react2.useEffect)(() => {
566
+ (0, import_react3.useEffect)(() => {
463
567
  watchInputModality();
464
568
  const el = ref.current;
465
569
  if (!el) return;
466
- const mark = () => markKeyOpened(el);
570
+ const mark = () => {
571
+ if (el.hasAttribute("data-uix-animate-keys")) el.removeAttribute("data-uix-key-opened");
572
+ else markKeyOpened(el);
573
+ };
467
574
  el.addEventListener("beforetoggle", mark);
468
575
  return () => el.removeEventListener("beforetoggle", mark);
469
576
  }, []);
470
- (0, import_react2.useEffect)(() => {
577
+ (0, import_react3.useEffect)(() => {
471
578
  const el = ref.current;
472
579
  if (!el || !anchor) return;
473
580
  const hold = (event) => {
@@ -500,7 +607,7 @@ function Popover({
500
607
  el.removeAttribute(PLACING);
501
608
  };
502
609
  }, [anchor, reposition]);
503
- (0, import_react2.useEffect)(() => {
610
+ (0, import_react3.useEffect)(() => {
504
611
  const el = ref.current;
505
612
  const anchorEl = resolveAnchor(anchor);
506
613
  if (!hover || !el || !anchorEl) return;
@@ -687,7 +794,7 @@ function formatLabel(template, values) {
687
794
  }
688
795
 
689
796
  // src/components/EmojiGlyph.tsx
690
- var import_react3 = require("react");
797
+ var import_react4 = require("react");
691
798
 
692
799
  // src/emoji-image.ts
693
800
  var warned = /* @__PURE__ */ new Set();
@@ -755,12 +862,12 @@ function canRenderEmoji(emoji) {
755
862
  // src/components/EmojiGlyph.tsx
756
863
  var import_jsx_runtime2 = require("react/jsx-runtime");
757
864
  function useEmojiRenderer(emojiImageBaseUrl) {
758
- const base = (0, import_react3.useMemo)(() => normalizeEmojiImageBaseUrl(emojiImageBaseUrl), [emojiImageBaseUrl]);
759
- const [mounted, setMounted] = (0, import_react3.useState)(false);
760
- (0, import_react3.useEffect)(() => {
865
+ const base = (0, import_react4.useMemo)(() => normalizeEmojiImageBaseUrl(emojiImageBaseUrl), [emojiImageBaseUrl]);
866
+ const [mounted, setMounted] = (0, import_react4.useState)(false);
867
+ (0, import_react4.useEffect)(() => {
761
868
  if (base) setMounted(true);
762
869
  }, [base]);
763
- return (0, import_react3.useCallback)((emoji) => {
870
+ return (0, import_react4.useCallback)((emoji) => {
764
871
  if (!base || !mounted || canRenderEmoji(emoji)) return emoji;
765
872
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { className: "uix-emoji-img", src: emojiImageSrc(base, emoji), alt: emoji, draggable: false, decoding: "async" });
766
873
  }, [base, mounted]);
@@ -779,7 +886,7 @@ var DEFAULT_EMOJI_PICKER_LABELS = {
779
886
  loadFailed: "Emoji could not be loaded."
780
887
  };
781
888
  var EMOJI_GRID_COLUMNS = 8;
782
- var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? import_react4.useLayoutEffect : import_react4.useEffect;
889
+ var useIsomorphicLayoutEffect3 = typeof document !== "undefined" ? import_react5.useLayoutEffect : import_react5.useEffect;
783
890
  function revealInGrid(grid, cell) {
784
891
  const g = grid.getBoundingClientRect();
785
892
  const c = cell.getBoundingClientRect();
@@ -802,20 +909,20 @@ function EmojiPicker({
802
909
  }) {
803
910
  const renderEmoji = useEmojiRenderer(emojiImageBaseUrl);
804
911
  const labels = { ...DEFAULT_EMOJI_PICKER_LABELS, ...labelOverrides };
805
- const id = (0, import_react4.useId)();
912
+ const id = (0, import_react5.useId)();
806
913
  const popoverId = `${id}-picker`;
807
- const anchorRef = (0, import_react4.useRef)(null);
808
- const searchRef = (0, import_react4.useRef)(null);
809
- const gridRef = (0, import_react4.useRef)(null);
810
- const pointerWasOpen = (0, import_react4.useRef)(null);
811
- const closedByAnchor = (0, import_react4.useRef)(false);
812
- const pendingJump = (0, import_react4.useRef)(null);
813
- const [open, setOpen] = (0, import_react4.useState)(false);
814
- const [data, setData] = (0, import_react4.useState)(null);
815
- const [failed, setFailed] = (0, import_react4.useState)(false);
816
- const [query, setQuery] = (0, import_react4.useState)("");
817
- const [recent, setRecent] = (0, import_react4.useState)([]);
818
- const [active, setActive] = (0, import_react4.useState)(0);
914
+ const anchorRef = (0, import_react5.useRef)(null);
915
+ const searchRef = (0, import_react5.useRef)(null);
916
+ const gridRef = (0, import_react5.useRef)(null);
917
+ const pointerWasOpen = (0, import_react5.useRef)(null);
918
+ const closedByAnchor = (0, import_react5.useRef)(false);
919
+ const pendingJump = (0, import_react5.useRef)(null);
920
+ const [open, setOpen] = (0, import_react5.useState)(false);
921
+ const [data, setData] = (0, import_react5.useState)(null);
922
+ const [failed, setFailed] = (0, import_react5.useState)(false);
923
+ const [query, setQuery] = (0, import_react5.useState)("");
924
+ const [recent, setRecent] = (0, import_react5.useState)([]);
925
+ const [active, setActive] = (0, import_react5.useState)(0);
819
926
  const popoverEl = () => typeof document === "undefined" ? null : document.getElementById(popoverId);
820
927
  const isOpen = (el) => {
821
928
  try {
@@ -824,7 +931,7 @@ function EmojiPicker({
824
931
  return false;
825
932
  }
826
933
  };
827
- (0, import_react4.useEffect)(() => {
934
+ (0, import_react5.useEffect)(() => {
828
935
  const el = popoverEl();
829
936
  if (!el) return;
830
937
  const onToggle = (event) => {
@@ -848,7 +955,7 @@ function EmojiPicker({
848
955
  el.addEventListener("toggle", onToggle);
849
956
  return () => el.removeEventListener("toggle", onToggle);
850
957
  }, [popoverId, recentStorageKey, onOpenChange]);
851
- (0, import_react4.useEffect)(() => {
958
+ (0, import_react5.useEffect)(() => {
852
959
  if (!open || data?.locale === locale) return;
853
960
  let live = true;
854
961
  setFailed(false);
@@ -872,7 +979,7 @@ function EmojiPicker({
872
979
  const el = popoverEl();
873
980
  if (el && isOpen(el)) el.hidePopover();
874
981
  };
875
- const browseSections = (0, import_react4.useMemo)(() => {
982
+ const browseSections = (0, import_react5.useMemo)(() => {
876
983
  const list = [];
877
984
  if (quickPicks?.length) list.push({ key: "quick", title: labels.quickPicks, emojis: [...new Set(quickPicks)] });
878
985
  if (recent.length) list.push({ key: "recent", title: labels.recent, emojis: recent });
@@ -883,12 +990,12 @@ function EmojiPicker({
883
990
  }
884
991
  return list;
885
992
  }, [data, quickPicks, recent, labels.quickPicks, labels.recent]);
886
- const sections = (0, import_react4.useMemo)(() => {
993
+ const sections = (0, import_react5.useMemo)(() => {
887
994
  if (!query.trim()) return browseSections;
888
995
  return data ? [{ key: "results", title: labels.search, emojis: searchEmoji(data, query).map((e) => e.emoji) }] : [];
889
996
  }, [query, data, browseSections, labels.search]);
890
- const flat = (0, import_react4.useMemo)(() => sections.flatMap((s) => s.emojis), [sections]);
891
- const sectionStart = (0, import_react4.useMemo)(() => {
997
+ const flat = (0, import_react5.useMemo)(() => sections.flatMap((s) => s.emojis), [sections]);
998
+ const sectionStart = (0, import_react5.useMemo)(() => {
892
999
  const starts = /* @__PURE__ */ new Map();
893
1000
  let at = 0;
894
1001
  for (const section of sections) {
@@ -903,7 +1010,7 @@ function EmojiPicker({
903
1010
  onSelect(emoji);
904
1011
  hide();
905
1012
  };
906
- const focusCell = (0, import_react4.useCallback)((index, reveal = true) => {
1013
+ const focusCell = (0, import_react5.useCallback)((index, reveal = true) => {
907
1014
  setActive(index);
908
1015
  const find = () => gridRef.current?.querySelector(`[data-emoji-index="${index}"]`);
909
1016
  const move = (cell2) => {
@@ -975,8 +1082,8 @@ function EmojiPicker({
975
1082
  if (isOpen(el)) el.hidePopover();
976
1083
  else el.showPopover();
977
1084
  };
978
- const triggerProps = (0, import_react4.isValidElement)(trigger) ? trigger.props : {};
979
- const triggerEl = (0, import_react4.isValidElement)(trigger) ? (0, import_react4.cloneElement)(trigger, {
1085
+ const triggerProps = (0, import_react5.isValidElement)(trigger) ? trigger.props : {};
1086
+ const triggerEl = (0, import_react5.isValidElement)(trigger) ? (0, import_react5.cloneElement)(trigger, {
980
1087
  "aria-haspopup": "dialog",
981
1088
  "aria-expanded": open,
982
1089
  "aria-controls": popoverId,
@@ -1135,10 +1242,11 @@ function EditorIcon({ name, ...props }) {
1135
1242
  }
1136
1243
 
1137
1244
  // src/components/Tooltip.tsx
1138
- var import_react6 = require("react");
1245
+ var import_react7 = require("react");
1246
+ var import_react_dom = require("react-dom");
1139
1247
 
1140
1248
  // src/components/Kbd.tsx
1141
- var import_react5 = require("react");
1249
+ var import_react6 = require("react");
1142
1250
  var import_jsx_runtime5 = require("react/jsx-runtime");
1143
1251
  var KEYS = {
1144
1252
  Mod: { mac: ["\u2318", "Command"], other: ["Ctrl", "Control"] },
@@ -1168,7 +1276,7 @@ var noSubscription = () => () => {
1168
1276
  };
1169
1277
  var serverPlatform = () => "other";
1170
1278
  function useKbdPlatform(platform) {
1171
- const detected = (0, import_react5.useSyncExternalStore)(noSubscription, detectPlatform, serverPlatform);
1279
+ const detected = (0, import_react6.useSyncExternalStore)(noSubscription, detectPlatform, serverPlatform);
1172
1280
  return platform ?? detected;
1173
1281
  }
1174
1282
  var isKeyShortcut = (value) => Array.isArray(value) && value.length > 0 && value.every((key) => typeof key === "string");
@@ -1185,22 +1293,97 @@ function KbdCombo({ keys, platform, keyLabels, className, ...props }) {
1185
1293
 
1186
1294
  // src/components/Tooltip.tsx
1187
1295
  var import_jsx_runtime6 = require("react/jsx-runtime");
1188
- var group = { open: 0, lastClosed: -Infinity, current: null };
1189
- var useIsomorphicLayoutEffect4 = typeof document !== "undefined" ? import_react6.useLayoutEffect : import_react6.useEffect;
1296
+ var group = { open: 0, lastClosed: -Infinity, current: null, bubble: null };
1297
+ var MORPH_FALLBACK_MS = 1e3;
1298
+ var MORPH_MAX_TRAVEL_PX = 320;
1299
+ var useIsomorphicLayoutEffect4 = typeof document !== "undefined" ? import_react7.useLayoutEffect : import_react7.useEffect;
1190
1300
  function Tooltip({ label, content, placement = "top", shortcut, className, children, ...props }) {
1191
- const triggerRef = (0, import_react6.useRef)(null);
1192
- const bubbleRef = (0, import_react6.useRef)(null);
1193
- const closeTimer = (0, import_react6.useRef)(null);
1194
- const openTimer = (0, import_react6.useRef)(null);
1195
- const shown = (0, import_react6.useRef)(false);
1196
- const [open, setOpen] = (0, import_react6.useState)(false);
1197
- const id = (0, import_react6.useId)();
1301
+ const triggerRef = (0, import_react7.useRef)(null);
1302
+ const bubbleRef = (0, import_react7.useRef)(null);
1303
+ const closeTimer = (0, import_react7.useRef)(null);
1304
+ const openTimer = (0, import_react7.useRef)(null);
1305
+ const shown = (0, import_react7.useRef)(false);
1306
+ const morphFrom = (0, import_react7.useRef)(null);
1307
+ const [open, setOpen] = (0, import_react7.useState)(false);
1308
+ const id = (0, import_react7.useId)();
1198
1309
  const platform = useKbdPlatform();
1199
- const childShortcut = (0, import_react6.isValidElement)(children) ? children.props.shortcut : void 0;
1310
+ const childShortcut = (0, import_react7.isValidElement)(children) ? children.props.shortcut : void 0;
1200
1311
  const own = shortcut ?? (isKeyShortcut(childShortcut) ? childShortcut : void 0);
1201
1312
  const keys = own && own.length > 0 ? own : null;
1202
1313
  useAnchoredPosition(triggerRef, bubbleRef, { open, placement, offset: 6 });
1203
- (0, import_react6.useEffect)(() => {
1314
+ useIsomorphicLayoutEffect4(() => {
1315
+ const from = morphFrom.current;
1316
+ const b = bubbleRef.current;
1317
+ morphFrom.current = null;
1318
+ if (!open || !from || !b || prefersReducedMotion()) return void 0;
1319
+ const to = b.getBoundingClientRect();
1320
+ if (!to.width || !to.height) return void 0;
1321
+ const was = from.rect;
1322
+ const dx = was.left + was.width / 2 - (to.left + to.width / 2);
1323
+ const dy = was.top + was.height / 2 - (to.top + to.height / 2);
1324
+ if (Math.hypot(dx, dy) > MORPH_MAX_TRAVEL_PX) return void 0;
1325
+ const alongX = Math.abs(dx) >= Math.abs(dy);
1326
+ const way = Math.hypot(dx, dy) < 0.5 ? 0 : -Math.sign(alongX ? dx : dy);
1327
+ b.setAttribute("data-uix-instant", "");
1328
+ b.setAttribute("data-morph", "");
1329
+ b.style.setProperty("--uix-swap-x", String(alongX ? way : 0));
1330
+ b.style.setProperty("--uix-swap-y", String(alongX ? 0 : way));
1331
+ b.style.transform = `translate(${dx}px, ${dy}px)`;
1332
+ b.style.setProperty("--uix-morph-sx", String(was.width / to.width));
1333
+ b.style.setProperty("--uix-morph-sy", String(was.height / to.height));
1334
+ const content2 = b.querySelector(".uix-tooltip__content");
1335
+ const cs = window.getComputedStyle(b);
1336
+ const px = parseFloat(cs.paddingLeft) || 0;
1337
+ const py = parseFloat(cs.paddingTop) || 0;
1338
+ const insetY = (to.height - was.height) / 2;
1339
+ const insetX = (to.width - was.width) / 2;
1340
+ if (content2) content2.style.clipPath = `inset(${insetY - py}px ${insetX - px}px)`;
1341
+ let leaving = null;
1342
+ if (from.label) {
1343
+ leaving = document.createElement("span");
1344
+ leaving.className = "uix-tooltip__content uix-tooltip__content--leaving";
1345
+ leaving.setAttribute("aria-hidden", "true");
1346
+ const old = from.label.cloneNode(true);
1347
+ for (const el of [old, ...Array.from(old.querySelectorAll("[id]"))]) el.removeAttribute("id");
1348
+ leaving.appendChild(old);
1349
+ leaving.style.clipPath = `inset(${insetY}px ${insetX}px)`;
1350
+ b.appendChild(leaving);
1351
+ }
1352
+ void b.offsetWidth;
1353
+ b.removeAttribute("data-uix-instant");
1354
+ b.setAttribute("data-morphing", "");
1355
+ b.style.transform = "";
1356
+ b.style.removeProperty("--uix-morph-sx");
1357
+ b.style.removeProperty("--uix-morph-sy");
1358
+ if (content2) content2.style.clipPath = `inset(${-py}px ${-px}px)`;
1359
+ if (leaving) leaving.style.clipPath = "inset(0px)";
1360
+ const blur = tokenPx("--uix-swap-blur", 6);
1361
+ const label2 = content2?.querySelector(".uix-tooltip__label");
1362
+ const stopIn = label2 ? blurIn([label2], { from: blur, duration: tokenMs("--uix-dur-swap-in", 340), ease: tokenEase("--uix-ease-enter") }) : () => {
1363
+ };
1364
+ const oldLabel = leaving?.firstElementChild instanceof HTMLElement ? leaving.firstElementChild : null;
1365
+ const stopOut = oldLabel ? blurIn([oldLabel], { from: blur, duration: tokenMs("--uix-dur-swap-out", 130), ease: tokenEase("--uix-ease-leave"), leave: true }) : () => {
1366
+ };
1367
+ const end = () => {
1368
+ clearTimeout(timer);
1369
+ stopIn();
1370
+ stopOut();
1371
+ b.removeEventListener("transitionend", onEnd);
1372
+ b.removeAttribute("data-morph");
1373
+ b.removeAttribute("data-morphing");
1374
+ b.style.removeProperty("--uix-swap-x");
1375
+ b.style.removeProperty("--uix-swap-y");
1376
+ if (content2) content2.style.clipPath = "";
1377
+ leaving?.remove();
1378
+ };
1379
+ const onEnd = (event) => {
1380
+ if (event.target === b && !event.pseudoElement && event.propertyName === "transform") end();
1381
+ };
1382
+ b.addEventListener("transitionend", onEnd);
1383
+ const timer = setTimeout(end, MORPH_FALLBACK_MS);
1384
+ return end;
1385
+ }, [open]);
1386
+ (0, import_react7.useEffect)(() => {
1204
1387
  watchInputModality();
1205
1388
  }, []);
1206
1389
  const cancelClose = () => {
@@ -1215,13 +1398,17 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1215
1398
  openTimer.current = null;
1216
1399
  }
1217
1400
  };
1218
- const reveal = (instant) => {
1401
+ const reveal = (handOver) => {
1219
1402
  cancelOpen();
1403
+ const neighbour = group.current && group.current !== self && group.bubble?.matches(":popover-open") ? group.bubble : null;
1404
+ const rect = neighbour?.getBoundingClientRect();
1405
+ morphFrom.current = handOver && neighbour && rect && rect.width > 0 ? { rect, label: neighbour.querySelector(".uix-tooltip__content:not(.uix-tooltip__content--leaving) > .uix-tooltip__label") } : null;
1220
1406
  if (group.current && group.current !== self) group.current.current(true);
1221
1407
  group.current = self;
1408
+ group.bubble = bubbleRef.current;
1222
1409
  const b = bubbleRef.current;
1223
1410
  if (b && !b.matches(":popover-open")) {
1224
- b.toggleAttribute("data-uix-instant", instant);
1411
+ b.toggleAttribute("data-uix-instant", handOver && !!neighbour);
1225
1412
  markKeyOpened(b);
1226
1413
  try {
1227
1414
  b.showPopover();
@@ -1232,14 +1419,14 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1232
1419
  shown.current = true;
1233
1420
  group.open += 1;
1234
1421
  }
1235
- setOpen(true);
1422
+ (0, import_react_dom.flushSync)(() => setOpen(true));
1236
1423
  };
1237
1424
  const show = (via) => {
1238
1425
  cancelClose();
1239
- if (shown.current) return;
1426
+ if (shown.current || !hasText) return;
1240
1427
  const warm = group.open > 0 || performance.now() - group.lastClosed < tokenMs("--uix-delay-tooltip-skip", 300);
1241
1428
  if (via === "focus" || warm) {
1242
- reveal(via === "pointer");
1429
+ reveal(via === "pointer" && group.open > 0);
1243
1430
  return;
1244
1431
  }
1245
1432
  if (openTimer.current == null) openTimer.current = window.setTimeout(() => reveal(false), tokenMs("--uix-delay-tooltip", 400));
@@ -1260,10 +1447,15 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1260
1447
  group.open -= 1;
1261
1448
  group.lastClosed = performance.now();
1262
1449
  }
1263
- if (group.current === self) group.current = null;
1450
+ if (group.current === self) {
1451
+ group.current = null;
1452
+ group.bubble = null;
1453
+ }
1454
+ morphFrom.current = null;
1455
+ b?.querySelector(".uix-tooltip__content--leaving")?.remove();
1264
1456
  setOpen(false);
1265
1457
  };
1266
- const self = (0, import_react6.useRef)(hide);
1458
+ const self = (0, import_react7.useRef)(hide);
1267
1459
  self.current = hide;
1268
1460
  const scheduleHide = () => {
1269
1461
  cancelClose();
@@ -1274,7 +1466,7 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1274
1466
  } catch {
1275
1467
  }
1276
1468
  hide();
1277
- }, 100);
1469
+ }, tokenMs("--uix-delay-tooltip-skip", 300));
1278
1470
  };
1279
1471
  useIsomorphicLayoutEffect4(() => {
1280
1472
  if (!open) return void 0;
@@ -1282,12 +1474,12 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1282
1474
  if (e.key !== "Escape") return;
1283
1475
  e.preventDefault();
1284
1476
  e.stopPropagation();
1285
- hide();
1477
+ hide(true);
1286
1478
  };
1287
1479
  document.addEventListener("keydown", onKey, true);
1288
1480
  return () => document.removeEventListener("keydown", onKey, true);
1289
1481
  }, [open]);
1290
- (0, import_react6.useEffect)(() => () => {
1482
+ (0, import_react7.useEffect)(() => () => {
1291
1483
  if (closeTimer.current != null) clearTimeout(closeTimer.current);
1292
1484
  if (openTimer.current != null) clearTimeout(openTimer.current);
1293
1485
  if (shown.current) {
@@ -1306,9 +1498,10 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1306
1498
  }, []);
1307
1499
  const bubbleAttr = { popover: "manual" };
1308
1500
  const text = content ?? label;
1501
+ const hasText = keys != null || text != null && text !== "";
1309
1502
  const description = keys ? [text != null ? `${id}-text` : null, `${id}-keys`].filter(Boolean).join(" ") : id;
1310
- const single = (0, import_react6.isValidElement)(children);
1311
- const child = single ? (0, import_react6.cloneElement)(children, {
1503
+ const single = (0, import_react7.isValidElement)(children);
1504
+ const child = single && hasText ? (0, import_react7.cloneElement)(children, {
1312
1505
  "aria-describedby": [children.props["aria-describedby"], description].filter(Boolean).join(" ")
1313
1506
  }) : children;
1314
1507
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
@@ -1316,12 +1509,12 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1316
1509
  {
1317
1510
  ref: triggerRef,
1318
1511
  className: cx("uix-tooltip", className),
1319
- "aria-describedby": single ? void 0 : description,
1320
- tabIndex: single ? void 0 : 0,
1512
+ "aria-describedby": single || !hasText ? void 0 : description,
1513
+ tabIndex: single || !hasText ? void 0 : 0,
1321
1514
  onMouseEnter: () => show("pointer"),
1322
1515
  onMouseLeave: scheduleHide,
1323
1516
  onFocus: () => show("focus"),
1324
- onBlur: () => hide(),
1517
+ onBlur: () => hide(true),
1325
1518
  ...props,
1326
1519
  children: [
1327
1520
  child,
@@ -1335,13 +1528,13 @@ function Tooltip({ label, content, placement = "top", shortcut, className, child
1335
1528
  onMouseEnter: cancelClose,
1336
1529
  onMouseLeave: scheduleHide,
1337
1530
  ...bubbleAttr,
1338
- children: keys ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1531
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uix-tooltip__content", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uix-tooltip__label", children: keys ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1339
1532
  text != null && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id: `${id}-text`, children: text }),
1340
1533
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "uix-tooltip__shortcut", children: [
1341
1534
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { id: `${id}-keys`, className: "uix-visually-hidden", children: spokenKeys(keys, platform) }),
1342
1535
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(KbdCombo, { keys: [...keys], platform, "aria-hidden": "true" })
1343
1536
  ] })
1344
- ] }) : text
1537
+ ] }) : text }) })
1345
1538
  }
1346
1539
  )
1347
1540
  ]
@@ -47,16 +47,23 @@ declare function partitionFiles<F extends {
47
47
  accepted: F[];
48
48
  rejected: FileRejection<F>[];
49
49
  };
50
- /** The coarse kinds of the object form of `fileKind`, read by `FileUpload` and `Attachment`. */
50
+ /**
51
+ * The coarse kinds of the object form of `fileKind`, read by `FileUpload` and `Attachment`. Older
52
+ * than the file kit and separate from `FileKind`: here `text` means any document (Word files
53
+ * included), there it means plain text only.
54
+ */
51
55
  type LegacyFileKind = 'image' | 'video' | 'pdf' | 'sheet' | 'archive' | 'text' | 'other';
52
56
  /**
53
- * What a service-desk agent does with a file, as one of eight kinds (file kit 2.57): `img`
54
- * (Bild), `doc` (Dokument), `sheet` (Tabelle), `mail` (E-Mail), `code` (Code & Konfiguration),
55
- * `log` (Protokoll), `archive` (Archiv) and `other` (Datei). Each has a colour
56
- * (`--uix-file-<kind>`) and a glyph; `FileIcon`, `FileRow` and `FileDrop` read it.
57
+ * What a service-desk agent does with a file, as one of eleven kinds (file kit 2.57, office
58
+ * formats split out in 2.59): `img` (Bild), `doc` (Dokument: Word and other word-processor
59
+ * files), `sheet` (Tabelle), `slides` (Präsentation), `pdf` (PDF), `mail` (E-Mail), `code`
60
+ * (Code & Konfiguration), `log` (Protokoll), `archive` (Archiv), `text` (Text) and `other`
61
+ * (Datei). Each has a colour (`--uix-file-<kind>`) and a glyph; `FileIcon`, `FileRow` and
62
+ * `FileDrop` read it. The office kinds take the colour people know from the program (Word
63
+ * blue, Excel green, PowerPoint orange, PDF red), tuned to stay clear of the status colours.
57
64
  */
58
- type FileKind = 'img' | 'doc' | 'sheet' | 'mail' | 'code' | 'log' | 'archive' | 'other';
59
- /** The eight kinds in display order (`other` last). */
65
+ type FileKind = 'img' | 'doc' | 'sheet' | 'slides' | 'pdf' | 'mail' | 'code' | 'log' | 'archive' | 'text' | 'other';
66
+ /** The eleven kinds in display order (`other` last). */
60
67
  declare const FILE_KINDS: readonly FileKind[];
61
68
  /** The extensions of each kind, lower case and without the dot. `other` has none. */
62
69
  declare const FILE_KIND_EXTENSIONS: Readonly<Record<FileKind, readonly string[]>>;