@tensor_1/react 2.41.0 → 2.42.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.
- package/dist/components/Button.d.ts +19 -1
- package/dist/components/Button.js +13 -8
- package/dist/components/DescriptionList.d.ts +11 -0
- package/dist/components/DiscardPrompt.d.ts +54 -0
- package/dist/components/DiscardPrompt.js +245 -0
- package/dist/components/Drawer.d.ts +19 -3
- package/dist/components/Drawer.js +60 -21
- package/dist/components/EditorialHome.d.ts +1 -1
- package/dist/components/Field.d.ts +7 -1
- package/dist/components/Field.js +5 -4
- package/dist/components/Input.d.ts +5 -0
- package/dist/components/Input.js +2 -1
- package/dist/components/Kbd.d.ts +20 -1
- package/dist/components/Kbd.js +30 -7
- package/dist/components/Menu.d.ts +11 -4
- package/dist/components/Menu.js +17 -3
- package/dist/components/MetricInput.d.ts +8 -1
- package/dist/components/MetricInput.js +11 -3
- package/dist/components/Modal.d.ts +15 -1
- package/dist/components/Modal.js +58 -13
- package/dist/components/SearchBar.d.ts +67 -0
- package/dist/components/SearchBar.js +117 -0
- package/dist/components/Select.js +5 -4
- package/dist/components/ShortcutHint.d.ts +29 -0
- package/dist/components/ShortcutHint.js +149 -0
- package/dist/components/Tooltip.d.ts +10 -1
- package/dist/components/Tooltip.js +15 -4
- package/dist/emoji.cjs +108 -31
- package/dist/hooks/useAnchoredPosition.d.ts +13 -1
- package/dist/hooks/useAnchoredPosition.js +19 -11
- package/dist/hooks/useDialog.d.ts +6 -1
- package/dist/hooks/useDialog.js +10 -1
- package/dist/index.cjs +3184 -2521
- package/dist/index.d.cts +221 -39
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -1
- package/dist/labels-context.d.ts +8 -0
- package/dist/rich-text.cjs +17 -10
- package/package.json +1 -1
package/dist/rich-text.cjs
CHANGED
|
@@ -1373,11 +1373,16 @@ function translationOf(el) {
|
|
|
1373
1373
|
if (!t || t === "none" || typeof DOMMatrixReadOnly === "undefined") return { x: 0, y: 0 };
|
|
1374
1374
|
try {
|
|
1375
1375
|
const m = new DOMMatrixReadOnly(t);
|
|
1376
|
-
|
|
1376
|
+
const z = zoomOf(el);
|
|
1377
|
+
return { x: m.m41 * z, y: m.m42 * z };
|
|
1377
1378
|
} catch {
|
|
1378
1379
|
return { x: 0, y: 0 };
|
|
1379
1380
|
}
|
|
1380
1381
|
}
|
|
1382
|
+
function zoomOf(el) {
|
|
1383
|
+
const z = el.currentCSSZoom;
|
|
1384
|
+
return typeof z === "number" && Number.isFinite(z) && z > 0 ? z : 1;
|
|
1385
|
+
}
|
|
1381
1386
|
var signed = (n) => `${n < 0 ? "-" : "+"} ${Math.round(Math.abs(n) * 100) / 100}px`;
|
|
1382
1387
|
var prepared = /* @__PURE__ */ new WeakSet();
|
|
1383
1388
|
function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-start", offset = 6, padding = 8, shiftMainAxis = true, capHeight = false, onAnchorHidden }) {
|
|
@@ -1402,8 +1407,9 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
1402
1407
|
const s = floating.style;
|
|
1403
1408
|
if (keepPlace && current.anchor.isConnected) {
|
|
1404
1409
|
const a = current.anchor.getBoundingClientRect();
|
|
1405
|
-
|
|
1406
|
-
s.
|
|
1410
|
+
const z = zoomOf(floating);
|
|
1411
|
+
s.top = `${Math.round(((current.yEdge === "bottom" ? a.bottom : a.top) + current.dy) / z)}px`;
|
|
1412
|
+
s.left = `${Math.round(((current.xEdge === "right" ? a.right : a.left) + current.dx) / z)}px`;
|
|
1407
1413
|
}
|
|
1408
1414
|
s.removeProperty("position-anchor");
|
|
1409
1415
|
}
|
|
@@ -1431,6 +1437,7 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
1431
1437
|
written.current = "";
|
|
1432
1438
|
}
|
|
1433
1439
|
const { placement: p, offset: o, padding: pad, shiftMainAxis: keepInView, capHeight: cap } = opts.current;
|
|
1440
|
+
const zoom = floating.getClientRects().length > 0 ? zoomOf(floating) : zoomOf(anchorEl);
|
|
1434
1441
|
if (cap) {
|
|
1435
1442
|
if (!heightCap.current) {
|
|
1436
1443
|
const own = getComputedStyle(floating);
|
|
@@ -1444,7 +1451,7 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
1444
1451
|
};
|
|
1445
1452
|
if (setOverflow) s.overflowY = "auto";
|
|
1446
1453
|
}
|
|
1447
|
-
const room = `${Math.max(0, window.innerHeight - 2 * pad)}px`;
|
|
1454
|
+
const room = `${Math.max(0, (window.innerHeight - 2 * pad * zoom) / zoom)}px`;
|
|
1448
1455
|
const max = heightCap.current.ownMaxHeight ? `min(${room}, ${heightCap.current.ownMaxHeight})` : room;
|
|
1449
1456
|
if (max !== heightCap.current.written) {
|
|
1450
1457
|
s.maxHeight = max;
|
|
@@ -1454,19 +1461,19 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
1454
1461
|
uncap();
|
|
1455
1462
|
}
|
|
1456
1463
|
const a = anchorEl.getBoundingClientRect();
|
|
1457
|
-
const size = { width: floating.offsetWidth, height: floating.offsetHeight };
|
|
1464
|
+
const size = { width: floating.offsetWidth * zoom, height: floating.offsetHeight * zoom };
|
|
1458
1465
|
const pos = computePosition(
|
|
1459
1466
|
{ x: a.x, y: a.y, width: a.width, height: a.height },
|
|
1460
1467
|
size,
|
|
1461
1468
|
{ width: window.innerWidth, height: window.innerHeight },
|
|
1462
|
-
{ placement: p, offset: o, padding: pad, shiftMainAxis: keepInView, stickySide: side.current ?? void 0 }
|
|
1469
|
+
{ placement: p, offset: o * zoom, padding: pad * zoom, shiftMainAxis: keepInView, stickySide: side.current ?? void 0 }
|
|
1463
1470
|
);
|
|
1464
1471
|
const measured = size.width > 0 || size.height > 0;
|
|
1465
1472
|
if (measured && session.current) side.current = pos.side;
|
|
1466
1473
|
if (floating.dataset.placement !== pos.placement) floating.dataset.placement = pos.placement;
|
|
1467
1474
|
const writeFixed = (at) => {
|
|
1468
|
-
const left2 = `${Math.round(at.x)}px`;
|
|
1469
|
-
const top2 = `${Math.round(at.y)}px`;
|
|
1475
|
+
const left2 = `${Math.round(at.x / zoom)}px`;
|
|
1476
|
+
const top2 = `${Math.round(at.y / zoom)}px`;
|
|
1470
1477
|
const key2 = `fixed ${left2} ${top2}`;
|
|
1471
1478
|
if (key2 === written.current) return;
|
|
1472
1479
|
s.left = left2;
|
|
@@ -1493,8 +1500,8 @@ function useAnchoredPosition(anchor, floatingRef, { open, placement = "bottom-st
|
|
|
1493
1500
|
current.xEdge = pos.side === "right" ? "right" : "left";
|
|
1494
1501
|
current.dy = pos.y - (current.yEdge === "bottom" ? a.bottom : a.top);
|
|
1495
1502
|
current.dx = pos.x - (current.xEdge === "right" ? a.right : a.left);
|
|
1496
|
-
const top = `round(anchor(${current.yEdge}) ${signed(current.dy)}, 1px)`;
|
|
1497
|
-
const left = `round(anchor(${current.xEdge}) ${signed(current.dx)}, 1px)`;
|
|
1503
|
+
const top = `round(anchor(${current.yEdge}) ${signed(current.dy / zoom)}, 1px)`;
|
|
1504
|
+
const left = `round(anchor(${current.xEdge}) ${signed(current.dx / zoom)}, 1px)`;
|
|
1498
1505
|
const key = `anchored ${top} ${left}`;
|
|
1499
1506
|
if (key !== written.current) {
|
|
1500
1507
|
s.top = top;
|