@sheetxl/utils-react 0.7.28-beta.4 → 0.8.0-beta.1
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/browser/cjs/index.cjs +3 -3
- package/browser/esm/{51Pip02D-3A0Z061.mjs → BIb3Fag4wDs4Gro1.mjs} +2 -2
- package/browser/esm/{BHhuMHMaojWvosqS.mjs → BT6JG-bEtM8ou0Xr.mjs} +2 -2
- package/browser/esm/{CmVNzL-ngYHToTGc.mjs → CKvLZo8keTi4hdRr.mjs} +1 -1
- package/browser/esm/index.mjs +109 -104
- package/node/esm/{DE0Lw6aGWWnFHy-j.mjs → CdJ0O_khlsS4DqVj.mjs} +1 -1
- package/node/esm/{CAC_eUuPPsAz7M27.mjs → TlOKuBGsozMYzzBC.mjs} +1 -1
- package/node/esm/index.mjs +44 -39
- package/package.json +2 -2
- package/types/src/float/FloatPopper.d.ts +4 -0
package/node/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.
|
|
2
|
+
* @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.8.0-beta.1
|
|
3
3
|
*
|
|
4
4
|
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
5
|
* License: The license can be found at https://www.sheetxl.com/license.
|
|
@@ -2537,7 +2537,10 @@ var Mo = g(null), Eo = () => {
|
|
|
2537
2537
|
get contextElement() {
|
|
2538
2538
|
if (a) return;
|
|
2539
2539
|
const t = e();
|
|
2540
|
-
|
|
2540
|
+
if (!t) return;
|
|
2541
|
+
if (1 === t.nodeType) return t;
|
|
2542
|
+
const n = t.contextElement;
|
|
2543
|
+
return n && 1 === n.nodeType ? n : void 0;
|
|
2541
2544
|
}
|
|
2542
2545
|
};
|
|
2543
2546
|
}, [a, l]), { refs: oe, floatingStyles: re, isPositioned: ie, placement: se, update: le } = U({
|
|
@@ -2718,8 +2721,8 @@ var Oo = (e) => z(Ho, { ...e }), Fo = (e) => {
|
|
|
2718
2721
|
const t = E.floatByParents.get(e);
|
|
2719
2722
|
let n = null;
|
|
2720
2723
|
return t && (n = E.statesByMovables.get(t)?.close(0) ?? null), n;
|
|
2721
|
-
}, B = () => $(
|
|
2722
|
-
if (!_) return
|
|
2724
|
+
}, B = () => $(G.key), [H, I] = D(), N = () => {
|
|
2725
|
+
if (!_) return V(), null;
|
|
2723
2726
|
const e = new Promise((e, t) => {
|
|
2724
2727
|
I((n) => ({
|
|
2725
2728
|
resolve: e,
|
|
@@ -2739,18 +2742,20 @@ var Oo = (e) => z(Ho, { ...e }), Fo = (e) => {
|
|
|
2739
2742
|
let e = M;
|
|
2740
2743
|
for (; e.parent;) e = e.parent;
|
|
2741
2744
|
return $(e.key);
|
|
2742
|
-
}, []), F = () => {
|
|
2743
|
-
if (_) return void
|
|
2745
|
+
}, []), F = L(null), W = () => {
|
|
2746
|
+
if (_) return void V();
|
|
2744
2747
|
M && E.statesByMovables.get(M.key)?.open(0);
|
|
2745
2748
|
const e = E.floatByParents.get(M.key);
|
|
2746
|
-
e && e !== A && E.statesByMovables.get(e)?.close(0)
|
|
2747
|
-
|
|
2749
|
+
e && e !== A && E.statesByMovables.get(e)?.close(0);
|
|
2750
|
+
const t = document.activeElement;
|
|
2751
|
+
t && t !== document.body && "function" == typeof t.focus && (F.current = t), requestAnimationFrame(() => {
|
|
2752
|
+
E.floatByParents.set(M.key, G.key), v(!0);
|
|
2748
2753
|
});
|
|
2749
|
-
}, [
|
|
2750
|
-
closeFloat:
|
|
2751
|
-
closeFloatAll:
|
|
2754
|
+
}, [K, V] = T((e) => e + 1, 0), j = w((e) => null === m ? null : m({
|
|
2755
|
+
closeFloat: X,
|
|
2756
|
+
closeFloatAll: Z,
|
|
2752
2757
|
...e
|
|
2753
|
-
}), [m]),
|
|
2758
|
+
}), [m]), U = null === m, Y = qt((e = 120) => E.debounce(e, W, /* @__PURE__ */ new Set([G]), !1)(), [W]), X = qt((e = 60) => E.debounce(e, N, E.descendants(G), !0)(), [N]), q = qt((e = 360) => E.debounce(e, B, E.descendants(E.getChildRef(G)), !0)(), [B]), Z = qt(O, [O]), G = k(() => ({
|
|
2754
2759
|
key: A,
|
|
2755
2760
|
isRoot: !1,
|
|
2756
2761
|
label: r,
|
|
@@ -2761,32 +2766,32 @@ var Oo = (e) => z(Ho, { ...e }), Fo = (e) => {
|
|
|
2761
2766
|
onChildHidden: () => {
|
|
2762
2767
|
C(!1);
|
|
2763
2768
|
},
|
|
2764
|
-
open:
|
|
2765
|
-
close:
|
|
2766
|
-
closeChild:
|
|
2767
|
-
closeAll:
|
|
2769
|
+
open: Y,
|
|
2770
|
+
close: X,
|
|
2771
|
+
closeChild: q,
|
|
2772
|
+
closeAll: Z,
|
|
2768
2773
|
getRoot: () => E,
|
|
2769
2774
|
floatElement: () => P.current,
|
|
2770
2775
|
anchorElement: () => R.current
|
|
2771
2776
|
}), []);
|
|
2772
2777
|
S(() => {
|
|
2773
|
-
E.statesByMovables.set(A,
|
|
2774
|
-
}, [
|
|
2775
|
-
E.statesByMovables.delete(A),
|
|
2778
|
+
E.statesByMovables.set(A, G);
|
|
2779
|
+
}, [G]), S(() => () => {
|
|
2780
|
+
E.statesByMovables.delete(A), X(0);
|
|
2776
2781
|
}, []), S(() => {
|
|
2777
|
-
_ && !
|
|
2778
|
-
}, [_,
|
|
2779
|
-
const
|
|
2780
|
-
e.which === J.Escape && (e.preventDefault(), e.stopPropagation(),
|
|
2781
|
-
}, []),
|
|
2782
|
-
const e =
|
|
2782
|
+
_ && !U && (b(!0), M.onChildVisible());
|
|
2783
|
+
}, [_, U]);
|
|
2784
|
+
const Q = w((e) => {
|
|
2785
|
+
e.which === J.Escape && (e.preventDefault(), e.stopPropagation(), X(0));
|
|
2786
|
+
}, []), ee = w(() => {
|
|
2787
|
+
const e = F.current, t = P.current;
|
|
2783
2788
|
e && t && (requestAnimationFrame(() => {
|
|
2784
2789
|
(t.contains(document.activeElement) || document.activeElement === document.body) && e.focus();
|
|
2785
|
-
}),
|
|
2790
|
+
}), F.current = null), d?.();
|
|
2786
2791
|
}, []), te = w((e) => {
|
|
2787
2792
|
P.current = e;
|
|
2788
|
-
if (e.addEventListener("
|
|
2789
|
-
|
|
2793
|
+
if (e.addEventListener("focusin", (e) => {
|
|
2794
|
+
F.current || (F.current = e.relatedTarget);
|
|
2790
2795
|
}, {
|
|
2791
2796
|
once: !0,
|
|
2792
2797
|
passive: !0
|
|
@@ -2797,11 +2802,11 @@ var Oo = (e) => z(Ho, { ...e }), Fo = (e) => {
|
|
|
2797
2802
|
});
|
|
2798
2803
|
}, [n]), [ne, oe] = D();
|
|
2799
2804
|
S(() => {
|
|
2800
|
-
|
|
2801
|
-
value:
|
|
2805
|
+
U && (_ ? u?.() : !1 === _ && d?.()), oe(y ? z(Ct, {
|
|
2806
|
+
value: G,
|
|
2802
2807
|
children: p({
|
|
2803
2808
|
...f?.propsFloatPanel,
|
|
2804
|
-
floatReference:
|
|
2809
|
+
floatReference: G,
|
|
2805
2810
|
open: !0 === _,
|
|
2806
2811
|
label: r,
|
|
2807
2812
|
anchorEl: t,
|
|
@@ -2814,25 +2819,25 @@ var Oo = (e) => z(Ho, { ...e }), Fo = (e) => {
|
|
|
2814
2819
|
},
|
|
2815
2820
|
onMount: te,
|
|
2816
2821
|
propsPopper: {
|
|
2817
|
-
onKeyDown:
|
|
2822
|
+
onKeyDown: Q,
|
|
2818
2823
|
onMouseEnter: (e) => {
|
|
2819
|
-
_ && E.lastDebounced?.isClose && E.lastDebounced.setReferences.has(
|
|
2824
|
+
_ && E.lastDebounced?.isClose && E.lastDebounced.setReferences.has(G) && (E.lastDebounced.fn.clear(), E.lastDebounced = null, G.closeChild());
|
|
2820
2825
|
},
|
|
2821
2826
|
...a
|
|
2822
2827
|
},
|
|
2823
|
-
createPopupPanel:
|
|
2828
|
+
createPopupPanel: j
|
|
2824
2829
|
})
|
|
2825
2830
|
}) : null);
|
|
2826
2831
|
}, [
|
|
2827
2832
|
y,
|
|
2828
2833
|
_,
|
|
2829
2834
|
r,
|
|
2830
|
-
|
|
2835
|
+
U,
|
|
2831
2836
|
a,
|
|
2832
|
-
|
|
2837
|
+
j,
|
|
2833
2838
|
p,
|
|
2834
2839
|
f?.propsFloatPanel,
|
|
2835
|
-
|
|
2840
|
+
K
|
|
2836
2841
|
]);
|
|
2837
2842
|
const re = qt((e) => {
|
|
2838
2843
|
if (0 === E.floatByParents.size) return;
|
|
@@ -2856,7 +2861,7 @@ var Oo = (e) => z(Ho, { ...e }), Fo = (e) => {
|
|
|
2856
2861
|
o
|
|
2857
2862
|
]), {
|
|
2858
2863
|
component: ne,
|
|
2859
|
-
reference:
|
|
2864
|
+
reference: G,
|
|
2860
2865
|
isOpen: !0 === _
|
|
2861
2866
|
};
|
|
2862
2867
|
}, Ko = {}, Vo = (e) => {
|
|
@@ -3355,7 +3360,7 @@ function tr() {
|
|
|
3355
3360
|
}
|
|
3356
3361
|
qo.displayName = "SplitPane";
|
|
3357
3362
|
var nr = tr();
|
|
3358
|
-
nr.register("base", () => import("./
|
|
3363
|
+
nr.register("base", () => import("./CdJ0O_khlsS4DqVj.mjs")), nr.register("cf", () => import("./TlOKuBGsozMYzzBC.mjs"));
|
|
3359
3364
|
var or = (e) => z("svg", {
|
|
3360
3365
|
...e,
|
|
3361
3366
|
children: z("path", {})
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/utils-react",
|
|
3
3
|
"description": "Utils React - Utilities for React capabilities needed for all SheetXL components.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0-beta.1",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@floating-ui/react-dom": "^2.1.9",
|
|
44
|
-
"@sheetxl/utils": "^0.
|
|
44
|
+
"@sheetxl/utils": "^0.8.0-beta.1",
|
|
45
45
|
"clsx": "^2.1.1",
|
|
46
46
|
"detect-it": "^4.0.1",
|
|
47
47
|
"prop-types": "^15.8.1",
|
|
@@ -62,6 +62,10 @@ export interface FloatPopperProps extends Omit<React.HTMLAttributes<HTMLDivEleme
|
|
|
62
62
|
* scroll/resize event to observe — e.g. a caret-following formula hint whose rect changes as the caret
|
|
63
63
|
* moves by click or arrow. Off by default: the per-frame poll has a cost, so only anchors that track a
|
|
64
64
|
* moving point should enable it (a normal element/point anchor repositions fine on scroll/resize alone).
|
|
65
|
+
*
|
|
66
|
+
* A virtual anchor that exposes its own `contextElement` (the element it moves WITH — a grid range
|
|
67
|
+
* anchor names its pane) does not need this: that element's scroll / resize / layout-shift triggers
|
|
68
|
+
* are observed normally.
|
|
65
69
|
* @defaultValue false
|
|
66
70
|
*/
|
|
67
71
|
followAnchor?: boolean;
|