@quantinuum/quantinuum-ui 4.0.0 → 4.0.1-fix-update-radix.1

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 (241) hide show
  1. package/dist/_virtual/index.js +4 -0
  2. package/dist/_virtual/index.js.map +1 -0
  3. package/dist/_virtual/use-sync-external-store-shim.development.js +4 -0
  4. package/dist/_virtual/use-sync-external-store-shim.development.js.map +1 -0
  5. package/dist/_virtual/use-sync-external-store-shim.production.js +4 -0
  6. package/dist/_virtual/use-sync-external-store-shim.production.js.map +1 -0
  7. package/dist/node_modules/@radix-ui/number/dist/index.mjs.js +4 -3
  8. package/dist/node_modules/@radix-ui/number/dist/index.mjs.js.map +1 -1
  9. package/dist/node_modules/@radix-ui/primitive/dist/index.mjs.js +9 -6
  10. package/dist/node_modules/@radix-ui/primitive/dist/index.mjs.js.map +1 -1
  11. package/dist/node_modules/@radix-ui/react-accordion/dist/index.mjs.js +279 -267
  12. package/dist/node_modules/@radix-ui/react-accordion/dist/index.mjs.js.map +1 -1
  13. package/dist/node_modules/@radix-ui/react-arrow/dist/index.mjs.js +26 -0
  14. package/dist/node_modules/@radix-ui/react-arrow/dist/index.mjs.js.map +1 -0
  15. package/dist/node_modules/@radix-ui/react-avatar/dist/index.mjs.js +114 -92
  16. package/dist/node_modules/@radix-ui/react-avatar/dist/index.mjs.js.map +1 -1
  17. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.mjs.js +255 -138
  18. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.mjs.js.map +1 -1
  19. package/dist/node_modules/@radix-ui/react-collapsible/dist/index.mjs.js +135 -130
  20. package/dist/node_modules/@radix-ui/react-collapsible/dist/index.mjs.js.map +1 -1
  21. package/dist/node_modules/@radix-ui/react-collection/dist/index.mjs.js +66 -88
  22. package/dist/node_modules/@radix-ui/react-collection/dist/index.mjs.js.map +1 -1
  23. package/dist/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs.js +81 -73
  24. package/dist/node_modules/@radix-ui/react-collection/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  25. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.js +34 -21
  26. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.js.map +1 -1
  27. package/dist/node_modules/@radix-ui/react-context/dist/index.mjs.js +72 -93
  28. package/dist/node_modules/@radix-ui/react-context/dist/index.mjs.js.map +1 -1
  29. package/dist/node_modules/@radix-ui/react-dialog/dist/index.mjs.js +297 -254
  30. package/dist/node_modules/@radix-ui/react-dialog/dist/index.mjs.js.map +1 -1
  31. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.mjs.js +81 -73
  32. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  33. package/dist/node_modules/@radix-ui/react-direction/dist/index.mjs.js +8 -6
  34. package/dist/node_modules/@radix-ui/react-direction/dist/index.mjs.js.map +1 -1
  35. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.js +190 -217
  36. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs.js.map +1 -1
  37. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs.js +243 -217
  38. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs.js.map +1 -1
  39. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.mjs.js +26 -25
  40. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.mjs.js.map +1 -1
  41. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.mjs.js +191 -259
  42. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.mjs.js.map +1 -1
  43. package/dist/node_modules/@radix-ui/react-hover-card/dist/index.mjs.js +224 -205
  44. package/dist/node_modules/@radix-ui/react-hover-card/dist/index.mjs.js.map +1 -1
  45. package/dist/node_modules/@radix-ui/react-id/dist/index.mjs.js +11 -14
  46. package/dist/node_modules/@radix-ui/react-id/dist/index.mjs.js.map +1 -1
  47. package/dist/node_modules/@radix-ui/react-label/dist/index.mjs.js +22 -14
  48. package/dist/node_modules/@radix-ui/react-label/dist/index.mjs.js.map +1 -1
  49. package/dist/node_modules/@radix-ui/react-menu/dist/index.mjs.js +765 -820
  50. package/dist/node_modules/@radix-ui/react-menu/dist/index.mjs.js.map +1 -1
  51. package/dist/node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot/dist/index.mjs.js +81 -73
  52. package/dist/node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  53. package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.mjs.js +717 -730
  54. package/dist/node_modules/@radix-ui/react-navigation-menu/dist/index.mjs.js.map +1 -1
  55. package/dist/node_modules/@radix-ui/react-popover/dist/index.mjs.js +268 -199
  56. package/dist/node_modules/@radix-ui/react-popover/dist/index.mjs.js.map +1 -1
  57. package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot/dist/index.mjs.js +81 -73
  58. package/dist/node_modules/@radix-ui/react-popover/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  59. package/dist/node_modules/@radix-ui/react-popper/dist/index.mjs.js +267 -223
  60. package/dist/node_modules/@radix-ui/react-popper/dist/index.mjs.js.map +1 -1
  61. package/dist/node_modules/@radix-ui/react-portal/dist/index.mjs.js +14 -10
  62. package/dist/node_modules/@radix-ui/react-portal/dist/index.mjs.js.map +1 -1
  63. package/dist/node_modules/@radix-ui/react-presence/dist/index.mjs.js +122 -121
  64. package/dist/node_modules/@radix-ui/react-presence/dist/index.mjs.js.map +1 -1
  65. package/dist/node_modules/@radix-ui/react-primitive/dist/index.mjs.js +39 -83
  66. package/dist/node_modules/@radix-ui/react-primitive/dist/index.mjs.js.map +1 -1
  67. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.mjs.js +81 -73
  68. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  69. package/dist/node_modules/@radix-ui/react-progress/dist/index.mjs.js +77 -78
  70. package/dist/node_modules/@radix-ui/react-progress/dist/index.mjs.js.map +1 -1
  71. package/dist/node_modules/@radix-ui/react-radio-group/dist/index.mjs.js +264 -217
  72. package/dist/node_modules/@radix-ui/react-radio-group/dist/index.mjs.js.map +1 -1
  73. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.mjs.js +204 -216
  74. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.mjs.js.map +1 -1
  75. package/dist/node_modules/@radix-ui/react-scroll-area/dist/index.mjs.js +9 -9
  76. package/dist/node_modules/@radix-ui/react-select/dist/index.mjs.js +1080 -1079
  77. package/dist/node_modules/@radix-ui/react-select/dist/index.mjs.js.map +1 -1
  78. package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot/dist/index.mjs.js +81 -73
  79. package/dist/node_modules/@radix-ui/react-select/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  80. package/dist/node_modules/@radix-ui/react-separator/dist/index.mjs.js +26 -43
  81. package/dist/node_modules/@radix-ui/react-separator/dist/index.mjs.js.map +1 -1
  82. package/dist/node_modules/@radix-ui/react-slot/dist/index.mjs.js +1 -1
  83. package/dist/node_modules/@radix-ui/react-switch/dist/index.mjs.js +140 -112
  84. package/dist/node_modules/@radix-ui/react-switch/dist/index.mjs.js.map +1 -1
  85. package/dist/node_modules/@radix-ui/react-tabs/dist/index.mjs.js +173 -141
  86. package/dist/node_modules/@radix-ui/react-tabs/dist/index.mjs.js.map +1 -1
  87. package/dist/node_modules/@radix-ui/react-toggle/dist/index.mjs.js +34 -25
  88. package/dist/node_modules/@radix-ui/react-toggle/dist/index.mjs.js.map +1 -1
  89. package/dist/node_modules/@radix-ui/react-toggle-group/dist/index.mjs.js +154 -145
  90. package/dist/node_modules/@radix-ui/react-toggle-group/dist/index.mjs.js.map +1 -1
  91. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.mjs.js +462 -491
  92. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.mjs.js.map +1 -1
  93. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.mjs.js +13 -78
  94. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +1 -1
  95. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs.js +9 -15
  96. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs.js.map +1 -1
  97. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs.js +66 -43
  98. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs.js.map +1 -1
  99. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs.js +15 -18
  100. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs.js.map +1 -1
  101. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs.js +18 -0
  102. package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs.js.map +1 -0
  103. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.js +5 -9
  104. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.js.map +1 -1
  105. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.mjs.js +12 -18
  106. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.mjs.js.map +1 -1
  107. package/dist/node_modules/@radix-ui/react-use-size/dist/index.mjs.js +37 -48
  108. package/dist/node_modules/@radix-ui/react-use-size/dist/index.mjs.js.map +1 -1
  109. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs.js +32 -23
  110. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs.js.map +1 -1
  111. package/dist/node_modules/aria-hidden/dist/es2015/index.js +22 -16
  112. package/dist/node_modules/aria-hidden/dist/es2015/index.js.map +1 -1
  113. package/dist/node_modules/class-variance-authority/dist/index.mjs.js +7 -9
  114. package/dist/node_modules/class-variance-authority/dist/index.mjs.js.map +1 -1
  115. package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.mjs.js +4 -0
  116. package/dist/node_modules/cmdk/dist/chunk-NZJY6EH4.mjs.js.map +1 -0
  117. package/dist/node_modules/cmdk/dist/index.mjs.js +8 -4
  118. package/dist/node_modules/cmdk/dist/index.mjs.js.map +1 -1
  119. package/dist/node_modules/{@radix-ui/react-scroll-area → cmdk}/node_modules/@radix-ui/react-primitive/dist/index.mjs.js +1 -1
  120. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.mjs.js.map +1 -0
  121. package/dist/node_modules/input-otp/dist/index.mjs.js +1 -1
  122. package/dist/node_modules/input-otp/dist/index.mjs.js.map +1 -1
  123. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +23 -5
  124. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +1 -1
  125. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +2 -2
  126. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js.map +1 -1
  127. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +18 -6
  128. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +1 -1
  129. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +25 -5
  130. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js.map +1 -1
  131. package/dist/node_modules/sonner/dist/index.mjs.js +46 -26
  132. package/dist/node_modules/sonner/dist/index.mjs.js.map +1 -1
  133. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +27 -1
  134. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +1 -1
  135. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +107 -0
  136. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js.map +1 -0
  137. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +78 -0
  138. package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js.map +1 -0
  139. package/dist/node_modules/use-sync-external-store/shim/index.js +13 -0
  140. package/dist/node_modules/use-sync-external-store/shim/index.js.map +1 -0
  141. package/dist/src/index.js +1 -1
  142. package/dist/src/shadcn/ui/accordion.js +7 -7
  143. package/dist/src/shadcn/ui/avatar.js +7 -7
  144. package/dist/src/shadcn/ui/checkbox.js +3 -3
  145. package/dist/src/shadcn/ui/command.js +15 -15
  146. package/dist/src/shadcn/ui/dialog.js +14 -14
  147. package/dist/src/shadcn/ui/dropdown-menu.js +23 -23
  148. package/dist/src/shadcn/ui/hover-card.js +5 -5
  149. package/dist/src/shadcn/ui/label.js +3 -3
  150. package/dist/src/shadcn/ui/navigation-menu.js +15 -15
  151. package/dist/src/shadcn/ui/navigation-menu.js.map +1 -1
  152. package/dist/src/shadcn/ui/popover.js +32 -6
  153. package/dist/src/shadcn/ui/popover.js.map +1 -1
  154. package/dist/src/shadcn/ui/progress.js +3 -3
  155. package/dist/src/shadcn/ui/radio-group.js +5 -5
  156. package/dist/src/shadcn/ui/select.js +19 -19
  157. package/dist/src/shadcn/ui/separator.js +3 -3
  158. package/dist/src/shadcn/ui/sheet.js +14 -14
  159. package/dist/src/shadcn/ui/switch.js +3 -3
  160. package/dist/src/shadcn/ui/tabs.js +8 -8
  161. package/dist/src/shadcn/ui/toggle-group.js +5 -5
  162. package/dist/src/shadcn/ui/toggle.js +3 -3
  163. package/dist/src/shadcn/ui/tooltip.js +7 -7
  164. package/dist/tailwind-manifest.js +12595 -14091
  165. package/dist/types/src/shadcn/ui/command.d.ts +44 -8
  166. package/dist/types/src/shadcn/ui/popover.d.ts +8 -4
  167. package/dist/types/src/shadcn/ui/sheet.d.ts +1 -1
  168. package/package.json +10 -31
  169. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +0 -12
  170. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
  171. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/number/dist/index.mjs.js +0 -7
  172. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/number/dist/index.mjs.js.map +0 -1
  173. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/primitive/dist/index.mjs.js +0 -12
  174. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/primitive/dist/index.mjs.js.map +0 -1
  175. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.js +0 -40
  176. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.js.map +0 -1
  177. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-context/dist/index.mjs.js +0 -64
  178. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-context/dist/index.mjs.js.map +0 -1
  179. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-direction/dist/index.mjs.js +0 -12
  180. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-direction/dist/index.mjs.js.map +0 -1
  181. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-presence/dist/index.mjs.js +0 -132
  182. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-presence/dist/index.mjs.js.map +0 -1
  183. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-primitive/dist/index.mjs.js.map +0 -1
  184. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-slot/dist/index.mjs.js +0 -90
  185. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-slot/dist/index.mjs.js.map +0 -1
  186. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs.js +0 -13
  187. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs.js.map +0 -1
  188. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.js +0 -8
  189. package/dist/node_modules/@radix-ui/react-scroll-area/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs.js.map +0 -1
  190. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.js +0 -37
  191. package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.mjs.js.map +0 -1
  192. package/dist/node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs.js +0 -4
  193. package/dist/node_modules/class-variance-authority/node_modules/clsx/dist/clsx.mjs.js.map +0 -1
  194. package/dist/node_modules/cmdk/node_modules/@radix-ui/primitive/dist/index.module.js +0 -9
  195. package/dist/node_modules/cmdk/node_modules/@radix-ui/primitive/dist/index.module.js.map +0 -1
  196. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-compose-refs/dist/index.module.js +0 -27
  197. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-compose-refs/dist/index.module.js.map +0 -1
  198. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-context/dist/index.module.js +0 -101
  199. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-context/dist/index.module.js.map +0 -1
  200. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-dialog/dist/index.module.js +0 -214
  201. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-dialog/dist/index.module.js.map +0 -1
  202. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.js +0 -233
  203. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-dismissable-layer/dist/index.module.js.map +0 -1
  204. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-focus-guards/dist/index.module.js +0 -30
  205. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-focus-guards/dist/index.module.js.map +0 -1
  206. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-focus-scope/dist/index.module.js +0 -252
  207. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-focus-scope/dist/index.module.js.map +0 -1
  208. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-id/dist/index.module.js +0 -19
  209. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-id/dist/index.module.js.map +0 -1
  210. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-portal/dist/index.module.js +0 -15
  211. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-portal/dist/index.module.js.map +0 -1
  212. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-presence/dist/index.module.js +0 -131
  213. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-presence/dist/index.module.js.map +0 -1
  214. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.module.js +0 -85
  215. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-primitive/dist/index.module.js.map +0 -1
  216. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.module.js +0 -79
  217. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-slot/dist/index.module.js.map +0 -1
  218. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js +0 -19
  219. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-callback-ref/dist/index.module.js.map +0 -1
  220. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-controllable-state/dist/index.module.js +0 -48
  221. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-controllable-state/dist/index.module.js.map +0 -1
  222. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.js +0 -21
  223. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-escape-keydown/dist/index.module.js.map +0 -1
  224. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-layout-effect/dist/index.module.js +0 -12
  225. package/dist/node_modules/cmdk/node_modules/@radix-ui/react-use-layout-effect/dist/index.module.js.map +0 -1
  226. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -10
  227. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/Combination.js.map +0 -1
  228. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -146
  229. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/SideEffect.js.map +0 -1
  230. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -39
  231. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/UI.js.map +0 -1
  232. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -22
  233. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +0 -1
  234. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -97
  235. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/handleScroll.js.map +0 -1
  236. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -9
  237. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/medium.js.map +0 -1
  238. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -10
  239. package/dist/node_modules/cmdk/node_modules/react-remove-scroll/dist/es2015/sidecar.js.map +0 -1
  240. package/dist/node_modules/command-score/index.js +0 -138
  241. package/dist/node_modules/command-score/index.js.map +0 -1
