@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,277 +1,209 @@
1
- import _extends from '../../../@babel/runtime/helpers/esm/extends.js';
2
- import { forwardRef, useState, useRef, useEffect, useCallback, createElement } from 'react';
3
- import { useComposedRefs as $6ed0406888f73fc4$export$c7b2cbe3552a0d05 } from '../../react-compose-refs/dist/index.mjs.js';
4
- import { Primitive as $8927f6f2acc4f386$export$250ffa63cdc0d034 } from '../../react-primitive/dist/index.mjs.js';
5
- import { useCallbackRef as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a } from '../../react-use-callback-ref/dist/index.mjs.js';
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import { useComposedRefs } from '../../react-compose-refs/dist/index.mjs.js';
4
+ import { Primitive } from '../../react-primitive/dist/index.mjs.js';
5
+ import { useCallbackRef } from '../../react-use-callback-ref/dist/index.mjs.js';
6
+ import { jsx } from 'react/jsx-runtime';
6
7
 
7
- const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';
8
- const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';
9
- const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
10
- bubbles: false,
11
- cancelable: true
12
- };
13
- const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
14
- const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
15
- const [container1, setContainer] = useState(null);
16
- const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
17
- const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
18
- const lastFocusedElementRef = useRef(null);
19
- const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
20
- );
21
- const focusScope = useRef({
22
- paused: false,
23
- pause () {
24
- this.paused = true;
25
- },
26
- resume () {
27
- this.paused = false;
28
- }
29
- }).current; // Takes care of trapping focus if focus is moved outside programmatically for example
30
- useEffect(()=>{
31
- if (trapped) {
32
- function handleFocusIn(event) {
33
- if (focusScope.paused || !container1) return;
34
- const target = event.target;
35
- if (container1.contains(target)) lastFocusedElementRef.current = target;
36
- else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
37
- select: true
38
- });
39
- }
40
- function handleFocusOut(event) {
41
- if (focusScope.paused || !container1) return;
42
- const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:
43
- //
44
- // 1. When the user switches app/tabs/windows/the browser itself loses focus.
45
- // 2. In Google Chrome, when the focused element is removed from the DOM.
46
- //
47
- // We let the browser do its thing here because:
48
- //
49
- // 1. The browser already keeps a memory of what's focused for when the page gets refocused.
50
- // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it
51
- // throws the CPU to 100%, so we avoid doing anything for this reason here too.
52
- if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)
53
- // that is outside the container, we move focus to the last valid focused element inside.
54
- if (!container1.contains(relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {
55
- select: true
56
- });
57
- } // When the focused element gets removed from the DOM, browsers move focus
58
- // back to the document.body. In this case, we move focus to the container
59
- // to keep focus trapped correctly.
60
- function handleMutations(mutations) {
61
- const focusedElement = document.activeElement;
62
- if (focusedElement !== document.body) return;
63
- for (const mutation of mutations)if (mutation.removedNodes.length > 0) $d3863c46a17e8a28$var$focus(container1);
64
- }
65
- document.addEventListener('focusin', handleFocusIn);
66
- document.addEventListener('focusout', handleFocusOut);
67
- const mutationObserver = new MutationObserver(handleMutations);
68
- if (container1) mutationObserver.observe(container1, {
69
- childList: true,
70
- subtree: true
71
- });
72
- return ()=>{
73
- document.removeEventListener('focusin', handleFocusIn);
74
- document.removeEventListener('focusout', handleFocusOut);
75
- mutationObserver.disconnect();
76
- };
8
+ var AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount";
9
+ var AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount";
10
+ var EVENT_OPTIONS = { bubbles: false, cancelable: true };
11
+ var FOCUS_SCOPE_NAME = "FocusScope";
12
+ var FocusScope = React.forwardRef((props, forwardedRef) => {
13
+ const {
14
+ loop = false,
15
+ trapped = false,
16
+ onMountAutoFocus: onMountAutoFocusProp,
17
+ onUnmountAutoFocus: onUnmountAutoFocusProp,
18
+ ...scopeProps
19
+ } = props;
20
+ const [container, setContainer] = React.useState(null);
21
+ const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);
22
+ const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);
23
+ const lastFocusedElementRef = React.useRef(null);
24
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));
25
+ const focusScope = React.useRef({
26
+ paused: false,
27
+ pause() {
28
+ this.paused = true;
29
+ },
30
+ resume() {
31
+ this.paused = false;
32
+ }
33
+ }).current;
34
+ React.useEffect(() => {
35
+ if (trapped) {
36
+ let handleFocusIn2 = function(event) {
37
+ if (focusScope.paused || !container) return;
38
+ const target = event.target;
39
+ if (container.contains(target)) {
40
+ lastFocusedElementRef.current = target;
41
+ } else {
42
+ focus(lastFocusedElementRef.current, { select: true });
77
43
  }
78
- }, [
79
- trapped,
80
- container1,
81
- focusScope.paused
82
- ]);
83
- useEffect(()=>{
84
- if (container1) {
85
- $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
86
- const previouslyFocusedElement = document.activeElement;
87
- const hasFocusedCandidate = container1.contains(previouslyFocusedElement);
88
- if (!hasFocusedCandidate) {
89
- const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
90
- container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
91
- container1.dispatchEvent(mountEvent);
92
- if (!mountEvent.defaultPrevented) {
93
- $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {
94
- select: true
95
- });
96
- if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);
97
- }
98
- }
99
- return ()=>{
100
- container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.
101
- // We need to delay the focus a little to get around it for now.
102
- // See: https://github.com/facebook/react/issues/17894
103
- setTimeout(()=>{
104
- const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);
105
- container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
106
- container1.dispatchEvent(unmountEvent);
107
- if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {
108
- select: true
109
- });
110
- // we need to remove the listener after we `dispatchEvent`
111
- container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
112
- $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);
113
- }, 0);
114
- };
44
+ }, handleFocusOut2 = function(event) {
45
+ if (focusScope.paused || !container) return;
46
+ const relatedTarget = event.relatedTarget;
47
+ if (relatedTarget === null) return;
48
+ if (!container.contains(relatedTarget)) {
49
+ focus(lastFocusedElementRef.current, { select: true });
115
50
  }
116
- }, [
117
- container1,
118
- onMountAutoFocus,
119
- onUnmountAutoFocus,
120
- focusScope
121
- ]); // Takes care of looping focus (when tabbing whilst at the edges)
122
- const handleKeyDown = useCallback((event)=>{
123
- if (!loop && !trapped) return;
124
- if (focusScope.paused) return;
125
- const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
51
+ }, handleMutations2 = function(mutations) {
126
52
  const focusedElement = document.activeElement;
127
- if (isTabKey && focusedElement) {
128
- const container = event.currentTarget;
129
- const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);
130
- const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges
131
- if (!hasTabbableElementsInside) {
132
- if (focusedElement === container) event.preventDefault();
133
- } else {
134
- if (!event.shiftKey && focusedElement === last) {
135
- event.preventDefault();
136
- if (loop) $d3863c46a17e8a28$var$focus(first, {
137
- select: true
138
- });
139
- } else if (event.shiftKey && focusedElement === first) {
140
- event.preventDefault();
141
- if (loop) $d3863c46a17e8a28$var$focus(last, {
142
- select: true
143
- });
144
- }
145
- }
53
+ if (focusedElement !== document.body) return;
54
+ for (const mutation of mutations) {
55
+ if (mutation.removedNodes.length > 0) focus(container);
146
56
  }
147
- }, [
148
- loop,
149
- trapped,
150
- focusScope.paused
151
- ]);
152
- return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
153
- tabIndex: -1
154
- }, scopeProps, {
155
- ref: composedRefs,
156
- onKeyDown: handleKeyDown
157
- }));
158
- });
159
- /* -------------------------------------------------------------------------------------------------
160
- * Utils
161
- * -----------------------------------------------------------------------------------------------*/ /**
162
- * Attempts focusing the first element in a list of candidates.
163
- * Stops when focus has actually moved.
164
- */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {
165
- const previouslyFocusedElement = document.activeElement;
166
- for (const candidate of candidates){
167
- $d3863c46a17e8a28$var$focus(candidate, {
168
- select: select
169
- });
170
- if (document.activeElement !== previouslyFocusedElement) return;
57
+ };
58
+ document.addEventListener("focusin", handleFocusIn2);
59
+ document.addEventListener("focusout", handleFocusOut2);
60
+ const mutationObserver = new MutationObserver(handleMutations2);
61
+ if (container) mutationObserver.observe(container, { childList: true, subtree: true });
62
+ return () => {
63
+ document.removeEventListener("focusin", handleFocusIn2);
64
+ document.removeEventListener("focusout", handleFocusOut2);
65
+ mutationObserver.disconnect();
66
+ };
171
67
  }
