@yselimcan/ui 0.0.2 → 0.0.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.
Files changed (265) hide show
  1. package/dist/index.js +100 -15331
  2. package/dist/index10.js +137 -0
  3. package/dist/index100.js +7 -0
  4. package/dist/index101.js +69 -0
  5. package/dist/index102.js +11 -0
  6. package/dist/index103.js +16 -0
  7. package/dist/index104.js +6 -0
  8. package/dist/index105.js +6 -0
  9. package/dist/index106.js +8 -0
  10. package/dist/index107.js +10 -0
  11. package/dist/index108.js +90 -0
  12. package/dist/index109.js +15 -0
  13. package/dist/index11.js +21 -0
  14. package/dist/index110.js +65 -0
  15. package/dist/index111.js +40 -0
  16. package/dist/index112.js +16 -0
  17. package/dist/index113.js +35 -0
  18. package/dist/index114.js +21 -0
  19. package/dist/index115.js +8 -0
  20. package/dist/index116.js +6 -0
  21. package/dist/index117.js +7 -0
  22. package/dist/index118.js +14 -0
  23. package/dist/index119.js +21 -0
  24. package/dist/index12.js +20 -0
  25. package/dist/index120.js +15 -0
  26. package/dist/index121.js +299 -0
  27. package/dist/index122.js +7 -0
  28. package/dist/index123.js +41 -0
  29. package/dist/index124.js +128 -0
  30. package/dist/index125.js +23 -0
  31. package/dist/index126.js +79 -0
  32. package/dist/index127.js +67 -0
  33. package/dist/index128.js +48 -0
  34. package/dist/index129.js +32 -0
  35. package/dist/index13.js +206 -0
  36. package/dist/index130.js +14 -0
  37. package/dist/index131.js +69 -0
  38. package/dist/index132.js +56 -0
  39. package/dist/index133.js +15 -0
  40. package/dist/index134.js +15 -0
  41. package/dist/index135.js +15 -0
  42. package/dist/index136.js +43 -0
  43. package/dist/index137.js +14 -0
  44. package/dist/index138.js +11 -0
  45. package/dist/index139.js +8 -0
  46. package/dist/index14.js +24 -0
  47. package/dist/index140.js +90 -0
  48. package/dist/index141.js +14 -0
  49. package/dist/index142.js +266 -0
  50. package/dist/index143.js +82 -0
  51. package/dist/index144.js +14 -0
  52. package/dist/index145.js +59 -0
  53. package/dist/index146.js +14 -0
  54. package/dist/index147.js +14 -0
  55. package/dist/index148.js +33 -0
  56. package/dist/index149.js +21 -0
  57. package/dist/index15.js +19 -0
  58. package/dist/index150.js +69 -0
  59. package/dist/index151.js +107 -0
  60. package/dist/index152.js +11 -0
  61. package/dist/index153.js +11 -0
  62. package/dist/index154.js +25 -0
  63. package/dist/index155.js +106 -0
  64. package/dist/index156.js +10 -0
  65. package/dist/index157.js +35 -0
  66. package/dist/index158.js +233 -0
  67. package/dist/index159.js +77 -0
  68. package/dist/index16.js +8 -0
  69. package/dist/index160.js +286 -0
  70. package/dist/index161.js +56 -0
  71. package/dist/index162.js +6 -0
  72. package/dist/index163.js +17 -0
  73. package/dist/index164.js +18 -0
  74. package/dist/index165.js +31 -0
  75. package/dist/index166.js +10 -0
  76. package/dist/index167.js +25 -0
  77. package/dist/index168.js +27 -0
  78. package/dist/index169.js +163 -0
  79. package/dist/index17.js +46 -0
  80. package/dist/index170.js +116 -0
  81. package/dist/index171.js +78 -0
  82. package/dist/index172.js +67 -0
  83. package/dist/index173.js +72 -0
  84. package/dist/index174.js +16 -0
  85. package/dist/index175.js +8 -0
  86. package/dist/index176.js +20 -0
  87. package/dist/index177.js +24 -0
  88. package/dist/index178.js +61 -0
  89. package/dist/index179.js +20 -0
  90. package/dist/index18.js +41 -0
  91. package/dist/index180.js +30 -0
  92. package/dist/index181.js +45 -0
  93. package/dist/index182.js +24 -0
  94. package/dist/index183.js +51 -0
  95. package/dist/index184.js +54 -0
  96. package/dist/index185.js +20 -0
  97. package/dist/index186.js +14 -0
  98. package/dist/index187.js +38 -0
  99. package/dist/index188.js +18 -0
  100. package/dist/index189.js +82 -0
  101. package/dist/index19.js +80 -0
  102. package/dist/index190.js +26 -0
  103. package/dist/index191.js +6 -0
  104. package/dist/index192.js +14 -0
  105. package/dist/index193.js +13 -0
  106. package/dist/index194.js +43 -0
  107. package/dist/index195.js +7 -0
  108. package/dist/index196.js +12 -0
  109. package/dist/index197.js +14 -0
  110. package/dist/index198.js +120 -0
  111. package/dist/index199.js +14 -0
  112. package/dist/index20.js +25 -0
  113. package/dist/index200.js +8 -0
  114. package/dist/index201.js +50 -0
  115. package/dist/index202.js +202 -0
  116. package/dist/index203.js +50 -0
  117. package/dist/index204.js +22 -0
  118. package/dist/index205.js +29 -0
  119. package/dist/index206.js +6 -0
  120. package/dist/index207.js +24 -0
  121. package/dist/index208.js +130 -0
  122. package/dist/index209.js +47 -0
  123. package/dist/index21.js +40 -0
  124. package/dist/index210.js +20 -0
  125. package/dist/index211.js +7 -0
  126. package/dist/index212.js +183 -0
  127. package/dist/index213.js +78 -0
  128. package/dist/index214.js +401 -0
  129. package/dist/index215.js +9 -0
  130. package/dist/index216.js +7 -0
  131. package/dist/index217.js +19 -0
  132. package/dist/index218.js +17 -0
  133. package/dist/index219.js +35 -0
  134. package/dist/index22.js +31 -0
  135. package/dist/index220.js +41 -0
  136. package/dist/index221.js +59 -0
  137. package/dist/index222.js +30 -0
  138. package/dist/index223.js +10 -0
  139. package/dist/index224.js +15 -0
  140. package/dist/index225.js +14 -0
  141. package/dist/index226.js +14 -0
  142. package/dist/index227.js +24 -0
  143. package/dist/index228.js +14 -0
  144. package/dist/index229.js +10 -0
  145. package/dist/index23.js +25 -0
  146. package/dist/index230.js +45 -0
  147. package/dist/index231.js +599 -0
  148. package/dist/index232.js +14 -0
  149. package/dist/index233.js +6 -0
  150. package/dist/index234.js +12 -0
  151. package/dist/index235.js +14 -0
  152. package/dist/index236.js +17 -0
  153. package/dist/index237.js +211 -0
  154. package/dist/index238.js +6 -0
  155. package/dist/index239.js +16 -0
  156. package/dist/index24.js +56 -0
  157. package/dist/index240.js +50 -0
  158. package/dist/index241.js +6 -0
  159. package/dist/index242.js +15 -0
  160. package/dist/index243.js +60 -0
  161. package/dist/index244.js +32 -0
  162. package/dist/index245.js +16 -0
  163. package/dist/index246.js +11 -0
  164. package/dist/index247.js +209 -0
  165. package/dist/index248.js +23 -0
  166. package/dist/index249.js +8 -0
  167. package/dist/index25.js +35 -0
  168. package/dist/index250.js +324 -0
  169. package/dist/index251.js +5 -0
  170. package/dist/index252.js +5 -0
  171. package/dist/index253.js +489 -0
  172. package/dist/index254.js +10 -0
  173. package/dist/index255.js +4 -0
  174. package/dist/index256.js +46 -0
  175. package/dist/index257.js +58 -0
  176. package/dist/index258.js +10 -0
  177. package/dist/index259.js +4 -0
  178. package/dist/index26.js +7 -0
  179. package/dist/index260.js +57 -0
  180. package/dist/index261.js +58 -0
  181. package/dist/index262.js +4 -0
  182. package/dist/index263.js +4 -0
  183. package/dist/index264.js +4 -0
  184. package/dist/index265.js +4 -0
  185. package/dist/index27.js +82 -0
  186. package/dist/index28.js +32 -0
  187. package/dist/index29.js +6 -0
  188. package/dist/index3.js +181 -0
  189. package/dist/index30.js +9 -0
  190. package/dist/index31.js +6 -0
  191. package/dist/index32.js +23 -0
  192. package/dist/index33.js +207 -0
  193. package/dist/index34.js +25 -0
  194. package/dist/index35.js +102 -0
  195. package/dist/index36.js +69 -0
  196. package/dist/index37.js +66 -0
  197. package/dist/index38.js +113 -0
  198. package/dist/index39.js +53 -0
  199. package/dist/index4.js +47 -0
  200. package/dist/index40.js +35 -0
  201. package/dist/index41.js +28 -0
  202. package/dist/index42.js +18 -0
  203. package/dist/index43.js +27 -0
  204. package/dist/index44.js +25 -0
  205. package/dist/index45.js +36 -0
  206. package/dist/index46.js +78 -0
  207. package/dist/index47.js +65 -0
  208. package/dist/index48.js +128 -0
  209. package/dist/index49.js +19 -0
  210. package/dist/index5.js +52 -0
  211. package/dist/index50.js +86 -0
  212. package/dist/index51.js +6 -0
  213. package/dist/index52.js +268 -0
  214. package/dist/index53.js +25 -0
  215. package/dist/index54.js +207 -0
  216. package/dist/index55.js +146 -0
  217. package/dist/index56.js +88 -0
  218. package/dist/index57.js +29 -0
  219. package/dist/index58.js +30 -0
  220. package/dist/index59.js +48 -0
  221. package/dist/index6.js +93 -0
  222. package/dist/index60.js +79 -0
  223. package/dist/index61.js +45 -0
  224. package/dist/index62.js +46 -0
  225. package/dist/index63.js +76 -0
  226. package/dist/index64.js +45 -0
  227. package/dist/index65.js +22 -0
  228. package/dist/index66.js +101 -0
  229. package/dist/index67.js +14 -0
  230. package/dist/index68.js +6 -0
  231. package/dist/index69.js +321 -0
  232. package/dist/index7.js +294 -0
  233. package/dist/index70.js +24 -0
  234. package/dist/index71.js +143 -0
  235. package/dist/index72.js +200 -0
  236. package/dist/index73.js +43 -0
  237. package/dist/index74.js +29 -0
  238. package/dist/index75.js +148 -0
  239. package/dist/index76.js +32 -0
  240. package/dist/index77.js +53 -0
  241. package/dist/index78.js +28 -0
  242. package/dist/index79.js +15 -0
  243. package/dist/index8.js +264 -0
  244. package/dist/index80.js +15 -0
  245. package/dist/index81.js +135 -0
  246. package/dist/index82.js +31 -0
  247. package/dist/index83.js +35 -0
  248. package/dist/index84.js +17 -0
  249. package/dist/index85.js +2765 -0
  250. package/dist/index86.js +57 -0
  251. package/dist/index87.js +14 -0
  252. package/dist/index88.js +98 -0
  253. package/dist/index89.js +92 -0
  254. package/dist/index9.js +197 -0
  255. package/dist/index90.js +21 -0
  256. package/dist/index91.js +18 -0
  257. package/dist/index92.js +35 -0
  258. package/dist/index93.js +14 -0
  259. package/dist/index94.js +136 -0
  260. package/dist/index95.js +30 -0
  261. package/dist/index96.js +11 -0
  262. package/dist/index97.js +7 -0
  263. package/dist/index98.js +15 -0
  264. package/dist/index99.js +25 -0
  265. package/package.json +3 -2
