@proveanything/smartlinks-utils-ui 0.12.15 → 0.12.16
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.
|
@@ -1908,8 +1908,10 @@ interface Props$9 {
|
|
|
1908
1908
|
children: ReactNode;
|
|
1909
1909
|
/** Which edge of the anchor the pill should hug. Defaults to `right`. */
|
|
1910
1910
|
side?: 'left' | 'right';
|
|
1911
|
+
/** Which vertical position of the anchor the pill should hug. Defaults to `center`. */
|
|
1912
|
+
vAlign?: 'top' | 'center' | 'bottom';
|
|
1911
1913
|
}
|
|
1912
|
-
declare function PreviewReopenPill({ anchorRef, onClick, ariaLabel, title, children, side, }: Props$9): React$1.ReactPortal | null;
|
|
1914
|
+
declare function PreviewReopenPill({ anchorRef, onClick, ariaLabel, title, children, side, vAlign, }: Props$9): React$1.ReactPortal | null;
|
|
1913
1915
|
|
|
1914
1916
|
declare const ScopeBreadcrumb: ({ scope }: {
|
|
1915
1917
|
scope: ParsedRef;
|
|
@@ -8831,15 +8831,18 @@ function PreviewReopenPill({
|
|
|
8831
8831
|
ariaLabel,
|
|
8832
8832
|
title,
|
|
8833
8833
|
children,
|
|
8834
|
-
side = "right"
|
|
8834
|
+
side = "right",
|
|
8835
|
+
vAlign = "center"
|
|
8835
8836
|
}) {
|
|
8836
8837
|
const [pos, setPos] = useState(null);
|
|
8837
8838
|
const rafRef = useRef(null);
|
|
8838
8839
|
useLayoutEffect(() => {
|
|
8839
8840
|
const el = anchorRef.current;
|
|
8840
8841
|
if (typeof window === "undefined") return;
|
|
8842
|
+
const TOP_INSET = 14;
|
|
8843
|
+
const fallbackTop = () => vAlign === "top" ? TOP_INSET : vAlign === "bottom" ? Math.max(0, window.innerHeight - TOP_INSET) : window.innerHeight / 2;
|
|
8841
8844
|
if (!el) {
|
|
8842
|
-
setPos({ top:
|
|
8845
|
+
setPos({ top: fallbackTop(), right: 8, left: 8 });
|
|
8843
8846
|
return;
|
|
8844
8847
|
}
|
|
8845
8848
|
const measure = () => {
|
|
@@ -8847,11 +8850,11 @@ function PreviewReopenPill({
|
|
|
8847
8850
|
rafRef.current = requestAnimationFrame(() => {
|
|
8848
8851
|
const rect = el.getBoundingClientRect();
|
|
8849
8852
|
if (rect.width === 0 && rect.height === 0) {
|
|
8850
|
-
setPos({ top: window.innerHeight / 2, right: 8, left: 8 });
|
|
8851
8853
|
return;
|
|
8852
8854
|
}
|
|
8855
|
+
const top = vAlign === "top" ? rect.top + TOP_INSET : vAlign === "bottom" ? rect.bottom - TOP_INSET : rect.top + rect.height / 2;
|
|
8853
8856
|
setPos({
|
|
8854
|
-
top
|
|
8857
|
+
top,
|
|
8855
8858
|
right: Math.max(0, window.innerWidth - rect.right),
|
|
8856
8859
|
left: Math.max(0, rect.left)
|
|
8857
8860
|
});
|
|
@@ -8869,13 +8872,14 @@ function PreviewReopenPill({
|
|
|
8869
8872
|
window.removeEventListener("scroll", measure, true);
|
|
8870
8873
|
if (rafRef.current != null) cancelAnimationFrame(rafRef.current);
|
|
8871
8874
|
};
|
|
8872
|
-
}, [anchorRef]);
|
|
8875
|
+
}, [anchorRef, vAlign]);
|
|
8873
8876
|
if (typeof document === "undefined") return null;
|
|
8874
8877
|
const effectivePos = pos ?? {
|
|
8875
|
-
top: typeof window !== "undefined" ? window.innerHeight / 2 : 200,
|
|
8878
|
+
top: typeof window !== "undefined" ? vAlign === "top" ? 14 : vAlign === "bottom" ? window.innerHeight - 14 : window.innerHeight / 2 : 200,
|
|
8876
8879
|
right: 8,
|
|
8877
8880
|
left: 8
|
|
8878
8881
|
};
|
|
8882
|
+
const translateY = vAlign === "center" ? "-50%" : "0";
|
|
8879
8883
|
return createPortal(
|
|
8880
8884
|
/* @__PURE__ */ jsx(
|
|
8881
8885
|
"button",
|
|
@@ -8891,7 +8895,7 @@ function PreviewReopenPill({
|
|
|
8891
8895
|
...side === "right" ? { right: effectivePos.right } : { left: effectivePos.left },
|
|
8892
8896
|
// Pull half the pill width out into the gutter so it visually
|
|
8893
8897
|
// anchors *to* the editor edge rather than sitting inside it.
|
|
8894
|
-
transform: side === "right" ?
|
|
8898
|
+
transform: side === "right" ? `translate(50%, ${translateY})` : `translate(-50%, ${translateY})`
|
|
8895
8899
|
},
|
|
8896
8900
|
children
|
|
8897
8901
|
}
|
|
@@ -11415,6 +11419,7 @@ function RecordsAdminShellInner(props) {
|
|
|
11415
11419
|
{
|
|
11416
11420
|
anchorRef: railReopenAnchorRef,
|
|
11417
11421
|
side: "left",
|
|
11422
|
+
vAlign: "top",
|
|
11418
11423
|
onClick: () => setRailOpen(true),
|
|
11419
11424
|
ariaLabel: i18n.openList,
|
|
11420
11425
|
title: i18n.openList,
|