@protonradio/proton-ui 0.11.29 → 0.11.30-beta.2

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 (340) hide show
  1. package/dist/components/ActionMenu/ActionMenu.cjs.js +1 -1
  2. package/dist/components/ActionMenu/ActionMenu.cjs.js.map +1 -1
  3. package/dist/components/ActionMenu/ActionMenu.es.js +77 -76
  4. package/dist/components/ActionMenu/ActionMenu.es.js.map +1 -1
  5. package/dist/components/Banner/Banner.cjs.js +1 -1
  6. package/dist/components/Banner/Banner.cjs.js.map +1 -1
  7. package/dist/components/Banner/Banner.es.js +77 -77
  8. package/dist/components/Banner/Banner.es.js.map +1 -1
  9. package/dist/components/ButtonWithSelect/ButtonWithSelect.cjs.js +1 -1
  10. package/dist/components/ButtonWithSelect/ButtonWithSelect.cjs.js.map +1 -1
  11. package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js +9 -9
  12. package/dist/components/ButtonWithSelect/ButtonWithSelect.es.js.map +1 -1
  13. package/dist/components/Icon/IconComponents/AlertCircle.cjs.js +2 -0
  14. package/dist/components/Icon/IconComponents/AlertCircle.cjs.js.map +1 -0
  15. package/dist/components/Icon/IconComponents/AlertCircle.es.js +56 -0
  16. package/dist/components/Icon/IconComponents/AlertCircle.es.js.map +1 -0
  17. package/dist/components/Icon/IconComponents/AmazonMusicLogo.cjs.js +2 -0
  18. package/dist/components/Icon/IconComponents/AmazonMusicLogo.cjs.js.map +1 -0
  19. package/dist/components/Icon/IconComponents/AmazonMusicLogo.es.js +27 -0
  20. package/dist/components/Icon/IconComponents/AmazonMusicLogo.es.js.map +1 -0
  21. package/dist/components/Icon/IconComponents/AppleMusicLogo.cjs.js +2 -0
  22. package/dist/components/Icon/IconComponents/AppleMusicLogo.cjs.js.map +1 -0
  23. package/dist/components/Icon/IconComponents/AppleMusicLogo.es.js +42 -0
  24. package/dist/components/Icon/IconComponents/AppleMusicLogo.es.js.map +1 -0
  25. package/dist/components/Icon/IconComponents/ArrowLeft.cjs.js +2 -0
  26. package/dist/components/Icon/IconComponents/ArrowLeft.cjs.js.map +1 -0
  27. package/dist/components/Icon/IconComponents/ArrowLeft.es.js +27 -0
  28. package/dist/components/Icon/IconComponents/ArrowLeft.es.js.map +1 -0
  29. package/dist/components/Icon/IconComponents/BandcampLogo.cjs.js +2 -0
  30. package/dist/components/Icon/IconComponents/BandcampLogo.cjs.js.map +1 -0
  31. package/dist/components/Icon/IconComponents/BandcampLogo.es.js +27 -0
  32. package/dist/components/Icon/IconComponents/BandcampLogo.es.js.map +1 -0
  33. package/dist/components/Icon/IconComponents/BeatportLogo.cjs.js +2 -0
  34. package/dist/components/Icon/IconComponents/BeatportLogo.cjs.js.map +1 -0
  35. package/dist/components/Icon/IconComponents/BeatportLogo.es.js +29 -0
  36. package/dist/components/Icon/IconComponents/BeatportLogo.es.js.map +1 -0
  37. package/dist/components/Icon/IconComponents/Bell.cjs.js +2 -0
  38. package/dist/components/Icon/IconComponents/Bell.cjs.js.map +1 -0
  39. package/dist/components/Icon/IconComponents/Bell.es.js +31 -0
  40. package/dist/components/Icon/IconComponents/Bell.es.js.map +1 -0
  41. package/dist/components/Icon/IconComponents/CaretDown.cjs.js +2 -0
  42. package/dist/components/Icon/IconComponents/CaretDown.cjs.js.map +1 -0
  43. package/dist/components/Icon/IconComponents/CaretDown.es.js +27 -0
  44. package/dist/components/Icon/IconComponents/CaretDown.es.js.map +1 -0
  45. package/dist/components/Icon/IconComponents/CaretRight.cjs.js +2 -0
  46. package/dist/components/Icon/IconComponents/CaretRight.cjs.js.map +1 -0
  47. package/dist/components/Icon/IconComponents/CaretRight.es.js +27 -0
  48. package/dist/components/Icon/IconComponents/CaretRight.es.js.map +1 -0
  49. package/dist/components/Icon/IconComponents/Chart.cjs.js +2 -0
  50. package/dist/components/Icon/IconComponents/Chart.cjs.js.map +1 -0
  51. package/dist/components/Icon/IconComponents/Chart.es.js +31 -0
  52. package/dist/components/Icon/IconComponents/Chart.es.js.map +1 -0
  53. package/dist/components/Icon/IconComponents/CheckCircle.cjs.js +2 -0
  54. package/dist/components/Icon/IconComponents/CheckCircle.cjs.js.map +1 -0
  55. package/dist/components/Icon/IconComponents/CheckCircle.es.js +27 -0
  56. package/dist/components/Icon/IconComponents/CheckCircle.es.js.map +1 -0
  57. package/dist/components/Icon/IconComponents/ChevronDown.cjs.js +2 -0
  58. package/dist/components/Icon/IconComponents/ChevronDown.cjs.js.map +1 -0
  59. package/dist/components/Icon/IconComponents/ChevronDown.es.js +23 -0
  60. package/dist/components/Icon/IconComponents/ChevronDown.es.js.map +1 -0
  61. package/dist/components/Icon/IconComponents/ChevronLeft.cjs.js +2 -0
  62. package/dist/components/Icon/IconComponents/ChevronLeft.cjs.js.map +1 -0
  63. package/dist/components/Icon/IconComponents/ChevronLeft.es.js +23 -0
  64. package/dist/components/Icon/IconComponents/ChevronLeft.es.js.map +1 -0
  65. package/dist/components/Icon/IconComponents/ChevronRight.cjs.js +2 -0
  66. package/dist/components/Icon/IconComponents/ChevronRight.cjs.js.map +1 -0
  67. package/dist/components/Icon/IconComponents/ChevronRight.es.js +27 -0
  68. package/dist/components/Icon/IconComponents/ChevronRight.es.js.map +1 -0
  69. package/dist/components/Icon/IconComponents/ChevronSquareDown.cjs.js +2 -0
  70. package/dist/components/Icon/IconComponents/ChevronSquareDown.cjs.js.map +1 -0
  71. package/dist/components/Icon/IconComponents/ChevronSquareDown.es.js +27 -0
  72. package/dist/components/Icon/IconComponents/ChevronSquareDown.es.js.map +1 -0
  73. package/dist/components/Icon/IconComponents/ChevronUp.cjs.js +2 -0
  74. package/dist/components/Icon/IconComponents/ChevronUp.cjs.js.map +1 -0
  75. package/dist/components/Icon/IconComponents/ChevronUp.es.js +27 -0
  76. package/dist/components/Icon/IconComponents/ChevronUp.es.js.map +1 -0
  77. package/dist/components/Icon/IconComponents/Close.cjs.js +2 -0
  78. package/dist/components/Icon/IconComponents/Close.cjs.js.map +1 -0
  79. package/dist/components/Icon/IconComponents/Close.es.js +27 -0
  80. package/dist/components/Icon/IconComponents/Close.es.js.map +1 -0
  81. package/dist/components/Icon/IconComponents/Cog.cjs.js +2 -0
  82. package/dist/components/Icon/IconComponents/Cog.cjs.js.map +1 -0
  83. package/dist/components/Icon/IconComponents/Cog.es.js +30 -0
  84. package/dist/components/Icon/IconComponents/Cog.es.js.map +1 -0
  85. package/dist/components/Icon/IconComponents/Copy.cjs.js +2 -0
  86. package/dist/components/Icon/IconComponents/Copy.cjs.js.map +1 -0
  87. package/dist/components/Icon/IconComponents/Copy.es.js +26 -0
  88. package/dist/components/Icon/IconComponents/Copy.es.js.map +1 -0
  89. package/dist/components/Icon/IconComponents/DangerCircle.cjs.js +2 -0
  90. package/dist/components/Icon/IconComponents/DangerCircle.cjs.js.map +1 -0
  91. package/dist/components/Icon/IconComponents/DangerCircle.es.js +33 -0
  92. package/dist/components/Icon/IconComponents/DangerCircle.es.js.map +1 -0
  93. package/dist/components/Icon/IconComponents/Dashboard.cjs.js +2 -0
  94. package/dist/components/Icon/IconComponents/Dashboard.cjs.js.map +1 -0
  95. package/dist/components/Icon/IconComponents/Dashboard.es.js +27 -0
  96. package/dist/components/Icon/IconComponents/Dashboard.es.js.map +1 -0
  97. package/dist/components/Icon/IconComponents/DeezerLogo.cjs.js +2 -0
  98. package/dist/components/Icon/IconComponents/DeezerLogo.cjs.js.map +1 -0
  99. package/dist/components/Icon/IconComponents/DeezerLogo.es.js +27 -0
  100. package/dist/components/Icon/IconComponents/DeezerLogo.es.js.map +1 -0
  101. package/dist/components/Icon/IconComponents/Download.cjs.js +2 -0
  102. package/dist/components/Icon/IconComponents/Download.cjs.js.map +1 -0
  103. package/dist/components/Icon/IconComponents/Download.es.js +27 -0
  104. package/dist/components/Icon/IconComponents/Download.es.js.map +1 -0
  105. package/dist/components/Icon/IconComponents/DragHandle.cjs.js +2 -0
  106. package/dist/components/Icon/IconComponents/DragHandle.cjs.js.map +1 -0
  107. package/dist/components/Icon/IconComponents/DragHandle.es.js +30 -0
  108. package/dist/components/Icon/IconComponents/DragHandle.es.js.map +1 -0
  109. package/dist/components/Icon/IconComponents/Edit.cjs.js +2 -0
  110. package/dist/components/Icon/IconComponents/Edit.cjs.js.map +1 -0
  111. package/dist/components/Icon/IconComponents/Edit.es.js +23 -0
  112. package/dist/components/Icon/IconComponents/Edit.es.js.map +1 -0
  113. package/dist/components/Icon/IconComponents/Ellipsis.cjs.js +2 -0
  114. package/dist/components/Icon/IconComponents/Ellipsis.cjs.js.map +1 -0
  115. package/dist/components/Icon/IconComponents/Ellipsis.es.js +27 -0
  116. package/dist/components/Icon/IconComponents/Ellipsis.es.js.map +1 -0
  117. package/dist/components/Icon/IconComponents/EmailThick.cjs.js +2 -0
  118. package/dist/components/Icon/IconComponents/EmailThick.cjs.js.map +1 -0
  119. package/dist/components/Icon/IconComponents/EmailThick.es.js +30 -0
  120. package/dist/components/Icon/IconComponents/EmailThick.es.js.map +1 -0
  121. package/dist/components/Icon/IconComponents/EmailThin.cjs.js +2 -0
  122. package/dist/components/Icon/IconComponents/EmailThin.cjs.js.map +1 -0
  123. package/dist/components/Icon/IconComponents/EmailThin.es.js +28 -0
  124. package/dist/components/Icon/IconComponents/EmailThin.es.js.map +1 -0
  125. package/dist/components/Icon/IconComponents/ExternalLink.cjs.js +2 -0
  126. package/dist/components/Icon/IconComponents/ExternalLink.cjs.js.map +1 -0
  127. package/dist/components/Icon/IconComponents/ExternalLink.es.js +30 -0
  128. package/dist/components/Icon/IconComponents/ExternalLink.es.js.map +1 -0
  129. package/dist/components/Icon/IconComponents/FacebookLogo.cjs.js +2 -0
  130. package/dist/components/Icon/IconComponents/FacebookLogo.cjs.js.map +1 -0
  131. package/dist/components/Icon/IconComponents/FacebookLogo.es.js +27 -0
  132. package/dist/components/Icon/IconComponents/FacebookLogo.es.js.map +1 -0
  133. package/dist/components/Icon/IconComponents/Globe.cjs.js +2 -0
  134. package/dist/components/Icon/IconComponents/Globe.cjs.js.map +1 -0
  135. package/dist/components/Icon/IconComponents/Globe.es.js +30 -0
  136. package/dist/components/Icon/IconComponents/Globe.es.js.map +1 -0
  137. package/dist/components/Icon/IconComponents/Hamburger.cjs.js +2 -0
  138. package/dist/components/Icon/IconComponents/Hamburger.cjs.js.map +1 -0
  139. package/dist/components/Icon/IconComponents/Hamburger.es.js +27 -0
  140. package/dist/components/Icon/IconComponents/Hamburger.es.js.map +1 -0
  141. package/dist/components/Icon/IconComponents/Heartbeat.cjs.js +2 -0
  142. package/dist/components/Icon/IconComponents/Heartbeat.cjs.js.map +1 -0
  143. package/dist/components/Icon/IconComponents/Heartbeat.es.js +23 -0
  144. package/dist/components/Icon/IconComponents/Heartbeat.es.js.map +1 -0
  145. package/dist/components/Icon/IconComponents/Info.cjs.js +2 -0
  146. package/dist/components/Icon/IconComponents/Info.cjs.js.map +1 -0
  147. package/dist/components/Icon/IconComponents/Info.es.js +27 -0
  148. package/dist/components/Icon/IconComponents/Info.es.js.map +1 -0
  149. package/dist/components/Icon/IconComponents/InfoOutline.cjs.js +2 -0
  150. package/dist/components/Icon/IconComponents/InfoOutline.cjs.js.map +1 -0
  151. package/dist/components/Icon/IconComponents/InfoOutline.es.js +30 -0
  152. package/dist/components/Icon/IconComponents/InfoOutline.es.js.map +1 -0
  153. package/dist/components/Icon/IconComponents/InstagramLogo.cjs.js +2 -0
  154. package/dist/components/Icon/IconComponents/InstagramLogo.cjs.js.map +1 -0
  155. package/dist/components/Icon/IconComponents/InstagramLogo.es.js +30 -0
  156. package/dist/components/Icon/IconComponents/InstagramLogo.es.js.map +1 -0
  157. package/dist/components/Icon/IconComponents/IntercomLogo.cjs.js +2 -0
  158. package/dist/components/Icon/IconComponents/IntercomLogo.cjs.js.map +1 -0
  159. package/dist/components/Icon/IconComponents/IntercomLogo.es.js +47 -0
  160. package/dist/components/Icon/IconComponents/IntercomLogo.es.js.map +1 -0
  161. package/dist/components/Icon/IconComponents/Lightning.cjs.js +2 -0
  162. package/dist/components/Icon/IconComponents/Lightning.cjs.js.map +1 -0
  163. package/dist/components/Icon/IconComponents/Lightning.es.js +26 -0
  164. package/dist/components/Icon/IconComponents/Lightning.es.js.map +1 -0
  165. package/dist/components/Icon/IconComponents/Link.cjs.js +2 -0
  166. package/dist/components/Icon/IconComponents/Link.cjs.js.map +1 -0
  167. package/dist/components/Icon/IconComponents/Link.es.js +23 -0
  168. package/dist/components/Icon/IconComponents/Link.es.js.map +1 -0
  169. package/dist/components/Icon/IconComponents/MessengerLogo.cjs.js +2 -0
  170. package/dist/components/Icon/IconComponents/MessengerLogo.cjs.js.map +1 -0
  171. package/dist/components/Icon/IconComponents/MessengerLogo.es.js +27 -0
  172. package/dist/components/Icon/IconComponents/MessengerLogo.es.js.map +1 -0
  173. package/dist/components/Icon/IconComponents/MusicNote.cjs.js +2 -0
  174. package/dist/components/Icon/IconComponents/MusicNote.cjs.js.map +1 -0
  175. package/dist/components/Icon/IconComponents/MusicNote.es.js +31 -0
  176. package/dist/components/Icon/IconComponents/MusicNote.es.js.map +1 -0
  177. package/dist/components/Icon/IconComponents/Pause.cjs.js +2 -0
  178. package/dist/components/Icon/IconComponents/Pause.cjs.js.map +1 -0
  179. package/dist/components/Icon/IconComponents/Pause.es.js +23 -0
  180. package/dist/components/Icon/IconComponents/Pause.es.js.map +1 -0
  181. package/dist/components/Icon/IconComponents/Pencil.cjs.js +2 -0
  182. package/dist/components/Icon/IconComponents/Pencil.cjs.js.map +1 -0
  183. package/dist/components/Icon/IconComponents/Pencil.es.js +23 -0
  184. package/dist/components/Icon/IconComponents/Pencil.es.js.map +1 -0
  185. package/dist/components/Icon/IconComponents/PhoneThick.cjs.js +2 -0
  186. package/dist/components/Icon/IconComponents/PhoneThick.cjs.js.map +1 -0
  187. package/dist/components/Icon/IconComponents/PhoneThick.es.js +27 -0
  188. package/dist/components/Icon/IconComponents/PhoneThick.es.js.map +1 -0
  189. package/dist/components/Icon/IconComponents/PhoneThin.cjs.js +2 -0
  190. package/dist/components/Icon/IconComponents/PhoneThin.cjs.js.map +1 -0
  191. package/dist/components/Icon/IconComponents/PhoneThin.es.js +27 -0
  192. package/dist/components/Icon/IconComponents/PhoneThin.es.js.map +1 -0
  193. package/dist/components/Icon/IconComponents/Play.cjs.js +2 -0
  194. package/dist/components/Icon/IconComponents/Play.cjs.js.map +1 -0
  195. package/dist/components/Icon/IconComponents/Play.es.js +23 -0
  196. package/dist/components/Icon/IconComponents/Play.es.js.map +1 -0
  197. package/dist/components/Icon/IconComponents/ProtonLogo.cjs.js +2 -0
  198. package/dist/components/Icon/IconComponents/ProtonLogo.cjs.js.map +1 -0
  199. package/dist/components/Icon/IconComponents/ProtonLogo.es.js +30 -0
  200. package/dist/components/Icon/IconComponents/ProtonLogo.es.js.map +1 -0
  201. package/dist/components/Icon/IconComponents/Quote.cjs.js +2 -0
  202. package/dist/components/Icon/IconComponents/Quote.cjs.js.map +1 -0
  203. package/dist/components/Icon/IconComponents/Quote.es.js +27 -0
  204. package/dist/components/Icon/IconComponents/Quote.es.js.map +1 -0
  205. package/dist/components/Icon/IconComponents/Search.cjs.js +2 -0
  206. package/dist/components/Icon/IconComponents/Search.cjs.js.map +1 -0
  207. package/dist/components/Icon/IconComponents/Search.es.js +27 -0
  208. package/dist/components/Icon/IconComponents/Search.es.js.map +1 -0
  209. package/dist/components/Icon/IconComponents/Share.cjs.js +2 -0
  210. package/dist/components/Icon/IconComponents/Share.cjs.js.map +1 -0
  211. package/dist/components/Icon/IconComponents/Share.es.js +27 -0
  212. package/dist/components/Icon/IconComponents/Share.es.js.map +1 -0
  213. package/dist/components/Icon/IconComponents/SignOut.cjs.js +2 -0
  214. package/dist/components/Icon/IconComponents/SignOut.cjs.js.map +1 -0
  215. package/dist/components/Icon/IconComponents/SignOut.es.js +32 -0
  216. package/dist/components/Icon/IconComponents/SignOut.es.js.map +1 -0
  217. package/dist/components/Icon/IconComponents/SoundcloudLogo.cjs.js +2 -0
  218. package/dist/components/Icon/IconComponents/SoundcloudLogo.cjs.js.map +1 -0
  219. package/dist/components/Icon/IconComponents/SoundcloudLogo.es.js +27 -0
  220. package/dist/components/Icon/IconComponents/SoundcloudLogo.es.js.map +1 -0
  221. package/dist/components/Icon/IconComponents/SpotifyLogo.cjs.js +2 -0
  222. package/dist/components/Icon/IconComponents/SpotifyLogo.cjs.js.map +1 -0
  223. package/dist/components/Icon/IconComponents/SpotifyLogo.es.js +41 -0
  224. package/dist/components/Icon/IconComponents/SpotifyLogo.es.js.map +1 -0
  225. package/dist/components/Icon/IconComponents/Spy.cjs.js +2 -0
  226. package/dist/components/Icon/IconComponents/Spy.cjs.js.map +1 -0
  227. package/dist/components/Icon/IconComponents/Spy.es.js +23 -0
  228. package/dist/components/Icon/IconComponents/Spy.es.js.map +1 -0
  229. package/dist/components/Icon/IconComponents/SuccessCircle.cjs.js +2 -0
  230. package/dist/components/Icon/IconComponents/SuccessCircle.cjs.js.map +1 -0
  231. package/dist/components/Icon/IconComponents/SuccessCircle.es.js +33 -0
  232. package/dist/components/Icon/IconComponents/SuccessCircle.es.js.map +1 -0
  233. package/dist/components/Icon/IconComponents/TelegramLogo.cjs.js +2 -0
  234. package/dist/components/Icon/IconComponents/TelegramLogo.cjs.js.map +1 -0
  235. package/dist/components/Icon/IconComponents/TelegramLogo.es.js +27 -0
  236. package/dist/components/Icon/IconComponents/TelegramLogo.es.js.map +1 -0
  237. package/dist/components/Icon/IconComponents/TiktokLogo.cjs.js +2 -0
  238. package/dist/components/Icon/IconComponents/TiktokLogo.cjs.js.map +1 -0
  239. package/dist/components/Icon/IconComponents/TiktokLogo.es.js +27 -0
  240. package/dist/components/Icon/IconComponents/TiktokLogo.es.js.map +1 -0
  241. package/dist/components/Icon/IconComponents/Tracklist.cjs.js +2 -0
  242. package/dist/components/Icon/IconComponents/Tracklist.cjs.js.map +1 -0
  243. package/dist/components/Icon/IconComponents/Tracklist.es.js +27 -0
  244. package/dist/components/Icon/IconComponents/Tracklist.es.js.map +1 -0
  245. package/dist/components/Icon/IconComponents/TrashCan.cjs.js +2 -0
  246. package/dist/components/Icon/IconComponents/TrashCan.cjs.js.map +1 -0
  247. package/dist/components/Icon/IconComponents/TrashCan.es.js +23 -0
  248. package/dist/components/Icon/IconComponents/TrashCan.es.js.map +1 -0
  249. package/dist/components/Icon/IconComponents/TraxsourceLogo.cjs.js +2 -0
  250. package/dist/components/Icon/IconComponents/TraxsourceLogo.cjs.js.map +1 -0
  251. package/dist/components/Icon/IconComponents/TraxsourceLogo.es.js +27 -0
  252. package/dist/components/Icon/IconComponents/TraxsourceLogo.es.js.map +1 -0
  253. package/dist/components/Icon/IconComponents/User.cjs.js +2 -0
  254. package/dist/components/Icon/IconComponents/User.cjs.js.map +1 -0
  255. package/dist/components/Icon/IconComponents/User.es.js +35 -0
  256. package/dist/components/Icon/IconComponents/User.es.js.map +1 -0
  257. package/dist/components/Icon/IconComponents/Users.cjs.js +2 -0
  258. package/dist/components/Icon/IconComponents/Users.cjs.js.map +1 -0
  259. package/dist/components/Icon/IconComponents/Users.es.js +23 -0
  260. package/dist/components/Icon/IconComponents/Users.es.js.map +1 -0
  261. package/dist/components/Icon/IconComponents/WarningTriangle.cjs.js +2 -0
  262. package/dist/components/Icon/IconComponents/WarningTriangle.cjs.js.map +1 -0
  263. package/dist/components/Icon/IconComponents/WarningTriangle.es.js +27 -0
  264. package/dist/components/Icon/IconComponents/WarningTriangle.es.js.map +1 -0
  265. package/dist/components/Icon/IconComponents/WhatsappLogoThick.cjs.js +2 -0
  266. package/dist/components/Icon/IconComponents/WhatsappLogoThick.cjs.js.map +1 -0
  267. package/dist/components/Icon/IconComponents/WhatsappLogoThick.es.js +47 -0
  268. package/dist/components/Icon/IconComponents/WhatsappLogoThick.es.js.map +1 -0
  269. package/dist/components/Icon/IconComponents/WhatsappLogoThin.cjs.js +2 -0
  270. package/dist/components/Icon/IconComponents/WhatsappLogoThin.cjs.js.map +1 -0
  271. package/dist/components/Icon/IconComponents/WhatsappLogoThin.es.js +33 -0
  272. package/dist/components/Icon/IconComponents/WhatsappLogoThin.es.js.map +1 -0
  273. package/dist/components/Icon/IconComponents/XTwitterLogo.cjs.js +2 -0
  274. package/dist/components/Icon/IconComponents/XTwitterLogo.cjs.js.map +1 -0
  275. package/dist/components/Icon/IconComponents/XTwitterLogo.es.js +27 -0
  276. package/dist/components/Icon/IconComponents/XTwitterLogo.es.js.map +1 -0
  277. package/dist/components/Icon/IconComponents/YandexLogo.cjs.js +2 -0
  278. package/dist/components/Icon/IconComponents/YandexLogo.cjs.js.map +1 -0
  279. package/dist/components/Icon/IconComponents/YandexLogo.es.js +33 -0
  280. package/dist/components/Icon/IconComponents/YandexLogo.es.js.map +1 -0
  281. package/dist/components/Icon/IconComponents/YoutubeLogo.cjs.js +2 -0
  282. package/dist/components/Icon/IconComponents/YoutubeLogo.cjs.js.map +1 -0
  283. package/dist/components/Icon/IconComponents/YoutubeLogo.es.js +35 -0
  284. package/dist/components/Icon/IconComponents/YoutubeLogo.es.js.map +1 -0
  285. package/dist/components/Icon/IconProps.cjs.js +2 -0
  286. package/dist/components/Icon/IconProps.cjs.js.map +1 -0
  287. package/dist/components/Icon/IconProps.es.js +35 -0
  288. package/dist/components/Icon/IconProps.es.js.map +1 -0
  289. package/dist/components/Input/CopyInput/CopyInput.cjs.js +1 -1
  290. package/dist/components/Input/CopyInput/CopyInput.cjs.js.map +1 -1
  291. package/dist/components/Input/CopyInput/CopyInput.es.js +26 -48
  292. package/dist/components/Input/CopyInput/CopyInput.es.js.map +1 -1
  293. package/dist/components/Input/SearchInput/SearchInput.cjs.js.map +1 -1
  294. package/dist/components/Input/SearchInput/SearchInput.es.js.map +1 -1
  295. package/dist/components/Menu/MenuTrigger.cjs.js +1 -1
  296. package/dist/components/Menu/MenuTrigger.cjs.js.map +1 -1
  297. package/dist/components/Menu/MenuTrigger.es.js +51 -54
  298. package/dist/components/Menu/MenuTrigger.es.js.map +1 -1
  299. package/dist/components/Menu/PopoverMenu.cjs.js +1 -1
  300. package/dist/components/Menu/PopoverMenu.cjs.js.map +1 -1
  301. package/dist/components/Menu/PopoverMenu.es.js +23 -36
  302. package/dist/components/Menu/PopoverMenu.es.js.map +1 -1
  303. package/dist/components/Select/Select.cjs.js +1 -1
  304. package/dist/components/Select/Select.cjs.js.map +1 -1
  305. package/dist/components/Select/Select.es.js +81 -98
  306. package/dist/components/Select/Select.es.js.map +1 -1
  307. package/dist/components/Table/DataTable/DataTable.cjs.js +1 -1
  308. package/dist/components/Table/DataTable/DataTable.cjs.js.map +1 -1
  309. package/dist/components/Table/DataTable/DataTable.es.js +5 -6
  310. package/dist/components/Table/DataTable/DataTable.es.js.map +1 -1
  311. package/dist/components/Tooltip/ResponsiveTooltip.cjs.js +1 -1
  312. package/dist/components/Tooltip/ResponsiveTooltip.cjs.js.map +1 -1
  313. package/dist/components/Tooltip/ResponsiveTooltip.es.js +37 -36
  314. package/dist/components/Tooltip/ResponsiveTooltip.es.js.map +1 -1
  315. package/dist/hooks.cjs.js +1 -1
  316. package/dist/hooks.d.ts +0 -18
  317. package/dist/hooks.es.js +5 -9
  318. package/dist/hooks.es.js.map +1 -1
  319. package/dist/index.cjs.js +1 -1
  320. package/dist/index.d.ts +568 -19
  321. package/dist/index.es.js +206 -73
  322. package/dist/index.es.js.map +1 -1
  323. package/package.json +1 -1
  324. package/dist/assets/svg/icons.svg.cjs.js +0 -2
  325. package/dist/assets/svg/icons.svg.cjs.js.map +0 -1
  326. package/dist/assets/svg/icons.svg.es.js +0 -5
  327. package/dist/assets/svg/icons.svg.es.js.map +0 -1
  328. package/dist/components/Icon/Icon.cjs.js +0 -2
  329. package/dist/components/Icon/Icon.cjs.js.map +0 -1
  330. package/dist/components/Icon/Icon.es.js +0 -42
  331. package/dist/components/Icon/Icon.es.js.map +0 -1
  332. package/dist/hooks/useResponsiveDevice.cjs.js +0 -2
  333. package/dist/hooks/useResponsiveDevice.cjs.js.map +0 -1
  334. package/dist/hooks/useResponsiveDevice.es.js +0 -14
  335. package/dist/hooks/useResponsiveDevice.es.js.map +0 -1
  336. package/dist/hooks/useTouchDevice.cjs.js +0 -2
  337. package/dist/hooks/useTouchDevice.cjs.js.map +0 -1
  338. package/dist/hooks/useTouchDevice.es.js +0 -13
  339. package/dist/hooks/useTouchDevice.es.js.map +0 -1
  340. package/dist/icons.svg +0 -11
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../node_modules/react/jsx-runtime.cjs.js"),s=require("react"),H=require("../../hooks/useIsClosing.cjs.js"),P=require("../../hooks/useLockBodyScroll.cjs.js"),G=require("../Button/Button.cjs.js"),L=require("../ScreenOverlay/ScreenOverlay.cjs.js"),i=require("radix-ui"),N=require("../Icon/Icon.cjs.js");;/* empty css */const D=require("../../utils/navigation.cjs.js"),T=({isOpen:e,actions:a=[],children:o,showCancel:l=!0,cancelButtonText:m="Cancel",selectionMode:E="single",selectedKeys:x,disabledKeys:h=[],onSelectionChange:p,onClose:f,title:j,"data-testid":r})=>{var $;P.useLockBodyScroll(e);const[u,c]=s.useState(0),[t,d]=s.useState([]),[A,_]=s.useState({title:j,actions:a,key:null,previousKey:null}),g=s.useRef(null),C=s.useRef(null),S=s.useRef(null),{isClosing:M,handleClose:b}=H.useIsClosing({onClose:f,overlayRef:S}),v=A.actions||[],w=v&&v.length>0,I=o||w||l,q=t.length>0;function B(R){const y=v.find(k=>k.key===R);if(!y){console.error(`Action with key ${R} not found`);return}d(k=>[...k,A]),_(k=>({title:y.label,actions:y.children,key:y.key,previousKey:k.key}))}function F(){if(t.length>0){const R=t[t.length-1];_(R),d(t.slice(0,-1))}}return s.useEffect(()=>{e&&requestAnimationFrame(()=>{g.current&&c(g.current.scrollHeight+12)})},[e,t,I]),s.useEffect(()=>{(!e||M)&&c(0)},[e,M]),!e&&!M?null:n.jsxRuntimeExports.jsx(L.ScreenOverlay,{fadeIn:!0,ref:S,children:n.jsxRuntimeExports.jsxs(i.DropdownMenu.Root,{modal:!0,open:e,onOpenChange:R=>{R||b()},children:[n.jsxRuntimeExports.jsx(i.DropdownMenu.Trigger,{asChild:!0,children:n.jsxRuntimeExports.jsx("div",{children:""})}),n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__background-wrapper",style:{opacity:M?0:1},children:n.jsxRuntimeExports.jsx("div",{"data-testid":r||"ActionMenu-wrapper",className:"proton-ActionMenu__wrapper",children:n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__card","data-testid":"ActionMenu-content",style:{height:`${u}px`},children:n.jsxRuntimeExports.jsx("div",{ref:C,className:"proton-ActionMenu__menu",children:n.jsxRuntimeExports.jsx(i.DropdownMenu.Content,{loop:!0,sideOffset:8,ref:g,children:I&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[o&&n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__content",children:typeof o=="function"?o({close:b}):o}),w&&n.jsxRuntimeExports.jsx(z,{actions:v,selectionMode:E,selectedKeys:x,onSelectionChange:p,disabledKeys:h,handleSubmenuOpen:B,title:A.title,isInSubmenu:q,handleBack:F,previousMenuTitle:($=t[t.length-1])==null?void 0:$.title}),l&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(i.DropdownMenu.Separator,{}),n.jsxRuntimeExports.jsx(i.DropdownMenu.Item,{className:"proton-ActionMenu__cancel-button",children:n.jsxRuntimeExports.jsx(G.Button,{"data-testid":"ActionMenuItem-cancel",onPress:b,fullWidth:!0,variant:"secondary",children:m})})]})]})})})})})})]})})},z=({actions:e,selectionMode:a,selectedKeys:o=[],onSelectionChange:l,disabledKeys:m=[],handleSubmenuOpen:E,title:x,isInSubmenu:h=!1,handleBack:p,previousMenuTitle:f})=>{const j=()=>n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[h&&p&&n.jsxRuntimeExports.jsxs("div",{className:"proton-ActionMenu__back-button-container",children:[n.jsxRuntimeExports.jsx(i.DropdownMenu.Item,{className:"proton-ActionMenu__back-button",onSelect:r=>{r.preventDefault(),p()},"aria-label":`Go back to ${f||"previous menu"}`,children:n.jsxRuntimeExports.jsx(N.Icon,{id:"chevron-left",size:16,"aria-hidden":"true"})}),n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__title",role:"banner","aria-label":h?`Submenu: ${x}`:`Menu: ${x}`,children:n.jsxRuntimeExports.jsx("span",{children:x})}),n.jsxRuntimeExports.jsx(i.DropdownMenu.Separator,{})]}),e.map((r,u)=>{var t;const c=e[u];return n.jsxRuntimeExports.jsx(U,{item:r,isSubmenu:!!((t=c.children)!=null&&t.length),selectionMode:a,onSelectionChange:l,selectedKeys:o,disabledKeys:m,handleSubmenuOpen:E},r.key)})]});return n.jsxRuntimeExports.jsx("div",{"aria-disabled":a==="none",className:"proton-ActionMenu__list",role:"menu","aria-label":x?`${h?"Submenu":"Menu"}: ${x}`:"Action menu","aria-orientation":"vertical",children:a==="single"?n.jsxRuntimeExports.jsx(i.DropdownMenu.RadioGroup,{value:(o==null?void 0:o[0])||"",onValueChange:r=>{var c;const u=e.find(t=>t.key===r);(c=u==null?void 0:u.children)!=null&&c.length||l&&l(new Set([r]))},children:n.jsxRuntimeExports.jsx(j,{})}):n.jsxRuntimeExports.jsx(i.DropdownMenu.Group,{children:n.jsxRuntimeExports.jsx(j,{})})})},U=({item:e,isSubmenu:a,selectionMode:o,onSelectionChange:l,selectedKeys:m=[],disabledKeys:E=[],handleSubmenuOpen:x})=>{const h=s.useRef(null),p=e.to&&D.isUrlExternal(e.to),f=E.includes(e.key),j=m.includes(e.key),r={className:"proton-ActionMenu__item","aria-label":e.label?`${e.label}${e.description?`, ${e.description}`:""}`:`ActionMenu-Item-${e.key}`,role:"menuitem",disabled:f,ref:h},u=t=>{var d;if((d=e==null?void 0:e.children)!=null&&d.length){t.preventDefault(),x(e.key);return}e.onAction&&e.onAction(e.key)},c=n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs("div",{className:"proton-ActionMenu__item-content",children:[n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__item-label",children:e.label}),e.description&&n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__description",children:e.description})]}),a&&n.jsxRuntimeExports.jsx(N.Icon,{id:"chevron-right",size:16,"aria-hidden":"true"})]});return e.to?s.createElement(i.DropdownMenu.Item,{...r,key:e.key,asChild:!0},n.jsxRuntimeExports.jsx("a",{"aria-label":e.label?`${e.label}${e.description?`, ${e.description}`:""}`:`ActionMenu-Item-${e.key}`,"aria-disabled":f,"aria-checked":j,"aria-expanded":a?!1:void 0,href:e.to,target:p?"_blank":void 0,rel:p?"noopener noreferrer":void 0,onClick:t=>{p||!e.to||D.handleInternalNavigation(t,e.to)},children:c})):o==="multiple"?s.createElement(i.DropdownMenu.CheckboxItem,{...r,key:e.key,checked:j,onSelect:u,onCheckedChange:t=>{if(!l)return;const d=new Set(m);t?d.add(e.key):d.delete(e.key),l(d)}},c):s.createElement(i.DropdownMenu.RadioItem,{...r,value:e.key,key:e.key,"aria-checked":j,"aria-expanded":a?!1:void 0,onSelect:u},c)};exports.ActionMenu=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../node_modules/react/jsx-runtime.cjs.js"),s=require("react"),F=require("../../hooks/useIsClosing.cjs.js"),H=require("../../hooks/useLockBodyScroll.cjs.js"),L=require("../Button/Button.cjs.js"),P=require("../ScreenOverlay/ScreenOverlay.cjs.js"),i=require("radix-ui"),G=require("../Icon/IconComponents/ChevronLeft.cjs.js"),T=require("../Icon/IconComponents/ChevronRight.cjs.js");;/* empty css */const D=require("../../utils/navigation.cjs.js"),z=({isOpen:e,actions:a=[],children:o,showCancel:l=!0,cancelButtonText:m="Cancel",selectionMode:E="single",selectedKeys:x,disabledKeys:h=[],onSelectionChange:p,onClose:f,title:j,"data-testid":r})=>{var $;H.useLockBodyScroll(e);const[c,u]=s.useState(0),[t,d]=s.useState([]),[A,_]=s.useState({title:j,actions:a,key:null,previousKey:null}),g=s.useRef(null),N=s.useRef(null),S=s.useRef(null),{isClosing:M,handleClose:b}=F.useIsClosing({onClose:f,overlayRef:S}),v=A.actions||[],w=v&&v.length>0,C=o||w||l,I=t.length>0;function q(R){const y=v.find(k=>k.key===R);if(!y){console.error(`Action with key ${R} not found`);return}d(k=>[...k,A]),_(k=>({title:y.label,actions:y.children,key:y.key,previousKey:k.key}))}function B(){if(t.length>0){const R=t[t.length-1];_(R),d(t.slice(0,-1))}}return s.useEffect(()=>{e&&requestAnimationFrame(()=>{g.current&&u(g.current.scrollHeight+12)})},[e,t,C]),s.useEffect(()=>{(!e||M)&&u(0)},[e,M]),!e&&!M?null:n.jsxRuntimeExports.jsx(P.ScreenOverlay,{fadeIn:!0,ref:S,children:n.jsxRuntimeExports.jsxs(i.DropdownMenu.Root,{modal:!0,open:e,onOpenChange:R=>{R||b()},children:[n.jsxRuntimeExports.jsx(i.DropdownMenu.Trigger,{asChild:!0,children:n.jsxRuntimeExports.jsx("div",{children:""})}),n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__background-wrapper",style:{opacity:M?0:1},children:n.jsxRuntimeExports.jsx("div",{"data-testid":r||"ActionMenu-wrapper",className:"proton-ActionMenu__wrapper",children:n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__card","data-testid":"ActionMenu-content",style:{height:`${c}px`},children:n.jsxRuntimeExports.jsx("div",{ref:N,className:"proton-ActionMenu__menu",children:n.jsxRuntimeExports.jsx(i.DropdownMenu.Content,{loop:!0,sideOffset:8,ref:g,children:C&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[o&&n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__content",children:typeof o=="function"?o({close:b}):o}),w&&n.jsxRuntimeExports.jsx(U,{actions:v,selectionMode:E,selectedKeys:x,onSelectionChange:p,disabledKeys:h,handleSubmenuOpen:q,title:A.title,isInSubmenu:I,handleBack:B,previousMenuTitle:($=t[t.length-1])==null?void 0:$.title}),l&&n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx(i.DropdownMenu.Separator,{}),n.jsxRuntimeExports.jsx(i.DropdownMenu.Item,{className:"proton-ActionMenu__cancel-button",children:n.jsxRuntimeExports.jsx(L.Button,{"data-testid":"ActionMenuItem-cancel",onPress:b,fullWidth:!0,variant:"secondary",children:m})})]})]})})})})})})]})})},U=({actions:e,selectionMode:a,selectedKeys:o=[],onSelectionChange:l,disabledKeys:m=[],handleSubmenuOpen:E,title:x,isInSubmenu:h=!1,handleBack:p,previousMenuTitle:f})=>{const j=()=>n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[h&&p&&n.jsxRuntimeExports.jsxs("div",{className:"proton-ActionMenu__back-button-container",children:[n.jsxRuntimeExports.jsx(i.DropdownMenu.Item,{className:"proton-ActionMenu__back-button",onSelect:r=>{r.preventDefault(),p()},"aria-label":`Go back to ${f||"previous menu"}`,children:n.jsxRuntimeExports.jsx(G.ChevronLeft,{size:16})}),n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__title",role:"banner","aria-label":h?`Submenu: ${x}`:`Menu: ${x}`,children:n.jsxRuntimeExports.jsx("span",{children:x})}),n.jsxRuntimeExports.jsx(i.DropdownMenu.Separator,{})]}),e.map((r,c)=>{var t;const u=e[c];return n.jsxRuntimeExports.jsx(V,{item:r,isSubmenu:!!((t=u.children)!=null&&t.length),selectionMode:a,onSelectionChange:l,selectedKeys:o,disabledKeys:m,handleSubmenuOpen:E},r.key)})]});return n.jsxRuntimeExports.jsx("div",{"aria-disabled":a==="none",className:"proton-ActionMenu__list",role:"menu","aria-label":x?`${h?"Submenu":"Menu"}: ${x}`:"Action menu","aria-orientation":"vertical",children:a==="single"?n.jsxRuntimeExports.jsx(i.DropdownMenu.RadioGroup,{value:(o==null?void 0:o[0])||"",onValueChange:r=>{var u;const c=e.find(t=>t.key===r);(u=c==null?void 0:c.children)!=null&&u.length||l&&l(new Set([r]))},children:n.jsxRuntimeExports.jsx(j,{})}):n.jsxRuntimeExports.jsx(i.DropdownMenu.Group,{children:n.jsxRuntimeExports.jsx(j,{})})})},V=({item:e,isSubmenu:a,selectionMode:o,onSelectionChange:l,selectedKeys:m=[],disabledKeys:E=[],handleSubmenuOpen:x})=>{const h=s.useRef(null),p=e.to&&D.isUrlExternal(e.to),f=E.includes(e.key),j=m.includes(e.key),r={className:"proton-ActionMenu__item","aria-label":e.label?`${e.label}${e.description?`, ${e.description}`:""}`:`ActionMenu-Item-${e.key}`,role:"menuitem",disabled:f,ref:h},c=t=>{var d;if((d=e==null?void 0:e.children)!=null&&d.length){t.preventDefault(),x(e.key);return}e.onAction&&e.onAction(e.key)},u=n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsxs("div",{className:"proton-ActionMenu__item-content",children:[n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__item-label",children:e.label}),e.description&&n.jsxRuntimeExports.jsx("div",{className:"proton-ActionMenu__description",children:e.description})]}),a&&n.jsxRuntimeExports.jsx(T.ChevronRight,{size:16})]});return e.to?s.createElement(i.DropdownMenu.Item,{...r,key:e.key,asChild:!0},n.jsxRuntimeExports.jsx("a",{"aria-label":e.label?`${e.label}${e.description?`, ${e.description}`:""}`:`ActionMenu-Item-${e.key}`,"aria-disabled":f,"aria-checked":j,"aria-expanded":a?!1:void 0,href:e.to,target:p?"_blank":void 0,rel:p?"noopener noreferrer":void 0,onClick:t=>{p||!e.to||D.handleInternalNavigation(t,e.to)},children:u})):o==="multiple"?s.createElement(i.DropdownMenu.CheckboxItem,{...r,key:e.key,checked:j,onSelect:c,onCheckedChange:t=>{if(!l)return;const d=new Set(m);t?d.add(e.key):d.delete(e.key),l(d)}},u):s.createElement(i.DropdownMenu.RadioItem,{...r,value:e.key,key:e.key,"aria-checked":j,"aria-expanded":a?!1:void 0,onSelect:c},u)};exports.ActionMenu=z;
2
2
  //# sourceMappingURL=ActionMenu.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionMenu.cjs.js","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode, useEffect, useRef, useState } from \"react\";\nimport type { Selection } from \"@react-types/shared\";\n\nimport { useIsClosing } from \"../../hooks/useIsClosing\";\nimport { useLockBodyScroll } from \"../../hooks/useLockBodyScroll\";\nimport { handleInternalNavigation, isUrlExternal } from \"../../utils\";\n\nimport { Button } from \"../Button/Button\";\nimport { ScreenOverlay } from \"../ScreenOverlay/ScreenOverlay\";\nimport { DropdownMenu } from \"radix-ui\";\nimport { Icon } from \"../Icon/Icon\";\n\nimport \"./ActionMenu.css\";\n\nexport interface ActionMenuAction {\n key: string;\n label?: ReactNode;\n description?: ReactNode;\n to?: string;\n onAction?: (key: string) => void;\n children?: ActionMenuAction[];\n}\n\nexport type ActionMenuSelectionMode = \"single\" | \"multiple\" | \"none\";\n\nexport interface ActionMenuProps {\n /** The actions of the menu\n * - type {@link ActionMenuAction}[]\n */\n actions?: ActionMenuAction[];\n\n /** The text of the cancel button */\n cancelButtonText?: string;\n\n /** The children of the menu */\n children?: ReactNode | ((props: { close: () => void }) => ReactNode);\n\n /** The test id of the menu */\n \"data-testid\"?: string;\n\n /** The keys of the disabled items\n * @default []\n */\n disabledKeys?: string[];\n\n /** Whether the menu is open\n * @default false\n */\n isOpen: boolean;\n\n /** The callback function to close the menu */\n onClose?: () => void;\n\n /** The callback function to change the selection\n * - type {@link Selection}\n */\n onSelectionChange?: (keys: Selection) => void;\n\n /** The selection mode of the menu\n * @default \"single\"\n */\n selectionMode?: ActionMenuSelectionMode;\n\n /** The keys of the selected items */\n selectedKeys?: string[];\n\n /** Whether to show the cancel button */\n showCancel?: boolean;\n\n /** The title of the menu */\n title?: string;\n}\n\ntype ActionStack = {\n title: ReactNode | null;\n actions: ActionMenuAction[];\n key: string | null;\n previousKey: string | null;\n};\n\n/**\n * A controlled ActionMenu to display a menu of actions.\n * Renders a list of actions as a focusable menu, or non-focusable children.\n *\n * API:\n * - {@link ActionMenuProps}\n */\nexport const ActionMenu = ({\n isOpen,\n actions = [],\n children,\n showCancel = true,\n cancelButtonText = \"Cancel\",\n selectionMode = \"single\",\n selectedKeys,\n disabledKeys = [],\n onSelectionChange,\n onClose,\n title,\n \"data-testid\": testId,\n}: ActionMenuProps) => {\n useLockBodyScroll(isOpen);\n const [contentHeight, setContentHeight] = useState<number>(0);\n const [stackHistory, setStackHistory] = useState<ActionStack[]>([]);\n const [currentActionStack, setCurrentActionStack] = useState<ActionStack>({\n title,\n actions,\n key: null,\n previousKey: null,\n });\n const contentRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n const { isClosing, handleClose } = useIsClosing({ onClose, overlayRef });\n\n const currentActions = currentActionStack.actions || [];\n const hasActions = currentActions && currentActions.length > 0;\n const hasContent = children || hasActions || showCancel;\n const isInSubmenu = stackHistory.length > 0;\n\n function handleSubmenuOpen(key: string) {\n const action = currentActions.find((action) => action.key === key);\n if (!action) {\n console.error(`Action with key ${key} not found`);\n return;\n }\n\n setStackHistory((prevStackHistory) => [\n ...prevStackHistory,\n currentActionStack,\n ]);\n setCurrentActionStack((prevStack) => ({\n title: action.label,\n actions: action.children,\n key: action.key,\n previousKey: prevStack.key,\n }));\n }\n\n function handleBack() {\n if (stackHistory.length > 0) {\n const previousStack = stackHistory[stackHistory.length - 1];\n setCurrentActionStack(previousStack);\n setStackHistory(stackHistory.slice(0, -1));\n }\n }\n\n // Re-measure the open menu's content height when stack history changes\n useEffect(() => {\n if (!isOpen) return;\n\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContentHeight(contentRef.current.scrollHeight + 12);\n }\n });\n }, [isOpen, stackHistory, hasContent]);\n\n // Reset content height when menu closes or is closing\n useEffect(() => {\n if (!isOpen || isClosing) {\n setContentHeight(0);\n }\n }, [isOpen, isClosing]);\n\n if (!isOpen && !isClosing) return null;\n\n return (\n <ScreenOverlay fadeIn ref={overlayRef}>\n <DropdownMenu.Root\n modal\n open={isOpen}\n onOpenChange={(open) => {\n if (!open) handleClose();\n }}\n >\n <DropdownMenu.Trigger asChild>\n {/* No visible trigger, menu is controlled by isOpen */}\n <div>{\"\"}</div>\n </DropdownMenu.Trigger>\n\n <div\n className=\"proton-ActionMenu__background-wrapper\"\n style={{ opacity: isClosing ? 0 : 1 }}\n >\n <div\n data-testid={testId || \"ActionMenu-wrapper\"}\n className=\"proton-ActionMenu__wrapper\"\n >\n <div\n className=\"proton-ActionMenu__card\"\n data-testid=\"ActionMenu-content\"\n style={{ height: `${contentHeight}px` }}\n >\n <div ref={menuRef} className=\"proton-ActionMenu__menu\">\n <DropdownMenu.Content loop sideOffset={8} ref={contentRef}>\n {hasContent && (\n <>\n {children && (\n <div className=\"proton-ActionMenu__content\">\n {typeof children === \"function\"\n ? children({ close: handleClose })\n : children}\n </div>\n )}\n\n {hasActions && (\n <ActionMenuList\n actions={currentActions}\n selectionMode={selectionMode}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n title={currentActionStack.title}\n isInSubmenu={isInSubmenu}\n handleBack={handleBack}\n previousMenuTitle={\n stackHistory[stackHistory.length - 1]?.title\n }\n />\n )}\n\n {showCancel && (\n <>\n <DropdownMenu.Separator />\n <DropdownMenu.Item className=\"proton-ActionMenu__cancel-button\">\n <Button\n data-testid=\"ActionMenuItem-cancel\"\n onPress={handleClose}\n fullWidth\n variant=\"secondary\"\n >\n {cancelButtonText}\n </Button>\n </DropdownMenu.Item>\n </>\n )}\n </>\n )}\n </DropdownMenu.Content>\n </div>\n </div>\n </div>\n </div>\n </DropdownMenu.Root>\n </ScreenOverlay>\n );\n};\n\ninterface ActionMenuListProps {\n actions: ActionMenuAction[];\n selectionMode: ActionMenuSelectionMode;\n selectedKeys?: string[];\n onSelectionChange?: (keys: Selection) => void;\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n title?: ReactNode;\n isInSubmenu?: boolean;\n handleBack?: () => void;\n previousMenuTitle?: ReactNode;\n}\n\nconst ActionMenuList = ({\n actions,\n selectionMode,\n selectedKeys = [],\n onSelectionChange,\n disabledKeys = [],\n handleSubmenuOpen,\n title,\n isInSubmenu = false,\n handleBack,\n previousMenuTitle,\n}: ActionMenuListProps) => {\n const ActionMenuItemMap = () => (\n <>\n {isInSubmenu && handleBack && (\n <div className=\"proton-ActionMenu__back-button-container\">\n <DropdownMenu.Item\n className=\"proton-ActionMenu__back-button\"\n onSelect={(event) => {\n event.preventDefault();\n handleBack();\n }}\n aria-label={`Go back to ${previousMenuTitle || \"previous menu\"}`}\n >\n <Icon id=\"chevron-left\" size={16} aria-hidden=\"true\" />\n </DropdownMenu.Item>\n <div\n className=\"proton-ActionMenu__title\"\n role=\"banner\"\n aria-label={isInSubmenu ? `Submenu: ${title}` : `Menu: ${title}`}\n >\n <span>{title}</span>\n </div>\n <DropdownMenu.Separator />\n </div>\n )}\n\n {actions.map((action, i) => {\n const itemProps = actions[i];\n return (\n <ActionMenuItem\n key={action.key}\n item={action}\n isSubmenu={Boolean(itemProps.children?.length)}\n selectionMode={selectionMode}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedKeys}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n />\n );\n })}\n </>\n );\n\n return (\n <div\n aria-disabled={selectionMode === \"none\"}\n className=\"proton-ActionMenu__list\"\n role=\"menu\"\n aria-label={\n title ? `${isInSubmenu ? \"Submenu\" : \"Menu\"}: ${title}` : \"Action menu\"\n }\n aria-orientation=\"vertical\"\n >\n {selectionMode === \"single\" ? (\n <DropdownMenu.RadioGroup\n value={selectedKeys?.[0] || \"\"}\n onValueChange={(value) => {\n // Check if this is a submenu item - if so, don't trigger selection change\n const action = actions.find((action) => action.key === value);\n if (action?.children?.length) {\n return;\n }\n\n if (onSelectionChange) {\n onSelectionChange(new Set([value]));\n }\n }}\n >\n <ActionMenuItemMap />\n </DropdownMenu.RadioGroup>\n ) : (\n <DropdownMenu.Group>\n <ActionMenuItemMap />\n </DropdownMenu.Group>\n )}\n </div>\n );\n};\n\ninterface ActionMenuItemProps {\n to?: string;\n item: ActionMenuAction;\n isSubmenu?: boolean;\n selectionMode: ActionMenuSelectionMode;\n onSelectionChange?: (keys: Selection) => void;\n selectedKeys?: string[];\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n}\n\nconst ActionMenuItem = ({\n item,\n isSubmenu,\n selectionMode,\n onSelectionChange,\n selectedKeys = [],\n disabledKeys = [],\n handleSubmenuOpen,\n}: ActionMenuItemProps) => {\n const ref = useRef(null);\n const isExternal = item.to && isUrlExternal(item.to);\n const isDisabled = disabledKeys.includes(item.key);\n const isSelected = selectedKeys.includes(item.key);\n\n const radixItemProps = {\n className: \"proton-ActionMenu__item\",\n \"aria-label\": item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`,\n role: \"menuitem\",\n disabled: isDisabled,\n ref,\n };\n\n const onSelect = (event: Event) => {\n if (item?.children?.length) {\n event.preventDefault();\n handleSubmenuOpen(item.key);\n return;\n }\n if (item.onAction) {\n item.onAction(item.key);\n }\n };\n\n const content = (\n <>\n <div className=\"proton-ActionMenu__item-content\">\n <div className=\"proton-ActionMenu__item-label\">{item.label}</div>\n {item.description && (\n <div className=\"proton-ActionMenu__description\">\n {item.description}\n </div>\n )}\n </div>\n {isSubmenu && <Icon id=\"chevron-right\" size={16} aria-hidden=\"true\" />}\n </>\n );\n\n if (item.to) {\n return (\n <DropdownMenu.Item {...radixItemProps} key={item.key} asChild>\n <a\n aria-label={\n item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`\n }\n aria-disabled={isDisabled}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n href={item.to}\n target={isExternal ? \"_blank\" : undefined}\n rel={isExternal ? \"noopener noreferrer\" : undefined}\n onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {\n if (isExternal || !item.to) {\n return;\n }\n handleInternalNavigation(e, item.to);\n }}\n >\n {content}\n </a>\n </DropdownMenu.Item>\n );\n }\n\n if (selectionMode === \"multiple\") {\n return (\n <DropdownMenu.CheckboxItem\n {...radixItemProps}\n key={item.key}\n checked={isSelected}\n onSelect={onSelect}\n onCheckedChange={(checked: boolean) => {\n if (!onSelectionChange) return;\n\n const currentKeys = new Set(selectedKeys);\n if (checked) {\n currentKeys.add(item.key);\n } else {\n currentKeys.delete(item.key);\n }\n onSelectionChange(currentKeys);\n }}\n >\n {content}\n </DropdownMenu.CheckboxItem>\n );\n }\n\n return (\n <DropdownMenu.RadioItem\n {...radixItemProps}\n value={item.key}\n key={item.key}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n onSelect={onSelect}\n >\n {content}\n </DropdownMenu.RadioItem>\n );\n};\n"],"names":["ActionMenu","isOpen","actions","children","showCancel","cancelButtonText","selectionMode","selectedKeys","disabledKeys","onSelectionChange","onClose","title","testId","useLockBodyScroll","contentHeight","setContentHeight","useState","stackHistory","setStackHistory","currentActionStack","setCurrentActionStack","contentRef","useRef","menuRef","overlayRef","isClosing","handleClose","useIsClosing","currentActions","hasActions","hasContent","isInSubmenu","handleSubmenuOpen","key","action","prevStackHistory","prevStack","handleBack","previousStack","useEffect","jsx","ScreenOverlay","jsxs","DropdownMenu","open","Fragment","ActionMenuList","_a","Button","previousMenuTitle","ActionMenuItemMap","event","Icon","i","itemProps","ActionMenuItem","value","item","isSubmenu","ref","isExternal","isUrlExternal","isDisabled","isSelected","radixItemProps","onSelect","content","createElement","e","handleInternalNavigation","checked","currentKeys"],"mappings":"oeAyFaA,EAAa,CAAC,CACzB,OAAAC,EACA,QAAAC,EAAU,CAAC,EACX,SAAAC,EACA,WAAAC,EAAa,GACb,iBAAAC,EAAmB,SACnB,cAAAC,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,GAAQ,OACnC,KAAMD,EAAK,GACX,OAAQG,EAAa,SAAW,OAChC,IAAKA,EAAa,sBAAwB,OAC1C,QAAUQ,GAA2C,CAC/CR,GAAc,CAACH,EAAK,IAGCY,EAAAA,yBAAAD,EAAGX,EAAK,EAAE,CACrC,EAEC,SAAAS,CAAA,CAAA,CAEL,EAIA5D,IAAkB,WAElB6D,EAAA,cAACxB,EAAAA,aAAa,aAAb,CACE,GAAGqB,EACJ,IAAKP,EAAK,IACV,QAASM,EACT,SAAAE,EACA,gBAAkBK,GAAqB,CACrC,GAAI,CAAC7D,EAAmB,OAElB,MAAA8D,EAAc,IAAI,IAAIhE,CAAY,EACpC+D,EACUC,EAAA,IAAId,EAAK,GAAG,EAEZc,EAAA,OAAOd,EAAK,GAAG,EAE7BhD,EAAkB8D,CAAW,CAC/B,CAAA,EAECL,CAAA,EAMLC,EAAA,cAACxB,EAAAA,aAAa,UAAb,CACE,GAAGqB,EACJ,MAAOP,EAAK,IACZ,IAAKA,EAAK,IACV,eAAcM,EACd,gBAAeL,EAAY,GAAQ,OACnC,SAAAO,CAAA,EAECC,CAAA,CAGP"}
1
+ {"version":3,"file":"ActionMenu.cjs.js","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode, useEffect, useRef, useState } from \"react\";\nimport type { Selection } from \"@react-types/shared\";\n\nimport { useIsClosing } from \"../../hooks/useIsClosing\";\nimport { useLockBodyScroll } from \"../../hooks/useLockBodyScroll\";\nimport { handleInternalNavigation, isUrlExternal } from \"../../utils\";\n\nimport { Button } from \"../Button/Button\";\nimport { ScreenOverlay } from \"../ScreenOverlay/ScreenOverlay\";\nimport { DropdownMenu } from \"radix-ui\";\nimport { ChevronLeft } from \"../Icon/IconComponents/ChevronLeft\";\nimport { ChevronRight } from \"../Icon/IconComponents/ChevronRight\";\n\nimport \"./ActionMenu.css\";\n\nexport interface ActionMenuAction {\n key: string;\n label?: ReactNode;\n description?: ReactNode;\n to?: string;\n onAction?: (key: string) => void;\n children?: ActionMenuAction[];\n}\n\nexport type ActionMenuSelectionMode = \"single\" | \"multiple\" | \"none\";\n\nexport interface ActionMenuProps {\n /** The actions of the menu\n * - type {@link ActionMenuAction}[]\n */\n actions?: ActionMenuAction[];\n\n /** The text of the cancel button */\n cancelButtonText?: string;\n\n /** The children of the menu */\n children?: ReactNode | ((props: { close: () => void }) => ReactNode);\n\n /** The test id of the menu */\n \"data-testid\"?: string;\n\n /** The keys of the disabled items\n * @default []\n */\n disabledKeys?: string[];\n\n /** Whether the menu is open\n * @default false\n */\n isOpen: boolean;\n\n /** The callback function to close the menu */\n onClose?: () => void;\n\n /** The callback function to change the selection\n * - type {@link Selection}\n */\n onSelectionChange?: (keys: Selection) => void;\n\n /** The selection mode of the menu\n * @default \"single\"\n */\n selectionMode?: ActionMenuSelectionMode;\n\n /** The keys of the selected items */\n selectedKeys?: string[];\n\n /** Whether to show the cancel button */\n showCancel?: boolean;\n\n /** The title of the menu */\n title?: string;\n}\n\ntype ActionStack = {\n title: ReactNode | null;\n actions: ActionMenuAction[];\n key: string | null;\n previousKey: string | null;\n};\n\n/**\n * A controlled ActionMenu to display a menu of actions.\n * Renders a list of actions as a focusable menu, or non-focusable children.\n *\n * API:\n * - {@link ActionMenuProps}\n */\nexport const ActionMenu = ({\n isOpen,\n actions = [],\n children,\n showCancel = true,\n cancelButtonText = \"Cancel\",\n selectionMode = \"single\",\n selectedKeys,\n disabledKeys = [],\n onSelectionChange,\n onClose,\n title,\n \"data-testid\": testId,\n}: ActionMenuProps) => {\n useLockBodyScroll(isOpen);\n const [contentHeight, setContentHeight] = useState<number>(0);\n const [stackHistory, setStackHistory] = useState<ActionStack[]>([]);\n const [currentActionStack, setCurrentActionStack] = useState<ActionStack>({\n title,\n actions,\n key: null,\n previousKey: null,\n });\n const contentRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n const { isClosing, handleClose } = useIsClosing({ onClose, overlayRef });\n\n const currentActions = currentActionStack.actions || [];\n const hasActions = currentActions && currentActions.length > 0;\n const hasContent = children || hasActions || showCancel;\n const isInSubmenu = stackHistory.length > 0;\n\n function handleSubmenuOpen(key: string) {\n const action = currentActions.find((action) => action.key === key);\n if (!action) {\n console.error(`Action with key ${key} not found`);\n return;\n }\n\n setStackHistory((prevStackHistory) => [\n ...prevStackHistory,\n currentActionStack,\n ]);\n setCurrentActionStack((prevStack) => ({\n title: action.label,\n actions: action.children,\n key: action.key,\n previousKey: prevStack.key,\n }));\n }\n\n function handleBack() {\n if (stackHistory.length > 0) {\n const previousStack = stackHistory[stackHistory.length - 1];\n setCurrentActionStack(previousStack);\n setStackHistory(stackHistory.slice(0, -1));\n }\n }\n\n // Re-measure the open menu's content height when stack history changes\n useEffect(() => {\n if (!isOpen) return;\n\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContentHeight(contentRef.current.scrollHeight + 12);\n }\n });\n }, [isOpen, stackHistory, hasContent]);\n\n // Reset content height when menu closes or is closing\n useEffect(() => {\n if (!isOpen || isClosing) {\n setContentHeight(0);\n }\n }, [isOpen, isClosing]);\n\n if (!isOpen && !isClosing) return null;\n\n return (\n <ScreenOverlay fadeIn ref={overlayRef}>\n <DropdownMenu.Root\n modal\n open={isOpen}\n onOpenChange={(open) => {\n if (!open) handleClose();\n }}\n >\n <DropdownMenu.Trigger asChild>\n {/* No visible trigger, menu is controlled by isOpen */}\n <div>{\"\"}</div>\n </DropdownMenu.Trigger>\n\n <div\n className=\"proton-ActionMenu__background-wrapper\"\n style={{ opacity: isClosing ? 0 : 1 }}\n >\n <div\n data-testid={testId || \"ActionMenu-wrapper\"}\n className=\"proton-ActionMenu__wrapper\"\n >\n <div\n className=\"proton-ActionMenu__card\"\n data-testid=\"ActionMenu-content\"\n style={{ height: `${contentHeight}px` }}\n >\n <div ref={menuRef} className=\"proton-ActionMenu__menu\">\n <DropdownMenu.Content loop sideOffset={8} ref={contentRef}>\n {hasContent && (\n <>\n {children && (\n <div className=\"proton-ActionMenu__content\">\n {typeof children === \"function\"\n ? children({ close: handleClose })\n : children}\n </div>\n )}\n\n {hasActions && (\n <ActionMenuList\n actions={currentActions}\n selectionMode={selectionMode}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n title={currentActionStack.title}\n isInSubmenu={isInSubmenu}\n handleBack={handleBack}\n previousMenuTitle={\n stackHistory[stackHistory.length - 1]?.title\n }\n />\n )}\n\n {showCancel && (\n <>\n <DropdownMenu.Separator />\n <DropdownMenu.Item className=\"proton-ActionMenu__cancel-button\">\n <Button\n data-testid=\"ActionMenuItem-cancel\"\n onPress={handleClose}\n fullWidth\n variant=\"secondary\"\n >\n {cancelButtonText}\n </Button>\n </DropdownMenu.Item>\n </>\n )}\n </>\n )}\n </DropdownMenu.Content>\n </div>\n </div>\n </div>\n </div>\n </DropdownMenu.Root>\n </ScreenOverlay>\n );\n};\n\ninterface ActionMenuListProps {\n actions: ActionMenuAction[];\n selectionMode: ActionMenuSelectionMode;\n selectedKeys?: string[];\n onSelectionChange?: (keys: Selection) => void;\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n title?: ReactNode;\n isInSubmenu?: boolean;\n handleBack?: () => void;\n previousMenuTitle?: ReactNode;\n}\n\nconst ActionMenuList = ({\n actions,\n selectionMode,\n selectedKeys = [],\n onSelectionChange,\n disabledKeys = [],\n handleSubmenuOpen,\n title,\n isInSubmenu = false,\n handleBack,\n previousMenuTitle,\n}: ActionMenuListProps) => {\n const ActionMenuItemMap = () => (\n <>\n {isInSubmenu && handleBack && (\n <div className=\"proton-ActionMenu__back-button-container\">\n <DropdownMenu.Item\n className=\"proton-ActionMenu__back-button\"\n onSelect={(event) => {\n event.preventDefault();\n handleBack();\n }}\n aria-label={`Go back to ${previousMenuTitle || \"previous menu\"}`}\n >\n <ChevronLeft size={16} />\n </DropdownMenu.Item>\n <div\n className=\"proton-ActionMenu__title\"\n role=\"banner\"\n aria-label={isInSubmenu ? `Submenu: ${title}` : `Menu: ${title}`}\n >\n <span>{title}</span>\n </div>\n <DropdownMenu.Separator />\n </div>\n )}\n\n {actions.map((action, i) => {\n const itemProps = actions[i];\n return (\n <ActionMenuItem\n key={action.key}\n item={action}\n isSubmenu={Boolean(itemProps.children?.length)}\n selectionMode={selectionMode}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedKeys}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n />\n );\n })}\n </>\n );\n\n return (\n <div\n aria-disabled={selectionMode === \"none\"}\n className=\"proton-ActionMenu__list\"\n role=\"menu\"\n aria-label={\n title ? `${isInSubmenu ? \"Submenu\" : \"Menu\"}: ${title}` : \"Action menu\"\n }\n aria-orientation=\"vertical\"\n >\n {selectionMode === \"single\" ? (\n <DropdownMenu.RadioGroup\n value={selectedKeys?.[0] || \"\"}\n onValueChange={(value) => {\n // Check if this is a submenu item - if so, don't trigger selection change\n const action = actions.find((action) => action.key === value);\n if (action?.children?.length) {\n return;\n }\n\n if (onSelectionChange) {\n onSelectionChange(new Set([value]));\n }\n }}\n >\n <ActionMenuItemMap />\n </DropdownMenu.RadioGroup>\n ) : (\n <DropdownMenu.Group>\n <ActionMenuItemMap />\n </DropdownMenu.Group>\n )}\n </div>\n );\n};\n\ninterface ActionMenuItemProps {\n to?: string;\n item: ActionMenuAction;\n isSubmenu?: boolean;\n selectionMode: ActionMenuSelectionMode;\n onSelectionChange?: (keys: Selection) => void;\n selectedKeys?: string[];\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n}\n\nconst ActionMenuItem = ({\n item,\n isSubmenu,\n selectionMode,\n onSelectionChange,\n selectedKeys = [],\n disabledKeys = [],\n handleSubmenuOpen,\n}: ActionMenuItemProps) => {\n const ref = useRef(null);\n const isExternal = item.to && isUrlExternal(item.to);\n const isDisabled = disabledKeys.includes(item.key);\n const isSelected = selectedKeys.includes(item.key);\n\n const radixItemProps = {\n className: \"proton-ActionMenu__item\",\n \"aria-label\": item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`,\n role: \"menuitem\",\n disabled: isDisabled,\n ref,\n };\n\n const onSelect = (event: Event) => {\n if (item?.children?.length) {\n event.preventDefault();\n handleSubmenuOpen(item.key);\n return;\n }\n if (item.onAction) {\n item.onAction(item.key);\n }\n };\n\n const content = (\n <>\n <div className=\"proton-ActionMenu__item-content\">\n <div className=\"proton-ActionMenu__item-label\">{item.label}</div>\n {item.description && (\n <div className=\"proton-ActionMenu__description\">\n {item.description}\n </div>\n )}\n </div>\n {isSubmenu && <ChevronRight size={16} />}\n </>\n );\n\n if (item.to) {\n return (\n <DropdownMenu.Item {...radixItemProps} key={item.key} asChild>\n <a\n aria-label={\n item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`\n }\n aria-disabled={isDisabled}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n href={item.to}\n target={isExternal ? \"_blank\" : undefined}\n rel={isExternal ? \"noopener noreferrer\" : undefined}\n onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {\n if (isExternal || !item.to) {\n return;\n }\n handleInternalNavigation(e, item.to);\n }}\n >\n {content}\n </a>\n </DropdownMenu.Item>\n );\n }\n\n if (selectionMode === \"multiple\") {\n return (\n <DropdownMenu.CheckboxItem\n {...radixItemProps}\n key={item.key}\n checked={isSelected}\n onSelect={onSelect}\n onCheckedChange={(checked: boolean) => {\n if (!onSelectionChange) return;\n\n const currentKeys = new Set(selectedKeys);\n if (checked) {\n currentKeys.add(item.key);\n } else {\n currentKeys.delete(item.key);\n }\n onSelectionChange(currentKeys);\n }}\n >\n {content}\n </DropdownMenu.CheckboxItem>\n );\n }\n\n return (\n <DropdownMenu.RadioItem\n {...radixItemProps}\n value={item.key}\n key={item.key}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n onSelect={onSelect}\n >\n {content}\n </DropdownMenu.RadioItem>\n );\n};\n"],"names":["ActionMenu","isOpen","actions","children","showCancel","cancelButtonText","selectionMode","selectedKeys","disabledKeys","onSelectionChange","onClose","title","testId","useLockBodyScroll","contentHeight","setContentHeight","useState","stackHistory","setStackHistory","currentActionStack","setCurrentActionStack","contentRef","useRef","menuRef","overlayRef","isClosing","handleClose","useIsClosing","currentActions","hasActions","hasContent","isInSubmenu","handleSubmenuOpen","key","action","prevStackHistory","prevStack","handleBack","previousStack","useEffect","jsx","ScreenOverlay","jsxs","DropdownMenu","open","Fragment","ActionMenuList","_a","Button","previousMenuTitle","ActionMenuItemMap","event","ChevronLeft","i","itemProps","ActionMenuItem","value","item","isSubmenu","ref","isExternal","isUrlExternal","isDisabled","isSelected","radixItemProps","onSelect","content","ChevronRight","createElement","e","handleInternalNavigation","checked","currentKeys"],"mappings":"kjBA0FaA,EAAa,CAAC,CACzB,OAAAC,EACA,QAAAC,EAAU,CAAC,EACX,SAAAC,EACA,WAAAC,EAAa,GACb,iBAAAC,EAAmB,SACnB,cAAAC,EAAgB,SAChB,aAAAC,EACA,aAAAC,EAAe,CAAC,EAChB,kBAAAC,EACA,QAAAC,EACA,MAAAC,EACA,cAAeC,CACjB,IAAuB,OACrBC,EAAA,kBAAkBZ,CAAM,EACxB,KAAM,CAACa,EAAeC,CAAgB,EAAIC,WAAiB,CAAC,EACtD,CAACC,EAAcC,CAAe,EAAIF,EAAA,SAAwB,CAAE,CAAA,EAC5D,CAACG,EAAoBC,CAAqB,EAAIJ,WAAsB,CACxE,MAAAL,EACA,QAAAT,EACA,IAAK,KACL,YAAa,IAAA,CACd,EACKmB,EAAaC,SAAuB,IAAI,EACxCC,EAAUD,SAAuB,IAAI,EACrCE,EAAaF,SAAuB,IAAI,EACxC,CAAE,UAAAG,EAAW,YAAAC,CAAY,EAAIC,eAAa,CAAE,QAAAjB,EAAS,WAAAc,EAAY,EAEjEI,EAAi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N,CAAA,EAMLE,EAAA,cAACzB,EAAAA,aAAa,UAAb,CACE,GAAGqB,EACJ,MAAOP,EAAK,IACZ,IAAKA,EAAK,IACV,eAAcM,EACd,gBAAeL,EAAY,GAAQ,OACnC,SAAAO,CAAA,EAECC,CAAA,CAGP"}
@@ -1,17 +1,18 @@
1
1
  import { j as e } from "../../node_modules/react/jsx-runtime.es.js";
2
- import { useState as $, useRef as b, useEffect as F, createElement as I } from "react";
3
- import { useIsClosing as z } from "../../hooks/useIsClosing.es.js";
4
- import { useLockBodyScroll as L } from "../../hooks/useLockBodyScroll.es.js";
5
- import { Button as T } from "../Button/Button.es.js";
6
- import { ScreenOverlay as q } from "../ScreenOverlay/ScreenOverlay.es.js";
7
- import { DropdownMenu as i } from "radix-ui";
8
- import { Icon as H } from "../Icon/Icon.es.js";
2
+ import { useState as $, useRef as b, useEffect as F, createElement as C } from "react";
3
+ import { useIsClosing as L } from "../../hooks/useIsClosing.es.js";
4
+ import { useLockBodyScroll as P } from "../../hooks/useLockBodyScroll.es.js";
5
+ import { Button as z } from "../Button/Button.es.js";
6
+ import { ScreenOverlay as T } from "../ScreenOverlay/ScreenOverlay.es.js";
7
+ import { DropdownMenu as s } from "radix-ui";
8
+ import { ChevronLeft as q } from "../Icon/IconComponents/ChevronLeft.es.js";
9
+ import { ChevronRight as U } from "../Icon/IconComponents/ChevronRight.es.js";
9
10
  /* empty css */
10
- import { isUrlExternal as U, handleInternalNavigation as V } from "../../utils/navigation.es.js";
11
- const on = ({
11
+ import { isUrlExternal as V, handleInternalNavigation as W } from "../../utils/navigation.es.js";
12
+ const cn = ({
12
13
  isOpen: n,
13
- actions: s = [],
14
- children: o,
14
+ actions: a = [],
15
+ children: r,
15
16
  showCancel: l = !0,
16
17
  cancelButtonText: x = "Cancel",
17
18
  selectionMode: m = "single",
@@ -20,17 +21,17 @@ const on = ({
20
21
  onSelectionChange: p,
21
22
  onClose: k,
22
23
  title: h,
23
- "data-testid": r
24
+ "data-testid": o
24
25
  }) => {
25
26
  var E;
26
- L(n);
27
- const [a, c] = $(0), [t, d] = $([]), [g, C] = $({
27
+ P(n);
28
+ const [i, c] = $(0), [t, d] = $([]), [g, I] = $({
28
29
  title: h,
29
- actions: s,
30
+ actions: a,
30
31
  key: null,
31
32
  previousKey: null
32
- }), M = b(null), D = b(null), S = b(null), { isClosing: v, handleClose: N } = z({ onClose: k, overlayRef: S }), y = g.actions || [], R = y && y.length > 0, w = o || R || l, B = t.length > 0;
33
- function G(j) {
33
+ }), M = b(null), H = b(null), S = b(null), { isClosing: v, handleClose: N } = L({ onClose: k, overlayRef: S }), y = g.actions || [], R = y && y.length > 0, w = r || R || l, D = t.length > 0;
34
+ function B(j) {
34
35
  const _ = y.find((A) => A.key === j);
35
36
  if (!_) {
36
37
  console.error(`Action with key ${j} not found`);
@@ -39,17 +40,17 @@ const on = ({
39
40
  d((A) => [
40
41
  ...A,
41
42
  g
42
- ]), C((A) => ({
43
+ ]), I((A) => ({
43
44
  title: _.label,
44
45
  actions: _.children,
45
46
  key: _.key,
46
47
  previousKey: A.key
47
48
  }));
48
49
  }
49
- function P() {
50
+ function G() {
50
51
  if (t.length > 0) {
51
52
  const j = t[t.length - 1];
52
- C(j), d(t.slice(0, -1));
53
+ I(j), d(t.slice(0, -1));
53
54
  }
54
55
  }
55
56
  return F(() => {
@@ -58,8 +59,8 @@ const on = ({
58
59
  });
59
60
  }, [n, t, w]), F(() => {
60
61
  (!n || v) && c(0);
61
- }, [n, v]), !n && !v ? null : /* @__PURE__ */ e.jsx(q, { fadeIn: !0, ref: S, children: /* @__PURE__ */ e.jsxs(
62
- i.Root,
62
+ }, [n, v]), !n && !v ? null : /* @__PURE__ */ e.jsx(T, { fadeIn: !0, ref: S, children: /* @__PURE__ */ e.jsxs(
63
+ s.Root,
63
64
  {
64
65
  modal: !0,
65
66
  open: n,
@@ -67,7 +68,7 @@ const on = ({
67
68
  j || N();
68
69
  },
69
70
  children: [
70
- /* @__PURE__ */ e.jsx(i.Trigger, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: "" }) }),
71
+ /* @__PURE__ */ e.jsx(s.Trigger, { asChild: !0, children: /* @__PURE__ */ e.jsx("div", { children: "" }) }),
71
72
  /* @__PURE__ */ e.jsx(
72
73
  "div",
73
74
  {
@@ -76,35 +77,35 @@ const on = ({
76
77
  children: /* @__PURE__ */ e.jsx(
77
78
  "div",
78
79
  {
79
- "data-testid": r || "ActionMenu-wrapper",
80
+ "data-testid": o || "ActionMenu-wrapper",
80
81
  className: "proton-ActionMenu__wrapper",
81
82
  children: /* @__PURE__ */ e.jsx(
82
83
  "div",
83
84
  {
84
85
  className: "proton-ActionMenu__card",
85
86
  "data-testid": "ActionMenu-content",
86
- style: { height: `${a}px` },
87
- children: /* @__PURE__ */ e.jsx("div", { ref: D, className: "proton-ActionMenu__menu", children: /* @__PURE__ */ e.jsx(i.Content, { loop: !0, sideOffset: 8, ref: M, children: w && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
88
- o && /* @__PURE__ */ e.jsx("div", { className: "proton-ActionMenu__content", children: typeof o == "function" ? o({ close: N }) : o }),
87
+ style: { height: `${i}px` },
88
+ children: /* @__PURE__ */ e.jsx("div", { ref: H, className: "proton-ActionMenu__menu", children: /* @__PURE__ */ e.jsx(s.Content, { loop: !0, sideOffset: 8, ref: M, children: w && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
89
+ r && /* @__PURE__ */ e.jsx("div", { className: "proton-ActionMenu__content", children: typeof r == "function" ? r({ close: N }) : r }),
89
90
  R && /* @__PURE__ */ e.jsx(
90
- W,
91
+ J,
91
92
  {
92
93
  actions: y,
93
94
  selectionMode: m,
94
95
  selectedKeys: u,
95
96
  onSelectionChange: p,
96
97
  disabledKeys: f,
97
- handleSubmenuOpen: G,
98
+ handleSubmenuOpen: B,
98
99
  title: g.title,
99
- isInSubmenu: B,
100
- handleBack: P,
100
+ isInSubmenu: D,
101
+ handleBack: G,
101
102
  previousMenuTitle: (E = t[t.length - 1]) == null ? void 0 : E.title
102
103
  }
103
104
  ),
104
105
  l && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
105
- /* @__PURE__ */ e.jsx(i.Separator, {}),
106
- /* @__PURE__ */ e.jsx(i.Item, { className: "proton-ActionMenu__cancel-button", children: /* @__PURE__ */ e.jsx(
107
- T,
106
+ /* @__PURE__ */ e.jsx(s.Separator, {}),
107
+ /* @__PURE__ */ e.jsx(s.Item, { className: "proton-ActionMenu__cancel-button", children: /* @__PURE__ */ e.jsx(
108
+ z,
108
109
  {
109
110
  "data-testid": "ActionMenuItem-cancel",
110
111
  onPress: N,
@@ -124,10 +125,10 @@ const on = ({
124
125
  ]
125
126
  }
126
127
  ) });
127
- }, W = ({
128
+ }, J = ({
128
129
  actions: n,
129
- selectionMode: s,
130
- selectedKeys: o = [],
130
+ selectionMode: a,
131
+ selectedKeys: r = [],
131
132
  onSelectionChange: l,
132
133
  disabledKeys: x = [],
133
134
  handleSubmenuOpen: m,
@@ -139,14 +140,14 @@ const on = ({
139
140
  const h = () => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
140
141
  f && p && /* @__PURE__ */ e.jsxs("div", { className: "proton-ActionMenu__back-button-container", children: [
141
142
  /* @__PURE__ */ e.jsx(
142
- i.Item,
143
+ s.Item,
143
144
  {
144
145
  className: "proton-ActionMenu__back-button",
145
- onSelect: (r) => {
146
- r.preventDefault(), p();
146
+ onSelect: (o) => {
147
+ o.preventDefault(), p();
147
148
  },
148
149
  "aria-label": `Go back to ${k || "previous menu"}`,
149
- children: /* @__PURE__ */ e.jsx(H, { id: "chevron-left", size: 16, "aria-hidden": "true" })
150
+ children: /* @__PURE__ */ e.jsx(q, { size: 16 })
150
151
  }
151
152
  ),
152
153
  /* @__PURE__ */ e.jsx(
@@ -158,64 +159,64 @@ const on = ({
158
159
  children: /* @__PURE__ */ e.jsx("span", { children: u })
159
160
  }
160
161
  ),
161
- /* @__PURE__ */ e.jsx(i.Separator, {})
162
+ /* @__PURE__ */ e.jsx(s.Separator, {})
162
163
  ] }),
163
- n.map((r, a) => {
164
+ n.map((o, i) => {
164
165
  var t;
165
- const c = n[a];
166
+ const c = n[i];
166
167
  return /* @__PURE__ */ e.jsx(
167
- J,
168
+ Q,
168
169
  {
169
- item: r,
170
+ item: o,
170
171
  isSubmenu: !!((t = c.children) != null && t.length),
171
- selectionMode: s,
172
+ selectionMode: a,
172
173
  onSelectionChange: l,
173
- selectedKeys: o,
174
+ selectedKeys: r,
174
175
  disabledKeys: x,
175
176
  handleSubmenuOpen: m
176
177
  },
177
- r.key
178
+ o.key
178
179
  );
179
180
  })
180
181
  ] });
181
182
  return /* @__PURE__ */ e.jsx(
182
183
  "div",
183
184
  {
184
- "aria-disabled": s === "none",
185
+ "aria-disabled": a === "none",
185
186
  className: "proton-ActionMenu__list",
186
187
  role: "menu",
187
188
  "aria-label": u ? `${f ? "Submenu" : "Menu"}: ${u}` : "Action menu",
188
189
  "aria-orientation": "vertical",
189
- children: s === "single" ? /* @__PURE__ */ e.jsx(
190
- i.RadioGroup,
190
+ children: a === "single" ? /* @__PURE__ */ e.jsx(
191
+ s.RadioGroup,
191
192
  {
192
- value: (o == null ? void 0 : o[0]) || "",
193
- onValueChange: (r) => {
193
+ value: (r == null ? void 0 : r[0]) || "",
194
+ onValueChange: (o) => {
194
195
  var c;
195
- const a = n.find((t) => t.key === r);
196
- (c = a == null ? void 0 : a.children) != null && c.length || l && l(/* @__PURE__ */ new Set([r]));
196
+ const i = n.find((t) => t.key === o);
197
+ (c = i == null ? void 0 : i.children) != null && c.length || l && l(/* @__PURE__ */ new Set([o]));
197
198
  },
198
199
  children: /* @__PURE__ */ e.jsx(h, {})
199
200
  }
200
- ) : /* @__PURE__ */ e.jsx(i.Group, { children: /* @__PURE__ */ e.jsx(h, {}) })
201
+ ) : /* @__PURE__ */ e.jsx(s.Group, { children: /* @__PURE__ */ e.jsx(h, {}) })
201
202
  }
202
203
  );
203
- }, J = ({
204
+ }, Q = ({
204
205
  item: n,
205
- isSubmenu: s,
206
- selectionMode: o,
206
+ isSubmenu: a,
207
+ selectionMode: r,
207
208
  onSelectionChange: l,
208
209
  selectedKeys: x = [],
209
210
  disabledKeys: m = [],
210
211
  handleSubmenuOpen: u
211
212
  }) => {
212
- const f = b(null), p = n.to && U(n.to), k = m.includes(n.key), h = x.includes(n.key), r = {
213
+ const f = b(null), p = n.to && V(n.to), k = m.includes(n.key), h = x.includes(n.key), o = {
213
214
  className: "proton-ActionMenu__item",
214
215
  "aria-label": n.label ? `${n.label}${n.description ? `, ${n.description}` : ""}` : `ActionMenu-Item-${n.key}`,
215
216
  role: "menuitem",
216
217
  disabled: k,
217
218
  ref: f
218
- }, a = (t) => {
219
+ }, i = (t) => {
219
220
  var d;
220
221
  if ((d = n == null ? void 0 : n.children) != null && d.length) {
221
222
  t.preventDefault(), u(n.key);
@@ -227,30 +228,30 @@ const on = ({
227
228
  /* @__PURE__ */ e.jsx("div", { className: "proton-ActionMenu__item-label", children: n.label }),
228
229
  n.description && /* @__PURE__ */ e.jsx("div", { className: "proton-ActionMenu__description", children: n.description })
229
230
  ] }),
230
- s && /* @__PURE__ */ e.jsx(H, { id: "chevron-right", size: 16, "aria-hidden": "true" })
231
+ a && /* @__PURE__ */ e.jsx(U, { size: 16 })
231
232
  ] });
232
- return n.to ? /* @__PURE__ */ I(i.Item, { ...r, key: n.key, asChild: !0 }, /* @__PURE__ */ e.jsx(
233
+ return n.to ? /* @__PURE__ */ C(s.Item, { ...o, key: n.key, asChild: !0 }, /* @__PURE__ */ e.jsx(
233
234
  "a",
234
235
  {
235
236
  "aria-label": n.label ? `${n.label}${n.description ? `, ${n.description}` : ""}` : `ActionMenu-Item-${n.key}`,
236
237
  "aria-disabled": k,
237
238
  "aria-checked": h,
238
- "aria-expanded": s ? !1 : void 0,
239
+ "aria-expanded": a ? !1 : void 0,
239
240
  href: n.to,
240
241
  target: p ? "_blank" : void 0,
241
242
  rel: p ? "noopener noreferrer" : void 0,
242
243
  onClick: (t) => {
243
- p || !n.to || V(t, n.to);
244
+ p || !n.to || W(t, n.to);
244
245
  },
245
246
  children: c
246
247
  }
247
- )) : o === "multiple" ? /* @__PURE__ */ I(
248
- i.CheckboxItem,
248
+ )) : r === "multiple" ? /* @__PURE__ */ C(
249
+ s.CheckboxItem,
249
250
  {
250
- ...r,
251
+ ...o,
251
252
  key: n.key,
252
253
  checked: h,
253
- onSelect: a,
254
+ onSelect: i,
254
255
  onCheckedChange: (t) => {
255
256
  if (!l) return;
256
257
  const d = new Set(x);
@@ -258,20 +259,20 @@ const on = ({
258
259
  }
259
260
  },
260
261
  c
261
- ) : /* @__PURE__ */ I(
262
- i.RadioItem,
262
+ ) : /* @__PURE__ */ C(
263
+ s.RadioItem,
263
264
  {
264
- ...r,
265
+ ...o,
265
266
  value: n.key,
266
267
  key: n.key,
267
268
  "aria-checked": h,
268
- "aria-expanded": s ? !1 : void 0,
269
- onSelect: a
269
+ "aria-expanded": a ? !1 : void 0,
270
+ onSelect: i
270
271
  },
271
272
  c
272
273
  );
273
274
  };
274
275
  export {
275
- on as ActionMenu
276
+ cn as ActionMenu
276
277
  };
277
278
  //# sourceMappingURL=ActionMenu.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionMenu.es.js","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode, useEffect, useRef, useState } from \"react\";\nimport type { Selection } from \"@react-types/shared\";\n\nimport { useIsClosing } from \"../../hooks/useIsClosing\";\nimport { useLockBodyScroll } from \"../../hooks/useLockBodyScroll\";\nimport { handleInternalNavigation, isUrlExternal } from \"../../utils\";\n\nimport { Button } from \"../Button/Button\";\nimport { ScreenOverlay } from \"../ScreenOverlay/ScreenOverlay\";\nimport { DropdownMenu } from \"radix-ui\";\nimport { Icon } from \"../Icon/Icon\";\n\nimport \"./ActionMenu.css\";\n\nexport interface ActionMenuAction {\n key: string;\n label?: ReactNode;\n description?: ReactNode;\n to?: string;\n onAction?: (key: string) => void;\n children?: ActionMenuAction[];\n}\n\nexport type ActionMenuSelectionMode = \"single\" | \"multiple\" | \"none\";\n\nexport interface ActionMenuProps {\n /** The actions of the menu\n * - type {@link ActionMenuAction}[]\n */\n actions?: ActionMenuAction[];\n\n /** The text of the cancel button */\n cancelButtonText?: string;\n\n /** The children of the menu */\n children?: ReactNode | ((props: { close: () => void }) => ReactNode);\n\n /** The test id of the menu */\n \"data-testid\"?: string;\n\n /** The keys of the disabled items\n * @default []\n */\n disabledKeys?: string[];\n\n /** Whether the menu is open\n * @default false\n */\n isOpen: boolean;\n\n /** The callback function to close the menu */\n onClose?: () => void;\n\n /** The callback function to change the selection\n * - type {@link Selection}\n */\n onSelectionChange?: (keys: Selection) => void;\n\n /** The selection mode of the menu\n * @default \"single\"\n */\n selectionMode?: ActionMenuSelectionMode;\n\n /** The keys of the selected items */\n selectedKeys?: string[];\n\n /** Whether to show the cancel button */\n showCancel?: boolean;\n\n /** The title of the menu */\n title?: string;\n}\n\ntype ActionStack = {\n title: ReactNode | null;\n actions: ActionMenuAction[];\n key: string | null;\n previousKey: string | null;\n};\n\n/**\n * A controlled ActionMenu to display a menu of actions.\n * Renders a list of actions as a focusable menu, or non-focusable children.\n *\n * API:\n * - {@link ActionMenuProps}\n */\nexport const ActionMenu = ({\n isOpen,\n actions = [],\n children,\n showCancel = true,\n cancelButtonText = \"Cancel\",\n selectionMode = \"single\",\n selectedKeys,\n disabledKeys = [],\n onSelectionChange,\n onClose,\n title,\n \"data-testid\": testId,\n}: ActionMenuProps) => {\n useLockBodyScroll(isOpen);\n const [contentHeight, setContentHeight] = useState<number>(0);\n const [stackHistory, setStackHistory] = useState<ActionStack[]>([]);\n const [currentActionStack, setCurrentActionStack] = useState<ActionStack>({\n title,\n actions,\n key: null,\n previousKey: null,\n });\n const contentRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n const { isClosing, handleClose } = useIsClosing({ onClose, overlayRef });\n\n const currentActions = currentActionStack.actions || [];\n const hasActions = currentActions && currentActions.length > 0;\n const hasContent = children || hasActions || showCancel;\n const isInSubmenu = stackHistory.length > 0;\n\n function handleSubmenuOpen(key: string) {\n const action = currentActions.find((action) => action.key === key);\n if (!action) {\n console.error(`Action with key ${key} not found`);\n return;\n }\n\n setStackHistory((prevStackHistory) => [\n ...prevStackHistory,\n currentActionStack,\n ]);\n setCurrentActionStack((prevStack) => ({\n title: action.label,\n actions: action.children,\n key: action.key,\n previousKey: prevStack.key,\n }));\n }\n\n function handleBack() {\n if (stackHistory.length > 0) {\n const previousStack = stackHistory[stackHistory.length - 1];\n setCurrentActionStack(previousStack);\n setStackHistory(stackHistory.slice(0, -1));\n }\n }\n\n // Re-measure the open menu's content height when stack history changes\n useEffect(() => {\n if (!isOpen) return;\n\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContentHeight(contentRef.current.scrollHeight + 12);\n }\n });\n }, [isOpen, stackHistory, hasContent]);\n\n // Reset content height when menu closes or is closing\n useEffect(() => {\n if (!isOpen || isClosing) {\n setContentHeight(0);\n }\n }, [isOpen, isClosing]);\n\n if (!isOpen && !isClosing) return null;\n\n return (\n <ScreenOverlay fadeIn ref={overlayRef}>\n <DropdownMenu.Root\n modal\n open={isOpen}\n onOpenChange={(open) => {\n if (!open) handleClose();\n }}\n >\n <DropdownMenu.Trigger asChild>\n {/* No visible trigger, menu is controlled by isOpen */}\n <div>{\"\"}</div>\n </DropdownMenu.Trigger>\n\n <div\n className=\"proton-ActionMenu__background-wrapper\"\n style={{ opacity: isClosing ? 0 : 1 }}\n >\n <div\n data-testid={testId || \"ActionMenu-wrapper\"}\n className=\"proton-ActionMenu__wrapper\"\n >\n <div\n className=\"proton-ActionMenu__card\"\n data-testid=\"ActionMenu-content\"\n style={{ height: `${contentHeight}px` }}\n >\n <div ref={menuRef} className=\"proton-ActionMenu__menu\">\n <DropdownMenu.Content loop sideOffset={8} ref={contentRef}>\n {hasContent && (\n <>\n {children && (\n <div className=\"proton-ActionMenu__content\">\n {typeof children === \"function\"\n ? children({ close: handleClose })\n : children}\n </div>\n )}\n\n {hasActions && (\n <ActionMenuList\n actions={currentActions}\n selectionMode={selectionMode}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n title={currentActionStack.title}\n isInSubmenu={isInSubmenu}\n handleBack={handleBack}\n previousMenuTitle={\n stackHistory[stackHistory.length - 1]?.title\n }\n />\n )}\n\n {showCancel && (\n <>\n <DropdownMenu.Separator />\n <DropdownMenu.Item className=\"proton-ActionMenu__cancel-button\">\n <Button\n data-testid=\"ActionMenuItem-cancel\"\n onPress={handleClose}\n fullWidth\n variant=\"secondary\"\n >\n {cancelButtonText}\n </Button>\n </DropdownMenu.Item>\n </>\n )}\n </>\n )}\n </DropdownMenu.Content>\n </div>\n </div>\n </div>\n </div>\n </DropdownMenu.Root>\n </ScreenOverlay>\n );\n};\n\ninterface ActionMenuListProps {\n actions: ActionMenuAction[];\n selectionMode: ActionMenuSelectionMode;\n selectedKeys?: string[];\n onSelectionChange?: (keys: Selection) => void;\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n title?: ReactNode;\n isInSubmenu?: boolean;\n handleBack?: () => void;\n previousMenuTitle?: ReactNode;\n}\n\nconst ActionMenuList = ({\n actions,\n selectionMode,\n selectedKeys = [],\n onSelectionChange,\n disabledKeys = [],\n handleSubmenuOpen,\n title,\n isInSubmenu = false,\n handleBack,\n previousMenuTitle,\n}: ActionMenuListProps) => {\n const ActionMenuItemMap = () => (\n <>\n {isInSubmenu && handleBack && (\n <div className=\"proton-ActionMenu__back-button-container\">\n <DropdownMenu.Item\n className=\"proton-ActionMenu__back-button\"\n onSelect={(event) => {\n event.preventDefault();\n handleBack();\n }}\n aria-label={`Go back to ${previousMenuTitle || \"previous menu\"}`}\n >\n <Icon id=\"chevron-left\" size={16} aria-hidden=\"true\" />\n </DropdownMenu.Item>\n <div\n className=\"proton-ActionMenu__title\"\n role=\"banner\"\n aria-label={isInSubmenu ? `Submenu: ${title}` : `Menu: ${title}`}\n >\n <span>{title}</span>\n </div>\n <DropdownMenu.Separator />\n </div>\n )}\n\n {actions.map((action, i) => {\n const itemProps = actions[i];\n return (\n <ActionMenuItem\n key={action.key}\n item={action}\n isSubmenu={Boolean(itemProps.children?.length)}\n selectionMode={selectionMode}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedKeys}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n />\n );\n })}\n </>\n );\n\n return (\n <div\n aria-disabled={selectionMode === \"none\"}\n className=\"proton-ActionMenu__list\"\n role=\"menu\"\n aria-label={\n title ? `${isInSubmenu ? \"Submenu\" : \"Menu\"}: ${title}` : \"Action menu\"\n }\n aria-orientation=\"vertical\"\n >\n {selectionMode === \"single\" ? (\n <DropdownMenu.RadioGroup\n value={selectedKeys?.[0] || \"\"}\n onValueChange={(value) => {\n // Check if this is a submenu item - if so, don't trigger selection change\n const action = actions.find((action) => action.key === value);\n if (action?.children?.length) {\n return;\n }\n\n if (onSelectionChange) {\n onSelectionChange(new Set([value]));\n }\n }}\n >\n <ActionMenuItemMap />\n </DropdownMenu.RadioGroup>\n ) : (\n <DropdownMenu.Group>\n <ActionMenuItemMap />\n </DropdownMenu.Group>\n )}\n </div>\n );\n};\n\ninterface ActionMenuItemProps {\n to?: string;\n item: ActionMenuAction;\n isSubmenu?: boolean;\n selectionMode: ActionMenuSelectionMode;\n onSelectionChange?: (keys: Selection) => void;\n selectedKeys?: string[];\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n}\n\nconst ActionMenuItem = ({\n item,\n isSubmenu,\n selectionMode,\n onSelectionChange,\n selectedKeys = [],\n disabledKeys = [],\n handleSubmenuOpen,\n}: ActionMenuItemProps) => {\n const ref = useRef(null);\n const isExternal = item.to && isUrlExternal(item.to);\n const isDisabled = disabledKeys.includes(item.key);\n const isSelected = selectedKeys.includes(item.key);\n\n const radixItemProps = {\n className: \"proton-ActionMenu__item\",\n \"aria-label\": item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`,\n role: \"menuitem\",\n disabled: isDisabled,\n ref,\n };\n\n const onSelect = (event: Event) => {\n if (item?.children?.length) {\n event.preventDefault();\n handleSubmenuOpen(item.key);\n return;\n }\n if (item.onAction) {\n item.onAction(item.key);\n }\n };\n\n const content = (\n <>\n <div className=\"proton-ActionMenu__item-content\">\n <div className=\"proton-ActionMenu__item-label\">{item.label}</div>\n {item.description && (\n <div className=\"proton-ActionMenu__description\">\n {item.description}\n </div>\n )}\n </div>\n {isSubmenu && <Icon id=\"chevron-right\" size={16} aria-hidden=\"true\" />}\n </>\n );\n\n if (item.to) {\n return (\n <DropdownMenu.Item {...radixItemProps} key={item.key} asChild>\n <a\n aria-label={\n item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`\n }\n aria-disabled={isDisabled}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n href={item.to}\n target={isExternal ? \"_blank\" : undefined}\n rel={isExternal ? \"noopener noreferrer\" : undefined}\n onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {\n if (isExternal || !item.to) {\n return;\n }\n handleInternalNavigation(e, item.to);\n }}\n >\n {content}\n </a>\n </DropdownMenu.Item>\n );\n }\n\n if (selectionMode === \"multiple\") {\n return (\n <DropdownMenu.CheckboxItem\n {...radixItemProps}\n key={item.key}\n checked={isSelected}\n onSelect={onSelect}\n onCheckedChange={(checked: boolean) => {\n if (!onSelectionChange) return;\n\n const currentKeys = new Set(selectedKeys);\n if (checked) {\n currentKeys.add(item.key);\n } else {\n currentKeys.delete(item.key);\n }\n onSelectionChange(currentKeys);\n }}\n >\n {content}\n </DropdownMenu.CheckboxItem>\n );\n }\n\n return (\n <DropdownMenu.RadioItem\n {...radixItemProps}\n value={item.key}\n key={item.key}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n onSelect={onSelect}\n >\n {content}\n </DropdownMenu.RadioItem>\n );\n};\n"],"names":["ActionMenu","isOpen","actions","children","showCancel","cancelButtonText","selectionMode","selectedKeys","disabledKeys","onSelectionChange","onClose","title","testId","useLockBodyScroll","contentHeight","setContentHeight","useState","stackHistory","setStackHistory","currentActionStack","setCurrentActionStack","contentRef","useRef","menuRef","overlayRef","isClosing","handleClose","useIsClosing","currentActions","hasActions","hasContent","isInSubmenu","handleSubmenuOpen","key","action","prevStackHistory","prevStack","handleBack","previousStack","useEffect","jsx","ScreenOverlay","jsxs","DropdownMenu","open","Fragment","ActionMenuList","_a","Button","previousMenuTitle","ActionMenuItemMap","event","Icon","i","itemProps","ActionMenuItem","value","item","isSubmenu","ref","isExternal","isUrlExternal","isDisabled","isSelected","radixItemProps","onSelect","content","createElement","e","handleInternalNavigation","checked","currentKeys"],"mappings":";;;;;;;;;;AAyFO,MAAMA,KAAa,CAAC;AAAA,EACzB,QAAAC;AAAA,EACA,SAAAC,IAAU,CAAC;AAAA,EACX,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,kBAAAC,IAAmB;AAAA,EACnB,eAAAC,IAAgB;AAAA,EAChB,cAAAC;AAAA,EACA,cAAAC,IAAe,CAAC;AAAA,EAChB,mBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAeC;AACjB,MAAuB;;AACrB,EAAAC,EAAkBZ,CAAM;AACxB,QAAM,CAACa,GAAeC,CAAgB,IAAIC,EAAiB,CAAC,GACtD,CAACC,GAAcC,CAAe,IAAIF,EAAwB,CAAE,CAAA,GAC5D,CAACG,GAAoBC,CAAqB,IAAIJ,EAAsB;AAAA,IACxE,OAAAL;AAAA,IACA,SAAAT;AAAA,IACA,KAAK;AAAA,IACL,aAAa;AAAA,EAAA,CACd,GACKmB,IAAaC,EAAuB,IAAI,GACxCC,IAAUD,EAAuB,IAAI,GACr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c,EAAA,OAAOd,EAAK,GAAG,GAE7BhD,EAAkB8D,CAAW;AAAA,MAC/B;AAAA,IAAA;AAAA,IAECL;AAAA,EAAA,IAML,gBAAAC;AAAA,IAACxB,EAAa;AAAA,IAAb;AAAA,MACE,GAAGqB;AAAA,MACJ,OAAOP,EAAK;AAAA,MACZ,KAAKA,EAAK;AAAA,MACV,gBAAcM;AAAA,MACd,iBAAeL,IAAY,KAAQ;AAAA,MACnC,UAAAO;AAAA,IAAA;AAAA,IAECC;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"ActionMenu.es.js","sources":["../../../src/components/ActionMenu/ActionMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport { ReactNode, useEffect, useRef, useState } from \"react\";\nimport type { Selection } from \"@react-types/shared\";\n\nimport { useIsClosing } from \"../../hooks/useIsClosing\";\nimport { useLockBodyScroll } from \"../../hooks/useLockBodyScroll\";\nimport { handleInternalNavigation, isUrlExternal } from \"../../utils\";\n\nimport { Button } from \"../Button/Button\";\nimport { ScreenOverlay } from \"../ScreenOverlay/ScreenOverlay\";\nimport { DropdownMenu } from \"radix-ui\";\nimport { ChevronLeft } from \"../Icon/IconComponents/ChevronLeft\";\nimport { ChevronRight } from \"../Icon/IconComponents/ChevronRight\";\n\nimport \"./ActionMenu.css\";\n\nexport interface ActionMenuAction {\n key: string;\n label?: ReactNode;\n description?: ReactNode;\n to?: string;\n onAction?: (key: string) => void;\n children?: ActionMenuAction[];\n}\n\nexport type ActionMenuSelectionMode = \"single\" | \"multiple\" | \"none\";\n\nexport interface ActionMenuProps {\n /** The actions of the menu\n * - type {@link ActionMenuAction}[]\n */\n actions?: ActionMenuAction[];\n\n /** The text of the cancel button */\n cancelButtonText?: string;\n\n /** The children of the menu */\n children?: ReactNode | ((props: { close: () => void }) => ReactNode);\n\n /** The test id of the menu */\n \"data-testid\"?: string;\n\n /** The keys of the disabled items\n * @default []\n */\n disabledKeys?: string[];\n\n /** Whether the menu is open\n * @default false\n */\n isOpen: boolean;\n\n /** The callback function to close the menu */\n onClose?: () => void;\n\n /** The callback function to change the selection\n * - type {@link Selection}\n */\n onSelectionChange?: (keys: Selection) => void;\n\n /** The selection mode of the menu\n * @default \"single\"\n */\n selectionMode?: ActionMenuSelectionMode;\n\n /** The keys of the selected items */\n selectedKeys?: string[];\n\n /** Whether to show the cancel button */\n showCancel?: boolean;\n\n /** The title of the menu */\n title?: string;\n}\n\ntype ActionStack = {\n title: ReactNode | null;\n actions: ActionMenuAction[];\n key: string | null;\n previousKey: string | null;\n};\n\n/**\n * A controlled ActionMenu to display a menu of actions.\n * Renders a list of actions as a focusable menu, or non-focusable children.\n *\n * API:\n * - {@link ActionMenuProps}\n */\nexport const ActionMenu = ({\n isOpen,\n actions = [],\n children,\n showCancel = true,\n cancelButtonText = \"Cancel\",\n selectionMode = \"single\",\n selectedKeys,\n disabledKeys = [],\n onSelectionChange,\n onClose,\n title,\n \"data-testid\": testId,\n}: ActionMenuProps) => {\n useLockBodyScroll(isOpen);\n const [contentHeight, setContentHeight] = useState<number>(0);\n const [stackHistory, setStackHistory] = useState<ActionStack[]>([]);\n const [currentActionStack, setCurrentActionStack] = useState<ActionStack>({\n title,\n actions,\n key: null,\n previousKey: null,\n });\n const contentRef = useRef<HTMLDivElement>(null);\n const menuRef = useRef<HTMLDivElement>(null);\n const overlayRef = useRef<HTMLDivElement>(null);\n const { isClosing, handleClose } = useIsClosing({ onClose, overlayRef });\n\n const currentActions = currentActionStack.actions || [];\n const hasActions = currentActions && currentActions.length > 0;\n const hasContent = children || hasActions || showCancel;\n const isInSubmenu = stackHistory.length > 0;\n\n function handleSubmenuOpen(key: string) {\n const action = currentActions.find((action) => action.key === key);\n if (!action) {\n console.error(`Action with key ${key} not found`);\n return;\n }\n\n setStackHistory((prevStackHistory) => [\n ...prevStackHistory,\n currentActionStack,\n ]);\n setCurrentActionStack((prevStack) => ({\n title: action.label,\n actions: action.children,\n key: action.key,\n previousKey: prevStack.key,\n }));\n }\n\n function handleBack() {\n if (stackHistory.length > 0) {\n const previousStack = stackHistory[stackHistory.length - 1];\n setCurrentActionStack(previousStack);\n setStackHistory(stackHistory.slice(0, -1));\n }\n }\n\n // Re-measure the open menu's content height when stack history changes\n useEffect(() => {\n if (!isOpen) return;\n\n requestAnimationFrame(() => {\n if (contentRef.current) {\n setContentHeight(contentRef.current.scrollHeight + 12);\n }\n });\n }, [isOpen, stackHistory, hasContent]);\n\n // Reset content height when menu closes or is closing\n useEffect(() => {\n if (!isOpen || isClosing) {\n setContentHeight(0);\n }\n }, [isOpen, isClosing]);\n\n if (!isOpen && !isClosing) return null;\n\n return (\n <ScreenOverlay fadeIn ref={overlayRef}>\n <DropdownMenu.Root\n modal\n open={isOpen}\n onOpenChange={(open) => {\n if (!open) handleClose();\n }}\n >\n <DropdownMenu.Trigger asChild>\n {/* No visible trigger, menu is controlled by isOpen */}\n <div>{\"\"}</div>\n </DropdownMenu.Trigger>\n\n <div\n className=\"proton-ActionMenu__background-wrapper\"\n style={{ opacity: isClosing ? 0 : 1 }}\n >\n <div\n data-testid={testId || \"ActionMenu-wrapper\"}\n className=\"proton-ActionMenu__wrapper\"\n >\n <div\n className=\"proton-ActionMenu__card\"\n data-testid=\"ActionMenu-content\"\n style={{ height: `${contentHeight}px` }}\n >\n <div ref={menuRef} className=\"proton-ActionMenu__menu\">\n <DropdownMenu.Content loop sideOffset={8} ref={contentRef}>\n {hasContent && (\n <>\n {children && (\n <div className=\"proton-ActionMenu__content\">\n {typeof children === \"function\"\n ? children({ close: handleClose })\n : children}\n </div>\n )}\n\n {hasActions && (\n <ActionMenuList\n actions={currentActions}\n selectionMode={selectionMode}\n selectedKeys={selectedKeys}\n onSelectionChange={onSelectionChange}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n title={currentActionStack.title}\n isInSubmenu={isInSubmenu}\n handleBack={handleBack}\n previousMenuTitle={\n stackHistory[stackHistory.length - 1]?.title\n }\n />\n )}\n\n {showCancel && (\n <>\n <DropdownMenu.Separator />\n <DropdownMenu.Item className=\"proton-ActionMenu__cancel-button\">\n <Button\n data-testid=\"ActionMenuItem-cancel\"\n onPress={handleClose}\n fullWidth\n variant=\"secondary\"\n >\n {cancelButtonText}\n </Button>\n </DropdownMenu.Item>\n </>\n )}\n </>\n )}\n </DropdownMenu.Content>\n </div>\n </div>\n </div>\n </div>\n </DropdownMenu.Root>\n </ScreenOverlay>\n );\n};\n\ninterface ActionMenuListProps {\n actions: ActionMenuAction[];\n selectionMode: ActionMenuSelectionMode;\n selectedKeys?: string[];\n onSelectionChange?: (keys: Selection) => void;\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n title?: ReactNode;\n isInSubmenu?: boolean;\n handleBack?: () => void;\n previousMenuTitle?: ReactNode;\n}\n\nconst ActionMenuList = ({\n actions,\n selectionMode,\n selectedKeys = [],\n onSelectionChange,\n disabledKeys = [],\n handleSubmenuOpen,\n title,\n isInSubmenu = false,\n handleBack,\n previousMenuTitle,\n}: ActionMenuListProps) => {\n const ActionMenuItemMap = () => (\n <>\n {isInSubmenu && handleBack && (\n <div className=\"proton-ActionMenu__back-button-container\">\n <DropdownMenu.Item\n className=\"proton-ActionMenu__back-button\"\n onSelect={(event) => {\n event.preventDefault();\n handleBack();\n }}\n aria-label={`Go back to ${previousMenuTitle || \"previous menu\"}`}\n >\n <ChevronLeft size={16} />\n </DropdownMenu.Item>\n <div\n className=\"proton-ActionMenu__title\"\n role=\"banner\"\n aria-label={isInSubmenu ? `Submenu: ${title}` : `Menu: ${title}`}\n >\n <span>{title}</span>\n </div>\n <DropdownMenu.Separator />\n </div>\n )}\n\n {actions.map((action, i) => {\n const itemProps = actions[i];\n return (\n <ActionMenuItem\n key={action.key}\n item={action}\n isSubmenu={Boolean(itemProps.children?.length)}\n selectionMode={selectionMode}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedKeys}\n disabledKeys={disabledKeys}\n handleSubmenuOpen={handleSubmenuOpen}\n />\n );\n })}\n </>\n );\n\n return (\n <div\n aria-disabled={selectionMode === \"none\"}\n className=\"proton-ActionMenu__list\"\n role=\"menu\"\n aria-label={\n title ? `${isInSubmenu ? \"Submenu\" : \"Menu\"}: ${title}` : \"Action menu\"\n }\n aria-orientation=\"vertical\"\n >\n {selectionMode === \"single\" ? (\n <DropdownMenu.RadioGroup\n value={selectedKeys?.[0] || \"\"}\n onValueChange={(value) => {\n // Check if this is a submenu item - if so, don't trigger selection change\n const action = actions.find((action) => action.key === value);\n if (action?.children?.length) {\n return;\n }\n\n if (onSelectionChange) {\n onSelectionChange(new Set([value]));\n }\n }}\n >\n <ActionMenuItemMap />\n </DropdownMenu.RadioGroup>\n ) : (\n <DropdownMenu.Group>\n <ActionMenuItemMap />\n </DropdownMenu.Group>\n )}\n </div>\n );\n};\n\ninterface ActionMenuItemProps {\n to?: string;\n item: ActionMenuAction;\n isSubmenu?: boolean;\n selectionMode: ActionMenuSelectionMode;\n onSelectionChange?: (keys: Selection) => void;\n selectedKeys?: string[];\n disabledKeys?: string[];\n handleSubmenuOpen: (key: string) => void;\n}\n\nconst ActionMenuItem = ({\n item,\n isSubmenu,\n selectionMode,\n onSelectionChange,\n selectedKeys = [],\n disabledKeys = [],\n handleSubmenuOpen,\n}: ActionMenuItemProps) => {\n const ref = useRef(null);\n const isExternal = item.to && isUrlExternal(item.to);\n const isDisabled = disabledKeys.includes(item.key);\n const isSelected = selectedKeys.includes(item.key);\n\n const radixItemProps = {\n className: \"proton-ActionMenu__item\",\n \"aria-label\": item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`,\n role: \"menuitem\",\n disabled: isDisabled,\n ref,\n };\n\n const onSelect = (event: Event) => {\n if (item?.children?.length) {\n event.preventDefault();\n handleSubmenuOpen(item.key);\n return;\n }\n if (item.onAction) {\n item.onAction(item.key);\n }\n };\n\n const content = (\n <>\n <div className=\"proton-ActionMenu__item-content\">\n <div className=\"proton-ActionMenu__item-label\">{item.label}</div>\n {item.description && (\n <div className=\"proton-ActionMenu__description\">\n {item.description}\n </div>\n )}\n </div>\n {isSubmenu && <ChevronRight size={16} />}\n </>\n );\n\n if (item.to) {\n return (\n <DropdownMenu.Item {...radixItemProps} key={item.key} asChild>\n <a\n aria-label={\n item.label\n ? `${item.label}${item.description ? `, ${item.description}` : \"\"}`\n : `ActionMenu-Item-${item.key}`\n }\n aria-disabled={isDisabled}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n href={item.to}\n target={isExternal ? \"_blank\" : undefined}\n rel={isExternal ? \"noopener noreferrer\" : undefined}\n onClick={(e: React.MouseEvent<HTMLAnchorElement>) => {\n if (isExternal || !item.to) {\n return;\n }\n handleInternalNavigation(e, item.to);\n }}\n >\n {content}\n </a>\n </DropdownMenu.Item>\n );\n }\n\n if (selectionMode === \"multiple\") {\n return (\n <DropdownMenu.CheckboxItem\n {...radixItemProps}\n key={item.key}\n checked={isSelected}\n onSelect={onSelect}\n onCheckedChange={(checked: boolean) => {\n if (!onSelectionChange) return;\n\n const currentKeys = new Set(selectedKeys);\n if (checked) {\n currentKeys.add(item.key);\n } else {\n currentKeys.delete(item.key);\n }\n onSelectionChange(currentKeys);\n }}\n >\n {content}\n </DropdownMenu.CheckboxItem>\n );\n }\n\n return (\n <DropdownMenu.RadioItem\n {...radixItemProps}\n value={item.key}\n key={item.key}\n aria-checked={isSelected}\n aria-expanded={isSubmenu ? false : undefined}\n onSelect={onSelect}\n >\n {content}\n </DropdownMenu.RadioItem>\n );\n};\n"],"names":["ActionMenu","isOpen","actions","children","showCancel","cancelButtonText","selectionMode","selectedKeys","disabledKeys","onSelectionChange","onClose","title","testId","useLockBodyScroll","contentHeight","setContentHeight","useState","stackHistory","setStackHistory","currentActionStack","setCurrentActionStack","contentRef","useRef","menuRef","overlayRef","isClosing","handleClose","useIsClosing","currentActions","hasActions","hasContent","isInSubmenu","handleSubmenuOpen","key","action","prevStackHistory","prevStack","handleBack","previousStack","useEffect","jsx","ScreenOverlay","jsxs","DropdownMenu","open","Fragment","ActionMenuList","_a","Button","previousMenuTitle","ActionMenuItemMap","event","ChevronLeft","itemProps","ActionMenuItem","value","item","isSubmenu","ref","isExternal","isUrlExternal","isDisabled","isSelected","radixItemProps","onSelect","content","ChevronRight","createElement","e","handleInternalNavigation","checked","currentKeys"],"mappings":";;;;;;;;;;;AA0FO,MAAMA,KAAa,CAAC;AAAA,EACzB,QAAAC;AAAA,EACA,SAAAC,IAAU,CAAC;AAAA,EACX,UAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,kBAAAC,IAAmB;AAAA,EACnB,eAAAC,IAAgB;AAAA,EAChB,cAAAC;AAAA,EACA,cAAAC,IAAe,CAAC;AAAA,EAChB,mBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAeC;AACjB,MAAuB;;AACrB,EAAAC,EAAkBZ,CAAM;AACxB,QAAM,CAACa,GAAeC,CAAgB,IAAIC,EAAiB,CAAC,GACtD,CAACC,GAAcC,CAAe,IAAIF,EAAwB,CAAE,CAAA,GAC5D,CAACG,GAAoBC,CAAqB,IAAIJ,EAAsB;AAAA,IACxE,OAAAL;AAAA,IACA,SAAAT;AAAA,IACA,KAAK;AAAA,IACL,aAAa;AAAA,EAAA,CACd,GACKmB,IAAaC,EAAuB,IAAI,GACxCC,IAAUD,EAAuB,IAAI,GACrCE,IAAaF,EAAuB,IAAI,GACxC,EAAE,WAAAG,GAAW,aAAAC,EAAY,IAAIC,EAAa,EAAE,SAAAjB,GAAS,YAAAc,GAAY,GAEjEI,IAAiBT,EAAmB,WAAW,IAC/CU,IAAaD,KAAkBA,EAAe,SAAS,GACvDE,IAAa3B,KAAY0B,KAAczB,GACvC2B,IAAcd,EAAa,SAAS;AAE1C,WAASe,EAAkBC,GAAa;AACtC,UAAMC,IAASN,EAAe,KAAK,CAACM,MAAWA,EAAO,QAAQD,CAAG;AACjE,QAAI,CAACC,GAAQ;AACH,cAAA,MAAM,mBAAmBD,CAAG,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Symbol.toStringTag,{value:"Module"});const n=require("../../node_modules/react/jsx-runtime.cjs.js"),o=require("react"),h=require("../Button/Button.cjs.js");;/* empty css */const a=require("../../utils/string.cjs.js"),x={success:n.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 20 20",height:"18",width:"18",children:n.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"})}),warning:n.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 56 56",height:"17",width:"17",children:n.jsxRuntimeExports.jsx("path",{d:"M9.59 50.207h36.82c3.516 0 5.719-2.531 5.719-5.719a5.56 5.56 0 0 0-.75-2.812l-18.445-33c-1.055-1.899-2.977-2.883-4.922-2.883c-1.922 0-3.89.984-4.946 2.883L4.645 41.699c-.516.89-.774 1.828-.774 2.79c0 3.187 2.227 5.718 5.719 5.718m18.422-16.055c-1.242 0-1.922-.703-1.969-1.968l-.328-11.578c-.047-1.266.937-2.204 2.273-2.204c1.313 0 2.344.961 2.297 2.227l-.351 11.555c-.047 1.289-.727 1.968-1.922 1.968m0 8.649c-1.36 0-2.625-1.078-2.625-2.532s1.242-2.53 2.625-2.53s2.625 1.054 2.625 2.53c0 1.477-1.266 2.532-2.625 2.532"})}),danger:n.jsxRuntimeExports.jsx("svg",{viewBox:"0 0 20 20",height:"18",width:"18",children:n.jsxRuntimeExports.jsx("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z"})})},N={default:"default",success:"success",warning:"warning",danger:"danger"},c=o.createContext(void 0),s=({variant:t="default",rounded:e=!0,icon:r=!1,compact:i=!0,children:m,"data-testid":j})=>n.jsxRuntimeExports.jsx(c.Provider,{value:t,children:n.jsxRuntimeExports.jsx("div",{role:"status","aria-live":"polite",className:a.csx("proton-Banner",`proton-Banner--${t}`,e&&"proton-Banner--rounded"),"data-testid":j,children:n.jsxRuntimeExports.jsxs("div",{className:a.csx("proton-Banner__wrapper",i&&"proton-Banner__wrapper--compact"),children:[n.jsxRuntimeExports.jsx(s.Icon,{icon:r}),n.jsxRuntimeExports.jsx("div",{className:"proton-Banner__content-wrapper",children:n.jsxRuntimeExports.jsx("div",{className:"proton-Banner__container",children:m})})]})})});s.displayName="Banner";const d=({children:t,"data-testid":e})=>{const r=o.useContext(c);if(!r)throw new Error("BannerTitle must be used within a Banner");return n.jsxRuntimeExports.jsx("h3",{className:a.csx("proton-Banner__title",`proton-Banner--${r}__title`),"data-testid":e,children:t})};d.displayName="Banner.Title";const u=({children:t,"data-testid":e})=>{const r=o.useContext(c);if(!r)throw new Error("BannerContent must be used within a Banner");return n.jsxRuntimeExports.jsx("p",{className:a.csx("proton-Banner__content",`proton-Banner--${r}__content`),"data-testid":e,children:t})};u.displayName="Banner.Content";function R(t,e){return o.isValidElement(t)?t:t?x[e]:null}const l=({icon:t,"data-testid":e})=>{const r=o.useContext(c);if(!r)throw new Error("BannerIcon must be used within a Banner");const i=R(t,r);return i?n.jsxRuntimeExports.jsx("div",{"aria-hidden":"true","data-testid":e,className:a.csx("proton-Banner__icon",`proton-Banner--${r}__icon`),children:i}):null};l.displayName="Banner.Icon";const p=({children:t,...e})=>n.jsxRuntimeExports.jsx(h.Button,{...e,children:t});p.displayName="Banner.Action";const B=({children:t})=>n.jsxRuntimeExports.jsx("div",{className:"proton-Banner__actions",children:t});B.displayName="Banner.Actions";s.Title=d;s.Content=u;s.Icon=l;s.Action=p;s.Actions=B;exports.BANNER_ICONS=x;exports.BANNER_VARIANTS=N;exports.Banner=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../../node_modules/react/jsx-runtime.cjs.js"),a=require("react"),_=require("../Button/Button.cjs.js");;/* empty css */const s=require("../../utils/string.cjs.js"),N=require("../Icon/IconComponents/SuccessCircle.cjs.js"),j=require("../Icon/IconComponents/WarningTriangle.cjs.js"),g=require("../Icon/IconComponents/DangerCircle.cjs.js"),E={success:"var(--proton-color__success-light)",warning:"var(--proton-color__warning-light)",danger:"var(--proton-color__danger-light)"},C={success:N.SuccessCircle,warning:j.WarningTriangle,danger:g.DangerCircle},R={default:"default",success:"success",warning:"warning",danger:"danger"},c=a.createContext(void 0),o=({variant:n="default",rounded:e=!0,icon:t=!1,compact:i=!0,children:B,"data-testid":m})=>r.jsxRuntimeExports.jsx(c.Provider,{value:n,children:r.jsxRuntimeExports.jsx("div",{role:"status","aria-live":"polite",className:s.csx("proton-Banner",`proton-Banner--${n}`,e&&"proton-Banner--rounded"),"data-testid":m,children:r.jsxRuntimeExports.jsxs("div",{className:s.csx("proton-Banner__wrapper",i&&"proton-Banner__wrapper--compact"),children:[r.jsxRuntimeExports.jsx(o.Icon,{icon:t}),r.jsxRuntimeExports.jsx("div",{className:"proton-Banner__content-wrapper",children:r.jsxRuntimeExports.jsx("div",{className:"proton-Banner__container",children:B})})]})})});o.displayName="ProtonUIBanner";const u=({children:n,"data-testid":e})=>{const t=a.useContext(c);if(!t)throw new Error("BannerTitle must be used within a Banner");return r.jsxRuntimeExports.jsx("h3",{className:s.csx("proton-Banner__title",`proton-Banner--${t}__title`),"data-testid":e,children:n})};u.displayName="ProtonUIBanner.Title";const l=({children:n,"data-testid":e})=>{const t=a.useContext(c);if(!t)throw new Error("BannerContent must be used within a Banner");return r.jsxRuntimeExports.jsx("p",{className:s.csx("proton-Banner__content",`proton-Banner--${t}__content`),"data-testid":e,children:n})};l.displayName="ProtonUIBanner.Content";function w(n,e){if(a.isValidElement(n))return n;if(n&&e!=="default"){const t=C[e];if(t)return r.jsxRuntimeExports.jsx(t,{size:18,color:E[e]})}return null}const d=({icon:n,"data-testid":e})=>{const t=a.useContext(c);if(!t)throw new Error("BannerIcon must be used within a Banner");const i=w(n,t);return i?r.jsxRuntimeExports.jsx("div",{"aria-hidden":"true","data-testid":e,className:s.csx("proton-Banner__icon",`proton-Banner--${t}__icon`),children:i}):null};d.displayName="ProtonUIBanner.Icon";const x=({children:n,...e})=>r.jsxRuntimeExports.jsx(_.Button,{...e,children:n});x.displayName="ProtonUIBanner.Action";const p=({children:n})=>r.jsxRuntimeExports.jsx("div",{className:"proton-Banner__actions",children:n});p.displayName="ProtonUIBanner.Actions";o.Title=u;o.Content=l;o.Icon=d;o.Action=x;o.Actions=p;exports.BANNER_VARIANTS=R;exports.Banner=o;
2
2
  //# sourceMappingURL=Banner.cjs.js.map