@@ -0,0 +1,268 @@
1
+ "use client";
2
+ import * as r from "react";
3
+ import * as Fe from "react-dom";
4
+ import { useTimeout as G } from "./index148.js";
5
+ import { useStableCallback as Ae } from "./index95.js";
6
+ import { useId as He } from "./index149.js";
7
+ import { useIsoLayoutEffect as J } from "./index97.js";
8
+ import { useAnimationFrame as Ue } from "./index150.js";
9
+ import { useScrollLock as Ke } from "./index151.js";
10
+ import { EMPTY_ARRAY as Le } from "./index106.js";
11
+ import { useMenuRootContext as _e, MenuRootContext as Ve } from "./index133.js";
12
+ import { useMenubarContext as Ye } from "./index152.js";
13
+ import { TYPEAHEAD_RESET_MS as qe } from "./index125.js";
14
+ import { useDirection as De } from "./index153.js";
15
+ import { useOpenInteractionType as je } from "./index154.js";
16
+ import { createChangeEventDetails as Be } from "./index113.js";
17
+ import { useContextMenuRootContext as $e } from "./index144.js";
18
+ import { MenuStore as ze } from "./index155.js";
19
+ import { useMenuSubmenuRootContext as Ge } from "./index156.js";
20
+ import { jsx as Q } from "react/jsx-runtime";
21
+ import { useFloatingNodeId as Je, useFloatingParentNodeId as Qe, FloatingTree as We } from "./index145.js";
22
+ import { useSyncedFloatingRootContext as Xe } from "./index157.js";
23
+ import { useDismiss as Ze } from "./index158.js";
24
+ import { useRole as et } from "./index159.js";
25
+ import { useListNavigation as tt } from "./index160.js";
26
+ import { useTypeahead as ot } from "./index161.js";
27
+ import { useInteractions as nt } from "./index128.js";
28
+ import { useImplicitActiveTrigger as rt, useOpenStateTransitions as st } from "./index126.js";
29
+ import { imperativeAction as it, triggerFocus as W, triggerPress as at, itemPress as ut, triggerHover as O, focusOut as ct, listNavigation as lt, siblingOpen as pt, escapeKey as dt } from "./index114.js";
30
+ import { mergeProps as X } from "./index27.js";
31
+ function Vt(Z) {
32
+ const {
33
+ children: C,
34
+ open: ee,
35
+ onOpenChange: te,
36
+ onOpenChangeComplete: oe,
37
+ defaultOpen: ne = !1,
38
+ disabled: re = !1,
39
+ modal: N,
40
+ loopFocus: se = !0,
41
+ orientation: ie = "vertical",
42
+ actionsRef: ae,
43
+ closeParentOnEsc: ue = !1,
44
+ handle: ce,
45
+ triggerId: le,
46
+ defaultTriggerId: pe = null,
47
+ highlightItemOnHover: de = !0
48
+ } = Z, u = $e(!0), a = _e(!0), I = Ye(), k = Ge(), T = r.useMemo(() => k && a ? {
49
+ type: "menu",
50
+ store: a.store
51
+ } : I ? {
52
+ type: "menubar",
53
+ context: I
54
+ } : u && !a ? {
55
+ type: "context-menu",
56
+ context: u
57
+ } : {
58
+ type: void 0
59
+ }, [u, a, I, k]), e = ze.useStore(ce?.store, {
60
+ parent: T
61
+ }), f = e.useState("floatingTreeRoot"), b = Je(f), x = Qe();
62
+ J(() => {
63
+ u && !a ? e.update({
64
+ parent: {
65
+ type: "context-menu",
66
+ context: u
67
+ },
68
+ floatingNodeId: b,
69
+ floatingParentNodeId: x
70
+ }) : a && e.update({
71
+ floatingNodeId: b,
72
+ floatingParentNodeId: x
73
+ });
74
+ }, [u, a, b, x, e]), e.useControlledProp("open", ee, ne), e.useControlledProp("activeTriggerId", le, pe), e.useContextCallback("onOpenChangeComplete", oe);
75
+ const i = e.useState("open"), w = e.useState("activeTriggerElement"), E = e.useState("positionerElement"), F = e.useState("hoverEnabled"), me = e.useState("modal"), A = e.useState("disabled"), fe = e.useState("lastOpenChangeReason"), n = e.useState("parent"), l = e.useState("activeIndex"), ge = e.useState("payload"), ye = e.useState("floatingParentNodeId"), h = r.useRef(null), P = ye != null;
76
+ let p;
77
+ process.env.NODE_ENV !== "production" && n.type !== void 0 && N !== void 0 && console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored."), e.useSyncedValues({
78
+ disabled: re,
79
+ modal: n.type === void 0 ? N : void 0,
80
+ rootId: He()
81
+ });
82
+ const {
83
+ openMethod: ve,
84
+ triggerProps: g,
85
+ reset: Ce
86
+ } = je(i);
87
+ rt(e);
88
+ const {
89
+ forceUnmount: H
90
+ } = st(i, e, () => {
91
+ e.update({
92
+ allowMouseEnter: !1,
93
+ stickIfOpen: !0
94
+ }), Ce();
95
+ }), R = r.useRef(n.type !== "context-menu"), M = G();
96
+ r.useEffect(() => {
97
+ if (i || (h.current = null), n.type === "context-menu") {
98
+ if (!i) {
99
+ M.clear(), R.current = !1;
100
+ return;
101
+ }
102
+ M.start(500, () => {
103
+ R.current = !0;
104
+ });
105
+ }
106
+ }, [M, i, n.type]), Ke(i && me && fe !== O && ve !== "touch", E), J(() => {
107
+ !i && !F && e.set("hoverEnabled", !0);
108
+ }, [i, F, e]);
109
+ const y = r.useRef(!0), U = G(), d = Ae((t, o) => {
110
+ const s = o.reason;
111
+ if (i === t && o.trigger === w || (o.preventUnmountOnClose = () => {
112
+ e.set("preventUnmountingOnClose", !0);
113
+ }, !t && o.trigger == null && (o.trigger = w ?? void 0), te?.(t, o), o.isCanceled))
114
+ return;
115
+ const ke = {
116
+ open: t,
117
+ nativeEvent: o.event,
118
+ reason: o.reason,
119
+ nested: P
120
+ };
121
+ p?.emit("openchange", ke);
122
+ const v = o.event;
123
+ if (t === !1 && v?.type === "click" && v.pointerType === "touch" && !y.current)
124
+ return;
125
+ if (!t && l !== null) {
126
+ const m = e.context.itemDomElements.current[l];
127
+ queueMicrotask(() => {
128
+ m?.setAttribute("tabindex", "-1");
129
+ });
130
+ }
131
+ t && s === W ? (y.current = !1, U.start(300, () => {
132
+ y.current = !0;
133
+ })) : (y.current = !0, U.clear());
134
+ const B = (s === at || s === ut) && v.detail === 0 && v?.isTrusted, we = !t && (s === dt || s == null);
135
+ function $() {
136
+ const m = {
137
+ open: t,
138
+ openChangeReason: s
139
+ };
140
+ h.current = o.event ?? null;
141
+ const z = o.trigger?.id ?? null;
142
+ (z || t) && (m.activeTriggerId = z, m.activeTriggerElement = o.trigger ?? null), e.update(m);
143
+ }
144
+ s === O ? Fe.flushSync($) : $(), n.type === "menubar" && (s === W || s === ct || s === O || s === lt || s === pt) ? e.set("instantType", "group") : B || we ? e.set("instantType", B ? "click" : "dismiss") : e.set("instantType", void 0);
145
+ }), K = r.useCallback((t) => {
146
+ const o = Be(t);
147
+ return o.preventUnmountOnClose = () => {
148
+ e.set("preventUnmountingOnClose", !0);
149
+ }, o;
150
+ }, [e]), L = r.useCallback(() => {
151
+ e.setOpen(!1, K(it));
152
+ }, [e, K]);
153
+ r.useImperativeHandle(ae, () => ({
154
+ unmount: H,
155
+ close: L
156
+ }), [H, L]);
157
+ let S;
158
+ n.type === "context-menu" && (S = n.context), r.useImperativeHandle(S?.positionerRef, () => E, [E]), r.useImperativeHandle(S?.actionsRef, () => ({
159
+ setOpen: d
160
+ }), [d]);
161
+ const c = Xe({
162
+ popupStore: e,
163
+ onOpenChange: d
164
+ });
165
+ p = c.context.events, r.useEffect(() => {
166
+ const t = ({
167
+ open: o,
168
+ eventDetails: s
169
+ }) => d(o, s);
170
+ return p.on("setOpen", t), () => {
171
+ p?.off("setOpen", t);
172
+ };
173
+ }, [p, d]);
174
+ const Ie = Ze(c, {
175
+ enabled: !A,
176
+ bubbles: ue && n.type === "menu",
177
+ outsidePress() {
178
+ return n.type !== "context-menu" || h.current?.type === "contextmenu" ? !0 : R.current;
179
+ },
180
+ externalTree: P ? f : void 0
181
+ }), Te = et(c, {
182
+ role: "menu"
183
+ }), be = De(), xe = r.useCallback((t) => {
184
+ e.select("activeIndex") !== t && e.set("activeIndex", t);
185
+ }, [e]), Ee = tt(c, {
186
+ enabled: !A,
187
+ listRef: e.context.itemDomElements,
188
+ activeIndex: l,
189
+ nested: n.type !== void 0,
190
+ loopFocus: se,
191
+ orientation: ie,
192
+ parentOrientation: n.type === "menubar" ? n.context.orientation : void 0,
193
+ rtl: be === "rtl",
194
+ disabledIndices: Le,
195
+ onNavigate: xe,
196
+ openOnArrowKeyDown: n.type !== "context-menu",
197
+ externalTree: P ? f : void 0,
198
+ focusItemOnHover: de
199
+ }), he = r.useCallback((t) => {
200
+ e.context.typingRef.current = t;
201
+ }, [e]), Pe = ot(c, {
202
+ listRef: e.context.itemLabels,
203
+ activeIndex: l,
204
+ resetMs: qe,
205
+ onMatch: (t) => {
206
+ i && t !== l && e.set("activeIndex", t);
207
+ },
208
+ onTypingChange: he
209
+ }), {
210
+ getReferenceProps: _,
211
+ getFloatingProps: V,
212
+ getItemProps: Y,
213
+ getTriggerProps: q
214
+ } = nt([Ie, Te, Ee, Pe]), Re = r.useMemo(() => {
215
+ const t = X(_(), {
216
+ onMouseEnter() {
217
+ e.set("hoverEnabled", !0);
218
+ },
219
+ onMouseMove() {
220
+ e.set("allowMouseEnter", !0);
221
+ }
222
+ }, g);
223
+ return delete t.role, t;
224
+ }, [_, e, g]), Me = r.useMemo(() => {
225
+ const t = q();
226
+ if (!t)
227
+ return t;
228
+ const o = X(t, g);
229
+ return delete o.role, delete o["aria-controls"], o;
230
+ }, [q, g]), D = Ue(), Se = r.useMemo(() => V({
231
+ onMouseEnter() {
232
+ n.type === "menu" && D.request(() => e.set("hoverEnabled", !1));
233
+ },
234
+ onMouseMove() {
235
+ e.set("allowMouseEnter", !0);
236
+ },
237
+ onClick() {
238
+ e.select("hoverEnabled") && e.set("hoverEnabled", !1);
239
+ },
240
+ onKeyDown(t) {
241
+ const o = e.select("keyboardEventRelay");
242
+ o && !t.isPropagationStopped() && o(t);
243
+ }
244
+ }), [V, n.type, D, e]), Oe = r.useMemo(() => Y(), [Y]);
245
+ e.useSyncedValues({
246
+ floatingRootContext: c,
247
+ activeTriggerProps: Re,
248
+ inactiveTriggerProps: Me,
249
+ popupProps: Se,
250
+ itemProps: Oe
251
+ });
252
+ const Ne = r.useMemo(() => ({
253
+ store: e,
254
+ parent: T
255
+ }), [e, T]), j = /* @__PURE__ */ Q(Ve.Provider, {
256
+ value: Ne,
257
+ children: typeof C == "function" ? C({
258
+ payload: ge
259
+ }) : C
260
+ });
261
+ return n.type === void 0 || n.type === "context-menu" ? /* @__PURE__ */ Q(We, {
262
+ externalTree: f,
263
+ children: j
264
+ }) : j;
265
+ }
266
+ export {
267
+ Vt as MenuRoot
268
+ };
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ import * as s from "react";
3
+ import { useMenuRootContext as l } from "./index133.js";
4
+ import { MenuPortalContext as a } from "./index141.js";
5
+ import { jsx as e } from "react/jsx-runtime";
6
+ import { FloatingPortal as i } from "./index124.js";
7
+ const m = /* @__PURE__ */ s.forwardRef(function(t, r) {
8
+ const {
9
+ keepMounted: o = !1,
10
+ ...n
11
+ } = t, {
12
+ store: u
13
+ } = l();
14
+ return u.useState("mounted") || o ? /* @__PURE__ */ e(a.Provider, {
15
+ value: o,
16
+ children: /* @__PURE__ */ e(i, {
17
+ ref: r,
18
+ ...n
19
+ })
20
+ }) : null;
21
+ });
22
+ process.env.NODE_ENV !== "production" && (m.displayName = "MenuPortal");
23
+ export {
24
+ m as MenuPortal
25
+ };
@@ -0,0 +1,207 @@
1
+ "use client";
2
+ import de from "./index100.js";
3
+ import * as n from "react";
4
+ import * as D from "react-dom";
5
+ import { useTimeout as L } from "./index148.js";
6
+ import { ownerDocument as B } from "./index162.js";
7
+ import { useStableCallback as h } from "./index95.js";
8
+ import { useIsoLayoutEffect as be } from "./index97.js";
9
+ import { EMPTY_OBJECT as Te } from "./index106.js";
10
+ import { FloatingTreeStore as xe } from "./index163.js";
11
+ import { useMenuRootContext as G } from "./index133.js";
12
+ import { pressableTriggerOpenStateMapping as H } from "./index111.js";
13
+ import { useRenderElement as ye } from "./index86.js";
14
+ import { useButton as Re } from "./index89.js";
15
+ import { getPseudoElementBounds as Me } from "./index164.js";
16
+ import { CompositeItem as Oe } from "./index165.js";
17
+ import { useCompositeRootContext as he } from "./index98.js";
18
+ import { findRootOwnerId as Ee } from "./index166.js";
19
+ import { useBaseUiId as ve } from "./index115.js";
20
+ import { useMixedToggleClickHandler as Ce } from "./index167.js";
21
+ import { useContextMenuRootContext as Ie } from "./index144.js";
22
+ import { useMenubarContext as Fe } from "./index152.js";
23
+ import { PATIENT_CLICK_THRESHOLD as Pe } from "./index125.js";
24
+ import { FocusGuard as A } from "./index168.js";
25
+ import { createChangeEventDetails as U } from "./index113.js";
26
+ import { jsx as g, jsxs as we } from "react/jsx-runtime";
27
+ import { useFloatingTree as Se, useFloatingNodeId as ke, useFloatingParentNodeId as Ne } from "./index145.js";
28
+ import { useHoverReferenceInteraction as De } from "./index169.js";
29
+ import { safePolygon as Be } from "./index170.js";
30
+ import { useClick as He } from "./index127.js";
31
+ import { useFocus as Ae } from "./index171.js";
32
+ import { useInteractions as Ue } from "./index128.js";
33
+ import { getTabbableBeforeElement as _e, isOutsideEvent as Le, getTabbableAfterElement as Ge, getNextTabbable as Ye } from "./index172.js";
34
+ import { useTriggerDataForwarding as je } from "./index126.js";
35
+ import { triggerHover as Ke, cancelOpen as Ve, focusOut as _ } from "./index114.js";
36
+ import { contains as E } from "./index173.js";
37
+ const x = 2, Xe = /* @__PURE__ */ n.forwardRef(function(c, u) {
38
+ const {
39
+ render: d,
40
+ className: m,
41
+ disabled: Y = !1,
42
+ nativeButton: j = !0,
43
+ id: K,
44
+ openOnHover: V,
45
+ delay: X = 100,
46
+ closeDelay: v = 0,
47
+ handle: $,
48
+ payload: J,
49
+ ...q
50
+ } = c, z = G(!0), e = $?.store ?? z?.store;
51
+ if (!e)
52
+ throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle." : de(85));
53
+ const l = ve(K), Q = e.useState("isTriggerActive", l), y = e.useState("floatingRootContext"), s = e.useState("isOpenedByTrigger", l), b = n.useRef(null), t = Je(), W = he(!0), C = Se(), T = n.useMemo(() => C ?? new xe(), [C]), Z = ke(T), ee = Ne(), {
54
+ registerTrigger: te,
55
+ isMountedByThisTrigger: I
56
+ } = je(l, b, e, {
57
+ payload: J,
58
+ closeDelay: v,
59
+ parent: t,
60
+ floatingTreeRoot: T,
61
+ floatingNodeId: Z,
62
+ floatingParentNodeId: ee,
63
+ keyboardEventRelay: W?.relayKeyboardEvent
64
+ }), oe = e.useState("disabled"), p = Y || oe || t.type === "menubar" && t.context.disabled, {
65
+ getButtonProps: re,
66
+ buttonRef: ne
67
+ } = Re({
68
+ disabled: p,
69
+ native: j
70
+ });
71
+ n.useEffect(() => {
72
+ !s && t.type === void 0 && (e.context.allowMouseUpTriggerRef.current = !1);
73
+ }, [e, s, t.type]);
74
+ const f = n.useRef(null), F = L(), R = h((o) => {
75
+ if (!f.current)
76
+ return;
77
+ F.clear(), e.context.allowMouseUpTriggerRef.current = !1;
78
+ const i = o.target;
79
+ if (E(f.current, i) || E(e.select("positionerElement"), i) || i === f.current || i != null && Ee(i) === e.select("rootId"))
80
+ return;
81
+ const r = Me(f.current);
82
+ o.clientX >= r.left - x && o.clientX <= r.right + x && o.clientY >= r.top - x && o.clientY <= r.bottom + x || T.events.emit("close", {
83
+ domEvent: o,
84
+ reason: Ve
85
+ });
86
+ });
87
+ n.useEffect(() => {
88
+ s && e.select("lastOpenChangeReason") === Ke && B(f.current).addEventListener("mouseup", R, {
89
+ once: !0
90
+ });
91
+ }, [s, R, e]);
92
+ const M = t.type === "menubar" && t.context.hasSubmenuOpen, se = De(y, {
93
+ enabled: (V ?? M ?? !1) && !p && t.type !== "context-menu" && (t.type !== "menubar" || M && !I),
94
+ handleClose: Be({
95
+ blockPointerEvents: t.type !== "menubar"
96
+ }),
97
+ mouseOnly: !0,
98
+ move: !1,
99
+ restMs: t.type === void 0 ? X : void 0,
100
+ delay: {
101
+ close: v
102
+ },
103
+ triggerElementRef: b,
104
+ externalTree: T,
105
+ isActiveTrigger: Q
106
+ }), ie = $e(s, e.select("lastOpenChangeReason")), ue = He(y, {
107
+ enabled: !p && t.type !== "context-menu",
108
+ event: s && t.type === "menubar" ? "click" : "mousedown",
109
+ toggle: !0,
110
+ ignoreMouse: !1,
111
+ stickIfOpen: t.type === void 0 ? ie : !1
112
+ }), ae = Ae(y, {
113
+ enabled: !p && (t.type !== "menubar" && s || M)
114
+ }), ce = Ce({
115
+ open: s,
116
+ enabled: t.type === "menubar",
117
+ mouseDownAction: "open"
118
+ }), le = Ue([ue, ae]), O = t.type === "menubar", P = n.useMemo(() => ({
119
+ disabled: p,
120
+ open: s
121
+ }), [p, s]), pe = e.useState("triggerProps", I), w = [f, u, ne, te, b], S = [le.getReferenceProps(), se ?? Te, pe, {
122
+ "aria-haspopup": "menu",
123
+ id: l,
124
+ onMouseDown: (o) => {
125
+ if (e.select("open"))
126
+ return;
127
+ F.start(200, () => {
128
+ e.context.allowMouseUpTriggerRef.current = !0;
129
+ }), B(o.currentTarget).addEventListener("mouseup", R, {
130
+ once: !0
131
+ });
132
+ }
133
+ }, O ? {
134
+ role: "menuitem"
135
+ } : {}, ce, q, re], k = n.useRef(null), fe = h((o) => {
136
+ D.flushSync(() => {
137
+ e.setOpen(!1, U(_, o.nativeEvent, o.currentTarget));
138
+ }), _e(k.current)?.focus();
139
+ }), me = h((o) => {
140
+ const i = e.select("positionerElement");
141
+ if (i && Le(o, i))
142
+ e.context.beforeContentFocusGuardRef.current?.focus();
143
+ else {
144
+ D.flushSync(() => {
145
+ e.setOpen(!1, U(_, o.nativeEvent, o.currentTarget));
146
+ });
147
+ let r = Ge(b.current);
148
+ for (; r !== null && E(i, r) || r?.hasAttribute("aria-hidden"); ) {
149
+ const ge = r;
150
+ if (r = Ye(r), r === ge)
151
+ break;
152
+ }
153
+ r?.focus();
154
+ }
155
+ }), N = ye("button", c, {
156
+ enabled: !O,
157
+ stateAttributesMapping: H,
158
+ state: P,
159
+ ref: w,
160
+ props: S
161
+ });
162
+ return O ? /* @__PURE__ */ g(Oe, {
163
+ tag: "button",
164
+ render: d,
165
+ className: m,
166
+ state: P,
167
+ refs: w,
168
+ props: S,
169
+ stateAttributesMapping: H
170
+ }) : s ? /* @__PURE__ */ we(n.Fragment, {
171
+ children: [/* @__PURE__ */ g(A, {
172
+ ref: k,
173
+ onFocus: fe
174
+ }, `${l}-pre-focus-guard`), /* @__PURE__ */ g(n.Fragment, {
175
+ children: N
176
+ }, l), /* @__PURE__ */ g(A, {
177
+ ref: e.context.triggerFocusTargetRef,
178
+ onFocus: me
179
+ }, `${l}-post-focus-guard`)]
180
+ }) : /* @__PURE__ */ g(n.Fragment, {
181
+ children: N
182
+ }, l);
183
+ });
184
+ process.env.NODE_ENV !== "production" && (Xe.displayName = "MenuTrigger");
185
+ function $e(a, c) {
186
+ const u = L(), [d, m] = n.useState(!1);
187
+ return be(() => {
188
+ a && c === "trigger-hover" ? (m(!0), u.start(Pe, () => {
189
+ m(!1);
190
+ })) : a || (u.clear(), m(!1));
191
+ }, [a, c, u]), d;
192
+ }
193
+ function Je() {
194
+ const a = Ie(!0), c = G(!0), u = Fe();
195
+ return n.useMemo(() => u ? {
196
+ type: "menubar",
197
+ context: u
198
+ } : a && !c ? {
199
+ type: "context-menu",
200
+ context: a
201
+ } : {
202
+ type: void 0
203
+ }, [a, c, u]);
204
+ }
205
+ export {
206
+ Xe as MenuTrigger
207
+ };
@@ -0,0 +1,146 @@
1
+ "use client";
2
+ import * as l from "react";
3
+ import { inertValue as X } from "./index122.js";
4
+ import { MenuPositionerContext as Y } from "./index135.js";
5
+ import { useMenuRootContext as Z } from "./index133.js";
6
+ import { useAnchorPositioning as $ } from "./index142.js";
7
+ import { useRenderElement as ee } from "./index86.js";
8
+ import { popupStateMapping as te } from "./index111.js";
9
+ import { CompositeList as ne } from "./index143.js";
10
+ import { InternalBackdrop as oe } from "./index123.js";
11
+ import { useMenuPortalContext as re } from "./index141.js";
12
+ import { DROPDOWN_COLLISION_AVOIDANCE as se, POPUP_COLLISION_AVOIDANCE as ie } from "./index125.js";
13
+ import { useContextMenuRootContext as ae } from "./index144.js";
14
+ import { createChangeEventDetails as x } from "./index113.js";
15
+ import { jsxs as le, jsx as I } from "react/jsx-runtime";
16
+ import { FloatingNode as de } from "./index145.js";
17
+ import { triggerHover as ce, siblingOpen as g } from "./index114.js";
18
+ const fe = /* @__PURE__ */ l.forwardRef(function(d, M) {
19
+ const {
20
+ anchor: v,
21
+ positionMethod: E = "absolute",
22
+ className: pe,
23
+ render: me,
24
+ side: O,
25
+ align: b,
26
+ sideOffset: A = 0,
27
+ alignOffset: w = 0,
28
+ collisionBoundary: D = "clipping-ancestors",
29
+ collisionPadding: k = 5,
30
+ arrowPadding: L = 5,
31
+ sticky: H = !1,
32
+ disableAnchorTracking: T = !1,
33
+ collisionAvoidance: V = se,
34
+ ..._
35
+ } = d, {
36
+ store: e
37
+ } = Z(), B = re(), U = ae(!0), n = e.useState("parent"), j = e.useState("floatingRootContext"), s = e.useState("floatingTreeRoot"), u = e.useState("mounted"), i = e.useState("open"), F = e.useState("modal"), p = e.useState("activeTriggerElement"), W = e.useState("lastOpenChangeReason"), a = e.useState("floatingNodeId"), P = e.useState("floatingParentNodeId");
38
+ let y = v, N = A, S = w, m = b, C = V;
39
+ n.type === "context-menu" && (y = v ?? n.context?.anchor, m = m ?? "start", !O && m !== "center" && (S = d.alignOffset ?? 2, N = d.sideOffset ?? -5));
40
+ let c = O, f = m;
41
+ n.type === "menu" ? (c = c ?? "inline-end", f = f ?? "start", C = d.collisionAvoidance ?? ie) : n.type === "menubar" && (c = c ?? "bottom", f = f ?? "start");
42
+ const R = n.type === "context-menu", t = $({
43
+ anchor: y,
44
+ floatingRootContext: j,
45
+ positionMethod: U ? "fixed" : E,
46
+ mounted: u,
47
+ side: c,
48
+ sideOffset: N,
49
+ align: f,
50
+ alignOffset: S,
51
+ arrowPadding: R ? 0 : L,
52
+ collisionBoundary: D,
53
+ collisionPadding: k,
54
+ sticky: H,
55
+ nodeId: a,
56
+ keepMounted: B,
57
+ disableAnchorTracking: T,
58
+ collisionAvoidance: C,
59
+ shiftCrossAxis: R,
60
+ externalTree: s
61
+ }), q = l.useMemo(() => {
62
+ const r = {};
63
+ return i || (r.pointerEvents = "none"), {
64
+ role: "presentation",
65
+ hidden: !u,
66
+ style: {
67
+ ...t.positionerStyles,
68
+ ...r
69
+ }
70
+ };
71
+ }, [i, u, t.positionerStyles]);
72
+ l.useEffect(() => {
73
+ function r(o) {
74
+ o.open ? (o.parentNodeId === a && e.set("hoverEnabled", !1), o.nodeId !== a && o.parentNodeId === e.select("floatingParentNodeId") && e.setOpen(!1, x(g))) : o.parentNodeId === a && o.reason !== g && e.set("hoverEnabled", !0);
75
+ }
76
+ return s.events.on("menuopenchange", r), () => {
77
+ s.events.off("menuopenchange", r);
78
+ };
79
+ }, [e, s.events, a]), l.useEffect(() => {
80
+ if (e.select("floatingParentNodeId") == null)
81
+ return;
82
+ function r(o) {
83
+ if (o.open || o.nodeId !== e.select("floatingParentNodeId"))
84
+ return;
85
+ const Q = o.reason ?? g;
86
+ e.setOpen(!1, x(Q));
87
+ }
88
+ return s.events.on("menuopenchange", r), () => {
89
+ s.events.off("menuopenchange", r);
90
+ };
91
+ }, [s.events, e]), l.useEffect(() => {
92
+ function r(o) {
93
+ !i || o.nodeId !== e.select("floatingParentNodeId") || o.target && p && p !== o.target && e.setOpen(!1, x(g));
94
+ }
95
+ return s.events.on("itemhover", r), () => {
96
+ s.events.off("itemhover", r);
97
+ };
98
+ }, [s.events, i, p, e]), l.useEffect(() => {
99
+ const r = {
100
+ open: i,
101
+ nodeId: a,
102
+ parentNodeId: P,
103
+ reason: e.select("lastOpenChangeReason")
104
+ };
105
+ s.events.emit("menuopenchange", r);
106
+ }, [s.events, i, e, a, P]);
107
+ const z = l.useMemo(() => ({
108
+ open: i,
109
+ side: t.side,
110
+ align: t.align,
111
+ anchorHidden: t.anchorHidden,
112
+ nested: n.type === "menu"
113
+ }), [i, t.side, t.align, t.anchorHidden, n.type]), G = l.useMemo(() => ({
114
+ side: t.side,
115
+ align: t.align,
116
+ arrowRef: t.arrowRef,
117
+ arrowUncentered: t.arrowUncentered,
118
+ arrowStyles: t.arrowStyles,
119
+ nodeId: t.context.nodeId
120
+ }), [t.side, t.align, t.arrowRef, t.arrowUncentered, t.arrowStyles, t.context.nodeId]), J = ee("div", d, {
121
+ state: z,
122
+ stateAttributesMapping: te,
123
+ ref: [M, e.useStateSetter("positionerElement")],
124
+ props: [q, _]
125
+ }), K = u && n.type !== "menu" && (n.type !== "menubar" && F && W !== ce || n.type === "menubar" && n.context.modal);
126
+ let h = null;
127
+ return n.type === "menubar" ? h = n.context.contentElement : n.type === void 0 && (h = p), /* @__PURE__ */ le(Y.Provider, {
128
+ value: G,
129
+ children: [K && /* @__PURE__ */ I(oe, {
130
+ ref: n.type === "context-menu" || n.type === "nested-context-menu" ? n.context.internalBackdropRef : null,
131
+ inert: X(!i),
132
+ cutout: h
133
+ }), /* @__PURE__ */ I(de, {
134
+ id: a,
135
+ children: /* @__PURE__ */ I(ne, {
136
+ elementsRef: e.context.itemDomElements,
137
+ labelsRef: e.context.itemLabels,
138
+ children: J
139
+ })
140
+ })]
141
+ });
142
+ });
143
+ process.env.NODE_ENV !== "production" && (fe.displayName = "MenuPositioner");
144
+ export {
145
+ fe as MenuPositioner
146
+ };