@phillips/seldon 1.32.0 → 1.33.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/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +39 -34
- package/dist/components/Drawer/Drawer.d.ts +23 -0
- package/dist/components/Drawer/Drawer.js +46 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +34 -32
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +6 -6
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +8 -8
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +3 -3
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +67 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +260 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +128 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +137 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +35 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +62 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll/node_modules/tslib/tslib.es6.js +27 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
- package/dist/node_modules/use-sidecar/node_modules/tslib/tslib.es6.js +21 -0
- package/dist/scss/_vars.scss +2 -0
- package/dist/scss/components/Drawer/_drawer.scss +66 -0
- package/dist/scss/components/Subscribe/_subscribe.scss +1 -0
- package/dist/scss/styles.scss +1 -0
- package/package.json +7 -6
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-context/dist/index.js +0 -52
- package/dist/node_modules/@radix-ui/react-accordion/node_modules/@radix-ui/react-primitive/dist/index.js +0 -31
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/primitive/dist/index.js +0 -9
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -14
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-context/dist/index.js +0 -52
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-id/dist/index.js +0 -13
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-primitive/dist/index.js +0 -31
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-slot/dist/index.js +0 -48
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -13
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -32
- package/dist/node_modules/@radix-ui/react-collapsible/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -6
- package/dist/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -14
- package/dist/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-context/dist/index.js +0 -52
- package/dist/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.js +0 -48
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/primitive → primitive}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/react-compose-refs → react-compose-refs}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/react-id → react-id}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-collapsible/node_modules/@radix-ui/react-presence → react-presence}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/react-slot → react-slot}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/react-use-callback-ref → react-use-callback-ref}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/react-use-controllable-state → react-use-controllable-state}/dist/index.js +0 -0
- /package/dist/node_modules/@radix-ui/{react-accordion/node_modules/@radix-ui/react-use-layout-effect → react-use-layout-effect}/dist/index.js +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { composeEventHandlers as m } from "../../primitive/dist/index.js";
|
|
3
|
+
import { Primitive as R, dispatchDiscreteCustomEvent as U } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useComposedRefs as w } from "../../react-compose-refs/dist/index.js";
|
|
5
|
+
import { useCallbackRef as T } from "../../react-use-callback-ref/dist/index.js";
|
|
6
|
+
import { useEscapeKeydown as z } from "../../react-use-escape-keydown/dist/index.js";
|
|
7
|
+
import { jsx as B } from "react/jsx-runtime";
|
|
8
|
+
var H = "DismissableLayer", y = "dismissableLayer.update", M = "dismissableLayer.pointerDownOutside", j = "dismissableLayer.focusOutside", O, x = n.createContext({
|
|
9
|
+
layers: /* @__PURE__ */ new Set(),
|
|
10
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
11
|
+
branches: /* @__PURE__ */ new Set()
|
|
12
|
+
}), X = n.forwardRef(
|
|
13
|
+
(r, e) => {
|
|
14
|
+
var C;
|
|
15
|
+
const {
|
|
16
|
+
disableOutsidePointerEvents: i = !1,
|
|
17
|
+
onEscapeKeyDown: o,
|
|
18
|
+
onPointerDownOutside: t,
|
|
19
|
+
onFocusOutside: a,
|
|
20
|
+
onInteractOutside: l,
|
|
21
|
+
onDismiss: d,
|
|
22
|
+
...v
|
|
23
|
+
} = r, c = n.useContext(x), [u, F] = n.useState(null), f = (C = u == null ? void 0 : u.ownerDocument) != null ? C : globalThis == null ? void 0 : globalThis.document, [, W] = n.useState({}), A = w(e, (s) => F(s)), p = Array.from(c.layers), [N] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), I = p.indexOf(N), b = u ? p.indexOf(u) : -1, _ = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= I, k = G((s) => {
|
|
24
|
+
const E = s.target, L = [...c.branches].some((h) => h.contains(E));
|
|
25
|
+
!P || L || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
26
|
+
}, f), D = J((s) => {
|
|
27
|
+
const E = s.target;
|
|
28
|
+
[...c.branches].some((h) => h.contains(E)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
29
|
+
}, f);
|
|
30
|
+
return z((s) => {
|
|
31
|
+
b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
|
|
32
|
+
}, f), n.useEffect(() => {
|
|
33
|
+
if (u)
|
|
34
|
+
return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (O = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), g(), () => {
|
|
35
|
+
i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = O);
|
|
36
|
+
};
|
|
37
|
+
}, [u, f, i, c]), n.useEffect(() => () => {
|
|
38
|
+
u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), g());
|
|
39
|
+
}, [u, c]), n.useEffect(() => {
|
|
40
|
+
const s = () => W({});
|
|
41
|
+
return document.addEventListener(y, s), () => document.removeEventListener(y, s);
|
|
42
|
+
}, []), /* @__PURE__ */ B(
|
|
43
|
+
R.div,
|
|
44
|
+
{
|
|
45
|
+
...v,
|
|
46
|
+
ref: A,
|
|
47
|
+
style: {
|
|
48
|
+
pointerEvents: _ ? P ? "auto" : "none" : void 0,
|
|
49
|
+
...r.style
|
|
50
|
+
},
|
|
51
|
+
onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
|
|
52
|
+
onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
|
|
53
|
+
onPointerDownCapture: m(
|
|
54
|
+
r.onPointerDownCapture,
|
|
55
|
+
k.onPointerDownCapture
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
X.displayName = H;
|
|
62
|
+
var Y = "DismissableLayerBranch", q = n.forwardRef((r, e) => {
|
|
63
|
+
const i = n.useContext(x), o = n.useRef(null), t = w(e, o);
|
|
64
|
+
return n.useEffect(() => {
|
|
65
|
+
const a = o.current;
|
|
66
|
+
if (a)
|
|
67
|
+
return i.branches.add(a), () => {
|
|
68
|
+
i.branches.delete(a);
|
|
69
|
+
};
|
|
70
|
+
}, [i.branches]), /* @__PURE__ */ B(R.div, { ...r, ref: t });
|
|
71
|
+
});
|
|
72
|
+
q.displayName = Y;
|
|
73
|
+
function G(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
74
|
+
const i = T(r), o = n.useRef(!1), t = n.useRef(() => {
|
|
75
|
+
});
|
|
76
|
+
return n.useEffect(() => {
|
|
77
|
+
const a = (d) => {
|
|
78
|
+
if (d.target && !o.current) {
|
|
79
|
+
let v = function() {
|
|
80
|
+
S(
|
|
81
|
+
M,
|
|
82
|
+
i,
|
|
83
|
+
c,
|
|
84
|
+
{ discrete: !0 }
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
const c = { originalEvent: d };
|
|
88
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
|
|
89
|
+
} else
|
|
90
|
+
e.removeEventListener("click", t.current);
|
|
91
|
+
o.current = !1;
|
|
92
|
+
}, l = window.setTimeout(() => {
|
|
93
|
+
e.addEventListener("pointerdown", a);
|
|
94
|
+
}, 0);
|
|
95
|
+
return () => {
|
|
96
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
|
|
97
|
+
};
|
|
98
|
+
}, [e, i]), {
|
|
99
|
+
// ensures we check React component tree (not just DOM tree)
|
|
100
|
+
onPointerDownCapture: () => o.current = !0
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function J(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
104
|
+
const i = T(r), o = n.useRef(!1);
|
|
105
|
+
return n.useEffect(() => {
|
|
106
|
+
const t = (a) => {
|
|
107
|
+
a.target && !o.current && S(j, i, { originalEvent: a }, {
|
|
108
|
+
discrete: !1
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
|
|
112
|
+
}, [e, i]), {
|
|
113
|
+
onFocusCapture: () => o.current = !0,
|
|
114
|
+
onBlurCapture: () => o.current = !1
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function g() {
|
|
118
|
+
const r = new CustomEvent(y);
|
|
119
|
+
document.dispatchEvent(r);
|
|
120
|
+
}
|
|
121
|
+
function S(r, e, i, { discrete: o }) {
|
|
122
|
+
const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
|
|
123
|
+
e && t.addEventListener(r, e, { once: !0 }), o ? U(t, a) : t.dispatchEvent(a);
|
|
124
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
X as DismissableLayer,
|
|
127
|
+
q as DismissableLayerBranch
|
|
128
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
var t = 0;
|
|
3
|
+
function c() {
|
|
4
|
+
u.useEffect(() => {
|
|
5
|
+
var n, o;
|
|
6
|
+
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
7
|
+
return document.body.insertAdjacentElement("afterbegin", (n = e[0]) != null ? n : r()), document.body.insertAdjacentElement("beforeend", (o = e[1]) != null ? o : r()), t++, () => {
|
|
8
|
+
t === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((a) => a.remove()), t--;
|
|
9
|
+
};
|
|
10
|
+
}, []);
|
|
11
|
+
}
|
|
12
|
+
function r() {
|
|
13
|
+
const e = document.createElement("span");
|
|
14
|
+
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
c as useFocusGuards
|
|
18
|
+
};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { useComposedRefs as R } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { Primitive as M } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useCallbackRef as N } from "../../react-use-callback-ref/dist/index.js";
|
|
5
|
+
import { jsx as _ } from "react/jsx-runtime";
|
|
6
|
+
var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", y = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, n) => {
|
|
7
|
+
const {
|
|
8
|
+
loop: t = !1,
|
|
9
|
+
trapped: u = !1,
|
|
10
|
+
onMountAutoFocus: p,
|
|
11
|
+
onUnmountAutoFocus: L,
|
|
12
|
+
...g
|
|
13
|
+
} = e, [s, U] = d.useState(null), E = N(p), v = N(L), b = d.useRef(null), A = R(n, (o) => U(o)), a = d.useRef({
|
|
14
|
+
paused: !1,
|
|
15
|
+
pause() {
|
|
16
|
+
this.paused = !0;
|
|
17
|
+
},
|
|
18
|
+
resume() {
|
|
19
|
+
this.paused = !1;
|
|
20
|
+
}
|
|
21
|
+
}).current;
|
|
22
|
+
d.useEffect(() => {
|
|
23
|
+
if (u) {
|
|
24
|
+
let o = function(i) {
|
|
25
|
+
if (a.paused || !s) return;
|
|
26
|
+
const c = i.target;
|
|
27
|
+
s.contains(c) ? b.current = c : f(b.current, { select: !0 });
|
|
28
|
+
}, l = function(i) {
|
|
29
|
+
if (a.paused || !s) return;
|
|
30
|
+
const c = i.relatedTarget;
|
|
31
|
+
c !== null && (s.contains(c) || f(b.current, { select: !0 }));
|
|
32
|
+
}, r = function(i) {
|
|
33
|
+
if (document.activeElement === document.body)
|
|
34
|
+
for (const h of i)
|
|
35
|
+
h.removedNodes.length > 0 && f(s);
|
|
36
|
+
};
|
|
37
|
+
document.addEventListener("focusin", o), document.addEventListener("focusout", l);
|
|
38
|
+
const m = new MutationObserver(r);
|
|
39
|
+
return s && m.observe(s, { childList: !0, subtree: !0 }), () => {
|
|
40
|
+
document.removeEventListener("focusin", o), document.removeEventListener("focusout", l), m.disconnect();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}, [u, s, a.paused]), d.useEffect(() => {
|
|
44
|
+
if (s) {
|
|
45
|
+
S.add(a);
|
|
46
|
+
const o = document.activeElement;
|
|
47
|
+
if (!s.contains(o)) {
|
|
48
|
+
const r = new CustomEvent(F, y);
|
|
49
|
+
s.addEventListener(F, E), s.dispatchEvent(r), r.defaultPrevented || (w(W(I(s)), { select: !0 }), document.activeElement === o && f(s));
|
|
50
|
+
}
|
|
51
|
+
return () => {
|
|
52
|
+
s.removeEventListener(F, E), setTimeout(() => {
|
|
53
|
+
const r = new CustomEvent(T, y);
|
|
54
|
+
s.addEventListener(T, v), s.dispatchEvent(r), r.defaultPrevented || f(o != null ? o : document.body, { select: !0 }), s.removeEventListener(T, v), S.remove(a);
|
|
55
|
+
}, 0);
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}, [s, E, v, a]);
|
|
59
|
+
const P = d.useCallback(
|
|
60
|
+
(o) => {
|
|
61
|
+
if (!t && !u || a.paused) return;
|
|
62
|
+
const l = o.key === "Tab" && !o.altKey && !o.ctrlKey && !o.metaKey, r = document.activeElement;
|
|
63
|
+
if (l && r) {
|
|
64
|
+
const m = o.currentTarget, [i, c] = x(m);
|
|
65
|
+
i && c ? !o.shiftKey && r === c ? (o.preventDefault(), t && f(i, { select: !0 })) : o.shiftKey && r === i && (o.preventDefault(), t && f(c, { select: !0 })) : r === m && o.preventDefault();
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[t, u, a.paused]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ _(M.div, { tabIndex: -1, ...g, ref: A, onKeyDown: P });
|
|
71
|
+
});
|
|
72
|
+
k.displayName = K;
|
|
73
|
+
function w(e, { select: n = !1 } = {}) {
|
|
74
|
+
const t = document.activeElement;
|
|
75
|
+
for (const u of e)
|
|
76
|
+
if (f(u, { select: n }), document.activeElement !== t) return;
|
|
77
|
+
}
|
|
78
|
+
function x(e) {
|
|
79
|
+
const n = I(e), t = O(n, e), u = O(n.reverse(), e);
|
|
80
|
+
return [t, u];
|
|
81
|
+
}
|
|
82
|
+
function I(e) {
|
|
83
|
+
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
84
|
+
acceptNode: (u) => {
|
|
85
|
+
const p = u.tagName === "INPUT" && u.type === "hidden";
|
|
86
|
+
return u.disabled || u.hidden || p ? NodeFilter.FILTER_SKIP : u.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
90
|
+
return n;
|
|
91
|
+
}
|
|
92
|
+
function O(e, n) {
|
|
93
|
+
for (const t of e)
|
|
94
|
+
if (!D(t, { upTo: n })) return t;
|
|
95
|
+
}
|
|
96
|
+
function D(e, { upTo: n }) {
|
|
97
|
+
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
98
|
+
for (; e; ) {
|
|
99
|
+
if (n !== void 0 && e === n) return !1;
|
|
100
|
+
if (getComputedStyle(e).display === "none") return !0;
|
|
101
|
+
e = e.parentElement;
|
|
102
|
+
}
|
|
103
|
+
return !1;
|
|
104
|
+
}
|
|
105
|
+
function H(e) {
|
|
106
|
+
return e instanceof HTMLInputElement && "select" in e;
|
|
107
|
+
}
|
|
108
|
+
function f(e, { select: n = !1 } = {}) {
|
|
109
|
+
if (e && e.focus) {
|
|
110
|
+
const t = document.activeElement;
|
|
111
|
+
e.focus({ preventScroll: !0 }), e !== t && H(e) && n && e.select();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
var S = V();
|
|
115
|
+
function V() {
|
|
116
|
+
let e = [];
|
|
117
|
+
return {
|
|
118
|
+
add(n) {
|
|
119
|
+
const t = e[0];
|
|
120
|
+
n !== t && (t == null || t.pause()), e = C(e, n), e.unshift(n);
|
|
121
|
+
},
|
|
122
|
+
remove(n) {
|
|
123
|
+
var t;
|
|
124
|
+
e = C(e, n), (t = e[0]) == null || t.resume();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function C(e, n) {
|
|
129
|
+
const t = [...e], u = t.indexOf(n);
|
|
130
|
+
return u !== -1 && t.splice(u, 1), t;
|
|
131
|
+
}
|
|
132
|
+
function W(e) {
|
|
133
|
+
return e.filter((n) => n.tagName !== "A");
|
|
134
|
+
}
|
|
135
|
+
export {
|
|
136
|
+
k as FocusScope
|
|
137
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import s from "react-dom";
|
|
3
|
+
import { Primitive as c } from "../../react-primitive/dist/index.js";
|
|
4
|
+
import { useLayoutEffect as u } from "../../react-use-layout-effect/dist/index.js";
|
|
5
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
6
|
+
var p = "Portal", d = r.forwardRef((e, a) => {
|
|
7
|
+
var o;
|
|
8
|
+
const { container: f, ...i } = e, [m, n] = r.useState(!1);
|
|
9
|
+
u(() => n(!0), []);
|
|
10
|
+
const t = f || m && ((o = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : o.body);
|
|
11
|
+
return t ? s.createPortal(/* @__PURE__ */ l(c.div, { ...i, ref: a }), t) : null;
|
|
12
|
+
});
|
|
13
|
+
d.displayName = p;
|
|
14
|
+
export {
|
|
15
|
+
d as Portal
|
|
16
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import * as f from "react-dom";
|
|
3
|
+
import { Slot as p } from "../../react-slot/dist/index.js";
|
|
4
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
5
|
+
var c = [
|
|
6
|
+
"a",
|
|
7
|
+
"button",
|
|
8
|
+
"div",
|
|
9
|
+
"form",
|
|
10
|
+
"h2",
|
|
11
|
+
"h3",
|
|
12
|
+
"img",
|
|
13
|
+
"input",
|
|
14
|
+
"label",
|
|
15
|
+
"li",
|
|
16
|
+
"nav",
|
|
17
|
+
"ol",
|
|
18
|
+
"p",
|
|
19
|
+
"span",
|
|
20
|
+
"svg",
|
|
21
|
+
"ul"
|
|
22
|
+
], v = c.reduce((r, i) => {
|
|
23
|
+
const t = s.forwardRef((o, e) => {
|
|
24
|
+
const { asChild: m, ...a } = o, n = m ? p : i;
|
|
25
|
+
return typeof window != "undefined" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ u(n, { ...a, ref: e });
|
|
26
|
+
});
|
|
27
|
+
return t.displayName = `Primitive.${i}`, { ...r, [i]: t };
|
|
28
|
+
}, {});
|
|
29
|
+
function h(r, i) {
|
|
30
|
+
r && f.flushSync(() => r.dispatchEvent(i));
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
v as Primitive,
|
|
34
|
+
h as dispatchDiscreteCustomEvent
|
|
35
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
import { useCallbackRef as s } from "../../react-use-callback-ref/dist/index.js";
|
|
3
|
+
function p(n, e = globalThis == null ? void 0 : globalThis.document) {
|
|
4
|
+
const t = s(n);
|
|
5
|
+
r.useEffect(() => {
|
|
6
|
+
const o = (a) => {
|
|
7
|
+
a.key === "Escape" && t(a);
|
|
8
|
+
};
|
|
9
|
+
return e.addEventListener("keydown", o, { capture: !0 }), () => e.removeEventListener("keydown", o, { capture: !0 });
|
|
10
|
+
}, [t, e]);
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
p as useEscapeKeydown
|
|
14
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var S = function(r) {
|
|
2
|
+
if (typeof document == "undefined")
|
|
3
|
+
return null;
|
|
4
|
+
var u = Array.isArray(r) ? r[0] : r;
|
|
5
|
+
return u.ownerDocument.body;
|
|
6
|
+
}, f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {}, h = 0, W = function(r) {
|
|
7
|
+
return r && (r.host || W(r.parentNode));
|
|
8
|
+
}, D = function(r, u) {
|
|
9
|
+
return u.map(function(e) {
|
|
10
|
+
if (r.contains(e))
|
|
11
|
+
return e;
|
|
12
|
+
var n = W(e);
|
|
13
|
+
return n && r.contains(n) ? n : (console.error("aria-hidden", e, "in not contained inside", r, ". Doing nothing"), null);
|
|
14
|
+
}).filter(function(e) {
|
|
15
|
+
return !!e;
|
|
16
|
+
});
|
|
17
|
+
}, E = function(r, u, e, n) {
|
|
18
|
+
var i = D(u, Array.isArray(r) ? r : [r]);
|
|
19
|
+
p[e] || (p[e] = /* @__PURE__ */ new WeakMap());
|
|
20
|
+
var o = p[e], l = [], s = /* @__PURE__ */ new Set(), b = new Set(i), y = function(t) {
|
|
21
|
+
!t || s.has(t) || (s.add(t), y(t.parentNode));
|
|
22
|
+
};
|
|
23
|
+
i.forEach(y);
|
|
24
|
+
var A = function(t) {
|
|
25
|
+
!t || b.has(t) || Array.prototype.forEach.call(t.children, function(a) {
|
|
26
|
+
if (s.has(a))
|
|
27
|
+
A(a);
|
|
28
|
+
else
|
|
29
|
+
try {
|
|
30
|
+
var c = a.getAttribute(n), w = c !== null && c !== "false", d = (f.get(a) || 0) + 1, M = (o.get(a) || 0) + 1;
|
|
31
|
+
f.set(a, d), o.set(a, M), l.push(a), d === 1 && w && v.set(a, !0), M === 1 && a.setAttribute(e, "true"), w || a.setAttribute(n, "true");
|
|
32
|
+
} catch (k) {
|
|
33
|
+
console.error("aria-hidden: cannot operate on ", a, k);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
return A(u), s.clear(), h++, function() {
|
|
38
|
+
l.forEach(function(t) {
|
|
39
|
+
var a = f.get(t) - 1, c = o.get(t) - 1;
|
|
40
|
+
f.set(t, a), o.set(t, c), a || (v.has(t) || t.removeAttribute(n), v.delete(t)), c || t.removeAttribute(e);
|
|
41
|
+
}), h--, h || (f = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), p = {});
|
|
42
|
+
};
|
|
43
|
+
}, C = function(r, u, e) {
|
|
44
|
+
e === void 0 && (e = "data-aria-hidden");
|
|
45
|
+
var n = Array.from(Array.isArray(r) ? r : [r]), i = S(r);
|
|
46
|
+
return i ? (n.push.apply(n, Array.from(i.querySelectorAll("[aria-live]"))), E(n, i, e, "aria-hidden")) : function() {
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
C as hideOthers
|
|
52
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __assign as m } from "../../node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import * as r from "react";
|
|
3
|
+
import { RemoveScroll as e } from "./UI.js";
|
|
4
|
+
import t from "./sidecar.js";
|
|
5
|
+
var s = r.forwardRef(function(a, o) {
|
|
6
|
+
return r.createElement(e, m({}, a, { ref: o, sideCar: t }));
|
|
7
|
+
});
|
|
8
|
+
s.classNames = e.classNames;
|
|
9
|
+
export {
|
|
10
|
+
s as default
|
|
11
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { __spreadArray as x } from "../../node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { RemoveScrollBar as A } from "../../../react-remove-scroll-bar/dist/es2015/component.js";
|
|
4
|
+
import { styleSingleton as I } from "../../../react-style-singleton/dist/es2015/component.js";
|
|
5
|
+
import { nonPassive as s } from "./aggresiveCapture.js";
|
|
6
|
+
import { locationCouldBeScrolled as T, handleScroll as W } from "./handleScroll.js";
|
|
7
|
+
var k = function(t) {
|
|
8
|
+
return "changedTouches" in t ? [t.changedTouches[0].clientX, t.changedTouches[0].clientY] : [0, 0];
|
|
9
|
+
}, Y = function(t) {
|
|
10
|
+
return [t.deltaX, t.deltaY];
|
|
11
|
+
}, B = function(t) {
|
|
12
|
+
return t && "current" in t ? t.current : t;
|
|
13
|
+
}, F = function(t, c) {
|
|
14
|
+
return t[0] === c[0] && t[1] === c[1];
|
|
15
|
+
}, O = function(t) {
|
|
16
|
+
return `
|
|
17
|
+
.block-interactivity-`.concat(t, ` {pointer-events: none;}
|
|
18
|
+
.allow-interactivity-`).concat(t, ` {pointer-events: all;}
|
|
19
|
+
`);
|
|
20
|
+
}, Q = 0, f = [];
|
|
21
|
+
function G(t) {
|
|
22
|
+
var c = n.useRef([]), E = n.useRef([0, 0]), d = n.useRef(), v = n.useState(Q++)[0], m = n.useState(I)[0], g = n.useRef(t);
|
|
23
|
+
n.useEffect(function() {
|
|
24
|
+
g.current = t;
|
|
25
|
+
}, [t]), n.useEffect(function() {
|
|
26
|
+
if (t.inert) {
|
|
27
|
+
document.body.classList.add("block-interactivity-".concat(v));
|
|
28
|
+
var e = x([t.lockRef.current], (t.shards || []).map(B), !0).filter(Boolean);
|
|
29
|
+
return e.forEach(function(r) {
|
|
30
|
+
return r.classList.add("allow-interactivity-".concat(v));
|
|
31
|
+
}), function() {
|
|
32
|
+
document.body.classList.remove("block-interactivity-".concat(v)), e.forEach(function(r) {
|
|
33
|
+
return r.classList.remove("allow-interactivity-".concat(v));
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
}, [t.inert, t.lockRef.current, t.shards]);
|
|
38
|
+
var y = n.useCallback(function(e, r) {
|
|
39
|
+
if ("touches" in e && e.touches.length === 2)
|
|
40
|
+
return !g.current.allowPinchZoom;
|
|
41
|
+
var l = k(e), o = E.current, u = "deltaX" in e ? e.deltaX : o[0] - l[0], i = "deltaY" in e ? e.deltaY : o[1] - l[1], a, C = e.target, h = Math.abs(u) > Math.abs(i) ? "h" : "v";
|
|
42
|
+
if ("touches" in e && h === "h" && C.type === "range")
|
|
43
|
+
return !1;
|
|
44
|
+
var b = T(h, C);
|
|
45
|
+
if (!b)
|
|
46
|
+
return !0;
|
|
47
|
+
if (b ? a = h : (a = h === "v" ? "h" : "v", b = T(h, C)), !b)
|
|
48
|
+
return !1;
|
|
49
|
+
if (!d.current && "changedTouches" in e && (u || i) && (d.current = a), !a)
|
|
50
|
+
return !0;
|
|
51
|
+
var P = d.current || a;
|
|
52
|
+
return W(P, r, e, P === "h" ? u : i, !0);
|
|
53
|
+
}, []), S = n.useCallback(function(e) {
|
|
54
|
+
var r = e;
|
|
55
|
+
if (!(!f.length || f[f.length - 1] !== m)) {
|
|
56
|
+
var l = "deltaY" in r ? Y(r) : k(r), o = c.current.filter(function(a) {
|
|
57
|
+
return a.name === r.type && (a.target === r.target || r.target === a.shadowParent) && F(a.delta, l);
|
|
58
|
+
})[0];
|
|
59
|
+
if (o && o.should) {
|
|
60
|
+
r.cancelable && r.preventDefault();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (!o) {
|
|
64
|
+
var u = (g.current.shards || []).map(B).filter(Boolean).filter(function(a) {
|
|
65
|
+
return a.contains(r.target);
|
|
66
|
+
}), i = u.length > 0 ? y(r, u[0]) : !g.current.noIsolation;
|
|
67
|
+
i && r.cancelable && r.preventDefault();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}, []), R = n.useCallback(function(e, r, l, o) {
|
|
71
|
+
var u = { name: e, delta: r, target: l, should: o, shadowParent: Z(l) };
|
|
72
|
+
c.current.push(u), setTimeout(function() {
|
|
73
|
+
c.current = c.current.filter(function(i) {
|
|
74
|
+
return i !== u;
|
|
75
|
+
});
|
|
76
|
+
}, 1);
|
|
77
|
+
}, []), w = n.useCallback(function(e) {
|
|
78
|
+
E.current = k(e), d.current = void 0;
|
|
79
|
+
}, []), L = n.useCallback(function(e) {
|
|
80
|
+
R(e.type, Y(e), e.target, y(e, t.lockRef.current));
|
|
81
|
+
}, []), M = n.useCallback(function(e) {
|
|
82
|
+
R(e.type, k(e), e.target, y(e, t.lockRef.current));
|
|
83
|
+
}, []);
|
|
84
|
+
n.useEffect(function() {
|
|
85
|
+
return f.push(m), t.setCallbacks({
|
|
86
|
+
onScrollCapture: L,
|
|
87
|
+
onWheelCapture: L,
|
|
88
|
+
onTouchMoveCapture: M
|
|
89
|
+
}), document.addEventListener("wheel", S, s), document.addEventListener("touchmove", S, s), document.addEventListener("touchstart", w, s), function() {
|
|
90
|
+
f = f.filter(function(e) {
|
|
91
|
+
return e !== m;
|
|
92
|
+
}), document.removeEventListener("wheel", S, s), document.removeEventListener("touchmove", S, s), document.removeEventListener("touchstart", w, s);
|
|
93
|
+
};
|
|
94
|
+
}, []);
|
|
95
|
+
var X = t.removeScrollBar, D = t.inert;
|
|
96
|
+
return n.createElement(
|
|
97
|
+
n.Fragment,
|
|
98
|
+
null,
|
|
99
|
+
D ? n.createElement(m, { styles: O(v) }) : null,
|
|
100
|
+
X ? n.createElement(A, { gapMode: t.gapMode }) : null
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function Z(t) {
|
|
104
|
+
for (var c = null; t !== null; )
|
|
105
|
+
t instanceof ShadowRoot && (c = t.host, t = t.host), t = t.parentNode;
|
|
106
|
+
return c;
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
G as RemoveScrollSideCar,
|
|
110
|
+
Y as getDeltaXY,
|
|
111
|
+
k as getTouchXY
|
|
112
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __rest as k, __assign as r } from "../../node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { fullWidthClassName as E, zeroRightClassName as I } from "../../../react-remove-scroll-bar/dist/es2015/constants.js";
|
|
4
|
+
import { effectCar as Z } from "./medium.js";
|
|
5
|
+
import { useMergeRefs as W } from "../../../use-callback-ref/dist/es2015/useMergeRef.js";
|
|
6
|
+
var o = function() {
|
|
7
|
+
}, m = a.forwardRef(function(e, d) {
|
|
8
|
+
var l = a.useRef(null), n = a.useState({
|
|
9
|
+
onScrollCapture: o,
|
|
10
|
+
onWheelCapture: o,
|
|
11
|
+
onTouchMoveCapture: o
|
|
12
|
+
}), f = n[0], h = n[1], u = e.forwardProps, t = e.children, v = e.className, C = e.removeScrollBar, g = e.enabled, P = e.shards, R = e.sideCar, S = e.noIsolation, b = e.inert, w = e.allowPinchZoom, s = e.as, N = s === void 0 ? "div" : s, M = e.gapMode, _ = k(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), B = R, i = W([l, d]), c = r(r({}, _), f);
|
|
13
|
+
return a.createElement(
|
|
14
|
+
a.Fragment,
|
|
15
|
+
null,
|
|
16
|
+
g && a.createElement(B, { sideCar: Z, removeScrollBar: C, shards: P, noIsolation: S, inert: b, setCallbacks: h, allowPinchZoom: !!w, lockRef: l, gapMode: M }),
|
|
17
|
+
u ? a.cloneElement(a.Children.only(t), r(r({}, c), { ref: i })) : a.createElement(N, r({}, c, { className: v, ref: i }), t)
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
m.defaultProps = {
|
|
21
|
+
enabled: !0,
|
|
22
|
+
removeScrollBar: !0,
|
|
23
|
+
inert: !1
|
|
24
|
+
};
|
|
25
|
+
m.classNames = {
|
|
26
|
+
fullWidth: E,
|
|
27
|
+
zeroRight: I
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
m as RemoveScroll
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var r = !1;
|
|
2
|
+
if (typeof window != "undefined")
|
|
3
|
+
try {
|
|
4
|
+
var e = Object.defineProperty({}, "passive", {
|
|
5
|
+
get: function() {
|
|
6
|
+
return r = !0, !0;
|
|
7
|
+
}
|
|
8
|
+
});
|
|
9
|
+
window.addEventListener("test", e, e), window.removeEventListener("test", e, e);
|
|
10
|
+
} catch {
|
|
11
|
+
r = !1;
|
|
12
|
+
}
|
|
13
|
+
var a = r ? { passive: !1 } : !1;
|
|
14
|
+
export {
|
|
15
|
+
a as nonPassive
|
|
16
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var p = function(r) {
|
|
2
|
+
return r.tagName === "TEXTAREA";
|
|
3
|
+
}, w = function(r, e) {
|
|
4
|
+
var o = window.getComputedStyle(r);
|
|
5
|
+
return (
|
|
6
|
+
// not-not-scrollable
|
|
7
|
+
o[e] !== "hidden" && // contains scroll inside self
|
|
8
|
+
!(o.overflowY === o.overflowX && !p(r) && o[e] === "visible")
|
|
9
|
+
);
|
|
10
|
+
}, y = function(r) {
|
|
11
|
+
return w(r, "overflowY");
|
|
12
|
+
}, H = function(r) {
|
|
13
|
+
return w(r, "overflowX");
|
|
14
|
+
}, R = function(r, e) {
|
|
15
|
+
var o = e.ownerDocument, t = e;
|
|
16
|
+
do {
|
|
17
|
+
typeof ShadowRoot != "undefined" && t instanceof ShadowRoot && (t = t.host);
|
|
18
|
+
var a = g(r, t);
|
|
19
|
+
if (a) {
|
|
20
|
+
var n = b(r, t), i = n[1], l = n[2];
|
|
21
|
+
if (i > l)
|
|
22
|
+
return !0;
|
|
23
|
+
}
|
|
24
|
+
t = t.parentNode;
|
|
25
|
+
} while (t && t !== o.body);
|
|
26
|
+
return !1;
|
|
27
|
+
}, B = function(r) {
|
|
28
|
+
var e = r.scrollTop, o = r.scrollHeight, t = r.clientHeight;
|
|
29
|
+
return [
|
|
30
|
+
e,
|
|
31
|
+
o,
|
|
32
|
+
t
|
|
33
|
+
];
|
|
34
|
+
}, V = function(r) {
|
|
35
|
+
var e = r.scrollLeft, o = r.scrollWidth, t = r.clientWidth;
|
|
36
|
+
return [
|
|
37
|
+
e,
|
|
38
|
+
o,
|
|
39
|
+
t
|
|
40
|
+
];
|
|
41
|
+
}, g = function(r, e) {
|
|
42
|
+
return r === "v" ? y(e) : H(e);
|
|
43
|
+
}, b = function(r, e) {
|
|
44
|
+
return r === "v" ? B(e) : V(e);
|
|
45
|
+
}, D = function(r, e) {
|
|
46
|
+
return r === "h" && e === "rtl" ? -1 : 1;
|
|
47
|
+
}, W = function(r, e, o, t, a) {
|
|
48
|
+
var n = D(r, window.getComputedStyle(e).direction), i = n * t, l = o.target, f = e.contains(l), c = !1, d = i > 0, s = 0, h = 0;
|
|
49
|
+
do {
|
|
50
|
+
var u = b(r, l), v = u[0], m = u[1], C = u[2], S = m - C - n * v;
|
|
51
|
+
(v || S) && g(r, l) && (s += S, h += v), l instanceof ShadowRoot ? l = l.host : l = l.parentNode;
|
|
52
|
+
} while (
|
|
53
|
+
// portaled content
|
|
54
|
+
!f && l !== document.body || // self content
|
|
55
|
+
f && (e.contains(l) || e === l)
|
|
56
|
+
);
|
|
57
|
+
return (d && (Math.abs(s) < 1 || !a) || !d && (Math.abs(h) < 1 || !a)) && (c = !0), c;
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
W as handleScroll,
|
|
61
|
+
R as locationCouldBeScrolled
|
|
62
|
+
};
|