@yselimcan/ui 0.0.6 → 0.0.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/index100.js +4 -32
- package/dist/index101.js +67 -19
- package/dist/index102.js +8 -5
- package/dist/index103.js +14 -4
- package/dist/index104.js +4 -5
- package/dist/index105.js +3 -11
- package/dist/index106.js +5 -18
- package/dist/index107.js +30 -13
- package/dist/index108.js +11 -296
- package/dist/index109.js +66 -4
- package/dist/index110.js +52 -37
- package/dist/index111.js +10 -123
- package/dist/index112.js +5 -4
- package/dist/index113.js +12 -20
- package/dist/index114.js +12 -76
- package/dist/index115.js +29 -61
- package/dist/index116.js +19 -46
- package/dist/index117.js +38 -64
- package/dist/index118.js +18 -8
- package/dist/index119.js +11 -13
- package/dist/index120.js +38 -4
- package/dist/index121.js +14 -4
- package/dist/index122.js +8 -5
- package/dist/index123.js +13 -134
- package/dist/index124.js +5 -27
- package/dist/index125.js +87 -8
- package/dist/index126.js +296 -4
- package/dist/index127.js +11 -12
- package/dist/index128.js +121 -18
- package/dist/index129.js +5 -14
- package/dist/index130.js +263 -5
- package/dist/index131.js +77 -27
- package/dist/index132.js +38 -17
- package/dist/index133.js +21 -22
- package/dist/index134.js +11 -58
- package/dist/index135.js +55 -16
- package/dist/index136.js +11 -27
- package/dist/index137.js +11 -40
- package/dist/index138.js +31 -43
- package/dist/index139.js +16 -19
- package/dist/index140.js +65 -47
- package/dist/index141.js +97 -44
- package/dist/index142.js +8 -17
- package/dist/index143.js +8 -11
- package/dist/index144.js +2 -2
- package/dist/index145.js +102 -34
- package/dist/index146.js +7 -230
- package/dist/index147.js +31 -282
- package/dist/index148.js +230 -53
- package/dist/index149.js +74 -15
- package/dist/index150.js +275 -71
- package/dist/index151.js +53 -3
- package/dist/index152.js +43 -28
- package/dist/index153.js +77 -24
- package/dist/index154.js +3 -15
- package/dist/index155.js +12 -67
- package/dist/index156.js +16 -4
- package/dist/index157.js +27 -103
- package/dist/index158.js +7 -79
- package/dist/index159.js +19 -260
- package/dist/index160.js +25 -12
- package/dist/index161.js +159 -9
- package/dist/index162.js +111 -38
- package/dist/index163.js +64 -4
- package/dist/index164.js +75 -66
- package/dist/index165.js +65 -10
- package/dist/index166.js +69 -8
- package/dist/index167.js +14 -6
- package/dist/index168.js +6 -52
- package/dist/index169.js +4 -10
- package/dist/index17.js +4 -4
- package/dist/index170.js +16 -116
- package/dist/index171.js +20 -10
- package/dist/index172.js +58 -11
- package/dist/index173.js +16 -65
- package/dist/index174.js +26 -11
- package/dist/index175.js +42 -12
- package/dist/index176.js +20 -11
- package/dist/index177.js +48 -11
- package/dist/index178.js +47 -83
- package/dist/index179.js +17 -11
- package/dist/index18.js +4 -4
- package/dist/index180.js +11 -11
- package/dist/index181.js +34 -55
- package/dist/index182.js +15 -11
- package/dist/index183.js +79 -11
- package/dist/index184.js +23 -18
- package/dist/index185.js +4 -9
- package/dist/index186.js +10 -7
- package/dist/index187.js +10 -103
- package/dist/index188.js +40 -7
- package/dist/index189.js +4 -32
- package/dist/index19.js +9 -9
- package/dist/index190.js +10 -75
- package/dist/index191.js +11 -14
- package/dist/index192.js +114 -25
- package/dist/index193.js +11 -7
- package/dist/index194.js +85 -20
- package/dist/index195.js +12 -24
- package/dist/index196.js +59 -157
- package/dist/index197.js +4 -114
- package/dist/index198.js +5 -76
- package/dist/index199.js +11 -64
- package/dist/index20.js +2 -2
- package/dist/index200.js +5 -47
- package/dist/index201.js +21 -199
- package/dist/index202.js +4 -48
- package/dist/index203.js +27 -20
- package/dist/index204.js +127 -26
- package/dist/index205.js +45 -6
- package/dist/index206.js +18 -10
- package/dist/index207.js +5 -12
- package/dist/index208.js +179 -15
- package/dist/index209.js +75 -6
- package/dist/index21.js +3 -3
- package/dist/index210.js +399 -4
- package/dist/index211.js +199 -21
- package/dist/index212.js +46 -126
- package/dist/index213.js +18 -43
- package/dist/index214.js +47 -17
- package/dist/index215.js +7 -5
- package/dist/index216.js +5 -181
- package/dist/index217.js +15 -74
- package/dist/index218.js +12 -396
- package/dist/index219.js +33 -4
- package/dist/index22.js +5 -5
- package/dist/index220.js +4 -5
- package/dist/index221.js +11 -14
- package/dist/index222.js +7 -30
- package/dist/index223.js +1 -1
- package/dist/index224.js +2 -2
- package/dist/index225.js +1 -1
- package/dist/index227.js +1 -1
- package/dist/index228.js +1 -1
- package/dist/index229.js +1 -1
- package/dist/index23.js +2 -2
- package/dist/index231.js +1 -1
- package/dist/index233.js +1 -1
- package/dist/index234.js +28 -28
- package/dist/index235.js +1 -1
- package/dist/index236.js +4 -209
- package/dist/index237.js +209 -4
- package/dist/index238.js +3 -13
- package/dist/index239.js +13 -47
- package/dist/index24.js +9 -9
- package/dist/index240.js +47 -3
- package/dist/index242.js +3 -3
- package/dist/index243.js +2 -2
- package/dist/index246.js +2 -2
- package/dist/index247.js +1 -1
- package/dist/index251.js +1 -1
- package/dist/index253.js +1 -1
- package/dist/index256.js +1 -1
- package/dist/index257.js +1 -1
- package/dist/index260.js +1 -1
- package/dist/index261.js +1 -1
- package/dist/index262.js +2 -2
- package/dist/index264.js +2 -2
- package/dist/index27.js +1 -1
- package/dist/index28.js +1 -1
- package/dist/index33.js +11 -11
- package/dist/index34.js +2 -2
- package/dist/index35.js +9 -9
- package/dist/index36.js +7 -7
- package/dist/index37.js +3 -3
- package/dist/index38.js +5 -5
- package/dist/index39.js +3 -3
- package/dist/index41.js +2 -2
- package/dist/index45.js +2 -2
- package/dist/index46.js +4 -4
- package/dist/index47.js +5 -5
- package/dist/index48.js +15 -15
- package/dist/index49.js +2 -2
- package/dist/index50.js +9 -9
- package/dist/index52.js +24 -24
- package/dist/index53.js +3 -3
- package/dist/index54.js +31 -31
- package/dist/index55.js +13 -13
- package/dist/index56.js +12 -12
- package/dist/index57.js +1 -1
- package/dist/index58.js +3 -3
- package/dist/index59.js +5 -5
- package/dist/index60.js +11 -11
- package/dist/index61.js +4 -4
- package/dist/index62.js +3 -3
- package/dist/index63.js +11 -11
- package/dist/index64.js +4 -4
- package/dist/index65.js +3 -3
- package/dist/index66.js +13 -13
- package/dist/index67.js +1 -1
- package/dist/index69.js +31 -31
- package/dist/index70.js +5 -5
- package/dist/index71.js +17 -17
- package/dist/index72.js +23 -23
- package/dist/index73.js +7 -7
- package/dist/index74.js +1 -1
- package/dist/index75.js +13 -13
- package/dist/index76.js +2 -2
- package/dist/index77.js +4 -4
- package/dist/index78.js +3 -3
- package/dist/index79.js +1 -1
- package/dist/index80.js +1 -1
- package/dist/index81.js +17 -17
- package/dist/index82.js +4 -4
- package/dist/index83.js +4 -4
- package/dist/index86.js +89 -11
- package/dist/index87.js +8 -8
- package/dist/index88.js +12 -96
- package/dist/index89.js +87 -81
- package/dist/index94.js +133 -7
- package/dist/index95.js +26 -86
- package/dist/index96.js +8 -12
- package/dist/index97.js +5 -63
- package/dist/index98.js +13 -38
- package/dist/index99.js +23 -14
- package/package.json +5 -2
package/dist/index100.js
CHANGED
|
@@ -1,35 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const l = s;
|
|
5
|
-
return {
|
|
6
|
-
reason: e,
|
|
7
|
-
event: t ?? new Event("base-ui"),
|
|
8
|
-
cancel() {
|
|
9
|
-
a = !0;
|
|
10
|
-
},
|
|
11
|
-
allowPropagation() {
|
|
12
|
-
r = !0;
|
|
13
|
-
},
|
|
14
|
-
get isCanceled() {
|
|
15
|
-
return a;
|
|
16
|
-
},
|
|
17
|
-
get isPropagationAllowed() {
|
|
18
|
-
return r;
|
|
19
|
-
},
|
|
20
|
-
trigger: n,
|
|
21
|
-
...l
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
function d(e, t, n) {
|
|
25
|
-
const o = n ?? s;
|
|
26
|
-
return {
|
|
27
|
-
reason: e,
|
|
28
|
-
event: t ?? new Event("base-ui"),
|
|
29
|
-
...o
|
|
30
|
-
};
|
|
1
|
+
function o(r, ...a) {
|
|
2
|
+
const e = new URL(`https://base-ui.com/production-error/${r}`);
|
|
3
|
+
return a.forEach((s) => e.searchParams.append("args[]", s)), `Base UI error #${r}; visit ${e} for the full message.`;
|
|
31
4
|
}
|
|
32
5
|
export {
|
|
33
|
-
|
|
34
|
-
d as createGenericEventDetails
|
|
6
|
+
o as default
|
|
35
7
|
};
|
package/dist/index101.js
CHANGED
|
@@ -1,21 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
import { useRefWithInit as r } from "./index168.js";
|
|
2
|
+
function b(n, e, c, t) {
|
|
3
|
+
const l = r(i).current;
|
|
4
|
+
return s(l, n, e, c, t) && o(l, [n, e, c, t]), l.callback;
|
|
5
|
+
}
|
|
6
|
+
function h(n) {
|
|
7
|
+
const e = r(i).current;
|
|
8
|
+
return f(e, n) && o(e, n), e.callback;
|
|
9
|
+
}
|
|
10
|
+
function i() {
|
|
11
|
+
return {
|
|
12
|
+
callback: null,
|
|
13
|
+
cleanup: null,
|
|
14
|
+
refs: []
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function s(n, e, c, t, l) {
|
|
18
|
+
return n.refs[0] !== e || n.refs[1] !== c || n.refs[2] !== t || n.refs[3] !== l;
|
|
19
|
+
}
|
|
20
|
+
function f(n, e) {
|
|
21
|
+
return n.refs.length !== e.length || n.refs.some((c, t) => c !== e[t]);
|
|
22
|
+
}
|
|
23
|
+
function o(n, e) {
|
|
24
|
+
if (n.refs = e, e.every((c) => c == null)) {
|
|
25
|
+
n.callback = null;
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
n.callback = (c) => {
|
|
29
|
+
if (n.cleanup && (n.cleanup(), n.cleanup = null), c != null) {
|
|
30
|
+
const t = Array(e.length).fill(null);
|
|
31
|
+
for (let l = 0; l < e.length; l += 1) {
|
|
32
|
+
const u = e[l];
|
|
33
|
+
if (u != null)
|
|
34
|
+
switch (typeof u) {
|
|
35
|
+
case "function": {
|
|
36
|
+
const a = u(c);
|
|
37
|
+
typeof a == "function" && (t[l] = a);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "object": {
|
|
41
|
+
u.current = c;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
n.cleanup = () => {
|
|
47
|
+
for (let l = 0; l < e.length; l += 1) {
|
|
48
|
+
const u = e[l];
|
|
49
|
+
if (u != null)
|
|
50
|
+
switch (typeof u) {
|
|
51
|
+
case "function": {
|
|
52
|
+
const a = t[l];
|
|
53
|
+
typeof a == "function" ? a() : u(null);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "object": {
|
|
57
|
+
u.current = null;
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
2
66
|
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
r as clearPress,
|
|
6
|
-
i as closePress,
|
|
7
|
-
u as escapeKey,
|
|
8
|
-
l as focusOut,
|
|
9
|
-
h as imperativeAction,
|
|
10
|
-
g as inputChange,
|
|
11
|
-
a as inputClear,
|
|
12
|
-
c as itemPress,
|
|
13
|
-
v as listNavigation,
|
|
14
|
-
e as none,
|
|
15
|
-
o as outsidePress,
|
|
16
|
-
P as siblingOpen,
|
|
17
|
-
t as triggerFocus,
|
|
18
|
-
n as triggerHover,
|
|
19
|
-
s as triggerPress,
|
|
20
|
-
d as windowResize
|
|
67
|
+
b as useMergedRefs,
|
|
68
|
+
h as useMergedRefsN
|
|
21
69
|
};
|
package/dist/index102.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
function
|
|
4
|
-
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { isReactVersionAtLeast as o } from "./index200.js";
|
|
3
|
+
function s(t) {
|
|
4
|
+
if (!/* @__PURE__ */ n.isValidElement(t))
|
|
5
|
+
return null;
|
|
6
|
+
const e = t, r = e.props;
|
|
7
|
+
return (o(19) ? r?.ref : e.ref) ?? null;
|
|
5
8
|
}
|
|
6
9
|
export {
|
|
7
|
-
|
|
10
|
+
s as getReactElementRef
|
|
8
11
|
};
|
package/dist/index103.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
function i(r, n) {
|
|
2
|
+
const o = {};
|
|
3
|
+
for (const t in r) {
|
|
4
|
+
const e = r[t];
|
|
5
|
+
if (n?.hasOwnProperty(t)) {
|
|
6
|
+
const s = n[t](e);
|
|
7
|
+
s != null && Object.assign(o, s);
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
e === !0 ? o[`data-${t.toLowerCase()}`] = "" : e && (o[`data-${t.toLowerCase()}`] = e.toString());
|
|
11
|
+
}
|
|
12
|
+
return o;
|
|
13
|
+
}
|
|
4
14
|
export {
|
|
5
|
-
|
|
15
|
+
i as getStateAttributesProps
|
|
6
16
|
};
|
package/dist/index104.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
})({});
|
|
1
|
+
function t(n, o) {
|
|
2
|
+
return typeof n == "function" ? n(o) : n;
|
|
3
|
+
}
|
|
5
4
|
export {
|
|
6
|
-
|
|
5
|
+
t as resolveClassName
|
|
7
6
|
};
|
package/dist/index105.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const e = /* @__PURE__ */ t.createContext(void 0);
|
|
4
|
-
process.env.NODE_ENV !== "production" && (e.displayName = "DialogPortalContext");
|
|
5
|
-
function a() {
|
|
6
|
-
const o = t.useContext(e);
|
|
7
|
-
if (o === void 0)
|
|
8
|
-
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Dialog.Portal> is missing." : r(26));
|
|
9
|
-
return o;
|
|
1
|
+
function e(n, o) {
|
|
2
|
+
return typeof n == "function" ? n(o) : n;
|
|
10
3
|
}
|
|
11
4
|
export {
|
|
12
|
-
e as
|
|
13
|
-
a as useDialogPortalContext
|
|
5
|
+
e as resolveStyle
|
|
14
6
|
};
|
package/dist/index106.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import * as a from "react";
|
|
3
|
-
import { useStableCallback as f } from "./index124.js";
|
|
4
|
-
import { useValueAsRef as p } from "./index132.js";
|
|
5
|
-
import { useAnimationsFinished as u } from "./index204.js";
|
|
6
|
-
function b(i) {
|
|
7
|
-
const {
|
|
8
|
-
enabled: n = !0,
|
|
9
|
-
open: e,
|
|
10
|
-
ref: s,
|
|
11
|
-
onComplete: m
|
|
12
|
-
} = i, o = p(e), t = f(m), r = u(s, e);
|
|
13
|
-
a.useEffect(() => {
|
|
14
|
-
n && r(() => {
|
|
15
|
-
e === o.current && t();
|
|
16
|
-
});
|
|
17
|
-
}, [n, e, t, r, o]);
|
|
1
|
+
function e() {
|
|
18
2
|
}
|
|
3
|
+
const t = Object.freeze([]), c = Object.freeze({});
|
|
19
4
|
export {
|
|
20
|
-
|
|
5
|
+
t as EMPTY_ARRAY,
|
|
6
|
+
c as EMPTY_OBJECT,
|
|
7
|
+
e as NOOP
|
|
21
8
|
};
|
package/dist/index107.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
function d({
|
|
4
|
+
controlled: o,
|
|
5
|
+
default: s,
|
|
6
|
+
name: t,
|
|
7
|
+
state: i = "value"
|
|
8
|
+
}) {
|
|
9
|
+
const {
|
|
10
|
+
current: e
|
|
11
|
+
} = n.useRef(o !== void 0), [l, c] = n.useState(s), u = e ? o : l;
|
|
12
|
+
if (process.env.NODE_ENV !== "production") {
|
|
13
|
+
n.useEffect(() => {
|
|
14
|
+
e !== (o !== void 0) && console.error([`Base UI: A component is changing the ${e ? "" : "un"}controlled ${i} state of ${t} to be ${e ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${t} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join(`
|
|
15
|
+
`));
|
|
16
|
+
}, [i, t, o]);
|
|
17
|
+
const {
|
|
18
|
+
current: r
|
|
19
|
+
} = n.useRef(s);
|
|
20
|
+
n.useEffect(() => {
|
|
21
|
+
!e && JSON.stringify(r) !== JSON.stringify(s) && console.error([`Base UI: A component is changing the default ${i} state of an uncontrolled ${t} after being initialized. To suppress this warning opt to use a controlled ${t}.`].join(`
|
|
22
|
+
`));
|
|
23
|
+
}, [JSON.stringify(s)]);
|
|
24
|
+
}
|
|
25
|
+
const f = n.useCallback((r) => {
|
|
26
|
+
e || c(r);
|
|
27
|
+
}, []);
|
|
28
|
+
return [u, f];
|
|
29
|
+
}
|
|
4
30
|
export {
|
|
5
|
-
|
|
6
|
-
O as ARROW_KEYS,
|
|
7
|
-
o as ARROW_LEFT,
|
|
8
|
-
R as ARROW_RIGHT,
|
|
9
|
-
t as ARROW_UP,
|
|
10
|
-
s as COMPOSITE_KEYS,
|
|
11
|
-
c as END,
|
|
12
|
-
e as HOME,
|
|
13
|
-
E as HORIZONTAL_KEYS,
|
|
14
|
-
A as VERTICAL_KEYS
|
|
31
|
+
d as useControlled
|
|
15
32
|
};
|
package/dist/index108.js
CHANGED
|
@@ -1,299 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import { useTimeout as ye } from "./index152.js";
|
|
11
|
-
import { useAnimationFrame as $e } from "./index164.js";
|
|
12
|
-
import { FocusGuard as Te } from "./index195.js";
|
|
13
|
-
import { createChangeEventDetails as ze } from "./index100.js";
|
|
14
|
-
import { createAttribute as Fe } from "./index237.js";
|
|
15
|
-
import { enqueueFocus as te } from "./index238.js";
|
|
16
|
-
import { markOthers as Je } from "./index239.js";
|
|
17
|
-
import { usePortalContext as Qe } from "./index111.js";
|
|
18
|
-
import { useFloatingTree as Xe } from "./index181.js";
|
|
19
|
-
import { CLICK_TRIGGER_IDENTIFIER as Ye } from "./index113.js";
|
|
20
|
-
import { resolveRef as D } from "./index240.js";
|
|
21
|
-
import { jsxs as Ze, jsx as xe } from "react/jsx-runtime";
|
|
22
|
-
import { isTypeableCombobox as he, getFloatingFocusElement as Ie, getDocument as I, activeElement as V, contains as m, getTarget as W } from "./index155.js";
|
|
23
|
-
import { getTabbableOptions as re, isOutsideEvent as Le, getNextTabbable as et, getPreviousTabbable as tt } from "./index199.js";
|
|
24
|
-
import { getNodeAncestors as ke, getNodeChildren as Ce } from "./index241.js";
|
|
25
|
-
import { isVirtualClick as nt, isVirtualPointerEvent as rt, stopEvent as ot } from "./index225.js";
|
|
26
|
-
import { triggerHover as st, outsidePress as ut, focusOut as it } from "./index101.js";
|
|
27
|
-
function ct(n, p) {
|
|
28
|
-
const h = _e(n.target);
|
|
29
|
-
return n instanceof h.KeyboardEvent ? "keyboard" : n instanceof h.FocusEvent ? p || "keyboard" : "pointerType" in n ? n.pointerType || "keyboard" : "touches" in n ? "touch" : n instanceof h.MouseEvent ? p || (n.detail === 0 ? "keyboard" : "mouse") : "";
|
|
30
|
-
}
|
|
31
|
-
const Ae = 20;
|
|
32
|
-
let L = [];
|
|
33
|
-
function oe() {
|
|
34
|
-
L = L.filter((n) => n.isConnected);
|
|
35
|
-
}
|
|
36
|
-
function at(n) {
|
|
37
|
-
oe(), n && He(n) !== "body" && (L.push(n), L.length > Ae && (L = L.slice(-Ae)));
|
|
38
|
-
}
|
|
39
|
-
function ne() {
|
|
40
|
-
return oe(), L[L.length - 1];
|
|
41
|
-
}
|
|
42
|
-
function ft(n) {
|
|
43
|
-
if (!n)
|
|
44
|
-
return null;
|
|
45
|
-
const p = re();
|
|
46
|
-
return De(n, p) ? n : we(n, p)[0] || n;
|
|
47
|
-
}
|
|
48
|
-
function lt(n) {
|
|
49
|
-
return !n || !n.isConnected ? !1 : typeof n.checkVisibility == "function" ? n.checkVisibility() : Ue(n).display !== "none";
|
|
50
|
-
}
|
|
51
|
-
function Oe(n, p) {
|
|
52
|
-
if (!p.current.includes("floating") && !n.getAttribute("role")?.includes("dialog"))
|
|
53
|
-
return;
|
|
54
|
-
const h = re(), $ = Ke(n, h).filter((S) => {
|
|
55
|
-
const P = S.getAttribute("data-tabindex") || "";
|
|
56
|
-
return De(S, h) || S.hasAttribute("data-tabindex") && !P.startsWith("-");
|
|
57
|
-
}), N = n.getAttribute("tabindex");
|
|
58
|
-
p.current.includes("floating") || $.length === 0 ? N !== "0" && n.setAttribute("tabindex", "0") : (N !== "-1" || n.hasAttribute("data-tabindex") && n.getAttribute("data-tabindex") !== "-1") && (n.setAttribute("tabindex", "-1"), n.setAttribute("data-tabindex", "-1"));
|
|
59
|
-
}
|
|
60
|
-
function Mt(n) {
|
|
61
|
-
const {
|
|
62
|
-
context: p,
|
|
63
|
-
children: h,
|
|
64
|
-
disabled: i = !1,
|
|
65
|
-
order: $ = ["content"],
|
|
66
|
-
initialFocus: N = !0,
|
|
67
|
-
returnFocus: S = !0,
|
|
68
|
-
restoreFocus: P = !1,
|
|
69
|
-
modal: E = !0,
|
|
70
|
-
closeOnFocusOut: M = !0,
|
|
71
|
-
openInteractionType: Ne = "",
|
|
72
|
-
getInsideElements: Se = () => [],
|
|
73
|
-
nextFocusableElement: z,
|
|
74
|
-
previousFocusableElement: J,
|
|
75
|
-
beforeContentFocusGuardRef: Pe,
|
|
76
|
-
externalTree: Me
|
|
77
|
-
} = n, F = "rootStore" in p ? p.rootStore : p, v = F.useState("open"), a = F.useState("domReferenceElement"), f = F.useState("floatingElement"), {
|
|
78
|
-
events: Q,
|
|
79
|
-
dataRef: k
|
|
80
|
-
} = F.context, O = _(() => k.current.floatingContext?.nodeId), se = _(Se), ue = N === !1, x = he(a) && ue, C = H($), ie = H(N), j = H(S), ce = H(Ne), R = Xe(Me), c = Qe(), Ge = b.useRef(null), qe = b.useRef(null), y = b.useRef(!1), B = b.useRef(!1), X = b.useRef(!1), ae = b.useRef(-1), fe = b.useRef(""), Y = b.useRef(""), le = ye(), de = ye(), be = $e(), Z = c != null, r = Ie(f), A = _((t = r) => t ? we(t, re()) : []), G = _((t) => {
|
|
81
|
-
const o = A(t);
|
|
82
|
-
return C.current.map(() => o).filter(Boolean).flat();
|
|
83
|
-
});
|
|
84
|
-
b.useEffect(() => {
|
|
85
|
-
if (i || !E)
|
|
86
|
-
return;
|
|
87
|
-
function t(l) {
|
|
88
|
-
l.key === "Tab" && m(r, V(I(r))) && A().length === 0 && !x && ot(l);
|
|
89
|
-
}
|
|
90
|
-
const o = I(r);
|
|
91
|
-
return o.addEventListener("keydown", t), () => {
|
|
92
|
-
o.removeEventListener("keydown", t);
|
|
93
|
-
};
|
|
94
|
-
}, [i, a, r, E, C, x, A, G]), b.useEffect(() => {
|
|
95
|
-
if (i || !f)
|
|
96
|
-
return;
|
|
97
|
-
function t(o) {
|
|
98
|
-
const l = W(o), d = A().indexOf(l);
|
|
99
|
-
d !== -1 && (ae.current = d);
|
|
100
|
-
}
|
|
101
|
-
return f.addEventListener("focusin", t), () => {
|
|
102
|
-
f.removeEventListener("focusin", t);
|
|
103
|
-
};
|
|
104
|
-
}, [i, f, A]), b.useEffect(() => {
|
|
105
|
-
if (i || !v)
|
|
106
|
-
return;
|
|
107
|
-
const t = I(r);
|
|
108
|
-
function o() {
|
|
109
|
-
X.current = !1;
|
|
110
|
-
}
|
|
111
|
-
function l(d) {
|
|
112
|
-
const e = W(d), s = m(f, e) || m(a, e) || m(c?.portalNode, e);
|
|
113
|
-
X.current = !s, Y.current = d.pointerType || "keyboard";
|
|
114
|
-
}
|
|
115
|
-
function u() {
|
|
116
|
-
Y.current = "keyboard";
|
|
117
|
-
}
|
|
118
|
-
return t.addEventListener("pointerdown", l, !0), t.addEventListener("pointerup", o, !0), t.addEventListener("pointercancel", o, !0), t.addEventListener("keydown", u, !0), () => {
|
|
119
|
-
t.removeEventListener("pointerdown", l, !0), t.removeEventListener("pointerup", o, !0), t.removeEventListener("pointercancel", o, !0), t.removeEventListener("keydown", u, !0);
|
|
120
|
-
};
|
|
121
|
-
}, [i, f, a, r, v, c]), b.useEffect(() => {
|
|
122
|
-
if (i || !M)
|
|
123
|
-
return;
|
|
124
|
-
function t() {
|
|
125
|
-
B.current = !0, de.start(0, () => {
|
|
126
|
-
B.current = !1;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function o(e) {
|
|
130
|
-
const s = e.relatedTarget, w = e.currentTarget, g = W(e);
|
|
131
|
-
queueMicrotask(() => {
|
|
132
|
-
const K = O(), ge = F.context.triggerElements, Be = !(m(a, s) || m(f, s) || m(s, f) || m(c?.portalNode, s) || s != null && ge.hasElement(s) || ge.hasMatchingElement((T) => m(T, s)) || s?.hasAttribute(Fe("focus-guard")) || R && (Ce(R.nodesRef.current, K).find((T) => m(T.context?.elements.floating, s) || m(T.context?.elements.domReference, s)) || ke(R.nodesRef.current, K).find((T) => [T.context?.elements.floating, Ie(T.context?.elements.floating)].includes(s) || T.context?.elements.domReference === s)));
|
|
133
|
-
if (w === a && r && Oe(r, C), P && w !== a && !lt(g) && V(I(r)) === I(r).body) {
|
|
134
|
-
if (q(r) && (r.focus(), P === "popup")) {
|
|
135
|
-
be.request(() => {
|
|
136
|
-
r.focus();
|
|
137
|
-
});
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
const T = ae.current, ee = A(), ve = ee[T] || ee[ee.length - 1] || r;
|
|
141
|
-
q(ve) && ve.focus();
|
|
142
|
-
}
|
|
143
|
-
if (k.current.insideReactTree) {
|
|
144
|
-
k.current.insideReactTree = !1;
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
(x || !E) && s && Be && !B.current && // Fix React 18 Strict Mode returnFocus due to double rendering.
|
|
148
|
-
// For an "untrapped" typeable combobox (input role=combobox with
|
|
149
|
-
// initialFocus=false), re-opening the popup and tabbing out should still close it even
|
|
150
|
-
// when the previously focused element (e.g. the next tabbable outside the popup) is
|
|
151
|
-
// focused again. Otherwise, the popup remains open on the second Tab sequence:
|
|
152
|
-
// click input -> Tab (closes) -> click input -> Tab.
|
|
153
|
-
// Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element.
|
|
154
|
-
(x || s !== ne()) && (y.current = !0, F.setOpen(!1, ze(it, e)));
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
function l() {
|
|
158
|
-
X.current || (k.current.insideReactTree = !0, le.start(0, () => {
|
|
159
|
-
k.current.insideReactTree = !1;
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
const u = q(a) ? a : null, d = [];
|
|
163
|
-
if (!(!f && !u))
|
|
164
|
-
return u && (u.addEventListener("focusout", o), u.addEventListener("pointerdown", t), d.push(() => {
|
|
165
|
-
u.removeEventListener("focusout", o), u.removeEventListener("pointerdown", t);
|
|
166
|
-
})), f && (f.addEventListener("focusout", o), c && (f.addEventListener("focusout", l, !0), d.push(() => {
|
|
167
|
-
f.removeEventListener("focusout", l, !0);
|
|
168
|
-
})), d.push(() => {
|
|
169
|
-
f.removeEventListener("focusout", o);
|
|
170
|
-
})), () => {
|
|
171
|
-
d.forEach((e) => {
|
|
172
|
-
e();
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
}, [i, a, f, r, E, R, c, F, M, P, A, x, O, C, k, le, de, be]);
|
|
176
|
-
const me = b.useRef(null), pe = b.useRef(null), Ve = Re(me, Pe, c?.beforeInsideRef), je = Re(pe, c?.afterInsideRef);
|
|
177
|
-
b.useEffect(() => {
|
|
178
|
-
if (i || !f || !v)
|
|
179
|
-
return;
|
|
180
|
-
const t = Array.from(c?.portalNode?.querySelectorAll(`[${Fe("portal")}]`) || []), l = (R ? ke(R.nodesRef.current, O()) : []).find((e) => he(e.context?.elements.domReference || null))?.context?.elements.domReference, u = [f, l, ...t, ...se(), Ge.current, qe.current, me.current, pe.current, c?.beforeOutsideRef.current, c?.afterOutsideRef.current, D(J), D(z), x ? a : null].filter((e) => e != null), d = Je(u, E || x);
|
|
181
|
-
return () => {
|
|
182
|
-
d();
|
|
183
|
-
};
|
|
184
|
-
}, [v, i, a, f, E, C, c, x, R, O, se, z, J]), U(() => {
|
|
185
|
-
if (!v || i || !q(r))
|
|
186
|
-
return;
|
|
187
|
-
const t = I(r), o = V(t);
|
|
188
|
-
queueMicrotask(() => {
|
|
189
|
-
const l = G(r), u = ie.current, d = typeof u == "function" ? u(ce.current || "") : u;
|
|
190
|
-
if (d === void 0 || d === !1)
|
|
191
|
-
return;
|
|
192
|
-
let e;
|
|
193
|
-
d === !0 || d === null ? e = l[0] || r : e = D(d), e = e || l[0] || r, !m(r, o) && te(e, {
|
|
194
|
-
preventScroll: e === r
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
}, [i, v, r, ue, G, ie, ce]), U(() => {
|
|
198
|
-
if (i || !r)
|
|
199
|
-
return;
|
|
200
|
-
const t = I(r), o = V(t);
|
|
201
|
-
at(o);
|
|
202
|
-
function l(e) {
|
|
203
|
-
if (e.open || (fe.current = ct(e.nativeEvent, Y.current)), e.reason === st && e.nativeEvent.type === "mouseleave" && (y.current = !0), e.reason === ut)
|
|
204
|
-
if (e.nested)
|
|
205
|
-
y.current = !1;
|
|
206
|
-
else if (nt(e.nativeEvent) || rt(e.nativeEvent))
|
|
207
|
-
y.current = !1;
|
|
208
|
-
else {
|
|
209
|
-
let s = !1;
|
|
210
|
-
document.createElement("div").focus({
|
|
211
|
-
get preventScroll() {
|
|
212
|
-
return s = !0, !1;
|
|
213
|
-
}
|
|
214
|
-
}), s ? y.current = !1 : y.current = !0;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
Q.on("openchange", l);
|
|
218
|
-
const u = t.createElement("span");
|
|
219
|
-
u.setAttribute("tabindex", "-1"), u.setAttribute("aria-hidden", "true"), Object.assign(u.style, We), Z && a && a.insertAdjacentElement("afterend", u);
|
|
220
|
-
function d() {
|
|
221
|
-
const e = j.current;
|
|
222
|
-
let s = typeof e == "function" ? e(fe.current) : e;
|
|
223
|
-
if (s === void 0 || s === !1)
|
|
224
|
-
return null;
|
|
225
|
-
if (s === null && (s = !0), typeof s == "boolean") {
|
|
226
|
-
const g = a || ne();
|
|
227
|
-
return g && g.isConnected ? g : u;
|
|
228
|
-
}
|
|
229
|
-
const w = a || ne() || u;
|
|
230
|
-
return D(s) || w;
|
|
231
|
-
}
|
|
232
|
-
return () => {
|
|
233
|
-
Q.off("openchange", l);
|
|
234
|
-
const e = V(t), s = m(f, e) || R && Ce(R.nodesRef.current, O(), !1).some((g) => m(g.context?.elements.floating, e)), w = d();
|
|
235
|
-
queueMicrotask(() => {
|
|
236
|
-
const g = ft(w), K = typeof j.current != "boolean";
|
|
237
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
238
|
-
j.current && !y.current && q(g) && // If the focus moved somewhere else after mount, avoid returning focus
|
|
239
|
-
// since it likely entered a different element which should be
|
|
240
|
-
// respected: https://github.com/floating-ui/floating-ui/issues/2607
|
|
241
|
-
(!(!K && g !== e && e !== t.body) || s) && g.focus({
|
|
242
|
-
preventScroll: !0
|
|
243
|
-
}), u.remove();
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
}, [i, f, r, j, k, Q, R, Z, a, O]), b.useEffect(() => {
|
|
247
|
-
queueMicrotask(() => {
|
|
248
|
-
y.current = !1;
|
|
249
|
-
});
|
|
250
|
-
}, [i]), b.useEffect(() => {
|
|
251
|
-
if (i || !v)
|
|
252
|
-
return;
|
|
253
|
-
function t(l) {
|
|
254
|
-
W(l)?.closest(`[${Ye}]`) && (B.current = !0);
|
|
255
|
-
}
|
|
256
|
-
const o = I(r);
|
|
257
|
-
return o.addEventListener("pointerdown", t, !0), () => {
|
|
258
|
-
o.removeEventListener("pointerdown", t, !0);
|
|
259
|
-
};
|
|
260
|
-
}, [i, v, r]), U(() => {
|
|
261
|
-
if (!i && c)
|
|
262
|
-
return c.setFocusManagerState({
|
|
263
|
-
modal: E,
|
|
264
|
-
closeOnFocusOut: M,
|
|
265
|
-
open: v,
|
|
266
|
-
onOpenChange: F.setOpen,
|
|
267
|
-
domReference: a
|
|
268
|
-
}), () => {
|
|
269
|
-
c.setFocusManagerState(null);
|
|
270
|
-
};
|
|
271
|
-
}, [i, c, E, v, F, M, a]), U(() => {
|
|
272
|
-
if (!(i || !r))
|
|
273
|
-
return Oe(r, C), () => {
|
|
274
|
-
queueMicrotask(oe);
|
|
275
|
-
};
|
|
276
|
-
}, [i, r, C]);
|
|
277
|
-
const Ee = !i && (E ? !x : !0) && (Z || E);
|
|
278
|
-
return /* @__PURE__ */ Ze(b.Fragment, {
|
|
279
|
-
children: [Ee && /* @__PURE__ */ xe(Te, {
|
|
280
|
-
"data-type": "inside",
|
|
281
|
-
ref: Ve,
|
|
282
|
-
onFocus: (t) => {
|
|
283
|
-
if (E) {
|
|
284
|
-
const o = G();
|
|
285
|
-
te(o[o.length - 1]);
|
|
286
|
-
} else c?.portalNode && (y.current = !1, Le(t, c.portalNode) ? et(a)?.focus() : D(J ?? c.beforeOutsideRef)?.focus());
|
|
287
|
-
}
|
|
288
|
-
}), h, Ee && /* @__PURE__ */ xe(Te, {
|
|
289
|
-
"data-type": "inside",
|
|
290
|
-
ref: je,
|
|
291
|
-
onFocus: (t) => {
|
|
292
|
-
E ? te(G()[0]) : c?.portalNode && (M && (y.current = !0), Le(t, c.portalNode) ? tt(a)?.focus() : D(z ?? c.afterOutsideRef)?.focus());
|
|
293
|
-
}
|
|
294
|
-
})]
|
|
295
|
-
});
|
|
1
|
+
import n from "./index100.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
const o = /* @__PURE__ */ t.createContext(void 0);
|
|
4
|
+
process.env.NODE_ENV !== "production" && (o.displayName = "MenuCheckboxItemContext");
|
|
5
|
+
function s() {
|
|
6
|
+
const e = t.useContext(o);
|
|
7
|
+
if (e === void 0)
|
|
8
|
+
throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>." : n(30));
|
|
9
|
+
return e;
|
|
296
10
|
}
|
|
297
11
|
export {
|
|
298
|
-
|
|
12
|
+
o as MenuCheckboxItemContext,
|
|
13
|
+
s as useMenuCheckboxItemContext
|
|
299
14
|
};
|
package/dist/index109.js
CHANGED
|
@@ -1,7 +1,69 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import * as a from "react";
|
|
3
|
+
import { useMergedRefs as h } from "./index101.js";
|
|
4
|
+
import { useContextMenuRootContext as y } from "./index134.js";
|
|
5
|
+
import { useButton as P } from "./index86.js";
|
|
6
|
+
import { mergeProps as v } from "./index27.js";
|
|
7
|
+
import { itemPress as I } from "./index116.js";
|
|
8
|
+
const A = {
|
|
9
|
+
type: "regular-item"
|
|
10
|
+
};
|
|
11
|
+
function w(M) {
|
|
12
|
+
const {
|
|
13
|
+
closeOnClick: m,
|
|
14
|
+
disabled: R = !1,
|
|
15
|
+
highlighted: f,
|
|
16
|
+
id: l,
|
|
17
|
+
store: n,
|
|
18
|
+
nativeButton: b,
|
|
19
|
+
itemMetadata: o,
|
|
20
|
+
nodeId: r
|
|
21
|
+
} = M, i = a.useRef(null), t = y(!0), u = t !== void 0, {
|
|
22
|
+
events: s
|
|
23
|
+
} = n.useState("floatingTreeRoot"), {
|
|
24
|
+
getButtonProps: p,
|
|
25
|
+
buttonRef: x
|
|
26
|
+
} = P({
|
|
27
|
+
disabled: R,
|
|
28
|
+
focusableWhenDisabled: !0,
|
|
29
|
+
native: b
|
|
30
|
+
}), g = a.useCallback((C) => v({
|
|
31
|
+
id: l,
|
|
32
|
+
role: "menuitem",
|
|
33
|
+
tabIndex: f ? 0 : -1,
|
|
34
|
+
onMouseMove(e) {
|
|
35
|
+
r && s.emit("itemhover", {
|
|
36
|
+
nodeId: r,
|
|
37
|
+
target: e.currentTarget
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
onMouseEnter() {
|
|
41
|
+
o.type === "submenu-trigger" && o.setActive();
|
|
42
|
+
},
|
|
43
|
+
onKeyUp(e) {
|
|
44
|
+
e.key === " " && n.context.typingRef.current && e.preventBaseUIHandler();
|
|
45
|
+
},
|
|
46
|
+
onClick(e) {
|
|
47
|
+
m && s.emit("close", {
|
|
48
|
+
domEvent: e,
|
|
49
|
+
reason: I
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
onMouseUp(e) {
|
|
53
|
+
if (t) {
|
|
54
|
+
const c = t.initialCursorPointRef.current;
|
|
55
|
+
if (t.initialCursorPointRef.current = null, u && c && Math.abs(e.clientX - c.x) <= 1 && Math.abs(e.clientY - c.y) <= 1)
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
i.current && n.context.allowMouseUpTriggerRef.current && (!u || e.button === 2) && o.type === "regular-item" && i.current.click();
|
|
59
|
+
}
|
|
60
|
+
}, C, p), [l, f, p, m, s, n, u, t, o, r]), d = h(i, x);
|
|
61
|
+
return a.useMemo(() => ({
|
|
62
|
+
getItemProps: g,
|
|
63
|
+
itemRef: d
|
|
64
|
+
}), [g, d]);
|
|
4
65
|
}
|
|
5
66
|
export {
|
|
6
|
-
|
|
67
|
+
A as REGULAR_ITEM,
|
|
68
|
+
w as useMenuItem
|
|
7
69
|
};
|