@anoki/fse-ui 1.0.0-beta1.45.6 → 1.0.0-beta1.45.7
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/ui/BaseModal/BaseModal.css +1 -1
- package/dist/index.cjs245.js +1 -1
- package/dist/index.cjs252.js +1 -1
- package/dist/index.cjs290.js +1 -1
- package/dist/index.cjs295.js +1 -1
- package/dist/index.cjs303.js +1 -1
- package/dist/index.cjs314.js +1 -1
- package/dist/index.cjs321.js +1 -1
- package/dist/index.cjs352.js +1 -1
- package/dist/index.cjs393.js +1 -1
- package/dist/index.cjs399.js +1 -1
- package/dist/index.cjs44.js +1 -1
- package/dist/index.cjs44.js.map +1 -1
- package/dist/index.cjs453.js +1 -27
- package/dist/index.cjs453.js.map +1 -1
- package/dist/index.cjs454.js +2 -1
- package/dist/index.cjs454.js.map +1 -1
- package/dist/index.cjs455.js +27 -1
- package/dist/index.cjs455.js.map +1 -1
- package/dist/index.cjs456.js +1 -1
- package/dist/index.cjs456.js.map +1 -1
- package/dist/index.cjs457.js +1 -2
- package/dist/index.cjs457.js.map +1 -1
- package/dist/index.cjs468.js +1 -1
- package/dist/index.cjs468.js.map +1 -1
- package/dist/index.cjs471.js +1 -1
- package/dist/index.cjs471.js.map +1 -1
- package/dist/index.cjs472.js +1 -1
- package/dist/index.cjs472.js.map +1 -1
- package/dist/index.cjs473.js +1 -1
- package/dist/index.cjs473.js.map +1 -1
- package/dist/index.cjs474.js +1 -1
- package/dist/index.cjs474.js.map +1 -1
- package/dist/index.cjs475.js +1 -1
- package/dist/index.cjs475.js.map +1 -1
- package/dist/index.cjs476.js +1 -1
- package/dist/index.cjs476.js.map +1 -1
- package/dist/index.cjs477.js +1 -1
- package/dist/index.cjs477.js.map +1 -1
- package/dist/index.cjs478.js +1 -1
- package/dist/index.cjs478.js.map +1 -1
- package/dist/index.cjs479.js +1 -1
- package/dist/index.cjs479.js.map +1 -1
- package/dist/index.cjs480.js +1 -1
- package/dist/index.cjs480.js.map +1 -1
- package/dist/index.cjs481.js +1 -1
- package/dist/index.cjs481.js.map +1 -1
- package/dist/index.cjs482.js +1 -1
- package/dist/index.cjs482.js.map +1 -1
- package/dist/index.cjs483.js +1 -1
- package/dist/index.cjs483.js.map +1 -1
- package/dist/index.cjs484.js +1 -1
- package/dist/index.cjs484.js.map +1 -1
- package/dist/index.cjs485.js +1 -1
- package/dist/index.cjs485.js.map +1 -1
- package/dist/index.cjs486.js +1 -1
- package/dist/index.cjs486.js.map +1 -1
- package/dist/index.cjs487.js +1 -1
- package/dist/index.cjs487.js.map +1 -1
- package/dist/index.cjs488.js +1 -1
- package/dist/index.cjs488.js.map +1 -1
- package/dist/index.cjs489.js +1 -1
- package/dist/index.cjs489.js.map +1 -1
- package/dist/index.cjs490.js +2 -0
- package/dist/index.cjs490.js.map +1 -0
- package/dist/index.cjs491.js +2 -0
- package/dist/index.cjs491.js.map +1 -0
- package/dist/index.cjs492.js +1 -1
- package/dist/index.cjs492.js.map +1 -1
- package/dist/index.cjs493.js +1 -1
- package/dist/index.cjs493.js.map +1 -1
- package/dist/index.cjs494.js +1 -1
- package/dist/index.cjs494.js.map +1 -1
- package/dist/index.cjs495.js +1 -1
- package/dist/index.cjs495.js.map +1 -1
- package/dist/index.cjs496.js +1 -1
- package/dist/index.cjs496.js.map +1 -1
- package/dist/index.cjs497.js +1 -1
- package/dist/index.cjs497.js.map +1 -1
- package/dist/index.cjs502.js +2 -0
- package/dist/index.cjs502.js.map +1 -0
- package/dist/index.cjs503.js +2 -0
- package/dist/index.cjs503.js.map +1 -0
- package/dist/index.cjs504.js +2 -0
- package/dist/index.cjs504.js.map +1 -0
- package/dist/index.cjs505.js +2 -0
- package/dist/index.cjs505.js.map +1 -0
- package/dist/index.cjs506.js +1 -1
- package/dist/index.cjs506.js.map +1 -1
- package/dist/index.cjs507.js +1 -1
- package/dist/index.cjs507.js.map +1 -1
- package/dist/index.cjs508.js +1 -1
- package/dist/index.cjs508.js.map +1 -1
- package/dist/index.cjs509.js +4 -1
- package/dist/index.cjs509.js.map +1 -1
- package/dist/{index.cjs524.js → index.cjs510.js} +2 -2
- package/dist/{index.cjs524.js.map → index.cjs510.js.map} +1 -1
- package/dist/{index.cjs525.js → index.cjs511.js} +2 -2
- package/dist/{index.cjs525.js.map → index.cjs511.js.map} +1 -1
- package/dist/{index.cjs526.js → index.cjs512.js} +1 -1
- package/dist/{index.cjs526.js.map → index.cjs512.js.map} +1 -1
- package/dist/{index.cjs527.js → index.cjs513.js} +1 -1
- package/dist/{index.cjs527.js.map → index.cjs513.js.map} +1 -1
- package/dist/{index.cjs528.js → index.cjs519.js} +2 -2
- package/dist/{index.cjs528.js.map → index.cjs519.js.map} +1 -1
- package/dist/index.cjs520.js +1 -1
- package/dist/index.cjs520.js.map +1 -1
- package/dist/index.cjs521.js +1 -1
- package/dist/index.cjs521.js.map +1 -1
- package/dist/index.cjs522.js +1 -1
- package/dist/index.cjs522.js.map +1 -1
- package/dist/index.cjs523.js +1 -4
- package/dist/index.cjs523.js.map +1 -1
- package/dist/index.cjs539.js +1 -1
- package/dist/index.cjs540.js +1 -1
- package/dist/index.cjs545.js +1 -1
- package/dist/index.cjs546.js +1 -1
- package/dist/index.cjs548.js +1 -1
- package/dist/index.cjs549.js +1 -1
- package/dist/index.cjs550.js +1 -1
- package/dist/index.cjs551.js +1 -1
- package/dist/index.cjs554.js +1 -1
- package/dist/index.cjs557.js +1 -1
- package/dist/index.cjs562.js +1 -1
- package/dist/index.cjs564.js +1 -1
- package/dist/index.cjs567.js +1 -1
- package/dist/index.cjs571.js +1 -1
- package/dist/index.cjs571.js.map +1 -1
- package/dist/index.cjs572.js +1 -1
- package/dist/index.cjs572.js.map +1 -1
- package/dist/index.cjs573.js +2 -0
- package/dist/index.cjs573.js.map +1 -0
- package/dist/index.cjs574.js +1 -1
- package/dist/index.cjs574.js.map +1 -1
- package/dist/index.cjs575.js +1 -1
- package/dist/index.cjs575.js.map +1 -1
- package/dist/{index.cjs578.js → index.cjs576.js} +1 -1
- package/dist/{index.cjs578.js.map → index.cjs576.js.map} +1 -1
- package/dist/index.cjs577.js +1 -1
- package/dist/index.cjs577.js.map +1 -1
- package/dist/index.cjs582.js +2 -0
- package/dist/index.cjs582.js.map +1 -0
- package/dist/index.cjs583.js +1 -1
- package/dist/index.cjs583.js.map +1 -1
- package/dist/index.cjs594.js +1 -1
- package/dist/index.d.ts +8 -7
- package/dist/index.es245.js +1 -1
- package/dist/index.es252.js +2 -2
- package/dist/index.es290.js +7 -7
- package/dist/index.es295.js +1 -1
- package/dist/index.es303.js +8 -8
- package/dist/index.es314.js +1 -1
- package/dist/index.es321.js +14 -14
- package/dist/index.es352.js +7 -7
- package/dist/index.es393.js +4 -4
- package/dist/index.es399.js +1 -1
- package/dist/index.es44.js +43 -31
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es453.js +5 -3674
- package/dist/index.es453.js.map +1 -1
- package/dist/index.es454.js +520 -5
- package/dist/index.es454.js.map +1 -1
- package/dist/index.es455.js +3675 -2
- package/dist/index.es455.js.map +1 -1
- package/dist/index.es456.js +5 -5
- package/dist/index.es456.js.map +1 -1
- package/dist/index.es457.js +2 -521
- package/dist/index.es457.js.map +1 -1
- package/dist/index.es468.js +15 -7
- package/dist/index.es468.js.map +1 -1
- package/dist/index.es471.js +6 -51
- package/dist/index.es471.js.map +1 -1
- package/dist/index.es472.js +26 -33
- package/dist/index.es472.js.map +1 -1
- package/dist/index.es473.js +63 -617
- package/dist/index.es473.js.map +1 -1
- package/dist/index.es474.js +51 -10
- package/dist/index.es474.js.map +1 -1
- package/dist/index.es475.js +34 -4
- package/dist/index.es475.js.map +1 -1
- package/dist/index.es476.js +619 -54
- package/dist/index.es476.js.map +1 -1
- package/dist/index.es477.js +10 -45
- package/dist/index.es477.js.map +1 -1
- package/dist/index.es478.js +3 -13
- package/dist/index.es478.js.map +1 -1
- package/dist/index.es479.js +52 -120
- package/dist/index.es479.js.map +1 -1
- package/dist/index.es480.js +45 -14
- package/dist/index.es480.js.map +1 -1
- package/dist/index.es481.js +13 -134
- package/dist/index.es481.js.map +1 -1
- package/dist/index.es482.js +113 -206
- package/dist/index.es482.js.map +1 -1
- package/dist/index.es483.js +14 -13
- package/dist/index.es483.js.map +1 -1
- package/dist/index.es484.js +126 -60
- package/dist/index.es484.js.map +1 -1
- package/dist/index.es485.js +203 -166
- package/dist/index.es485.js.map +1 -1
- package/dist/index.es486.js +13 -10
- package/dist/index.es486.js.map +1 -1
- package/dist/index.es487.js +66 -47
- package/dist/index.es487.js.map +1 -1
- package/dist/index.es488.js +181 -9
- package/dist/index.es488.js.map +1 -1
- package/dist/index.es489.js +11 -15
- package/dist/index.es489.js.map +1 -1
- package/dist/index.es490.js +53 -0
- package/dist/index.es490.js.map +1 -0
- package/dist/index.es491.js +12 -0
- package/dist/index.es491.js.map +1 -0
- package/dist/index.es492.js +5 -11
- package/dist/index.es492.js.map +1 -1
- package/dist/index.es493.js +24 -204
- package/dist/index.es493.js.map +1 -1
- package/dist/index.es494.js +12 -22
- package/dist/index.es494.js.map +1 -1
- package/dist/index.es495.js +204 -24
- package/dist/index.es495.js.map +1 -1
- package/dist/index.es496.js +21 -396
- package/dist/index.es496.js.map +1 -1
- package/dist/index.es497.js +396 -5
- package/dist/index.es497.js.map +1 -1
- package/dist/index.es502.js +28 -0
- package/dist/index.es502.js.map +1 -0
- package/dist/index.es503.js +32 -0
- package/dist/index.es503.js.map +1 -0
- package/dist/index.es504.js +8 -0
- package/dist/index.es504.js.map +1 -0
- package/dist/index.es505.js +18 -0
- package/dist/index.es505.js.map +1 -0
- package/dist/index.es506.js +5 -15
- package/dist/index.es506.js.map +1 -1
- package/dist/index.es507.js +3 -25
- package/dist/index.es507.js.map +1 -1
- package/dist/index.es508.js +24 -29
- package/dist/index.es508.js.map +1 -1
- package/dist/index.es509.js +110 -5
- package/dist/index.es509.js.map +1 -1
- package/dist/{index.es524.js → index.es510.js} +2 -2
- package/dist/{index.es524.js.map → index.es510.js.map} +1 -1
- package/dist/{index.es525.js → index.es511.js} +2 -2
- package/dist/{index.es525.js.map → index.es511.js.map} +1 -1
- package/dist/{index.es526.js → index.es512.js} +1 -1
- package/dist/{index.es526.js.map → index.es512.js.map} +1 -1
- package/dist/{index.es527.js → index.es513.js} +1 -1
- package/dist/{index.es527.js.map → index.es513.js.map} +1 -1
- package/dist/{index.es528.js → index.es519.js} +3 -3
- package/dist/{index.es528.js.map → index.es519.js.map} +1 -1
- package/dist/index.es520.js +9 -5
- package/dist/index.es520.js.map +1 -1
- package/dist/index.es521.js +14 -3
- package/dist/index.es521.js.map +1 -1
- package/dist/index.es522.js +61 -23
- package/dist/index.es522.js.map +1 -1
- package/dist/index.es523.js +58 -103
- package/dist/index.es523.js.map +1 -1
- package/dist/index.es539.js +1 -1
- package/dist/index.es540.js +3 -3
- package/dist/index.es545.js +1 -1
- package/dist/index.es546.js +2 -2
- package/dist/index.es548.js +1 -1
- package/dist/index.es549.js +2 -2
- package/dist/index.es550.js +15 -15
- package/dist/index.es551.js +2 -2
- package/dist/index.es554.js +2 -2
- package/dist/index.es557.js +8 -8
- package/dist/index.es562.js +8 -8
- package/dist/index.es564.js +1 -1
- package/dist/index.es567.js +1 -1
- package/dist/index.es571.js +16 -6
- package/dist/index.es571.js.map +1 -1
- package/dist/index.es572.js +6 -16
- package/dist/index.es572.js.map +1 -1
- package/dist/index.es573.js +5 -0
- package/dist/index.es573.js.map +1 -0
- package/dist/index.es574.js +2 -2
- package/dist/index.es574.js.map +1 -1
- package/dist/index.es575.js +3 -2
- package/dist/index.es575.js.map +1 -1
- package/dist/{index.es578.js → index.es576.js} +1 -1
- package/dist/{index.es578.js.map → index.es576.js.map} +1 -1
- package/dist/index.es577.js +4 -3
- package/dist/index.es577.js.map +1 -1
- package/dist/index.es582.js +77 -0
- package/dist/index.es582.js.map +1 -0
- package/dist/index.es583.js +2 -74
- package/dist/index.es583.js.map +1 -1
- package/dist/index.es594.js +1 -1
- package/package.json +1 -1
- package/dist/index.cjs469.js +0 -2
- package/dist/index.cjs469.js.map +0 -1
- package/dist/index.cjs470.js +0 -2
- package/dist/index.cjs470.js.map +0 -1
- package/dist/index.cjs529.js +0 -2
- package/dist/index.cjs529.js.map +0 -1
- package/dist/index.cjs530.js +0 -2
- package/dist/index.cjs530.js.map +0 -1
- package/dist/index.cjs531.js +0 -2
- package/dist/index.cjs531.js.map +0 -1
- package/dist/index.cjs532.js +0 -2
- package/dist/index.cjs532.js.map +0 -1
- package/dist/index.cjs579.js +0 -2
- package/dist/index.cjs579.js.map +0 -1
- package/dist/index.cjs584.js +0 -2
- package/dist/index.cjs584.js.map +0 -1
- package/dist/index.es469.js +0 -30
- package/dist/index.es469.js.map +0 -1
- package/dist/index.es470.js +0 -71
- package/dist/index.es470.js.map +0 -1
- package/dist/index.es529.js +0 -12
- package/dist/index.es529.js.map +0 -1
- package/dist/index.es530.js +0 -17
- package/dist/index.es530.js.map +0 -1
- package/dist/index.es531.js +0 -65
- package/dist/index.es531.js.map +0 -1
- package/dist/index.es532.js +0 -68
- package/dist/index.es532.js.map +0 -1
- package/dist/index.es579.js +0 -7
- package/dist/index.es579.js.map +0 -1
- package/dist/index.es584.js +0 -5
- package/dist/index.es584.js.map +0 -1
package/dist/index.es480.js
CHANGED
|
@@ -1,18 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import r from "react";
|
|
2
|
+
import { createContextScope as y } from "./index.es473.js";
|
|
3
|
+
import { useComposedRefs as S } from "./index.es472.js";
|
|
4
|
+
import { createSlot as M } from "./index.es479.js";
|
|
5
|
+
import { j as d } from "./index.es241.js";
|
|
6
|
+
function D(s) {
|
|
7
|
+
const m = s + "CollectionProvider", [A, E] = y(m), [N, f] = A(
|
|
8
|
+
m,
|
|
9
|
+
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
10
|
+
), p = (c) => {
|
|
11
|
+
const { scope: e, children: l } = c, o = r.useRef(null), t = r.useRef(/* @__PURE__ */ new Map()).current;
|
|
12
|
+
return /* @__PURE__ */ d.jsx(N, { scope: e, itemMap: t, collectionRef: o, children: l });
|
|
13
|
+
};
|
|
14
|
+
p.displayName = m;
|
|
15
|
+
const a = s + "CollectionSlot", _ = M(a), C = r.forwardRef(
|
|
16
|
+
(c, e) => {
|
|
17
|
+
const { scope: l, children: o } = c, t = f(a, l), n = S(e, t.collectionRef);
|
|
18
|
+
return /* @__PURE__ */ d.jsx(_, { ref: n, children: o });
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
C.displayName = a;
|
|
22
|
+
const u = s + "CollectionItemSlot", R = "data-radix-collection-item", T = M(u), x = r.forwardRef(
|
|
23
|
+
(c, e) => {
|
|
24
|
+
const { scope: l, children: o, ...t } = c, n = r.useRef(null), I = S(e, n), i = f(u, l);
|
|
25
|
+
return r.useEffect(() => (i.itemMap.set(n, { ref: n, ...t }), () => void i.itemMap.delete(n))), /* @__PURE__ */ d.jsx(T, { [R]: "", ref: I, children: o });
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
x.displayName = u;
|
|
29
|
+
function O(c) {
|
|
30
|
+
const e = f(s + "CollectionConsumer", c);
|
|
31
|
+
return r.useCallback(() => {
|
|
32
|
+
const o = e.collectionRef.current;
|
|
33
|
+
if (!o) return [];
|
|
34
|
+
const t = Array.from(o.querySelectorAll(`[${R}]`));
|
|
35
|
+
return Array.from(e.itemMap.values()).sort(
|
|
36
|
+
(i, v) => t.indexOf(i.ref.current) - t.indexOf(v.ref.current)
|
|
37
|
+
);
|
|
38
|
+
}, [e.collectionRef, e.itemMap]);
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
{ Provider: p, Slot: C, ItemSlot: x },
|
|
42
|
+
O,
|
|
43
|
+
E
|
|
44
|
+
];
|
|
14
45
|
}
|
|
15
46
|
export {
|
|
16
|
-
|
|
47
|
+
D as createCollection
|
|
17
48
|
};
|
|
18
49
|
//# sourceMappingURL=index.es480.js.map
|
package/dist/index.es480.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es480.js","sources":["../node_modules/@radix-ui/react-focus-guards/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// packages/react/focus-guards/src/focus-guards.tsx\nimport * as React from \"react\";\nvar count = 0;\nfunction FocusGuards(props) {\n useFocusGuards();\n return props.children;\n}\nfunction useFocusGuards() {\n React.useEffect(() => {\n const edgeGuards = document.querySelectorAll(\"[data-radix-focus-guard]\");\n document.body.insertAdjacentElement(\"afterbegin\", edgeGuards[0] ?? createFocusGuard());\n document.body.insertAdjacentElement(\"beforeend\", edgeGuards[1] ?? createFocusGuard());\n count++;\n return () => {\n if (count === 1) {\n document.querySelectorAll(\"[data-radix-focus-guard]\").forEach((node) => node.remove());\n }\n count--;\n };\n }, []);\n}\nfunction createFocusGuard() {\n const element = document.createElement(\"span\");\n element.setAttribute(\"data-radix-focus-guard\", \"\");\n element.tabIndex = 0;\n element.style.outline = \"none\";\n element.style.opacity = \"0\";\n element.style.position = \"fixed\";\n element.style.pointerEvents = \"none\";\n return element;\n}\nvar Root = FocusGuards;\nexport {\n FocusGuards,\n Root,\n useFocusGuards\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["count","useFocusGuards","React","edgeGuards","createFocusGuard","node","element"],"mappings":";AAIA,IAAIA,IAAQ;AAKZ,SAASC,IAAiB;AACxB,EAAAC,EAAM,UAAU,MAAM;AACpB,UAAMC,IAAa,SAAS,iBAAiB,0BAA0B;AACvE,oBAAS,KAAK,sBAAsB,cAAcA,EAAW,CAAC,KAAKC,GAAkB,GACrF,SAAS,KAAK,sBAAsB,aAAaD,EAAW,CAAC,KAAKC,GAAkB,GACpFJ,KACO,MAAM;AACX,MAAIA,MAAU,KACZ,SAAS,iBAAiB,0BAA0B,EAAE,QAAQ,CAACK,MAASA,EAAK,QAAQ,GAEvFL;AAAA,IACD;AAAA,EACF,GAAE,EAAE;AACP;AACA,SAASI,IAAmB;AAC1B,QAAME,IAAU,SAAS,cAAc,MAAM;AAC7C,SAAAA,EAAQ,aAAa,0BAA0B,EAAE,GACjDA,EAAQ,WAAW,GACnBA,EAAQ,MAAM,UAAU,QACxBA,EAAQ,MAAM,UAAU,KACxBA,EAAQ,MAAM,WAAW,SACzBA,EAAQ,MAAM,gBAAgB,QACvBA;AACT;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.es480.js","sources":["../node_modules/@radix-ui/react-collection/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/collection-legacy.tsx\nimport React from \"react\";\nimport { createContextScope } from \"@radix-ui/react-context\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { createSlot } from \"@radix-ui/react-slot\";\nimport { jsx } from \"react/jsx-runtime\";\nfunction createCollection(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);\n const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }\n );\n const CollectionProvider = (props) => {\n const { scope, children } = props;\n const ref = React.useRef(null);\n const itemMap = React.useRef(/* @__PURE__ */ new Map()).current;\n return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);\n const CollectionSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);\n const CollectionItemSlot = React.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n React.useEffect(() => {\n context.itemMap.set(ref, { ref, ...itemData });\n return () => void context.itemMap.delete(ref);\n });\n return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useCollection(scope) {\n const context = useCollectionContext(name + \"CollectionConsumer\", scope);\n const getItems = React.useCallback(() => {\n const collectionNode = context.collectionRef.current;\n if (!collectionNode) return [];\n const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));\n const items = Array.from(context.itemMap.values());\n const orderedItems = items.sort(\n (a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)\n );\n return orderedItems;\n }, [context.collectionRef, context.itemMap]);\n return getItems;\n }\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n useCollection,\n createCollectionScope\n ];\n}\n\n// src/collection.tsx\nimport React2 from \"react\";\nimport { createContextScope as createContextScope2 } from \"@radix-ui/react-context\";\nimport { useComposedRefs as useComposedRefs2 } from \"@radix-ui/react-compose-refs\";\nimport { createSlot as createSlot2 } from \"@radix-ui/react-slot\";\n\n// src/ordered-dictionary.ts\nvar __instanciated = /* @__PURE__ */ new WeakMap();\nvar OrderedDict = class _OrderedDict extends Map {\n #keys;\n constructor(entries) {\n super(entries);\n this.#keys = [...super.keys()];\n __instanciated.set(this, true);\n }\n set(key, value) {\n if (__instanciated.get(this)) {\n if (this.has(key)) {\n this.#keys[this.#keys.indexOf(key)] = key;\n } else {\n this.#keys.push(key);\n }\n }\n super.set(key, value);\n return this;\n }\n insert(index, key, value) {\n const has = this.has(key);\n const length = this.#keys.length;\n const relativeIndex = toSafeInteger(index);\n let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) {\n this.set(key, value);\n return this;\n }\n const size = this.size + (has ? 0 : 1);\n if (relativeIndex < 0) {\n actualIndex++;\n }\n const keys = [...this.#keys];\n let nextValue;\n let shouldSkip = false;\n for (let i = actualIndex; i < size; i++) {\n if (actualIndex === i) {\n let nextKey = keys[i];\n if (keys[i] === key) {\n nextKey = keys[i + 1];\n }\n if (has) {\n this.delete(key);\n }\n nextValue = this.get(nextKey);\n this.set(key, value);\n } else {\n if (!shouldSkip && keys[i - 1] === key) {\n shouldSkip = true;\n }\n const currentKey = keys[shouldSkip ? i : i - 1];\n const currentValue = nextValue;\n nextValue = this.get(currentKey);\n this.delete(currentKey);\n this.set(currentKey, currentValue);\n }\n }\n return this;\n }\n with(index, key, value) {\n const copy = new _OrderedDict(this);\n copy.insert(index, key, value);\n return copy;\n }\n before(key) {\n const index = this.#keys.indexOf(key) - 1;\n if (index < 0) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position before the given key.\n */\n setBefore(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index, newKey, value);\n }\n after(key) {\n let index = this.#keys.indexOf(key);\n index = index === -1 || index === this.size - 1 ? -1 : index + 1;\n if (index === -1) {\n return void 0;\n }\n return this.entryAt(index);\n }\n /**\n * Sets a new key-value pair at the position after the given key.\n */\n setAfter(key, newKey, value) {\n const index = this.#keys.indexOf(key);\n if (index === -1) {\n return this;\n }\n return this.insert(index + 1, newKey, value);\n }\n first() {\n return this.entryAt(0);\n }\n last() {\n return this.entryAt(-1);\n }\n clear() {\n this.#keys = [];\n return super.clear();\n }\n delete(key) {\n const deleted = super.delete(key);\n if (deleted) {\n this.#keys.splice(this.#keys.indexOf(key), 1);\n }\n return deleted;\n }\n deleteAt(index) {\n const key = this.keyAt(index);\n if (key !== void 0) {\n return this.delete(key);\n }\n return false;\n }\n at(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return this.get(key);\n }\n }\n entryAt(index) {\n const key = at(this.#keys, index);\n if (key !== void 0) {\n return [key, this.get(key)];\n }\n }\n indexOf(key) {\n return this.#keys.indexOf(key);\n }\n keyAt(index) {\n return at(this.#keys, index);\n }\n from(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.at(dest);\n }\n keyFrom(key, offset) {\n const index = this.indexOf(key);\n if (index === -1) {\n return void 0;\n }\n let dest = index + offset;\n if (dest < 0) dest = 0;\n if (dest >= this.size) dest = this.size - 1;\n return this.keyAt(dest);\n }\n find(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return entry;\n }\n index++;\n }\n return void 0;\n }\n findIndex(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return index;\n }\n index++;\n }\n return -1;\n }\n filter(predicate, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n entries.push(entry);\n }\n index++;\n }\n return new _OrderedDict(entries);\n }\n map(callbackfn, thisArg) {\n const entries = [];\n let index = 0;\n for (const entry of this) {\n entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [entry, index, this])]);\n index++;\n }\n return new _OrderedDict(entries);\n }\n reduce(...args) {\n const [callbackfn, initialValue] = args;\n let index = 0;\n let accumulator = initialValue ?? this.at(0);\n for (const entry of this) {\n if (index === 0 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n index++;\n }\n return accumulator;\n }\n reduceRight(...args) {\n const [callbackfn, initialValue] = args;\n let accumulator = initialValue ?? this.at(-1);\n for (let index = this.size - 1; index >= 0; index--) {\n const entry = this.at(index);\n if (index === this.size - 1 && args.length === 1) {\n accumulator = entry;\n } else {\n accumulator = Reflect.apply(callbackfn, this, [accumulator, entry, index, this]);\n }\n }\n return accumulator;\n }\n toSorted(compareFn) {\n const entries = [...this.entries()].sort(compareFn);\n return new _OrderedDict(entries);\n }\n toReversed() {\n const reversed = new _OrderedDict();\n for (let index = this.size - 1; index >= 0; index--) {\n const key = this.keyAt(index);\n const element = this.get(key);\n reversed.set(key, element);\n }\n return reversed;\n }\n toSpliced(...args) {\n const entries = [...this.entries()];\n entries.splice(...args);\n return new _OrderedDict(entries);\n }\n slice(start, end) {\n const result = new _OrderedDict();\n let stop = this.size - 1;\n if (start === void 0) {\n return result;\n }\n if (start < 0) {\n start = start + this.size;\n }\n if (end !== void 0 && end > 0) {\n stop = end - 1;\n }\n for (let index = start; index <= stop; index++) {\n const key = this.keyAt(index);\n const element = this.get(key);\n result.set(key, element);\n }\n return result;\n }\n every(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (!Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return false;\n }\n index++;\n }\n return true;\n }\n some(predicate, thisArg) {\n let index = 0;\n for (const entry of this) {\n if (Reflect.apply(predicate, thisArg, [entry, index, this])) {\n return true;\n }\n index++;\n }\n return false;\n }\n};\nfunction at(array, index) {\n if (\"at\" in Array.prototype) {\n return Array.prototype.at.call(array, index);\n }\n const actualIndex = toSafeIndex(array, index);\n return actualIndex === -1 ? void 0 : array[actualIndex];\n}\nfunction toSafeIndex(array, index) {\n const length = array.length;\n const relativeIndex = toSafeInteger(index);\n const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;\n return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex;\n}\nfunction toSafeInteger(number) {\n return number !== number || number === 0 ? 0 : Math.trunc(number);\n}\n\n// src/collection.tsx\nimport { jsx as jsx2 } from \"react/jsx-runtime\";\nfunction createCollection2(name) {\n const PROVIDER_NAME = name + \"CollectionProvider\";\n const [createCollectionContext, createCollectionScope] = createContextScope2(PROVIDER_NAME);\n const [CollectionContextProvider, useCollectionContext] = createCollectionContext(\n PROVIDER_NAME,\n {\n collectionElement: null,\n collectionRef: { current: null },\n collectionRefObject: { current: null },\n itemMap: new OrderedDict(),\n setItemMap: () => void 0\n }\n );\n const CollectionProvider = ({ state, ...props }) => {\n return state ? /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state }) : /* @__PURE__ */ jsx2(CollectionInit, { ...props });\n };\n CollectionProvider.displayName = PROVIDER_NAME;\n const CollectionInit = (props) => {\n const state = useInitCollection();\n return /* @__PURE__ */ jsx2(CollectionProviderImpl, { ...props, state });\n };\n CollectionInit.displayName = PROVIDER_NAME + \"Init\";\n const CollectionProviderImpl = (props) => {\n const { scope, children, state } = props;\n const ref = React2.useRef(null);\n const [collectionElement, setCollectionElement] = React2.useState(\n null\n );\n const composeRefs = useComposedRefs2(ref, setCollectionElement);\n const [itemMap, setItemMap] = state;\n React2.useEffect(() => {\n if (!collectionElement) return;\n const observer = getChildListObserver(() => {\n });\n observer.observe(collectionElement, {\n childList: true,\n subtree: true\n });\n return () => {\n observer.disconnect();\n };\n }, [collectionElement]);\n return /* @__PURE__ */ jsx2(\n CollectionContextProvider,\n {\n scope,\n itemMap,\n setItemMap,\n collectionRef: composeRefs,\n collectionRefObject: ref,\n collectionElement,\n children\n }\n );\n };\n CollectionProviderImpl.displayName = PROVIDER_NAME + \"Impl\";\n const COLLECTION_SLOT_NAME = name + \"CollectionSlot\";\n const CollectionSlotImpl = createSlot2(COLLECTION_SLOT_NAME);\n const CollectionSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children } = props;\n const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);\n const composedRefs = useComposedRefs2(forwardedRef, context.collectionRef);\n return /* @__PURE__ */ jsx2(CollectionSlotImpl, { ref: composedRefs, children });\n }\n );\n CollectionSlot.displayName = COLLECTION_SLOT_NAME;\n const ITEM_SLOT_NAME = name + \"CollectionItemSlot\";\n const ITEM_DATA_ATTR = \"data-radix-collection-item\";\n const CollectionItemSlotImpl = createSlot2(ITEM_SLOT_NAME);\n const CollectionItemSlot = React2.forwardRef(\n (props, forwardedRef) => {\n const { scope, children, ...itemData } = props;\n const ref = React2.useRef(null);\n const [element, setElement] = React2.useState(null);\n const composedRefs = useComposedRefs2(forwardedRef, ref, setElement);\n const context = useCollectionContext(ITEM_SLOT_NAME, scope);\n const { setItemMap } = context;\n const itemDataRef = React2.useRef(itemData);\n if (!shallowEqual(itemDataRef.current, itemData)) {\n itemDataRef.current = itemData;\n }\n const memoizedItemData = itemDataRef.current;\n React2.useEffect(() => {\n const itemData2 = memoizedItemData;\n setItemMap((map) => {\n if (!element) {\n return map;\n }\n if (!map.has(element)) {\n map.set(element, { ...itemData2, element });\n return map.toSorted(sortByDocumentPosition);\n }\n return map.set(element, { ...itemData2, element }).toSorted(sortByDocumentPosition);\n });\n return () => {\n setItemMap((map) => {\n if (!element || !map.has(element)) {\n return map;\n }\n map.delete(element);\n return new OrderedDict(map);\n });\n };\n }, [element, memoizedItemData, setItemMap]);\n return /* @__PURE__ */ jsx2(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: \"\" }, ref: composedRefs, children });\n }\n );\n CollectionItemSlot.displayName = ITEM_SLOT_NAME;\n function useInitCollection() {\n return React2.useState(new OrderedDict());\n }\n function useCollection(scope) {\n const { itemMap } = useCollectionContext(name + \"CollectionConsumer\", scope);\n return itemMap;\n }\n const functions = {\n createCollectionScope,\n useCollection,\n useInitCollection\n };\n return [\n { Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },\n functions\n ];\n}\nfunction shallowEqual(a, b) {\n if (a === b) return true;\n if (typeof a !== \"object\" || typeof b !== \"object\") return false;\n if (a == null || b == null) return false;\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n for (const key of keysA) {\n if (!Object.prototype.hasOwnProperty.call(b, key)) return false;\n if (a[key] !== b[key]) return false;\n }\n return true;\n}\nfunction isElementPreceding(a, b) {\n return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING);\n}\nfunction sortByDocumentPosition(a, b) {\n return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1;\n}\nfunction getChildListObserver(callback) {\n const observer = new MutationObserver((mutationsList) => {\n for (const mutation of mutationsList) {\n if (mutation.type === \"childList\") {\n callback();\n return;\n }\n }\n });\n return observer;\n}\nexport {\n createCollection,\n createCollection2 as unstable_createCollection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["createCollection","name","PROVIDER_NAME","createCollectionContext","createCollectionScope","createContextScope","CollectionProviderImpl","useCollectionContext","CollectionProvider","props","scope","children","ref","React","itemMap","jsx","COLLECTION_SLOT_NAME","CollectionSlotImpl","createSlot","CollectionSlot","forwardedRef","context","composedRefs","useComposedRefs","ITEM_SLOT_NAME","ITEM_DATA_ATTR","CollectionItemSlotImpl","CollectionItemSlot","itemData","useCollection","collectionNode","orderedNodes","a","b"],"mappings":";;;;;AAQA,SAASA,EAAiBC,GAAM;AAC9B,QAAMC,IAAgBD,IAAO,sBACvB,CAACE,GAAyBC,CAAqB,IAAIC,EAAmBH,CAAa,GACnF,CAACI,GAAwBC,CAAoB,IAAIJ;AAAA,IACrDD;AAAA,IACA,EAAE,eAAe,EAAE,SAAS,KAAI,GAAI,SAAyB,oBAAI,IAAK,EAAA;AAAA,EACvE,GACKM,IAAqB,CAACC,MAAU;AACpC,UAAM,EAAE,OAAAC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AcH;AACjC,WAASK,EAAcnB,GAAO;AAC5B,UAAMW,IAAUd,EAAqBN,IAAO,sBAAsBS,CAAK;AAWvE,WAViBG,EAAM,YAAY,MAAM;AACvC,YAAMiB,IAAiBT,EAAQ,cAAc;AAC7C,UAAI,CAACS,EAAgB,QAAO,CAAE;AAC9B,YAAMC,IAAe,MAAM,KAAKD,EAAe,iBAAiB,IAAIL,CAAc,GAAG,CAAC;AAKtF,aAJc,MAAM,KAAKJ,EAAQ,QAAQ,QAAQ,EACtB;AAAA,QACzB,CAACW,GAAGC,MAAMF,EAAa,QAAQC,EAAE,IAAI,OAAO,IAAID,EAAa,QAAQE,EAAE,IAAI,OAAO;AAAA,MACnF;AAAA,IAEF,GAAE,CAACZ,EAAQ,eAAeA,EAAQ,OAAO,CAAC;AAAA,EAE/C;AACE,SAAO;AAAA,IACL,EAAE,UAAUb,GAAoB,MAAMW,GAAgB,UAAUQ,EAAoB;AAAA,IACpFE;AAAA,IACAzB;AAAA,EACD;AACH;","x_google_ignoreList":[0]}
|
package/dist/index.es481.js
CHANGED
|
@@ -1,138 +1,17 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
onMountAutoFocus: p,
|
|
11
|
-
onUnmountAutoFocus: L,
|
|
12
|
-
...g
|
|
13
|
-
} = e, [o, R] = d.useState(null), E = y(p), v = y(L), b = d.useRef(null), U = P(n, (s) => R(s)), 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 s = function(i) {
|
|
25
|
-
if (a.paused || !o) return;
|
|
26
|
-
const c = i.target;
|
|
27
|
-
o.contains(c) ? b.current = c : f(b.current, { select: !0 });
|
|
28
|
-
}, l = function(i) {
|
|
29
|
-
if (a.paused || !o) return;
|
|
30
|
-
const c = i.relatedTarget;
|
|
31
|
-
c !== null && (o.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(o);
|
|
36
|
-
};
|
|
37
|
-
document.addEventListener("focusin", s), document.addEventListener("focusout", l);
|
|
38
|
-
const m = new MutationObserver(r);
|
|
39
|
-
return o && m.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
40
|
-
document.removeEventListener("focusin", s), document.removeEventListener("focusout", l), m.disconnect();
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}, [u, o, a.paused]), d.useEffect(() => {
|
|
44
|
-
if (o) {
|
|
45
|
-
S.add(a);
|
|
46
|
-
const s = document.activeElement;
|
|
47
|
-
if (!o.contains(s)) {
|
|
48
|
-
const r = new CustomEvent(F, N);
|
|
49
|
-
o.addEventListener(F, E), o.dispatchEvent(r), r.defaultPrevented || (w(V(I(o)), { select: !0 }), document.activeElement === s && f(o));
|
|
50
|
-
}
|
|
51
|
-
return () => {
|
|
52
|
-
o.removeEventListener(F, E), setTimeout(() => {
|
|
53
|
-
const r = new CustomEvent(T, N);
|
|
54
|
-
o.addEventListener(T, v), o.dispatchEvent(r), r.defaultPrevented || f(s ?? document.body, { select: !0 }), o.removeEventListener(T, v), S.remove(a);
|
|
55
|
-
}, 0);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}, [o, E, v, a]);
|
|
59
|
-
const A = d.useCallback(
|
|
60
|
-
(s) => {
|
|
61
|
-
if (!t && !u || a.paused) return;
|
|
62
|
-
const l = s.key === "Tab" && !s.altKey && !s.ctrlKey && !s.metaKey, r = document.activeElement;
|
|
63
|
-
if (l && r) {
|
|
64
|
-
const m = s.currentTarget, [i, c] = x(m);
|
|
65
|
-
i && c ? !s.shiftKey && r === c ? (s.preventDefault(), t && f(i, { select: !0 })) : s.shiftKey && r === i && (s.preventDefault(), t && f(c, { select: !0 })) : r === m && s.preventDefault();
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
[t, u, a.paused]
|
|
69
|
-
);
|
|
70
|
-
return /* @__PURE__ */ _.jsx(M.div, { tabIndex: -1, ...g, ref: U, onKeyDown: A });
|
|
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 = j();
|
|
115
|
-
function j() {
|
|
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 V(e) {
|
|
133
|
-
return e.filter((n) => n.tagName !== "A");
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
import { j as n } from "./index.es241.js";
|
|
3
|
+
var o = e.createContext(void 0), a = (r) => {
|
|
4
|
+
const { dir: t, children: i } = r;
|
|
5
|
+
return /* @__PURE__ */ n.jsx(o.Provider, { value: t, children: i });
|
|
6
|
+
};
|
|
7
|
+
function s(r) {
|
|
8
|
+
const t = e.useContext(o);
|
|
9
|
+
return r || t || "ltr";
|
|
134
10
|
}
|
|
11
|
+
var v = a;
|
|
135
12
|
export {
|
|
136
|
-
|
|
13
|
+
a as DirectionProvider,
|
|
14
|
+
v as Provider,
|
|
15
|
+
s as useDirection
|
|
137
16
|
};
|
|
138
17
|
//# sourceMappingURL=index.es481.js.map
|
package/dist/index.es481.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es481.js","sources":["../node_modules/@radix-ui/react-focus-scope/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/focus-scope.tsx\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { jsx } from \"react/jsx-runtime\";\nvar AUTOFOCUS_ON_MOUNT = \"focusScope.autoFocusOnMount\";\nvar AUTOFOCUS_ON_UNMOUNT = \"focusScope.autoFocusOnUnmount\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar FOCUS_SCOPE_NAME = \"FocusScope\";\nvar FocusScope = React.forwardRef((props, forwardedRef) => {\n const {\n loop = false,\n trapped = false,\n onMountAutoFocus: onMountAutoFocusProp,\n onUnmountAutoFocus: onUnmountAutoFocusProp,\n ...scopeProps\n } = props;\n const [container, setContainer] = React.useState(null);\n const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));\n const focusScope = React.useRef({\n paused: false,\n pause() {\n this.paused = true;\n },\n resume() {\n this.paused = false;\n }\n }).current;\n React.useEffect(() => {\n if (trapped) {\n let handleFocusIn2 = function(event) {\n if (focusScope.paused || !container) return;\n const target = event.target;\n if (container.contains(target)) {\n lastFocusedElementRef.current = target;\n } else {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }, handleFocusOut2 = function(event) {\n if (focusScope.paused || !container) return;\n const relatedTarget = event.relatedTarget;\n if (relatedTarget === null) return;\n if (!container.contains(relatedTarget)) {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }, handleMutations2 = function(mutations) {\n const focusedElement = document.activeElement;\n if (focusedElement !== document.body) return;\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) focus(container);\n }\n };\n var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;\n document.addEventListener(\"focusin\", handleFocusIn2);\n document.addEventListener(\"focusout\", handleFocusOut2);\n const mutationObserver = new MutationObserver(handleMutations2);\n if (container) mutationObserver.observe(container, { childList: true, subtree: true });\n return () => {\n document.removeEventListener(\"focusin\", handleFocusIn2);\n document.removeEventListener(\"focusout\", handleFocusOut2);\n mutationObserver.disconnect();\n };\n }\n }, [trapped, container, focusScope.paused]);\n React.useEffect(() => {\n if (container) {\n focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });\n if (document.activeElement === previouslyFocusedElement) {\n focus(container);\n }\n }\n }\n return () => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n setTimeout(() => {\n const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) {\n focus(previouslyFocusedElement ?? document.body, { select: true });\n }\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);\n const handleKeyDown = React.useCallback(\n (event) => {\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n const isTabKey = event.key === \"Tab\" && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement;\n if (isTabKey && focusedElement) {\n const container2 = event.currentTarget;\n const [first, last] = getTabbableEdges(container2);\n const hasTabbableElementsInside = first && last;\n if (!hasTabbableElementsInside) {\n if (focusedElement === container2) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) focus(first, { select: true });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) focus(last, { select: true });\n }\n }\n }\n },\n [loop, trapped, focusScope.paused]\n );\n return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });\n});\nFocusScope.displayName = FOCUS_SCOPE_NAME;\nfunction focusFirst(candidates, { select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\nfunction getTabbableEdges(container) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last];\n}\nfunction getTabbableCandidates(container) {\n const nodes = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node) => {\n const isHiddenInput = node.tagName === \"INPUT\" && node.type === \"hidden\";\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while (walker.nextNode()) nodes.push(walker.currentNode);\n return nodes;\n}\nfunction findVisible(elements, container) {\n for (const element of elements) {\n if (!isHidden(element, { upTo: container })) return element;\n }\n}\nfunction isHidden(node, { upTo }) {\n if (getComputedStyle(node).visibility === \"hidden\") return true;\n while (node) {\n if (upTo !== void 0 && node === upTo) return false;\n if (getComputedStyle(node).display === \"none\") return true;\n node = node.parentElement;\n }\n return false;\n}\nfunction isSelectableInput(element) {\n return element instanceof HTMLInputElement && \"select\" in element;\n}\nfunction focus(element, { select = false } = {}) {\n if (element && element.focus) {\n const previouslyFocusedElement = document.activeElement;\n element.focus({ preventScroll: true });\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select)\n element.select();\n }\n}\nvar focusScopesStack = createFocusScopesStack();\nfunction createFocusScopesStack() {\n let stack = [];\n return {\n add(focusScope) {\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) {\n activeFocusScope?.pause();\n }\n stack = arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n remove(focusScope) {\n stack = arrayRemove(stack, focusScope);\n stack[0]?.resume();\n }\n };\n}\nfunction arrayRemove(array, item) {\n const updatedArray = [...array];\n const index = updatedArray.indexOf(item);\n if (index !== -1) {\n updatedArray.splice(index, 1);\n }\n return updatedArray;\n}\nfunction removeLinks(items) {\n return items.filter((item) => item.tagName !== \"A\");\n}\nvar Root = FocusScope;\nexport {\n FocusScope,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["AUTOFOCUS_ON_MOUNT","AUTOFOCUS_ON_UNMOUNT","EVENT_OPTIONS","FOCUS_SCOPE_NAME","FocusScope","React","props","forwardedRef","loop","trapped","onMountAutoFocusProp","onUnmountAutoFocusProp","scopeProps","container","setContainer","onMountAutoFocus","useCallbackRef","onUnmountAutoFocus","lastFocusedElementRef","composedRefs","useComposedRefs","node","focusScope","handleFocusIn2","event","target","focus","handleFocusOut2","relatedTarget","handleMutations2","mutations","mutation","mutationObserver","focusScopesStack","previouslyFocusedElement","mountEvent","focusFirst","removeLinks","getTabbableCandidates","unmountEvent","handleKeyDown","isTabKey","focusedElement","container2","first","last","getTabbableEdges","jsx","Primitive","candidates","select","candidate","findVisible","nodes","walker","isHiddenInput","elements","element","isHidden","upTo","isSelectableInput","createFocusScopesStack","stack","activeFocusScope","arrayRemove","_a","array","item","updatedArray","index","items"],"mappings":";;;;;AAQA,IAAIA,IAAqB,+BACrBC,IAAuB,iCACvBC,IAAgB,EAAE,SAAS,IAAO,YAAY,GAAM,GACpDC,IAAmB,cACnBC,IAAaC,EAAM,WAAW,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AA,QAAAA,EAAkB,UAEpBD,IAAQE,EAAYF,GAAOxC,CAAU,GACrCwC,EAAM,QAAQxC,CAAU;AAAA,IACzB;AAAA,IACD,OAAOA,GAAY;;AACjB,MAAAwC,IAAQE,EAAYF,GAAOxC,CAAU,IACrC2C,IAAAH,EAAM,CAAC,MAAP,QAAAG,EAAU;AAAA,IAChB;AAAA,EACG;AACH;AACA,SAASD,EAAYE,GAAOC,GAAM;AAChC,QAAMC,IAAe,CAAC,GAAGF,CAAK,GACxBG,IAAQD,EAAa,QAAQD,CAAI;AACvC,SAAIE,MAAU,MACZD,EAAa,OAAOC,GAAO,CAAC,GAEvBD;AACT;AACA,SAAS/B,EAAYiC,GAAO;AAC1B,SAAOA,EAAM,OAAO,CAACH,MAASA,EAAK,YAAY,GAAG;AACpD;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.es481.js","sources":["../node_modules/@radix-ui/react-direction/dist/index.mjs"],"sourcesContent":["// packages/react/direction/src/direction.tsx\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nvar DirectionContext = React.createContext(void 0);\nvar DirectionProvider = (props) => {\n const { dir, children } = props;\n return /* @__PURE__ */ jsx(DirectionContext.Provider, { value: dir, children });\n};\nfunction useDirection(localDir) {\n const globalDir = React.useContext(DirectionContext);\n return localDir || globalDir || \"ltr\";\n}\nvar Provider = DirectionProvider;\nexport {\n DirectionProvider,\n Provider,\n useDirection\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":["DirectionContext","React","DirectionProvider","props","dir","children","jsx","useDirection","localDir","globalDir","Provider"],"mappings":";;AAGA,IAAIA,IAAmBC,EAAM,cAAc,MAAM,GAC7CC,IAAoB,CAACC,MAAU;AACjC,QAAM,EAAE,KAAAC,GAAK,UAAAC,EAAQ,IAAKF;AAC1B,SAAuBG,gBAAAA,EAAAA,IAAIN,EAAiB,UAAU,EAAE,OAAOI,GAAK,UAAAC,GAAU;AAChF;AACA,SAASE,EAAaC,GAAU;AAC9B,QAAMC,IAAYR,EAAM,WAAWD,CAAgB;AACnD,SAAOQ,KAAYC,KAAa;AAClC;AACG,IAACC,IAAWR;","x_google_ignoreList":[0]}
|
package/dist/index.es482.js
CHANGED
|
@@ -1,221 +1,128 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useComposedRefs as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return /* @__PURE__ */ f.jsx($e, { scope: i, anchor: t, onAnchorChange: a, children: n });
|
|
15
|
-
};
|
|
16
|
-
U.displayName = N;
|
|
17
|
-
var q = "PopperAnchor", G = s.forwardRef(
|
|
18
|
-
(e, i) => {
|
|
19
|
-
const { __scopePopper: n, virtualRef: t, ...a } = e, r = Z(q, n), o = s.useRef(null), w = T(i, o);
|
|
20
|
-
return s.useEffect(() => {
|
|
21
|
-
r.onAnchorChange((t == null ? void 0 : t.current) || o.current);
|
|
22
|
-
}), t ? null : /* @__PURE__ */ f.jsx(z.div, { ...a, ref: w });
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
G.displayName = q;
|
|
26
|
-
var _ = "PopperContent", [je, He] = L(_), J = s.forwardRef(
|
|
27
|
-
(e, i) => {
|
|
28
|
-
var I, Y, M, X, D, F;
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { composeEventHandlers as m } from "./index.es471.js";
|
|
3
|
+
import { Primitive as R, dispatchDiscreteCustomEvent as k } from "./index.es475.js";
|
|
4
|
+
import { useComposedRefs as g } from "./index.es472.js";
|
|
5
|
+
import { useCallbackRef as w } from "./index.es489.js";
|
|
6
|
+
import { useEscapeKeydown as U } from "./index.es494.js";
|
|
7
|
+
import { j as x } from "./index.es241.js";
|
|
8
|
+
var j = "DismissableLayer", p = "dismissableLayer.update", z = "dismissableLayer.pointerDownOutside", H = "dismissableLayer.focusOutside", L, T = n.createContext({
|
|
9
|
+
layers: /* @__PURE__ */ new Set(),
|
|
10
|
+
layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
|
|
11
|
+
branches: /* @__PURE__ */ new Set()
|
|
12
|
+
}), M = n.forwardRef(
|
|
13
|
+
(r, e) => {
|
|
29
14
|
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
middleware: [
|
|
60
|
-
Pe({ mainAxis: a + $, alignmentAxis: o }),
|
|
61
|
-
p && ye({
|
|
62
|
-
mainAxis: !0,
|
|
63
|
-
crossAxis: !1,
|
|
64
|
-
limiter: m === "partial" ? Se() : void 0,
|
|
65
|
-
...b
|
|
66
|
-
}),
|
|
67
|
-
p && Ae({ ...b }),
|
|
68
|
-
ve({
|
|
69
|
-
...b,
|
|
70
|
-
apply: ({ elements: P, rects: k, availableWidth: he, availableHeight: ge }) => {
|
|
71
|
-
const { width: ue, height: we } = k.reference, R = P.floating.style;
|
|
72
|
-
R.setProperty("--radix-popper-available-width", `${he}px`), R.setProperty("--radix-popper-available-height", `${ge}px`), R.setProperty("--radix-popper-anchor-width", `${ue}px`), R.setProperty("--radix-popper-anchor-height", `${we}px`);
|
|
73
|
-
}
|
|
74
|
-
}),
|
|
75
|
-
E && Ce({ element: E, padding: w }),
|
|
76
|
-
Ye({ arrowWidth: re, arrowHeight: $ }),
|
|
77
|
-
y && be({ strategy: "referenceHidden", ...b })
|
|
78
|
-
]
|
|
79
|
-
}), [W, pe] = V(se), O = Ee(l);
|
|
80
|
-
B(() => {
|
|
81
|
-
S && (O == null || O());
|
|
82
|
-
}, [S, O]);
|
|
83
|
-
const ce = (I = u.arrow) == null ? void 0 : I.x, de = (Y = u.arrow) == null ? void 0 : Y.y, le = ((M = u.arrow) == null ? void 0 : M.centerOffset) !== 0, [fe, me] = s.useState();
|
|
84
|
-
return B(() => {
|
|
85
|
-
h && me(window.getComputedStyle(h).zIndex);
|
|
86
|
-
}, [h]), /* @__PURE__ */ f.jsx(
|
|
87
|
-
"div",
|
|
15
|
+
disableOutsidePointerEvents: i = !1,
|
|
16
|
+
onEscapeKeyDown: o,
|
|
17
|
+
onPointerDownOutside: t,
|
|
18
|
+
onFocusOutside: a,
|
|
19
|
+
onInteractOutside: l,
|
|
20
|
+
onDismiss: d,
|
|
21
|
+
...v
|
|
22
|
+
} = r, c = n.useContext(T), [u, S] = n.useState(null), f = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, F] = n.useState({}), W = g(e, (s) => S(s)), y = Array.from(c.layers), [A] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), N = y.indexOf(A), b = u ? y.indexOf(u) : -1, I = c.layersWithOutsidePointerEventsDisabled.size > 0, P = b >= N, _ = q((s) => {
|
|
23
|
+
const E = s.target, C = [...c.branches].some((h) => h.contains(E));
|
|
24
|
+
!P || C || (t == null || t(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
25
|
+
}, f), D = G((s) => {
|
|
26
|
+
const E = s.target;
|
|
27
|
+
[...c.branches].some((h) => h.contains(E)) || (a == null || a(s), l == null || l(s), s.defaultPrevented || d == null || d());
|
|
28
|
+
}, f);
|
|
29
|
+
return U((s) => {
|
|
30
|
+
b === c.layers.size - 1 && (o == null || o(s), !s.defaultPrevented && d && (s.preventDefault(), d()));
|
|
31
|
+
}, f), n.useEffect(() => {
|
|
32
|
+
if (u)
|
|
33
|
+
return i && (c.layersWithOutsidePointerEventsDisabled.size === 0 && (L = f.body.style.pointerEvents, f.body.style.pointerEvents = "none"), c.layersWithOutsidePointerEventsDisabled.add(u)), c.layers.add(u), O(), () => {
|
|
34
|
+
i && c.layersWithOutsidePointerEventsDisabled.size === 1 && (f.body.style.pointerEvents = L);
|
|
35
|
+
};
|
|
36
|
+
}, [u, f, i, c]), n.useEffect(() => () => {
|
|
37
|
+
u && (c.layers.delete(u), c.layersWithOutsidePointerEventsDisabled.delete(u), O());
|
|
38
|
+
}, [u, c]), n.useEffect(() => {
|
|
39
|
+
const s = () => F({});
|
|
40
|
+
return document.addEventListener(p, s), () => document.removeEventListener(p, s);
|
|
41
|
+
}, []), /* @__PURE__ */ x.jsx(
|
|
42
|
+
R.div,
|
|
88
43
|
{
|
|
89
|
-
|
|
90
|
-
|
|
44
|
+
...v,
|
|
45
|
+
ref: W,
|
|
91
46
|
style: {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// keep off the page when measuring
|
|
95
|
-
minWidth: "max-content",
|
|
96
|
-
zIndex: fe,
|
|
97
|
-
"--radix-popper-transform-origin": [
|
|
98
|
-
(X = u.transformOrigin) == null ? void 0 : X.x,
|
|
99
|
-
(D = u.transformOrigin) == null ? void 0 : D.y
|
|
100
|
-
].join(" "),
|
|
101
|
-
// hide the content if using the hide middleware and should be hidden
|
|
102
|
-
// set visibility to hidden and disable pointer events so the UI behaves
|
|
103
|
-
// as if the PopperContent isn't there at all
|
|
104
|
-
...((F = u.hide) == null ? void 0 : F.referenceHidden) && {
|
|
105
|
-
visibility: "hidden",
|
|
106
|
-
pointerEvents: "none"
|
|
107
|
-
}
|
|
47
|
+
pointerEvents: I ? P ? "auto" : "none" : void 0,
|
|
48
|
+
...r.style
|
|
108
49
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
placedSide: W,
|
|
115
|
-
onArrowChange: te,
|
|
116
|
-
arrowX: ce,
|
|
117
|
-
arrowY: de,
|
|
118
|
-
shouldHideArrow: le,
|
|
119
|
-
children: /* @__PURE__ */ f.jsx(
|
|
120
|
-
z.div,
|
|
121
|
-
{
|
|
122
|
-
"data-side": W,
|
|
123
|
-
"data-align": pe,
|
|
124
|
-
...d,
|
|
125
|
-
ref: ee,
|
|
126
|
-
style: {
|
|
127
|
-
...d.style,
|
|
128
|
-
// if the PopperContent hasn't been placed yet (not all measurements done)
|
|
129
|
-
// we prevent animations so that users's animation don't kick in too early referring wrong sides
|
|
130
|
-
animation: S ? void 0 : "none"
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
)
|
|
134
|
-
}
|
|
50
|
+
onFocusCapture: m(r.onFocusCapture, D.onFocusCapture),
|
|
51
|
+
onBlurCapture: m(r.onBlurCapture, D.onBlurCapture),
|
|
52
|
+
onPointerDownCapture: m(
|
|
53
|
+
r.onPointerDownCapture,
|
|
54
|
+
_.onPointerDownCapture
|
|
135
55
|
)
|
|
136
56
|
}
|
|
137
57
|
);
|
|
138
58
|
}
|
|
139
59
|
);
|
|
140
|
-
|
|
141
|
-
var
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// doesn't report size as we'd expect on SVG elements.
|
|
151
|
-
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
152
|
-
/* @__PURE__ */ f.jsx(
|
|
153
|
-
"span",
|
|
154
|
-
{
|
|
155
|
-
ref: r.onArrowChange,
|
|
156
|
-
style: {
|
|
157
|
-
position: "absolute",
|
|
158
|
-
left: r.arrowX,
|
|
159
|
-
top: r.arrowY,
|
|
160
|
-
[o]: 0,
|
|
161
|
-
transformOrigin: {
|
|
162
|
-
top: "",
|
|
163
|
-
right: "0 0",
|
|
164
|
-
bottom: "center 0",
|
|
165
|
-
left: "100% 0"
|
|
166
|
-
}[r.placedSide],
|
|
167
|
-
transform: {
|
|
168
|
-
top: "translateY(100%)",
|
|
169
|
-
right: "translateY(50%) rotate(90deg) translateX(-50%)",
|
|
170
|
-
bottom: "rotate(180deg)",
|
|
171
|
-
left: "translateY(50%) rotate(-90deg) translateX(50%)"
|
|
172
|
-
}[r.placedSide],
|
|
173
|
-
visibility: r.shouldHideArrow ? "hidden" : void 0
|
|
174
|
-
},
|
|
175
|
-
children: /* @__PURE__ */ f.jsx(
|
|
176
|
-
Oe,
|
|
177
|
-
{
|
|
178
|
-
...a,
|
|
179
|
-
ref: n,
|
|
180
|
-
style: {
|
|
181
|
-
...a.style,
|
|
182
|
-
// ensures the element can be measured correctly (mostly for if SVG)
|
|
183
|
-
display: "block"
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
)
|
|
189
|
-
);
|
|
60
|
+
M.displayName = j;
|
|
61
|
+
var X = "DismissableLayerBranch", Y = n.forwardRef((r, e) => {
|
|
62
|
+
const i = n.useContext(T), o = n.useRef(null), t = g(e, o);
|
|
63
|
+
return n.useEffect(() => {
|
|
64
|
+
const a = o.current;
|
|
65
|
+
if (a)
|
|
66
|
+
return i.branches.add(a), () => {
|
|
67
|
+
i.branches.delete(a);
|
|
68
|
+
};
|
|
69
|
+
}, [i.branches]), /* @__PURE__ */ x.jsx(R.div, { ...r, ref: t });
|
|
190
70
|
});
|
|
191
|
-
|
|
192
|
-
function
|
|
193
|
-
|
|
71
|
+
Y.displayName = X;
|
|
72
|
+
function q(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
73
|
+
const i = w(r), o = n.useRef(!1), t = n.useRef(() => {
|
|
74
|
+
});
|
|
75
|
+
return n.useEffect(() => {
|
|
76
|
+
const a = (d) => {
|
|
77
|
+
if (d.target && !o.current) {
|
|
78
|
+
let v = function() {
|
|
79
|
+
B(
|
|
80
|
+
z,
|
|
81
|
+
i,
|
|
82
|
+
c,
|
|
83
|
+
{ discrete: !0 }
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
const c = { originalEvent: d };
|
|
87
|
+
d.pointerType === "touch" ? (e.removeEventListener("click", t.current), t.current = v, e.addEventListener("click", t.current, { once: !0 })) : v();
|
|
88
|
+
} else
|
|
89
|
+
e.removeEventListener("click", t.current);
|
|
90
|
+
o.current = !1;
|
|
91
|
+
}, l = window.setTimeout(() => {
|
|
92
|
+
e.addEventListener("pointerdown", a);
|
|
93
|
+
}, 0);
|
|
94
|
+
return () => {
|
|
95
|
+
window.clearTimeout(l), e.removeEventListener("pointerdown", a), e.removeEventListener("click", t.current);
|
|
96
|
+
};
|
|
97
|
+
}, [e, i]), {
|
|
98
|
+
// ensures we check React component tree (not just DOM tree)
|
|
99
|
+
onPointerDownCapture: () => o.current = !0
|
|
100
|
+
};
|
|
194
101
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
})
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
102
|
+
function G(r, e = globalThis == null ? void 0 : globalThis.document) {
|
|
103
|
+
const i = w(r), o = n.useRef(!1);
|
|
104
|
+
return n.useEffect(() => {
|
|
105
|
+
const t = (a) => {
|
|
106
|
+
a.target && !o.current && B(H, i, { originalEvent: a }, {
|
|
107
|
+
discrete: !1
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
return e.addEventListener("focusin", t), () => e.removeEventListener("focusin", t);
|
|
111
|
+
}, [e, i]), {
|
|
112
|
+
onFocusCapture: () => o.current = !0,
|
|
113
|
+
onBlurCapture: () => o.current = !1
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function O() {
|
|
117
|
+
const r = new CustomEvent(p);
|
|
118
|
+
document.dispatchEvent(r);
|
|
119
|
+
}
|
|
120
|
+
function B(r, e, i, { discrete: o }) {
|
|
121
|
+
const t = i.originalEvent.target, a = new CustomEvent(r, { bubbles: !1, cancelable: !0, detail: i });
|
|
122
|
+
e && t.addEventListener(r, e, { once: !0 }), o ? k(t, a) : t.dispatchEvent(a);
|
|
208
123
|
}
|
|
209
|
-
var qe = U, Ge = G, Je = J, Ke = Q;
|
|
210
124
|
export {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
Je as Content,
|
|
214
|
-
U as Popper,
|
|
215
|
-
G as PopperAnchor,
|
|
216
|
-
Q as PopperArrow,
|
|
217
|
-
J as PopperContent,
|
|
218
|
-
qe as Root,
|
|
219
|
-
Ue as createPopperScope
|
|
125
|
+
M as DismissableLayer,
|
|
126
|
+
Y as DismissableLayerBranch
|
|
220
127
|
};
|
|
221
128
|
//# sourceMappingURL=index.es482.js.map
|