@yselimcan/ui 0.0.7 → 0.0.9

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.
Files changed (266) hide show
  1. package/dist/index.js +15277 -100
  2. package/dist/styles.css +1 -1
  3. package/package.json +9 -12
  4. package/dist/index10.js +0 -137
  5. package/dist/index100.js +0 -7
  6. package/dist/index101.js +0 -69
  7. package/dist/index102.js +0 -11
  8. package/dist/index103.js +0 -16
  9. package/dist/index104.js +0 -6
  10. package/dist/index105.js +0 -6
  11. package/dist/index106.js +0 -8
  12. package/dist/index107.js +0 -32
  13. package/dist/index108.js +0 -14
  14. package/dist/index109.js +0 -69
  15. package/dist/index11.js +0 -21
  16. package/dist/index110.js +0 -56
  17. package/dist/index111.js +0 -15
  18. package/dist/index112.js +0 -8
  19. package/dist/index113.js +0 -15
  20. package/dist/index114.js +0 -15
  21. package/dist/index115.js +0 -35
  22. package/dist/index116.js +0 -21
  23. package/dist/index117.js +0 -43
  24. package/dist/index118.js +0 -21
  25. package/dist/index119.js +0 -14
  26. package/dist/index12.js +0 -20
  27. package/dist/index120.js +0 -40
  28. package/dist/index121.js +0 -16
  29. package/dist/index122.js +0 -11
  30. package/dist/index123.js +0 -15
  31. package/dist/index124.js +0 -8
  32. package/dist/index125.js +0 -90
  33. package/dist/index126.js +0 -299
  34. package/dist/index127.js +0 -14
  35. package/dist/index128.js +0 -128
  36. package/dist/index129.js +0 -7
  37. package/dist/index13.js +0 -206
  38. package/dist/index130.js +0 -266
  39. package/dist/index131.js +0 -82
  40. package/dist/index132.js +0 -41
  41. package/dist/index133.js +0 -23
  42. package/dist/index134.js +0 -14
  43. package/dist/index135.js +0 -59
  44. package/dist/index136.js +0 -14
  45. package/dist/index137.js +0 -14
  46. package/dist/index138.js +0 -33
  47. package/dist/index139.js +0 -21
  48. package/dist/index14.js +0 -24
  49. package/dist/index140.js +0 -69
  50. package/dist/index141.js +0 -107
  51. package/dist/index142.js +0 -11
  52. package/dist/index143.js +0 -11
  53. package/dist/index144.js +0 -25
  54. package/dist/index145.js +0 -106
  55. package/dist/index146.js +0 -10
  56. package/dist/index147.js +0 -35
  57. package/dist/index148.js +0 -233
  58. package/dist/index149.js +0 -77
  59. package/dist/index15.js +0 -19
  60. package/dist/index150.js +0 -286
  61. package/dist/index151.js +0 -56
  62. package/dist/index152.js +0 -48
  63. package/dist/index153.js +0 -79
  64. package/dist/index154.js +0 -6
  65. package/dist/index155.js +0 -17
  66. package/dist/index156.js +0 -18
  67. package/dist/index157.js +0 -31
  68. package/dist/index158.js +0 -10
  69. package/dist/index159.js +0 -25
  70. package/dist/index16.js +0 -8
  71. package/dist/index160.js +0 -27
  72. package/dist/index161.js +0 -163
  73. package/dist/index162.js +0 -116
  74. package/dist/index163.js +0 -67
  75. package/dist/index164.js +0 -78
  76. package/dist/index165.js +0 -67
  77. package/dist/index166.js +0 -72
  78. package/dist/index167.js +0 -16
  79. package/dist/index168.js +0 -10
  80. package/dist/index169.js +0 -8
  81. package/dist/index17.js +0 -46
  82. package/dist/index170.js +0 -20
  83. package/dist/index171.js +0 -24
  84. package/dist/index172.js +0 -61
  85. package/dist/index173.js +0 -20
  86. package/dist/index174.js +0 -30
  87. package/dist/index175.js +0 -45
  88. package/dist/index176.js +0 -24
  89. package/dist/index177.js +0 -51
  90. package/dist/index178.js +0 -54
  91. package/dist/index179.js +0 -20
  92. package/dist/index18.js +0 -41
  93. package/dist/index180.js +0 -14
  94. package/dist/index181.js +0 -38
  95. package/dist/index182.js +0 -18
  96. package/dist/index183.js +0 -82
  97. package/dist/index184.js +0 -26
  98. package/dist/index185.js +0 -6
  99. package/dist/index186.js +0 -14
  100. package/dist/index187.js +0 -13
  101. package/dist/index188.js +0 -43
  102. package/dist/index189.js +0 -7
  103. package/dist/index19.js +0 -80
  104. package/dist/index190.js +0 -12
  105. package/dist/index191.js +0 -14
  106. package/dist/index192.js +0 -120
  107. package/dist/index193.js +0 -14
  108. package/dist/index194.js +0 -90
  109. package/dist/index195.js +0 -15
  110. package/dist/index196.js +0 -65
  111. package/dist/index197.js +0 -6
  112. package/dist/index198.js +0 -7
  113. package/dist/index199.js +0 -14
  114. package/dist/index20.js +0 -25
  115. package/dist/index200.js +0 -8
  116. package/dist/index201.js +0 -24
  117. package/dist/index202.js +0 -6
  118. package/dist/index203.js +0 -29
  119. package/dist/index204.js +0 -130
  120. package/dist/index205.js +0 -47
  121. package/dist/index206.js +0 -20
  122. package/dist/index207.js +0 -7
  123. package/dist/index208.js +0 -183
  124. package/dist/index209.js +0 -78
  125. package/dist/index21.js +0 -40
  126. package/dist/index210.js +0 -401
  127. package/dist/index211.js +0 -202
  128. package/dist/index212.js +0 -50
  129. package/dist/index213.js +0 -22
  130. package/dist/index214.js +0 -50
  131. package/dist/index215.js +0 -9
  132. package/dist/index216.js +0 -7
  133. package/dist/index217.js +0 -19
  134. package/dist/index218.js +0 -17
  135. package/dist/index219.js +0 -35
  136. package/dist/index22.js +0 -31
  137. package/dist/index220.js +0 -6
  138. package/dist/index221.js +0 -14
  139. package/dist/index222.js +0 -12
  140. package/dist/index223.js +0 -41
  141. package/dist/index224.js +0 -59
  142. package/dist/index225.js +0 -30
  143. package/dist/index226.js +0 -10
  144. package/dist/index227.js +0 -15
  145. package/dist/index228.js +0 -14
  146. package/dist/index229.js +0 -14
  147. package/dist/index23.js +0 -25
  148. package/dist/index230.js +0 -24
  149. package/dist/index231.js +0 -14
  150. package/dist/index232.js +0 -10
  151. package/dist/index233.js +0 -45
  152. package/dist/index234.js +0 -599
  153. package/dist/index235.js +0 -14
  154. package/dist/index236.js +0 -6
  155. package/dist/index237.js +0 -211
  156. package/dist/index238.js +0 -6
  157. package/dist/index239.js +0 -16
  158. package/dist/index24.js +0 -56
  159. package/dist/index240.js +0 -50
  160. package/dist/index241.js +0 -15
  161. package/dist/index242.js +0 -60
  162. package/dist/index243.js +0 -32
  163. package/dist/index244.js +0 -16
  164. package/dist/index245.js +0 -11
  165. package/dist/index246.js +0 -209
  166. package/dist/index247.js +0 -17
  167. package/dist/index248.js +0 -324
  168. package/dist/index249.js +0 -5
  169. package/dist/index25.js +0 -35
  170. package/dist/index250.js +0 -5
  171. package/dist/index251.js +0 -23
  172. package/dist/index252.js +0 -8
  173. package/dist/index253.js +0 -489
  174. package/dist/index254.js +0 -10
  175. package/dist/index255.js +0 -4
  176. package/dist/index256.js +0 -46
  177. package/dist/index257.js +0 -58
  178. package/dist/index258.js +0 -10
  179. package/dist/index259.js +0 -4
  180. package/dist/index26.js +0 -7
  181. package/dist/index260.js +0 -57
  182. package/dist/index261.js +0 -58
  183. package/dist/index262.js +0 -4
  184. package/dist/index263.js +0 -4
  185. package/dist/index264.js +0 -4
  186. package/dist/index265.js +0 -4
  187. package/dist/index27.js +0 -82
  188. package/dist/index28.js +0 -32
  189. package/dist/index29.js +0 -6
  190. package/dist/index3.js +0 -181
  191. package/dist/index30.js +0 -9
  192. package/dist/index31.js +0 -6
  193. package/dist/index32.js +0 -23
  194. package/dist/index33.js +0 -207
  195. package/dist/index34.js +0 -25
  196. package/dist/index35.js +0 -102
  197. package/dist/index36.js +0 -69
  198. package/dist/index37.js +0 -66
  199. package/dist/index38.js +0 -113
  200. package/dist/index39.js +0 -53
  201. package/dist/index4.js +0 -47
  202. package/dist/index40.js +0 -35
  203. package/dist/index41.js +0 -28
  204. package/dist/index42.js +0 -18
  205. package/dist/index43.js +0 -27
  206. package/dist/index44.js +0 -25
  207. package/dist/index45.js +0 -36
  208. package/dist/index46.js +0 -78
  209. package/dist/index47.js +0 -65
  210. package/dist/index48.js +0 -128
  211. package/dist/index49.js +0 -19
  212. package/dist/index5.js +0 -52
  213. package/dist/index50.js +0 -86
  214. package/dist/index51.js +0 -6
  215. package/dist/index52.js +0 -268
  216. package/dist/index53.js +0 -25
  217. package/dist/index54.js +0 -207
  218. package/dist/index55.js +0 -146
  219. package/dist/index56.js +0 -88
  220. package/dist/index57.js +0 -29
  221. package/dist/index58.js +0 -30
  222. package/dist/index59.js +0 -48
  223. package/dist/index6.js +0 -93
  224. package/dist/index60.js +0 -79
  225. package/dist/index61.js +0 -45
  226. package/dist/index62.js +0 -46
  227. package/dist/index63.js +0 -76
  228. package/dist/index64.js +0 -45
  229. package/dist/index65.js +0 -22
  230. package/dist/index66.js +0 -101
  231. package/dist/index67.js +0 -14
  232. package/dist/index68.js +0 -6
  233. package/dist/index69.js +0 -321
  234. package/dist/index7.js +0 -294
  235. package/dist/index70.js +0 -24
  236. package/dist/index71.js +0 -143
  237. package/dist/index72.js +0 -200
  238. package/dist/index73.js +0 -43
  239. package/dist/index74.js +0 -29
  240. package/dist/index75.js +0 -148
  241. package/dist/index76.js +0 -32
  242. package/dist/index77.js +0 -53
  243. package/dist/index78.js +0 -28
  244. package/dist/index79.js +0 -15
  245. package/dist/index8.js +0 -264
  246. package/dist/index80.js +0 -15
  247. package/dist/index81.js +0 -135
  248. package/dist/index82.js +0 -31
  249. package/dist/index83.js +0 -35
  250. package/dist/index84.js +0 -17
  251. package/dist/index85.js +0 -2765
  252. package/dist/index86.js +0 -92
  253. package/dist/index87.js +0 -57
  254. package/dist/index88.js +0 -14
  255. package/dist/index89.js +0 -98
  256. package/dist/index9.js +0 -197
  257. package/dist/index90.js +0 -21
  258. package/dist/index91.js +0 -18
  259. package/dist/index92.js +0 -35
  260. package/dist/index93.js +0 -14
  261. package/dist/index94.js +0 -136
  262. package/dist/index95.js +0 -30
  263. package/dist/index96.js +0 -11
  264. package/dist/index97.js +0 -7
  265. package/dist/index98.js +0 -15
  266. package/dist/index99.js +0 -25