@@ -1,798 +1,785 @@
1
- import _extends from '../../../@babel/runtime/helpers/esm/extends.js';
2
- import { forwardRef, useState, useRef, useCallback, useEffect, createElement, Fragment, useMemo } from 'react';
1
+ 'use client';
2
+ import * as React from 'react';
3
3
  import ReactDOM__default from 'react-dom';
4
- import { createContextScope as $c512c27ab02ef895$export$50c7b4e9d9f19c1 } from '../../react-context/dist/index.mjs.js';
5
- import { composeEventHandlers as $e42e1063c40fb3ef$export$b9ecd428b558ff10 } from '../../primitive/dist/index.mjs.js';
6
- import { Primitive as $8927f6f2acc4f386$export$250ffa63cdc0d034, dispatchDiscreteCustomEvent as $8927f6f2acc4f386$export$6d1a0317bde7de7f } from '../../react-primitive/dist/index.mjs.js';
7
- import { useControllableState as $71cd76cc60e0454e$export$6f32135080cb4c3 } from '../../react-use-controllable-state/dist/index.mjs.js';
8
- import { useComposedRefs as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, composeRefs as $6ed0406888f73fc4$export$43e446d32b3d21af } from '../../react-compose-refs/dist/index.mjs.js';
9
- import { useDirection as $f631663db3294ace$export$b39126d51d94e6f3 } from '../../react-direction/dist/index.mjs.js';
10
- import { Presence as $921a889cee6df7e8$export$99c2b779aa4e8b8b } from '../../react-presence/dist/index.mjs.js';
11
- import { useId as $1746a345f3d73bb7$export$f680877a34711e37 } from '../../react-id/dist/index.mjs.js';
12
- import { createCollection as $e02a7d9cb1dc128c$export$c74125a8e3af6bb2 } from '../../react-collection/dist/index.mjs.js';
13
- import { DismissableLayer as $5cb92bef7577960e$export$177fb62ff3ec1f22 } from '../../react-dismissable-layer/dist/index.mjs.js';
14
- import { usePrevious as $010c2913dbd2fe3d$export$5cae361ad82dce8b } from '../../react-use-previous/dist/index.mjs.js';
15
- import { useLayoutEffect as $9f79659886946c16$export$e5c5a5f917a5871c } from '../../react-use-layout-effect/dist/index.mjs.js';
16
- import { useCallbackRef as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a } from '../../react-use-callback-ref/dist/index.mjs.js';
17
- import { Root as $ea1ef594cf570d83$export$be92b6f5f03c0fe9 } from '../../react-visually-hidden/dist/index.mjs.js';
4
+ import { createContextScope } from '../../react-context/dist/index.mjs.js';
5
+ import { composeEventHandlers } from '../../primitive/dist/index.mjs.js';
6
+ import { Primitive, dispatchDiscreteCustomEvent } from '../../react-primitive/dist/index.mjs.js';
7
+ import { useControllableState } from '../../react-use-controllable-state/dist/index.mjs.js';
8
+ import { useComposedRefs, composeRefs } from '../../react-compose-refs/dist/index.mjs.js';
9
+ import { useDirection } from '../../react-direction/dist/index.mjs.js';
10
+ import { Presence } from '../../react-presence/dist/index.mjs.js';
11
+ import { useId } from '../../react-id/dist/index.mjs.js';
12
+ import { createCollection } from '../../react-collection/dist/index.mjs.js';
13
+ import { DismissableLayer } from '../../react-dismissable-layer/dist/index.mjs.js';
14
+ import { usePrevious } from '../../react-use-previous/dist/index.mjs.js';
15
+ import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.mjs.js';
16
+ import { useCallbackRef } from '../../react-use-callback-ref/dist/index.mjs.js';
17
+ import { Root } from '../../react-visually-hidden/dist/index.mjs.js';
18
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
18
19
 
