@plyaz/ui 0.4.2 → 0.4.3
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/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Form/LoginForm.d.ts.map +1 -1
- package/dist/types/components/Form/SignupForm.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/ui.cjs19.js +1 -1
- package/dist/ui.cjs20.js +1 -1
- package/dist/ui.cjs21.js +1 -1
- package/dist/ui.cjs30.js +1 -1
- package/dist/ui.cjs31.js +1 -1
- package/dist/ui.cjs32.js +1 -1
- package/dist/ui.cjs33.js +1 -1
- package/dist/ui.cjs34.js +1 -1
- package/dist/ui.cjs35.js +1 -1
- package/dist/ui.cjs36.js +1 -1
- package/dist/ui.cjs37.js +1 -1
- package/dist/ui.cjs38.js +1 -1
- package/dist/ui.cjs39.js +1 -1
- package/dist/ui.cjs40.js +1 -1
- package/dist/ui.cjs41.js +1 -1
- package/dist/ui.cjs42.js +1 -1
- package/dist/ui.cjs43.js +1 -1
- package/dist/ui.cjs44.js +1 -1
- package/dist/ui.cjs45.js +1 -1
- package/dist/ui.cjs46.js +1 -1
- package/dist/ui.cjs47.js +1 -1
- package/dist/ui.cjs48.js +1 -1
- package/dist/ui.cjs49.js +1 -1
- package/dist/ui.cjs50.js +1 -1
- package/dist/ui.cjs53.js +1 -1
- package/dist/ui.cjs55.js +1 -1
- package/dist/ui.cjs56.js +1 -1
- package/dist/ui.cjs66.js +1 -1
- package/dist/ui.cjs68.js +1 -1
- package/dist/ui.cjs73.js +1 -38
- package/dist/ui.cjs74.js +38 -1
- package/dist/ui.cjs75.js +1 -1
- package/dist/ui.cjs76.js +1 -1
- package/dist/ui.cjs77.js +1 -1
- package/dist/ui.es15.js +8 -2
- package/dist/ui.es19.js +1 -1
- package/dist/ui.es20.js +1 -1
- package/dist/ui.es21.js +20 -20
- package/dist/ui.es30.js +3 -26
- package/dist/ui.es31.js +5 -2727
- package/dist/ui.es32.js +45 -3
- package/dist/ui.es33.js +25 -5
- package/dist/ui.es34.js +50 -43
- package/dist/ui.es35.js +7 -52
- package/dist/ui.es36.js +124 -7
- package/dist/ui.es37.js +12 -122
- package/dist/ui.es38.js +134 -14
- package/dist/ui.es39.js +10 -134
- package/dist/ui.es40.js +217 -10
- package/dist/ui.es41.js +13 -217
- package/dist/ui.es42.js +34 -14
- package/dist/ui.es43.js +10 -33
- package/dist/ui.es44.js +51 -10
- package/dist/ui.es45.js +4 -52
- package/dist/ui.es46.js +6 -4
- package/dist/ui.es47.js +28 -6
- package/dist/ui.es48.js +50 -28
- package/dist/ui.es49.js +9 -50
- package/dist/ui.es50.js +2729 -9
- package/dist/ui.es53.js +1 -1
- package/dist/ui.es55.js +1 -1
- package/dist/ui.es56.js +1 -1
- package/dist/ui.es66.js +1 -1
- package/dist/ui.es68.js +4 -4
- package/dist/ui.es73.js +65 -69
- package/dist/ui.es74.js +68 -8
- package/dist/ui.es75.js +9 -14
- package/dist/ui.es76.js +14 -66
- package/dist/ui.es77.js +65 -64
- package/package.json +1 -1
package/dist/ui.es38.js
CHANGED
|
@@ -1,17 +1,137 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import * as d from "react";
|
|
2
|
+
import { useComposedRefs as P } from "./ui.es33.js";
|
|
3
|
+
import { Primitive as M } from "./ui.es42.js";
|
|
4
|
+
import { useCallbackRef as y } from "./ui.es43.js";
|
|
5
|
+
import { j as _ } from "./ui.es16.js";
|
|
6
|
+
var F = "focusScope.autoFocusOnMount", T = "focusScope.autoFocusOnUnmount", N = { bubbles: !1, cancelable: !0 }, K = "FocusScope", k = d.forwardRef((e, n) => {
|
|
7
|
+
const {
|
|
8
|
+
loop: t = !1,
|
|
9
|
+
trapped: u = !1,
|
|
10
|
+
onMountAutoFocus: p,
|
|
11
|
+
onUnmountAutoFocus: L,
|
|
12
|
+
...g
|
|
13
|
+
} = e, [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");
|
|
14
134
|
}
|
|
15
135
|
export {
|
|
16
|
-
|
|
136
|
+
k as FocusScope
|
|
17
137
|
};
|
package/dist/ui.es39.js
CHANGED
|
@@ -1,137 +1,13 @@
|
|
|
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 o from "react";
|
|
2
|
+
import { useLayoutEffect as a } from "./ui.es45.js";
|
|
3
|
+
var s = o[" useId ".trim().toString()] || (() => {
|
|
4
|
+
}), f = 0;
|
|
5
|
+
function i(t) {
|
|
6
|
+
const [e, r] = o.useState(s());
|
|
7
|
+
return a(() => {
|
|
8
|
+
r((u) => u ?? String(f++));
|
|
9
|
+
}, [t]), t || (e ? `radix-${e}` : "");
|
|
134
10
|
}
|
|
135
11
|
export {
|
|
136
|
-
|
|
12
|
+
i as useId
|
|
137
13
|
};
|
package/dist/ui.es40.js
CHANGED
|
@@ -1,13 +1,220 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import * as s from "react";
|
|
2
|
+
import { useFloating as xe, offset as Pe, shift as ye, flip as Ae, size as ve, arrow as Ce, hide as be, limitShift as Se } from "./ui.es54.js";
|
|
3
|
+
import { Root as Oe } from "./ui.es55.js";
|
|
4
|
+
import { useComposedRefs as T } from "./ui.es33.js";
|
|
5
|
+
import { createContextScope as Re } from "./ui.es34.js";
|
|
6
|
+
import { Primitive as z } from "./ui.es42.js";
|
|
7
|
+
import { useCallbackRef as Ee } from "./ui.es43.js";
|
|
8
|
+
import { useLayoutEffect as B } from "./ui.es45.js";
|
|
9
|
+
import { useSize as Ne } from "./ui.es56.js";
|
|
10
|
+
import { j as f } from "./ui.es16.js";
|
|
11
|
+
import { autoUpdate as _e } from "./ui.es57.js";
|
|
12
|
+
var N = "Popper", [L, Ue] = Re(N), [$e, Z] = L(N), U = (e) => {
|
|
13
|
+
const { __scopePopper: i, children: n } = e, [t, a] = s.useState(null);
|
|
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;
|
|
29
|
+
const {
|
|
30
|
+
__scopePopper: n,
|
|
31
|
+
side: t = "bottom",
|
|
32
|
+
sideOffset: a = 0,
|
|
33
|
+
align: r = "center",
|
|
34
|
+
alignOffset: o = 0,
|
|
35
|
+
arrowPadding: w = 0,
|
|
36
|
+
avoidCollisions: p = !0,
|
|
37
|
+
collisionBoundary: c = [],
|
|
38
|
+
collisionPadding: x = 0,
|
|
39
|
+
sticky: m = "partial",
|
|
40
|
+
hideWhenDetached: y = !1,
|
|
41
|
+
updatePositionStrategy: A = "optimized",
|
|
42
|
+
onPlaced: l,
|
|
43
|
+
...d
|
|
44
|
+
} = e, v = Z(_, n), [h, C] = s.useState(null), ee = T(i, (P) => C(P)), [E, te] = s.useState(null), g = Ne(E), re = (g == null ? void 0 : g.width) ?? 0, $ = (g == null ? void 0 : g.height) ?? 0, oe = t + (r !== "center" ? "-" + r : ""), ne = typeof x == "number" ? x : { top: 0, right: 0, bottom: 0, left: 0, ...x }, j = Array.isArray(c) ? c : [c], ae = j.length > 0, b = {
|
|
45
|
+
padding: ne,
|
|
46
|
+
boundary: j.filter(Ie),
|
|
47
|
+
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
48
|
+
altBoundary: ae
|
|
49
|
+
}, { refs: ie, floatingStyles: H, placement: se, isPositioned: S, middlewareData: u } = xe({
|
|
50
|
+
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
51
|
+
strategy: "fixed",
|
|
52
|
+
placement: oe,
|
|
53
|
+
whileElementsMounted: (...P) => _e(...P, {
|
|
54
|
+
animationFrame: A === "always"
|
|
55
|
+
}),
|
|
56
|
+
elements: {
|
|
57
|
+
reference: v.anchor
|
|
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",
|
|
88
|
+
{
|
|
89
|
+
ref: ie.setFloating,
|
|
90
|
+
"data-radix-popper-content-wrapper": "",
|
|
91
|
+
style: {
|
|
92
|
+
...H,
|
|
93
|
+
transform: S ? H.transform : "translate(0, -200%)",
|
|
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
|
+
}
|
|
108
|
+
},
|
|
109
|
+
dir: e.dir,
|
|
110
|
+
children: /* @__PURE__ */ f.jsx(
|
|
111
|
+
je,
|
|
112
|
+
{
|
|
113
|
+
scope: n,
|
|
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
|
+
}
|
|
135
|
+
)
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
J.displayName = _;
|
|
141
|
+
var K = "PopperArrow", We = {
|
|
142
|
+
top: "bottom",
|
|
143
|
+
right: "left",
|
|
144
|
+
bottom: "top",
|
|
145
|
+
left: "right"
|
|
146
|
+
}, Q = s.forwardRef(function(i, n) {
|
|
147
|
+
const { __scopePopper: t, ...a } = i, r = He(K, t), o = We[r.placedSide];
|
|
148
|
+
return (
|
|
149
|
+
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
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
|
+
);
|
|
190
|
+
});
|
|
191
|
+
Q.displayName = K;
|
|
192
|
+
function Ie(e) {
|
|
193
|
+
return e !== null;
|
|
194
|
+
}
|
|
195
|
+
var Ye = (e) => ({
|
|
196
|
+
name: "transformOrigin",
|
|
197
|
+
options: e,
|
|
198
|
+
fn(i) {
|
|
199
|
+
var v, h, C;
|
|
200
|
+
const { placement: n, rects: t, middlewareData: a } = i, o = ((v = a.arrow) == null ? void 0 : v.centerOffset) !== 0, w = o ? 0 : e.arrowWidth, p = o ? 0 : e.arrowHeight, [c, x] = V(n), m = { start: "0%", center: "50%", end: "100%" }[x], y = (((h = a.arrow) == null ? void 0 : h.x) ?? 0) + w / 2, A = (((C = a.arrow) == null ? void 0 : C.y) ?? 0) + p / 2;
|
|
201
|
+
let l = "", d = "";
|
|
202
|
+
return c === "bottom" ? (l = o ? m : `${y}px`, d = `${-p}px`) : c === "top" ? (l = o ? m : `${y}px`, d = `${t.floating.height + p}px`) : c === "right" ? (l = `${-p}px`, d = o ? m : `${A}px`) : c === "left" && (l = `${t.floating.width + p}px`, d = o ? m : `${A}px`), { data: { x: l, y: d } };
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
function V(e) {
|
|
206
|
+
const [i, n = "center"] = e.split("-");
|
|
207
|
+
return [i, n];
|
|
10
208
|
}
|
|
209
|
+
var qe = U, Ge = G, Je = J, Ke = Q;
|
|
11
210
|
export {
|
|
12
|
-
|
|
211
|
+
Ge as Anchor,
|
|
212
|
+
Ke as Arrow,
|
|
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
|
|
13
220
|
};
|