@rpcbase/ui 0.252.0 → 0.254.0

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 (353) hide show
  1. package/dist/components/Notifications/types.d.ts +2 -0
  2. package/dist/components/Notifications/types.d.ts.map +1 -1
  3. package/dist/index10.js +2 -2
  4. package/dist/index106.js +1 -1
  5. package/dist/index11.js +2 -2
  6. package/dist/index12.js +3 -3
  7. package/dist/index120.js +10 -10
  8. package/dist/index122.js +2 -2
  9. package/dist/index123.js +3 -3
  10. package/dist/index13.js +2 -2
  11. package/dist/index14.js +2 -2
  12. package/dist/index15.js +2 -2
  13. package/dist/index16.js +8 -8
  14. package/dist/index167.js +3 -3
  15. package/dist/index17.js +1 -1
  16. package/dist/index172.js +3 -3
  17. package/dist/index175.js +1 -1
  18. package/dist/index176.js +4 -4
  19. package/dist/index18.js +7 -7
  20. package/dist/index182.js +2 -2
  21. package/dist/index184.js +4 -4
  22. package/dist/index185.js +14 -14
  23. package/dist/index186.js +1 -1
  24. package/dist/index187.js +1 -1
  25. package/dist/index188.js +6 -6
  26. package/dist/index189.js +2 -2
  27. package/dist/index19.js +16 -16
  28. package/dist/index192.js +2 -2
  29. package/dist/index193.js +6 -6
  30. package/dist/index21.js +1 -1
  31. package/dist/index22.js +2 -2
  32. package/dist/index23.js +1 -1
  33. package/dist/index235.js +27 -14
  34. package/dist/index235.js.map +1 -1
  35. package/dist/index236.js +12 -7
  36. package/dist/index236.js.map +1 -1
  37. package/dist/index237.js +24 -9
  38. package/dist/index237.js.map +1 -1
  39. package/dist/index238.js +5 -10
  40. package/dist/index238.js.map +1 -1
  41. package/dist/index239.js +15 -20
  42. package/dist/index239.js.map +1 -1
  43. package/dist/index24.js +1 -1
  44. package/dist/index240.js +7 -8
  45. package/dist/index240.js.map +1 -1
  46. package/dist/index241.js +10 -9
  47. package/dist/index241.js.map +1 -1
  48. package/dist/index242.js +10 -9
  49. package/dist/index242.js.map +1 -1
  50. package/dist/index243.js +21 -4
  51. package/dist/index243.js.map +1 -1
  52. package/dist/index244.js +8 -5
  53. package/dist/index244.js.map +1 -1
  54. package/dist/index245.js +9 -16
  55. package/dist/index245.js.map +1 -1
  56. package/dist/index246.js +8 -8
  57. package/dist/index246.js.map +1 -1
  58. package/dist/index247.js +4 -18
  59. package/dist/index247.js.map +1 -1
  60. package/dist/index248.js +5 -20
  61. package/dist/index248.js.map +1 -1
  62. package/dist/index249.js +16 -12
  63. package/dist/index249.js.map +1 -1
  64. package/dist/index25.js +1 -1
  65. package/dist/index250.js +9 -29
  66. package/dist/index250.js.map +1 -1
  67. package/dist/index251.js +18 -12
  68. package/dist/index251.js.map +1 -1
  69. package/dist/index252.js +20 -25
  70. package/dist/index252.js.map +1 -1
  71. package/dist/index253.js +12 -5
  72. package/dist/index253.js.map +1 -1
  73. package/dist/index260.js +2 -2
  74. package/dist/index273.js +1 -1
  75. package/dist/index277.js +25 -20
  76. package/dist/index277.js.map +1 -1
  77. package/dist/index278.js +24 -62
  78. package/dist/index278.js.map +1 -1
  79. package/dist/index279.js +16 -6
  80. package/dist/index279.js.map +1 -1
  81. package/dist/index28.js +1 -1
  82. package/dist/index280.js +20 -6
  83. package/dist/index280.js.map +1 -1
  84. package/dist/index281.js +66 -11
  85. package/dist/index281.js.map +1 -1
  86. package/dist/index282.js +6 -3
  87. package/dist/index282.js.map +1 -1
  88. package/dist/index283.js +5 -50
  89. package/dist/index283.js.map +1 -1
  90. package/dist/index284.js +12 -4
  91. package/dist/index284.js.map +1 -1
  92. package/dist/index285.js +3 -29
  93. package/dist/index285.js.map +1 -1
  94. package/dist/index286.js +49 -15
  95. package/dist/index286.js.map +1 -1
  96. package/dist/index287.js +4 -6
  97. package/dist/index287.js.map +1 -1
  98. package/dist/index288.js +28 -20
  99. package/dist/index288.js.map +1 -1
  100. package/dist/index289.js +15 -52
  101. package/dist/index289.js.map +1 -1
  102. package/dist/index29.js +3 -56
  103. package/dist/index29.js.map +1 -1
  104. package/dist/index290.js +5 -20
  105. package/dist/index290.js.map +1 -1
  106. package/dist/index291.js +21 -41
  107. package/dist/index291.js.map +1 -1
  108. package/dist/index292.js +53 -39
  109. package/dist/index292.js.map +1 -1
  110. package/dist/index293.js +21 -46
  111. package/dist/index293.js.map +1 -1
  112. package/dist/index294.js +40 -19
  113. package/dist/index294.js.map +1 -1
  114. package/dist/index295.js +38 -69
  115. package/dist/index295.js.map +1 -1
  116. package/dist/index296.js +46 -18
  117. package/dist/index296.js.map +1 -1
  118. package/dist/index297.js +20 -3
  119. package/dist/index297.js.map +1 -1
  120. package/dist/index298.js +69 -10
  121. package/dist/index298.js.map +1 -1
  122. package/dist/index299.js +16 -12
  123. package/dist/index299.js.map +1 -1
  124. package/dist/index3.js +2 -2
  125. package/dist/index30.js +242 -3
  126. package/dist/index30.js.map +1 -1
  127. package/dist/index300.js +3 -18
  128. package/dist/index300.js.map +1 -1
  129. package/dist/index301.js +11 -36
  130. package/dist/index301.js.map +1 -1
  131. package/dist/index302.js +12 -238
  132. package/dist/index302.js.map +1 -1
  133. package/dist/index303.js +15 -249
  134. package/dist/index303.js.map +1 -1
  135. package/dist/index304.js +35 -67
  136. package/dist/index304.js.map +1 -1
  137. package/dist/index305.js +233 -93
  138. package/dist/index305.js.map +1 -1
  139. package/dist/index306.js +243 -74
  140. package/dist/index306.js.map +1 -1
  141. package/dist/index307.js +68 -3
  142. package/dist/index307.js.map +1 -1
  143. package/dist/index308.js +96 -26
  144. package/dist/index308.js.map +1 -1
  145. package/dist/index309.js +83 -16
  146. package/dist/index309.js.map +1 -1
  147. package/dist/index31.js +21 -239
  148. package/dist/index31.js.map +1 -1
  149. package/dist/index310.js +4 -35
  150. package/dist/index310.js.map +1 -1
  151. package/dist/index311.js +28 -16
  152. package/dist/index311.js.map +1 -1
  153. package/dist/index312.js +16 -3
  154. package/dist/index312.js.map +1 -1
  155. package/dist/index313.js +35 -27
  156. package/dist/index313.js.map +1 -1
  157. package/dist/index314.js +17 -28
  158. package/dist/index314.js.map +1 -1
  159. package/dist/index315.js +4 -4
  160. package/dist/index315.js.map +1 -1
  161. package/dist/index316.js +23 -75
  162. package/dist/index316.js.map +1 -1
  163. package/dist/index317.js +25 -269
  164. package/dist/index317.js.map +1 -1
  165. package/dist/index318.js +4 -12
  166. package/dist/index318.js.map +1 -1
  167. package/dist/index319.js +79 -11
  168. package/dist/index319.js.map +1 -1
  169. package/dist/index32.js +4 -23
  170. package/dist/index32.js.map +1 -1
  171. package/dist/index320.js +270 -23
  172. package/dist/index320.js.map +1 -1
  173. package/dist/index321.js +11 -16
  174. package/dist/index321.js.map +1 -1
  175. package/dist/index322.js +10 -125
  176. package/dist/index322.js.map +1 -1
  177. package/dist/index323.js +24 -4
  178. package/dist/index323.js.map +1 -1
  179. package/dist/index324.js +16 -65
  180. package/dist/index324.js.map +1 -1
  181. package/dist/index325.js +125 -13
  182. package/dist/index325.js.map +1 -1
  183. package/dist/index326.js +5 -7
  184. package/dist/index326.js.map +1 -1
  185. package/dist/index327.js +65 -5
  186. package/dist/index327.js.map +1 -1
  187. package/dist/index328.js +14 -4
  188. package/dist/index328.js.map +1 -1
  189. package/dist/index329.js +7 -10
  190. package/dist/index329.js.map +1 -1
  191. package/dist/index33.js +6 -3
  192. package/dist/index33.js.map +1 -1
  193. package/dist/index330.js +5 -7
  194. package/dist/index330.js.map +1 -1
  195. package/dist/index331.js +3 -133
  196. package/dist/index331.js.map +1 -1
  197. package/dist/index332.js +9 -398
  198. package/dist/index332.js.map +1 -1
  199. package/dist/index333.js +8 -5
  200. package/dist/index333.js.map +1 -1
  201. package/dist/index334.js +131 -50
  202. package/dist/index334.js.map +1 -1
  203. package/dist/index335.js +399 -11
  204. package/dist/index335.js.map +1 -1
  205. package/dist/index336.js +5 -28
  206. package/dist/index336.js.map +1 -1
  207. package/dist/index337.js +52 -11
  208. package/dist/index337.js.map +1 -1
  209. package/dist/index338.js +11 -24
  210. package/dist/index338.js.map +1 -1
  211. package/dist/index339.js +27 -28
  212. package/dist/index339.js.map +1 -1
  213. package/dist/index34.js +38 -8
  214. package/dist/index34.js.map +1 -1
  215. package/dist/index340.js +11 -16
  216. package/dist/index340.js.map +1 -1
  217. package/dist/index341.js +1 -1
  218. package/dist/index348.js +5 -51
  219. package/dist/index348.js.map +1 -1
  220. package/dist/index349.js +51 -5
  221. package/dist/index349.js.map +1 -1
  222. package/dist/index35.js +74 -35
  223. package/dist/index35.js.map +1 -1
  224. package/dist/index350.js +3 -3
  225. package/dist/index358.js +5 -5
  226. package/dist/index359.js +1 -1
  227. package/dist/index36.js +20 -74
  228. package/dist/index36.js.map +1 -1
  229. package/dist/index363.js +5 -5
  230. package/dist/index368.js +11 -5
  231. package/dist/index368.js.map +1 -1
  232. package/dist/index369.js +6 -3
  233. package/dist/index369.js.map +1 -1
  234. package/dist/index37.js +33 -18
  235. package/dist/index37.js.map +1 -1
  236. package/dist/index370.js +3 -12
  237. package/dist/index370.js.map +1 -1
  238. package/dist/index372.js +1 -1
  239. package/dist/index375.js +2 -2
  240. package/dist/index376.js +3 -3
  241. package/dist/index377.js +8 -8
  242. package/dist/index379.js +5 -5
  243. package/dist/index38.js +26 -36
  244. package/dist/index38.js.map +1 -1
  245. package/dist/index380.js +3 -3
  246. package/dist/index382.js +1 -1
  247. package/dist/index384.js +1 -1
  248. package/dist/index385.js +2 -2
  249. package/dist/index386.js +1 -1
  250. package/dist/index388.js +2 -2
  251. package/dist/index389.js +2 -2
  252. package/dist/index39.js +21 -26
  253. package/dist/index39.js.map +1 -1
  254. package/dist/index399.js +2 -2
  255. package/dist/index4.js +2 -2
  256. package/dist/index40.js +56 -20
  257. package/dist/index40.js.map +1 -1
  258. package/dist/index41.js +51 -59
  259. package/dist/index41.js.map +1 -1
  260. package/dist/index411.js +3 -15
  261. package/dist/index411.js.map +1 -1
  262. package/dist/index412.js +15 -3
  263. package/dist/index412.js.map +1 -1
  264. package/dist/index413.js +1 -1
  265. package/dist/index414.js +68 -5
  266. package/dist/index414.js.map +1 -1
  267. package/dist/index415.js +30 -55
  268. package/dist/index415.js.map +1 -1
  269. package/dist/index416.js +9 -68
  270. package/dist/index416.js.map +1 -1
  271. package/dist/index417.js +148 -26
  272. package/dist/index417.js.map +1 -1
  273. package/dist/index418.js +108 -9
  274. package/dist/index418.js.map +1 -1
  275. package/dist/index419.js +5 -153
  276. package/dist/index419.js.map +1 -1
  277. package/dist/index42.js +21 -50
  278. package/dist/index42.js.map +1 -1
  279. package/dist/index420.js +54 -106
  280. package/dist/index420.js.map +1 -1
  281. package/dist/index43.js +127 -18
  282. package/dist/index43.js.map +1 -1
  283. package/dist/index44.js +39 -122
  284. package/dist/index44.js.map +1 -1
  285. package/dist/index45.js +85 -42
  286. package/dist/index45.js.map +1 -1
  287. package/dist/index46.js +123 -87
  288. package/dist/index46.js.map +1 -1
  289. package/dist/index47.js +5 -126
  290. package/dist/index47.js.map +1 -1
  291. package/dist/index48.js +332 -5
  292. package/dist/index48.js.map +1 -1
  293. package/dist/index49.js +245 -320
  294. package/dist/index49.js.map +1 -1
  295. package/dist/index5.js +2 -2
  296. package/dist/index50.js +23 -254
  297. package/dist/index50.js.map +1 -1
  298. package/dist/index51.js +129 -25
  299. package/dist/index51.js.map +1 -1
  300. package/dist/index52.js +24 -129
  301. package/dist/index52.js.map +1 -1
  302. package/dist/index53.js +19 -22
  303. package/dist/index53.js.map +1 -1
  304. package/dist/index54.js +134 -19
  305. package/dist/index54.js.map +1 -1
  306. package/dist/index55.js +30 -133
  307. package/dist/index55.js.map +1 -1
  308. package/dist/index56.js +24 -30
  309. package/dist/index56.js.map +1 -1
  310. package/dist/index57.js +38 -26
  311. package/dist/index57.js.map +1 -1
  312. package/dist/index58.js +19 -39
  313. package/dist/index58.js.map +1 -1
  314. package/dist/index59.js +133 -18
  315. package/dist/index59.js.map +1 -1
  316. package/dist/index6.js +4 -4
  317. package/dist/index60.js +49 -134
  318. package/dist/index60.js.map +1 -1
  319. package/dist/index61.js +25 -48
  320. package/dist/index61.js.map +1 -1
  321. package/dist/index62.js +57 -28
  322. package/dist/index62.js.map +1 -1
  323. package/dist/index63.js +56 -57
  324. package/dist/index63.js.map +1 -1
  325. package/dist/index64.js +5 -5
  326. package/dist/index64.js.map +1 -1
  327. package/dist/index66.js +23 -11
  328. package/dist/index66.js.map +1 -1
  329. package/dist/index67.js +232 -17
  330. package/dist/index67.js.map +1 -1
  331. package/dist/index68.js +5 -5
  332. package/dist/index68.js.map +1 -1
  333. package/dist/index7.js +11 -11
  334. package/dist/index70.js +11 -23
  335. package/dist/index70.js.map +1 -1
  336. package/dist/index71.js +17 -232
  337. package/dist/index71.js.map +1 -1
  338. package/dist/index72.js +6 -2
  339. package/dist/index72.js.map +1 -1
  340. package/dist/index73.js +8 -2
  341. package/dist/index73.js.map +1 -1
  342. package/dist/index74.js +6 -2
  343. package/dist/index74.js.map +1 -1
  344. package/dist/index75.js +2 -2
  345. package/dist/index76.js +2 -6
  346. package/dist/index76.js.map +1 -1
  347. package/dist/index77.js +2 -8
  348. package/dist/index77.js.map +1 -1
  349. package/dist/index78.js +2 -6
  350. package/dist/index78.js.map +1 -1
  351. package/dist/index8.js +2 -2
  352. package/dist/index9.js +1 -1
  353. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index305.js","sources":["../../../node_modules/@base-ui/react/merge-props/mergeProps.mjs"],"sourcesContent":["import { mergeObjects } from '@base-ui/utils/mergeObjects';\nconst EMPTY_PROPS = {};\n\n/* eslint-disable id-denylist */\n/**\n * Merges multiple sets of React props. It follows the Object.assign pattern where the rightmost object's fields overwrite\n * the conflicting ones from others. This doesn't apply to event handlers, `className` and `style` props.\n *\n * Event handlers are merged and called in right-to-left order (rightmost handler executes first, leftmost last).\n * For React synthetic events, the rightmost handler can prevent prior (left-positioned) handlers from executing\n * by calling `event.preventBaseUIHandler()`. For non-synthetic events (custom events with primitive/object values),\n * all handlers always execute without prevention capability.\n *\n * The `className` prop is merged by concatenating classes in right-to-left order (rightmost class appears first in the string).\n * The `style` prop is merged with rightmost styles overwriting the prior ones.\n *\n * Props can either be provided as objects or as functions that take the previous props as an argument.\n * The function will receive the merged props up to that point (going from left to right):\n * so in the case of `(obj1, obj2, fn, obj3)`, `fn` will receive the merged props of `obj1` and `obj2`.\n * The function is responsible for chaining event handlers if needed (that is, we don't run the merge logic).\n *\n * Event handlers returned by the functions are not automatically prevented when `preventBaseUIHandler` is called.\n * They must check `event.baseUIHandlerPrevented` themselves and bail out if it's true.\n *\n * @important **`ref` is not merged.**\n * @param a Props object to merge.\n * @param b Props object to merge. The function will overwrite conflicting props from `a`.\n * @param c Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param d Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @param e Props object to merge. The function will overwrite conflicting props from previous parameters.\n * @returns The merged props.\n * @public\n */\n\nexport function mergeProps(a, b, c, d, e) {\n if (!c && !d && !e && !a) {\n return createInitialMergedProps(b);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(a);\n if (b) {\n merged = mergeInto(merged, b);\n }\n if (c) {\n merged = mergeInto(merged, c);\n }\n if (d) {\n merged = mergeInto(merged, d);\n }\n if (e) {\n merged = mergeInto(merged, e);\n }\n return merged;\n}\n/* eslint-enable id-denylist */\n\n/**\n * Merges an arbitrary number of React props using the same logic as {@link mergeProps}.\n * This function accepts an array of props instead of individual arguments.\n *\n * This has slightly lower performance than {@link mergeProps} due to accepting an array\n * instead of a fixed number of arguments. Prefer {@link mergeProps} when merging 5 or\n * fewer prop sets for better performance.\n *\n * @param props Array of props to merge.\n * @returns The merged props.\n * @see mergeProps\n * @public\n */\nexport function mergePropsN(props) {\n if (props.length === 0) {\n return EMPTY_PROPS;\n }\n if (props.length === 1) {\n return createInitialMergedProps(props[0]);\n }\n\n // We need to mutably own `merged`.\n let merged = createInitialMergedProps(props[0]);\n for (let i = 1; i < props.length; i += 1) {\n merged = mergeInto(merged, props[i]);\n }\n return merged;\n}\nfunction createInitialMergedProps(inputProps) {\n if (isPropsGetter(inputProps)) {\n // Getter-returned handlers intentionally keep their existing semantics.\n return {\n ...resolvePropsGetter(inputProps, EMPTY_PROPS)\n };\n }\n return copyInitialProps(inputProps);\n}\nfunction mergeInto(merged, inputProps) {\n if (isPropsGetter(inputProps)) {\n return resolvePropsGetter(inputProps, merged);\n }\n return mutablyMergeInto(merged, inputProps);\n}\nfunction copyInitialProps(inputProps) {\n const copiedProps = {\n ...inputProps\n };\n\n // `copiedProps` is our fresh own-object copy, so iterating with `for...in` is safe here.\n // eslint-disable-next-line guard-for-in\n for (const propName in copiedProps) {\n const propValue = copiedProps[propName];\n if (isEventHandler(propName, propValue)) {\n copiedProps[propName] = wrapEventHandler(propValue);\n }\n }\n return copiedProps;\n}\n\n/**\n * Merges two sets of props. In case of conflicts, the external props take precedence.\n */\nfunction mutablyMergeInto(mergedProps, externalProps) {\n if (!externalProps) {\n return mergedProps;\n }\n\n // eslint-disable-next-line guard-for-in\n for (const propName in externalProps) {\n const externalPropValue = externalProps[propName];\n switch (propName) {\n case 'style':\n {\n mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);\n break;\n }\n case 'className':\n {\n mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);\n break;\n }\n default:\n {\n if (isEventHandler(propName, externalPropValue)) {\n mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);\n } else {\n mergedProps[propName] = externalPropValue;\n }\n }\n }\n }\n return mergedProps;\n}\nfunction isEventHandler(key, value) {\n // This approach is more efficient than using a regex.\n const code0 = key.charCodeAt(0);\n const code1 = key.charCodeAt(1);\n const code2 = key.charCodeAt(2);\n return code0 === 111 /* o */ && code1 === 110 /* n */ && code2 >= 65 /* A */ && code2 <= 90 /* Z */ && (typeof value === 'function' || typeof value === 'undefined');\n}\nfunction isPropsGetter(inputProps) {\n return typeof inputProps === 'function';\n}\nfunction resolvePropsGetter(inputProps, previousProps) {\n if (isPropsGetter(inputProps)) {\n return inputProps(previousProps);\n }\n return inputProps ?? EMPTY_PROPS;\n}\nfunction mergeEventHandlers(ourHandler, theirHandler) {\n if (!theirHandler) {\n return ourHandler;\n }\n if (!ourHandler) {\n return wrapEventHandler(theirHandler);\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n const baseUIEvent = event;\n makeEventPreventable(baseUIEvent);\n const result = theirHandler(...args);\n if (!baseUIEvent.baseUIHandlerPrevented) {\n ourHandler?.(...args);\n }\n return result;\n }\n const result = theirHandler(...args);\n ourHandler?.(...args);\n return result;\n };\n}\nfunction wrapEventHandler(handler) {\n if (!handler) {\n return handler;\n }\n return (...args) => {\n const event = args[0];\n if (isSyntheticEvent(event)) {\n makeEventPreventable(event);\n }\n return handler(...args);\n };\n}\nexport function makeEventPreventable(event) {\n event.preventBaseUIHandler = () => {\n event.baseUIHandlerPrevented = true;\n };\n return event;\n}\nexport function mergeClassNames(ourClassName, theirClassName) {\n if (theirClassName) {\n if (ourClassName) {\n // eslint-disable-next-line prefer-template\n return theirClassName + ' ' + ourClassName;\n }\n return theirClassName;\n }\n return ourClassName;\n}\nfunction isSyntheticEvent(event) {\n return event != null && typeof event === 'object' && 'nativeEvent' in event;\n}"],"names":["EMPTY_PROPS","mergeProps","a","b","c","d","e","createInitialMergedProps","merged","mergeInto","mergePropsN","props","i","inputProps","isPropsGetter","resolvePropsGetter","copyInitialProps","mutablyMergeInto","copiedProps","propName","propValue","isEventHandler","wrapEventHandler","mergedProps","externalProps","externalPropValue","mergeObjects","mergeClassNames","mergeEventHandlers","key","value","code0","code1","code2","previousProps","ourHandler","theirHandler","args","event","isSyntheticEvent","baseUIEvent","makeEventPreventable","result","handler","ourClassName","theirClassName"],"mappings":";AACA,MAAMA,IAAc,CAAA;AAiCb,SAASC,EAAWC,GAAGC,GAAGC,GAAGC,GAAGC,GAAG;AACxC,MAAI,CAACF,KAAK,CAACC,KAAK,CAACC,KAAK,CAACJ;AACrB,WAAOK,EAAyBJ,CAAC;AAInC,MAAIK,IAASD,EAAyBL,CAAC;AACvC,SAAI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,KACxBG,EAAqBH,CAAK,GAErBK,EAAQ,GAAGN,CAAI;AAAA,EACxB;AACF;AACO,SAASI,EAAqBH,GAAO;AAC1C,SAAAA,EAAM,uBAAuB,MAAM;AACjC,IAAAA,EAAM,yBAAyB;AAAA,EACjC,GACOA;AACT;AACO,SAASX,EAAgBiB,GAAcC,GAAgB;AAC5D,SAAIA,IACED,IAEKC,IAAiB,MAAMD,IAEzBC,IAEFD;AACT;AACA,SAASL,EAAiBD,GAAO;AAC/B,SAAOA,KAAS,QAAQ,OAAOA,KAAU,YAAY,iBAAiBA;AACxE;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index305.js","sources":["../../../node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs"],"sourcesContent":["'use client';\n\n/* eslint-disable no-underscore-dangle */\nimport * as React from 'react';\nimport { addEventListener } from '@base-ui/utils/addEventListener';\nimport { mergeCleanups } from '@base-ui/utils/mergeCleanups';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { Timeout, useTimeout } from '@base-ui/utils/useTimeout';\nimport { getComputedStyle, getParentNode, isElement, isHTMLElement, isLastTraversableNode, isShadowRoot } from '@floating-ui/utils/dom';\nimport { platform } from '@base-ui/utils/platform';\nimport { useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { createAttribute } from \"../utils/createAttribute.mjs\";\nimport { contains, getTarget, isEventTargetWithin, isRootElement } from \"../utils/element.mjs\";\nimport { isReactEvent } from \"../utils/event.mjs\";\nimport { getNodeChildren } from \"../utils/nodes.mjs\";\nfunction alwaysFalse() {\n return false;\n}\nexport function normalizeProp(normalizable) {\n return {\n escapeKey: typeof normalizable === 'boolean' ? normalizable : normalizable?.escapeKey ?? false,\n outsidePress: typeof normalizable === 'boolean' ? normalizable : normalizable?.outsidePress ?? true\n };\n}\n/**\n * Closes the floating element when a dismissal is requested — by default, when\n * the user presses the `escape` key or outside of the floating element.\n * @see https://floating-ui.com/docs/useDismiss\n */\nexport function useDismiss(context, props = {}) {\n const {\n enabled = true,\n escapeKey = true,\n outsidePress: outsidePressProp = true,\n outsidePressEvent = 'sloppy',\n referencePress = alwaysFalse,\n bubbles,\n externalTree\n } = props;\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const {\n dataRef\n } = store.context;\n const tree = useFloatingTree(externalTree);\n const outsidePressFn = useStableCallback(typeof outsidePressProp === 'function' ? outsidePressProp : () => false);\n const outsidePress = typeof outsidePressProp === 'function' ? outsidePressFn : outsidePressProp;\n const outsidePressEnabled = outsidePress !== false;\n const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent);\n const {\n escapeKey: escapeKeyBubbles,\n outsidePress: outsidePressBubbles\n } = normalizeProp(bubbles);\n const pressStartedInsideRef = React.useRef(false);\n const pressStartPreventedRef = React.useRef(false);\n // Ignore only the very next outside click after dragging from inside to outside.\n const suppressNextOutsideClickRef = React.useRef(false);\n const isComposingRef = React.useRef(false);\n const currentPointerTypeRef = React.useRef('');\n const touchStateRef = React.useRef(null);\n const cancelDismissOnEndTimeout = useTimeout();\n const clearInsideReactTreeTimeout = useTimeout();\n const clearInsideReactTree = useStableCallback(() => {\n clearInsideReactTreeTimeout.clear();\n dataRef.current.insideReactTree = false;\n });\n const hasBlockingChild = useStableCallback(bubbleKey => {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];\n return children.some(child => child.context?.open && !child.context.dataRef.current[bubbleKey]);\n });\n const isEventWithinOwnElements = useStableCallback(event => {\n return isEventTargetWithin(event, store.select('floatingElement')) || isEventTargetWithin(event, store.select('domReferenceElement'));\n });\n const closeOnReferencePress = useStableCallback(event => {\n if (!referencePress()) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.triggerPress, event.nativeEvent));\n });\n const closeOnEscapeKeyDown = useStableCallback(event => {\n if (!open || !enabled || !escapeKey || event.key !== 'Escape') {\n return;\n }\n\n // Wait until IME is settled. Pressing `Escape` while composing should\n // close the compose menu, but not the floating element.\n if (isComposingRef.current) {\n return;\n }\n if (!escapeKeyBubbles && hasBlockingChild('__escapeKeyBubbles')) {\n return;\n }\n const native = isReactEvent(event) ? event.nativeEvent : event;\n const eventDetails = createChangeEventDetails(REASONS.escapeKey, native);\n store.setOpen(false, eventDetails);\n if (!eventDetails.isCanceled) {\n event.preventDefault();\n }\n if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) {\n event.stopPropagation();\n }\n });\n const markInsideReactTree = useStableCallback(() => {\n dataRef.current.insideReactTree = true;\n clearInsideReactTreeTimeout.start(0, clearInsideReactTree);\n });\n const markPressStartedInsideReactTree = useStableCallback(event => {\n if (!open || !enabled || event.button !== 0) {\n return;\n }\n const target = getTarget(event.nativeEvent);\n\n // Only treat presses that start within the floating DOM subtree as inside.\n // This avoids suppressing parent dismissal when interacting with nested portals.\n if (!contains(store.select('floatingElement'), target)) {\n return;\n }\n if (!pressStartedInsideRef.current) {\n pressStartedInsideRef.current = true;\n pressStartPreventedRef.current = false;\n }\n });\n const markInsidePressStartPrevented = useStableCallback(event => {\n if (!open || !enabled) {\n return;\n }\n if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) {\n return;\n }\n if (pressStartedInsideRef.current) {\n pressStartPreventedRef.current = true;\n }\n });\n React.useEffect(() => {\n if (!open || !enabled) {\n return undefined;\n }\n dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;\n dataRef.current.__outsidePressBubbles = outsidePressBubbles;\n const compositionTimeout = new Timeout();\n const preventedPressSuppressionTimeout = new Timeout();\n function handleCompositionStart() {\n compositionTimeout.clear();\n isComposingRef.current = true;\n }\n function handleCompositionEnd() {\n // Safari fires `compositionend` before `keydown`, so we need to wait\n // until the next tick to set `isComposing` to `false`.\n // https://bugs.webkit.org/show_bug.cgi?id=165004\n compositionTimeout.start(\n // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.\n // Only apply to WebKit for the test to remain 0ms.\n platform.engine.webkit ? 5 : 0, () => {\n isComposingRef.current = false;\n });\n }\n function suppressImmediateOutsideClickAfterPreventedStart() {\n suppressNextOutsideClickRef.current = true;\n // Firefox can emit the synthetic outside click in a later task after\n // pointer lock exit, so microtask clearing is too early here.\n preventedPressSuppressionTimeout.start(0, () => {\n suppressNextOutsideClickRef.current = false;\n });\n }\n function resetPressStartState() {\n pressStartedInsideRef.current = false;\n pressStartPreventedRef.current = false;\n }\n function getOutsidePressEvent() {\n const type = currentPointerTypeRef.current;\n const computedType = type === 'pen' || !type ? 'mouse' : type;\n const outsidePressEventValue = getOutsidePressEventProp();\n const resolved = typeof outsidePressEventValue === 'function' ? outsidePressEventValue() : outsidePressEventValue;\n if (typeof resolved === 'string') {\n return resolved;\n }\n return resolved[computedType];\n }\n function shouldIgnoreEvent(event) {\n const computedOutsidePressEvent = getOutsidePressEvent();\n return computedOutsidePressEvent === 'intentional' && event.type !== 'click' || computedOutsidePressEvent === 'sloppy' && event.type === 'click';\n }\n function isEventWithinFloatingTree(event) {\n const nodeId = dataRef.current.floatingContext?.nodeId;\n const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some(node => isEventTargetWithin(event, node.context?.elements.floating));\n return isEventWithinOwnElements(event) || targetIsInsideChildren;\n }\n function closeOnPressOutside(event) {\n if (shouldIgnoreEvent(event)) {\n // A new press began outside the floating element and its trigger. Clear any\n // leftover drag-out suppression so this press's eventual click can dismiss.\n if (event.type !== 'click' && !isEventWithinOwnElements(event)) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n }\n clearInsideReactTree();\n return;\n }\n if (dataRef.current.insideReactTree) {\n clearInsideReactTree();\n return;\n }\n const target = getTarget(event);\n const inertSelector = `[${createAttribute('inert')}]`;\n const targetRoot = isElement(target) ? target.getRootNode() : null;\n const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select('floatingElement'))).querySelectorAll(inertSelector));\n const triggers = store.context.triggerElements;\n\n // If another trigger is clicked, don't close the floating element.\n if (target && (triggers.hasElement(target) || triggers.hasMatchingElement(trigger => contains(trigger, target)))) {\n return;\n }\n let targetRootAncestor = isElement(target) ? target : null;\n while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) {\n const nextParent = getParentNode(targetRootAncestor);\n if (isLastTraversableNode(nextParent) || !isElement(nextParent)) {\n break;\n }\n targetRootAncestor = nextParent;\n }\n\n // Check if the click occurred on a third-party element injected after the\n // floating element rendered.\n if (markers.length && isElement(target) && !isRootElement(target) &&\n // Clicked on a direct ancestor (e.g. FloatingOverlay).\n !contains(target, store.select('floatingElement')) &&\n // If the target root element contains none of the markers, then the\n // element was injected after the floating element rendered.\n markers.every(marker => !contains(targetRootAncestor, marker))) {\n return;\n }\n\n // Check if the click occurred on the scrollbar\n // Skip for touch events: scrollbars don't receive touch events on most platforms\n if (isHTMLElement(target) && !('touches' in event)) {\n const lastTraversableNode = isLastTraversableNode(target);\n const style = getComputedStyle(target);\n const scrollRe = /auto|scroll/;\n const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);\n const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);\n const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;\n const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;\n const isRTL = style.direction === 'rtl';\n\n // Check click position relative to scrollbar.\n // In some browsers it is possible to change the <body> (or window)\n // scrollbar to the left side, but is very rare and is difficult to\n // check for. Plus, for modal dialogs with backdrops, it is more\n // important that the backdrop is checked but not so much the window.\n const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);\n const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;\n if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {\n return;\n }\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // In intentional mode, a press that starts inside and ends outside gets\n // one suppressed outside click. Run this after inside-target checks so\n // inside clicks don't consume the one-shot suppression.\n if (getOutsidePressEvent() === 'intentional' && suppressNextOutsideClickRef.current) {\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = false;\n return;\n }\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n if (hasBlockingChild('__outsidePressBubbles')) {\n return;\n }\n store.setOpen(false, createChangeEventDetails(REASONS.outsidePress, event));\n clearInsideReactTree();\n }\n function handlePointerDown(event) {\n if (getOutsidePressEvent() !== 'sloppy' || event.pointerType === 'touch' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n closeOnPressOutside(event);\n }\n function handleTouchStart(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !store.select('open') || !enabled || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (touch) {\n touchStateRef.current = {\n startTime: Date.now(),\n startX: touch.clientX,\n startY: touch.clientY,\n dismissOnTouchEnd: false,\n dismissOnMouseDown: true\n };\n cancelDismissOnEndTimeout.start(1000, () => {\n if (touchStateRef.current) {\n touchStateRef.current.dismissOnTouchEnd = false;\n touchStateRef.current.dismissOnMouseDown = false;\n }\n });\n }\n }\n function addTargetEventListenerOnce(event, listener) {\n const target = getTarget(event);\n if (!target) {\n return;\n }\n const unsubscribe = addEventListener(target, event.type, () => {\n listener(event);\n unsubscribe();\n });\n }\n function handleTouchStartCapture(event) {\n currentPointerTypeRef.current = 'touch';\n addTargetEventListenerOnce(event, handleTouchStart);\n }\n function closeOnPressOutsideCapture(event) {\n cancelDismissOnEndTimeout.clear();\n if (event.type === 'pointerdown') {\n currentPointerTypeRef.current = event.pointerType;\n }\n if (event.type === 'mousedown' && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) {\n return;\n }\n addTargetEventListenerOnce(event, targetEvent => {\n if (targetEvent.type === 'pointerdown') {\n handlePointerDown(targetEvent);\n } else {\n closeOnPressOutside(targetEvent);\n }\n });\n }\n function handlePressEndCapture(event) {\n if (!pressStartedInsideRef.current) {\n return;\n }\n const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current;\n resetPressStartState();\n if (getOutsidePressEvent() !== 'intentional') {\n return;\n }\n if (event.type === 'pointercancel') {\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n }\n return;\n }\n if (isEventWithinFloatingTree(event)) {\n return;\n }\n\n // If pointerdown was prevented, no click may be generated for that\n // interaction. However, Firefox may still emit an immediate click after\n // pointerup (e.g. NumberField scrub with pointer lock), so suppress for\n // one tick to absorb that synthetic click only.\n if (pressStartedInsideDefaultPrevented) {\n suppressImmediateOutsideClickAfterPreventedStart();\n return;\n }\n\n // Avoid suppressing when outsidePress explicitly ignores this target.\n if (typeof outsidePress === 'function' && !outsidePress(event)) {\n return;\n }\n preventedPressSuppressionTimeout.clear();\n suppressNextOutsideClickRef.current = true;\n clearInsideReactTree();\n }\n function handleTouchMove(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n const touch = event.touches[0];\n if (!touch) {\n return;\n }\n const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX);\n const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY);\n const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);\n if (distance > 5) {\n touchStateRef.current.dismissOnTouchEnd = true;\n }\n if (distance > 10) {\n closeOnPressOutside(event);\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n }\n function handleTouchMoveCapture(event) {\n addTargetEventListenerOnce(event, handleTouchMove);\n }\n function handleTouchEnd(event) {\n if (getOutsidePressEvent() !== 'sloppy' || !touchStateRef.current || isEventWithinOwnElements(event)) {\n return;\n }\n if (touchStateRef.current.dismissOnTouchEnd) {\n closeOnPressOutside(event);\n }\n cancelDismissOnEndTimeout.clear();\n touchStateRef.current = null;\n }\n function handleTouchEndCapture(event) {\n addTargetEventListenerOnce(event, handleTouchEnd);\n }\n const doc = ownerDocument(floatingElement);\n const unsubscribe = mergeCleanups(escapeKey && mergeCleanups(addEventListener(doc, 'keydown', closeOnEscapeKeyDown), addEventListener(doc, 'compositionstart', handleCompositionStart), addEventListener(doc, 'compositionend', handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, 'click', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerdown', closeOnPressOutsideCapture, true), addEventListener(doc, 'pointerup', handlePressEndCapture, true), addEventListener(doc, 'pointercancel', handlePressEndCapture, true), addEventListener(doc, 'mousedown', closeOnPressOutsideCapture, true), addEventListener(doc, 'mouseup', handlePressEndCapture, true), addEventListener(doc, 'touchstart', handleTouchStartCapture, true), addEventListener(doc, 'touchmove', handleTouchMoveCapture, true), addEventListener(doc, 'touchend', handleTouchEndCapture, true)));\n return () => {\n unsubscribe();\n compositionTimeout.clear();\n preventedPressSuppressionTimeout.clear();\n resetPressStartState();\n suppressNextOutsideClickRef.current = false;\n };\n }, [dataRef, floatingElement, escapeKey, outsidePressEnabled, outsidePress, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]);\n React.useEffect(clearInsideReactTree, [outsidePress, clearInsideReactTree]);\n const reference = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n onPointerDown: closeOnReferencePress,\n onClick: closeOnReferencePress\n }), [closeOnEscapeKeyDown, closeOnReferencePress]);\n const floating = React.useMemo(() => ({\n onKeyDown: closeOnEscapeKeyDown,\n // `onMouseDown` may be blocked if `event.preventDefault()` is called in\n // `onPointerDown`, such as with <NumberField.ScrubArea>.\n // See https://github.com/mui/base-ui/pull/3379\n onPointerDown: markInsidePressStartPrevented,\n onMouseDown: markInsidePressStartPrevented,\n onClickCapture: markInsideReactTree,\n onMouseDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onPointerDownCapture(event) {\n markInsideReactTree();\n markPressStartedInsideReactTree(event);\n },\n onMouseUpCapture: markInsideReactTree,\n onTouchEndCapture: markInsideReactTree,\n onTouchMoveCapture: markInsideReactTree\n }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n trigger: reference\n } : {}, [enabled, reference, floating]);\n}"],"names":["alwaysFalse","normalizeProp","normalizable","useDismiss","context","props","enabled","escapeKey","outsidePressProp","outsidePressEvent","referencePress","bubbles","externalTree","store","open","floatingElement","dataRef","tree","useFloatingTree","outsidePressFn","useStableCallback","outsidePress","outsidePressEnabled","getOutsidePressEventProp","escapeKeyBubbles","outsidePressBubbles","pressStartedInsideRef","React","pressStartPreventedRef","suppressNextOutsideClickRef","isComposingRef","currentPointerTypeRef","touchStateRef","cancelDismissOnEndTimeout","useTimeout","clearInsideReactTreeTimeout","clearInsideReactTree","hasBlockingChild","bubbleKey","nodeId","getNodeChildren","child","isEventWithinOwnElements","event","isEventTargetWithin","closeOnReferencePress","createChangeEventDetails","REASONS.triggerPress","closeOnEscapeKeyDown","native","isReactEvent","eventDetails","REASONS.escapeKey","markInsideReactTree","markPressStartedInsideReactTree","target","getTarget","contains","markInsidePressStartPrevented","compositionTimeout","Timeout","preventedPressSuppressionTimeout","handleCompositionStart","handleCompositionEnd","platform.engine.webkit","suppressImmediateOutsideClickAfterPreventedStart","resetPressStartState","getOutsidePressEvent","type","computedType","outsidePressEventValue","resolved","shouldIgnoreEvent","computedOutsidePressEvent","isEventWithinFloatingTree","targetIsInsideChildren","node","closeOnPressOutside","inertSelector","createAttribute","targetRoot","isElement","markers","isShadowRoot","ownerDocument","triggers","trigger","targetRootAncestor","isLastTraversableNode","nextParent","getParentNode","isRootElement","marker","isHTMLElement","lastTraversableNode","style","getComputedStyle","scrollRe","isScrollableX","isScrollableY","canScrollX","canScrollY","isRTL","pressedVerticalScrollbar","pressedHorizontalScrollbar","REASONS.outsidePress","handlePointerDown","handleTouchStart","touch","addTargetEventListenerOnce","listener","unsubscribe","addEventListener","handleTouchStartCapture","closeOnPressOutsideCapture","targetEvent","handlePressEndCapture","pressStartedInsideDefaultPrevented","handleTouchMove","deltaX","deltaY","distance","handleTouchMoveCapture","handleTouchEnd","handleTouchEndCapture","doc","mergeCleanups","reference","floating"],"mappings":";;;;;;;;;;;;;;;;AAkBA,SAASA,KAAc;AACrB,SAAO;AACT;AACO,SAASC,GAAcC,GAAc;AAC1C,SAAO;AAAA,IACL,WAAW,OAAOA,KAAiB,YAAYA,IAAeA,GAAc,aAAa;AAAA,IACzF,cAAc,OAAOA,KAAiB,YAAYA,IAAeA,GAAc,gBAAgB;AAAA,EACnG;AACA;AAMO,SAASC,GAAWC,GAASC,KAAQ,IAAI;AAC9C,QAAM;AAAA,IACJ,SAAAC,IAAU;AAAA,IACd,WAAIC,IAAY;AAAA,IACZ,cAAcC,IAAmB;AAAA,IACjC,mBAAAC,KAAoB;AAAA,IACpB,gBAAAC,KAAiBV;AAAA,IACjB,SAAAW;AAAA,IACA,cAAAC;AAAA,EACJ,IAAMP,IACEQ,IAAQ,eAAeT,IAAUA,EAAQ,YAAYA,GACrDU,IAAOD,EAAM,SAAS,MAAM,GAC5BE,KAAkBF,EAAM,SAAS,iBAAiB,GAClD;AAAA,IACJ,SAAAG;AAAA,EACJ,IAAMH,EAAM,SACJI,IAAOC,GAAgBN,EAAY,GACnCO,KAAiBC,EAAkB,OAAOZ,KAAqB,aAAaA,IAAmB,MAAM,EAAK,GAC1Ga,IAAe,OAAOb,KAAqB,aAAaW,KAAiBX,GACzEc,KAAsBD,MAAiB,IACvCE,KAA2BH,EAAkB,MAAMX,EAAiB,GACpE;AAAA,IACJ,WAAWe;AAAA,IACX,cAAcC;AAAA,EAClB,IAAMxB,GAAc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,GAAkBC,IAAqBuB,GAAsBZ,GAAsBb,IAA0Bc,GAAkBK,GAA0BzB,GAAMJ,GAAOoB,CAAyB,CAAC,GAC3RN,EAAM,UAAUS,GAAsB,CAACf,GAAce,CAAoB,CAAC;AAC1E,QAAM2F,IAAYpG,EAAM,QAAQ,OAAO;AAAA,IACrC,WAAWqB;AAAA,IACX,eAAeH;AAAA,IACf,SAASA;AAAA,EACb,IAAM,CAACG,GAAsBH,CAAqB,CAAC,GAC3CmF,KAAWrG,EAAM,QAAQ,OAAO;AAAA,IACpC,WAAWqB;AAAA;AAAA;AAAA;AAAA,IAIX,eAAeU;AAAA,IACf,aAAaA;AAAA,IACb,gBAAgBL;AAAA,IAChB,mBAAmBV,GAAO;AACxB,MAAAU,EAAmB,GACnBC,EAAgCX,CAAK;AAAA,IACvC;AAAA,IACA,qBAAqBA,GAAO;AAC1B,MAAAU,EAAmB,GACnBC,EAAgCX,CAAK;AAAA,IACvC;AAAA,IACA,kBAAkBU;AAAA,IAClB,mBAAmBA;AAAA,IACnB,oBAAoBA;AAAA,EACxB,IAAM,CAACL,GAAsBK,GAAqBC,GAAiCI,CAA6B,CAAC;AAC/G,SAAO/B,EAAM,QAAQ,MAAMrB,IAAU;AAAA,IACnC,WAAAyH;AAAA,IACA,UAAAC;AAAA,IACA,SAASD;AAAA,EACb,IAAM,CAAA,GAAI,CAACzH,GAASyH,GAAWC,EAAQ,CAAC;AACxC;","x_google_ignoreList":[0]}
package/dist/index306.js CHANGED
@@ -1,87 +1,256 @@
1
- import { useStore as r } from "./index300.js";
2
- class n {
3
- /**
4
- * The current state of the store.
5
- * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.
6
- * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
7
- * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
8
- *
9
- * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
10
- */
11
- // Internal state to handle recursive `setState()` calls
12
- constructor(t) {
13
- this.state = t, this.listeners = /* @__PURE__ */ new Set(), this.updateTick = 0;
1
+ import * as f from "react";
2
+ import { useAnimationFrame as Me } from "./index327.js";
3
+ import { useIsoLayoutEffect as T } from "./index287.js";
4
+ import { ownerDocument as be } from "./index310.js";
5
+ import { useStableCallback as S } from "./index288.js";
6
+ import { useValueAsRef as k } from "./index289.js";
7
+ import { isHTMLElement as Pe } from "./index334.js";
8
+ import { createChangeEventDetails as ce } from "./index175.js";
9
+ import { useFloatingParentNodeId as ze, useFloatingTree as We } from "./index386.js";
10
+ import { isIndexOutOfListBounds as Fe, getMinListIndex as ie, getMaxListIndex as ve, findNonDisabledListIndex as G } from "./index382.js";
11
+ import { ARROW_LEFT as B, ARROW_RIGHT as Q, ARROW_UP as Se, ARROW_DOWN as le } from "./index390.js";
12
+ import { getFloatingFocusElement as _e, isTypeableCombobox as qe } from "./index316.js";
13
+ import { enqueueFocus as He } from "./index384.js";
14
+ import { stopEvent as P, isVirtualClick as Ge, isVirtualPointerEvent as $e } from "./index339.js";
15
+ import { activeElement as ue, contains as se, getTarget as Be } from "./index317.js";
16
+ import { listNavigation as Te, focusOut as Qe } from "./index177.js";
17
+ const Ue = "Escape";
18
+ function U(c, d, n) {
19
+ switch (c) {
20
+ case "vertical":
21
+ return d;
22
+ case "horizontal":
23
+ return n;
24
+ default:
25
+ return d || n;
14
26
  }
15
- /**
16
- * Registers a listener that will be called whenever the store's state changes.
17
- *
18
- * @param fn The listener function to be called on state changes.
19
- * @returns A function to unsubscribe the listener.
20
- */
21
- subscribe = (t) => (this.listeners.add(t), () => {
22
- this.listeners.delete(t);
27
+ }
28
+ function $(c, d) {
29
+ return U(d, c === Se || c === le, c === B || c === Q);
30
+ }
31
+ function ae(c, d, n) {
32
+ return U(d, c === le, n ? c === B : c === Q) || c === "Enter" || c === " " || c === "";
33
+ }
34
+ function je(c, d, n) {
35
+ return U(d, n ? c === B : c === Q, c === le);
36
+ }
37
+ function Je(c, d, n, p) {
38
+ const K = n ? c === Q : c === B, R = c === Se;
39
+ return d === "both" || d === "horizontal" && p ? c === Ue : U(d, K, R);
40
+ }
41
+ function dr(c, d) {
42
+ const {
43
+ listRef: n,
44
+ activeIndex: p,
45
+ onNavigate: K = () => {
46
+ },
47
+ enabled: R = !0,
48
+ selectedIndex: L = null,
49
+ allowEscape: j = !1,
50
+ loopFocus: V = !1,
51
+ nested: w = !1,
52
+ rtl: O = !1,
53
+ virtual: s = !1,
54
+ focusItemOnOpen: y = "auto",
55
+ focusItemOnHover: J = !0,
56
+ openOnArrowKeyDown: X = !0,
57
+ disabledIndices: x = void 0,
58
+ orientation: a = "vertical",
59
+ parentOrientation: Ke,
60
+ id: fe,
61
+ resetOnPointerLeave: Le = !0,
62
+ externalTree: Ce,
63
+ grid: Y
64
+ } = d, de = Y != null;
65
+ process.env.NODE_ENV !== "production" && (j && (V || console.warn("`useListNavigation` looping must be enabled to allow escaping."), s || console.warn("`useListNavigation` must be virtual to allow escaping.")), a === "vertical" && de && console.warn("In grid list navigation mode, the `orientation` should", 'be either "horizontal" or "both".'));
66
+ const g = "rootStore" in c ? c.rootStore : c, m = g.useState("open"), E = g.useState("floatingElement"), I = g.useState("domReferenceElement"), me = g.context.dataRef, De = _e(E), Z = qe(I), C = k(De), ee = ze(), F = We(Ce), M = f.useRef(y), o = f.useRef(L ?? -1), b = f.useRef(null), v = f.useRef(!0), u = S((e) => {
67
+ K(o.current === -1 ? null : o.current, e);
68
+ }), D = f.useRef(!!E), pe = f.useRef(m), h = f.useRef(!1), z = f.useRef(!1), re = f.useRef(null), Ne = k(x), W = k(m), N = k(L), ge = k(Le), Ae = Me(), Re = Me(), te = S(() => {
69
+ function e(i) {
70
+ s ? F?.events.emit("virtualfocus", i) : re.current = He(i, {
71
+ sync: h.current,
72
+ preventScroll: !0
73
+ });
74
+ }
75
+ const r = n.current[o.current], l = z.current;
76
+ r && e(r), (h.current ? (i) => i() : (i) => Ae.request(i))(() => {
77
+ const i = n.current[o.current] || r;
78
+ if (!i)
79
+ return;
80
+ r || e(i), // eslint-disable-next-line @typescript-eslint/no-use-before-define
81
+ oe && (l || !v.current) && i.scrollIntoView?.({
82
+ block: "nearest",
83
+ inline: "nearest"
84
+ });
85
+ });
23
86
  });
24
- /**
25
- * Returns the current state of the store.
26
- */
27
- getSnapshot = () => this.state;
28
- /**
29
- * Updates the entire store's state and notifies all registered listeners.
30
- *
31
- * @param newState The new state to set for the store.
32
- */
33
- setState(t) {
34
- if (this.state === t)
87
+ T(() => {
88
+ me.current.orientation = a;
89
+ }, [me, a]), T(() => {
90
+ R && (m && E ? (o.current = L ?? -1, M.current && L != null && (z.current = !0, u())) : D.current && (o.current = -1, u()));
91
+ }, [R, m, E, L, u]), T(() => {
92
+ if (R) {
93
+ if (!m) {
94
+ h.current = !1;
95
+ return;
96
+ }
97
+ if (E)
98
+ if (p == null) {
99
+ if (h.current = !1, N.current != null)
100
+ return;
101
+ if (D.current && (o.current = -1, te()), (!pe.current || !D.current) && M.current && (b.current != null || M.current === !0 && b.current == null)) {
102
+ let e = 0;
103
+ const r = () => {
104
+ n.current[0] == null ? (e < 2 && (e ? (t) => Re.request(t) : queueMicrotask)(r), e += 1) : (o.current = b.current == null || ae(b.current, a, O) || w ? ie(n) : ve(n), b.current = null, u());
105
+ };
106
+ r();
107
+ }
108
+ } else Fe(n.current, p) || (o.current = p, te(), z.current = !1);
109
+ }
110
+ }, [R, m, E, p, N, w, n, a, O, u, te, Re]), T(() => {
111
+ if (!R || E || !F || s || !D.current)
112
+ return;
113
+ const e = F.nodesRef.current, r = e.find((i) => i.id === ee)?.context?.elements.floating, l = ue(be(I ?? r ?? null)), t = e.some((i) => i.context && se(i.context.elements.floating, l));
114
+ r && !t && v.current && r.focus({
115
+ preventScroll: !0
116
+ });
117
+ }, [R, E, I, F, ee, s]), T(() => {
118
+ pe.current = m, D.current = !!E;
119
+ }), T(() => {
120
+ m || (b.current = null, M.current = y);
121
+ }, [m, y]);
122
+ const he = p != null, ne = S((e) => {
123
+ if (!W.current)
124
+ return;
125
+ const r = n.current.indexOf(e.currentTarget);
126
+ r !== -1 && (o.current !== r || p !== r) && (o.current = r, u(e));
127
+ }), _ = S(() => Ke ?? F?.nodesRef.current.find((e) => e.id === ee)?.context?.dataRef?.current.orientation), Ee = S(() => ie(n, Ne.current)), A = S((e) => {
128
+ if (v.current = !1, h.current = !0, e.which === 229 || !W.current && e.currentTarget === C.current)
35
129
  return;
36
- this.state = t, this.updateTick += 1;
37
- const s = this.updateTick;
38
- for (const e of this.listeners) {
39
- if (s !== this.updateTick)
130
+ if (w && Je(e.key, a, O, de)) {
131
+ $(e.key, _()) || P(e), g.setOpen(!1, ce(Te, e.nativeEvent)), Pe(I) && (s ? F?.events.emit("virtualfocus", I) : I.focus());
132
+ return;
133
+ }
134
+ const r = o.current, l = ie(n, x), t = ve(n, x);
135
+ if (Z || (e.key === "Home" && (P(e), o.current = l, u(e)), e.key === "End" && (P(e), o.current = t, u(e))), Y != null) {
136
+ const i = Y(e, o.current, n, a, V, O, x, l, t);
137
+ if (i != null && (o.current = i, u(e)), a === "both")
40
138
  return;
41
- e(t);
42
139
  }
43
- }
44
- /**
45
- * Merges the provided changes into the current state and notifies listeners if there are changes.
46
- *
47
- * @param changes An object containing the changes to apply to the current state.
48
- */
49
- update(t) {
50
- for (const s in t)
51
- if (!Object.is(this.state[s], t[s])) {
52
- this.setState({
53
- ...this.state,
54
- ...t
140
+ if ($(e.key, a)) {
141
+ if (P(e), m && !s && ue(e.currentTarget.ownerDocument) === e.currentTarget) {
142
+ o.current = ae(e.key, a, O) ? l : t, u(e);
143
+ return;
144
+ }
145
+ ae(e.key, a, O) ? V ? r >= t ? j && r !== n.current.length ? o.current = -1 : (h.current = !1, o.current = l) : o.current = G(n.current, {
146
+ startingIndex: r,
147
+ disabledIndices: x
148
+ }) : o.current = Math.min(t, G(n.current, {
149
+ startingIndex: r,
150
+ disabledIndices: x
151
+ })) : V ? r <= l ? j && r !== -1 ? o.current = n.current.length : (h.current = !1, o.current = t) : o.current = G(n.current, {
152
+ startingIndex: r,
153
+ decrement: !0,
154
+ disabledIndices: x
155
+ }) : o.current = Math.max(l, G(n.current, {
156
+ startingIndex: r,
157
+ decrement: !0,
158
+ disabledIndices: x
159
+ })), Fe(n.current, o.current) && (o.current = -1), u(e);
160
+ }
161
+ }), oe = f.useMemo(() => ({
162
+ onFocus(r) {
163
+ h.current = !0, ne(r);
164
+ },
165
+ onClick: ({
166
+ currentTarget: r
167
+ }) => r.focus({
168
+ preventScroll: !0
169
+ }),
170
+ // Safari
171
+ onMouseMove(r) {
172
+ h.current = !0, z.current = !1, J && ne(r);
173
+ },
174
+ onPointerLeave(r) {
175
+ if (!W.current || !v.current || r.pointerType === "touch")
176
+ return;
177
+ h.current = !0;
178
+ const l = r.relatedTarget;
179
+ if (!(!J || n.current.includes(l)) && ge.current && (re.current?.(), re.current = null, o.current = -1, u(r), !s)) {
180
+ const t = C.current, i = ue(be(t));
181
+ t && se(t, i) && t.focus({
182
+ preventScroll: !0
55
183
  });
184
+ }
185
+ }
186
+ }), [ne, W, C, J, n, u, ge, s]), q = f.useMemo(() => s && m && he && {
187
+ "aria-activedescendant": `${fe}-${p}`
188
+ }, [s, m, he, fe, p]), Ie = f.useMemo(() => ({
189
+ "aria-orientation": a === "both" ? void 0 : a,
190
+ ...Z ? {} : q,
191
+ onKeyDown(e) {
192
+ if (e.key === "Tab" && e.shiftKey && m && !s) {
193
+ const r = Be(e.nativeEvent);
194
+ if (r && !se(C.current, r))
195
+ return;
196
+ P(e), g.setOpen(!1, ce(Qe, e.nativeEvent)), Pe(I) && I.focus();
56
197
  return;
57
198
  }
58
- }
59
- /**
60
- * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
61
- *
62
- * @param key The key in the store's state to update.
63
- * @param value The new value to set for the specified key.
64
- */
65
- set(t, s) {
66
- Object.is(this.state[t], s) || this.setState({
67
- ...this.state,
68
- [t]: s
69
- });
70
- }
71
- /**
72
- * Gives the state a new reference and updates all registered listeners.
73
- */
74
- notifyAll() {
75
- const t = {
76
- ...this.state
199
+ A(e);
200
+ },
201
+ onPointerMove() {
202
+ v.current = !0;
203
+ }
204
+ }), [q, A, C, a, Z, g, m, s, I]), H = f.useMemo(() => {
205
+ function e(t) {
206
+ g.setOpen(!0, ce(Te, t.nativeEvent, t.currentTarget));
207
+ }
208
+ function r(t) {
209
+ y === "auto" && Ge(t.nativeEvent) && (M.current = !s);
210
+ }
211
+ function l(t) {
212
+ M.current = y, y === "auto" && $e(t.nativeEvent) && (M.current = !0);
213
+ }
214
+ return {
215
+ onKeyDown(t) {
216
+ const i = g.select("open");
217
+ v.current = !1;
218
+ const xe = t.key.startsWith("Arrow"), we = je(t.key, _(), O), ye = $(t.key, a), ke = (w ? we : ye) || t.key === "Enter" || t.key.trim() === "";
219
+ if (s && i)
220
+ return A(t);
221
+ if (!(!i && !X && xe)) {
222
+ if (ke) {
223
+ const Ve = $(t.key, _());
224
+ b.current = w && Ve ? null : t.key;
225
+ }
226
+ if (w) {
227
+ we && (P(t), i ? (o.current = Ee(), u(t)) : e(t));
228
+ return;
229
+ }
230
+ ye && (N.current != null && (o.current = N.current), P(t), !i && X ? e(t) : A(t), i && u(t));
231
+ }
232
+ },
233
+ onFocus(t) {
234
+ g.select("open") && !s && (o.current = -1, u(t));
235
+ },
236
+ onPointerDown: l,
237
+ onPointerEnter: l,
238
+ onMouseDown: r,
239
+ onClick: r
77
240
  };
78
- this.setState(t);
79
- }
80
- use(t, s, e, i) {
81
- return r(this, t, s, e, i);
82
- }
241
+ }, [A, y, Ee, w, u, g, X, a, _, O, N, s]), Oe = f.useMemo(() => ({
242
+ ...q,
243
+ ...H
244
+ }), [q, H]);
245
+ return f.useMemo(() => R ? {
246
+ reference: Oe,
247
+ floating: Ie,
248
+ item: oe,
249
+ trigger: H
250
+ } : {}, [R, Oe, Ie, H, oe]);
83
251
  }
84
252
  export {
85
- n as Store
253
+ Ue as ESCAPE,
254
+ dr as useListNavigation
86
255
  };
87
256
  //# sourceMappingURL=index306.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index306.js","sources":["../../../node_modules/@base-ui/utils/store/Store.mjs"],"sourcesContent":["import { useStore } from \"./useStore.mjs\";\n/**\n * A data store implementation that allows subscribing to state changes and updating the state.\n * It uses an observer pattern to notify subscribers when the state changes.\n */\nexport class Store {\n /**\n * The current state of the store.\n * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}.\n * To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).\n * The values can be used directly (to avoid subscribing to the store) in effects or event handlers.\n *\n * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.\n */\n\n // Internal state to handle recursive `setState()` calls\n\n constructor(state) {\n this.state = state;\n this.listeners = new Set();\n this.updateTick = 0;\n }\n\n /**\n * Registers a listener that will be called whenever the store's state changes.\n *\n * @param fn The listener function to be called on state changes.\n * @returns A function to unsubscribe the listener.\n */\n subscribe = fn => {\n this.listeners.add(fn);\n return () => {\n this.listeners.delete(fn);\n };\n };\n\n /**\n * Returns the current state of the store.\n */\n getSnapshot = () => {\n return this.state;\n };\n\n /**\n * Updates the entire store's state and notifies all registered listeners.\n *\n * @param newState The new state to set for the store.\n */\n setState(newState) {\n if (this.state === newState) {\n return;\n }\n this.state = newState;\n this.updateTick += 1;\n const currentTick = this.updateTick;\n for (const listener of this.listeners) {\n if (currentTick !== this.updateTick) {\n // If the tick has changed, a recursive `setState` call has been made,\n // and it has already notified all listeners.\n return;\n }\n listener(newState);\n }\n }\n\n /**\n * Merges the provided changes into the current state and notifies listeners if there are changes.\n *\n * @param changes An object containing the changes to apply to the current state.\n */\n update(changes) {\n for (const key in changes) {\n if (!Object.is(this.state[key], changes[key])) {\n this.setState({\n ...this.state,\n ...changes\n });\n return;\n }\n }\n }\n\n /**\n * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.\n *\n * @param key The key in the store's state to update.\n * @param value The new value to set for the specified key.\n */\n set(key, value) {\n if (!Object.is(this.state[key], value)) {\n this.setState({\n ...this.state,\n [key]: value\n });\n }\n }\n\n /**\n * Gives the state a new reference and updates all registered listeners.\n */\n notifyAll() {\n const newState = {\n ...this.state\n };\n this.setState(newState);\n }\n use(selector, a1, a2, a3) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useStore(this, selector, a1, a2, a3);\n }\n}"],"names":["Store","state","fn","newState","currentTick","listener","changes","key","value","selector","a1","a2","a3","useStore"],"mappings":";AAKO,MAAMA,EAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYjB,YAAYC,GAAO;AACjB,SAAK,QAAQA,GACb,KAAK,YAAY,oBAAI,IAAG,GACxB,KAAK,aAAa;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,YAAY,CAAAC,OACV,KAAK,UAAU,IAAIA,CAAE,GACd,MAAM;AACX,SAAK,UAAU,OAAOA,CAAE;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAMF,cAAc,MACL,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQd,SAASC,GAAU;AACjB,QAAI,KAAK,UAAUA;AACjB;AAEF,SAAK,QAAQA,GACb,KAAK,cAAc;AACnB,UAAMC,IAAc,KAAK;AACzB,eAAWC,KAAY,KAAK,WAAW;AACrC,UAAID,MAAgB,KAAK;AAGvB;AAEF,MAAAC,EAASF,CAAQ;AAAA,IACnB;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,OAAOG,GAAS;AACd,eAAWC,KAAOD;AAChB,UAAI,CAAC,OAAO,GAAG,KAAK,MAAMC,CAAG,GAAGD,EAAQC,CAAG,CAAC,GAAG;AAC7C,aAAK,SAAS;AAAA,UACZ,GAAG,KAAK;AAAA,UACR,GAAGD;AAAA,QACb,CAAS;AACD;AAAA,MACF;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAIC,GAAKC,GAAO;AACd,IAAK,OAAO,GAAG,KAAK,MAAMD,CAAG,GAAGC,CAAK,KACnC,KAAK,SAAS;AAAA,MACZ,GAAG,KAAK;AAAA,MACR,CAACD,CAAG,GAAGC;AAAA,IACf,CAAO;AAAA,EAEL;AAAA;AAAA;AAAA;AAAA,EAKA,YAAY;AACV,UAAML,IAAW;AAAA,MACf,GAAG,KAAK;AAAA,IACd;AACI,SAAK,SAASA,CAAQ;AAAA,EACxB;AAAA,EACA,IAAIM,GAAUC,GAAIC,GAAIC,GAAI;AAExB,WAAOC,EAAS,MAAMJ,GAAUC,GAAIC,GAAIC,CAAE;AAAA,EAC5C;AACF;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index306.js","sources":["../../../node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useAnimationFrame } from '@base-ui/utils/useAnimationFrame';\nimport { useIsoLayoutEffect } from '@base-ui/utils/useIsoLayoutEffect';\nimport { ownerDocument } from '@base-ui/utils/owner';\nimport { useStableCallback } from '@base-ui/utils/useStableCallback';\nimport { useValueAsRef } from '@base-ui/utils/useValueAsRef';\nimport { isHTMLElement } from '@floating-ui/utils/dom';\nimport { createChangeEventDetails } from \"../../internals/createBaseUIEventDetails.mjs\";\nimport { REASONS } from \"../../internals/reasons.mjs\";\nimport { useFloatingParentNodeId, useFloatingTree } from \"../components/FloatingTree.mjs\";\nimport { findNonDisabledListIndex, getMaxListIndex, getMinListIndex, isIndexOutOfListBounds } from \"../utils/composite.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"../utils/constants.mjs\";\nimport { activeElement, contains, getFloatingFocusElement, getTarget, isTypeableCombobox } from \"../utils/element.mjs\";\nimport { enqueueFocus } from \"../utils/enqueueFocus.mjs\";\nimport { isVirtualClick, isVirtualPointerEvent, stopEvent } from \"../utils/event.mjs\";\nexport const ESCAPE = 'Escape';\nfunction doSwitch(orientation, vertical, horizontal) {\n switch (orientation) {\n case 'vertical':\n return vertical;\n case 'horizontal':\n return horizontal;\n default:\n return vertical || horizontal;\n }\n}\nfunction isMainOrientationKey(key, orientation) {\n const vertical = key === ARROW_UP || key === ARROW_DOWN;\n const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isMainOrientationToEndKey(key, orientation, rtl) {\n const vertical = key === ARROW_DOWN;\n const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === '';\n}\nfunction isCrossOrientationOpenKey(key, orientation, rtl) {\n const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT;\n const horizontal = key === ARROW_DOWN;\n return doSwitch(orientation, vertical, horizontal);\n}\nfunction isCrossOrientationCloseKey(key, orientation, rtl, grid) {\n const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;\n const horizontal = key === ARROW_UP;\n if (orientation === 'both' || orientation === 'horizontal' && grid) {\n return key === ESCAPE;\n }\n return doSwitch(orientation, vertical, horizontal);\n}\n/**\n * Adds arrow key-based navigation of a list of items, either using real DOM\n * focus or virtual focus.\n * @see https://floating-ui.com/docs/useListNavigation\n */\nexport function useListNavigation(context, props) {\n const {\n listRef,\n activeIndex,\n onNavigate: onNavigateProp = () => {},\n enabled = true,\n selectedIndex = null,\n allowEscape = false,\n loopFocus = false,\n nested = false,\n rtl = false,\n virtual = false,\n focusItemOnOpen = 'auto',\n focusItemOnHover = true,\n openOnArrowKeyDown = true,\n disabledIndices = undefined,\n orientation = 'vertical',\n parentOrientation,\n id,\n resetOnPointerLeave = true,\n externalTree,\n grid: navigateGrid\n } = props;\n const isGrid = navigateGrid != null;\n if (process.env.NODE_ENV !== 'production') {\n if (allowEscape) {\n if (!loopFocus) {\n console.warn('`useListNavigation` looping must be enabled to allow escaping.');\n }\n if (!virtual) {\n console.warn('`useListNavigation` must be virtual to allow escaping.');\n }\n }\n if (orientation === 'vertical' && isGrid) {\n console.warn('In grid list navigation mode, the `orientation` should', 'be either \"horizontal\" or \"both\".');\n }\n }\n const store = 'rootStore' in context ? context.rootStore : context;\n const open = store.useState('open');\n const floatingElement = store.useState('floatingElement');\n const domReferenceElement = store.useState('domReferenceElement');\n const dataRef = store.context.dataRef;\n const floatingFocusElement = getFloatingFocusElement(floatingElement);\n const typeableComboboxReference = isTypeableCombobox(domReferenceElement);\n const floatingFocusElementRef = useValueAsRef(floatingFocusElement);\n const parentId = useFloatingParentNodeId();\n const tree = useFloatingTree(externalTree);\n const focusItemOnOpenRef = React.useRef(focusItemOnOpen);\n const indexRef = React.useRef(selectedIndex ?? -1);\n const keyRef = React.useRef(null);\n const isPointerModalityRef = React.useRef(true);\n const onNavigate = useStableCallback(event => {\n onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event);\n });\n const previousMountedRef = React.useRef(!!floatingElement);\n const previousOpenRef = React.useRef(open);\n const forceSyncFocusRef = React.useRef(false);\n const forceScrollIntoViewRef = React.useRef(false);\n const cancelQueuedFocusRef = React.useRef(null);\n const disabledIndicesRef = useValueAsRef(disabledIndices);\n const latestOpenRef = useValueAsRef(open);\n const selectedIndexRef = useValueAsRef(selectedIndex);\n const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave);\n const focusFrame = useAnimationFrame();\n const waitForListPopulatedFrame = useAnimationFrame();\n const focusItem = useStableCallback(() => {\n function runFocus(item) {\n if (virtual) {\n tree?.events.emit('virtualfocus', item);\n } else {\n cancelQueuedFocusRef.current = enqueueFocus(item, {\n sync: forceSyncFocusRef.current,\n preventScroll: true\n });\n }\n }\n const initialItem = listRef.current[indexRef.current];\n const forceScrollIntoView = forceScrollIntoViewRef.current;\n if (initialItem) {\n runFocus(initialItem);\n }\n const scheduler = forceSyncFocusRef.current ? callback => callback() : callback => focusFrame.request(callback);\n scheduler(() => {\n const waitedItem = listRef.current[indexRef.current] || initialItem;\n if (!waitedItem) {\n return;\n }\n if (!initialItem) {\n runFocus(waitedItem);\n }\n const shouldScrollIntoView =\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n item && (forceScrollIntoView || !isPointerModalityRef.current);\n if (shouldScrollIntoView) {\n // JSDOM doesn't support `.scrollIntoView()` but it's widely supported\n // by all browsers.\n waitedItem.scrollIntoView?.({\n block: 'nearest',\n inline: 'nearest'\n });\n }\n });\n });\n useIsoLayoutEffect(() => {\n dataRef.current.orientation = orientation;\n }, [dataRef, orientation]);\n\n // Sync `selectedIndex` to be the `activeIndex` upon opening the floating\n // element. Also, reset `activeIndex` upon closing the floating element.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (open && floatingElement) {\n indexRef.current = selectedIndex ?? -1;\n if (focusItemOnOpenRef.current && selectedIndex != null) {\n // Regardless of the pointer modality, we want to ensure the selected\n // item comes into view when the floating element is opened.\n forceScrollIntoViewRef.current = true;\n onNavigate();\n }\n } else if (previousMountedRef.current) {\n // Reset the active index when the list is no longer open and mounted (closing or\n // unmounting). `onNavigate` is a stable callback that always forwards to the latest\n // `onNavigate` prop.\n indexRef.current = -1;\n onNavigate();\n }\n }, [enabled, open, floatingElement, selectedIndex, onNavigate]);\n\n // Sync `activeIndex` to be the focused item while the floating element is\n // open.\n useIsoLayoutEffect(() => {\n if (!enabled) {\n return;\n }\n if (!open) {\n forceSyncFocusRef.current = false;\n return;\n }\n if (!floatingElement) {\n return;\n }\n if (activeIndex == null) {\n forceSyncFocusRef.current = false;\n if (selectedIndexRef.current != null) {\n return;\n }\n\n // Reset while the floating element was open (e.g. the list changed).\n if (previousMountedRef.current) {\n indexRef.current = -1;\n focusItem();\n }\n\n // Initial sync.\n if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) {\n let runs = 0;\n const waitForListPopulated = () => {\n if (listRef.current[0] == null) {\n // Avoid letting the browser paint if possible on the first try,\n // otherwise use rAF. Don't try more than twice, since something\n // is wrong otherwise.\n if (runs < 2) {\n const scheduler = runs ? callback => waitForListPopulatedFrame.request(callback) : queueMicrotask;\n scheduler(waitForListPopulated);\n }\n runs += 1;\n } else {\n // Initially focus the first non-disabled item. `disabledIndices` is deliberately\n // omitted here so attribute-disabled items (`disabled`/`aria-disabled`) are skipped\n // on open even when the consumer passes an empty `disabledIndices` array. Passing it\n // would regress that behavior (see mui/base-ui#2604).\n indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);\n keyRef.current = null;\n onNavigate();\n }\n };\n waitForListPopulated();\n }\n } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) {\n indexRef.current = activeIndex;\n focusItem();\n forceScrollIntoViewRef.current = false;\n }\n }, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]);\n\n // Ensure the parent floating element has focus when a nested child closes\n // to allow arrow key navigation to work after the pointer leaves the child.\n useIsoLayoutEffect(() => {\n if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) {\n return;\n }\n const nodes = tree.nodesRef.current;\n const parent = nodes.find(node => node.id === parentId)?.context?.elements.floating;\n // `floatingElement` is null here (see the guard above), so resolve the owner document from an\n // in-DOM element for realm-safety (shadow DOM/iframes): the reference element, falling back to\n // the parent floating element when the reference is virtual (`domReferenceElement` is null).\n const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));\n const treeContainsActiveEl = nodes.some(node => node.context && contains(node.context.elements.floating, activeEl));\n if (parent && !treeContainsActiveEl && isPointerModalityRef.current) {\n parent.focus({\n preventScroll: true\n });\n }\n }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]);\n useIsoLayoutEffect(() => {\n previousOpenRef.current = open;\n previousMountedRef.current = !!floatingElement;\n });\n useIsoLayoutEffect(() => {\n if (!open) {\n keyRef.current = null;\n focusItemOnOpenRef.current = focusItemOnOpen;\n }\n }, [open, focusItemOnOpen]);\n const hasActiveIndex = activeIndex != null;\n const syncCurrentTarget = useStableCallback(event => {\n if (!latestOpenRef.current) {\n return;\n }\n const index = listRef.current.indexOf(event.currentTarget);\n if (index !== -1 && (indexRef.current !== index || activeIndex !== index)) {\n indexRef.current = index;\n onNavigate(event);\n }\n });\n const getParentOrientation = useStableCallback(() => {\n return parentOrientation ?? tree?.nodesRef.current.find(node => node.id === parentId)?.context?.dataRef?.current.orientation;\n });\n const getMinEnabledIndex = useStableCallback(() => {\n return getMinListIndex(listRef, disabledIndicesRef.current);\n });\n const commonOnKeyDown = useStableCallback(event => {\n isPointerModalityRef.current = false;\n forceSyncFocusRef.current = true;\n\n // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari\n // don't appear to suffer from this. `event.isComposing` is avoided due to\n // Safari not supporting it properly (although it's not needed in the first\n // place for Safari, just avoiding any possible issues).\n if (event.which === 229) {\n return;\n }\n\n // If the floating element is animating out, ignore navigation. Otherwise,\n // the `activeIndex` gets set to 0 despite not being open so the next time\n // the user ArrowDowns, the first item won't be focused.\n if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) {\n return;\n }\n if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {\n // If the nested list's close key is also the parent navigation key,\n // let the parent navigate. Otherwise, stop propagating the event.\n if (!isMainOrientationKey(event.key, getParentOrientation())) {\n stopEvent(event);\n }\n store.setOpen(false, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n if (virtual) {\n tree?.events.emit('virtualfocus', domReferenceElement);\n } else {\n domReferenceElement.focus();\n }\n }\n return;\n }\n const currentIndex = indexRef.current;\n const minIndex = getMinListIndex(listRef, disabledIndices);\n const maxIndex = getMaxListIndex(listRef, disabledIndices);\n if (!typeableComboboxReference) {\n if (event.key === 'Home') {\n stopEvent(event);\n indexRef.current = minIndex;\n onNavigate(event);\n }\n if (event.key === 'End') {\n stopEvent(event);\n indexRef.current = maxIndex;\n onNavigate(event);\n }\n }\n\n // Grid navigation is injected by grid-capable consumers so non-grid\n // consumers (menu, select) tree-shake the grid helpers out.\n if (navigateGrid != null) {\n const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);\n if (index != null) {\n indexRef.current = index;\n onNavigate(event);\n }\n if (orientation === 'both') {\n return;\n }\n }\n if (isMainOrientationKey(event.key, orientation)) {\n stopEvent(event);\n\n // Reset the index if no item is focused.\n if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) {\n indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;\n onNavigate(event);\n return;\n }\n if (isMainOrientationToEndKey(event.key, orientation, rtl)) {\n if (loopFocus) {\n if (currentIndex >= maxIndex) {\n if (allowEscape && currentIndex !== listRef.current.length) {\n indexRef.current = -1;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = minIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n disabledIndices\n }));\n }\n } else if (loopFocus) {\n if (currentIndex <= minIndex) {\n if (allowEscape && currentIndex !== -1) {\n indexRef.current = listRef.current.length;\n } else {\n // Give time for virtualizers to update the listRef.\n forceSyncFocusRef.current = false;\n indexRef.current = maxIndex;\n }\n } else {\n indexRef.current = findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n });\n }\n } else {\n indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, {\n startingIndex: currentIndex,\n decrement: true,\n disabledIndices\n }));\n }\n if (isIndexOutOfListBounds(listRef.current, indexRef.current)) {\n indexRef.current = -1;\n }\n onNavigate(event);\n }\n });\n const item = React.useMemo(() => {\n const itemProps = {\n onFocus(event) {\n forceSyncFocusRef.current = true;\n syncCurrentTarget(event);\n },\n onClick: ({\n currentTarget\n }) => currentTarget.focus({\n preventScroll: true\n }),\n // Safari\n onMouseMove(event) {\n forceSyncFocusRef.current = true;\n forceScrollIntoViewRef.current = false;\n if (focusItemOnHover) {\n syncCurrentTarget(event);\n }\n },\n onPointerLeave(event) {\n if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === 'touch') {\n return;\n }\n forceSyncFocusRef.current = true;\n const relatedTarget = event.relatedTarget;\n if (!focusItemOnHover || listRef.current.includes(relatedTarget)) {\n return;\n }\n if (!resetOnPointerLeaveRef.current) {\n return;\n }\n cancelQueuedFocusRef.current?.();\n cancelQueuedFocusRef.current = null;\n indexRef.current = -1;\n onNavigate(event);\n if (!virtual) {\n const floatingFocusEl = floatingFocusElementRef.current;\n const activeEl = activeElement(ownerDocument(floatingFocusEl));\n if (floatingFocusEl && contains(floatingFocusEl, activeEl)) {\n floatingFocusEl.focus({\n preventScroll: true\n });\n }\n }\n }\n };\n return itemProps;\n }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]);\n const ariaActiveDescendantProp = React.useMemo(() => {\n return virtual && open && hasActiveIndex && {\n 'aria-activedescendant': `${id}-${activeIndex}`\n };\n }, [virtual, open, hasActiveIndex, id, activeIndex]);\n const floating = React.useMemo(() => {\n return {\n 'aria-orientation': orientation === 'both' ? undefined : orientation,\n ...(!typeableComboboxReference ? ariaActiveDescendantProp : {}),\n onKeyDown(event) {\n // Close submenu on Shift+Tab\n if (event.key === 'Tab' && event.shiftKey && open && !virtual) {\n // If the event originated from within a nested element (e.g., a Dialog opened from\n // within the menu), don't close the menu. The nested element has its own focus\n // management and should handle the Tab key.\n const target = getTarget(event.nativeEvent);\n if (target && !contains(floatingFocusElementRef.current, target)) {\n return;\n }\n stopEvent(event);\n store.setOpen(false, createChangeEventDetails(REASONS.focusOut, event.nativeEvent));\n if (isHTMLElement(domReferenceElement)) {\n domReferenceElement.focus();\n }\n return;\n }\n commonOnKeyDown(event);\n },\n onPointerMove() {\n isPointerModalityRef.current = true;\n }\n };\n }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, orientation, typeableComboboxReference, store, open, virtual, domReferenceElement]);\n const trigger = React.useMemo(() => {\n function openOnNavigationKeyDown(event) {\n store.setOpen(true, createChangeEventDetails(REASONS.listNavigation, event.nativeEvent, event.currentTarget));\n }\n function checkVirtualMouse(event) {\n if (focusItemOnOpen === 'auto' && isVirtualClick(event.nativeEvent)) {\n focusItemOnOpenRef.current = !virtual;\n }\n }\n function checkVirtualPointer(event) {\n // `pointerdown` fires first, reset the state then perform the checks.\n focusItemOnOpenRef.current = focusItemOnOpen;\n if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) {\n focusItemOnOpenRef.current = true;\n }\n }\n return {\n onKeyDown(event) {\n // non-reactive open state (to prevent re-creation of the handler)\n const currentOpen = store.select('open');\n isPointerModalityRef.current = false;\n const isArrowKey = event.key.startsWith('Arrow');\n const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);\n const isMainKey = isMainOrientationKey(event.key, orientation);\n const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === '';\n if (virtual && currentOpen) {\n return commonOnKeyDown(event);\n }\n\n // If a floating element should not open on arrow key down, avoid\n // setting `activeIndex` while it's closed.\n if (!currentOpen && !openOnArrowKeyDown && isArrowKey) {\n return undefined;\n }\n if (isNavigationKey) {\n const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());\n keyRef.current = nested && isParentMainKey ? null : event.key;\n }\n if (nested) {\n if (isParentCrossOpenKey) {\n stopEvent(event);\n if (currentOpen) {\n indexRef.current = getMinEnabledIndex();\n onNavigate(event);\n } else {\n openOnNavigationKeyDown(event);\n }\n }\n return undefined;\n }\n if (isMainKey) {\n if (selectedIndexRef.current != null) {\n indexRef.current = selectedIndexRef.current;\n }\n stopEvent(event);\n if (!currentOpen && openOnArrowKeyDown) {\n openOnNavigationKeyDown(event);\n } else {\n commonOnKeyDown(event);\n }\n if (currentOpen) {\n onNavigate(event);\n }\n }\n return undefined;\n },\n onFocus(event) {\n if (store.select('open') && !virtual) {\n indexRef.current = -1;\n onNavigate(event);\n }\n },\n onPointerDown: checkVirtualPointer,\n onPointerEnter: checkVirtualPointer,\n onMouseDown: checkVirtualMouse,\n onClick: checkVirtualMouse\n };\n }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]);\n const reference = React.useMemo(() => {\n return {\n ...ariaActiveDescendantProp,\n ...trigger\n };\n }, [ariaActiveDescendantProp, trigger]);\n return React.useMemo(() => enabled ? {\n reference,\n floating,\n item,\n trigger\n } : {}, [enabled, reference, floating, trigger, item]);\n}"],"names":["ESCAPE","doSwitch","orientation","vertical","horizontal","isMainOrientationKey","key","ARROW_UP","ARROW_DOWN","ARROW_LEFT","ARROW_RIGHT","isMainOrientationToEndKey","rtl","isCrossOrientationOpenKey","isCrossOrientationCloseKey","grid","useListNavigation","context","props","listRef","activeIndex","onNavigateProp","enabled","selectedIndex","allowEscape","loopFocus","nested","virtual","focusItemOnOpen","focusItemOnHover","openOnArrowKeyDown","disabledIndices","parentOrientation","id","resetOnPointerLeave","externalTree","navigateGrid","isGrid","store","open","floatingElement","domReferenceElement","dataRef","floatingFocusElement","getFloatingFocusElement","typeableComboboxReference","isTypeableCombobox","floatingFocusElementRef","useValueAsRef","parentId","useFloatingParentNodeId","tree","useFloatingTree","focusItemOnOpenRef","React","indexRef","keyRef","isPointerModalityRef","onNavigate","useStableCallback","event","previousMountedRef","previousOpenRef","forceSyncFocusRef","forceScrollIntoViewRef","cancelQueuedFocusRef","disabledIndicesRef","latestOpenRef","selectedIndexRef","resetOnPointerLeaveRef","focusFrame","useAnimationFrame","waitForListPopulatedFrame","focusItem","runFocus","item","enqueueFocus","initialItem","forceScrollIntoView","callback","waitedItem","useIsoLayoutEffect","runs","waitForListPopulated","getMinListIndex","getMaxListIndex","isIndexOutOfListBounds","nodes","parent","node","activeEl","activeElement","ownerDocument","treeContainsActiveEl","contains","hasActiveIndex","syncCurrentTarget","index","getParentOrientation","getMinEnabledIndex","commonOnKeyDown","stopEvent","createChangeEventDetails","REASONS.listNavigation","isHTMLElement","currentIndex","minIndex","maxIndex","findNonDisabledListIndex","currentTarget","relatedTarget","floatingFocusEl","ariaActiveDescendantProp","floating","target","getTarget","REASONS.focusOut","trigger","openOnNavigationKeyDown","checkVirtualMouse","isVirtualClick","checkVirtualPointer","isVirtualPointerEvent","currentOpen","isArrowKey","isParentCrossOpenKey","isMainKey","isNavigationKey","isParentMainKey","reference"],"mappings":";;;;;;;;;;;;;;;;AAiBY,MAACA,KAAS;AACtB,SAASC,EAASC,GAAaC,GAAUC,GAAY;AACnD,UAAQF,GAAW;AAAA,IACjB,KAAK;AACH,aAAOC;AAAA,IACT,KAAK;AACH,aAAOC;AAAA,IACT;AACE,aAAOD,KAAYC;AAAA,EACzB;AACA;AACA,SAASC,EAAqBC,GAAKJ,GAAa;AAG9C,SAAOD,EAASC,GAFCI,MAAQC,MAAYD,MAAQE,IAC1BF,MAAQG,KAAcH,MAAQI,CACA;AACnD;AACA,SAASC,GAA0BL,GAAKJ,GAAaU,GAAK;AAGxD,SAAOX,EAASC,GAFCI,MAAQE,IACNI,IAAMN,MAAQG,IAAaH,MAAQI,CACL,KAAKJ,MAAQ,WAAWA,MAAQ,OAAOA,MAAQ;AAClG;AACA,SAASO,GAA0BP,GAAKJ,GAAaU,GAAK;AAGxD,SAAOX,EAASC,GAFCU,IAAMN,MAAQG,IAAaH,MAAQI,GACjCJ,MAAQE,EACsB;AACnD;AACA,SAASM,GAA2BR,GAAKJ,GAAaU,GAAKG,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GAAGK;AAAA,EACT,IACK,CAACL,GAA0BK,CAAO,CAAC;AACtC,SAAO/D,EAAM,QAAQ,MAAMhC,IAAU;AAAA,IACnC,WAAA2G;AAAA,IACA,UAAAhB;AAAA,IACA,MAAAtC;AAAA,IACA,SAAA0C;AAAA,EACJ,IAAM,CAAA,GAAI,CAAC/F,GAAS2G,IAAWhB,IAAUI,GAAS1C,EAAI,CAAC;AACvD;","x_google_ignoreList":[0]}
package/dist/index307.js CHANGED
@@ -1,7 +1,72 @@
1
- function e(n) {
2
- return n?.ownerDocument || document;
1
+ import * as a from "react";
2
+ import { useIsoLayoutEffect as L } from "./index287.js";
3
+ import { useStableCallback as M } from "./index288.js";
4
+ import { useTimeout as N } from "./index311.js";
5
+ import { EMPTY_ARRAY as W } from "./index290.js";
6
+ import { isListIndexDisabled as _, isElementVisible as j } from "./index382.js";
7
+ import { contains as T } from "./index317.js";
8
+ import { stopEvent as K } from "./index339.js";
9
+ function ee(h, A) {
10
+ const {
11
+ listRef: D,
12
+ elementsRef: F,
13
+ activeIndex: u,
14
+ onMatch: P,
15
+ disabledIndices: S,
16
+ onTyping: o,
17
+ enabled: b = !0,
18
+ resetMs: O = 750,
19
+ selectedIndex: n = null
20
+ } = A, y = "rootStore" in h ? h.rootStore : h, i = y.useState("open"), m = N(), t = a.useRef(""), c = a.useRef(n ?? u ?? -1), l = a.useRef(null), k = M((r) => {
21
+ function d(e) {
22
+ const s = F?.current[e];
23
+ return !s || j(s);
24
+ }
25
+ function p(e) {
26
+ return d(e) ? S == null || !_(W, e, S) : !1;
27
+ }
28
+ function g(e, s, Y = 0) {
29
+ if (e.length === 0)
30
+ return -1;
31
+ const z = (Y % e.length + e.length) % e.length, B = s.toLowerCase();
32
+ for (let w = 0; w < e.length; w += 1) {
33
+ const x = (z + w) % e.length;
34
+ if (!(!e[x]?.toLowerCase().startsWith(B) || !p(x)))
35
+ return x;
36
+ }
37
+ return -1;
38
+ }
39
+ const f = D.current;
40
+ if (t.current.length > 0 && r.key === " " && (K(r), o?.(!0)), t.current.length > 0 && t.current[0] !== " " && g(f, t.current) === -1 && r.key !== " " && o?.(!1), f == null || // Character key.
41
+ r.key.length !== 1 || // Modifier key.
42
+ r.ctrlKey || r.metaKey || r.altKey)
43
+ return;
44
+ i && r.key !== " " && (K(r), o?.(!0));
45
+ const E = t.current === "";
46
+ E && (c.current = n ?? u ?? -1), f.every((e, s) => e && p(s) ? e[0]?.toLowerCase() !== e[1]?.toLowerCase() : !0) && t.current === r.key && (t.current = "", c.current = l.current), t.current += r.key, m.start(O, () => {
47
+ t.current = "", c.current = l.current, o?.(!1);
48
+ });
49
+ const V = ((E ? n ?? u ?? -1 : c.current) ?? 0) + 1, I = g(f, t.current, V);
50
+ I !== -1 ? (P?.(I), l.current = I) : r.key !== " " && (t.current = "", o?.(!1));
51
+ }), C = M((r) => {
52
+ const d = r.relatedTarget, p = y.select("domReferenceElement"), g = y.select("floatingElement");
53
+ T(p, d) || T(g, d) || (m.clear(), t.current = "", c.current = l.current, o?.(!1));
54
+ });
55
+ L(() => {
56
+ !i && n !== null || (m.clear(), l.current = null, t.current !== "" && (t.current = ""));
57
+ }, [i, n, m]), L(() => {
58
+ i && t.current === "" && (c.current = n ?? u ?? -1);
59
+ }, [i, n, u]);
60
+ const R = a.useMemo(() => ({
61
+ onKeyDown: k,
62
+ onBlur: C
63
+ }), [k, C]);
64
+ return a.useMemo(() => b ? {
65
+ reference: R,
66
+ floating: R
67
+ } : {}, [b, R]);
3
68
  }
4
69
  export {
5
- e as ownerDocument
70
+ ee as useTypeahead
6
71
  };
7
72
  //# sourceMappingURL=index307.js.map