19
- /* -------------------------------------------------------------------------------------------------
20
- * NavigationMenu
21
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$NAVIGATION_MENU_NAME = 'NavigationMenu';
22
- const [$322c88a641701f3b$var$Collection, $322c88a641701f3b$var$useCollection, $322c88a641701f3b$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($322c88a641701f3b$var$NAVIGATION_MENU_NAME);
23
- const [$322c88a641701f3b$var$FocusGroupCollection, $322c88a641701f3b$var$useFocusGroupCollection, $322c88a641701f3b$var$createFocusGroupCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($322c88a641701f3b$var$NAVIGATION_MENU_NAME);
24
- const [$322c88a641701f3b$var$createNavigationMenuContext, $322c88a641701f3b$export$fb8ea5af8c9fcdf0] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($322c88a641701f3b$var$NAVIGATION_MENU_NAME, [
25
- $322c88a641701f3b$var$createCollectionScope,
26
- $322c88a641701f3b$var$createFocusGroupCollectionScope
27
- ]);
28
- const [$322c88a641701f3b$var$NavigationMenuProviderImpl, $322c88a641701f3b$var$useNavigationMenuContext] = $322c88a641701f3b$var$createNavigationMenuContext($322c88a641701f3b$var$NAVIGATION_MENU_NAME);
29
- const [$322c88a641701f3b$var$ViewportContentProvider, $322c88a641701f3b$var$useViewportContentContext] = $322c88a641701f3b$var$createNavigationMenuContext($322c88a641701f3b$var$NAVIGATION_MENU_NAME);
30
- const $322c88a641701f3b$export$5b2278cf1e8bcae2 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
31
- const { __scopeNavigationMenu: __scopeNavigationMenu , value: valueProp , onValueChange: onValueChange , defaultValue: defaultValue , delayDuration: delayDuration = 200 , skipDelayDuration: skipDelayDuration = 300 , orientation: orientation = 'horizontal' , dir: dir , ...NavigationMenuProps } = props;
32
- const [navigationMenu, setNavigationMenu] = useState(null);
33
- const composedRef = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNavigationMenu(node)
34
- );
35
- const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
36
- const openTimerRef = useRef(0);
37
- const closeTimerRef = useRef(0);
38
- const skipDelayTimerRef = useRef(0);
39
- const [isOpenDelayed, setIsOpenDelayed] = useState(true);
40
- const [value1 = '', setValue] = $71cd76cc60e0454e$export$6f32135080cb4c3({
41
- prop: valueProp,
42
- onChange: (value)=>{
43
- const isOpen = value !== '';
44
- const hasSkipDelayDuration = skipDelayDuration > 0;
45
- if (isOpen) {
46
- window.clearTimeout(skipDelayTimerRef.current);
47
- if (hasSkipDelayDuration) setIsOpenDelayed(false);
48
- } else {
49
- window.clearTimeout(skipDelayTimerRef.current);
50
- skipDelayTimerRef.current = window.setTimeout(()=>setIsOpenDelayed(true)
51
- , skipDelayDuration);
52
- }
53
- onValueChange === null || onValueChange === void 0 || onValueChange(value);
54
- },
55
- defaultProp: defaultValue
20
+ var NAVIGATION_MENU_NAME = "NavigationMenu";
21
+ var [Collection, useCollection, createCollectionScope] = createCollection(NAVIGATION_MENU_NAME);
22
+ var [FocusGroupCollection, useFocusGroupCollection, createFocusGroupCollectionScope] = createCollection(NAVIGATION_MENU_NAME);
23
+ var [createNavigationMenuContext, createNavigationMenuScope] = createContextScope(
24
+ NAVIGATION_MENU_NAME,
25
+ [createCollectionScope, createFocusGroupCollectionScope]
26
+ );
27
+ var [NavigationMenuProviderImpl, useNavigationMenuContext] = createNavigationMenuContext(NAVIGATION_MENU_NAME);
28
+ var [ViewportContentProvider, useViewportContentContext] = createNavigationMenuContext(NAVIGATION_MENU_NAME);
29
+ var NavigationMenu = React.forwardRef(
30
+ (props, forwardedRef) => {
31
+ const {
32
+ __scopeNavigationMenu,
33
+ value: valueProp,
34
+ onValueChange,
35
+ defaultValue,
36
+ delayDuration = 200,
37
+ skipDelayDuration = 300,
38
+ orientation = "horizontal",
39
+ dir,
40
+ ...NavigationMenuProps
41
+ } = props;
42
+ const [navigationMenu, setNavigationMenu] = React.useState(null);
43
+ const composedRef = useComposedRefs(forwardedRef, (node) => setNavigationMenu(node));
44
+ const direction = useDirection(dir);
45
+ const openTimerRef = React.useRef(0);
46
+ const closeTimerRef = React.useRef(0);
47
+ const skipDelayTimerRef = React.useRef(0);
48
+ const [isOpenDelayed, setIsOpenDelayed] = React.useState(true);
49
+ const [value, setValue] = useControllableState({
50
+ prop: valueProp,
51
+ onChange: (value2) => {
52
+ const isOpen = value2 !== "";
53
+ const hasSkipDelayDuration = skipDelayDuration > 0;
54
+ if (isOpen) {
55
+ window.clearTimeout(skipDelayTimerRef.current);
56
+ if (hasSkipDelayDuration) setIsOpenDelayed(false);
57
+ } else {
58
+ window.clearTimeout(skipDelayTimerRef.current);
59
+ skipDelayTimerRef.current = window.setTimeout(
60
+ () => setIsOpenDelayed(true),
61
+ skipDelayDuration
62
+ );
63
+ }
64
+ onValueChange?.(value2);
65
+ },
66
+ defaultProp: defaultValue ?? "",
67
+ caller: NAVIGATION_MENU_NAME
56
68
  });
57
- const startCloseTimer = useCallback(()=>{
58
- window.clearTimeout(closeTimerRef.current);
59
- closeTimerRef.current = window.setTimeout(()=>setValue('')
60
- , 150);
61
- }, [
62
- setValue
63
- ]);
64
- const handleOpen = useCallback((itemValue)=>{
69
+ const startCloseTimer = React.useCallback(() => {
70
+ window.clearTimeout(closeTimerRef.current);
71
+ closeTimerRef.current = window.setTimeout(() => setValue(""), 150);
72
+ }, [setValue]);
73
+ const handleOpen = React.useCallback(
74
+ (itemValue) => {
65
75
  window.clearTimeout(closeTimerRef.current);
66
76
  setValue(itemValue);
67
- }, [
68
- setValue
69
- ]);
70
- const handleDelayedOpen = useCallback((itemValue)=>{
71
- const isOpenItem = value1 === itemValue;
72
- if (isOpenItem) // If the item is already open (e.g. we're transitioning from the content to the trigger)
73
- // then we want to clear the close timer immediately.
74
- window.clearTimeout(closeTimerRef.current);
75
- else openTimerRef.current = window.setTimeout(()=>{
77
+ },
78
+ [setValue]
79
+ );
80
+ const handleDelayedOpen = React.useCallback(
81
+ (itemValue) => {
82
+ const isOpenItem = value === itemValue;
83
+ if (isOpenItem) {
84
+ window.clearTimeout(closeTimerRef.current);
85
+ } else {
86
+ openTimerRef.current = window.setTimeout(() => {
76
87
  window.clearTimeout(closeTimerRef.current);
77
88
  setValue(itemValue);
78
- }, delayDuration);
79
- }, [
80
- value1,
81
- setValue,
82
- delayDuration
83
- ]);
84
- useEffect(()=>{
85
- return ()=>{
86
- window.clearTimeout(openTimerRef.current);
87
- window.clearTimeout(closeTimerRef.current);
88
- window.clearTimeout(skipDelayTimerRef.current);
89
- };
89
+ }, delayDuration);
90
+ }
91
+ },
92
+ [value, setValue, delayDuration]
93
+ );
94
+ React.useEffect(() => {
95
+ return () => {
96
+ window.clearTimeout(openTimerRef.current);
97
+ window.clearTimeout(closeTimerRef.current);
98
+ window.clearTimeout(skipDelayTimerRef.current);
99
+ };
90
100
  }, []);
91
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuProvider, {
101
+ return /* @__PURE__ */ jsx(
102
+ NavigationMenuProvider,
103
+ {
92
104
  scope: __scopeNavigationMenu,
93
105
  isRootMenu: true,
94
- value: value1,
106
+ value,
95
107
  dir: direction,
96
- orientation: orientation,
108
+ orientation,
97
109
  rootNavigationMenu: navigationMenu,
98
- onTriggerEnter: (itemValue)=>{
99
- window.clearTimeout(openTimerRef.current);
100
- if (isOpenDelayed) handleDelayedOpen(itemValue);
101
- else handleOpen(itemValue);
110
+ onTriggerEnter: (itemValue) => {
111
+ window.clearTimeout(openTimerRef.current);
112
+ if (isOpenDelayed) handleDelayedOpen(itemValue);
113
+ else handleOpen(itemValue);
102
114
  },
103
- onTriggerLeave: ()=>{
104
- window.clearTimeout(openTimerRef.current);
105
- startCloseTimer();
115
+ onTriggerLeave: () => {
116
+ window.clearTimeout(openTimerRef.current);
117
+ startCloseTimer();
106
118
  },
107
- onContentEnter: ()=>window.clearTimeout(closeTimerRef.current)
108
- ,
119
+ onContentEnter: () => window.clearTimeout(closeTimerRef.current),
109
120
  onContentLeave: startCloseTimer,
110
- onItemSelect: (itemValue)=>{
111
- setValue((prevValue)=>prevValue === itemValue ? '' : itemValue
112
- );
121
+ onItemSelect: (itemValue) => {
122
+ setValue((prevValue) => prevValue === itemValue ? "" : itemValue);
113
123
  },
114
- onItemDismiss: ()=>setValue('')
115
- }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.nav, _extends({
116
- "aria-label": "Main",
117
- "data-orientation": orientation,
118
- dir: direction
119
- }, NavigationMenuProps, {
120
- ref: composedRef
121
- })));
122
- });
123
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$NavigationMenuProvider = (props)=>{
124
- const { scope: scope , isRootMenu: isRootMenu , rootNavigationMenu: rootNavigationMenu , dir: dir , orientation: orientation , children: children , value: value , onItemSelect: onItemSelect , onItemDismiss: onItemDismiss , onTriggerEnter: onTriggerEnter , onTriggerLeave: onTriggerLeave , onContentEnter: onContentEnter , onContentLeave: onContentLeave } = props;
125
- const [viewport, setViewport] = useState(null);
126
- const [viewportContent, setViewportContent] = useState(new Map());
127
- const [indicatorTrack, setIndicatorTrack] = useState(null);
128
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuProviderImpl, {
129
- scope: scope,
130
- isRootMenu: isRootMenu,
131
- rootNavigationMenu: rootNavigationMenu,
132
- value: value,
133
- previousValue: $010c2913dbd2fe3d$export$5cae361ad82dce8b(value),
134
- baseId: $1746a345f3d73bb7$export$f680877a34711e37(),
135
- dir: dir,
136
- orientation: orientation,
137
- viewport: viewport,
138
- onViewportChange: setViewport,
139
- indicatorTrack: indicatorTrack,
140
- onIndicatorTrackChange: setIndicatorTrack,
141
- onTriggerEnter: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onTriggerEnter),
142
- onTriggerLeave: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onTriggerLeave),
143
- onContentEnter: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onContentEnter),
144
- onContentLeave: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onContentLeave),
145
- onItemSelect: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onItemSelect),
146
- onItemDismiss: $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onItemDismiss),
147
- onViewportContentChange: useCallback((contentValue, contentData)=>{
148
- setViewportContent((prevContent)=>{
149
- prevContent.set(contentValue, contentData);
150
- return new Map(prevContent);
151
- });
152
- }, []),
153
- onViewportContentRemove: useCallback((contentValue)=>{
154
- setViewportContent((prevContent)=>{
155
- if (!prevContent.has(contentValue)) return prevContent;
156
- prevContent.delete(contentValue);
157
- return new Map(prevContent);
158
- });
159
- }, [])
160
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$Collection.Provider, {
161
- scope: scope
162
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$ViewportContentProvider, {
163
- scope: scope,
164
- items: viewportContent
165
- }, children)));
124
+ onItemDismiss: () => setValue(""),
125
+ children: /* @__PURE__ */ jsx(
126
+ Primitive.nav,
127
+ {
128
+ "aria-label": "Main",
129
+ "data-orientation": orientation,
130
+ dir: direction,
131
+ ...NavigationMenuProps,
132
+ ref: composedRef
133
+ }
134
+ )
135
+ }
136
+ );
137
+ }
138
+ );
139
+ NavigationMenu.displayName = NAVIGATION_MENU_NAME;
140
+ var SUB_NAME = "NavigationMenuSub";
141
+ var NavigationMenuSub = React.forwardRef(
142
+ (props, forwardedRef) => {
143
+ const {
144
+ __scopeNavigationMenu,
145
+ value: valueProp,
146
+ onValueChange,
147
+ defaultValue,
148
+ orientation = "horizontal",
149
+ ...subProps
150
+ } = props;
151
+ const context = useNavigationMenuContext(SUB_NAME, __scopeNavigationMenu);
152
+ const [value, setValue] = useControllableState({
153
+ prop: valueProp,
154
+ onChange: onValueChange,
155
+ defaultProp: defaultValue ?? "",
156
+ caller: SUB_NAME
157
+ });
158
+ return /* @__PURE__ */ jsx(
159
+ NavigationMenuProvider,
160
+ {
161
+ scope: __scopeNavigationMenu,
162
+ isRootMenu: false,
163
+ value,
164
+ dir: context.dir,
165
+ orientation,
166
+ rootNavigationMenu: context.rootNavigationMenu,
167
+ onTriggerEnter: (itemValue) => setValue(itemValue),
168
+ onItemSelect: (itemValue) => setValue(itemValue),
169
+ onItemDismiss: () => setValue(""),
170
+ children: /* @__PURE__ */ jsx(Primitive.div, { "data-orientation": orientation, ...subProps, ref: forwardedRef })
171
+ }
172
+ );
173
+ }
174
+ );
175
+ NavigationMenuSub.displayName = SUB_NAME;
176
+ var NavigationMenuProvider = (props) => {
177
+ const {
178
+ scope,
179
+ isRootMenu,
180
+ rootNavigationMenu,
181
+ dir,
182
+ orientation,
183
+ children,
184
+ value,
185
+ onItemSelect,
186
+ onItemDismiss,
187
+ onTriggerEnter,
188
+ onTriggerLeave,
189
+ onContentEnter,
190
+ onContentLeave
191
+ } = props;
192
+ const [viewport, setViewport] = React.useState(null);
193
+ const [viewportContent, setViewportContent] = React.useState(/* @__PURE__ */ new Map());
194
+ const [indicatorTrack, setIndicatorTrack] = React.useState(null);
195
+ return /* @__PURE__ */ jsx(
196
+ NavigationMenuProviderImpl,
197
+ {
198
+ scope,
199
+ isRootMenu,
200
+ rootNavigationMenu,
201
+ value,
202
+ previousValue: usePrevious(value),
203
+ baseId: useId(),
204
+ dir,
205
+ orientation,
206
+ viewport,
207
+ onViewportChange: setViewport,
208
+ indicatorTrack,
209
+ onIndicatorTrackChange: setIndicatorTrack,
210
+ onTriggerEnter: useCallbackRef(onTriggerEnter),
211
+ onTriggerLeave: useCallbackRef(onTriggerLeave),
212
+ onContentEnter: useCallbackRef(onContentEnter),
213
+ onContentLeave: useCallbackRef(onContentLeave),
214
+ onItemSelect: useCallbackRef(onItemSelect),
215
+ onItemDismiss: useCallbackRef(onItemDismiss),
216
+ onViewportContentChange: React.useCallback((contentValue, contentData) => {
217
+ setViewportContent((prevContent) => {
218
+ prevContent.set(contentValue, contentData);
219
+ return new Map(prevContent);
220
+ });
221
+ }, []),
222
+ onViewportContentRemove: React.useCallback((contentValue) => {
223
+ setViewportContent((prevContent) => {
224
+ if (!prevContent.has(contentValue)) return prevContent;
225
+ prevContent.delete(contentValue);
226
+ return new Map(prevContent);
227
+ });
228
+ }, []),
229
+ children: /* @__PURE__ */ jsx(Collection.Provider, { scope, children: /* @__PURE__ */ jsx(ViewportContentProvider, { scope, items: viewportContent, children }) })
230
+ }
231
+ );
166
232
  };