package/dist/index117.js DELETED
@@ -1,43 +0,0 @@
1
- "use client";
2
- import * as c from "react";
3
- import { useIsoLayoutEffect as d } from "./index97.js";
4
- import { AnimationFrame as u } from "./index140.js";
5
- function g(t, s = !1, f = !1) {
6
- const [n, r] = c.useState(t && s ? "idle" : void 0), [i, a] = c.useState(t);
7
- return t && !i && (a(!0), r("starting")), !t && i && n !== "ending" && !f && r("ending"), !t && !i && n === "ending" && r(void 0), d(() => {
8
- if (!t && i && n !== "ending" && f) {
9
- const e = u.request(() => {
10
- r("ending");
11
- });
12
- return () => {
13
- u.cancel(e);
14
- };
15
- }
16
- }, [t, i, n, f]), d(() => {
17
- if (!t || s)
18
- return;
19
- const e = u.request(() => {
20
- r(void 0);
21
- });
22
- return () => {
23
- u.cancel(e);
24
- };
25
- }, [s, t]), d(() => {
26
- if (!t || !s)
27
- return;
28
- t && i && n !== "idle" && r("starting");
29
- const e = u.request(() => {
30
- r("idle");
31
- });
32
- return () => {
33
- u.cancel(e);
34
- };
35
- }, [s, t, i, r, n]), c.useMemo(() => ({
36
- mounted: i,
37
- setMounted: a,
38
- transitionStatus: n
39
- }), [i, n]);
40
- }
41
- export {
42
- g as useTransitionStatus
43
- };
package/dist/index118.js DELETED
@@ -1,21 +0,0 @@
1
- "use client";
2
- import * as a from "react";
3
- import { useStableCallback as f } from "./index95.js";
4
- import { useValueAsRef as p } from "./index170.js";
5
- import { useAnimationsFinished as u } from "./index203.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]);
18
- }
19
- export {
20
- b as useOpenChangeComplete
21
- };
package/dist/index119.js DELETED
@@ -1,14 +0,0 @@
1
- import n from "./index100.js";
2
- import * as o from "react";
3
- const t = /* @__PURE__ */ o.createContext(void 0);
4
- process.env.NODE_ENV !== "production" && (t.displayName = "MenuGroupContext");
5
- function u() {
6
- const e = o.useContext(t);
7
- if (e === void 0)
8
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: MenuGroupRootContext is missing. Menu group parts must be used within <Menu.Group>." : n(31));
9
- return e;
10
- }
11
- export {
12
- t as MenuGroupContext,
13
- u as useMenuGroupRootContext
14
- };
package/dist/index12.js DELETED
@@ -1,20 +0,0 @@
1
- "use client";
2
- import { jsx as a } from "react/jsx-runtime";
3
- import "react";
4
- import { cn as o } from "./index16.js";
5
- function i({ className: e, ...t }) {
6
- return /* @__PURE__ */ a(
7
- "label",
8
- {
9
- "data-slot": "label",
10
- className: o(
11
- "gap-2 text-sm leading-none font-medium group-data-[disabled=true]:opacity-50 peer-disabled:opacity-50 flex items-center select-none group-data-[disabled=true]:pointer-events-none peer-disabled:cursor-not-allowed",
12
- e
13
- ),
14
- ...t
15
- }
16
- );
17
- }
18
- export {
19
- i as Label
20
- };
package/dist/index120.js DELETED
@@ -1,40 +0,0 @@
1
- import { TransitionStatusDataAttributes as p } from "./index121.js";
2
- let r = (function(n) {
3
- return n.open = "data-open", n.closed = "data-closed", n[n.startingStyle = p.startingStyle] = "startingStyle", n[n.endingStyle = p.endingStyle] = "endingStyle", n.anchorHidden = "data-anchor-hidden", n;
4
- })({}), e = /* @__PURE__ */ (function(n) {
5
- return n.popupOpen = "data-popup-open", n.pressed = "data-pressed", n;
6
- })({});
7
- const t = {
8
- [e.popupOpen]: ""
9
- }, d = {
10
- [e.popupOpen]: "",
11
- [e.pressed]: ""
12
- }, O = {
13
- [r.open]: ""
14
- }, l = {
15
- [r.closed]: ""
16
- }, s = {
17
- [r.anchorHidden]: ""
18
- }, i = {
19
- open(n) {
20
- return n ? t : null;
21
- }
22
- }, a = {
23
- open(n) {
24
- return n ? d : null;
25
- }
26
- }, o = {
27
- open(n) {
28
- return n ? O : l;
29
- },
30
- anchorHidden(n) {
31
- return n ? s : null;
32
- }
33
- };
34
- export {
35
- r as CommonPopupDataAttributes,
36
- e as CommonTriggerDataAttributes,
37
- o as popupStateMapping,
38
- a as pressableTriggerOpenStateMapping,
39
- i as triggerOpenStateMapping
40
- };
package/dist/index121.js DELETED
@@ -1,16 +0,0 @@
1
- let n = /* @__PURE__ */ (function(t) {
2
- return t.startingStyle = "data-starting-style", t.endingStyle = "data-ending-style", t;
3
- })({});
4
- const e = {
5
- [n.startingStyle]: ""
6
- }, i = {
7
- [n.endingStyle]: ""
8
- }, r = {
9
- transitionStatus(t) {
10
- return t === "starting" ? e : t === "ending" ? i : null;
11
- }
12
- };
13
- export {
14
- n as TransitionStatusDataAttributes,
15
- r as transitionStatusMapping
16
- };
package/dist/index122.js DELETED
@@ -1,11 +0,0 @@
1
- "use client";
2
- import * as o from "react";
3
- const t = /* @__PURE__ */ o.createContext(void 0);
4
- process.env.NODE_ENV !== "production" && (t.displayName = "ToolbarRootContext");
5
- function r(e) {
6
- return o.useContext(t);
7
- }
8
- export {
9
- t as ToolbarRootContext,
10
- r as useToolbarRootContext
11
- };
package/dist/index123.js DELETED
@@ -1,15 +0,0 @@
1
- const t = "ArrowUp", n = "ArrowDown", o = "ArrowLeft", R = "ArrowRight", e = "Home", c = "End", E = /* @__PURE__ */ new Set([o, R]), A = /* @__PURE__ */ new Set([t, n]), O = /* @__PURE__ */ new Set([...E, ...A]);
2
- [...O];
3
- const s = /* @__PURE__ */ new Set([t, n, o, R, e, "End"]);
4
- export {
5
- n as ARROW_DOWN,
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
15
- };
package/dist/index124.js DELETED
@@ -1,8 +0,0 @@
1
- import { DISABLED_TRANSITIONS_STYLE as r } from "./index133.js";
2
- import { EMPTY_OBJECT as o } from "./index106.js";
3
- function T(t) {
4
- return t === "starting" ? r : o;
5
- }
6
- export {
7
- T as getDisabledMountTransitionStyles
8
- };
package/dist/index125.js DELETED
@@ -1,90 +0,0 @@
1
- import * as L from "react";
2
- import { isElement as j } from "./index94.js";
3
- import { useStableCallback as f } from "./index95.js";
4
- import { useIsoLayoutEffect as F } from "./index97.js";
5
- import { createChangeEventDetails as w } from "./index115.js";
6
- import { useFloatingTree as q, useFloatingParentNodeId as z } from "./index135.js";
7
- import { useHoverInteractionSharedState as B, safePolygonIdentifier as H, isInteractiveElement as G } from "./index243.js";
8
- import { triggerHover as O } from "./index116.js";
9
- import { getDocument as x, getTarget as J } from "./index166.js";
10
- import { isMouseLikePointerType as K } from "./index225.js";
11
- const Q = /* @__PURE__ */ new Set(["click", "mousedown"]);
12
- function re(i, d = {}) {
13
- const n = "rootStore" in i ? i.rootStore : i, m = n.useState("open"), u = n.useState("floatingElement"), b = n.useState("domReferenceElement"), {
14
- dataRef: p
15
- } = n.context, {
16
- enabled: R = !0,
17
- closeDelay: I = 0,
18
- externalTree: A
19
- } = d, {
20
- pointerTypeRef: E,
21
- interactedInsideRef: l,
22
- handlerRef: v,
23
- performedPointerEventsMutationRef: g,
24
- unbindMouseMoveRef: N,
25
- restTimeoutPendingRef: S,
26
- openChangeTimeout: y,
27
- handleCloseOptionsRef: k
28
- } = B(n), M = q(A), T = z(), h = f(() => l.current ? !0 : p.current.openEvent ? Q.has(p.current.openEvent.type) : !1), C = f(() => {
29
- const e = p.current.openEvent?.type;
30
- return e?.includes("mouse") && e !== "mousedown";
31
- }), P = L.useCallback((e, r = !0) => {
32
- const s = U(I, E.current);
33
- s && !v.current ? y.start(s, () => n.setOpen(!1, w(O, e))) : r && (y.clear(), n.setOpen(!1, w(O, e)));
34
- }, [I, v, n, E, y]), c = f(() => {
35
- N.current(), v.current = void 0;
36
- }), a = f(() => {
37
- if (g.current) {
38
- const e = x(u).body;
39
- e.style.pointerEvents = "", e.removeAttribute(H), g.current = !1;
40
- }
41
- }), D = f((e) => {
42
- const r = J(e);
43
- if (!G(r)) {
44
- l.current = !1;
45
- return;
46
- }
47
- l.current = !0;
48
- });
49
- F(() => {
50
- m || (E.current = void 0, S.current = !1, l.current = !1, c(), a());
51
- }, [m, E, S, l, c, a]), L.useEffect(() => () => {
52
- c();
53
- }, [c]), L.useEffect(() => a, [a]), F(() => {
54
- if (R && m && k.current?.blockPointerEvents && C() && j(b) && u) {
55
- g.current = !0;
56
- const e = x(u).body;
57
- e.setAttribute(H, "");
58
- const r = b, s = u, t = M?.nodesRef.current.find((o) => o.id === T)?.context?.elements.floating;
59
- return t && (t.style.pointerEvents = ""), e.style.pointerEvents = "none", r.style.pointerEvents = "auto", s.style.pointerEvents = "auto", () => {
60
- e.style.pointerEvents = "", r.style.pointerEvents = "", s.style.pointerEvents = "";
61
- };
62
- }
63
- }, [R, m, b, u, k, C, M, T, g]), L.useEffect(() => {
64
- if (!R)
65
- return;
66
- function e(o) {
67
- if (h() || !p.current.floatingContext || !n.select("open"))
68
- return;
69
- const W = n.context.triggerElements;
70
- o.relatedTarget && W.hasElement(o.relatedTarget) || (a(), c(), h() || P(o));
71
- }
72
- function r(o) {
73
- y.clear(), a(), v.current?.(o), c();
74
- }
75
- function s(o) {
76
- h() || P(o, !1);
77
- }
78
- const t = u;
79
- return t && (t.addEventListener("mouseleave", e), t.addEventListener("mouseenter", r), t.addEventListener("mouseleave", s), t.addEventListener("pointerdown", D, !0)), () => {
80
- t && (t.removeEventListener("mouseleave", e), t.removeEventListener("mouseenter", r), t.removeEventListener("mouseleave", s), t.removeEventListener("pointerdown", D, !0));
81
- };
82
- });
83
- }
84
- function U(i, d) {
85
- return d && !K(d) ? 0 : typeof i == "function" ? i() : i;
86
- }
87
- export {
88
- U as getDelay,
89
- re as useHoverFloatingInteraction
90
- };
package/dist/index126.js DELETED
@@ -1,299 +0,0 @@
1
- "use client";
2
- import * as b from "react";
3
- import { tabbable as we, isTabbable as De, focusable as Ke } from "./index237.js";
4
- import { isHTMLElement as q, getNodeName as He, getWindow as _e, getComputedStyle as Ue } from "./index94.js";
5
- import { useMergedRefs as Re } from "./index101.js";
6
- import { useValueAsRef as H } from "./index170.js";
7
- import { useStableCallback as _ } from "./index95.js";
8
- import { useIsoLayoutEffect as U } from "./index97.js";
9
- import { visuallyHidden as We } from "./index167.js";
10
- import { useTimeout as ye } from "./index138.js";
11
- import { useAnimationFrame as $e } from "./index140.js";
12
- import { FocusGuard as Te } from "./index160.js";
13
- import { createChangeEventDetails as ze } from "./index115.js";
14
- import { createAttribute as Fe } from "./index238.js";
15
- import { enqueueFocus as te } from "./index239.js";
16
- import { markOthers as Je } from "./index240.js";
17
- import { usePortalContext as Qe } from "./index128.js";
18
- import { useFloatingTree as Xe } from "./index135.js";
19
- import { CLICK_TRIGGER_IDENTIFIER as Ye } from "./index133.js";
20
- import { resolveRef as D } from "./index236.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 "./index166.js";
23
- import { getTabbableOptions as re, isOutsideEvent as Le, getNextTabbable as et, getPreviousTabbable as tt } from "./index165.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 "./index116.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
- });
296
- }
297
- export {
298
- Mt as FloatingFocusManager
299
- };
package/dist/index127.js DELETED
@@ -1,14 +0,0 @@
1
- import n from "./index100.js";
2
- import * as o from "react";
3
- const t = /* @__PURE__ */ o.createContext(void 0);
4
- process.env.NODE_ENV !== "production" && (t.displayName = "MenuPortalContext");
5
- function s() {
6
- const e = o.useContext(t);
7
- if (e === void 0)
8
- throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.Portal> is missing." : n(32));
9
- return e;
10
- }
11
- export {
12
- t as MenuPortalContext,
13
- s as useMenuPortalContext
14
- };