172
- }
173
- /**
174
- * Returns the first and last tabbable elements inside a container.
175
- */ function $d3863c46a17e8a28$var$getTabbableEdges(container) {
176
- const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);
177
- const first = $d3863c46a17e8a28$var$findVisible(candidates, container);
178
- const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);
179
- return [
180
- first,
181
- last
182
- ];
183
- }
184
- /**
185
- * Returns a list of potential tabbable candidates.
186
- *
187
- * NOTE: This is only a close approximation. For example it doesn't take into account cases like when
188
- * elements are not visible. This cannot be worked out easily by just reading a property, but rather
189
- * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.
190
- *
191
- * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker
192
- * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1
193
- */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {
194
- const nodes = [];
195
- const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
196
- acceptNode: (node)=>{
197
- const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';
198
- if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the
199
- // runtime's understanding of tabbability, so this automatically accounts
200
- // for any kind of element that could be tabbed to.
201
- return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
68
+ }, [trapped, container, focusScope.paused]);
69
+ React.useEffect(() => {
70
+ if (container) {
71
+ focusScopesStack.add(focusScope);
72
+ const previouslyFocusedElement = document.activeElement;
73
+ const hasFocusedCandidate = container.contains(previouslyFocusedElement);
74
+ if (!hasFocusedCandidate) {
75
+ const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);
76
+ container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
77
+ container.dispatchEvent(mountEvent);
78
+ if (!mountEvent.defaultPrevented) {
79
+ focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });
80
+ if (document.activeElement === previouslyFocusedElement) {
81
+ focus(container);
82
+ }
202
83
  }
203
- });
204
- while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it
205
- // hinders accessibility to have tab order different from visual order.
206
- return nodes;
207
- }
208
- /**
209
- * Returns the first visible element in a list.
210
- * NOTE: Only checks visibility up to the `container`.
211
- */ function $d3863c46a17e8a28$var$findVisible(elements, container) {
212
- for (const element of elements){
213
- // we stop checking if it's hidden at the `container` level (excluding)
214
- if (!$d3863c46a17e8a28$var$isHidden(element, {
215
- upTo: container
216
- })) return element;
84
+ }
85
+ return () => {
86
+ container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);
87
+ setTimeout(() => {
88
+ const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);
89
+ container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
90
+ container.dispatchEvent(unmountEvent);
91
+ if (!unmountEvent.defaultPrevented) {
92
+ focus(previouslyFocusedElement ?? document.body, { select: true });
93
+ }
94
+ container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);
95
+ focusScopesStack.remove(focusScope);
96
+ }, 0);
97
+ };
217
98
  }