167
- /* -------------------------------------------------------------------------------------------------
168
- * NavigationMenuList
169
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$LIST_NAME = 'NavigationMenuList';
170
- const $322c88a641701f3b$export$c361068a95fd2286 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
171
- const { __scopeNavigationMenu: __scopeNavigationMenu , ...listProps } = props;
172
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$LIST_NAME, __scopeNavigationMenu);
173
- const list = /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.ul, _extends({
174
- "data-orientation": context.orientation
175
- }, listProps, {
176
- ref: forwardedRef
177
- }));
178
- return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, {
179
- style: {
180
- position: 'relative'
181
- },
182
- ref: context.onIndicatorTrackChange
183
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$Collection.Slot, {
184
- scope: __scopeNavigationMenu
185
- }, context.isRootMenu ? /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroup, {
186
- asChild: true
187
- }, list) : list));
188
- });
189
- /* -------------------------------------------------------------------------------------------------
190
- * NavigationMenuItem
191
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$ITEM_NAME = 'NavigationMenuItem';
192
- const [$322c88a641701f3b$var$NavigationMenuItemContextProvider, $322c88a641701f3b$var$useNavigationMenuItemContext] = $322c88a641701f3b$var$createNavigationMenuContext($322c88a641701f3b$var$ITEM_NAME);
193
- const $322c88a641701f3b$export$ffdbb83a2de845c2 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
194
- const { __scopeNavigationMenu: __scopeNavigationMenu , value: valueProp , ...itemProps } = props;
195
- const autoValue = $1746a345f3d73bb7$export$f680877a34711e37(); // We need to provide an initial deterministic value as `useId` will return
196
- // empty string on the first render and we don't want to match our internal "closed" value.
197
- const value = valueProp || autoValue || 'LEGACY_REACT_AUTO_VALUE';
198
- const contentRef = useRef(null);
199
- const triggerRef = useRef(null);
200
- const focusProxyRef = useRef(null);
201
- const restoreContentTabOrderRef = useRef(()=>{});
202
- const wasEscapeCloseRef = useRef(false);
203
- const handleContentEntry = useCallback((side = 'start')=>{
204
- if (contentRef.current) {
205
- restoreContentTabOrderRef.current();
206
- const candidates = $322c88a641701f3b$var$getTabbableCandidates(contentRef.current);
207
- if (candidates.length) $322c88a641701f3b$var$focusFirst(side === 'start' ? candidates : candidates.reverse());
208
- }
233
+ var LIST_NAME = "NavigationMenuList";
234
+ var NavigationMenuList = React.forwardRef(
235
+ (props, forwardedRef) => {
236
+ const { __scopeNavigationMenu, ...listProps } = props;
237
+ const context = useNavigationMenuContext(LIST_NAME, __scopeNavigationMenu);
238
+ const list = /* @__PURE__ */ jsx(Primitive.ul, { "data-orientation": context.orientation, ...listProps, ref: forwardedRef });
239
+ return /* @__PURE__ */ jsx(Primitive.div, { style: { position: "relative" }, ref: context.onIndicatorTrackChange, children: /* @__PURE__ */ jsx(Collection.Slot, { scope: __scopeNavigationMenu, children: context.isRootMenu ? /* @__PURE__ */ jsx(FocusGroup, { asChild: true, children: list }) : list }) });
240
+ }
241
+ );
242
+ NavigationMenuList.displayName = LIST_NAME;
243
+ var ITEM_NAME = "NavigationMenuItem";
244
+ var [NavigationMenuItemContextProvider, useNavigationMenuItemContext] = createNavigationMenuContext(ITEM_NAME);
245
+ var NavigationMenuItem = React.forwardRef(
246
+ (props, forwardedRef) => {
247
+ const { __scopeNavigationMenu, value: valueProp, ...itemProps } = props;
248
+ const autoValue = useId();
249
+ const value = valueProp || autoValue || "LEGACY_REACT_AUTO_VALUE";
250
+ const contentRef = React.useRef(null);
251
+ const triggerRef = React.useRef(null);
252
+ const focusProxyRef = React.useRef(null);
253
+ const restoreContentTabOrderRef = React.useRef(() => {
254
+ });
255
+ const wasEscapeCloseRef = React.useRef(false);
256
+ const handleContentEntry = React.useCallback((side = "start") => {
257
+ if (contentRef.current) {
258
+ restoreContentTabOrderRef.current();
259
+ const candidates = getTabbableCandidates(contentRef.current);
260
+ if (candidates.length) focusFirst(side === "start" ? candidates : candidates.reverse());
261
+ }
209
262
  }, []);
210
- const handleContentExit = useCallback(()=>{
211
- if (contentRef.current) {
212
- const candidates = $322c88a641701f3b$var$getTabbableCandidates(contentRef.current);
213
- if (candidates.length) restoreContentTabOrderRef.current = $322c88a641701f3b$var$removeFromTabOrder(candidates);
214
- }
263
+ const handleContentExit = React.useCallback(() => {
264
+ if (contentRef.current) {
265
+ const candidates = getTabbableCandidates(contentRef.current);
266
+ if (candidates.length) restoreContentTabOrderRef.current = removeFromTabOrder(candidates);
267
+ }
215
268
  }, []);
216
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuItemContextProvider, {
269
+ return /* @__PURE__ */ jsx(
270
+ NavigationMenuItemContextProvider,
271
+ {
217
272
  scope: __scopeNavigationMenu,
218
- value: value,
219
- triggerRef: triggerRef,
220
- contentRef: contentRef,
221
- focusProxyRef: focusProxyRef,
222
- wasEscapeCloseRef: wasEscapeCloseRef,
273
+ value,
274
+ triggerRef,
275
+ contentRef,
276
+ focusProxyRef,
277
+ wasEscapeCloseRef,
223
278
  onEntryKeyDown: handleContentEntry,
224
279
  onFocusProxyEnter: handleContentEntry,
225
280
  onRootContentClose: handleContentExit,
226
- onContentFocusOutside: handleContentExit
227
- }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.li, _extends({}, itemProps, {
228
- ref: forwardedRef
229
- })));
230
- });
231
- /* -------------------------------------------------------------------------------------------------
232
- * NavigationMenuTrigger
233
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$TRIGGER_NAME = 'NavigationMenuTrigger';
234
- const $322c88a641701f3b$export$37fe8002734d8f2 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
235
- const { __scopeNavigationMenu: __scopeNavigationMenu , disabled: disabled , ...triggerProps } = props;
236
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$TRIGGER_NAME, props.__scopeNavigationMenu);
237
- const itemContext = $322c88a641701f3b$var$useNavigationMenuItemContext($322c88a641701f3b$var$TRIGGER_NAME, props.__scopeNavigationMenu);
238
- const ref = useRef(null);
239
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(ref, itemContext.triggerRef, forwardedRef);
240
- const triggerId = $322c88a641701f3b$var$makeTriggerId(context.baseId, itemContext.value);
241
- const contentId = $322c88a641701f3b$var$makeContentId(context.baseId, itemContext.value);
242
- const hasPointerMoveOpenedRef = useRef(false);
243
- const wasClickCloseRef = useRef(false);
244
- const open = itemContext.value === context.value;
245
- return /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement($322c88a641701f3b$var$Collection.ItemSlot, {
246
- scope: __scopeNavigationMenu,
247
- value: itemContext.value
248
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroupItem, {
249
- asChild: true
250
- }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
281
+ onContentFocusOutside: handleContentExit,
282
+ children: /* @__PURE__ */ jsx(Primitive.li, { ...itemProps, ref: forwardedRef })
283
+ }
284
+ );
285
+ }
286
+ );
287
+ NavigationMenuItem.displayName = ITEM_NAME;
288
+ var TRIGGER_NAME = "NavigationMenuTrigger";
289
+ var NavigationMenuTrigger = React.forwardRef((props, forwardedRef) => {
290
+ const { __scopeNavigationMenu, disabled, ...triggerProps } = props;
291
+ const context = useNavigationMenuContext(TRIGGER_NAME, props.__scopeNavigationMenu);
292
+ const itemContext = useNavigationMenuItemContext(TRIGGER_NAME, props.__scopeNavigationMenu);
293
+ const ref = React.useRef(null);
294
+ const composedRefs = useComposedRefs(ref, itemContext.triggerRef, forwardedRef);
295
+ const triggerId = makeTriggerId(context.baseId, itemContext.value);
296
+ const contentId = makeContentId(context.baseId, itemContext.value);
297
+ const hasPointerMoveOpenedRef = React.useRef(false);
298
+ const wasClickCloseRef = React.useRef(false);
299
+ const open = itemContext.value === context.value;
300
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
301
+ /* @__PURE__ */ jsx(Collection.ItemSlot, { scope: __scopeNavigationMenu, value: itemContext.value, children: /* @__PURE__ */ jsx(FocusGroupItem, { asChild: true, children: /* @__PURE__ */ jsx(
302
+ Primitive.button,
303
+ {
251
304
  id: triggerId,
252
- disabled: disabled,
253
- "data-disabled": disabled ? '' : undefined,
254
- "data-state": $322c88a641701f3b$var$getOpenState(open),
305
+ disabled,
306
+ "data-disabled": disabled ? "" : void 0,
307
+ "data-state": getOpenState(open),
255
308
  "aria-expanded": open,
256
- "aria-controls": contentId
257
- }, triggerProps, {
309
+ "aria-controls": contentId,
310
+ ...triggerProps,
258
311
  ref: composedRefs,
259
- onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerEnter, ()=>{
260
- wasClickCloseRef.current = false;
261
- itemContext.wasEscapeCloseRef.current = false;
312
+ onPointerEnter: composeEventHandlers(props.onPointerEnter, () => {
313
+ wasClickCloseRef.current = false;
314
+ itemContext.wasEscapeCloseRef.current = false;
262
315
  }),
263
- onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, $322c88a641701f3b$var$whenMouse(()=>{
264
- if (disabled || wasClickCloseRef.current || itemContext.wasEscapeCloseRef.current || hasPointerMoveOpenedRef.current) return;
316
+ onPointerMove: composeEventHandlers(
317
+ props.onPointerMove,
318
+ whenMouse(() => {
319
+ if (disabled || wasClickCloseRef.current || itemContext.wasEscapeCloseRef.current || hasPointerMoveOpenedRef.current)
320
+ return;
265
321
  context.onTriggerEnter(itemContext.value);
266
322
  hasPointerMoveOpenedRef.current = true;
267
- })),
268
- onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, $322c88a641701f3b$var$whenMouse(()=>{
323
+ })
324
+ ),
325
+ onPointerLeave: composeEventHandlers(
326
+ props.onPointerLeave,
327
+ whenMouse(() => {
269
328
  if (disabled) return;
270
329
  context.onTriggerLeave();
271
330
  hasPointerMoveOpenedRef.current = false;
272
- })),
273
- onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, ()=>{
274
- context.onItemSelect(itemContext.value);
275
- wasClickCloseRef.current = open;
331
+ })
332
+ ),
333
+ onClick: composeEventHandlers(props.onClick, () => {
334
+ context.onItemSelect(itemContext.value);
335
+ wasClickCloseRef.current = open;
276
336
  }),
277
- onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
278
- const verticalEntryKey = context.dir === 'rtl' ? 'ArrowLeft' : 'ArrowRight';
279
- const entryKey = {
280
- horizontal: 'ArrowDown',
281
- vertical: verticalEntryKey
282
- }[context.orientation];
283
- if (open && event.key === entryKey) {
284
- itemContext.onEntryKeyDown(); // Prevent FocusGroupItem from handling the event
285
- event.preventDefault();
286
- }
337
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
338
+ const verticalEntryKey = context.dir === "rtl" ? "ArrowLeft" : "ArrowRight";
339
+ const entryKey = { horizontal: "ArrowDown", vertical: verticalEntryKey }[context.orientation];
340
+ if (open && event.key === entryKey) {
341
+ itemContext.onEntryKeyDown();
342
+ event.preventDefault();
343
+ }
287
344
  })
288
- })))), open && /*#__PURE__*/ createElement(Fragment, null, /*#__PURE__*/ createElement($ea1ef594cf570d83$export$be92b6f5f03c0fe9, {
289
- "aria-hidden": true,
290
- tabIndex: 0,
291
- ref: itemContext.focusProxyRef,
292
- onFocus: (event)=>{
345
+ }
346
+ ) }) }),
347
+ open && /* @__PURE__ */ jsxs(Fragment, { children: [
348
+ /* @__PURE__ */ jsx(
349
+ Root,
350
+ {
351
+ "aria-hidden": true,
352
+ tabIndex: 0,
353
+ ref: itemContext.focusProxyRef,
354
+ onFocus: (event) => {
293
355
  const content = itemContext.contentRef.current;
294
356
  const prevFocusedElement = event.relatedTarget;
295
357
  const wasTriggerFocused = prevFocusedElement === ref.current;
296
- const wasFocusFromContent = content === null || content === void 0 ? void 0 : content.contains(prevFocusedElement);
297
- if (wasTriggerFocused || !wasFocusFromContent) itemContext.onFocusProxyEnter(wasTriggerFocused ? 'start' : 'end');
358
+ const wasFocusFromContent = content?.contains(prevFocusedElement);
359
+ if (wasTriggerFocused || !wasFocusFromContent) {
360
+ itemContext.onFocusProxyEnter(wasTriggerFocused ? "start" : "end");
361
+ }
362
+ }
298
363
  }
299
- }), context.viewport && /*#__PURE__*/ createElement("span", {
300
- "aria-owns": contentId
301
- })));
364
+ ),
365
+ context.viewport && /* @__PURE__ */ jsx("span", { "aria-owns": contentId })
366
+ ] })
367
+ ] });
302
368
  });
