@phillips/seldon 1.31.2 → 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/assets/lock.svg.js +4 -0
- package/dist/assets/minus.svg.js +4 -0
- package/dist/assets/plus.svg.js +4 -0
- package/dist/components/Accordion/Accordion.d.ts +26 -0
- package/dist/components/Accordion/Accordion.js +21 -0
- package/dist/components/Accordion/AccordionItem.d.ts +37 -0
- package/dist/components/Accordion/AccordionItem.js +114 -0
- package/dist/components/Accordion/index.d.ts +2 -0
- package/dist/components/Accordion/types.d.ts +44 -0
- 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 +2 -0
- package/dist/index.js +44 -38
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +237 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +119 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +14 -0
- 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-direction/dist/index.js +10 -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-id/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +69 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +35 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +48 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +13 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +32 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -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-modal/lib/components/Modal.js +6 -6
- 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/Accordion/_accordion.scss +104 -0
- package/dist/scss/components/Drawer/_drawer.scss +66 -0
- package/dist/scss/components/Subscribe/_subscribe.scss +1 -0
- package/dist/scss/styles.scss +2 -0
- package/package.json +8 -6
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as l from "react";
|
|
2
|
+
import { composeRefs as u } from "../../react-compose-refs/dist/index.js";
|
|
3
|
+
import { jsx as c, Fragment as d } from "react/jsx-runtime";
|
|
4
|
+
var m = l.forwardRef((e, n) => {
|
|
5
|
+
const { children: r, ...t } = e, o = l.Children.toArray(r), i = o.find(y);
|
|
6
|
+
if (i) {
|
|
7
|
+
const s = i.props.children, a = o.map((p) => p === i ? l.Children.count(s) > 1 ? l.Children.only(null) : l.isValidElement(s) ? s.props.children : null : p);
|
|
8
|
+
return /* @__PURE__ */ c(f, { ...t, ref: n, children: l.isValidElement(s) ? l.cloneElement(s, void 0, a) : null });
|
|
9
|
+
}
|
|
10
|
+
return /* @__PURE__ */ c(f, { ...t, ref: n, children: r });
|
|
11
|
+
});
|
|
12
|
+
m.displayName = "Slot";
|
|
13
|
+
var f = l.forwardRef((e, n) => {
|
|
14
|
+
const { children: r, ...t } = e;
|
|
15
|
+
if (l.isValidElement(r)) {
|
|
16
|
+
const o = C(r);
|
|
17
|
+
return l.cloneElement(r, {
|
|
18
|
+
...h(t, r.props),
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
ref: n ? u(n, o) : o
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
return l.Children.count(r) > 1 ? l.Children.only(null) : null;
|
|
24
|
+
});
|
|
25
|
+
f.displayName = "SlotClone";
|
|
26
|
+
var g = ({ children: e }) => /* @__PURE__ */ c(d, { children: e });
|
|
27
|
+
function y(e) {
|
|
28
|
+
return l.isValidElement(e) && e.type === g;
|
|
29
|
+
}
|
|
30
|
+
function h(e, n) {
|
|
31
|
+
const r = { ...n };
|
|
32
|
+
for (const t in n) {
|
|
33
|
+
const o = e[t], i = n[t];
|
|
34
|
+
/^on[A-Z]/.test(t) ? o && i ? r[t] = (...a) => {
|
|
35
|
+
i(...a), o(...a);
|
|
36
|
+
} : o && (r[t] = o) : t === "style" ? r[t] = { ...o, ...i } : t === "className" && (r[t] = [o, i].filter(Boolean).join(" "));
|
|
37
|
+
}
|
|
38
|
+
return { ...e, ...r };
|
|
39
|
+
}
|
|
40
|
+
function C(e) {
|
|
41
|
+
var t, o;
|
|
42
|
+
let n = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, r = n && "isReactWarning" in n && n.isReactWarning;
|
|
43
|
+
return r ? e.ref : (n = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = n && "isReactWarning" in n && n.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
m as Slot,
|
|
47
|
+
g as Slottable
|
|
48
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as r from "react";
|
|
2
|
+
function o(t) {
|
|
3
|
+
const e = r.useRef(t);
|
|
4
|
+
return r.useEffect(() => {
|
|
5
|
+
e.current = t;
|
|
6
|
+
}), r.useMemo(() => (...n) => {
|
|
7
|
+
var u;
|
|
8
|
+
return (u = e.current) == null ? void 0 : u.call(e, ...n);
|
|
9
|
+
}, []);
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
o as useCallbackRef
|
|
13
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as l from "react";
|
|
2
|
+
import { useCallbackRef as f } from "../../react-use-callback-ref/dist/index.js";
|
|
3
|
+
function R({
|
|
4
|
+
prop: t,
|
|
5
|
+
defaultProp: r,
|
|
6
|
+
onChange: s = () => {
|
|
7
|
+
}
|
|
8
|
+
}) {
|
|
9
|
+
const [e, n] = v({ defaultProp: r, onChange: s }), o = t !== void 0, i = o ? t : e, u = f(s), d = l.useCallback(
|
|
10
|
+
(c) => {
|
|
11
|
+
if (o) {
|
|
12
|
+
const a = typeof c == "function" ? c(t) : c;
|
|
13
|
+
a !== t && u(a);
|
|
14
|
+
} else
|
|
15
|
+
n(c);
|
|
16
|
+
},
|
|
17
|
+
[o, t, n, u]
|
|
18
|
+
);
|
|
19
|
+
return [i, d];
|
|
20
|
+
}
|
|
21
|
+
function v({
|
|
22
|
+
defaultProp: t,
|
|
23
|
+
onChange: r
|
|
24
|
+
}) {
|
|
25
|
+
const s = l.useState(t), [e] = s, n = l.useRef(e), o = f(r);
|
|
26
|
+
return l.useEffect(() => {
|
|
27
|
+
n.current !== e && (o(e), n.current = e);
|
|
28
|
+
}, [e, n, o]), s;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
R as useControllableState
|
|
32
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -7,7 +7,7 @@ import "../helpers/ariaAppHider.js";
|
|
|
7
7
|
import "../helpers/safeHTMLElement.js";
|
|
8
8
|
import D from "../../../../_virtual/react-lifecycles-compat.es.js";
|
|
9
9
|
import { __exports as w } from "../../../../_virtual/safeHTMLElement.js";
|
|
10
|
-
import { __exports as
|
|
10
|
+
import { __exports as H } from "../../../../_virtual/ariaAppHider.js";
|
|
11
11
|
Object.defineProperty(d, "__esModule", {
|
|
12
12
|
value: !0
|
|
13
13
|
});
|
|
@@ -19,7 +19,7 @@ var g = Object.assign || function(r) {
|
|
|
19
19
|
Object.prototype.hasOwnProperty.call(o, a) && (r[a] = o[a]);
|
|
20
20
|
}
|
|
21
21
|
return r;
|
|
22
|
-
},
|
|
22
|
+
}, q = /* @__PURE__ */ function() {
|
|
23
23
|
function r(e, o) {
|
|
24
24
|
for (var a = 0; a < o.length; a++) {
|
|
25
25
|
var n = o[a];
|
|
@@ -29,7 +29,7 @@ var g = Object.assign || function(r) {
|
|
|
29
29
|
return function(e, o, a) {
|
|
30
30
|
return o && r(e.prototype, o), a && r(e, a), e;
|
|
31
31
|
};
|
|
32
|
-
}(), R = N, O = m(R), U = T, _ = m(U), L = x, t = m(L), k = A, C = m(k),
|
|
32
|
+
}(), R = N, O = m(R), U = T, _ = m(U), L = x, t = m(L), k = A, C = m(k), W = H, F = B(W), u = w, M = m(u), $ = D;
|
|
33
33
|
function B(r) {
|
|
34
34
|
if (r && r.__esModule)
|
|
35
35
|
return r;
|
|
@@ -82,7 +82,7 @@ var p = function(r) {
|
|
|
82
82
|
n.portalRef(S);
|
|
83
83
|
}, a), E(n, l);
|
|
84
84
|
}
|
|
85
|
-
return
|
|
85
|
+
return q(e, [{
|
|
86
86
|
key: "componentDidMount",
|
|
87
87
|
value: function() {
|
|
88
88
|
if (u.canUseDOM) {
|
|
@@ -130,7 +130,7 @@ var p = function(r) {
|
|
|
130
130
|
}], [{
|
|
131
131
|
key: "setAppElement",
|
|
132
132
|
value: function(a) {
|
|
133
|
-
|
|
133
|
+
F.setElement(a);
|
|
134
134
|
}
|
|
135
135
|
/* eslint-disable react/no-unused-prop-types */
|
|
136
136
|
/* eslint-enable react/no-unused-prop-types */
|
|
@@ -230,7 +230,7 @@ p.defaultStyles = {
|
|
|
230
230
|
padding: "20px"
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
(0,
|
|
233
|
+
(0, $.polyfill)(p);
|
|
234
234
|
process.env.NODE_ENV !== "production" && (p.setCreateHTMLElement = function(r) {
|
|
235
235
|
return b = r;
|
|
236
236
|
});
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var p = function() {
|
|
2
|
+
return p = Object.assign || function(e) {
|
|
3
|
+
for (var n, r = 1, o = arguments.length; r < o; r++) {
|
|
4
|
+
n = arguments[r];
|
|
5
|
+
for (var a in n) Object.prototype.hasOwnProperty.call(n, a) && (e[a] = n[a]);
|
|
6
|
+
}
|
|
7
|
+
return e;
|
|
8
|
+
}, p.apply(this, arguments);
|
|
9
|
+
};
|
|
10
|
+
function c(t, e) {
|
|
11
|
+
var n = {};
|
|
12
|
+
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && e.indexOf(r) < 0 && (n[r] = t[r]);
|
|
13
|
+
if (t != null && typeof Object.getOwnPropertySymbols == "function")
|
|
14
|
+
for (var o = 0, r = Object.getOwnPropertySymbols(t); o < r.length; o++)
|
|
15
|
+
e.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(t, r[o]) && (n[r[o]] = t[r[o]]);
|
|
16
|
+
return n;
|
|
17
|
+
}
|
|
18
|
+
function l(t, e, n) {
|
|
19
|
+
if (n || arguments.length === 2) for (var r = 0, o = e.length, a; r < o; r++)
|
|
20
|
+
(a || !(r in e)) && (a || (a = Array.prototype.slice.call(e, 0, r)), a[r] = e[r]);
|
|
21
|
+
return t.concat(a || Array.prototype.slice.call(e));
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
p as __assign,
|
|
25
|
+
c as __rest,
|
|
26
|
+
l as __spreadArray
|
|
27
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { styleSingleton as f } from "../../../react-style-singleton/dist/es2015/component.js";
|
|
3
|
+
import { noScrollbarsClassName as p, zeroRightClassName as g, fullWidthClassName as l, removedBarSizeVariable as v } from "./constants.js";
|
|
4
|
+
import { getGapWidth as m } from "./utils.js";
|
|
5
|
+
var b = f(), e = "data-scroll-locked", h = function(n, a, o, t) {
|
|
6
|
+
var r = n.left, i = n.top, s = n.right, c = n.gap;
|
|
7
|
+
return o === void 0 && (o = "margin"), `
|
|
8
|
+
.`.concat(p, ` {
|
|
9
|
+
overflow: hidden `).concat(t, `;
|
|
10
|
+
padding-right: `).concat(c, "px ").concat(t, `;
|
|
11
|
+
}
|
|
12
|
+
body[`).concat(e, `] {
|
|
13
|
+
overflow: hidden `).concat(t, `;
|
|
14
|
+
overscroll-behavior: contain;
|
|
15
|
+
`).concat([
|
|
16
|
+
a && "position: relative ".concat(t, ";"),
|
|
17
|
+
o === "margin" && `
|
|
18
|
+
padding-left: `.concat(r, `px;
|
|
19
|
+
padding-top: `).concat(i, `px;
|
|
20
|
+
padding-right: `).concat(s, `px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: `).concat(c, "px ").concat(t, `;
|
|
24
|
+
`),
|
|
25
|
+
o === "padding" && "padding-right: ".concat(c, "px ").concat(t, ";")
|
|
26
|
+
].filter(Boolean).join(""), `
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.`).concat(g, ` {
|
|
30
|
+
right: `).concat(c, "px ").concat(t, `;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.`).concat(l, ` {
|
|
34
|
+
margin-right: `).concat(c, "px ").concat(t, `;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.`).concat(g, " .").concat(g, ` {
|
|
38
|
+
right: 0 `).concat(t, `;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.`).concat(l, " .").concat(l, ` {
|
|
42
|
+
margin-right: 0 `).concat(t, `;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
body[`).concat(e, `] {
|
|
46
|
+
`).concat(v, ": ").concat(c, `px;
|
|
47
|
+
}
|
|
48
|
+
`);
|
|
49
|
+
}, u = function() {
|
|
50
|
+
var n = parseInt(document.body.getAttribute(e) || "0", 10);
|
|
51
|
+
return isFinite(n) ? n : 0;
|
|
52
|
+
}, x = function() {
|
|
53
|
+
d.useEffect(function() {
|
|
54
|
+
return document.body.setAttribute(e, (u() + 1).toString()), function() {
|
|
55
|
+
var n = u() - 1;
|
|
56
|
+
n <= 0 ? document.body.removeAttribute(e) : document.body.setAttribute(e, n.toString());
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
}, C = function(n) {
|
|
60
|
+
var a = n.noRelative, o = n.noImportant, t = n.gapMode, r = t === void 0 ? "margin" : t;
|
|
61
|
+
x();
|
|
62
|
+
var i = d.useMemo(function() {
|
|
63
|
+
return m(r);
|
|
64
|
+
}, [r]);
|
|
65
|
+
return d.createElement(b, { styles: h(i, !a, r, o ? "" : "!important") });
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
C as RemoveScrollBar,
|
|
69
|
+
e as lockAttribute,
|
|
70
|
+
x as useLockAttribute
|
|
71
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var a = {
|
|
2
|
+
left: 0,
|
|
3
|
+
top: 0,
|
|
4
|
+
right: 0,
|
|
5
|
+
gap: 0
|
|
6
|
+
}, e = function(t) {
|
|
7
|
+
return parseInt(t || "", 10) || 0;
|
|
8
|
+
}, o = function(t) {
|
|
9
|
+
var n = window.getComputedStyle(document.body), i = n[t === "padding" ? "paddingLeft" : "marginLeft"], r = n[t === "padding" ? "paddingTop" : "marginTop"], d = n[t === "padding" ? "paddingRight" : "marginRight"];
|
|
10
|
+
return [e(i), e(r), e(d)];
|
|
11
|
+
}, f = function(t) {
|
|
12
|
+
if (t === void 0 && (t = "margin"), typeof window == "undefined")
|
|
13
|
+
return a;
|
|
14
|
+
var n = o(t), i = document.documentElement.clientWidth, r = window.innerWidth;
|
|
15
|
+
return {
|
|
16
|
+
left: n[0],
|
|
17
|
+
top: n[1],
|
|
18
|
+
right: n[2],
|
|
19
|
+
gap: Math.max(0, r - i + n[2] - n[0])
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
f as getGapWidth,
|
|
24
|
+
a as zeroGap
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as o from "react";
|
|
2
|
+
import { stylesheetSingleton as r } from "./singleton.js";
|
|
3
|
+
var i = function() {
|
|
4
|
+
var t = r();
|
|
5
|
+
return function(e, n) {
|
|
6
|
+
o.useEffect(function() {
|
|
7
|
+
return t.add(e), function() {
|
|
8
|
+
t.remove();
|
|
9
|
+
};
|
|
10
|
+
}, [e && n]);
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
i as styleHookSingleton
|
|
15
|
+
};
|