99
+ }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);
100
+ const handleKeyDown = React.useCallback(
101
+ (event) => {
102
+ if (!loop && !trapped) return;
103
+ if (focusScope.paused) return;
104
+ const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey;
105
+ const focusedElement = document.activeElement;
106
+ if (isTabKey && focusedElement) {
107
+ const container2 = event.currentTarget;
108
+ const [first, last] = getTabbableEdges(container2);
109
+ const hasTabbableElementsInside = first && last;
110
+ if (!hasTabbableElementsInside) {
111
+ if (focusedElement === container2) event.preventDefault();
112
+ } else {
113
+ if (!event.shiftKey && focusedElement === last) {
114
+ event.preventDefault();
115
+ if (loop) focus(first, { select: true });
116
+ } else if (event.shiftKey && focusedElement === first) {
117
+ event.preventDefault();
118
+ if (loop) focus(last, { select: true });
119
+ }
120
+ }
121
+ }
122
+ },
123
+ [loop, trapped, focusScope.paused]
124
+ );
125
+ return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });
126
+ });
127
+ FocusScope.displayName = FOCUS_SCOPE_NAME;
128
+ function focusFirst(candidates, { select = false } = {}) {
129
+ const previouslyFocusedElement = document.activeElement;
130
+ for (const candidate of candidates) {
131
+ focus(candidate, { select });
132
+ if (document.activeElement !== previouslyFocusedElement) return;
133
+ }
134
+ }
135
+ function getTabbableEdges(container) {
136
+ const candidates = getTabbableCandidates(container);
137
+ const first = findVisible(candidates, container);
138
+ const last = findVisible(candidates.reverse(), container);
139
+ return [first, last];
218
140
  }
219
- function $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {
220
- if (getComputedStyle(node).visibility === 'hidden') return true;
221
- while(node){
222
- // we stop at `upTo` (excluding it)
223
- if (upTo !== undefined && node === upTo) return false;
224
- if (getComputedStyle(node).display === 'none') return true;
225
- node = node.parentElement;
141
+ function getTabbableCandidates(container) {
142
+ const nodes = [];
143
+ const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
144
+ acceptNode: (node) => {
145
+ const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
146
+ if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
147
+ return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
226
148
  }
227
- return false;
149
+ });
150
+ while (walker.nextNode()) nodes.push(walker.currentNode);
151
+ return nodes;
228
152
  }