303
- const $322c88a641701f3b$var$LINK_SELECT = 'navigationMenu.linkSelect';
304
- const $322c88a641701f3b$export$6893bf21536567da = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
305
- const { __scopeNavigationMenu: __scopeNavigationMenu , active: active , onSelect: onSelect , ...linkProps } = props;
306
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroupItem, {
307
- asChild: true
308
- }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.a, _extends({
309
- "data-active": active ? '' : undefined,
310
- "aria-current": active ? 'page' : undefined
311
- }, linkProps, {
369
+ NavigationMenuTrigger.displayName = TRIGGER_NAME;
370
+ var LINK_NAME = "NavigationMenuLink";
371
+ var LINK_SELECT = "navigationMenu.linkSelect";
372
+ var NavigationMenuLink = React.forwardRef(
373
+ (props, forwardedRef) => {
374
+ const { __scopeNavigationMenu, active, onSelect, ...linkProps } = props;
375
+ return /* @__PURE__ */ jsx(FocusGroupItem, { asChild: true, children: /* @__PURE__ */ jsx(
376
+ Primitive.a,
377
+ {
378
+ "data-active": active ? "" : void 0,
379
+ "aria-current": active ? "page" : void 0,
380
+ ...linkProps,
312
381
  ref: forwardedRef,
313
- onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, (event1)=>{
314
- const target = event1.target;
315
- const linkSelectEvent = new CustomEvent($322c88a641701f3b$var$LINK_SELECT, {
382
+ onClick: composeEventHandlers(
383
+ props.onClick,
384
+ (event) => {
385
+ const target = event.target;
386
+ const linkSelectEvent = new CustomEvent(LINK_SELECT, {
387
+ bubbles: true,
388
+ cancelable: true
389
+ });
390
+ target.addEventListener(LINK_SELECT, (event2) => onSelect?.(event2), { once: true });
391
+ dispatchDiscreteCustomEvent(target, linkSelectEvent);
392
+ if (!linkSelectEvent.defaultPrevented && !event.metaKey) {
393
+ const rootContentDismissEvent = new CustomEvent(ROOT_CONTENT_DISMISS, {
316
394
  bubbles: true,
317
395
  cancelable: true
318
- });
319
- target.addEventListener($322c88a641701f3b$var$LINK_SELECT, (event)=>onSelect === null || onSelect === void 0 ? void 0 : onSelect(event)
320
- , {
321
- once: true
322
- });
323
- $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, linkSelectEvent);
324
- if (!linkSelectEvent.defaultPrevented && !event1.metaKey) {
325
- const rootContentDismissEvent = new CustomEvent($322c88a641701f3b$var$ROOT_CONTENT_DISMISS, {
326
- bubbles: true,
327
- cancelable: true
328
- });
329
- $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, rootContentDismissEvent);
396
+ });
397
+ dispatchDiscreteCustomEvent(target, rootContentDismissEvent);
330
398
  }
331
- }, {
332
- checkForDefaultPrevented: false
333
- })
334
- })));
399
+ },
400
+ { checkForDefaultPrevented: false }
401
+ )
402
+ }
403
+ ) });
404
+ }
405
+ );
406
+ NavigationMenuLink.displayName = LINK_NAME;
407
+ var INDICATOR_NAME = "NavigationMenuIndicator";
408
+ var NavigationMenuIndicator = React.forwardRef((props, forwardedRef) => {
409
+ const { forceMount, ...indicatorProps } = props;
410
+ const context = useNavigationMenuContext(INDICATOR_NAME, props.__scopeNavigationMenu);
411
+ const isVisible = Boolean(context.value);
412
+ return context.indicatorTrack ? ReactDOM__default.createPortal(
413
+ /* @__PURE__ */ jsx(Presence, { present: forceMount || isVisible, children: /* @__PURE__ */ jsx(NavigationMenuIndicatorImpl, { ...indicatorProps, ref: forwardedRef }) }),
414
+ context.indicatorTrack
415
+ ) : null;
335
416
  });
336
- /* -------------------------------------------------------------------------------------------------
337
- * NavigationMenuIndicator
338
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$INDICATOR_NAME = 'NavigationMenuIndicator';
339
- const $322c88a641701f3b$export$8ddb526647c0d8fb = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
340
- const { forceMount: forceMount , ...indicatorProps } = props;
341
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$INDICATOR_NAME, props.__scopeNavigationMenu);
342
- const isVisible = Boolean(context.value);
343
- return context.indicatorTrack ? /*#__PURE__*/ ReactDOM__default.createPortal(/*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
344
- present: forceMount || isVisible
345
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuIndicatorImpl, _extends({}, indicatorProps, {
346
- ref: forwardedRef
347
- }))), context.indicatorTrack) : null;
417
+ NavigationMenuIndicator.displayName = INDICATOR_NAME;
418
+ var NavigationMenuIndicatorImpl = React.forwardRef((props, forwardedRef) => {
419
+ const { __scopeNavigationMenu, ...indicatorProps } = props;
420
+ const context = useNavigationMenuContext(INDICATOR_NAME, __scopeNavigationMenu);
421
+ const getItems = useCollection(__scopeNavigationMenu);
422
+ const [activeTrigger, setActiveTrigger] = React.useState(
423
+ null
424
+ );
425
+ const [position, setPosition] = React.useState(null);
426
+ const isHorizontal = context.orientation === "horizontal";
427
+ const isVisible = Boolean(context.value);
428
+ React.useEffect(() => {
429
+ const items = getItems();
430
+ const triggerNode = items.find((item) => item.value === context.value)?.ref.current;
431
+ if (triggerNode) setActiveTrigger(triggerNode);
432
+ }, [getItems, context.value]);
433
+ const handlePositionChange = () => {
434
+ if (activeTrigger) {
435
+ setPosition({
436
+ size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,
437
+ offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop
438
+ });
439
+ }
440
+ };
441
+ useResizeObserver(activeTrigger, handlePositionChange);
442
+ useResizeObserver(context.indicatorTrack, handlePositionChange);
443
+ return position ? /* @__PURE__ */ jsx(
444
+ Primitive.div,
445
+ {
446
+ "aria-hidden": true,
447
+ "data-state": isVisible ? "visible" : "hidden",
448
+ "data-orientation": context.orientation,
449
+ ...indicatorProps,
450
+ ref: forwardedRef,
451
+ style: {
452
+ position: "absolute",
453
+ ...isHorizontal ? {
454
+ left: 0,
455
+ width: position.size + "px",
456
+ transform: `translateX(${position.offset}px)`
457
+ } : {
458
+ top: 0,
459
+ height: position.size + "px",
460
+ transform: `translateY(${position.offset}px)`
461
+ },
462
+ ...indicatorProps.style
463
+ }
464
+ }
465
+ ) : null;
348
466
  });
349
- const $322c88a641701f3b$var$NavigationMenuIndicatorImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
350
- const { __scopeNavigationMenu: __scopeNavigationMenu , ...indicatorProps } = props;
351
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$INDICATOR_NAME, __scopeNavigationMenu);
352
- const getItems = $322c88a641701f3b$var$useCollection(__scopeNavigationMenu);
353
- const [activeTrigger, setActiveTrigger] = useState(null);
354
- const [position, setPosition] = useState(null);
355
- const isHorizontal = context.orientation === 'horizontal';
356
- const isVisible = Boolean(context.value);
357
- useEffect(()=>{
358
- var _items$find;
359
- const items = getItems();
360
- const triggerNode = (_items$find = items.find((item)=>item.value === context.value
361
- )) === null || _items$find === void 0 ? void 0 : _items$find.ref.current;
362
- if (triggerNode) setActiveTrigger(triggerNode);
363
- }, [
364
- getItems,
365
- context.value
366
- ]);
367
- /**
368
- * Update position when the indicator or parent track size changes
369
- */ const handlePositionChange = ()=>{
370
- if (activeTrigger) setPosition({
371
- size: isHorizontal ? activeTrigger.offsetWidth : activeTrigger.offsetHeight,
372
- offset: isHorizontal ? activeTrigger.offsetLeft : activeTrigger.offsetTop
373
- });
374
- };
375
- $322c88a641701f3b$var$useResizeObserver(activeTrigger, handlePositionChange);
376
- $322c88a641701f3b$var$useResizeObserver(context.indicatorTrack, handlePositionChange); // We need to wait for the indicator position to be available before rendering to
377
- // snap immediately into position rather than transitioning from initial
378
- return position ? /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
379
- "aria-hidden": true,
380
- "data-state": isVisible ? 'visible' : 'hidden',
381
- "data-orientation": context.orientation
382
- }, indicatorProps, {
383
- ref: forwardedRef,
384
- style: {
385
- position: 'absolute',
386
- ...isHorizontal ? {
387
- left: 0,
388
- width: position.size + 'px',
389
- transform: `translateX(${position.offset}px)`
390
- } : {
391
- top: 0,
392
- height: position.size + 'px',
393
- transform: `translateY(${position.offset}px)`
394
- },
395
- ...indicatorProps.style
396
- }
397
- })) : null;
467
+ var CONTENT_NAME = "NavigationMenuContent";
468
+ var NavigationMenuContent = React.forwardRef((props, forwardedRef) => {
469
+ const { forceMount, ...contentProps } = props;
470
+ const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);
471
+ const itemContext = useNavigationMenuItemContext(CONTENT_NAME, props.__scopeNavigationMenu);
472
+ const composedRefs = useComposedRefs(itemContext.contentRef, forwardedRef);
473
+ const open = itemContext.value === context.value;
474
+ const commonProps = {
475
+ value: itemContext.value,
476
+ triggerRef: itemContext.triggerRef,
477
+ focusProxyRef: itemContext.focusProxyRef,
478
+ wasEscapeCloseRef: itemContext.wasEscapeCloseRef,
479
+ onContentFocusOutside: itemContext.onContentFocusOutside,
480
+ onRootContentClose: itemContext.onRootContentClose,
481
+ ...contentProps
482
+ };
483
+ return !context.viewport ? /* @__PURE__ */ jsx(Presence, { present: forceMount || open, children: /* @__PURE__ */ jsx(
484
+ NavigationMenuContentImpl,
485
+ {
486
+ "data-state": getOpenState(open),
487
+ ...commonProps,
488
+ ref: composedRefs,
489
+ onPointerEnter: composeEventHandlers(props.onPointerEnter, context.onContentEnter),
490
+ onPointerLeave: composeEventHandlers(
491
+ props.onPointerLeave,
492
+ whenMouse(context.onContentLeave)
493
+ ),
494
+ style: {
495
+ // Prevent interaction when animating out
496
+ pointerEvents: !open && context.isRootMenu ? "none" : void 0,
497
+ ...commonProps.style
498
+ }
499
+ }
500
+ ) }) : /* @__PURE__ */ jsx(ViewportContentMounter, { forceMount, ...commonProps, ref: composedRefs });
398
501
  });
399
- /* -------------------------------------------------------------------------------------------------
400
- * NavigationMenuContent
401
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$CONTENT_NAME = 'NavigationMenuContent';
402
- const $322c88a641701f3b$export$38e00e996c2f93f7 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
403
- const { forceMount: forceMount , ...contentProps } = props;
404
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$CONTENT_NAME, props.__scopeNavigationMenu);
405
- const itemContext = $322c88a641701f3b$var$useNavigationMenuItemContext($322c88a641701f3b$var$CONTENT_NAME, props.__scopeNavigationMenu);
406
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(itemContext.contentRef, forwardedRef);
407
- const open = itemContext.value === context.value;
408
- const commonProps = {
409
- value: itemContext.value,
410
- triggerRef: itemContext.triggerRef,
411
- focusProxyRef: itemContext.focusProxyRef,
412
- wasEscapeCloseRef: itemContext.wasEscapeCloseRef,
413
- onContentFocusOutside: itemContext.onContentFocusOutside,
414
- onRootContentClose: itemContext.onRootContentClose,
415
- ...contentProps
416
- };
417
- return !context.viewport ? /*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
418
- present: forceMount || open
419
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuContentImpl, _extends({
420
- "data-state": $322c88a641701f3b$var$getOpenState(open)
421
- }, commonProps, {
422
- ref: composedRefs,
423
- onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerEnter, context.onContentEnter),
424
- onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, $322c88a641701f3b$var$whenMouse(context.onContentLeave)),
425
- style: {
426
- // Prevent interaction when animating out
427
- pointerEvents: !open && context.isRootMenu ? 'none' : undefined,
428
- ...commonProps.style
429
- }
430
- }))) : /*#__PURE__*/ createElement($322c88a641701f3b$var$ViewportContentMounter, _extends({
431
- forceMount: forceMount
432
- }, commonProps, {
433
- ref: composedRefs
434
- }));
502
+ NavigationMenuContent.displayName = CONTENT_NAME;
503
+ var ViewportContentMounter = React.forwardRef((props, forwardedRef) => {
504
+ const context = useNavigationMenuContext(CONTENT_NAME, props.__scopeNavigationMenu);
505
+ const { onViewportContentChange, onViewportContentRemove } = context;
506
+ useLayoutEffect2(() => {
507
+ onViewportContentChange(props.value, {
508
+ ref: forwardedRef,
509
+ ...props
510
+ });
511
+ }, [props, forwardedRef, onViewportContentChange]);
512
+ useLayoutEffect2(() => {
513
+ return () => onViewportContentRemove(props.value);
514
+ }, [props.value, onViewportContentRemove]);
515
+ return null;
435
516
  });
436
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$ViewportContentMounter = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
437
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$CONTENT_NAME, props.__scopeNavigationMenu);
438
- const { onViewportContentChange: onViewportContentChange , onViewportContentRemove: onViewportContentRemove } = context;
439
- $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
440
- onViewportContentChange(props.value, {
441
- ref: forwardedRef,
442
- ...props
517
+ var ROOT_CONTENT_DISMISS = "navigationMenu.rootContentDismiss";
518
+ var NavigationMenuContentImpl = React.forwardRef((props, forwardedRef) => {
519
+ const {
520
+ __scopeNavigationMenu,
521
+ value,
522
+ triggerRef,
523
+ focusProxyRef,
524
+ wasEscapeCloseRef,
525
+ onRootContentClose,
526
+ onContentFocusOutside,
527
+ ...contentProps
528
+ } = props;
529
+ const context = useNavigationMenuContext(CONTENT_NAME, __scopeNavigationMenu);
530
+ const ref = React.useRef(null);
531
+ const composedRefs = useComposedRefs(ref, forwardedRef);
532
+ const triggerId = makeTriggerId(context.baseId, value);
533
+ const contentId = makeContentId(context.baseId, value);
534
+ const getItems = useCollection(__scopeNavigationMenu);
535
+ const prevMotionAttributeRef = React.useRef(null);
536
+ const { onItemDismiss } = context;
537
+ React.useEffect(() => {
538
+ const content = ref.current;
539
+ if (context.isRootMenu && content) {
540
+ const handleClose = () => {
541
+ onItemDismiss();
542
+ onRootContentClose();
543
+ if (content.contains(document.activeElement)) triggerRef.current?.focus();
544
+ };
545
+ content.addEventListener(ROOT_CONTENT_DISMISS, handleClose);
546
+ return () => content.removeEventListener(ROOT_CONTENT_DISMISS, handleClose);
547
+ }
548
+ }, [context.isRootMenu, props.value, triggerRef, onItemDismiss, onRootContentClose]);
549
+ const motionAttribute = React.useMemo(() => {
550
+ const items = getItems();
551
+ const values = items.map((item) => item.value);
552
+ if (context.dir === "rtl") values.reverse();
553
+ const index = values.indexOf(context.value);
554
+ const prevIndex = values.indexOf(context.previousValue);
555
+ const isSelected = value === context.value;
556
+ const wasSelected = prevIndex === values.indexOf(value);
557
+ if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;
558
+ const attribute = (() => {
559
+ if (index !== prevIndex) {
560
+ if (isSelected && prevIndex !== -1) return index > prevIndex ? "from-end" : "from-start";
561
+ if (wasSelected && index !== -1) return index > prevIndex ? "to-start" : "to-end";
562
+ }
563
+ return null;
564
+ })();
565
+ prevMotionAttributeRef.current = attribute;
566
+ return attribute;
567
+ }, [context.previousValue, context.value, context.dir, getItems, value]);
568
+ return /* @__PURE__ */ jsx(FocusGroup, { asChild: true, children: /* @__PURE__ */ jsx(
569
+ DismissableLayer,
570
+ {
571
+ id: contentId,
572
+ "aria-labelledby": triggerId,
573
+ "data-motion": motionAttribute,
574
+ "data-orientation": context.orientation,
575
+ ...contentProps,
576
+ ref: composedRefs,
577
+ disableOutsidePointerEvents: false,
578
+ onDismiss: () => {
579
+ const rootContentDismissEvent = new Event(ROOT_CONTENT_DISMISS, {
580
+ bubbles: true,
581
+ cancelable: true
443
582
  });
444
- }, [
445
- props,
446
- forwardedRef,
447
- onViewportContentChange
448
- ]);
449
- $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
450
- return ()=>onViewportContentRemove(props.value)
451
- ;
452
- }, [
453
- props.value,
454
- onViewportContentRemove
455
- ]); // Content is proxied into the viewport
456
- return null;
457
- });
458
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$ROOT_CONTENT_DISMISS = 'navigationMenu.rootContentDismiss';
459
- const $322c88a641701f3b$var$NavigationMenuContentImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
460
- const { __scopeNavigationMenu: __scopeNavigationMenu , value: value , triggerRef: triggerRef , focusProxyRef: focusProxyRef , wasEscapeCloseRef: wasEscapeCloseRef , onRootContentClose: onRootContentClose , onContentFocusOutside: onContentFocusOutside , ...contentProps } = props;
461
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$CONTENT_NAME, __scopeNavigationMenu);
462
- const ref = useRef(null);
463
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(ref, forwardedRef);
464
- const triggerId = $322c88a641701f3b$var$makeTriggerId(context.baseId, value);
465
- const contentId = $322c88a641701f3b$var$makeContentId(context.baseId, value);
466
- const getItems = $322c88a641701f3b$var$useCollection(__scopeNavigationMenu);
467
- const prevMotionAttributeRef = useRef(null);
468
- const { onItemDismiss: onItemDismiss } = context;
469
- useEffect(()=>{
470
- const content = ref.current; // Bubble dismiss to the root content node and focus its trigger
471
- if (context.isRootMenu && content) {
472
- const handleClose = ()=>{
473
- var _triggerRef$current;
474
- onItemDismiss();
475
- onRootContentClose();
476
- if (content.contains(document.activeElement)) (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 || _triggerRef$current.focus();
477
- };
478
- content.addEventListener($322c88a641701f3b$var$ROOT_CONTENT_DISMISS, handleClose);
479
- return ()=>content.removeEventListener($322c88a641701f3b$var$ROOT_CONTENT_DISMISS, handleClose)
480
- ;
583
+ ref.current?.dispatchEvent(rootContentDismissEvent);
584
+ },
585
+ onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {
586
+ onContentFocusOutside();
587
+ const target = event.target;
588
+ if (context.rootNavigationMenu?.contains(target)) event.preventDefault();
589
+ }),
590
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
591
+ const target = event.target;
592
+ const isTrigger = getItems().some((item) => item.ref.current?.contains(target));
593
+ const isRootViewport = context.isRootMenu && context.viewport?.contains(target);
594
+ if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();
595
+ }),
596
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
597
+ const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
598
+ const isTabKey = event.key === "Tab" && !isMetaKey;
599
+ if (isTabKey) {
600
+ const candidates = getTabbableCandidates(event.currentTarget);
601
+ const focusedElement = document.activeElement;
602
+ const index = candidates.findIndex((candidate) => candidate === focusedElement);
603
+ const isMovingBackwards = event.shiftKey;
604
+ const nextCandidates = isMovingBackwards ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
605
+ if (focusFirst(nextCandidates)) {
606
+ event.preventDefault();
607
+ } else {
608
+ focusProxyRef.current?.focus();
609
+ }
481
610
  }
482
- }, [
483
- context.isRootMenu,
484
- props.value,
485
- triggerRef,
486
- onItemDismiss,
487
- onRootContentClose
488
- ]);
489
- const motionAttribute = useMemo(()=>{
490
- const items = getItems();
491
- const values = items.map((item)=>item.value
492
- );
493
- if (context.dir === 'rtl') values.reverse();
494
- const index = values.indexOf(context.value);
495
- const prevIndex = values.indexOf(context.previousValue);
496
- const isSelected = value === context.value;
497
- const wasSelected = prevIndex === values.indexOf(value); // We only want to update selected and the last selected content
498
- // this avoids animations being interrupted outside of that range
499
- if (!isSelected && !wasSelected) return prevMotionAttributeRef.current;
500
- const attribute = (()=>{
501
- // Don't provide a direction on the initial open
502
- if (index !== prevIndex) {
503
- // If we're moving to this item from another
504
- if (isSelected && prevIndex !== -1) return index > prevIndex ? 'from-end' : 'from-start'; // If we're leaving this item for another
505
- if (wasSelected && index !== -1) return index > prevIndex ? 'to-start' : 'to-end';
506
- } // Otherwise we're entering from closed or leaving the list
507
- // entirely and should not animate in any direction
508
- return null;
509
- })();
510
- prevMotionAttributeRef.current = attribute;
511
- return attribute;
512
- }, [
513
- context.previousValue,
514
- context.value,
515
- context.dir,
516
- getItems,
517
- value
518
- ]);
519
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroup, {
520
- asChild: true
521
- }, /*#__PURE__*/ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, _extends({
522
- id: contentId,
523
- "aria-labelledby": triggerId,
524
- "data-motion": motionAttribute,
525
- "data-orientation": context.orientation
526
- }, contentProps, {
527
- ref: composedRefs,
528
- onDismiss: ()=>{
529
- var _ref$current;
530
- const rootContentDismissEvent = new Event($322c88a641701f3b$var$ROOT_CONTENT_DISMISS, {
531
- bubbles: true,
532
- cancelable: true
533
- });
534
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.dispatchEvent(rootContentDismissEvent);
535
- },
536
- onFocusOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusOutside, (event)=>{
537
- var _context$rootNavigati;
538
- onContentFocusOutside();
539
- const target = event.target; // Only dismiss content when focus moves outside of the menu
540
- if ((_context$rootNavigati = context.rootNavigationMenu) !== null && _context$rootNavigati !== void 0 && _context$rootNavigati.contains(target)) event.preventDefault();
541
- }),
542
- onPointerDownOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownOutside, (event)=>{
543
- var _context$viewport;
544
- const target = event.target;
545
- const isTrigger = getItems().some((item)=>{
546
- var _item$ref$current;
547
- return (_item$ref$current = item.ref.current) === null || _item$ref$current === void 0 ? void 0 : _item$ref$current.contains(target);
548
- });
549
- const isRootViewport = context.isRootMenu && ((_context$viewport = context.viewport) === null || _context$viewport === void 0 ? void 0 : _context$viewport.contains(target));
550
- if (isTrigger || isRootViewport || !context.isRootMenu) event.preventDefault();
551
- }),
552
- onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
553
- const isMetaKey = event.altKey || event.ctrlKey || event.metaKey;
554
- const isTabKey = event.key === 'Tab' && !isMetaKey;
555
- if (isTabKey) {
556
- const candidates = $322c88a641701f3b$var$getTabbableCandidates(event.currentTarget);
557
- const focusedElement = document.activeElement;
558
- const index = candidates.findIndex((candidate)=>candidate === focusedElement
559
- );
560
- const isMovingBackwards = event.shiftKey;
561
- const nextCandidates = isMovingBackwards ? candidates.slice(0, index).reverse() : candidates.slice(index + 1, candidates.length);
562
- if ($322c88a641701f3b$var$focusFirst(nextCandidates)) // prevent browser tab keydown because we've handled focus
563
- event.preventDefault();
564
- else {
565
- var _focusProxyRef$curren;
566
- // If we can't focus that means we're at the edges
567
- // so focus the proxy and let browser handle
568
- // tab/shift+tab keypress on the proxy instead
569
- (_focusProxyRef$curren = focusProxyRef.current) === null || _focusProxyRef$curren === void 0 || _focusProxyRef$curren.focus();
570
- }
571
- }
572
- }),
573
- onEscapeKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onEscapeKeyDown, (event)=>{
574
- // prevent the dropdown from reopening
575
- // after the escape key has been pressed
576
- wasEscapeCloseRef.current = true;
577
- })
578
- })));
611
+ }),
612
+ onEscapeKeyDown: composeEventHandlers(props.onEscapeKeyDown, (_event) => {
613
+ wasEscapeCloseRef.current = true;
614
+ })
615
+ }
616
+ ) });
579
617
  });