229
- function $d3863c46a17e8a28$var$isSelectableInput(element) {
230
- return element instanceof HTMLInputElement && 'select' in element;
153
+ function findVisible(elements, container) {
154
+ for (const element of elements) {
155
+ if (!isHidden(element, { upTo: container })) return element;
156
+ }
231
157
  }
232
- function $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {
233
- // only focus if that element is focusable
234
- if (element && element.focus) {
235
- const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users
236
- element.focus({
237
- preventScroll: true
238
- }); // only select if its not the same element, it supports selection and we need to select
239
- if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();
240
- }
158
+ function isHidden(node, { upTo }) {
159
+ if (getComputedStyle(node).visibility === "hidden") return true;
160
+ while (node) {
161
+ if (upTo !== void 0 && node === upTo) return false;
162
+ if (getComputedStyle(node).display === "none") return true;
163
+ node = node.parentElement;
164
+ }
165
+ return false;
241
166
  }
242
- /* -------------------------------------------------------------------------------------------------
243
- * FocusScope stack
244
- * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();
245
- function $d3863c46a17e8a28$var$createFocusScopesStack() {
246
- /** A stack of focus scopes, with the active one at the top */ let stack = [];
247
- return {
248
- add (focusScope) {
249
- // pause the currently active focus scope (at the top of the stack)
250
- const activeFocusScope = stack[0];
251
- if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();
252
- // remove in case it already exists (because we'll re-add it at the top of the stack)
253
- stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
254
- stack.unshift(focusScope);
255
- },
256
- remove (focusScope) {
257
- var _stack$;
258
- stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);
259
- (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();
260
- }
261
- };
167
+ function isSelectableInput(element) {
168
+ return element instanceof HTMLInputElement && "select" in element;
169
+ }
170
+ function focus(element, { select = false } = {}) {
171
+ if (element && element.focus) {
172
+ const previouslyFocusedElement = document.activeElement;
173
+ element.focus({ preventScroll: true });
174
+ if (element !== previouslyFocusedElement && isSelectableInput(element) && select)
175
+ element.select();
176
+ }
177
+ }
178
+ var focusScopesStack = createFocusScopesStack();
179
+ function createFocusScopesStack() {
180
+ let stack = [];
181
+ return {
182
+ add(focusScope) {
183
+ const activeFocusScope = stack[0];
184
+ if (focusScope !== activeFocusScope) {
185
+ activeFocusScope?.pause();
186
+ }
187
+ stack = arrayRemove(stack, focusScope);
188
+ stack.unshift(focusScope);
189
+ },
190
+ remove(focusScope) {
191
+ stack = arrayRemove(stack, focusScope);
192
+ stack[0]?.resume();
193
+ }
194
+ };
262
195
  }
263
- function $d3863c46a17e8a28$var$arrayRemove(array, item) {
264
- const updatedArray = [
265
- ...array
266
- ];
267
- const index = updatedArray.indexOf(item);
268
- if (index !== -1) updatedArray.splice(index, 1);
269
- return updatedArray;
196
+ function arrayRemove(array, item) {
197
+ const updatedArray = [...array];
198
+ const index = updatedArray.indexOf(item);
199
+ if (index !== -1) {
200
+ updatedArray.splice(index, 1);
201
+ }
202
+ return updatedArray;
270
203
  }
271
- function $d3863c46a17e8a28$var$removeLinks(items) {
272
- return items.filter((item)=>item.tagName !== 'A'
273
- );
204
+ function removeLinks(items) {
205
+ return items.filter((item) => item.tagName !== "A");
274
206
  }
275
207
 
276
- export { $d3863c46a17e8a28$export$20e40289641fbbb6 as FocusScope };
208
+ export { FocusScope };
277
209
  //# sourceMappingURL=index.mjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs.js","sources":["../../../../../node_modules/@radix-ui/react-focus-scope/dist/index.mjs"],"sourcesContent":["import $45QHv$babelruntimehelpersesmextends from \"@babel/runtime/helpers/esm/extends\";\nimport {forwardRef as $45QHv$forwardRef, useState as $45QHv$useState, useRef as $45QHv$useRef, useEffect as $45QHv$useEffect, useCallback as $45QHv$useCallback, createElement as $45QHv$createElement} from \"react\";\nimport {useComposedRefs as $45QHv$useComposedRefs} from \"@radix-ui/react-compose-refs\";\nimport {Primitive as $45QHv$Primitive} from \"@radix-ui/react-primitive\";\nimport {useCallbackRef as $45QHv$useCallbackRef} from \"@radix-ui/react-use-callback-ref\";\n\n\n\n\n\n\nconst $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = 'focusScope.autoFocusOnMount';\nconst $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = 'focusScope.autoFocusOnUnmount';\nconst $d3863c46a17e8a28$var$EVENT_OPTIONS = {\n bubbles: false,\n cancelable: true\n};\n/* -------------------------------------------------------------------------------------------------\n * FocusScope\n * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME = 'FocusScope';\nconst $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ $45QHv$forwardRef((props, forwardedRef)=>{\n const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;\n const [container1, setContainer] = $45QHv$useState(null);\n const onMountAutoFocus = $45QHv$useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = $45QHv$useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = $45QHv$useRef(null);\n const composedRefs = $45QHv$useComposedRefs(forwardedRef, (node)=>setContainer(node)\n );\n const focusScope = $45QHv$useRef({\n paused: false,\n pause () {\n this.paused = true;\n },\n resume () {\n this.paused = false;\n }\n }).current; // Takes care of trapping focus if focus is moved outside programmatically for example\n $45QHv$useEffect(()=>{\n if (trapped) {\n function handleFocusIn(event) {\n if (focusScope.paused || !container1) return;\n const target = event.target;\n if (container1.contains(target)) lastFocusedElementRef.current = target;\n else $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {\n select: true\n });\n }\n function handleFocusOut(event) {\n if (focusScope.paused || !container1) return;\n const relatedTarget = event.relatedTarget; // A `focusout` event with a `null` `relatedTarget` will happen in at least two cases:\n //\n // 1. When the user switches app/tabs/windows/the browser itself loses focus.\n // 2. In Google Chrome, when the focused element is removed from the DOM.\n //\n // We let the browser do its thing here because:\n //\n // 1. The browser already keeps a memory of what's focused for when the page gets refocused.\n // 2. In Google Chrome, if we try to focus the deleted focused element (as per below), it\n // throws the CPU to 100%, so we avoid doing anything for this reason here too.\n if (relatedTarget === null) return; // If the focus has moved to an actual legitimate element (`relatedTarget !== null`)\n // that is outside the container, we move focus to the last valid focused element inside.\n if (!container1.contains(relatedTarget)) $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, {\n select: true\n });\n } // When the focused element gets removed from the DOM, browsers move focus\n // back to the document.body. In this case, we move focus to the container\n // to keep focus trapped correctly.\n function handleMutations(mutations) {\n const focusedElement = document.activeElement;\n if (focusedElement !== document.body) return;\n for (const mutation of mutations)if (mutation.removedNodes.length > 0) $d3863c46a17e8a28$var$focus(container1);\n }\n document.addEventListener('focusin', handleFocusIn);\n document.addEventListener('focusout', handleFocusOut);\n const mutationObserver = new MutationObserver(handleMutations);\n if (container1) mutationObserver.observe(container1, {\n childList: true,\n subtree: true\n });\n return ()=>{\n document.removeEventListener('focusin', handleFocusIn);\n document.removeEventListener('focusout', handleFocusOut);\n mutationObserver.disconnect();\n };\n }\n }, [\n trapped,\n container1,\n focusScope.paused\n ]);\n $45QHv$useEffect(()=>{\n if (container1) {\n $d3863c46a17e8a28$var$focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement;\n const hasFocusedCandidate = container1.contains(previouslyFocusedElement);\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);\n container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container1.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), {\n select: true\n });\n if (document.activeElement === previouslyFocusedElement) $d3863c46a17e8a28$var$focus(container1);\n }\n }\n return ()=>{\n container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); // We hit a react bug (fixed in v17) with focusing in unmount.\n // We need to delay the focus a little to get around it for now.\n // See: https://github.com/facebook/react/issues/17894\n setTimeout(()=>{\n const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS);\n container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container1.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, {\n select: true\n });\n // we need to remove the listener after we `dispatchEvent`\n container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [\n container1,\n onMountAutoFocus,\n onUnmountAutoFocus,\n focusScope\n ]); // Takes care of looping focus (when tabbing whilst at the edges)\n const handleKeyDown = $45QHv$useCallback((event)=>{\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement;\n if (isTabKey && focusedElement) {\n const container = event.currentTarget;\n const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container);\n const hasTabbableElementsInside = first && last; // we can only wrap focus if we have tabbable edges\n if (!hasTabbableElementsInside) {\n if (focusedElement === container) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) $d3863c46a17e8a28$var$focus(first, {\n select: true\n });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) $d3863c46a17e8a28$var$focus(last, {\n select: true\n });\n }\n }\n }\n }, [\n loop,\n trapped,\n focusScope.paused\n ]);\n return /*#__PURE__*/ $45QHv$createElement($45QHv$Primitive.div, $45QHv$babelruntimehelpersesmextends({\n tabIndex: -1\n }, scopeProps, {\n ref: composedRefs,\n onKeyDown: handleKeyDown\n }));\n});\n/*#__PURE__*/ Object.assign($d3863c46a17e8a28$export$20e40289641fbbb6, {\n displayName: $d3863c46a17e8a28$var$FOCUS_SCOPE_NAME\n});\n/* -------------------------------------------------------------------------------------------------\n * Utils\n * -----------------------------------------------------------------------------------------------*/ /**\n * Attempts focusing the first element in a list of candidates.\n * Stops when focus has actually moved.\n */ function $d3863c46a17e8a28$var$focusFirst(candidates, { select: select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates){\n $d3863c46a17e8a28$var$focus(candidate, {\n select: select\n });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\n/**\n * Returns the first and last tabbable elements inside a container.\n */ function $d3863c46a17e8a28$var$getTabbableEdges(container) {\n const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container);\n const first = $d3863c46a17e8a28$var$findVisible(candidates, container);\n const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container);\n return [\n first,\n last\n ];\n}\n/**\n * Returns a list of potential tabbable candidates.\n *\n * NOTE: This is only a close approximation. For example it doesn't take into account cases like when\n * elements are not visible. This cannot be worked out easily by just reading a property, but rather\n * necessitate runtime knowledge (computed styles, etc). We deal with these cases separately.\n *\n * See: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n * Credit: https://github.com/discord/focus-layers/blob/master/src/util/wrapFocus.tsx#L1\n */ function $d3863c46a17e8a28$var$getTabbableCandidates(container) {\n const nodes = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node)=>{\n const isHiddenInput = node.tagName === 'INPUT' && node.type === 'hidden';\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP; // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while(walker.nextNode())nodes.push(walker.currentNode); // we do not take into account the order of nodes with positive `tabIndex` as it\n // hinders accessibility to have tab order different from visual order.\n return nodes;\n}\n/**\n * Returns the first visible element in a list.\n * NOTE: Only checks visibility up to the `container`.\n */ function $d3863c46a17e8a28$var$findVisible(elements, container) {\n for (const element of elements){\n // we stop checking if it's hidden at the `container` level (excluding)\n if (!$d3863c46a17e8a28$var$isHidden(element, {\n upTo: container\n })) return element;\n }\n}\nfunction $d3863c46a17e8a28$var$isHidden(node, { upTo: upTo }) {\n if (getComputedStyle(node).visibility === 'hidden') return true;\n while(node){\n // we stop at `upTo` (excluding it)\n if (upTo !== undefined && node === upTo) return false;\n if (getComputedStyle(node).display === 'none') return true;\n node = node.parentElement;\n }\n return false;\n}\nfunction $d3863c46a17e8a28$var$isSelectableInput(element) {\n return element instanceof HTMLInputElement && 'select' in element;\n}\nfunction $d3863c46a17e8a28$var$focus(element, { select: select = false } = {}) {\n // only focus if that element is focusable\n if (element && element.focus) {\n const previouslyFocusedElement = document.activeElement; // NOTE: we prevent scrolling on focus, to minimize jarring transitions for users\n element.focus({\n preventScroll: true\n }); // only select if its not the same element, it supports selection and we need to select\n if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) element.select();\n }\n}\n/* -------------------------------------------------------------------------------------------------\n * FocusScope stack\n * -----------------------------------------------------------------------------------------------*/ const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack();\nfunction $d3863c46a17e8a28$var$createFocusScopesStack() {\n /** A stack of focus scopes, with the active one at the top */ let stack = [];\n return {\n add (focusScope) {\n // pause the currently active focus scope (at the top of the stack)\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause();\n // remove in case it already exists (because we'll re-add it at the top of the stack)\n stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n remove (focusScope) {\n var _stack$;\n stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope);\n (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume();\n }\n };\n}\nfunction $d3863c46a17e8a28$var$arrayRemove(array, item) {\n const updatedArray = [\n ...array\n ];\n const index = updatedArray.indexOf(item);\n if (index !== -1) updatedArray.splice(index, 1);\n return updatedArray;\n}\nfunction $d3863c46a17e8a28$var$removeLinks(items) {\n return items.filter((item)=>item.tagName !== 'A'\n );\n}\nconst $d3863c46a17e8a28$export$be92b6f5f03c0fe9 = $d3863c46a17e8a28$export$20e40289641fbbb6;\n\n\n\n\nexport {$d3863c46a17e8a28$export$20e40289641fbbb6 as FocusScope, $d3863c46a17e8a28$export$be92b6f5f03c0fe9 as Root};\n//# sourceMappingURL=index.mjs.map\n"],"names":["$45QHv$forwardRef","$45QHv$useState","$45QHv$useCallbackRef","$45QHv$useRef","$45QHv$useComposedRefs","$45QHv$useEffect","$45QHv$useCallback","$45QHv$createElement","$45QHv$Primitive","$45QHv$babelruntimehelpersesmextends"],"mappings":";;;;;;AAWA,MAAM,wCAAwC,GAAG,6BAA6B,CAAC;AAC/E,MAAM,0CAA0C,GAAG,+BAA+B,CAAC;AACnF,MAAM,mCAAmC,GAAG;AAC5C,IAAI,OAAO,EAAE,KAAK;AAClB,IAAI,UAAU,EAAE,IAAI;AACpB,CAAC,CAAC;AAIG,MAAC,yCAAyC,iBAAiBA,UAAiB,CAAC,CAAC,KAAK,EAAE,YAAY,GAAG;AACzG,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,KAAK,GAAG,OAAO,EAAE,OAAO,GAAG,KAAK,GAAG,gBAAgB,EAAE,oBAAoB,GAAG,kBAAkB,EAAE,sBAAsB,GAAG,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;AAC1K,IAAI,MAAM,CAAC,UAAU,EAAE,YAAY,CAAC,GAAGC,QAAe,CAAC,IAAI,CAAC,CAAC;AAC7D,IAAI,MAAM,gBAAgB,GAAGC,yCAAqB,CAAC,oBAAoB,CAAC,CAAC;AACzE,IAAI,MAAM,kBAAkB,GAAGA,yCAAqB,CAAC,sB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C,KAAK,EAAE,CAAC,CAAC,CAAC;AACpD,IAAI,OAAO,YAAY,CAAC;AACxB,CAAC;AACD,SAAS,iCAAiC,CAAC,KAAK,EAAE;AAClD,IAAI,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,KAAK,GAAG;AACpD,KAAK,CAAC;AACN;;;;"}
1
+ {"version":3,"file":"index.mjs.js","sources":["../../../../../node_modules/@radix-ui/react-focus-scope/dist/index.mjs"],"sourcesContent":["\"use client\";\n\n// src/focus-scope.tsx\nimport * as React from \"react\";\nimport { useComposedRefs } from \"@radix-ui/react-compose-refs\";\nimport { Primitive } from \"@radix-ui/react-primitive\";\nimport { useCallbackRef } from \"@radix-ui/react-use-callback-ref\";\nimport { jsx } from \"react/jsx-runtime\";\nvar AUTOFOCUS_ON_MOUNT = \"focusScope.autoFocusOnMount\";\nvar AUTOFOCUS_ON_UNMOUNT = \"focusScope.autoFocusOnUnmount\";\nvar EVENT_OPTIONS = { bubbles: false, cancelable: true };\nvar FOCUS_SCOPE_NAME = \"FocusScope\";\nvar FocusScope = React.forwardRef((props, forwardedRef) => {\n const {\n loop = false,\n trapped = false,\n onMountAutoFocus: onMountAutoFocusProp,\n onUnmountAutoFocus: onUnmountAutoFocusProp,\n ...scopeProps\n } = props;\n const [container, setContainer] = React.useState(null);\n const onMountAutoFocus = useCallbackRef(onMountAutoFocusProp);\n const onUnmountAutoFocus = useCallbackRef(onUnmountAutoFocusProp);\n const lastFocusedElementRef = React.useRef(null);\n const composedRefs = useComposedRefs(forwardedRef, (node) => setContainer(node));\n const focusScope = React.useRef({\n paused: false,\n pause() {\n this.paused = true;\n },\n resume() {\n this.paused = false;\n }\n }).current;\n React.useEffect(() => {\n if (trapped) {\n let handleFocusIn2 = function(event) {\n if (focusScope.paused || !container) return;\n const target = event.target;\n if (container.contains(target)) {\n lastFocusedElementRef.current = target;\n } else {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }, handleFocusOut2 = function(event) {\n if (focusScope.paused || !container) return;\n const relatedTarget = event.relatedTarget;\n if (relatedTarget === null) return;\n if (!container.contains(relatedTarget)) {\n focus(lastFocusedElementRef.current, { select: true });\n }\n }, handleMutations2 = function(mutations) {\n const focusedElement = document.activeElement;\n if (focusedElement !== document.body) return;\n for (const mutation of mutations) {\n if (mutation.removedNodes.length > 0) focus(container);\n }\n };\n var handleFocusIn = handleFocusIn2, handleFocusOut = handleFocusOut2, handleMutations = handleMutations2;\n document.addEventListener(\"focusin\", handleFocusIn2);\n document.addEventListener(\"focusout\", handleFocusOut2);\n const mutationObserver = new MutationObserver(handleMutations2);\n if (container) mutationObserver.observe(container, { childList: true, subtree: true });\n return () => {\n document.removeEventListener(\"focusin\", handleFocusIn2);\n document.removeEventListener(\"focusout\", handleFocusOut2);\n mutationObserver.disconnect();\n };\n }\n }, [trapped, container, focusScope.paused]);\n React.useEffect(() => {\n if (container) {\n focusScopesStack.add(focusScope);\n const previouslyFocusedElement = document.activeElement;\n const hasFocusedCandidate = container.contains(previouslyFocusedElement);\n if (!hasFocusedCandidate) {\n const mountEvent = new CustomEvent(AUTOFOCUS_ON_MOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n container.dispatchEvent(mountEvent);\n if (!mountEvent.defaultPrevented) {\n focusFirst(removeLinks(getTabbableCandidates(container)), { select: true });\n if (document.activeElement === previouslyFocusedElement) {\n focus(container);\n }\n }\n }\n return () => {\n container.removeEventListener(AUTOFOCUS_ON_MOUNT, onMountAutoFocus);\n setTimeout(() => {\n const unmountEvent = new CustomEvent(AUTOFOCUS_ON_UNMOUNT, EVENT_OPTIONS);\n container.addEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n container.dispatchEvent(unmountEvent);\n if (!unmountEvent.defaultPrevented) {\n focus(previouslyFocusedElement ?? document.body, { select: true });\n }\n container.removeEventListener(AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus);\n focusScopesStack.remove(focusScope);\n }, 0);\n };\n }\n }, [container, onMountAutoFocus, onUnmountAutoFocus, focusScope]);\n const handleKeyDown = React.useCallback(\n (event) => {\n if (!loop && !trapped) return;\n if (focusScope.paused) return;\n const isTabKey = event.key === \"Tab\" && !event.altKey && !event.ctrlKey && !event.metaKey;\n const focusedElement = document.activeElement;\n if (isTabKey && focusedElement) {\n const container2 = event.currentTarget;\n const [first, last] = getTabbableEdges(container2);\n const hasTabbableElementsInside = first && last;\n if (!hasTabbableElementsInside) {\n if (focusedElement === container2) event.preventDefault();\n } else {\n if (!event.shiftKey && focusedElement === last) {\n event.preventDefault();\n if (loop) focus(first, { select: true });\n } else if (event.shiftKey && focusedElement === first) {\n event.preventDefault();\n if (loop) focus(last, { select: true });\n }\n }\n }\n },\n [loop, trapped, focusScope.paused]\n );\n return /* @__PURE__ */ jsx(Primitive.div, { tabIndex: -1, ...scopeProps, ref: composedRefs, onKeyDown: handleKeyDown });\n});\nFocusScope.displayName = FOCUS_SCOPE_NAME;\nfunction focusFirst(candidates, { select = false } = {}) {\n const previouslyFocusedElement = document.activeElement;\n for (const candidate of candidates) {\n focus(candidate, { select });\n if (document.activeElement !== previouslyFocusedElement) return;\n }\n}\nfunction getTabbableEdges(container) {\n const candidates = getTabbableCandidates(container);\n const first = findVisible(candidates, container);\n const last = findVisible(candidates.reverse(), container);\n return [first, last];\n}\nfunction getTabbableCandidates(container) {\n const nodes = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node) => {\n const isHiddenInput = node.tagName === \"INPUT\" && node.type === \"hidden\";\n if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n }\n });\n while (walker.nextNode()) nodes.push(walker.currentNode);\n return nodes;\n}\nfunction findVisible(elements, container) {\n for (const element of elements) {\n if (!isHidden(element, { upTo: container })) return element;\n }\n}\nfunction isHidden(node, { upTo }) {\n if (getComputedStyle(node).visibility === \"hidden\") return true;\n while (node) {\n if (upTo !== void 0 && node === upTo) return false;\n if (getComputedStyle(node).display === \"none\") return true;\n node = node.parentElement;\n }\n return false;\n}\nfunction isSelectableInput(element) {\n return element instanceof HTMLInputElement && \"select\" in element;\n}\nfunction focus(element, { select = false } = {}) {\n if (element && element.focus) {\n const previouslyFocusedElement = document.activeElement;\n element.focus({ preventScroll: true });\n if (element !== previouslyFocusedElement && isSelectableInput(element) && select)\n element.select();\n }\n}\nvar focusScopesStack = createFocusScopesStack();\nfunction createFocusScopesStack() {\n let stack = [];\n return {\n add(focusScope) {\n const activeFocusScope = stack[0];\n if (focusScope !== activeFocusScope) {\n activeFocusScope?.pause();\n }\n stack = arrayRemove(stack, focusScope);\n stack.unshift(focusScope);\n },\n remove(focusScope) {\n stack = arrayRemove(stack, focusScope);\n stack[0]?.resume();\n }\n };\n}\nfunction arrayRemove(array, item) {\n const updatedArray = [...array];\n const index = updatedArray.indexOf(item);\n if (index !== -1) {\n updatedArray.splice(index, 1);\n }\n return updatedArray;\n}\nfunction removeLinks(items) {\n return items.filter((item) => item.tagName !== \"A\");\n}\nvar Root = FocusScope;\nexport {\n FocusScope,\n Root\n};\n//# sourceMappingURL=index.mjs.map\n"],"names":[],"mappings":";;;;;;;AAQA;AACA;AACA;AACA;AACG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;"}