580
- /* -------------------------------------------------------------------------------------------------
581
- * NavigationMenuViewport
582
- * -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$VIEWPORT_NAME = 'NavigationMenuViewport';
583
- const $322c88a641701f3b$export$ee880b97cc6d44a5 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
584
- const { forceMount: forceMount , ...viewportProps } = props;
585
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$VIEWPORT_NAME, props.__scopeNavigationMenu);
586
- const open = Boolean(context.value);
587
- return /*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
588
- present: forceMount || open
589
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuViewportImpl, _extends({}, viewportProps, {
590
- ref: forwardedRef
591
- })));
618
+ var VIEWPORT_NAME = "NavigationMenuViewport";
619
+ var NavigationMenuViewport = React.forwardRef((props, forwardedRef) => {
620
+ const { forceMount, ...viewportProps } = props;
621
+ const context = useNavigationMenuContext(VIEWPORT_NAME, props.__scopeNavigationMenu);
622
+ const open = Boolean(context.value);
623
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || open, children: /* @__PURE__ */ jsx(NavigationMenuViewportImpl, { ...viewportProps, ref: forwardedRef }) });
592
624
  });
593
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$NavigationMenuViewportImpl = /*#__PURE__*/ forwardRef((props1, forwardedRef)=>{
594
- const { __scopeNavigationMenu: __scopeNavigationMenu , children: children , ...viewportImplProps } = props1;
595
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$VIEWPORT_NAME, __scopeNavigationMenu);
596
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onViewportChange);
597
- const viewportContentContext = $322c88a641701f3b$var$useViewportContentContext($322c88a641701f3b$var$CONTENT_NAME, props1.__scopeNavigationMenu);
598
- const [size, setSize] = useState(null);
599
- const [content, setContent] = useState(null);
600
- const viewportWidth = size ? (size === null || size === void 0 ? void 0 : size.width) + 'px' : undefined;
601
- const viewportHeight = size ? (size === null || size === void 0 ? void 0 : size.height) + 'px' : undefined;
602
- const open = Boolean(context.value); // We persist the last active content value as the viewport may be animating out
603
- // and we want the content to remain mounted for the lifecycle of the viewport.
604
- const activeContentValue = open ? context.value : context.previousValue;
605
- /**
606
- * Update viewport size to match the active content node.
607
- * We prefer offset dimensions over `getBoundingClientRect` as the latter respects CSS transform.
608
- * For example, if content animates in from `scale(0.5)` the dimensions would be anything
609
- * from `0.5` to `1` of the intended size.
610
- */ const handleSizeChange = ()=>{
611
- if (content) setSize({
612
- width: content.offsetWidth,
613
- height: content.offsetHeight
614
- });
615
- };
616
- $322c88a641701f3b$var$useResizeObserver(content, handleSizeChange);
617
- return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
618
- "data-state": $322c88a641701f3b$var$getOpenState(open),
619
- "data-orientation": context.orientation
620
- }, viewportImplProps, {
621
- ref: composedRefs,
622
- style: {
623
- // Prevent interaction when animating out
624
- pointerEvents: !open && context.isRootMenu ? 'none' : undefined,
625
- ['--radix-navigation-menu-viewport-width']: viewportWidth,
626
- ['--radix-navigation-menu-viewport-height']: viewportHeight,
627
- ...viewportImplProps.style
628
- },
629
- onPointerEnter: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props1.onPointerEnter, context.onContentEnter),
630
- onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props1.onPointerLeave, $322c88a641701f3b$var$whenMouse(context.onContentLeave))
631
- }), Array.from(viewportContentContext.items).map(([value, { ref: ref , forceMount: forceMount , ...props }])=>{
625
+ NavigationMenuViewport.displayName = VIEWPORT_NAME;
626
+ var NavigationMenuViewportImpl = React.forwardRef((props, forwardedRef) => {
627
+ const { __scopeNavigationMenu, children, ...viewportImplProps } = props;
628
+ const context = useNavigationMenuContext(VIEWPORT_NAME, __scopeNavigationMenu);
629
+ const composedRefs = useComposedRefs(forwardedRef, context.onViewportChange);
630
+ const viewportContentContext = useViewportContentContext(
631
+ CONTENT_NAME,
632
+ props.__scopeNavigationMenu
633
+ );
634
+ const [size, setSize] = React.useState(null);
635
+ const [content, setContent] = React.useState(null);
636
+ const viewportWidth = size ? size?.width + "px" : void 0;
637
+ const viewportHeight = size ? size?.height + "px" : void 0;
638
+ const open = Boolean(context.value);
639
+ const activeContentValue = open ? context.value : context.previousValue;
640
+ const handleSizeChange = () => {
641
+ if (content) setSize({ width: content.offsetWidth, height: content.offsetHeight });
642
+ };
643
+ useResizeObserver(content, handleSizeChange);
644
+ return /* @__PURE__ */ jsx(
645
+ Primitive.div,
646
+ {
647
+ "data-state": getOpenState(open),
648
+ "data-orientation": context.orientation,
649
+ ...viewportImplProps,
650
+ ref: composedRefs,
651
+ style: {
652
+ // Prevent interaction when animating out
653
+ pointerEvents: !open && context.isRootMenu ? "none" : void 0,
654
+ ["--radix-navigation-menu-viewport-width"]: viewportWidth,
655
+ ["--radix-navigation-menu-viewport-height"]: viewportHeight,
656
+ ...viewportImplProps.style
657
+ },
658
+ onPointerEnter: composeEventHandlers(props.onPointerEnter, context.onContentEnter),
659
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, whenMouse(context.onContentLeave)),
660
+ children: Array.from(viewportContentContext.items).map(([value, { ref, forceMount, ...props2 }]) => {
632
661
  const isActive = activeContentValue === value;
633
- return /*#__PURE__*/ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
634
- key: value,
635
- present: forceMount || isActive
636
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$NavigationMenuContentImpl, _extends({}, props, {
637
- ref: $6ed0406888f73fc4$export$43e446d32b3d21af(ref, (node)=>{
638
- // We only want to update the stored node when another is available
639
- // as we need to smoothly transition between them.
640
- if (isActive && node) setContent(node);
662
+ return /* @__PURE__ */ jsx(Presence, { present: forceMount || isActive, children: /* @__PURE__ */ jsx(
663
+ NavigationMenuContentImpl,
664
+ {
665
+ ...props2,
666
+ ref: composeRefs(ref, (node) => {
667
+ if (isActive && node) setContent(node);
641
668
  })
642
- })));
643
- }));
669
+ }
670
+ ) }, value);
671
+ })
672
+ }
673
+ );
644
674
  });
645
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$FOCUS_GROUP_NAME = 'FocusGroup';
646
- const $322c88a641701f3b$var$FocusGroup = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
647
- const { __scopeNavigationMenu: __scopeNavigationMenu , ...groupProps } = props;
648
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$FOCUS_GROUP_NAME, __scopeNavigationMenu);
649
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroupCollection.Provider, {
650
- scope: __scopeNavigationMenu
651
- }, /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroupCollection.Slot, {
652
- scope: __scopeNavigationMenu
653
- }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
654
- dir: context.dir
655
- }, groupProps, {
656
- ref: forwardedRef
657
- }))));
658
- });
659
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$var$ARROW_KEYS = [
660
- 'ArrowRight',
661
- 'ArrowLeft',
662
- 'ArrowUp',
663
- 'ArrowDown'
664
- ];
665
- const $322c88a641701f3b$var$FOCUS_GROUP_ITEM_NAME = 'FocusGroupItem';
666
- const $322c88a641701f3b$var$FocusGroupItem = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
667
- const { __scopeNavigationMenu: __scopeNavigationMenu , ...groupProps } = props;
668
- const getItems = $322c88a641701f3b$var$useFocusGroupCollection(__scopeNavigationMenu);
669
- const context = $322c88a641701f3b$var$useNavigationMenuContext($322c88a641701f3b$var$FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);
670
- return /*#__PURE__*/ createElement($322c88a641701f3b$var$FocusGroupCollection.ItemSlot, {
671
- scope: __scopeNavigationMenu
672
- }, /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({}, groupProps, {
675
+ var FOCUS_GROUP_NAME = "FocusGroup";
676
+ var FocusGroup = React.forwardRef(
677
+ (props, forwardedRef) => {
678
+ const { __scopeNavigationMenu, ...groupProps } = props;
679
+ const context = useNavigationMenuContext(FOCUS_GROUP_NAME, __scopeNavigationMenu);
680
+ return /* @__PURE__ */ jsx(FocusGroupCollection.Provider, { scope: __scopeNavigationMenu, children: /* @__PURE__ */ jsx(FocusGroupCollection.Slot, { scope: __scopeNavigationMenu, children: /* @__PURE__ */ jsx(Primitive.div, { dir: context.dir, ...groupProps, ref: forwardedRef }) }) });
681
+ }
682
+ );
683
+ var ARROW_KEYS = ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"];
684
+ var FOCUS_GROUP_ITEM_NAME = "FocusGroupItem";
685
+ var FocusGroupItem = React.forwardRef(
686
+ (props, forwardedRef) => {
687
+ const { __scopeNavigationMenu, ...groupProps } = props;
688
+ const getItems = useFocusGroupCollection(__scopeNavigationMenu);
689
+ const context = useNavigationMenuContext(FOCUS_GROUP_ITEM_NAME, __scopeNavigationMenu);
690
+ return /* @__PURE__ */ jsx(FocusGroupCollection.ItemSlot, { scope: __scopeNavigationMenu, children: /* @__PURE__ */ jsx(
691
+ Primitive.button,
692
+ {
693
+ ...groupProps,
673
694
  ref: forwardedRef,
674
- onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
675
- const isFocusNavigationKey = [
676
- 'Home',
677
- 'End',
678
- ...$322c88a641701f3b$var$ARROW_KEYS
679
- ].includes(event.key);
680
- if (isFocusNavigationKey) {
681
- let candidateNodes = getItems().map((item)=>item.ref.current
682
- );
683
- const prevItemKey = context.dir === 'rtl' ? 'ArrowRight' : 'ArrowLeft';
684
- const prevKeys = [
685
- prevItemKey,
686
- 'ArrowUp',
687
- 'End'
688
- ];
689
- if (prevKeys.includes(event.key)) candidateNodes.reverse();
690
- if ($322c88a641701f3b$var$ARROW_KEYS.includes(event.key)) {
691
- const currentIndex = candidateNodes.indexOf(event.currentTarget);
692
- candidateNodes = candidateNodes.slice(currentIndex + 1);
693
- }
694
- /**
695
- * Imperative focus during keydown is risky so we prevent React's batching updates
696
- * to avoid potential bugs. See: https://github.com/facebook/react/issues/20332
697
- */ setTimeout(()=>$322c88a641701f3b$var$focusFirst(candidateNodes)
698
- ); // Prevent page scroll while navigating
699
- event.preventDefault();
695
+ onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
696
+ const isFocusNavigationKey = ["Home", "End", ...ARROW_KEYS].includes(event.key);
697
+ if (isFocusNavigationKey) {
698
+ let candidateNodes = getItems().map((item) => item.ref.current);
699
+ const prevItemKey = context.dir === "rtl" ? "ArrowRight" : "ArrowLeft";
700
+ const prevKeys = [prevItemKey, "ArrowUp", "End"];
701
+ if (prevKeys.includes(event.key)) candidateNodes.reverse();
702
+ if (ARROW_KEYS.includes(event.key)) {
703
+ const currentIndex = candidateNodes.indexOf(event.currentTarget);
704
+ candidateNodes = candidateNodes.slice(currentIndex + 1);
700
705
  }
706
+ setTimeout(() => focusFirst(candidateNodes));
707
+ event.preventDefault();
708
+ }
701
709
  })
702
- })));
703
- });
704
- /**
705
- * Returns a list of potential tabbable candidates.
706
- *
707
- * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
708
- * elements are not visible. This cannot be worked out easily by just reading a property, but rather
709
- * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
710
- *
711
- * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
712
- * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
713
- */ function $322c88a641701f3b$var$getTabbableCandidates(container) {
714
- const nodes = [];
715
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
716
- acceptNode: (node)=>{
717
- const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
718
- if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
719
- // runtime's understanding of tabbability, so this automatically accounts
720
- // for any kind of element that could be tabbed to.
721
- return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
722
- }
723
- });
724
- while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
725
- // hinders accessibility to have tab order different from visual order.
726
- return nodes;
710
+ }
711
+ ) });
712
+ }
713
+ );
714
+ function getTabbableCandidates(container) {
715
+ const nodes = [];
716
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
717
+ acceptNode: (node) => {
718
+ const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
719
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
720
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
721
+ }
722
+ });
723
+ while (walker.nextNode()) nodes.push(walker.currentNode);
724
+ return nodes;
727
725
  }
728
- function $322c88a641701f3b$var$focusFirst(candidates) {
729
- const previouslyFocusedElement = document.activeElement;
730
- return candidates.some((candidate)=>{
731
- // if focus is already where we want to go, we don't want to keep going through the candidates
732
- if (candidate === previouslyFocusedElement) return true;
733
- candidate.focus();
734
- return document.activeElement !== previouslyFocusedElement;
735
- });
726
+ function focusFirst(candidates) {
727
+ const previouslyFocusedElement = document.activeElement;
728
+ return candidates.some((candidate) => {
729
+ if (candidate === previouslyFocusedElement) return true;
730
+ candidate.focus();
731
+ return document.activeElement !== previouslyFocusedElement;
732
+ });
736
733
  }
737
- function $322c88a641701f3b$var$removeFromTabOrder(candidates) {
738
- candidates.forEach((candidate)=>{
739
- candidate.dataset.tabindex = candidate.getAttribute('tabindex') || '';
740
- candidate.setAttribute('tabindex', '-1');
734
+ function removeFromTabOrder(candidates) {
735
+ candidates.forEach((candidate) => {
736
+ candidate.dataset.tabindex = candidate.getAttribute("tabindex") || "";
737
+ candidate.setAttribute("tabindex", "-1");
738
+ });
739
+ return () => {
740
+ candidates.forEach((candidate) => {
741
+ const prevTabIndex = candidate.dataset.tabindex;
742
+ candidate.setAttribute("tabindex", prevTabIndex);
741
743
  });
742
- return ()=>{
743
- candidates.forEach((candidate)=>{
744
- const prevTabIndex = candidate.dataset.tabindex;
745
- candidate.setAttribute('tabindex', prevTabIndex);
746
- });
747
- };
744
+ };
748
745
  }
749
- function $322c88a641701f3b$var$useResizeObserver(element, onResize) {
750
- const handleResize = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onResize);
751
- $9f79659886946c16$export$e5c5a5f917a5871c(()=>{
752
- let rAF = 0;
753
- if (element) {
754
- /**
755
- * Resize Observer will throw an often benign error that says `ResizeObserver loop
756
- * completed with undelivered notifications`. This means that ResizeObserver was not
757
- * able to deliver all observations within a single animation frame, so we use
758
- * `requestAnimationFrame` to ensure we don't deliver unnecessary observations.
759
- * Further reading: https://github.com/WICG/resize-observer/issues/38
760
- */ const resizeObserver = new ResizeObserver(()=>{
761
- cancelAnimationFrame(rAF);
762
- rAF = window.requestAnimationFrame(handleResize);
763
- });
764
- resizeObserver.observe(element);
765
- return ()=>{
766
- window.cancelAnimationFrame(rAF);
767
- resizeObserver.unobserve(element);
768
- };
769
- }
770
- }, [
771
- element,
772
- handleResize
773
- ]);
746
+ function useResizeObserver(element, onResize) {
747
+ const handleResize = useCallbackRef(onResize);
748
+ useLayoutEffect2(() => {
749
+ let rAF = 0;
750
+ if (element) {
751
+ const resizeObserver = new ResizeObserver(() => {
752
+ cancelAnimationFrame(rAF);
753
+ rAF = window.requestAnimationFrame(handleResize);
754
+ });
755
+ resizeObserver.observe(element);
756
+ return () => {
757
+ window.cancelAnimationFrame(rAF);
758
+ resizeObserver.unobserve(element);
759
+ };
760
+ }
761
+ }, [element, handleResize]);
774
762
  }
775
- function $322c88a641701f3b$var$getOpenState(open) {
776
- return open ? 'open' : 'closed';
763
+ function getOpenState(open) {
764
+ return open ? "open" : "closed";
777
765
  }
778
- function $322c88a641701f3b$var$makeTriggerId(baseId, value) {
779
- return `${baseId}-trigger-${value}`;
766
+ function makeTriggerId(baseId, value) {
767
+ return `${baseId}-trigger-${value}`;
780
768
  }
781
- function $322c88a641701f3b$var$makeContentId(baseId, value) {
782
- return `${baseId}-content-${value}`;
769
+ function makeContentId(baseId, value) {
770
+ return `${baseId}-content-${value}`;
783
771
  }
784
- function $322c88a641701f3b$var$whenMouse(handler) {
785
- return (event)=>event.pointerType === 'mouse' ? handler(event) : undefined
786
- ;
772
+ function whenMouse(handler) {
773
+ return (event) => event.pointerType === "mouse" ? handler(event) : void 0;
787
774
  }
788
- /* -----------------------------------------------------------------------------------------------*/ const $322c88a641701f3b$export$be92b6f5f03c0fe9 = $322c88a641701f3b$export$5b2278cf1e8bcae2;
789
- const $322c88a641701f3b$export$54c2e3dc7acea9f5 = $322c88a641701f3b$export$c361068a95fd2286;
790
- const $322c88a641701f3b$export$6d08773d2e66f8f2 = $322c88a641701f3b$export$ffdbb83a2de845c2;
791
- const $322c88a641701f3b$export$41fb9f06171c75f4 = $322c88a641701f3b$export$37fe8002734d8f2;
792
- const $322c88a641701f3b$export$a6c7ac8248d6e38a = $322c88a641701f3b$export$6893bf21536567da;
793
- const $322c88a641701f3b$export$adb584737d712b70 = $322c88a641701f3b$export$8ddb526647c0d8fb;
794
- const $322c88a641701f3b$export$7c6e2c02157bb7d2 = $322c88a641701f3b$export$38e00e996c2f93f7;
795
- const $322c88a641701f3b$export$d5c6c08dc2d3ca7 = $322c88a641701f3b$export$ee880b97cc6d44a5;
775
+ var Root2 = NavigationMenu;
776
+ var List = NavigationMenuList;
777
+ var Item = NavigationMenuItem;
778
+ var Trigger = NavigationMenuTrigger;
779
+ var Link = NavigationMenuLink;
780
+ var Indicator = NavigationMenuIndicator;
781
+ var Content = NavigationMenuContent;
782
+ var Viewport = NavigationMenuViewport;
796
783
 
797
- export { $322c88a641701f3b$export$7c6e2c02157bb7d2 as Content, $322c88a641701f3b$export$adb584737d712b70 as Indicator, $322c88a641701f3b$export$6d08773d2e66f8f2 as Item, $322c88a641701f3b$export$a6c7ac8248d6e38a as Link, $322c88a641701f3b$export$54c2e3dc7acea9f5 as List, $322c88a641701f3b$export$5b2278cf1e8bcae2 as NavigationMenu, $322c88a641701f3b$export$38e00e996c2f93f7 as NavigationMenuContent, $322c88a641701f3b$export$8ddb526647c0d8fb as NavigationMenuIndicator, $322c88a641701f3b$export$ffdbb83a2de845c2 as NavigationMenuItem, $322c88a641701f3b$export$6893bf21536567da as NavigationMenuLink, $322c88a641701f3b$export$c361068a95fd2286 as NavigationMenuList, $322c88a641701f3b$export$37fe8002734d8f2 as NavigationMenuTrigger, $322c88a641701f3b$export$ee880b97cc6d44a5 as NavigationMenuViewport, $322c88a641701f3b$export$be92b6f5f03c0fe9 as Root, $322c88a641701f3b$export$41fb9f06171c75f4 as Trigger, $322c88a641701f3b$export$d5c6c08dc2d3ca7 as Viewport, $322c88a641701f3b$export$fb8ea5af8c9fcdf0 as createNavigationMenuScope };
784
+ export { Content, Indicator, Item, Link, List, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuSub, NavigationMenuTrigger, NavigationMenuViewport, Root2 as Root, Trigger, Viewport, createNavigationMenuScope };
798
785
  //# sourceMappingURL=index.mjs.js.map